Browse Source

feat:[模板管理][update]

master
luojie 4 days ago
parent
commit
e68cc316ae
9 changed files with 263 additions and 264 deletions
  1. +46
    -28
      src/components/Template/BaseInfoFormPcakge.vue
  2. +180
    -109
      src/components/Template/CustomTable.vue
  3. +24
    -4
      src/components/Template/HandleFormItem.vue
  4. +2
    -22
      src/views/business/comps/template/comps/gy/MJYLQSQD.vue
  5. +2
    -22
      src/views/business/comps/template/comps/gy/SYWZPZJHB.vue
  6. +6
    -38
      src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
  7. +1
    -16
      src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue
  8. +1
    -19
      src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
  9. +1
    -6
      src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue

+ 46
- 28
src/components/Template/BaseInfoFormPcakge.vue View File

@ -210,7 +210,7 @@ export default {
})
},
handleClickable(sItem,event){
if(this.fillType !== 'actFill'){
if(this.$store.state.template.templateStatus !== 'actFill'){
return
}
this.$emit("clickable",sItem)
@ -320,19 +320,17 @@ export default {
}
}
},
validateFormData(){
},
getFormData() {
//
validateFormData() {
const { formFields, allFieldsConfig } = this;
const { templateStatus } = this.$store.state.template;
const errors = [];
//
//
this.errors = {};
const errors = {};
let firstError = null;
for (const key in allFieldsConfig) {
if (!formFields[key]) {
if (this.isValueEmpty(formFields[key])) {
const o = allFieldsConfig[key];
//
if (o.label === "其他" && !this.isShowOther(formFields[o.parentKey])) {
@ -343,32 +341,52 @@ export default {
continue
}
if (o.fillType == templateStatus && !o.disabled) {
//
errors[key] = true;
if (!firstError) {
let prefix = "";
if (o.type === "input" || o.type === "inputNumber" || o.type === "textarea") {
prefix = "填写";
} else {
prefix = "选择";
}
firstError = { label: o.label, prefix };
let prefix = "";
if (o.type === "input" || o.type === "inputNumber" || o.type === "textarea") {
prefix = "填写";
} else {
prefix = "选择";
}
const errorItem = {
field: key,
label: o.label,
error: `${prefix}${o.label}`
};
errors.push(errorItem);
this.$set(this.errors, key, true);
}
}
}
//
this.errors = errors;
return {
valid: errors.length === 0,
errors: errors
};
},
//
isValueEmpty(value) {
if (value === null || value === undefined || value === '') {
return true;
}
if (typeof value === 'string' && value.trim() === '') {
return true;
}
if (Array.isArray(value) && value.length === 0) {
return true;
}
return false;
},
getFormData() {
//
const validateResult = this.validateFormData();
return new Promise((resolve, reject) => {
if (Object.keys(errors).length > 0) {
//
// this.$message.error(`,`);
reject(`${firstError.label}还未${firstError.prefix}`);
if (validateResult.valid) {
resolve(this.formFields);
} else {
resolve(formFields);
// this.$message.error(",");
reject(validateResult.errors[0].error);
}
});
},

+ 180
- 109
src/components/Template/CustomTable.vue View File

@ -1,71 +1,96 @@
<template>
<div class="custom-table-wrapper">
<div class="custom-table-header">
<div class="custom-table-row">
<div v-for="(col, index) in columns" :key="index" class="custom-table-cell header-cell"
:style="{ width: col.width ? col.width + 'px' : 'auto' }">
<div class="header-cell-content">
<div>{{ col.label }}</div>
<template v-if="col.headerSelectKey && col.headerOptions&&showHeaderSelect">
<HandleFormItem type="select" class="header-select" :item="getHeaderItem(col)"
v-model="headerSelectFields[col.headerSelectKey]" @change="onHeaderSelectChange(col, $event)" />
</template>
<span v-else-if ="headerSelectFields[col.headerSelectKey]" class="fill-type-icon">({{ headerSelectFields[col.headerSelectKey] }})</span>
<div>
<div class="custom-table-wrapper">
<div class="custom-table-header">
<div class="custom-table-row">
<div v-for="(col, index) in columns" :key="index" class="custom-table-cell header-cell"
:style="{ width: col.width ? col.width + 'px' : 'auto' }">
<div class="header-cell-content">
<div>{{ col.label }}</div>
<template
v-if="col.headerSelectKey && col.headerOptions && (showHeaderSelect || $store.state.template.templateStatus === 'preFill')">
<HandleFormItem type="select" class="header-select" :item="getHeaderItem(col)"
v-model="headerSelectFields[col.headerSelectKey]" @change="onHeaderSelectChange(col, $event)"
:error="hasError(-1, index, col.headerSelectKey)"
@update:error="onErrorUpdate(-1, index, col.headerSelectKey, $event)" />
</template>
<span v-else-if="headerSelectFields[col.headerSelectKey]" class="fill-type-icon">({{
headerSelectFields[col.headerSelectKey] }})</span>
</div>
</div>
</div>
<!-- 默认操作栏 -->
<div class="custom-table-cell header-cell" :style="{ width: '180px' }" v-if="showOperation">
<div class="header-cell-content">
<div>操作</div>
</div>
<!-- 默认操作栏 -->
<div class="custom-table-cell header-cell" :style="{ width: '180px' }" v-if="showOperation">
<div class="header-cell-content">
<div>操作</div>
</div>
</div>
</div>
</div>
</div>
<div class="custom-table-body">
<div v-for="(row, rowIndex) in localDataSource" :key="rowIndex" class="custometable-row">
<div v-for="(col, colIndex) in columns" :key="colIndex" class="custom-table-cell body-cell"
:style="{ width: col.width ? col.width + 'px' : 'auto' }">
<div class="inner-table-cell">
<div>
<template v-if="col.bodyType === 'input'">
<HandleFormItem type="input" @blur = "onBlur(rowIndex, col.prop, $event)" @copy = "onCopy(rowIndex, col)" class="body-input" :item="getBodyItem(col,rowIndex)" v-model="row[col.prop]" @change="onBodyValueChange(rowIndex, colIndex, $event)" :error="hasError(rowIndex, colIndex, col.prop)" @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" />
</template>
<template v-else-if="col.bodyType === 'inputNumber'">
<HandleFormItem type="inputNumber" @copy = "onCopy(rowIndex, col)" class="body-input-number" :item="getBodyItem(col,rowIndex)"
v-model="row[col.prop]" @blur = "onBlur(rowIndex, col.prop, $event)" @change="onBodyValueChange(rowIndex, colIndex, $event)" :error="hasError(rowIndex, colIndex, col.prop)" @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" />
</template>
<template v-else-if="col.bodyType === 'select'">
<HandleFormItem type="select" class="body-select" @blur = "onBlur(rowIndex, col.prop, $event)" :item="getBodyItem(col,rowIndex)" v-model="row[col.prop]" @change="onBodyValueChange(rowIndex, colIndex, $event)" :error="hasError(rowIndex, colIndex, col.prop)" @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" />
</template>
<template v-else>
{{ row[col.prop] }}
</template>
</div>
<div class="m-l-5" v-if="col.showBodySub">
<template v-if="col.bodySubType === 'inputNumber'">
<HandleFormItem type="inputNumber" @blur = "onSubBlur(rowIndex, col.bodySubKey, $event)" @copy = "onCopy(rowIndex, col)" :item="getBodySubItem(col)"
v-model="row[col.bodySubKey]" @change="onBodySubValueChange(rowIndex, colIndex, $event)" :error="hasError(rowIndex, colIndex, col.bodySubKey)" @update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)" />
</template>
<template v-else>
{{ row[col.bodySubKey] }}
</template>
<div class="custom-table-body">
<div v-for="(row, rowIndex) in localDataSource" :key="rowIndex" class="custometable-row">
<div v-for="(col, colIndex) in columns" :key="colIndex" class="custom-table-cell body-cell"
:style="{ width: col.width ? col.width + 'px' : 'auto' }">
<div class="inner-table-cell">
<div>
<template v-if="col.bodyType === 'input'">
<HandleFormItem type="input" @blur="onBlur(rowIndex, col.prop, $event)" @copy="onCopy(rowIndex, col)"
class="body-input" :item="getBodyItem(col, rowIndex)" v-model="row[col.prop]"
@change="onBodyValueChange(rowIndex, colIndex, $event)"
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" />
</template>
<template v-else-if="col.bodyType === 'inputNumber'">
<HandleFormItem type="inputNumber" @copy="onCopy(rowIndex, col)" class="body-input-number"
:item="getBodyItem(col, rowIndex)" v-model="row[col.prop]" @blur="onBlur(rowIndex, col.prop, $event)"
@change="onBodyValueChange(rowIndex, colIndex, $event)"
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" />
</template>
<template v-else-if="col.bodyType === 'select'">
<HandleFormItem type="select" class="body-select" @blur="onBlur(rowIndex, col.prop, $event)"
:item="getBodyItem(col, rowIndex)" v-model="row[col.prop]"
@change="onBodyValueChange(rowIndex, colIndex, $event)"
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" />
</template>
<template v-else>
{{ row[col.prop] }}
</template>
</div>
<div class="m-l-5" v-if="col.showBodySub">
<template v-if="col.bodySubType === 'inputNumber'">
<HandleFormItem type="inputNumber" @blur="onSubBlur(rowIndex, col.bodySubKey, $event)"
@copy="onCopy(rowIndex, col)" :item="getBodySubItem(col)" v-model="row[col.bodySubKey]"
@change="onBodySubValueChange(rowIndex, colIndex, $event)"
:error="hasError(rowIndex, colIndex, col.bodySubKey)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)" />
</template>
<template v-else>
{{ row[col.bodySubKey] }}
</template>
</div>
</div>
</div>
</div>
<!-- 默认操作栏 -->
<div class="custom-table-cell body-cell" :style="{ width: '180px' }" v-if="showOperation">
<div class="inner-table-cell">
<slot name="operation" :row="row" :rowIndex="rowIndex" ></slot>
<!-- 默认操作栏 -->
<div class="custom-table-cell body-cell" :style="{ width: '180px' }" v-if="showOperation">
<div class="inner-table-cell">
<slot name="operation" :row="row" :rowIndex="rowIndex"></slot>
</div>
</div>
</div>
</div>
<div v-if="localDataSource.length == 0">
<div class="no-data">暂无数据</div>
</div>
</div>
<div v-if = "localDataSource.length==0">
<div class="no-data">暂无数据</div>
<div class="add-row" v-if="isShowAddRos()">
<el-button type="primary" plain @click="addRow">添加行</el-button>
</div>
</div>
</template>
@ -81,6 +106,10 @@ export default {
//
showHeaderSelect: {
type: Boolean,
default: false,
},
showAddRow: {
type: Boolean,
default: true,
},
//
@ -99,7 +128,7 @@ export default {
},
formData: {
type: Object,
default:()=>{
default: () => {
return {
stepTableFormData: [],
headerSelectFields: {}
@ -115,27 +144,34 @@ export default {
}
},
watch: {
formData:{
formData: {
immediate: true,
handler(newData) {
console.log(newData,"newData")
const {stepTableFormData = [], headerSelectFields = {}} = newData;
console.log(newData, "newData")
const { stepTableFormData = [], headerSelectFields = {} } = newData;
this.updateDataSource(stepTableFormData);
this.headerSelectFields = JSON.parse(JSON.stringify(headerSelectFields))
}
},
},
mounted() {
this.initHeaderSelectValues();
// this.initHeaderSelectValues();
console.log(this.$store.state.template.templateStatus, "this.$store.state.template.templateStatus")
},
methods: {
isShowAddRos() {
if(!this.showAddRow) {
return false;
}
return this.$store.state.template.templateStatus === 'preFill';
},
//
onCopy(rowIndex, col){
if(col.copyFrom){
if(!this.localDataSource[rowIndex][col.copyFrom]){//
return
}
onCopy(rowIndex, col) {
if (col.copyFrom) {
if (!this.localDataSource[rowIndex][col.copyFrom]) {//
return
}
this.$set(this.localDataSource[rowIndex], col.prop, this.localDataSource[rowIndex][col.copyFrom])
}
},
@ -143,7 +179,7 @@ export default {
initHeaderSelectValues() {
const headerSelectObj = {};
this.columns.map(col => {
if(col.headerSelectKey){
if (col.headerSelectKey) {
headerSelectObj[col.headerSelectKey] = col.defaultValue || col.headerOptions[0].value || ""
}
});
@ -152,17 +188,17 @@ export default {
//
getFormData() {
// columns
//
const validateResult = this.validateFormData();
return new Promise((resolve,reject)=>{
if(validateResult.valid){
return new Promise((resolve, reject) => {
if (validateResult.valid) {
resolve({
stepTableFormData: [...this.localDataSource],
headerSelectFields: this.headerSelectFields,
})
}else{
} else {
// this.$message.error(",");
reject(validateResult.errors[0].error)
}
@ -173,10 +209,28 @@ export default {
validateFormData() {
const templateStatus = this.$store.state.template.templateStatus;
const errors = [];
//
this.formErrors = [];
// HandleFormItem
this.columns.forEach((col, colIndex) => {
if (col.headerSelectKey && col.headerOptions && col.fillType === templateStatus) {
const headerValue = this.headerSelectFields[col.headerSelectKey];
if (this.isValueEmpty(headerValue)) {
const errorItem = {
rowIndex: -1, //
colIndex,
field: col.headerSelectKey,
label: col.label,
error: `请选择${col.label}`
};
errors.push(errorItem);
this.formErrors.push(errorItem);
}
}
});
//
this.localDataSource.forEach((row, rowIndex) => {
//
@ -196,11 +250,11 @@ export default {
errors.push(errorItem);
this.formErrors.push(errorItem);
}
//
if (col.bodySubKey&& !col.bodySubDisabled) {
if (col.bodySubKey && !col.bodySubDisabled) {
const subValue = row[col.bodySubKey];
console.log(col,subValue,"subValue")
console.log(col, subValue, "subValue")
if (this.isValueEmpty(subValue)) {
const errorItem = {
rowIndex,
@ -216,7 +270,7 @@ export default {
}
});
});
return {
valid: errors.length === 0,
errors: errors
@ -238,15 +292,20 @@ export default {
//
onHeaderSelectChange(col, value) {
this.headerSelectFields[col.headerSelectKey] = value;
//
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === -1 &&
error.field === col.headerSelectKey)
);
},
//
onBodyValueChange(rowIndex, colIndex, value) {
const col = this.columns[colIndex];
this.localDataSource[rowIndex][col.prop] = value;
//
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === rowIndex &&
error.colIndex === colIndex &&
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === rowIndex &&
error.colIndex === colIndex &&
error.field === col.prop)
);
this.$emit('body-value-change', rowIndex, colIndex, value);
@ -256,9 +315,9 @@ export default {
const col = this.columns[colIndex];
this.localDataSource[rowIndex][col.bodySubKey] = value;
//
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === rowIndex &&
error.colIndex === colIndex &&
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === rowIndex &&
error.colIndex === colIndex &&
error.field === col.bodySubKey)
);
this.$emit('body-sub-value-change', rowIndex, colIndex, value);
@ -270,9 +329,9 @@ export default {
label: ""
}
},
getBodyItem(col,rowIndex) {
getBodyItem(col, rowIndex) {
const currentItem = this.localDataSource[rowIndex];
const item = {
const item = {
fillType: col.bodyFillType,
options: col.bodyOptions,
maxlength: col.bodyMaxlength,
@ -280,21 +339,21 @@ export default {
precision: currentItem[col.bodyPrecisionKey] || col.precision || 0,
copyFrom: col.copyFrom || "",
};
if(col.bodyDisabled){
if (col.bodyDisabled) {
item.disabled = col.bodyDisabled;
}
return item
},
getBodySubItem(col) {
const item = {
const item = {
fillType: col.bodySubFillType,
options: col.bodySubOptions,
maxlength: col.bodySubMaxlength || 10,
label: "",
placeholder:col.bodySubPlaceholder||"请输入",
placeholder: col.bodySubPlaceholder || "请输入",
precision: col.subPrecision || 0,
}
if(col.bodySubDisabled){
if (col.bodySubDisabled) {
item.disabled = col.bodySubDisabled;
}
return item
@ -310,42 +369,42 @@ export default {
this.localDataSource = JSON.parse(JSON.stringify(dataSource || []));
},
//
addRow(row) {
addRow(row = {}) {
this.localDataSource.push(row);
},
getDataSource(){
getDataSource() {
return this.localDataSource;
},
//
updateDataSourceByRowIndex(rowIndex,data){
this.localDataSource[rowIndex] = {...this.localDataSource[rowIndex],...data};
console.log(this.localDataSource,"this.localDataSource")
updateDataSourceByRowIndex(rowIndex, data) {
this.localDataSource[rowIndex] = { ...this.localDataSource[rowIndex], ...data };
console.log(this.localDataSource, "this.localDataSource")
this.localDataSource = [...this.localDataSource];
},
//
hasError(rowIndex, colIndex, field) {
return this.formErrors.some(error =>
error.rowIndex === rowIndex &&
error.colIndex === colIndex &&
return this.formErrors.some(error =>
error.rowIndex === rowIndex &&
error.colIndex === colIndex &&
error.field === field
);
},
//
onErrorUpdate(rowIndex, colIndex, field, isError) {
if (!isError) {
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === rowIndex &&
error.colIndex === colIndex &&
this.formErrors = this.formErrors.filter(error =>
!(error.rowIndex === rowIndex &&
error.colIndex === colIndex &&
error.field === field)
);
}
},
onSubBlur(rowIndex, colKey, value) {
this.$emit("blur", {rowIndex, colKey, value,item:this.localDataSource[rowIndex]});
this.$emit("blur", { rowIndex, colKey, value, item: this.localDataSource[rowIndex] });
},
onBlur(rowIndex, colKey) {
const value = this.localDataSource[rowIndex][colKey];
this.$emit("blur", {rowIndex, colKey, value,item:this.localDataSource[rowIndex]});
this.$emit("blur", { rowIndex, colKey, value, item: this.localDataSource[rowIndex] });
}
}
};
@ -361,17 +420,20 @@ export default {
margin-top: 20px;
}
.inner-table-cell{
.inner-table-cell {
display: flex;
align-items: center;
align-items: center;
justify-content: center;
}
.m-l-5{
.m-l-5 {
margin-left: 5px;
}
.sub-input-number{
.sub-input-number {
width: 145px;
.el-input-number--mini{
.el-input-number--mini {
width: 145px;
}
}
@ -406,6 +468,7 @@ export default {
display: table;
width: 100%;
table-layout: fixed;
&:not(:last-child) {
border-bottom: 1px solid #ebeef5;
}
@ -473,9 +536,17 @@ export default {
width: 100px;
margin-left: 5px;
}
.no-data{
.no-data {
text-align: center;
padding: 20px 0;
color: rgb(144, 147, 153)
}
.add-row {
display: flex;
justify-content: center;
padding: 20px 0;
margin-top: 20px;
}
</style>

+ 24
- 4
src/components/Template/HandleFormItem.vue View File

@ -115,11 +115,28 @@ export default {
const value = val !== undefined ? val : this.inputValue;
this.$emit('input', value);
this.$emit('change', value);
//
if (this.error) {
//
const isEmpty = this.isValueEmpty(value);
if (this.error && !isEmpty) {
this.$emit('update:error', false);
} else if (!this.error && isEmpty) {
this.$emit('update:error', true);
}
},
//
isValueEmpty(value) {
if (value === null || value === undefined || value === '') {
return true;
}
if (typeof value === 'string' && value.trim() === '') {
return true;
}
if (Array.isArray(value) && value.length === 0) {
return true;
}
return false;
},
handleClickable(item,event){
if(item.fillType !== 'actFill'){
return
@ -176,9 +193,12 @@ export default {
this.$emit("copy")
},
onBlur(val) {
//
if (this.error) {
//
const isEmpty = this.isValueEmpty(this.inputValue);
if (this.error && !isEmpty) {
this.$emit('update:error', false);
} else if (!this.error && isEmpty) {
this.$emit('update:error', true);
}
this.$emit("blur", val)
},

+ 2
- 22
src/views/business/comps/template/comps/gy/MJYLQSQD.vue View File

@ -18,9 +18,6 @@
<TableOpertaion :fillType="fillType" :row="row" :rowIndex="rowIndex" @deleteRow="deleteRow"></TableOpertaion>
</template>
</CustomTable>
<div class="add-row">
<el-button type="primary" plain @click="addRow">添加行</el-button>
</div>
</div>
<BaseInfoFormPcakge label="特别说明" ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
@ -190,20 +187,7 @@ export default {
methods: {
async getFormData() {
const baseData = await this.$refs.baseInfoRef.getFormData();
const stepFormData = await this.$refs.stepFormPackageRef.getFormData();
const stepTableFormData = await this.$refs.stepTableRef.getFormData();
const remarkData = await this.$refs.remarkRef.getFormData();
if(!stepTableFormData.stepTableFormData.length){
this.$message.error("请添加计划信息");
return;
}
return {
...baseData,
...stepFormData,
...remarkData,
...stepTableFormData
}
return await this.validFormFields(["baseInfoRef", "stepFormPackageRef","stepTableRef","remarkRef"]);
},
async onSave() {
const formData = await this.getFormData();
@ -225,9 +209,5 @@ export default {
.mt-20 {
margin-top: 20px;
}
.add-row{
display: flex;
justify-content: center;
padding: 20px 0;
}
</style>

+ 2
- 22
src/views/business/comps/template/comps/gy/SYWZPZJHB.vue View File

@ -18,9 +18,6 @@
<TableOpertaion :fillType="fillType" :row="row" :rowIndex="rowIndex" @deleteRow="deleteRow"></TableOpertaion>
</template>
</CustomTable>
<div class="add-row">
<el-button type="primary" plain @click="addRow">添加行</el-button>
</div>
</div>
<BaseInfoFormPcakge label="特别说明" ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
@ -191,20 +188,7 @@ export default {
methods: {
async getFormData() {
const baseData = await this.$refs.baseInfoRef.getFormData();
const stepFormData = await this.$refs.stepFormPackageRef.getFormData();
const stepTableFormData = await this.$refs.stepTableRef.getFormData();
const remarkData = await this.$refs.remarkRef.getFormData();
if(!stepTableFormData.stepTableFormData.length){
this.$message.error("请添加计划信息");
return;
}
return {
...baseData,
...stepFormData,
...remarkData,
...stepTableFormData
}
return await this.validFormFields(["baseInfoRef", "stepFormPackageRef","stepTableRef","remarkRef"]);
},
async onSave() {
const formData = await this.getFormData();
@ -226,9 +210,5 @@ export default {
.mt-20 {
margin-top: 20px;
}
.add-row{
display: flex;
justify-content: center;
padding: 20px 0;
}
</style>

+ 6
- 38
src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue View File

@ -16,7 +16,7 @@
<div class="template-form-item">
<BaseInfoFormPcakge @clickable="handleClickable" ref="stepFormPackageRef" :formConfig="stepFormConfig" @blur="onHandleBlur"
:formData="formData" />
<CustomTable @blur="onHandleTableBlur" :showOperation="fillType === 'actFillill'" ref="stepTableRef" :columns="stepColumns"
<CustomTable :showAddRow="false" @blur="onHandleTableBlur" :showOperation="fillType === 'actFillill'" ref="stepTableRef" :columns="stepColumns"
:formData="formData" >
<template slot="operation" slot-scope="{ row, rowIndex}">
<TableOpertaion :fillType="fillType" :row="row" :rowIndex="rowIndex" @deleteRow="deleteRow"></TableOpertaion>
@ -428,24 +428,7 @@ export default {
};
},
mounted() {
if (this.fillType === "preFill") {
this.formData = {
effectivePeriodUnit: "days",//
createTime: "2026-01-02 18:05:36",//
versionNum:1,
stepTableFormData: [],
headerSelectFields: {
targetStartSolutionVolumeUnit: "mg",
actStartSolutionVolumeUnit: "mg",
targetDiluentVolumeUnit: "mg",
actDiluentVolumeUnit: "mg",
targetSolutionConcentrationUnit: "mg",
actSolutionConcentrationUnit: "mg",
targetSolutionVolumeUnit: "mg",
actSolutionVolumeUnit: "mg",
}
}
}
},
methods: {
handleClickable(item) {
@ -453,6 +436,7 @@ export default {
// return;
}
const {subKey = ""} = item;
console.log(subKey,"subKey")
if(subKey === "subStartSolution" || subKey === "subSolution"){//
this.selectReagentVisible = true;
this.currentSubKey = subKey;
@ -464,28 +448,12 @@ export default {
this.selectReagentVisible = false;
},
async getFormData() {
const baseData = await this.$refs.baseInfoRef.getFormData();
const conditionData = await this.$refs.storageConditionRef.getFormData();
const stepFormData = await this.$refs.stepFormPackageRef.getFormData();
const stepTableFormData = await this.$refs.stepTableRef.getFormData();
const stepData = await this.$refs.stepRef.getFormData();
if (!stepData.length) {
this.$message.error("请添加步骤");
return;
}
const remarkData = await this.$refs.remarkRef.getFormData();
return {
...baseData,
...conditionData,
stepData,
...stepFormData,
...remarkData,
...stepTableFormData
}
return await this.validFormFields(["baseInfoRef", "storageConditionRef","stepFormPackageRef","stepTableRef","stepRef","remarkRef"]);
},
async onSave() {
// const formData = await this.getFormData();
const formData = await this.$refs.stepTableRef.getFormData();
const formData = await this.validFormFields(["baseInfoRef", "storageConditionRef","stepFormPackageRef","stepTableRef","stepRef","remarkRef"]);
console.log(formData, "formData")
}
}

+ 1
- 16
src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue View File

@ -245,22 +245,7 @@ export default {
},
methods: {
async getFormData() {
const baseData = await this.$refs.baseInfoRef.getFormData();
const conditionData = await this.$refs.storageConditionRef.getFormData();
const stepFormData = await this.$refs.stepFormPackageRef.getFormData();
const stepData = await this.$refs.stepRef.getFormData();
if (!stepData.length) {
this.$message.error("请添加步骤");
return;
}
const remarkData = await this.$refs.remarkRef.getFormData();
return {
...baseData,
...conditionData,
stepData,
...stepFormData,
...remarkData
}
return await this.validFormFields(["baseInfoRef", "storageConditionRef","stepFormPackageRef","stepRef","remarkRef"]);
},
async onSave() {
const formData = await this.getFormData();

+ 1
- 19
src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue View File

@ -248,29 +248,11 @@ export default {
};
},
mounted() {
if(this.fillType === "preFill"){
this.formData = {
effectivePeriodUnit:"days",//
createTime: "2026-01-02 18:05:36",//
}
}
},
methods: {
async getFormData() {
// const baseData = await this.$refs.baseInfoRef.getFormData();
// const conditionData = await this.$refs.storageConditionRef.getFormData();
// const stepFormData = await this.$refs.stepFormPackageRef.getFormData();
// const stepData = await this.$refs.stepRef.getFormData();
// const remarkData = await this.$refs.remarkRef.getFormData();
return await this.validFormFields(["baseInfoRef", "storageConditionRef","stepFormPackageRef","stepRef","remarkRef"]);
return {
...baseData,
...conditionData,
stepData,
...stepFormData,
...remarkData
}
},
async onSave() {
// const formData = await this.getFormData();

+ 1
- 6
src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue View File

@ -969,12 +969,7 @@ export default {
.config-header .el-button:hover {
color: #f78989;
}
.add-row {
display: flex;
align-items: center;
padding: 20px 0;
border-bottom: 1px solid #ebeef5;
}
.mt-0{
margin-top: 0;
}

Loading…
Cancel
Save