Browse Source

feat:[模板管理][update]

master
luojie 4 days ago
parent
commit
78dae6dadf
11 changed files with 44 additions and 81 deletions
  1. +5
    -2
      src/components/Template/BaseInfoFormPcakge.vue
  2. +1
    -1
      src/components/Template/CustomTable.vue
  3. +4
    -4
      src/components/Template/Step.vue
  4. +1
    -7
      src/views/business/comps/template/comps/dl/SYWZPZJHB.vue
  5. +0
    -7
      src/views/business/comps/template/comps/gy/MJYLQSQD.vue
  6. +1
    -7
      src/views/business/comps/template/comps/gy/SYWZPZJHB.vue
  7. +0
    -10
      src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
  8. +0
    -12
      src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue
  9. +8
    -26
      src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
  10. +0
    -4
      src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue
  11. +24
    -1
      src/views/business/comps/template/mixins/templateMixin.js

+ 5
- 2
src/components/Template/BaseInfoFormPcakge.vue View File

@ -273,7 +273,6 @@ export default {
formFields[key] !== ''&&
typeof formFields[key] !== 'object'
) {
console.log(key,formData,formFields[key],"kkk")
// 使formData
result[key] = formFields[key];
} else {
@ -339,6 +338,10 @@ export default {
if (o.label === "其他" && !this.isShowOther(formFields[o.parentKey])) {
continue
}
//span
if(o.type === "span"){
continue
}
if (o.fillType == templateStatus && !o.disabled) {
//
errors[key] = true;
@ -362,7 +365,7 @@ export default {
return new Promise((resolve, reject) => {
if (Object.keys(errors).length > 0) {
//
this.$message.error(`表单内容未填完,请填写后再提交`);
// this.$message.error(`,`);
reject(`${firstError.label}还未${firstError.prefix}`);
} else {
resolve(formFields);

+ 1
- 1
src/components/Template/CustomTable.vue View File

@ -163,7 +163,7 @@ export default {
headerSelectFields: this.headerSelectFields,
})
}else{
this.$message.error("表单内容未填完,请填写后再提交");
// this.$message.error(",");
reject(validateResult.errors[0].error)
}
})

+ 4
- 4
src/components/Template/Step.vue View File

@ -233,15 +233,15 @@ export default {
//
const validation = this.validateSteps()
if (!validation.isValid) {
this.$message.error(validation.errors[0])
// this.$message.error(validation.errors[0])
reject(validation.errors[0])
return
}
//
if (this.steps.length === 0) {
this.$message.error(this.$t('template.common.addStepError'))
reject(this.$t('template.common.addStepError'))
// this.$message.error(this.$t('template.common.addStepError'))
reject({errorType:"step"});
return
}
@ -249,7 +249,7 @@ export default {
type: step.type,
...step.formData
}))
resolve(stepData)
resolve({stepData})
})
},

+ 1
- 7
src/views/business/comps/template/comps/dl/SYWZPZJHB.vue View File

@ -186,13 +186,7 @@ export default {
};
},
mounted() {
this.formData = {
headerSelectFields: {
preparationVolumeUnit: "ml",
preparationConcentrationUnit: "ul",
}
}
console.log("mounted")
},
methods: {

+ 0
- 7
src/views/business/comps/template/comps/gy/MJYLQSQD.vue View File

@ -186,13 +186,6 @@ export default {
};
},
mounted() {
this.formData = {
headerSelectFields: {
preparationVolumeUnit: "ml",
preparationConcentrationUnit: "ul",
}
}
},
methods: {

+ 1
- 7
src/views/business/comps/template/comps/gy/SYWZPZJHB.vue View File

@ -186,13 +186,7 @@ export default {
};
},
mounted() {
this.formData = {
headerSelectFields: {
preparationVolumeUnit: "ml",
preparationConcentrationUnit: "ul",
}
}
},
methods: {

+ 0
- 10
src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue View File

@ -53,22 +53,12 @@ export default {
components: { BaseInfoFormPcakge, LineLabel, TableList, Step, CustomTable, SelectReagentDialog, TableOpertaion },
mixins: [templateMixin],
props: {
value: {
type: {},
default: () => { },
},
fillType: {
type: String,
default: 'preFill',
},
},
watch: {
value: {
immediate: true,
handler(v) {
}
},
fillType: {
immediate: true,
handler(v) {

+ 0
- 12
src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue View File

@ -41,23 +41,11 @@ export default {
components: { BaseInfoFormPcakge, LineLabel, TableList, Step, CustomTable },
mixins: [templateMixin],
props: {
value: {
type: {},
default: () => { },
},
fillType: {
type: String,
default: 'preFill',
},
},
watch: {
value: {
immediate: true,
handler(v) {
}
}
},
computed: {
storageFormConfig() {
return [

+ 8
- 26
src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue View File

@ -41,23 +41,11 @@ export default {
components: { BaseInfoFormPcakge, LineLabel, TableList, Step, CustomTable },
mixins: [templateMixin],
props: {
value: {
type: {},
default: () => { },
},
fillType: {
type: String,
default: 'preFill',
},
},
watch: {
value: {
immediate: true,
handler(v) {
}
}
},
computed: {
storageFormConfig() {
return [
@ -269,16 +257,13 @@ 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(this.$t('template.common.addStepError'));
return;
}
const remarkData = await this.$refs.remarkRef.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,
@ -289,10 +274,7 @@ export default {
},
async onSave() {
// const formData = await this.getFormData();
const result = await Promise.all([this.$refs.baseInfoRef.getFormData(), this.$refs.storageConditionRef.getFormData()]).catch(()=>{
console.log("error")
});
console.log(result,"res")
// console.log(formData, "formData")
},

+ 0
- 4
src/views/business/comps/template/comps/sp/SWYPNBGZYZBB.vue View File

@ -144,10 +144,6 @@ export default {
components: { BaseInfoFormPcakge, LineLabel, TableList, Step, CustomTable, SelectReagentDialog, TableOpertaion },
mixins: [templateMixin],
props: {
value: {
type: {},
default: () => { },
},
fillType: {
type: String,
default: 'preFill',

+ 24
- 1
src/views/business/comps/template/mixins/templateMixin.js View File

@ -37,7 +37,30 @@ export default {
this.setTemplateData({});
},
methods: {
//统一校验form表单是否填写
async validFormFields(refArr = []) {
let result = {};
const refs = refArr.map(ref => {
const refData = this.$refs[ref].getFormData();
return refData;
});
const validFormData = await Promise.all(refs).catch(err => {
// this.$message.error(err);
if(err.errorType && err.errorType === "step"){
this.$message.error("请添加步骤");
return
}
console.log(err,"err")
this.$message.error("表单内容未填完,请填写后再提交");
});
if(validFormData){
validFormData.forEach(item => {
result = {...result,...item}
})
return result;
}
return false;
},
//试验配制条件options
getDictOptions(dictType) {
return this.dict.type[dictType] || [];

Loading…
Cancel
Save