|
|
|
@ -91,6 +91,7 @@ |
|
|
|
<el-button type="primary" @click="onReplyConfirm">确 定</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
<EditSign @cancel="resetRecord" ref="editSignRef" @callback="onEditSignSave" /> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -100,11 +101,13 @@ import DecimalInput from "./DecimalInput.vue"; |
|
|
|
import { EventBus } from "@/utils/eventBus"; |
|
|
|
import moment from "moment"; |
|
|
|
import { deepClone } from "@/utils/index"; |
|
|
|
import EditSign from "@/views/business/comps/template/dialog/EditSign.vue" |
|
|
|
export default { |
|
|
|
inject: ['templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"], |
|
|
|
components: { |
|
|
|
Question, |
|
|
|
DecimalInput |
|
|
|
DecimalInput, |
|
|
|
EditSign, |
|
|
|
}, |
|
|
|
props: { |
|
|
|
type: {//form类型 input/select等 |
|
|
|
@ -174,7 +177,9 @@ export default { |
|
|
|
console.log(this.$i18n.locale, "locale") |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
|
|
|
|
onEditSignSave(data){ |
|
|
|
this.handleUpdateRecord(data) |
|
|
|
}, |
|
|
|
getChecked() { |
|
|
|
return !!this.getFieldCheckObj()[this.fieldKey]?.checked; |
|
|
|
}, |
|
|
|
@ -235,9 +240,10 @@ export default { |
|
|
|
|
|
|
|
} |
|
|
|
const params = { |
|
|
|
type: "reply", |
|
|
|
//reply:回复,content:复核 |
|
|
|
type: this.templateFillType == 'actFill' ? "reply" : "content", |
|
|
|
newRecord: record, |
|
|
|
resourceList: deepClone(this.getFhyjjl()), |
|
|
|
resourceList: this.getFhyjjl(), |
|
|
|
} |
|
|
|
// 触发回复记录事件 |
|
|
|
EventBus.$emit('onModifyRecord', params); |
|
|
|
@ -305,7 +311,7 @@ export default { |
|
|
|
}, |
|
|
|
// 点击question图标 |
|
|
|
onClickQuestion() { |
|
|
|
const {templateFillType} = this; |
|
|
|
const {templateFillType} = this; |
|
|
|
if (templateFillType == 'actFill' || templateFillType == 'qc') { |
|
|
|
if (templateFillType == 'qc') { |
|
|
|
const field = this.getFieldCheckObj()[this.fieldKey]; |
|
|
|
@ -342,50 +348,15 @@ export default { |
|
|
|
// 检查值是否发生变化 |
|
|
|
if (this.templateFillType === "actFill") { |
|
|
|
// 值发生了变化,需要弹出密码输入框 |
|
|
|
try { |
|
|
|
const isSame = this.isEqual(this.oldValue, this.inputValue); |
|
|
|
if (this.oldValue && !isSame) { |
|
|
|
const passwordResult = await this.$prompt('请输入密码以确认修改', '密码验证', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
inputType: 'password', |
|
|
|
inputPattern: /.+/, |
|
|
|
inputErrorMessage: '请输入密码', |
|
|
|
zIndex: 10000, |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
const baseInfo = this.getCommonRecordInfo(); |
|
|
|
const record = { |
|
|
|
...baseInfo, |
|
|
|
oldValue: this.oldValue, |
|
|
|
value: this.inputValue, |
|
|
|
title: this.oldValue ? "修改记录" : "填写", |
|
|
|
time: moment().format("YYYY-MM-DD HH:mm:ss"), |
|
|
|
} |
|
|
|
const params = { |
|
|
|
type: "fieldChanged", |
|
|
|
newRecord: record, |
|
|
|
resourceList: deepClone(this.getZdxgjl()), |
|
|
|
} |
|
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
this.updateZdxgjl(record); |
|
|
|
//用户输入密码并点击确定,保存修改 |
|
|
|
this.oldValue = this.inputValue; // 更新旧值 |
|
|
|
this.$emit("blur", val); |
|
|
|
this.$emit('input', this.inputValue); |
|
|
|
this.$emit("change", val); |
|
|
|
// 调用后端接口记录修改记录 |
|
|
|
// await this.saveModificationRecord(); |
|
|
|
} catch { |
|
|
|
// 用户点击取消,还原数据 |
|
|
|
this.inputValue = this.oldValue; |
|
|
|
this.$emit('input', this.inputValue); // 触发 v-model 更新 |
|
|
|
this.$emit("blur", this.oldValue); |
|
|
|
this.$emit("change", this.oldValue); |
|
|
|
const isSame = this.isEqual(this.oldValue, this.inputValue); |
|
|
|
if (this.oldValue && !isSame) { |
|
|
|
this.$refs.editSignRef.show() |
|
|
|
|
|
|
|
} |
|
|
|
if(!this.oldValue){//如果是第一次填写,不需要密码验证 |
|
|
|
this.handleUpdateRecord() |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
// 值没有变化,正常触发 blur和change 事件 |
|
|
|
this.$emit("blur", val) |
|
|
|
@ -394,6 +365,42 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
//如果用户取消,那么回退到上一次的值 |
|
|
|
resetRecord(){ |
|
|
|
// 用户点击取消,还原数据 |
|
|
|
this.inputValue = this.oldValue; |
|
|
|
this.$emit('input', this.inputValue); // 触发 v-model 更新 |
|
|
|
this.$emit("blur", this.oldValue); |
|
|
|
this.$emit("change", this.oldValue); |
|
|
|
}, |
|
|
|
|
|
|
|
//处理更新记录 |
|
|
|
handleUpdateRecord(data){ |
|
|
|
const baseInfo = this.getCommonRecordInfo(); |
|
|
|
const record = { |
|
|
|
...baseInfo, |
|
|
|
oldValue: this.oldValue, |
|
|
|
value: this.inputValue, |
|
|
|
title: this.oldValue ? "修改记录" : "填写", |
|
|
|
time: moment().format("YYYY-MM-DD HH:mm:ss"), |
|
|
|
} |
|
|
|
if(data){ |
|
|
|
record.reason = data.remark |
|
|
|
} |
|
|
|
const params = { |
|
|
|
type: "fieldChanged", |
|
|
|
newRecord: record, |
|
|
|
resourceList: deepClone(this.getZdxgjl()), |
|
|
|
} |
|
|
|
EventBus.$emit('onModifyRecord', params,) |
|
|
|
this.updateZdxgjl(record); |
|
|
|
//用户输入密码并点击确定,保存修改 |
|
|
|
this.oldValue = this.inputValue; // 更新旧值 |
|
|
|
this.$emit("blur", this.inputValue); |
|
|
|
this.$emit('input', this.inputValue); |
|
|
|
this.$emit("change", this.inputValue); |
|
|
|
}, |
|
|
|
|
|
|
|
//判断两个值是否相等 |
|
|
|
isEqual(oldValue, nowValue){ |
|
|
|
if (oldValue === null || nowValue === null) { |
|
|
|
|