|
|
|
|
@ -6,7 +6,14 @@ |
|
|
|
|
width="30%" |
|
|
|
|
@close="closeDialog" |
|
|
|
|
> |
|
|
|
|
<avue-form ref="form" :option="option"></avue-form> |
|
|
|
|
<avue-form |
|
|
|
|
ref="form" |
|
|
|
|
:option="option" |
|
|
|
|
v-model="formData" |
|
|
|
|
:upload-after="uploadAfter" |
|
|
|
|
:upload-exceed="uploadExceed" |
|
|
|
|
:upload-delete="uploadDelete" |
|
|
|
|
></avue-form> |
|
|
|
|
|
|
|
|
|
<template #footer> |
|
|
|
|
<span class="dialog-footer"> |
|
|
|
|
@ -17,6 +24,7 @@ |
|
|
|
|
</el-dialog> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import { saveItem, updateItem ,userList} from '@/api/exemption/exemption'; |
|
|
|
|
// import { |
|
|
|
|
// updateProcess, |
|
|
|
|
// } from '../../api/flowManagement/index'; |
|
|
|
|
@ -30,76 +38,100 @@ export default { |
|
|
|
|
type: String, |
|
|
|
|
default: '新增', |
|
|
|
|
}, |
|
|
|
|
rowItem: { |
|
|
|
|
type: Object, |
|
|
|
|
default: () => {}, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
attachLink:'', |
|
|
|
|
openShow: false, |
|
|
|
|
formData: {}, |
|
|
|
|
userListData: [], |
|
|
|
|
option: { |
|
|
|
|
submitBtn: false, |
|
|
|
|
emptyBtn: false, |
|
|
|
|
labelWidth: 100, |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: '提出人', |
|
|
|
|
prop: 'reportUserId', |
|
|
|
|
type: 'select', |
|
|
|
|
span: 24, |
|
|
|
|
rules: [{ required: true, message: '请选择提出人', trigger: 'change' }], |
|
|
|
|
dicData: [], |
|
|
|
|
props: { |
|
|
|
|
label: 'label', |
|
|
|
|
value: 'value', |
|
|
|
|
}, |
|
|
|
|
filterable: true, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '岗位', |
|
|
|
|
prop: 'postName', |
|
|
|
|
span: 24, |
|
|
|
|
rules: [{ required: true, message: '请输入岗位', trigger: 'blur' }], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '发生时间', |
|
|
|
|
prop: 'happenDate', |
|
|
|
|
type: 'date', |
|
|
|
|
span: 24, |
|
|
|
|
rules: [{ required: true, message: '请选择发生时间', trigger: 'change' }], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '问题描述', |
|
|
|
|
prop: 'input', |
|
|
|
|
label: '免责问题描述', |
|
|
|
|
prop: 'notes', |
|
|
|
|
type: 'textarea', |
|
|
|
|
rows: 3, |
|
|
|
|
span: 24, |
|
|
|
|
rules: [{ required: true, message: '请输入', trigger: 'blur' }], |
|
|
|
|
rules: [{ required: true, message: '请输入免责问题描述', trigger: 'blur' }], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '原因', |
|
|
|
|
prop: 'input2', |
|
|
|
|
// type: 'textarea', |
|
|
|
|
prop: 'reason', |
|
|
|
|
type: 'textarea', |
|
|
|
|
rows: 3, |
|
|
|
|
span: 24, |
|
|
|
|
rules: [{ required: true, message: '请输入', trigger: 'blur' }], |
|
|
|
|
rules: [{ required: true, message: '请输入原因', trigger: 'blur' }], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '措施', |
|
|
|
|
prop: 'input2', |
|
|
|
|
// type: 'textarea', |
|
|
|
|
span: 24, |
|
|
|
|
prop: 'measure', |
|
|
|
|
type: 'textarea', |
|
|
|
|
rows: 3, |
|
|
|
|
rules: [{ required: true, message: '请输入', trigger: 'blur' }], |
|
|
|
|
span: 24, |
|
|
|
|
rules: [{ required: true, message: '请输入措施', trigger: 'blur' }], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '免责理由', |
|
|
|
|
prop: 'input2', |
|
|
|
|
// type: 'textarea', |
|
|
|
|
span: 24, |
|
|
|
|
prop: 'raiseHandReason', |
|
|
|
|
type: 'textarea', |
|
|
|
|
rows: 3, |
|
|
|
|
rules: [{ required: true, message: '请输入', trigger: 'blur' }], |
|
|
|
|
span: 24, |
|
|
|
|
rules: [{ required: true, message: '请输入免责理由', trigger: 'blur' }], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '免责金额', |
|
|
|
|
prop: 'input2', |
|
|
|
|
prop: 'amount', |
|
|
|
|
type: 'number', |
|
|
|
|
span: 24, |
|
|
|
|
rules: [{ required: true, message: '请输入', trigger: 'blur' }], |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '审核工艺员', |
|
|
|
|
prop: 'input2', |
|
|
|
|
type: 'select', |
|
|
|
|
span: 24, |
|
|
|
|
rules: [{ required: true, message: '请选择', trigger: 'blur' }], |
|
|
|
|
dicData: [ |
|
|
|
|
{ |
|
|
|
|
label: '张三', |
|
|
|
|
value: '1', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
rules: [{ required: true, message: '请输入免责金额', trigger: 'blur' }], |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
label: '固化文件', |
|
|
|
|
prop: 'imgUrl', |
|
|
|
|
prop: 'fileUrl', |
|
|
|
|
type: 'upload', |
|
|
|
|
multiple: true, |
|
|
|
|
span: 24, |
|
|
|
|
// propsHttp: { |
|
|
|
|
// url: 'url', |
|
|
|
|
// name: 'name', |
|
|
|
|
// res: 'data', |
|
|
|
|
// }, |
|
|
|
|
// action, |
|
|
|
|
propsHttp: { |
|
|
|
|
res: 'data', |
|
|
|
|
url: 'link', |
|
|
|
|
name: 'originalName', |
|
|
|
|
}, |
|
|
|
|
action: '/blade-resource/oss/endpoint/put-file-attach', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
@ -107,28 +139,119 @@ export default { |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
this.openShow = this.showDialog; |
|
|
|
|
this.loadUserList({ currentPage: 1, pageSize: 10 }); |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
rowItem: { |
|
|
|
|
handler(newVal) { |
|
|
|
|
if (newVal && Object.keys(newVal).length > 0) { |
|
|
|
|
// 修改模式,回显数据 |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
const formData = { ...newVal }; |
|
|
|
|
// 确保 reportUserId 类型与 userListData 中的 value 类型一致(转换为字符串) |
|
|
|
|
if (formData.reportUserId !== undefined && formData.reportUserId !== null) { |
|
|
|
|
formData.reportUserId = String(formData.reportUserId); |
|
|
|
|
} |
|
|
|
|
this.formData = formData; |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
// 新增模式,清空表单 |
|
|
|
|
this.formData = {}; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
immediate: true, |
|
|
|
|
deep: true, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
loadUserList(page, params = {}) { |
|
|
|
|
|
|
|
|
|
userList(page.currentPage, page.pageSize).then(res => { |
|
|
|
|
console.log('用户列表接口返回', res); |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
const users = res.data.data; |
|
|
|
|
console.log('用户列表数据', users); |
|
|
|
|
|
|
|
|
|
this.userListData = users.map(user => ({ |
|
|
|
|
label: user.realName || user.name, |
|
|
|
|
value: String(user.id) |
|
|
|
|
})); |
|
|
|
|
console.log('转换后的 userListData', this.userListData); |
|
|
|
|
|
|
|
|
|
// 同步到 option 的 dicData |
|
|
|
|
this.option.column[0].dicData = this.userListData; |
|
|
|
|
} |
|
|
|
|
}).catch(error => { |
|
|
|
|
console.error('获取用户列表失败', error); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
uploadAfter(res, done, loading, column) { |
|
|
|
|
console.log('uploadAfter1', res, done, loading, column); |
|
|
|
|
this.attachLink = res.link; |
|
|
|
|
// this.fileForm.excelFile = [res.link]; |
|
|
|
|
// done(); |
|
|
|
|
}, |
|
|
|
|
uploadDelete(file, column) { |
|
|
|
|
console.log('uploadDelete', file, column); |
|
|
|
|
this.attachLink = ''; |
|
|
|
|
}, |
|
|
|
|
uploadExceed(limit, files, fileList, column) { |
|
|
|
|
this.$message.error('最多只能上传一个文件'); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
closeDialog() { |
|
|
|
|
this.openShow = false; |
|
|
|
|
this.formData = {}; |
|
|
|
|
this.attachLink = ''; |
|
|
|
|
this.$emit('closeDialog'); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
submit() { |
|
|
|
|
this.$refs.form.validate(async valid => { |
|
|
|
|
if (valid) { |
|
|
|
|
let params = { |
|
|
|
|
id: this.$route.query.id, |
|
|
|
|
approvalStatus: '', |
|
|
|
|
|
|
|
|
|
// status: this.option.column[0].value, |
|
|
|
|
// reason: this.option.column[1].value, |
|
|
|
|
...this.formData, |
|
|
|
|
}; |
|
|
|
|
// updateProcess(params).then((res) => { |
|
|
|
|
// if (res.code == 200) { |
|
|
|
|
// this.$message.success('操作成功'); |
|
|
|
|
// this.closeDialog(); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
// 处理日期格式:将日期转换为 yyyy-MM-dd 格式 |
|
|
|
|
if (params.happenDate) { |
|
|
|
|
const date = new Date(params.happenDate); |
|
|
|
|
const year = date.getFullYear(); |
|
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0'); |
|
|
|
|
const day = String(date.getDate()).padStart(2, '0'); |
|
|
|
|
params.happenDate = `${year}-${month}-${day}`; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 添加文件URL |
|
|
|
|
if (this.attachLink) { |
|
|
|
|
params.fileUrl = this.attachLink; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('【表单提交】', this.infoTitle, params); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
let res; |
|
|
|
|
if (this.infoTitle === '修改') { |
|
|
|
|
console.log('修改模式,需要调用修改接口'); |
|
|
|
|
// 调用修改接口 |
|
|
|
|
res = await updateItem(params); |
|
|
|
|
} else { |
|
|
|
|
console.log('新增模式,需要调用新增接口'); |
|
|
|
|
// 调用新增接口 |
|
|
|
|
res = await saveItem(params); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.$message.success(this.infoTitle + '成功'); |
|
|
|
|
this.closeDialog(); |
|
|
|
|
} else { |
|
|
|
|
console.error('操作失败', res); |
|
|
|
|
this.$message.error(res.msg || '操作失败'); |
|
|
|
|
} |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error('操作失败', error); |
|
|
|
|
this.$message.error('操作失败,请稍后重试'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|