Browse Source

feat:[模板管理][update]

ouqian
luojie 1 month ago
parent
commit
22e0ad3a5d
4 changed files with 54 additions and 14 deletions
  1. +27
    -8
      src/components/Template/HandleFormItem.vue
  2. +3
    -0
      src/utils/index.js
  3. +13
    -1
      src/views/business/comps/template/TemplateTable.vue
  4. +11
    -5
      src/views/business/comps/template/mixins/templateMixin.js

+ 27
- 8
src/components/Template/HandleFormItem.vue View File

@ -235,7 +235,7 @@ import { getToken } from "@/utils/auth";
import { isShowOtherByCheckboxTree } from "@/utils/formPackageCommon"; import { isShowOtherByCheckboxTree } from "@/utils/formPackageCommon";
export default { export default {
inject: ['templateData', 'templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"],
inject: ['templateData', 'templateFillType',"getSubmittedCodes","updateSubmittedCodes", "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"],
components: { components: {
Question, Question,
DecimalInput, DecimalInput,
@ -1096,9 +1096,10 @@ export default {
const { mainRadio: oldMainRadio, inputValue: oldInputValue, subRadio: oldSubRadio } = this.oldFqyqValue; const { mainRadio: oldMainRadio, inputValue: oldInputValue, subRadio: oldSubRadio } = this.oldFqyqValue;
const o = { const o = {
"mainRadio": { oldValue: oldMainRadio, newValue: mainRadio, des: "" }, "mainRadio": { oldValue: oldMainRadio, newValue: mainRadio, des: "" },
"inputValue": { oldValue: oldInputValue, newValue: inputValue, des: "" },
"inputValue": { oldValue: oldInputValue, newValue: inputValue, des: "",key: this.fieldKey+"_inputValue" },
"subRadio": { oldValue: oldSubRadio, newValue: subRadio, des: "是否在规定时间完成:" } "subRadio": { oldValue: oldSubRadio, newValue: subRadio, des: "是否在规定时间完成:" }
} }
console.log(o, this.currentHandleType, this.fqyqValue,"fqyqValue")
return o[this.currentHandleType]; return o[this.currentHandleType];
}, },
getCheckboxTreeInfo() { getCheckboxTreeInfo() {
@ -1109,7 +1110,7 @@ export default {
const oldItem = oldCheckedValues.find(item => item.label === currentCheckboxTreeValue); const oldItem = oldCheckedValues.find(item => item.label === currentCheckboxTreeValue);
const o = { const o = {
"checkboxTreeCheckbox": { oldValue: oldItem, newValue: newItem, des: "" }, "checkboxTreeCheckbox": { oldValue: oldItem, newValue: newItem, des: "" },
"checkboxTreeOther": { oldValue: oldOtherValues[currentCheckboxTreeValue], newValue: otherValues[currentCheckboxTreeValue], des: `${currentCheckboxTreeValue}` },
"checkboxTreeOther": { oldValue: oldOtherValues[currentCheckboxTreeValue], newValue: otherValues[currentCheckboxTreeValue], des: `${currentCheckboxTreeValue}`,key: this.fieldKey+"_"+currentCheckboxTreeValue },
} }
return o[currentHandleType]; return o[currentHandleType];
}, },
@ -1168,7 +1169,11 @@ export default {
} else if (this.type === "fqyq") { } else if (this.type === "fqyq") {
const current = this.getFqyqInfo(); const current = this.getFqyqInfo();
isSame = isEqual(current.oldValue, current.newValue); isSame = isEqual(current.oldValue, current.newValue);
isOldValueEmpty = isValueEmpty(current.oldValue);
if(this.currentHandleType === "inputValue"){
isOldValueEmpty =this.isUnSubmitted(current.key);
}else{
isOldValueEmpty = isValueEmpty(current.oldValue);
}
} else if (this.type === "checkboxTree") { } else if (this.type === "checkboxTree") {
const current = this.getCheckboxTreeInfo() || {}; const current = this.getCheckboxTreeInfo() || {};
const { oldValue = {}, newValue = {} } = current; const { oldValue = {}, newValue = {} } = current;
@ -1177,16 +1182,16 @@ export default {
isOldValueEmpty = oldValue.checked === undefined; isOldValueEmpty = oldValue.checked === undefined;
} else { } else {
isSame = isEqual(current.oldValue, current.newValue); isSame = isEqual(current.oldValue, current.newValue);
isOldValueEmpty = isValueEmpty(current.oldValue);
isOldValueEmpty = this.isUnSubmitted(current.key);
} }
} else if(this.type === "checkbox"){ } else if(this.type === "checkbox"){
isSame = isEqual(this.oldValue, this.inputValue) isSame = isEqual(this.oldValue, this.inputValue)
isOldValueEmpty = this.oldValue === '';
isOldValueEmpty =this.isUnSubmitted();
}else { }else {
isSame = isEqual(this.oldValue, this.inputValue) isSame = isEqual(this.oldValue, this.inputValue)
isOldValueEmpty = isValueEmpty(this.oldValue);
isOldValueEmpty = this.isUnSubmitted();
} }
console.log(isSame, isOldValueEmpty, this.currentCheckboxTreeValue, this.oldValue, this.inputValue, "isSame") console.log(isSame, isOldValueEmpty, this.currentCheckboxTreeValue, this.oldValue, this.inputValue, "isSame")
if (isSame) { if (isSame) {
@ -1200,6 +1205,13 @@ export default {
} }
}, },
//
isUnSubmitted(key){
const finallyKey = key || this.fieldKey;
const has = this.getSubmittedCodes().includes(finallyKey)
return !has;
},
//退 //退
resetRecord() { resetRecord() {
// //
@ -1232,6 +1244,7 @@ export default {
if (!this.oldValue && !this.inputValue) { if (!this.oldValue && !this.inputValue) {
return return
} }
let finallyKey = this.fieldKey;
if (recordData) { if (recordData) {
this.oldValue = recordData.oldValue; this.oldValue = recordData.oldValue;
this.inputValue = recordData.inputValue; this.inputValue = recordData.inputValue;
@ -1248,6 +1261,9 @@ export default {
const current = this.getFqyqInfo(); const current = this.getFqyqInfo();
recordOldVlaue = `${current.des + current.oldValue}`; recordOldVlaue = `${current.des + current.oldValue}`;
recordValue = `${current.des + current.newValue}`; recordValue = `${current.des + current.newValue}`;
if(this.currentHandleType === "inputValue"){
finallyKey = current.key;
}
isModify = !!this.oldFqyqValue.mainRadio isModify = !!this.oldFqyqValue.mainRadio
} else if (this.type === "checkboxTree") { } else if (this.type === "checkboxTree") {
// checkboxTree // checkboxTree
@ -1257,6 +1273,7 @@ export default {
recordOldVlaue = `${oldValue?.label || ''}:${oldValue?.checked ? '勾选' : '未勾选'}`; recordOldVlaue = `${oldValue?.label || ''}:${oldValue?.checked ? '勾选' : '未勾选'}`;
recordValue = `${newValue.label || ''}:${newValue.checked ? '勾选' : '未勾选'}`; recordValue = `${newValue.label || ''}:${newValue.checked ? '勾选' : '未勾选'}`;
isModify = newValue.checked !== undefined; isModify = newValue.checked !== undefined;
finallyKey = current.key;
} else { } else {
recordOldVlaue = `${current.des + (current.oldValue || '')}`; recordOldVlaue = `${current.des + (current.oldValue || '')}`;
recordValue = `${current.des + (current.newValue || '')}`; recordValue = `${current.des + (current.newValue || '')}`;
@ -1271,7 +1288,7 @@ export default {
...baseInfo, ...baseInfo,
oldValue: recordOldVlaue, oldValue: recordOldVlaue,
value: recordValue, value: recordValue,
title: isModify ? "修改" : "提交",
title: !this.isUnSubmitted(finallyKey) ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"), time: moment().format("YYYY-MM-DD HH:mm:ss"),
} }
if (data) { if (data) {
@ -1281,6 +1298,7 @@ export default {
const params = { const params = {
type: "fieldChanged", type: "fieldChanged",
newRecord: [record], newRecord: [record],
submittedCodes: this.getSubmittedCodes(),
resourceList: this.getZdxgjl(), resourceList: this.getZdxgjl(),
} }
@ -1320,6 +1338,7 @@ export default {
if (this.templateFillType === "actFill") {// if (this.templateFillType === "actFill") {//
this.updateZdxgjl(record); this.updateZdxgjl(record);
this.updateSubmittedCodes(finallyKey);
} }
this.$nextTick(() => { this.$nextTick(() => {
EventBus.$emit('onModifyRecord', params,) EventBus.$emit('onModifyRecord', params,)

+ 3
- 0
src/utils/index.js View File

@ -419,6 +419,9 @@ export const getExpireDate = (
effectivePeriod, effectivePeriod,
effectivePeriodUnit effectivePeriodUnit
) => { ) => {
if(startDate === "NA"){
return "NA";
}
const start = moment(startDate) const start = moment(startDate)
const unit = effectivePeriodUnit === '天' ? 'days' : 'hours' const unit = effectivePeriodUnit === '天' ? 'days' : 'hours'
const end = start const end = start

+ 13
- 1
src/views/business/comps/template/TemplateTable.vue View File

@ -358,10 +358,13 @@ export default {
if (v.zdxgjl) { if (v.zdxgjl) {
this.zdxgjl = JSON.parse(v.zdxgjl) || []; this.zdxgjl = JSON.parse(v.zdxgjl) || [];
} }
if (v.submittedCodes) {
this.submittedCodes = JSON.parse(v.submittedCodes) || [];
}
if (v.fhyjjl) { if (v.fhyjjl) {
this.fhyjjl = JSON.parse(v.fhyjjl) || []; this.fhyjjl = JSON.parse(v.fhyjjl) || [];
} }
if (v.zdgxjl) {
if (v.zdgxjl) {//qc
this.fieldCheckObj = JSON.parse(v.zdgxjl) || {}; this.fieldCheckObj = JSON.parse(v.zdgxjl) || {};
} }
} }
@ -374,12 +377,20 @@ export default {
templateData: this.templateData, templateData: this.templateData,
templateFillType: this.fillType, templateFillType: this.fillType,
getZdxgjl: () => this.zdxgjl, getZdxgjl: () => this.zdxgjl,
getSubmittedCodes: () => this.submittedCodes,
getFhyjjl: () => this.fhyjjl, getFhyjjl: () => this.fhyjjl,
getFieldCheckObj: () => this.fieldCheckObj, getFieldCheckObj: () => this.fieldCheckObj,
// //
updateZdxgjl: (data) => { updateZdxgjl: (data) => {
this.zdxgjl.unshift(data); this.zdxgjl.unshift(data);
}, },
//codes
updateSubmittedCodes: (code) => {
if(!this.submittedCodes.includes(code)){
this.submittedCodes.unshift(code);
return
}
},
// //
updateFhyjjl: (data) => { updateFhyjjl: (data) => {
this.fhyjjl.unshift(data); this.fhyjjl.unshift(data);
@ -404,6 +415,7 @@ export default {
currentEditSignUuid: null, // EditSignHandleFormItemuuid currentEditSignUuid: null, // EditSignHandleFormItemuuid
latestParams: {},//params latestParams: {},//params
hasCustomTable: false,// hasCustomTable: false,//
submittedCodes: [],//codes
}; };
}, },
created() { created() {

+ 11
- 5
src/views/business/comps/template/mixins/templateMixin.js View File

@ -166,11 +166,17 @@ export default {
effectivePeriodUnit && effectivePeriodUnit &&
!expireDate !expireDate
) { ) {
const start = moment(startDate)
const unit = effectivePeriodUnit === '天' ? 'days' : 'hours'
const end = start
.add(Number(effectivePeriod), unit)
.format('YYYY-MM-DD HH:mm:ss')
let end;
if (startDate === "NA") {
end = "NA";
} else {
const start = moment(startDate)
const unit = effectivePeriodUnit === '天' ? 'days' : 'hours'
end = start
.add(Number(effectivePeriod), unit)
.format('YYYY-MM-DD HH:mm:ss')
}
this.formData = { ...this.formData, expireDate: end } this.formData = { ...this.formData, expireDate: end }
} }
console.log(this.formData, 'formData from templateData') console.log(this.formData, 'formData from templateData')

Loading…
Cancel
Save