index.vue
6.57 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!--
* @Description:补充材料通知书
* @Autor: renchao
* @LastEditTime: 2024-03-27 11:24:03
-->
<template>
<div class="clmlmx-box">
<lb-table :column="column" :key="key" row-key="bsmSj" ref="table" :heightNumSetting="true" :calcHeight="600"
:pagination="false" :data="tableData" @row-click="handleRowClick" @selection-change="handleSelectionChange">
</lb-table>
<div class="text-center">
<el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleSubmit" :loading="loading">打印</el-button>
</div>
</div>
</template>
<script>
import Vue from 'vue'
import store from '@/store/index.js'
import { ywPopupCacel } from "@/utils/popup.js";
import { getLodop } from "@/utils/LodopFuncs";
import { updateClml, InitClml } from "@/api/clxx.js";
import { getNewDate } from '@/utils/util'
import { getPrintTemplateByCode, getPrintSupplementalMaterials } from "@/api/print";
export default {
props: {
formData: {
type: Object,
default: () => {
return {}
}
}
},
data () {
return {
selectList: [],
loading: false,
sortable: null,
newDate: getNewDate(),
column: [
{
type: 'selection',
label: '全选',
width: '60'
},
{
label: "材料名称",
render: (h, scope) => {
return (
(this.formData.ableOperation && scope.row.sfxjcl == '1') ?
<el-input value={scope.row.sjmc} onInput={(val) => { scope.row.sjmc = val }}></el-input> : <span>{scope.row.sjmc}</span>
)
}
},
{
label: "份数",
render: (h, scope) => {
if (scope.row.ys && scope.row.ys > 0) {
return (
<div>
<span>{scope.row.ys}</span>
</div>
);
} else {
return (
<div>
<span>0</span>
</div>
);
}
}
},
{
label: "材料类型",
render: (h, scope) => {
return (
this.formData.ableOperation ?
<el-select value={scope.row.sjlx}
onChange={(val) => { scope.row.sjlx = val }}>
{
store.getters.dictData['A40'].map(option => {
return (
<el-option label={option.dname} value={option.dcode}></el-option>
)
})
}
</el-select> : <span>{this.dicStatus(scope.row.sjlx, "A40")}</span>
)
}
}
],
key: 0,
tableData: []
}
},
mounted () {
var formdata = new FormData();
formdata.append("bsmSlsq", this.formData.bsmSlsq ? this.formData.bsmSlsq : '');
formdata.append("bsmSldy", this.formData.bsmSldy ? this.formData.bsmSldy : '');
console.log(this.formData);
InitClml(formdata).then((res) => {
if (res.code == 200) {
if (res.result && res.result.length > 0) {
this.tableData = res.result
this.key++
}
} else {
this.$message.error(res.message);
}
})
},
beforeDestroy () {
if (this.sortable) {
this.sortable.destroy();
}
},
methods: {
handleSelectionChange (val) {
this.selectList = val
},
handleRowClick (row) {
let refs = 'table';
this.$refs[refs].toggleRowSelection(row)
},
handleCancel () {
ywPopupCacel()
},
handleSubmit () {
this.loading = true
if (this.selectList.length == 0) {
this.$message.error('请先选择材料目录')
this.loading = false
return
}
getPrintTemplateByCode({ tmpno: 'bdcdjbccltts' }).then(res => {
if (res.code === 200) {
getPrintSupplementalMaterials(this.formData.bsmSldy, this.selectList).then(infoRes => {
this.loading = false
if (infoRes.code === 200) {
if (infoRes.result.fileList && infoRes.result.fileList.length > 0) {
infoRes.result.fileList.forEach((it, index) => {
let key = index + 1
this.$set(infoRes.result, "file" + key, it.sjmc)
this.$set(infoRes.result, "file" + key + 'ys', it.ys)
this.$set(infoRes.result, "file" + key + 'lx', it.sjlx == 1 ? "原件" : "复印件")
})
}
infoRes.result.nownian = this.newDate.split(' ')[0].split('年')[0]
infoRes.result.nowyue = this.newDate.slice(5, 7)
infoRes.result.nowri = this.newDate.slice(8, 10)
let date = infoRes.result.sqrq
infoRes.result.sqnian = date.split(' ')[0].split('-')[0]
infoRes.result.sqyue = date.split(' ')[0].split('-')[1]
infoRes.result.sqri = date.split(' ')[0].split('-')[2]
console.log(infoRes.result)
let LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
// 装载第一个模板并设置数据
LODOP.ADD_PRINT_DATA("ProgramData", res.result.tmpcontent);
for (let key in infoRes.result) {
LODOP.SET_PRINT_STYLEA(key, "CONTENT", infoRes.result[key]);
}
// 进行预览
LODOP.PREVIEW();
} else {
this.$message.error(infoRes.message);
}
}).catch(() => {
this.loading = false
})
} else {
this.loading = false
this.$message.error(res.message);
}
})
},
dicStatus (val, code) {
let data = store.getters.dictData[code],
name = '暂无'
if (data) {
data.map((item) => {
if (item.dcode == val) {
name = item.dname
}
})
return name
}
},
}
}
</script>
<style scoped lang='scss'>
@import "~@/styles/mixin.scss";
.clmlmx-box {
margin: 0 auto;
.title {
text-align: center;
height: 60px;
line-height: 60px;
border: 1px solid #dfe6ec;
font-size: 20px;
background: #81d3f81a;
margin-bottom: -1px;
}
}
</style>