Browse Source

feat:[模板管理][update]

ouqian
luojie 1 month ago
parent
commit
17480e0415
3 changed files with 73 additions and 9 deletions
  1. +27
    -2
      src/components/Template/BaseInfoFormPackage.vue
  2. +34
    -2
      src/components/Template/mixins/formPackageMixins.js
  3. +12
    -5
      src/views/business/comps/template/comps/gsp/GSP005.vue

+ 27
- 2
src/components/Template/BaseInfoFormPackage.vue View File

@ -290,7 +290,24 @@
@update:error="errors[key] = false" :item="getRegentItem(sItem)" @update:error="errors[key] = false" :item="getRegentItem(sItem)"
:value="formFields[key]" /> :value="formFields[key]" />
<span v-if="sItem.subType === 'text'" class="sub-text">{{ $t(sItem.subText) }}</span> <span v-if="sItem.subType === 'text'" class="sub-text">{{ $t(sItem.subText) }}</span>
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.subKey" class="ml-10"
v-else-if="sItem.subType === 'input' || sItem.subType === 'inputNumber' || sItem.subType === 'select'" :type="sItem.subType" :item="getSubItem(sItem)"
v-model="formFields[sItem.subKey]" @copy="onCopy(sItem, key)"
:error="errors[sItem.subKey]" @blur="onBlur(sItem.subKey, $event)"
@update:error="errors[sItem.subKey] = false"
:orange-bg="orangeBgFields[sItem.subKey]" />
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.thirdKey" class="ml-10"
v-if="sItem.thirdType === 'select' || sItem.thirdType === 'input'" :type="sItem.thirdType" :item="getThirdItem(sItem)"
v-model="formFields[sItem.thirdKey]" @copy="onCopy(sItem, key)"
:error="errors[sItem.thirdKey]" @blur="onBlur(sItem.thirdKey, $event)"
@update:error="errors[sItem.thirdKey] = false"
:orange-bg="orangeBgFields[sItem.thirdKey]" />
<HandleFormItem class="ml-10" v-if="sItem.fourthType === 'button'" type="button"
:item="getFourthButtonItem(sItem)" :value="formFields[sItem.fourthKey]"
@clickButton="(e, val, data) => handleClickButton(e, sItem, val, data)" />
</div> </div>
</div> </div>
</div> </div>
@ -394,7 +411,15 @@ export default {
return { return {
...sItem, ...sItem,
key: sItem.subKey, key: sItem.subKey,
fillType: sItem.subFillType || sItem.fillType
fillType: sItem.fourthFillType || sItem.fillType
}
},
getFourthButtonItem(sItem) {
return {
...sItem,
key: sItem.fourthKey,
buttonName:sItem.fourthButtonName,
fillType: sItem.fourthFillType || sItem.fillType
} }
}, },
// fqyq // fqyq

+ 34
- 2
src/components/Template/mixins/formPackageMixins.js View File

@ -67,11 +67,11 @@ export default {
}, },
getRegentItem(item, fieldCode = "type") { getRegentItem(item, fieldCode = "type") {
const type = item[fieldCode]; const type = item[fieldCode];
console.log(item, "type")
const fillType = fieldCode === "type" ? item.fillType : (item.subFillType || item.fillType);
return { return {
label: "", label: "",
type, type,
fillType: item.subFillType || item.fillType,
fillType,
parentLabel: item.label, parentLabel: item.label,
filledCodes: item.filledCodes, filledCodes: item.filledCodes,
qxbdType: item.qxbdType, qxbdType: item.qxbdType,
@ -184,6 +184,20 @@ export default {
} }
return config; return config;
}, },
//获取第三个的配置
getThirdItem(sItem) {
const config = {
label: "",
options: sItem.thirdOptions || [],
fillType: sItem.thirdFillType,
parentLabel: sItem.label,
maxlength: sItem.thirdMaxlength || 50,
}
if (sItem.thirdDisabled) {
config.disabled = sItem.thirdDisabled;
}
return config;
},
// 根据formConfig回填form表单数据 // 根据formConfig回填form表单数据
handleFormField(update = false) { handleFormField(update = false) {
const result = {}; const result = {};
@ -235,6 +249,24 @@ export default {
} }
config[subKey] = { label: currentConfig.label, subKey, type: currentConfig.subType, fillType: currentConfig.subFillType || currentConfig.fillType, selectTo: currentConfig.selectTo } config[subKey] = { label: currentConfig.label, subKey, type: currentConfig.subType, fillType: currentConfig.subFillType || currentConfig.fillType, selectTo: currentConfig.selectTo }
} }
if(currentConfig.thirdKey){
const { thirdKey } = currentConfig;
if (update) {
result[thirdKey] = formFields[thirdKey] || formData[thirdKey] || '';
} else {
result[thirdKey] = formFields[thirdKey] || formData[thirdKey] || '';
}
config[thirdKey] = { label: currentConfig.label, thirdKey, type: currentConfig.thirdType, fillType: currentConfig.thirdFillType, selectTo: currentConfig.selectTo }
}
if(currentConfig.fourthKey){
const { fourthKey } = currentConfig;
if (update) {
result[fourthKey] = formFields[fourthKey] || formData[fourthKey] || '';
} else {
result[fourthKey] = formFields[fourthKey] || formData[fourthKey] || '';
}
config[fourthKey] = { label: currentConfig.label, fourthKey, type: currentConfig.fourthType, fillType: currentConfig.fourthFillType, selectTo: currentConfig.selectTo }
}
// 检查compareTo字段 // 检查compareTo字段
if (currentConfig.compareTo && formData[currentConfig.compareTo] && result[key]) { if (currentConfig.compareTo && formData[currentConfig.compareTo] && result[key]) {

+ 12
- 5
src/views/business/comps/template/comps/gsp/GSP005.vue View File

@ -338,12 +338,19 @@ export default {
}, },
sywzsjclz: { sywzsjclz: {
label: 'template.gsp.GSP005.sywzsjclz', label: 'template.gsp.GSP005.sywzsjclz',
type: "inputNumber",
subType: "select",
subKey: "sywzsjclzUnit",
type: "yq",
subType: "inputNumber",
subKey: "sywzsjclzValue",
thirdType: "select",
thirdKey: "sywzsjclzUnit",
thirdFillType: "preFill",
fillType: "actFill", fillType: "actFill",
subFillType: "preFill",
subOptions: this.getDictOptions('business_zldw'),
subFillType: "actFill",
fourthType: "button",
fourthKey: "sywzsjclzButtonValue",
fourthFillType: "actFill",
fourthButtonName:"获取值",
thirdOptions: this.getDictOptions('business_zldw'),
maxlength: 10 maxlength: 10
}, },
rjbhph: { rjbhph: {

Loading…
Cancel
Save