Browse Source

feat:[模板管理][组件抽离ing]

master
luojie 1 week ago
parent
commit
c791cc3916
12 changed files with 397 additions and 58 deletions
  1. +40
    -6
      src/components/Template/BaseInfoFormPcakge.vue
  2. +26
    -8
      src/components/Template/CustomTable.vue
  3. +45
    -13
      src/components/Template/HandleFormItem.vue
  4. +6
    -5
      src/components/Template/Step.vue
  5. +6
    -1
      src/lang/en/template/commonTemplate.js
  6. +6
    -1
      src/lang/zh/template/commonTemplate.js
  7. +3
    -1
      src/views/business/comps/template/TemplateTable.vue
  8. +240
    -0
      src/views/business/comps/template/comps/dl/SYWZPZJHB.vue
  9. +8
    -8
      src/views/business/comps/template/comps/sp/SWYPBQGZYZBB.vue
  10. +6
    -6
      src/views/business/comps/template/comps/sp/SWYPFXCBYPZB.vue
  11. +6
    -7
      src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue
  12. +5
    -2
      src/views/business/comps/template/mixins/templateMixin.js

+ 40
- 6
src/components/Template/BaseInfoFormPcakge.vue View File

@ -52,7 +52,7 @@
<div v-for="(sItem, key) in item.config" class="c-Item" :class="getSpanClass(sItem)" <div v-for="(sItem, key) in item.config" class="c-Item" :class="getSpanClass(sItem)"
:key="key"> :key="key">
<div class="form-title" v-if="sItem.label">{{ sItem.label }}</div> <div class="form-title" v-if="sItem.label">{{ sItem.label }}</div>
<div v-if="sItem.type === 'dateTime'">
<div v-if="sItem.type === 'dateTime'" class="flex1">
<HandleFormItem type="dateTime" :item="sItem" v-model="formFields[key]" <HandleFormItem type="dateTime" :item="sItem" v-model="formFields[key]"
@copy="onCopy(sItem, key)" /> @copy="onCopy(sItem, key)" />
</div> </div>
@ -78,7 +78,7 @@
<div v-for="(sItem, key) in item.config" class="c-Item flex item-center" :class="getSpanClass(sItem)" <div v-for="(sItem, key) in item.config" class="c-Item flex item-center" :class="getSpanClass(sItem)"
:key="key"> :key="key">
<div class="step-form-title" v-if="sItem.label">{{ sItem.label }}</div> <div class="step-form-title" v-if="sItem.label">{{ sItem.label }}</div>
<div v-if="sItem.type === 'dateTime'">
<div v-if="sItem.type === 'dateTime'" class="flex1">
<HandleFormItem type="dateTime" :item="sItem" v-model="formFields[key]" <HandleFormItem type="dateTime" :item="sItem" v-model="formFields[key]"
@copy="onCopy(sItem, key)" /> @copy="onCopy(sItem, key)" />
</div> </div>
@ -99,10 +99,12 @@
<HandleFormItem v-if="sItem.subType === 'select'" type="select" class="sub-select" :item="getSubItem(sItem)" v-model="formFields[sItem.subKey]" <HandleFormItem v-if="sItem.subType === 'select'" type="select" class="sub-select" :item="getSubItem(sItem)" v-model="formFields[sItem.subKey]"
@copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" /> @copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" />
<div v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div> <div v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div>
<div class="clickable" :class="getFillType(sItem.subFillType)" v-else-if = "sItem.subType ==='clickable'" @click="handleClickable(sItem,$event)">
<HandleFormItem v-else-if="sItem.subType === 'clickable'" type="clickable" @clickable="handleClickable(sItem,$event)" class="sub-select" :item="getClickableItem(sItem)" :value="formFields[sItem.subKey]"
/>
<!-- <div class="clickable" :class="getFillType(sItem.subFillType)" v-else-if = "sItem.subType ==='clickable'" @click="handleClickable(sItem,$event)">
<span v-if="formFields[sItem.subKey]">{{ formFields[sItem.subKey] }}</span> <span v-if="formFields[sItem.subKey]">{{ formFields[sItem.subKey] }}</span>
<span v-else class="default-placeholder-text">请选择</span> <span v-else class="default-placeholder-text">请选择</span>
</div>
</div> -->
</div> </div>
<div v-else-if="sItem.type === 'inputNumber'" class="flex flex1"> <div v-else-if="sItem.type === 'inputNumber'" class="flex flex1">
<HandleFormItem type = "inputNumber" @blur="onBlur(key, $event)" class="flex1" :item="sItem" @input = "onInputNumberChange(key, $event)" :value = "formFields[key]" <HandleFormItem type = "inputNumber" @blur="onBlur(key, $event)" class="flex1" :item="sItem" @input = "onInputNumberChange(key, $event)" :value = "formFields[key]"
@ -110,10 +112,12 @@
<HandleFormItem v-if="sItem.subType === 'select'" type="select" class="sub-select" :item="getSubItem(sItem)" v-model="formFields[sItem.subKey]" <HandleFormItem v-if="sItem.subType === 'select'" type="select" class="sub-select" :item="getSubItem(sItem)" v-model="formFields[sItem.subKey]"
@copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" /> @copy="onCopy(sItem, key)" @change="onSelectChange(sItem.subKey, $event)" />
<div v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div> <div v-else-if="sItem.subType === 'span'">{{ formFields[sItem.subKey] }}</div>
<div class="clickable" :class="getFillType(sItem.subFillType)" v-else-if = "sItem.subType ==='clickable'" @click="handleClickable(sItem,$event)">
<HandleFormItem v-else-if="sItem.subType === 'clickable'" @clickable="handleClickable(sItem,$event)" type="clickable" class="sub-select" :item="getClickableItem(sItem)" :value="formFields[sItem.subKey]"
/>
<!-- <div class="clickable" :class="getFillType(sItem.subFillType)" v-else-if = "sItem.subType ==='clickable'" @click="handleClickable(sItem,$event)">
<span v-if="formFields[sItem.subKey]">{{ formFields[sItem.subKey] }}</span> <span v-if="formFields[sItem.subKey]">{{ formFields[sItem.subKey] }}</span>
<span v-else class="default-placeholder-text">请选择</span> <span v-else class="default-placeholder-text">请选择</span>
</div>
</div> -->
</div> </div>
</div> </div>
</div> </div>
@ -193,6 +197,9 @@ export default {
}) })
}, },
handleClickable(sItem,event){ handleClickable(sItem,event){
if(this.fillType !== 'actFill'){
return
}
this.$emit("clickable",sItem) this.$emit("clickable",sItem)
}, },
//span //span
@ -211,6 +218,13 @@ export default {
maxlength: sItem.otherMaxlength || 50, maxlength: sItem.otherMaxlength || 50,
} }
}, },
getClickableItem(sItem){
return {
label: "",
type: "clickable",
fillType: sItem.subFillType || sItem.fillType,
}
},
getSubItem(sItem){ getSubItem(sItem){
return { return {
label: "", label: "",
@ -278,6 +292,23 @@ export default {
this.allFieldsConfig = config; this.allFieldsConfig = config;
console.log(config,"config") console.log(config,"config")
}, },
//
getDisabled() {
const { item } = this;
const { fillType } = item;
if (item.hasOwnProperty("disabled")) {
return item.disabled
} else {
const { templateStatus } = this.$store.state.template;
if (fillType === "actFill") {//fillTypeactFill
return templateStatus !== "actFill"
} else if (fillType === "preFill") {//fillTypepreFill
return templateStatus !== "preFill"
} else {
return true
}
}
},
getFormData() { getFormData() {
const { formFields, allFieldsConfig } = this; const { formFields, allFieldsConfig } = this;
const { templateStatus } = this.$store.state.template; const { templateStatus } = this.$store.state.template;
@ -443,6 +474,9 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
font-size: 14px;
font-weight: normal;
color: #606266;
} }
.orange-border { .orange-border {

+ 26
- 8
src/components/Template/CustomTable.vue View File

@ -6,10 +6,12 @@
:style="{ width: col.width ? col.width + 'px' : 'auto' }"> :style="{ width: col.width ? col.width + 'px' : 'auto' }">
<div class="header-cell-content"> <div class="header-cell-content">
<div>{{ col.label }}</div> <div>{{ col.label }}</div>
<template v-if="col.headerSelectKey && col.headerOptions">
<template v-if="col.headerSelectKey && col.headerOptions&&showHeaderSelect">
<HandleFormItem type="select" class="header-select" :item="getHeaderItem(col)" <HandleFormItem type="select" class="header-select" :item="getHeaderItem(col)"
v-model="headerSelectFields[col.headerSelectKey]" @change="onHeaderSelectChange(index, $event)" />
v-model="headerSelectFields[col.headerSelectKey]" @change="onHeaderSelectChange(col, $event)" />
</template> </template>
<span v-else-if ="headerSelectFields[col.headerSelectKey]" class="fill-type-icon">({{ headerSelectFields[col.headerSelectKey] }})</span>
</div> </div>
</div> </div>
@ -42,8 +44,8 @@
{{ row[col.prop] }} {{ row[col.prop] }}
</template> </template>
</div> </div>
<div class="m-l-5">
<template v-if="col.bodySubType === 'inputNumber' && col.showBodySub">
<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)" <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)" /> v-model="row[col.bodySubKey]" @change="onBodySubValueChange(rowIndex, colIndex, $event)" />
</template> </template>
@ -53,6 +55,7 @@
</div> </div>
</div> </div>
</div> </div>
<!-- 默认操作栏 --> <!-- 默认操作栏 -->
<div class="custom-table-cell body-cell" :style="{ width: '180px' }" v-if="showOperation"> <div class="custom-table-cell body-cell" :style="{ width: '180px' }" v-if="showOperation">
<div class="inner-table-cell"> <div class="inner-table-cell">
@ -61,6 +64,9 @@
</div> </div>
</div> </div>
</div> </div>
<div v-if = "localDataSource.length==0">
<div class="no-data">暂无数据</div>
</div>
</div> </div>
</template> </template>
@ -72,6 +78,11 @@ export default {
HandleFormItem HandleFormItem
}, },
props: { props: {
//
showHeaderSelect: {
type: Boolean,
default: true,
},
// //
showOperation: { showOperation: {
type: Boolean, type: Boolean,
@ -218,9 +229,8 @@ export default {
return false; return false;
}, },
// //
onHeaderSelectChange(colIndex, value) {
this.headerSelectValues[colIndex] = value;
this.$emit('header-select-change', colIndex, value);
onHeaderSelectChange(col, value) {
this.headerSelectFields[col.headerSelectKey] = value;
}, },
// //
onBodyValueChange(rowIndex, colIndex, value) { onBodyValueChange(rowIndex, colIndex, value) {
@ -280,6 +290,10 @@ export default {
// //
this.localDataSource = JSON.parse(JSON.stringify(dataSource || [])); this.localDataSource = JSON.parse(JSON.stringify(dataSource || []));
}, },
//
addRow(row) {
this.localDataSource.push(row);
},
getDataSource(){ getDataSource(){
return this.localDataSource; return this.localDataSource;
}, },
@ -422,5 +436,9 @@ export default {
width: 100px; width: 100px;
margin-left: 5px; margin-left: 5px;
} }
.no-data{
text-align: center;
padding: 20px 0;
color: rgb(144, 147, 153)
}
</style> </style>

+ 45
- 13
src/components/Template/HandleFormItem.vue View File

@ -2,30 +2,34 @@
<div class="flex w-100"> <div class="flex w-100">
<div class="flex1 flex"> <div class="flex1 flex">
<el-input v-if="type === 'input'" :maxlength="item.maxlength || 50" :disabled="getDisabled()" <el-input v-if="type === 'input'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
:class="item.fillType | getFillType" @blur="onBlur"
:class="getFillTypeStyle()" @blur="onBlur"
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" v-model="inputValue" :placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" v-model="inputValue"
@input="onInputChange" @change="onInputChange" /> @input="onInputChange" @change="onInputChange" />
<el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 50" :disabled="getDisabled()" <el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
:class="item.fillType | getFillType" type="textarea" show-word-limit resize="none" @blur="onBlur"
:class="getFillTypeStyle()" type="textarea" show-word-limit resize="none" @blur="onBlur"
:rows="item.rows || 3" :placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" :rows="item.rows || 3" :placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)"
v-model="inputValue" @input="onInputChange" @change="onInputChange" /> v-model="inputValue" @input="onInputChange" @change="onInputChange" />
<DecimalInput v-else-if="type === 'inputNumber'" @blur="onBlur" :maxlength="item.maxlength || 10" <DecimalInput v-else-if="type === 'inputNumber'" @blur="onBlur" :maxlength="item.maxlength || 10"
class="flex1" :disabled="getDisabled()" :controls="item.controls || false" :min="item.min || 0" class="flex1" :disabled="getDisabled()" :controls="item.controls || false" :min="item.min || 0"
:prepend = "item.prepend" :prepend = "item.prepend"
:decimalDigits="item.precision" :class="item.fillType | getFillType"
:decimalDigits="item.precision" :class="getFillTypeStyle()"
:placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" v-model="inputValue" :placeholder="item.placeholder ? item.placeholder : ('请输入' + item.label)" v-model="inputValue"
@input="onInputChange" @change="onInputChange" /> @input="onInputChange" @change="onInputChange" />
<el-select v-else-if="type === 'select'" class="flex1" :multiple="item.multiple" <el-select v-else-if="type === 'select'" class="flex1" :multiple="item.multiple"
:class="item.fillType | getFillType" v-model="inputValue" :disabled="getDisabled()"
:class="getFillTypeStyle()" v-model="inputValue" :disabled="getDisabled()"
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" @change="onInputChange"> :placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" @change="onInputChange">
<el-option v-for="op in item.options" :key="op.value" :label="op.label" :value="op.value"> <el-option v-for="op in item.options" :key="op.value" :label="op.label" :value="op.value">
</el-option> </el-option>
</el-select> </el-select>
<el-date-picker v-else-if="type === 'dateTime'" class="flex1" :class="item.fillType | getFillType"
<el-date-picker v-else-if="type === 'dateTime'" type="datetime" class="flex1" :class="getFillTypeStyle()"
v-model="inputValue" :disabled="getDisabled()" format="yyyy/MM/DD HH:mm:ss" v-model="inputValue" :disabled="getDisabled()" format="yyyy/MM/DD HH:mm:ss"
value-format="yyyy/MM/DD HH:mm:ss" value-format="yyyy/MM/DD HH:mm:ss"
:placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" @change="onInputChange"> :placeholder="item.placeholder ? item.placeholder : ('请选择' + item.label)" @change="onInputChange">
</el-date-picker> </el-date-picker>
<div class="clickable" :class="getFillTypeStyle() + (getDisabled()?' disabled':'')" v-else-if = "item.type ==='clickable'" @click="handleClickable(item,$event)">
<span v-if="value">{{ value }}</span>
<span v-else class="default-placeholder-text">请选择</span>
</div>
</div> </div>
<!-- qc才能操作 --> <!-- qc才能操作 -->
<div class="handle-row" v-if="isShowHandle()"> <div class="handle-row" v-if="isShowHandle()">
@ -79,17 +83,19 @@ export default {
} }
}, },
filters: { filters: {
getFillType(type) {
},
methods: {
getFillTypeStyle(type) {
const {fillType} = this.item;
const typeObj = { const typeObj = {
actFill: "orange-border",// actFill: "orange-border",//
green: "green-border", green: "green-border",
preFill: "blue-border",// preFill: "blue-border",//
} }
return typeObj[type] || ""
return typeObj[fillType] || ""
}, },
},
methods: {
//question //question
getQuestionColor() { getQuestionColor() {
//gray green 绿 orange //gray green 绿 orange
@ -101,6 +107,12 @@ export default {
this.$emit('input', value); this.$emit('input', value);
this.$emit('change', value); this.$emit('change', value);
}, },
handleClickable(item,event){
if(item.fillType !== 'actFill'){
return
}
this.$emit("clickable",item)
},
// //
getIsShowCopyIcon() { getIsShowCopyIcon() {
const { copyFrom } = this.item; const { copyFrom } = this.item;
@ -186,7 +198,7 @@ export default {
.orange-border { .orange-border {
input,
.el-input-group__prepend,input,
textarea { textarea {
border-color: #f9c588; border-color: #f9c588;
@ -207,7 +219,7 @@ export default {
.green-border { .green-border {
input,
.el-input-group__prepend,input,
textarea { textarea {
border-color: green; border-color: green;
@ -228,7 +240,7 @@ export default {
.blue-border { .blue-border {
input,
.el-input-group__prepend,input,
textarea { textarea {
border-color: #4ea2ff; border-color: #4ea2ff;
@ -246,4 +258,24 @@ export default {
} }
} }
.clickable{
cursor: pointer;
width: auto;
margin-left: 10px;
min-width: 100px;
height: 28px;
border-radius: 4px;
border:1px solid #4ea2ff;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: normal;
color: #606266;
&.disabled{
cursor: not-allowed;
color: #c0c4cc;
background-color: #f5f7fa;
}
}
</style> </style>

+ 6
- 5
src/components/Template/Step.vue View File

@ -81,8 +81,8 @@ export default {
name: 'Step', name: 'Step',
props: { props: {
formData: { formData: {
type: Object,
default: () => ({stepData:[]})
type: Array,
default: () => []
} }
}, },
data() { data() {
@ -164,7 +164,7 @@ export default {
}, },
deep: true deep: true
}, },
'formData.stepData': {
'formData': {
handler(newVal) { handler(newVal) {
console.log('newVal', newVal) console.log('newVal', newVal)
if(!newVal || newVal.length === 0) return if(!newVal || newVal.length === 0) return
@ -174,7 +174,8 @@ export default {
formData: step.formData || {} formData: step.formData || {}
})) }))
}, },
deep: true
deep: true,
immediate: true
} }
}, },
methods: { methods: {
@ -233,7 +234,7 @@ export default {
type: step.type, type: step.type,
...step.formData ...step.formData
})) }))
resolve({stepData})
resolve(stepData)
}) })
}, },

+ 6
- 1
src/lang/en/template/commonTemplate.js View File

@ -52,5 +52,10 @@ export default {
instrumentName: 'Instrument Name', instrumentName: 'Instrument Name',
instrumentModel: 'Instrument Model', instrumentModel: 'Instrument Model',
instrumentCode: 'Instrument Number', instrumentCode: 'Instrument Number',
nextTestDate: 'Next Test/Calibration/Verification Date'
nextTestDate: 'Next Test/Calibration/Verification Date',
// 试验物质配制计划列
administrationDoseOrGroup: 'Administration Dose or Group',
preparationConcentration: 'Preparation Concentration',
preparationVolume: 'Preparation Volume'
} }

+ 6
- 1
src/lang/zh/template/commonTemplate.js View File

@ -52,5 +52,10 @@ export default {
instrumentName: '仪器名称', instrumentName: '仪器名称',
instrumentModel: '仪器型号', instrumentModel: '仪器型号',
instrumentCode: '仪器编号', instrumentCode: '仪器编号',
nextTestDate: '下次测试/校准/检定日期'
nextTestDate: '下次测试/校准/检定日期',
// 试验物质配制计划列
administrationDoseOrGroup: '给药剂量或组别',
preparationConcentration: '配制浓度',
preparationVolume: '配制体积'
} }

+ 3
- 1
src/views/business/comps/template/TemplateTable.vue View File

@ -13,11 +13,12 @@ import SP001 from './comps/sp/SP001';
import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue"; import SWYPFXRYPZB from "./comps/sp/SWYPFXRYPZB.vue";
import SWYPFXCBYPZB from "./comps/sp/SWYPFXCBYPZB.vue"; import SWYPFXCBYPZB from "./comps/sp/SWYPFXCBYPZB.vue";
import SWYPBQGZYZBB from "./comps/sp/SWYPBQGZYZBB.vue"; import SWYPBQGZYZBB from "./comps/sp/SWYPBQGZYZBB.vue";
import SYWZPZJHB from "./comps/dl/SYWZPZJHB.vue";
import Demo from "./comps/sp/Demo.vue"; import Demo from "./comps/sp/Demo.vue";
export default { export default {
name: "TemplateTable", name: "TemplateTable",
components: { components: {
SP001,SWYPFXRYPZB ,Demo,SWYPFXCBYPZB,SWYPBQGZYZBB,
SP001,SWYPFXRYPZB ,Demo,SWYPFXCBYPZB,SWYPBQGZYZBB,SYWZPZJHB,
}, },
props: { props: {
sn: { sn: {
@ -41,6 +42,7 @@ export default {
'SP001': 'SWYPFXRYPZB', 'SP001': 'SWYPFXRYPZB',
'SP002': 'SWYPFXCBYPZB', 'SP002': 'SWYPFXCBYPZB',
'SP003': 'SWYPBQGZYZBB', 'SP003': 'SWYPBQGZYZBB',
'DL001': 'SYWZPZJHB',
// 'SP001': 'Demo', // 'SP001': 'Demo',
} }
} }

+ 240
- 0
src/views/business/comps/template/comps/dl/SYWZPZJHB.vue View File

@ -0,0 +1,240 @@
<!-- 试验物质配制计划表 -->
<template>
<div>
<div class="detail-container">
<div class="detail-title"><img src="@/assets/images/detail-title.png">试验物质配制计划表<img
src="@/assets/images/detail-title.png" /></div>
<div class="detail-content">
<div class="content">
<BaseInfoFormPcakge label="试验基本信息" ref="baseInfoRef" :formConfig="baseInfoFormConfig"
:formData="formData" />
<LineLabel label="计划信息" />
<div class="template-form-item">
<BaseInfoFormPcakge ref="stepFormPackageRef" :formConfig="stepFormConfig" @blur="onHandleBlur"
:formData="formData" />
<CustomTable @blur="onHandleTableBlur" :showHeaderSelect="fillType === 'actFill'" :showOperation="fillType === 'actFill'" ref="stepTableRef" :columns="stepColumns"
:formData="formData" >
<template slot="operation" slot-scope="{ row, rowIndex}">
<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" />
</div>
</div>
<button @click="onSave">保存</button>
</div>
</div>
</template>
<script>
import BaseInfoFormPcakge from "@/components/Template/BaseInfoFormPcakge";
import LineLabel from "@/components/Template/LineLabel";
import templateMixin from "../../mixins/templateMixin";
import CustomTable from '@/components/Template/CustomTable.vue';
import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue"
export default {
name: "SYWZPZJHB",
components: { BaseInfoFormPcakge, LineLabel, CustomTable, TableOpertaion },
mixins: [templateMixin],
props: {
value: {
type: {},
default: () => { },
},
fillType: {
type: String,
default: 'preFill',
},
},
watch: {
value: {
immediate: true,
handler(v) {
}
},
fillType: {
immediate: true,
handler(v) {
console.log(v,"fillType")
}
},
},
computed: {
//
remarkConig() {
return [
{
type: "cellItem",
config: {
remark: {
label: "",
type: "textarea",
fillType: "actFill",
span: 1,
placeholder: "请输入特别说明",
maxlength: 1000,
rows: 5
}
}
}
]
},
//
baseInfoFormConfig() {
return [
{
type: "cardItem",
config: {
studyMc: {
label: "试验名称",
type: "input",
disabled: true,
},
studySn: {
label: "试验编号",
type: "input",
disabled: true,
},
}
},
]
},
//
stepFormConfig() {
return [
{
type: "step",
config: {
drawTime: {
label: "领取时间",
type: "dateTime",
fillType: "actFill",
},
analyzeTime: {
label: "分析时间",
type: "dateTime",
fillType: "actFill",
},
testSubstance: {
label: "试验物质",
type: "input",
fillType: "actFill",
},
configFrequency: {
label: "配置频率",
type: "input",
fillType: "actFill",
},
}
}
]
},
//
stepColumns() {
return [
{
label: "给药剂量或组别",
prop: "startSolutionCode",
width: 280,
bodyType: "input",
bodyFillType: "actFill",
bodyMaxlength: 10,
},
{
label: "配制浓度",
prop: "preparationConcentration",
width: 280,
headerSelectKey: "preparationConcentrationUnit",
fillType: "actFill",
headerOptions: this.$store.state.template.volumeOptions,
defaultValue: "mg",
bodyType: "inputNumber",
bodyFillType: "actFill",
bodyMaxlength: 10,
},
{
label: "配制体积",
prop: "preparationVolume",
width: 280,
headerSelectKey: "preparationVolumeUnit",
fillType: "actFill",
headerOptions: this.$store.state.template.volumeOptions,
bodyType: "inputNumber",
bodyFillType: "actFill",
bodyMaxlength: 10,
},
]
},
},
data() {
return {
selectReagentVisible: false,
subSolutionVisible: false,
currentSubKey: "",//key
dataSource: [],
stepTableDataSource: [],
};
},
mounted() {
this.formData = {
headerSelectFields: {
preparationVolumeUnit: "ml",
preparationConcentrationUnit: "ul",
}
}
},
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
}
},
async onSave() {
const formData = await this.getFormData();
// const formData = await this.$refs.stepTableRef.getFormData();
console.log(formData, "formData")
},
//
addRow() {
this.$refs.stepTableRef.addRow({
startSolutionCode: "",
preparationConcentration: "",
preparationVolume: "",
})
}
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
.mt-20 {
margin-top: 20px;
}
.add-row{
display: flex;
justify-content: center;
margin-top: 20px;
}
</style>

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

@ -23,7 +23,7 @@
</template> </template>
</CustomTable> </CustomTable>
</div> </div>
<Step ref="stepRef" :formData="formData"></Step>
<Step ref="stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPcakge label="备注" ref="remarkRef" :formConfig="remarkConig" :formData="formData" /> <BaseInfoFormPcakge label="备注" ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
</div> </div>
@ -120,12 +120,12 @@ export default {
{ {
type: "cardItem", type: "cardItem",
config: { config: {
bdmc: {
studyMc: {
label: "试验名称", label: "试验名称",
type: "input", type: "input",
disabled: true, disabled: true,
}, },
bdbh: {
studySn: {
label: "试验编号", label: "试验编号",
type: "input", type: "input",
disabled: true, disabled: true,
@ -477,9 +477,9 @@ export default {
const baseData = await this.$refs.baseInfoRef.getFormData(); const baseData = await this.$refs.baseInfoRef.getFormData();
const conditionData = await this.$refs.storageConditionRef.getFormData(); const conditionData = await this.$refs.storageConditionRef.getFormData();
const stepFormData = await this.$refs.stepFormPackageRef.getFormData(); const stepFormData = await this.$refs.stepFormPackageRef.getFormData();
const stepDataFormData = await this.$refs.stepTableRef.getFormData();
const stepTableFormData = await this.$refs.stepTableRef.getFormData();
const stepData = await this.$refs.stepRef.getFormData(); const stepData = await this.$refs.stepRef.getFormData();
if (!stepData.stepData.length) {
if (!stepData.length) {
this.$message.error("请添加步骤"); this.$message.error("请添加步骤");
return; return;
} }
@ -487,10 +487,10 @@ export default {
return { return {
...baseData, ...baseData,
...conditionData, ...conditionData,
...stepData,
stepData: stepFormData,
stepData,
...stepFormData,
...remarkData, ...remarkData,
...stepDataFormData
...stepTableFormData
} }
}, },
async onSave() { async onSave() {

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

@ -17,7 +17,7 @@
<BaseInfoFormPcakge ref="stepFormPackageRef" :formConfig="stepFormConfig" <BaseInfoFormPcakge ref="stepFormPackageRef" :formConfig="stepFormConfig"
:formData="formData" /> :formData="formData" />
</div> </div>
<Step ref="stepRef" :formData="formData"></Step>
<Step ref="stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPcakge label="备注" ref="remarkRef" :formConfig="remarkConig" :formData="formData" /> <BaseInfoFormPcakge label="备注" ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
</div> </div>
@ -99,12 +99,12 @@ export default {
{ {
type: "cardItem", type: "cardItem",
config: { config: {
bdmc: {
studyMc: {
label: "试验名称", label: "试验名称",
type: "input", type: "input",
disabled: true, disabled: true,
}, },
bdbh: {
studySn: {
label: "试验编号", label: "试验编号",
type: "input", type: "input",
disabled: true, disabled: true,
@ -261,7 +261,7 @@ export default {
const conditionData = await this.$refs.storageConditionRef.getFormData(); const conditionData = await this.$refs.storageConditionRef.getFormData();
const stepFormData = await this.$refs.stepFormPackageRef.getFormData(); const stepFormData = await this.$refs.stepFormPackageRef.getFormData();
const stepData = await this.$refs.stepRef.getFormData(); const stepData = await this.$refs.stepRef.getFormData();
if (!stepData.stepData.length) {
if (!stepData.length) {
this.$message.error("请添加步骤"); this.$message.error("请添加步骤");
return; return;
} }
@ -269,8 +269,8 @@ export default {
return { return {
...baseData, ...baseData,
...conditionData, ...conditionData,
...stepData,
stepData: stepFormData,
stepData,
...stepFormData,
...remarkData ...remarkData
} }
}, },

+ 6
- 7
src/views/business/comps/template/comps/sp/SWYPFXRYPZB.vue View File

@ -18,7 +18,7 @@
@blur = "onHandleBlur" @blur = "onHandleBlur"
:formData="formData" /> :formData="formData" />
</div> </div>
<Step ref="stepRef" :formData="formData"></Step>
<Step ref="stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPcakge :label="$t('template.common.remark')" ref="remarkRef" :formConfig="remarkConig" :formData="formData" /> <BaseInfoFormPcakge :label="$t('template.common.remark')" ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
</div> </div>
@ -35,7 +35,6 @@ import TableList from "@/components/Template/Table";
import Step from "@/components/Template/Step"; 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 moment from 'moment';
export default { export default {
name: "SWYPFXRYPZB", name: "SWYPFXRYPZB",
@ -100,12 +99,12 @@ export default {
{ {
type: "cardItem", type: "cardItem",
config: { config: {
bdmc: {
studyMc: {
label: this.$t('template.common.testName'), label: this.$t('template.common.testName'),
type: "input", type: "input",
disabled: true, disabled: true,
}, },
bdbh: {
studySn: {
label: this.$t('template.common.testNumber'), label: this.$t('template.common.testNumber'),
type: "input", type: "input",
disabled: true, disabled: true,
@ -275,7 +274,7 @@ export default {
const conditionData = await this.$refs.storageConditionRef.getFormData(); const conditionData = await this.$refs.storageConditionRef.getFormData();
const stepFormData = await this.$refs.stepFormPackageRef.getFormData(); const stepFormData = await this.$refs.stepFormPackageRef.getFormData();
const stepData = await this.$refs.stepRef.getFormData(); const stepData = await this.$refs.stepRef.getFormData();
if (!stepData.stepData.length) {
if (!stepData.length) {
this.$message.error(this.$t('template.common.addStepError')); this.$message.error(this.$t('template.common.addStepError'));
return; return;
} }
@ -283,8 +282,8 @@ export default {
return { return {
...baseData, ...baseData,
...conditionData, ...conditionData,
...stepData,
stepData: stepFormData,
stepData,
...stepFormData,
...remarkData ...remarkData
} }
}, },

+ 5
- 2
src/views/business/comps/template/mixins/templateMixin.js View File

@ -39,8 +39,8 @@ export default {
] ]
) )
}, 1000); }, 1000);
this.setTemplateStatus("preFill");
// this.setTemplateStatus(this.fillType)
// this.setTemplateStatus("actFill");
this.setTemplateStatus(this.fillType)
}, },
unmounted() { unmounted() {
@ -54,6 +54,9 @@ export default {
setConditionOptions(options) { setConditionOptions(options) {
this.$store.commit('template/SET_CONDITION_OPTIONS', options) this.$store.commit('template/SET_CONDITION_OPTIONS', options)
}, },
setTemplateData(data) {
this.$store.commit('template/SET_TEMPLATE_DATA', data)
},
//统一处理删除行 //统一处理删除行
deleteRow(index) { deleteRow(index) {
this.$refs.stepTableRef.deleteRow(index); this.$refs.stepTableRef.deleteRow(index);

Loading…
Cancel
Save