|
|
|
@ -20,9 +20,10 @@ |
|
|
|
:formData="formData" |
|
|
|
:prefixKey = "`jcb`" |
|
|
|
fieldItemLabel = "template.lba.lba004.xbxx" |
|
|
|
:showOperation="fillType === 'preFill'" |
|
|
|
> |
|
|
|
<template slot="operation" slot-scope="{ row, rowIndex, columns }" v-if="fillType!='actFill'"> |
|
|
|
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="deleteRow" ></TableOpertaionDelete> |
|
|
|
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> |
|
|
|
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="deleteJcbRow" ></TableOpertaionDelete> |
|
|
|
</template> |
|
|
|
</CustomTable> |
|
|
|
|
|
|
|
@ -38,14 +39,14 @@ |
|
|
|
|
|
|
|
<div class="template-form-item"> |
|
|
|
<div class="config-header-end" v-if="fillType === 'preFill'"> |
|
|
|
<el-button type="primary" @click="handleAddParalle">{{ $t('template.lba.lba004.xz')}}</el-button> |
|
|
|
<el-button type="primary" @click="handleAddParalle(false)">{{ $t('template.lba.lba004.xz')}}</el-button> |
|
|
|
<el-button type="danger" plain @click="deleteParalleConfig(paralleIndex)">{{ $t('template.lba.lba004.sc')}}</el-button> |
|
|
|
</div> |
|
|
|
<BaseInfoFormPackage @clickable="(e) => handleClickable('paralle', paralleIndex, e)" |
|
|
|
:ref="`paralleStepFormPackageRef_${paralleIndex}`" :formConfig="paralleStepFormConfig" |
|
|
|
:formData="paralleConfig" :prefixKey="'paralle' + paralleIndex" |
|
|
|
:fieldItemLabel="$t('template.lba.lba004.xszj')" /> |
|
|
|
<CustomTable @blur="(e) => onHandleTableBlur('paralle', paralleIndex, e)" |
|
|
|
<!-- <CustomTable @blur="(e) => onHandleTableBlur('paralle', paralleIndex, e)" |
|
|
|
:ref="`paralleStepTableRef_${paralleIndex}`" :showOperation="fillType === 'actFill' || fillType === 'preFill'" |
|
|
|
:columns="paralleStepColumns" |
|
|
|
@onRegentSubmit="(data) => onTableRegentSubmit('paralle', paralleIndex, data)" |
|
|
|
@ -54,6 +55,15 @@ |
|
|
|
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> |
|
|
|
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="(rowIndex) => deleteRow(rowIndex, 'paralle', paralleIndex)" ></TableOpertaionDelete> |
|
|
|
</template> |
|
|
|
</CustomTable> --> |
|
|
|
<CustomTable |
|
|
|
:ref="`paralleStepTableRef_${paralleIndex}`" :showOperation="fillType === 'preFill'" |
|
|
|
:columns="paralleStepColumns" |
|
|
|
:formData="paralleConfig" :prefixKey="'paralle' + paralleIndex" |
|
|
|
:fieldItemLabel="$t('template.lba.lba004.xszj')"> |
|
|
|
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> |
|
|
|
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="(rowIndex) => deleteRow(rowIndex, 'paralle', paralleIndex)" ></TableOpertaionDelete> |
|
|
|
</template> |
|
|
|
</CustomTable> |
|
|
|
|
|
|
|
<Step class="mt-0 s-container" :ref="`paralleStepRef_${paralleIndex}`" |
|
|
|
@ -104,7 +114,7 @@ export default { |
|
|
|
width: 280, |
|
|
|
},{ |
|
|
|
prop: 'jcbBh', |
|
|
|
bodyType: 'sj', |
|
|
|
bodyType: 'jcb', |
|
|
|
bodyFillType: 'actFill', |
|
|
|
width: 280 |
|
|
|
}] |
|
|
|
@ -302,7 +312,7 @@ export default { |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
if(this.fillType === "preFill"){ |
|
|
|
this.handleAddParalle(); |
|
|
|
this.handleAddParalle(true); |
|
|
|
} |
|
|
|
if(this.fillType === "actFill"){ |
|
|
|
this.getCode(formData); |
|
|
|
@ -311,12 +321,59 @@ export default { |
|
|
|
methods: { |
|
|
|
//获取已填写的表单数据 |
|
|
|
getFilledFormData() { |
|
|
|
return this.getFilledFormDataByRefs(["baseInfoRef","stepRef","jcbRef", "remarkRef","fjRef"]) |
|
|
|
const baseData = this.$refs.baseInfoRef.getFilledFormData(); |
|
|
|
const jcbData = this.$refs.jcbRef.getFilledFormData(); |
|
|
|
const fjData = this.$refs.fjRef.getFilledFormData(); |
|
|
|
const remarkData = this.$refs.remarkRef.getFilledFormData(); |
|
|
|
|
|
|
|
// 获取所有平行配制数据 |
|
|
|
const paralleConfigsData = []; |
|
|
|
if (this.formData.paralleConfigs && this.formData.paralleConfigs.length > 0) { |
|
|
|
for (let i = 0; i < this.formData.paralleConfigs.length; i++) { |
|
|
|
const paralleFormData = this.$refs[`paralleStepFormPackageRef_${i}`][0].getFilledFormData(); |
|
|
|
const paralleTableFormData = this.$refs[`paralleStepTableRef_${i}`][0].getFilledFormData(); |
|
|
|
const paralleStepData = this.$refs[`paralleStepRef_${i}`][0].getFilledFormData(); |
|
|
|
|
|
|
|
paralleConfigsData.push({ |
|
|
|
...paralleFormData, |
|
|
|
...paralleTableFormData, |
|
|
|
paralleStepData: paralleStepData.stepData, |
|
|
|
showParalleConfig: true |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
...baseData, |
|
|
|
...jcbData, |
|
|
|
...fjData, |
|
|
|
...remarkData, |
|
|
|
paralleConfigs: paralleConfigsData, |
|
|
|
} |
|
|
|
}, |
|
|
|
//获取填写完成的表单数据 |
|
|
|
async getFormData() { |
|
|
|
let content = await this.validFormFields(["baseInfoRef","stepRef","jcbRef",, "remarkRef","fjRef"]); |
|
|
|
return content; |
|
|
|
//先校验再获取值 |
|
|
|
const validFlag = await this.validFields(); |
|
|
|
if (!validFlag) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
let content = this.getFilledFormData(); |
|
|
|
return content |
|
|
|
}, |
|
|
|
//只做校验 |
|
|
|
async validFields() { |
|
|
|
// 构建需要验证的引用数组 |
|
|
|
let refsToValidate = ["baseInfoRef","jcbRef","fjRef", "remarkRef"]; |
|
|
|
|
|
|
|
// 添加平行配制相关的引用 |
|
|
|
if (this.formData.paralleConfigs && this.formData.paralleConfigs.length > 0) { |
|
|
|
for (let i = 0; i < this.formData.paralleConfigs.length; i++) { |
|
|
|
refsToValidate.push(`paralleStepFormPackageRef_${i}`); |
|
|
|
refsToValidate.push(`paralleStepTableRef_${i}`); |
|
|
|
refsToValidate.push(`paralleStepRef_${i}`); |
|
|
|
} |
|
|
|
} |
|
|
|
return await this.validFormFields(refsToValidate); |
|
|
|
}, |
|
|
|
getResource() { |
|
|
|
let content = this.getFilledFormData(); |
|
|
|
@ -328,22 +385,28 @@ export default { |
|
|
|
}, |
|
|
|
//保存 |
|
|
|
async onSave() { |
|
|
|
let content =await this.$refs.fjRef.getFormData(); |
|
|
|
console.log(content); |
|
|
|
const formData = this.getStepResource(); |
|
|
|
console.log(formData, "formData") |
|
|
|
|
|
|
|
}, |
|
|
|
//新增平行配制 |
|
|
|
handleAddParalle() { |
|
|
|
// 初始化平行配制配置列表 |
|
|
|
if (!this.formData.paralleConfigs) { |
|
|
|
this.$set(this.formData, 'paralleConfigs', []); |
|
|
|
handleAddParalle(init) { |
|
|
|
if(init){ |
|
|
|
if (!this.formData.paralleConfigs) { |
|
|
|
this.$set(this.formData, 'paralleConfigs', []); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
// 初始化平行配制配置列表 |
|
|
|
if (!this.formData.paralleConfigs) { |
|
|
|
this.$set(this.formData, 'paralleConfigs', []); |
|
|
|
} |
|
|
|
// 添加新的平行配制配置 |
|
|
|
this.formData.paralleConfigs.push({ |
|
|
|
paralleStepData: [], |
|
|
|
paralleTableFormData: [], |
|
|
|
showParalleConfig: true |
|
|
|
}); |
|
|
|
} |
|
|
|
// 添加新的平行配制配置 |
|
|
|
this.formData.paralleConfigs.push({ |
|
|
|
paralleStepData: [], |
|
|
|
paralleTableFormData: [], |
|
|
|
showParalleConfig: true |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 删除平行配制配置 |
|
|
|
deleteParalleConfig(index) { |
|
|
|
@ -353,6 +416,27 @@ export default { |
|
|
|
} |
|
|
|
this.formData.paralleConfigs.splice(index, 1); |
|
|
|
}, |
|
|
|
deleteJcbRow(rowIndex){ |
|
|
|
const jcbRef = this.$refs['jcbRef']; |
|
|
|
if (jcbRef) { |
|
|
|
jcbRef.deleteRow(rowIndex); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 删除表格行 |
|
|
|
deleteRow(rowIndex, type, configIndex = 0) { |
|
|
|
// 根据类型删除对应的表格行 |
|
|
|
if (type === 'ladder') { |
|
|
|
const tableRef = this.$refs[`ladderStepTableRef_${configIndex}`]; |
|
|
|
if (tableRef) { |
|
|
|
tableRef.deleteRow(rowIndex); |
|
|
|
} |
|
|
|
} else if (type === 'paralle') { |
|
|
|
const tableRef = this.$refs[`paralleStepTableRef_${configIndex}`]; |
|
|
|
if (tableRef) { |
|
|
|
tableRef[0].deleteRow(rowIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |
|
|
|
@ -366,7 +450,7 @@ export default { |
|
|
|
} |
|
|
|
.config-header-end { |
|
|
|
display: flex; |
|
|
|
justify-content: end; |
|
|
|
justify-content: flex-end; |
|
|
|
align-items: center; |
|
|
|
margin-bottom: 15px; |
|
|
|
font-weight: bold; |
|
|
|
|