Browse Source

feat:[模板管理][暂存]

ouqian
luojie 1 month ago
parent
commit
ba3742ceaa
6 changed files with 127 additions and 31 deletions
  1. +3
    -0
      src/components/Template/CustomTable.vue
  2. +2
    -0
      src/components/Template/HandleFormItem.vue
  3. +19
    -4
      src/components/Template/SelectTable.vue
  4. +1
    -0
      src/components/Template/mixins/formPackageMixins.js
  5. +81
    -22
      src/views/business/comps/template/comps/sp/SP0021.vue
  6. +21
    -5
      src/views/business/comps/template/dialog/SelectMixReagentDialog.vue

+ 3
- 0
src/components/Template/CustomTable.vue View File

@ -780,6 +780,9 @@ export default {
if (col.qxbdType) { if (col.qxbdType) {
item.qxbdType = col.qxbdType; item.qxbdType = col.qxbdType;
} }
if (col.checkType) {
item.checkType = col.checkType;
}
// checkboxLabel - // checkboxLabel -
const dynamicLabelKey = col.prop + 'Label'; const dynamicLabelKey = col.prop + 'Label';
if (currentItem && currentItem[dynamicLabelKey]) { if (currentItem && currentItem[dynamicLabelKey]) {

+ 2
- 0
src/components/Template/HandleFormItem.vue View File

@ -628,6 +628,8 @@ export default {
params.mixType = true; params.mixType = true;
} else if (item.qxbdType) { } else if (item.qxbdType) {
params.qxbdType = item.qxbdType; params.qxbdType = item.qxbdType;
} else if (item.checkType) {
params.checkType = item.checkType;
} }
} }
EventBus.$emit(eventName, params) EventBus.$emit(eventName, params)

+ 19
- 4
src/components/Template/SelectTable.vue View File

@ -14,12 +14,18 @@
<el-button @click="reset">{{ $t('form.reset') }}</el-button> <el-button @click="reset">{{ $t('form.reset') }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table :data="dataSource" :row-key="(row) => row.id">
<el-table-column width="80" align="center" v-if="showRadio">
<el-table :data="dataSource" :row-key="(row) => row.id" @selection-change="handleSelectionChange">
<el-table-column width="80" align="center" v-if="checkType === 'radio'">
<template slot-scope="scope"> <template slot-scope="scope">
<el-radio v-model="localSelectedId" :label="scope.row[selectedCode]" class="hide-label" @input.native.stop="handleRadioClick(scope.row)"></el-radio> <el-radio v-model="localSelectedId" :label="scope.row[selectedCode]" class="hide-label" @input.native.stop="handleRadioClick(scope.row)"></el-radio>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column
v-else-if = "checkType === 'checkbox'"
type="selection"
@selection-change="handleSelectionChange"
width="55">
</el-table-column>
<el-table-column v-for="(item) in columns" :prop="item.prop" :key="item.prop" :formatter="item.formatter" :label="$t(item.label)"> <el-table-column v-for="(item) in columns" :prop="item.prop" :key="item.prop" :formatter="item.formatter" :label="$t(item.label)">
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -46,7 +52,11 @@ export default {
type: Object, type: Object,
default: () => {}, default: () => {},
}, },
showRadio: {//
checkType: {//
type: String,
default: "radio",
},
showCheckbox: {//
type: Boolean, type: Boolean,
default: true, default: true,
}, },
@ -79,6 +89,7 @@ export default {
data() { data() {
return { return {
localSelectedId: "", localSelectedId: "",
localSelectedRows: [],
listParams: { listParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
@ -153,7 +164,11 @@ export default {
this.localSelectedId = row[this.selectedCode]; this.localSelectedId = row[this.selectedCode];
this.$emit("radioSelect", row[this.selectedCode],row); this.$emit("radioSelect", row[this.selectedCode],row);
}, },
//
handleSelectionChange(selection) {
this.localSelectedRows = selection;
this.$emit("radioSelect","", selection);
},
} }
} }

+ 1
- 0
src/components/Template/mixins/formPackageMixins.js View File

@ -75,6 +75,7 @@ export default {
parentLabel: item.label, parentLabel: item.label,
filledCodes: item.filledCodes, filledCodes: item.filledCodes,
qxbdType: item.qxbdType, qxbdType: item.qxbdType,
checkType: item.checkType,
} }
}, },

+ 81
- 22
src/views/business/comps/template/comps/sp/SP0021.vue View File

@ -15,32 +15,32 @@
:formConfig="storageFormConfig" :formData="formData" /> :formConfig="storageFormConfig" :formData="formData" />
<LineLabel label="样本说明" /> <LineLabel label="样本说明" />
<el-button class="mt-20" v-if="fillType === 'actFill'" type="primary" @click="onAdd">新增</el-button> <el-button class="mt-20" v-if="fillType === 'actFill'" type="primary" @click="onAdd">新增</el-button>
<div class="template-form-item">
<div v-for="(item, index) in formData.ybsmDataList" :key="index" class="template-form-item">
<div class="config-header"> <div class="config-header">
<div></div> <div></div>
<el-button v-if="fillType === 'actFill'" type="text" icon="el-icon-delete" <el-button v-if="fillType === 'actFill'" type="text" icon="el-icon-delete"
@click="deleteConfig">{{ $t('template.common.deleteBtn')
@click="deleteConfig(index)">{{ $t('template.common.deleteBtn')
}}</el-button> }}</el-button>
</div> </div>
<BaseInfoFormPackage fieldItemLabel="样本说明" :ref="refConfig.ybsmFormPackageRef"
:formConfig="ybsmFormConfig" @blur="onHandleBlur" :formData="formData" />
<BaseInfoFormPackage fieldItemLabel="样本说明" :ref="`ybsmFormPackageRef${index}`"
:formConfig="ybsmFormConfig" @blur="onHandleBlur" :formData="item" />
<el-button v-if="fillType === 'actFill'" type="primary" @click="onImportAnimal">导入动物</el-button> <el-button v-if="fillType === 'actFill'" type="primary" @click="onImportAnimal">导入动物</el-button>
<CustomTable <CustomTable
:ref = "refConfig.ybsmTableRef"
:ref = "`ybsmTableRef${index}`"
:columns="ybsmColumns" :columns="ybsmColumns"
:showOperation="fillType === 'actFill'" :showOperation="fillType === 'actFill'"
:showAddRow="fillType === 'actFill'" :showAddRow="fillType === 'actFill'"
:dataSource="formData.ybsmData" >
:dataSource="item.ybsmData || []" >
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> <template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete <TableOpertaionDelete
:row="row" :row="row"
:rowIndex="rowIndex" :rowIndex="rowIndex"
:columns="columns" :columns="columns"
@deleteRow="() => deleteTableRow(rowIndex, 'ybsmTableRef')"
@deleteRow="() => deleteTableRow(rowIndex, `ybsmTableRef${index}`)"
></TableOpertaionDelete> ></TableOpertaionDelete>
</template> </template>
</CustomTable> </CustomTable>
<Step :ref="refConfig.stepRef" :formData="formData.stepData"></Step>
<Step :ref="`stepRef${index}`" :formData="item.stepData"></Step>
</div> </div>
<BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark" <BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark"
:ref="refConfig.remarkRef" :formConfig="remarkConig" :formData="formData" /> :ref="refConfig.remarkRef" :formConfig="remarkConig" :formData="formData" />
@ -63,6 +63,7 @@ import Step from "@/components/Template/Step";
import templateMixin from "../../mixins/templateMixin"; import templateMixin from "../../mixins/templateMixin";
import CustomTable from '@/components/Template/CustomTable.vue'; import CustomTable from '@/components/Template/CustomTable.vue';
import { uniqeResource } from "@/utils/calUnitTools"; import { uniqeResource } from "@/utils/calUnitTools";
import {getuuid} from "@/utils/index";
import { getBaseInfoFormConfig, getStorageFormConfig, getRemarkFormConfig, getYbsmFormConfig,getTableColumns } from "../../formConfig/sp/SP0021"; import { getBaseInfoFormConfig, getStorageFormConfig, getRemarkFormConfig, getYbsmFormConfig,getTableColumns } from "../../formConfig/sp/SP0021";
const refConfig = { const refConfig = {
baseInfoRef: "baseInfoRef", baseInfoRef: "baseInfoRef",
@ -110,20 +111,40 @@ export default {
}, },
}, },
data() { data() {
return {
refConfig,
formData: {},
};
},
return {
refConfig,
};
},
mounted() { mounted() {
if(this.fillType === 'preFill'){//
this.onAdd()
}
}, },
methods: { methods: {
// //
deleteConfig(){},
deleteConfig(index){
// ybsmDataList
if (!this.formData.ybsmDataList) {
this.formData.ybsmDataList = [{}];
return;
}
if (this.formData.ybsmDataList.length > 1) {
this.formData.ybsmDataList.splice(index, 1);
} else {
this.$message.warning('至少需要保留一个样本说明项');
}
},
// //
onAdd(){ onAdd(){
if (!this.formData.ybsmDataList) {
this.$set(this.formData, 'ybsmDataList', []);
}
//
this.formData.ybsmDataList.push({
id: getuuid(),
ybsmFormData: {},
stepData: [],
});
}, },
onLoadExcelData(excelData) { onLoadExcelData(excelData) {
const data = excelData.splice(1); const data = excelData.splice(1);
@ -146,12 +167,43 @@ export default {
}, },
// //
getFilledFormData() { getFilledFormData() {
return this.getFilledFormDataByRefs(compRefs)
//
const baseData = this.getFilledFormDataByRefs(compRefs);
//
const ybsmDataList = this.formData.ybsmDataList.map((item, index) => {
const ybsmFormData = this.$refs[`ybsmFormPackageRef${index}`]?.getFilledFormData() || {};
const ybsmTableData = this.$refs[`ybsmTableRef${index}`]?.getFilledFormData() || [];
const stepData = this.$refs[`stepRef${index}`]?.getFilledFormData() || {};
return {
...ybsmFormData,
ybsmData: ybsmTableData,
stepData: stepData
};
});
return {
...baseData,
ybsmDataList
};
}, },
// //
async getFormData() { async getFormData() {
//
let content = await this.validFormFields(compRefs); let content = await this.validFormFields(compRefs);
return content;
if (!content) return null;
//
for (let index = 0; index < this.formData.ybsmDataList.length; index++) {
//
const ybsmFormValid = await this.$refs[`ybsmFormPackageRef${index}`]?.validFormFields() || true;
if (!ybsmFormValid) return null;
//
const stepValid = await this.$refs[`stepRef${index}`]?.getFormData() || true;
if (!stepValid) return null;
}
//
return this.getFilledFormData();
}, },
getResource() { getResource() {
let content = this.getFilledFormData(); let content = this.getFilledFormData();
@ -179,14 +231,21 @@ export default {
}) })
} }
//使 //使
const stepResource = this.$refs.stepRef.getStepResource()
this.resourceTmp = uniqeResource(tmpResource, stepResource.sjResource || [])
this.yqResourceTmp = stepResource.yqResource || []
let allSjResource = [];
let allYqResource = [];
//
for (let index = 0; index < this.formData.ybsmDataList.length; index++) {
const stepResource = this.$refs[`stepRef${index}`]?.getStepResource() || { sjResource: [], yqResource: [] };
allSjResource = [...allSjResource, ...(stepResource.sjResource || [])];
allYqResource = [...allYqResource, ...(stepResource.yqResource || [])];
}
this.resourceTmp = uniqeResource(tmpResource, allSjResource)
this.yqResourceTmp = allYqResource
return this.resourceTmp; return this.resourceTmp;
}, },
// //
async onSave() { async onSave() {
let content = await this.$refs.stepRef.getFormData();
let content = await this.getFormData();
console.log(content); console.log(content);
}, },

+ 21
- 5
src/views/business/comps/template/dialog/SelectMixReagentDialog.vue View File

@ -8,6 +8,7 @@
<el-radio-button label="3">给药制剂列表</el-radio-button> <el-radio-button label="3">给药制剂列表</el-radio-button>
</el-radio-group> </el-radio-group>
<SelectTable ref="selectSjRef" :columns="columns" :selectedId="selectedId" :searchForm="searchForm" <SelectTable ref="selectSjRef" :columns="columns" :selectedId="selectedId" :searchForm="searchForm"
:checkType="checkType"
:studyFormId="studyFormId" :studyId="studyId" :listApi="listApi" :selectedCode="selectedCode" @radioSelect="handleSelect" /> :studyFormId="studyFormId" :studyId="studyId" :listApi="listApi" :selectedCode="selectedCode" @radioSelect="handleSelect" />
<!-- 只有步骤才会又这个选项 --> <!-- 只有步骤才会又这个选项 -->
@ -82,7 +83,7 @@ export default {
otherChecked: false, otherChecked: false,
selectedId: "", selectedId: "",
selectedCode: "bh", selectedCode: "bh",
currentRow: {},
currentRow: null,
radio: 1, radio: 1,
bzList: [], bzList: [],
depart: "", depart: "",
@ -99,12 +100,17 @@ export default {
title:"选择试剂", title:"选择试剂",
currentType: '1',// currentType: '1',//
qxbdType:"",// qxbdType:"",//
//
checkType: "radio",
} }
}, },
computed: { computed: {
isDisabled() { isDisabled() {
if (this.otherChecked && this.otherReagent) {// if (this.otherChecked && this.otherReagent) {//
return false; return false;
}else if(this.checkType === "checkbox"){
console.log(this.currentRow,"this.currentRow")
return !this.currentRow || this.currentRow.length === 0;
} }
return !this.selectedId; return !this.selectedId;
} }
@ -115,12 +121,13 @@ export default {
this.uuid = data.uuid this.uuid = data.uuid
} }
//type:sj()gsp()gyzj() //type:sj()gsp()gyzj()
const { type, sourceFrom = "step", mixType = false } = data;
const { type, sourceFrom = "step", mixType = false ,checkType = "radio"} = data;
this.currentType = type; this.currentType = type;
if(type==15){ if(type==15){
this.selectedCode = 'id' this.selectedCode = 'id'
this.qxbdType = data.qxbdType || ''; this.qxbdType = data.qxbdType || '';
} }
this.checkType = checkType;
this.mixType = mixType; this.mixType = mixType;
this.sourceFrom = sourceFrom; this.sourceFrom = sourceFrom;
this.studyFormId = studyFormId; this.studyFormId = studyFormId;
@ -136,7 +143,7 @@ export default {
this.otherChecked = val; this.otherChecked = val;
if (val) {//id if (val) {//id
this.selectedId = ""; this.selectedId = "";
this.currentRow = {};
this.currentRow = null;
} }
}, },
handleShowTableInfo(type) { handleShowTableInfo(type) {
@ -179,13 +186,22 @@ export default {
return return
} }
this.$emit('submit', selectedValue, row); this.$emit('submit', selectedValue, row);
let callbackData = { selectInfo, uuid: this.uuid, selectedId: selectedValue, row,selectType:this.selectType };
if(this.checkType === "checkbox"){
callbackData = {
uuid: this.uuid,
selectedRows: row,
}
}
// eventBus // eventBus
EventBus.$emit("onMixReagentSubmit", { selectInfo, uuid: this.uuid, selectedId: selectedValue, row,selectType:this.selectType });
EventBus.$emit("onMixReagentSubmit", callbackData);
// this.visible = false; // this.visible = false;
}, },
// //
handleSelect(code, row) { handleSelect(code, row) {
this.selectedId = code;
if(this.checkType === "radio"){
this.selectedId = code;
}
this.currentRow = row; this.currentRow = row;
}, },
} }

Loading…
Cancel
Save