Browse Source

feat:[模板管理][乱七八糟的一些更新]

lkf
luojie 1 month ago
parent
commit
bf71dfb02e
4 changed files with 33 additions and 14 deletions
  1. +7
    -3
      src/components/Template/BaseInfoFormPackage.vue
  2. +15
    -5
      src/components/Template/HandleFormItem.vue
  3. +8
    -3
      src/components/Template/mixins/formPackageMixins.js
  4. +3
    -3
      src/views/business/comps/template/comps/yp/YP002.vue

+ 7
- 3
src/components/Template/BaseInfoFormPackage.vue View File

@ -94,10 +94,12 @@
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
@blur="onBlur(key, $event)" :item="sItem" v-model="formFields[key]"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:ref = "key"
:orange-bg="orangeBgFields[key]" />
<span v-if="sItem.subType === 'text'" class="sub-text">{{ $t(sItem.subText) }}</span>
<HandleFormItem class="ml-10" v-else-if="sItem.subType === 'button'" type="button" :item="getButtonItem(sItem)"
@clickButton="(e) => handleClickButton(e, item)" />
:value="formFields[sItem.subKey]"
@clickButton="(e,val,data) => handleClickButton(e, sItem,val,data)" />
</div>
<div v-else-if="sItem.type === 'textarea'">
@ -345,13 +347,15 @@ export default {
this.$emit('beforeReagentSubmit', { selectData: data, callback, key, formFields: this.formFields })
},
//
handleClickButton(e, item) {
this.$emit("clickButton", e, item)
handleClickButton(e, item,val,data) {
this.formFields[item.subKey] = val;
this.$emit("clickButton", item,data)
},
//
getButtonItem(sItem) {
return {
...sItem,
key: sItem.subKey,
fillType: sItem.subFillType || sItem.fillType
}
},

+ 15
- 5
src/components/Template/HandleFormItem.vue View File

@ -53,7 +53,8 @@
</el-date-picker>
<el-button v-else-if="type === 'button'" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"
:disabled="getDisabled()" type="primary" @click="handleClickButton(item)">
{{ item.buttonName }}
{{ $t(item.buttonName) }}
<input type="hidden" v-model="inputValue" >
</el-button>
<div class="clickable"
@ -525,7 +526,8 @@ export default {
},
//
handleClickButton(item) {
this.$emit('clickButton', item);
this.inputValue = `button-${new Date().getTime()}`;
this.onCommonHandleSaveRecord(this.inputValue);
},
onDateChange(val, format) {
this.inputValue = moment(val).format(format);
@ -837,6 +839,7 @@ export default {
this.$emit("change", this.inputValue);
return;
}
//
const isSame = this.isEqual(this.oldValue, this.inputValue);
let isOtherValuesSame = true;
@ -866,7 +869,6 @@ export default {
otherValues: this.oldOtherValues
};
}
console.log(this.oldValue, oldValue,"ooo")
this.inputValue = this.oldValue;
this.$emit('input', oldValue); // v-model
// this.$emit("blur", this.oldValue);
@ -877,9 +879,13 @@ export default {
},
//
handleUpdateRecord(data) {
handleUpdateRecord(data,recordData) {
const baseInfo = this.getCommonRecordInfo();
if (!this.oldValue && !this.inputValue) return;
if(recordData){
this.oldValue = recordData.oldValue;
this.inputValue = recordData.inputValue;
}
const record = {
...baseInfo,
oldValue: this.oldValue,
@ -909,6 +915,9 @@ export default {
otherValues: this.otherValues
};
}
if(this.type === "button"){
this.$emit('clickButton', this.item,this.inputValue,data);
}
//
this.oldValue = value; //
this.$emit("blur", value);
@ -923,6 +932,7 @@ export default {
}
this.$nextTick(() => {
EventBus.$emit('onModifyRecord', params,)
console.log(params,"onModifyRecord")
if (this.regentType.includes(this.item.type)) {
this.$emit("onRegentSubmit", this.selectRegentInfo, this.inputValue);
}
@ -1011,7 +1021,7 @@ export default {
isShowHandle() {
const { fillType } = this.item;
//
return this.templateFillType !== "preFill" && fillType === "actFill"
return this.templateFillType !== "preFill" && fillType === "actFill"&&this.type!=="button"
},
//
getDisabled() {

+ 8
- 3
src/components/Template/mixins/formPackageMixins.js View File

@ -109,17 +109,23 @@ export default {
},
//更新表单数据
updateFormData(key, value) {
updateFormData(key, value,data) {
const {isUpdateRecord,signData} = data || {};
// 深拷贝当前表单数据,避免直接修改原数据
const cloneFormFields = JSON.parse(JSON.stringify(this.formFields));
this.oldFormFields[key] = cloneFormFields[key];
// this.showEditSignDialog();
this.formFields[key] = value;
// 清除该表单项的错误状态
if (this.errors[key]) {
this.$set(this.errors, key, false);
}
if(isUpdateRecord){
setTimeout(() => {
this.$refs[key][0].handleUpdateRecord(signData,{oldValue:this.oldFormFields[key],inputValue:value});
}, 10);
}
},
@ -363,7 +369,6 @@ export default {
const subComponentValidateResult = this.validateSubComponents();
// const subComponentValidateResult = {valid: true, error: ''};
console.log(subComponentValidateResult,validateResult,"subComponentValidateResult")
return new Promise((resolve, reject) => {
if (validateResult.valid && subComponentValidateResult.valid) {
resolve(this.formFields);

+ 3
- 3
src/views/business/comps/template/comps/yp/YP002.vue View File

@ -141,6 +141,7 @@ export default {
fillType: 'actFill',
maxlength: 200,
subType:"button",
subKey:"jssjButton",
buttonName:"获取时间"
},
}
@ -157,9 +158,8 @@ export default {
},
methods: {
//
handleClickButton(e,item){
this.$refs.ypjsInfoRef.updateFormData("jssj", moment().format("YYYY/MM/DD HH:mm"));
console.log(e,item,"点击按钮")
handleClickButton(item,signData){
this.$refs.ypjsInfoRef.updateFormData("jssj", moment().format("YYYY/MM/DD HH:mm"),{isUpdateRecord:true,signData});
},
//
getFilledFormData() {

Loading…
Cancel
Save