6ec243d6
wuxw
v1.9 点击提交后,成功提示没有...
|
1
|
<template>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
2
|
<el-dialog :title="$t('contractManage.edit.title')" :visible.sync="visible" width="70%" :before-close="handleClose">
|
8fb25d6e
wuxw
优化相关bug
|
3
|
<el-form :model="editContractInfo" label-width="120px" class="text-left" ref="editForm">
|
bc37d685
wuxw
开发完成合同功能
|
4
5
6
|
<el-row :gutter="20">
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.contractName')" prop="contractName" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
7
8
|
<el-input v-model="editContractInfo.contractName"
:placeholder="$t('contractManage.edit.contractNamePlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
9
10
11
12
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.contractCode')" prop="contractCode" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
13
14
|
<el-input v-model="editContractInfo.contractCode"
:placeholder="$t('contractManage.edit.contractCodePlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
15
16
17
18
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.contractType')" prop="contractType" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
19
20
21
22
|
<el-select v-model="editContractInfo.contractType"
:placeholder="$t('contractManage.edit.contractTypePlaceholder')" style="width:100%" disabled>
<el-option v-for="item in editContractInfo.contractTypes" :key="item.contractTypeId"
:label="item.typeName" :value="item.contractTypeId" />
|
bc37d685
wuxw
开发完成合同功能
|
23
24
25
26
27
28
29
30
|
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.partyA')" prop="partyA" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
31
|
<el-input v-model="editContractInfo.partyA" :placeholder="$t('contractManage.edit.partyAPlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
32
33
34
35
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.aContacts')" prop="aContacts" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
36
37
|
<el-input v-model="editContractInfo.aContacts"
:placeholder="$t('contractManage.edit.aContactsPlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
38
39
40
41
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.aLink')" prop="aLink" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
42
|
<el-input v-model="editContractInfo.aLink" :placeholder="$t('contractManage.edit.aLinkPlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
43
44
45
46
47
48
49
|
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.partyB')" prop="partyB" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
50
|
<el-input v-model="editContractInfo.partyB" :placeholder="$t('contractManage.edit.partyBPlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
51
52
53
54
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.bContacts')" prop="bContacts" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
55
56
|
<el-input v-model="editContractInfo.bContacts"
:placeholder="$t('contractManage.edit.bContactsPlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
57
58
59
60
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.bLink')" prop="bLink" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
61
|
<el-input v-model="editContractInfo.bLink" :placeholder="$t('contractManage.edit.bLinkPlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
62
63
64
65
66
67
68
|
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.operator')" prop="operator" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
69
70
|
<el-input v-model="editContractInfo.operator"
:placeholder="$t('contractManage.edit.operatorPlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
71
72
73
74
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.operatorLink')" prop="operatorLink" required>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
75
76
|
<el-input v-model="editContractInfo.operatorLink"
:placeholder="$t('contractManage.edit.operatorLinkPlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
77
78
79
80
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.amount')" prop="amount">
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
81
|
<el-input v-model="editContractInfo.amount" :placeholder="$t('contractManage.edit.amountPlaceholder')" />
|
bc37d685
wuxw
开发完成合同功能
|
82
83
84
85
86
87
88
|
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.startTime')" prop="startTime" required>
|
b25b036d
wuxw
v1.9 优化日期
|
89
|
<el-date-picker v-model="editContractInfo.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
90
|
:placeholder="$t('contractManage.edit.startTimePlaceholder')" style="width:100%" />
|
bc37d685
wuxw
开发完成合同功能
|
91
92
93
94
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.endTime')" prop="endTime" required>
|
b25b036d
wuxw
v1.9 优化日期
|
95
|
<el-date-picker v-model="editContractInfo.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
96
|
:placeholder="$t('contractManage.edit.endTimePlaceholder')" style="width:100%" />
|
bc37d685
wuxw
开发完成合同功能
|
97
98
99
100
|
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item :label="$t('contractManage.edit.signingTime')" prop="signingTime" required>
|
b25b036d
wuxw
v1.9 优化日期
|
101
|
<el-date-picker v-model="editContractInfo.signingTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
102
|
:placeholder="$t('contractManage.edit.signingTimePlaceholder')" style="width:100%" />
|
bc37d685
wuxw
开发完成合同功能
|
103
104
105
106
107
|
</el-form-item>
</el-col>
</el-row>
<!-- 合同类型规格 -->
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
108
|
<div v-for="(item, index) in editContractInfo.contractTypeSpecs" :key="index">
|
bc37d685
wuxw
开发完成合同功能
|
109
110
111
112
|
<el-row :gutter="20" v-if="index % 3 === 0">
<el-col :span="8" v-for="i in 3" :key="i">
<div v-if="editContractInfo.contractTypeSpecs[index + i - 1]">
<el-form-item :label="editContractInfo.contractTypeSpecs[index + i - 1].specName">
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
113
114
|
<el-input v-model="editContractInfo.contractTypeSpecs[index + i - 1].value"
:placeholder="editContractInfo.contractTypeSpecs[index + i - 1].specHoldplace" />
|
bc37d685
wuxw
开发完成合同功能
|
115
116
117
118
119
120
121
122
123
124
125
|
</el-form-item>
</div>
</el-col>
</el-row>
</div>
<!-- 合同附件 -->
<el-form-item :label="$t('contractManage.edit.contractFiles')">
<el-button type="primary" @click="addFileStep">
{{ $t('contractManage.edit.addFile') }}
</el-button>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
126
|
<div v-for="(item, index) in editContractInfo.contractFilePo" :key="index" style="margin-top:10px">
|
bc37d685
wuxw
开发完成合同功能
|
127
128
|
<el-row :gutter="10">
<el-col :span="2">
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
129
|
<span>{{ $t('contractManage.edit.fileIndex', { index: index + 1 }) }}</span>
|
bc37d685
wuxw
开发完成合同功能
|
130
131
|
</el-col>
<el-col :span="10">
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
132
133
|
<input type="file" style="display:inline-block;width:100%" @change="getFile($event, index)"
accept=".png,.pdf,.jpg" />
|
bc37d685
wuxw
开发完成合同功能
|
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
</el-col>
<el-col :span="6">
<span>{{ item.fileRealName }}</span>
</el-col>
<el-col :span="4">
<el-button type="text" @click="deleteStep(item)">
{{ $t('contractManage.edit.deleteFile') }}
</el-button>
</el-col>
</el-row>
</div>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose">{{ $t('contractManage.edit.cancel') }}</el-button>
<el-button type="primary" @click="editContract">{{ $t('contractManage.edit.save') }}</el-button>
</span>
</el-dialog>
</template>
<script>
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
156
157
|
import { updateContract, queryContractTypeSpec, queryContractFile } from '@/api/contract/contractManageApi'
import { uploadFile } from '@/api/system/paymentPoolApi'
|
bc37d685
wuxw
开发完成合同功能
|
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
export default {
name: 'EditContract',
data() {
return {
visible: false,
editContractInfo: {
contractId: '',
contractName: '',
contractCode: '',
contractType: '',
partyA: '',
partyB: '',
aContacts: '',
bContacts: '',
aLink: '',
bLink: '',
operator: '',
operatorLink: '',
amount: '',
startTime: '',
endTime: '',
signingTime: '',
contractTypes: [],
contractTypeSpecs: [],
tempfile: null,
contractFilePo: []
}
}
},
methods: {
open(contract) {
this.resetForm()
this.editContractInfo = {
...this.editContractInfo,
...contract,
contractTypes: this.editContractInfo.contractTypes
}
this.loadContractType(contract)
this.loadFiles()
this.visible = true
},
handleClose() {
this.visible = false
},
resetForm() {
this.editContractInfo = {
contractId: '',
contractName: '',
contractCode: '',
contractType: '',
partyA: '',
partyB: '',
aContacts: '',
bContacts: '',
aLink: '',
bLink: '',
operator: '',
operatorLink: '',
amount: '',
startTime: '',
endTime: '',
signingTime: '',
contractTypes: this.editContractInfo.contractTypes,
contractTypeSpecs: [],
tempfile: null,
contractFilePo: []
}
},
async loadContractType(contract) {
try {
const params = {
page: 1,
row: 100,
contractTypeId: contract.contractType
}
const { data } = await queryContractTypeSpec(params)
this.editContractInfo.contractTypeSpecs = data.map(item => {
const attr = contract.attrs.find(attr => attr.specCd === item.specCd) || {}
return {
...item,
value: attr.value || ''
}
}).filter(item => item.specShow === 'Y')
} catch (error) {
console.error('加载合同类型规格失败:', error)
}
},
async loadFiles() {
try {
const params = {
contractId: this.editContractInfo.contractId,
page: 1,
row: 100
}
const { data } = await queryContractFile(params)
this.editContractInfo.contractFilePo = data.map((file, index) => ({
seq: index,
fileSaveName: file.fileSaveName,
fileRealName: file.fileRealName
}))
} catch (error) {
console.error('加载合同文件失败:', error)
}
},
addFileStep() {
const newFile = {
seq: this.editContractInfo.contractFilePo.length,
fileSaveName: '',
fileRealName: ''
}
this.editContractInfo.contractFilePo.push(newFile)
},
deleteStep(step) {
this.editContractInfo.contractFilePo = this.editContractInfo.contractFilePo.filter(
item => item.seq !== step.seq
)
},
getFile(event, index) {
const file = event.target.files[0]
if (!file) return
if (!this.checkFileType(file.name.split('.').pop())) {
this.$message.error(this.$t('contractManage.edit.fileTypeError'))
return
}
this.editContractInfo.tempfile = file
this.editContractInfo.contractFilePo[index].fileRealName = file.name
this.uploadFile(index)
},
checkFileType(fileType) {
const acceptTypes = ['png', 'pdf', 'jpg']
return acceptTypes.includes(fileType.toLowerCase())
},
async uploadFile(index) {
try {
const formData = new FormData()
formData.append('uploadFile', this.editContractInfo.tempfile)
|
62011a14
wuxw
v1.9 修复合同上传附件bug 修复
|
298
299
|
const data = await uploadFile(formData,{})
this.editContractInfo.contractFilePo[index].fileSaveName = data.realFileName
|
6ec243d6
wuxw
v1.9 点击提交后,成功提示没有...
|
300
|
this.$message.success(this.$t('common.operationSuccess'))
|
bc37d685
wuxw
开发完成合同功能
|
301
302
303
304
305
306
307
308
|
} catch (error) {
console.error('上传文件失败:', error)
this.$message.error(this.$t('contractManage.edit.uploadError'))
}
},
async editContract() {
try {
await updateContract(this.editContractInfo)
|
6ec243d6
wuxw
v1.9 点击提交后,成功提示没有...
|
309
|
this.$message.success(this.$t('common.operationSuccess'))
|
bc37d685
wuxw
开发完成合同功能
|
310
311
312
313
314
315
316
317
318
319
|
this.$emit('success')
this.handleClose()
} catch (error) {
console.error('保存合同失败:', error)
this.$message.error(error.message || this.$t('contractManage.edit.saveError'))
}
}
}
}
</script>
|