Browse Source

feat:[模板管理][update]

lkf
luojie 1 month ago
parent
commit
efe069bf50
2 changed files with 52 additions and 17 deletions
  1. +48
    -13
      src/components/Template/HandleFormItem.vue
  2. +4
    -4
      src/views/business/comps/template/formConfig/sp/SP0019.js

+ 48
- 13
src/components/Template/HandleFormItem.vue View File

@ -34,6 +34,7 @@
<div v-if="option.otherCode && inputValue.includes(option.value)"> <div v-if="option.otherCode && inputValue.includes(option.value)">
<el-input v-model="otherValues[option.otherCode]" <el-input v-model="otherValues[option.otherCode]"
:placeholder="option.otherPlaceholder || '请输入'" :placeholder="option.otherPlaceholder || '请输入'"
:class="{ 'error-border': isOtherInputError(option.otherCode) }"
@blur="onBlur" @blur="onBlur"
@input="onOtherInputChange(option.otherCode, $event)" /> @input="onOtherInputChange(option.otherCode, $event)" />
</div> </div>
@ -727,12 +728,14 @@ export default {
}); });
} }
} }
value = { value = {
checkboxValues: this.inputValue,
otherValues: this.otherValues
};
this.onCommonHandleSaveRecord();
checkboxValues: this.inputValue,
otherValues: this.otherValues
};
if(val){
this.onCommonHandleSaveRecord();
}
} }
this.$emit('input', value); this.$emit('input', value);
@ -835,10 +838,11 @@ export default {
if (this.type === 'checkboxList' && this.otherValues) { if (this.type === 'checkboxList' && this.otherValues) {
isOtherValuesSame = this.isEqual(this.oldOtherValues, this.otherValues); isOtherValuesSame = this.isEqual(this.oldOtherValues, this.otherValues);
} }
console.log(this.oldValue, this.inputValue, isSame, isOtherValuesSame,this.otherValues,this.oldOtherValues,"是否需要记录修改记录")
if (isSame && isOtherValuesSame) { if (isSame && isOtherValuesSame) {
return; return;
} }
if (!this.isValueEmpty(this.oldValue) && !isSame && this.templateFillType === "actFill") {
if (!this.isValueEmpty(this.oldValue) && !(isSame && isOtherValuesSame) && this.templateFillType === "actFill") {
// EventBus // EventBus
EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
} else {// } else {//
@ -849,10 +853,18 @@ export default {
//退 //退
resetRecord() { resetRecord() {
// //
let oldValue = this.oldValue;
if (this.type === 'checkboxList') {
oldValue = {
checkboxValues: oldValue.checkboxValues || oldValue,
otherValues: this.oldOtherValues
};
}
console.log(this.oldValue, oldValue,"ooo")
this.inputValue = this.oldValue; this.inputValue = this.oldValue;
this.$emit('input', this.inputValue); // v-model
this.$emit('input', oldValue); // v-model
// this.$emit("blur", this.oldValue); // this.$emit("blur", this.oldValue);
this.$emit("change", this.oldValue, "cancel");
this.$emit("change", oldValue, "cancel");
if (this.item.type === "clickable") { if (this.item.type === "clickable") {
this.$emit("resetRecord"); this.$emit("resetRecord");
} }
@ -878,16 +890,24 @@ export default {
newRecord: [record], newRecord: [record],
resourceList: this.getZdxgjl(), resourceList: this.getZdxgjl(),
} }
//
this.oldValue = this.inputValue; //
// oldValueoldOtherValues // oldValueoldOtherValues
if (this.type === 'checkboxList') { if (this.type === 'checkboxList') {
this.oldValue = [...this.inputValue]; this.oldValue = [...this.inputValue];
this.oldOtherValues = { ...this.otherValues }; this.oldOtherValues = { ...this.otherValues };
} }
this.$emit("blur", this.inputValue);
this.$emit('input', this.inputValue);
this.$emit("change", this.inputValue, data ? "save" : "");
let value = this.inputValue;
if (this.type === 'checkboxList') {
value = {
checkboxValues: this.inputValue,
otherValues: this.otherValues
};
}
//
this.oldValue = value; //
this.$emit("blur", value);
this.$emit('input', value);
this.$emit("change", value, data ? "save" : "");
if (this.item.type === "clickable") {//clickable if (this.item.type === "clickable") {//clickable
return; return;
} }
@ -950,6 +970,14 @@ export default {
} }
return false; return false;
}, },
// checkboxListotherCode
isOtherInputError(otherCode) {
if (!this.error) {
return false;
}
// otherCode
return this.isValueEmpty(this.otherValues[otherCode]);
},
handleClickable(item, event) { handleClickable(item, event) {
if (this.templateFillType !== 'actFill') { if (this.templateFillType !== 'actFill') {
return return
@ -1461,6 +1489,13 @@ export default {
.el-input { .el-input {
width: 200px; width: 200px;
margin-left: 10px; margin-left: 10px;
&.error-border {
.el-input__inner {
border-color: #ff5d5d !important;
box-shadow: 0 0 6px #ffc3c3 !important;
}
}
} }
} }

+ 4
- 4
src/views/business/comps/template/formConfig/sp/SP0019.js View File

@ -137,10 +137,10 @@ export const getYqphFormConfig = () => {
type: 'checkboxList', type: 'checkboxList',
fillType: 'actFill', fillType: 'actFill',
options: [ options: [
{ label: '流动相平衡', value: 1 },
{ label: '样品平衡', value: 2 },
{ label: '样品', value: 3 ,otherCode:'ypOther'},
{ label: '未平衡', value: 4 }
{ label: '流动相平衡', value: '流动相平衡' },
{ label: '样品平衡', value: '样品平衡' },
{ label: '样品', value: '样品' ,otherCode:'ypOther'},
{ label: '未平衡', value: '未平衡' }
] ]
}, },
} }

Loading…
Cancel
Save