index.vue
4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<template>
<div>
<GLDialog bigTitle="选择合同"
mode="big"
:visible.sync="changeContractObj.visible"
:before-close="handleClose"
:close-on-click-modal="false"
@onOk="handleConfirm"
@onCancel="handleClose">
<glsx-combi-form ref="showSearch"
labelWidth="105px"
:formObj="searchForm"
:formData="searchFormData">
<span slot="footer">
<el-button :size="size"
type="primary"
@click="getTable">查询</el-button>
</span>
</glsx-combi-form>
<GLTable :hasNum="false" ref="contractTableRef" :noDataImg="url" :getListApi="getListApi" :searchForm="searchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
<div slot="radioSlot" slot-scope="scope">
<el-radio v-model="curId" :label="scope.scope.id"> </el-radio>
</div>
<span slot="auth-button" slot-scope="scope" :data="scope.scope">
<GLTableButton :buttonList="buttonList" :buttonItem="scope" :buttonNum="3"></GLTableButton>
</span>
</GLTable>
</GLDialog>
<pdf-dialog :isVisible="isPdfVisible" title="合同" :pdfUrl="pdfUrl" @closeDialog="handlePdfClose"></pdf-dialog>
</div>
</template>
<script>
import url from '@/assets/empty.png'
import pdfDialog from '@/views/beforeSale/pdfDialog'
import glsxCombiForm from '@/components/glsx-combi-form'
export default {
name: 'changeContract',
components: {
pdfDialog,
glsxCombiForm
},
props: {
changeContractObj: {
type: Object,
default: ()=>{}
}
},
data() {
return {
size: 'small',
isPdfVisible: false,
pdfUrl: '',
curId: '',
pageConf: { pageSize: 'pageSize', pageNum: 'pageNum', totalCount: 'total' },
getListApi: this.$apis.contractManager.getContractListApi,
searchForm: {
id: '',
},
buttonList: [
{
type: 'el-button',
name: row => {
return '预览'
},
attrs: {
type: 'text'
},
listeners: {
click: row => this.handlePdf(row.scope)
}
}
],
searchFormData: [
{
label: '合同编号',
name: 'id',
type: 'input',
isClear: true,
}
],
tableParams: {
listName: 'list',
tableOption: {
width: '100px'
},
tableColumns: [
{
label: '',
prop: 'radioSlot',
addHtml: 'radioSlot',
width: '50'
},
{
label: '合同编号',
prop: 'id',
},
{
label: '关联商品',
prop: 'packageName'
},
]
},
}
},
mounted() {
},
methods: {
handlePdfClose() {
this.isPdfVisible = !this.isPdfVisible
},
// 打印
handlePdf(row) {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.3)'
})
this.$apis.contractManager.printContractApi({ packageCode : row.packageCode , merchantId: row.merchantId }).then(res => {
this.pdfUrl = res
this.handlePdfClose()
loading.close()
})
},
beforeSearchFn() {
return new Promise(resolve => {
resolve()
})
},
getTable(){
this.$refs.contractTableRef.refreshTable()
},
handleConfirm(){
if(!this.curId) return this.$message.error('请选择变更模板的合同')
const params = {
sourceId: this.curId,
targetId: this.changeContractObj.id
}
this.$apis.contractManager.copyTemplateApi(params).then(res=>{
if(res) {
this.$message.success('变更模板成功')
this.handleClose()
}
})
},
handleClose(){
this.changeContractObj.visible = false
}
}
}
</script>
<style lang="scss">
</style>