Browse Source

feat:[模板管理][update]

luojie
luojie 2 weeks ago
parent
commit
bb232272a5
4 changed files with 178 additions and 156 deletions
  1. +5
    -1
      src/components/Template/HandleFormItem.vue
  2. +122
    -132
      src/components/Template/StepComponents/CdmdComp.vue
  3. +43
    -22
      src/components/Template/StepComponents/xbjzpz/cdmd.vue
  4. +8
    -1
      src/components/Template/StepFormPackage.vue

+ 5
- 1
src/components/Template/HandleFormItem.vue View File

@ -1198,7 +1198,8 @@ export default {
if (!isOldValueEmpty && !(isSame) && (this.templateFillType === "actFill" || this.templateFillType === "blxjsh") && this.type !== "attachment") { if (!isOldValueEmpty && !(isSame) && (this.templateFillType === "actFill" || this.templateFillType === "blxjsh") && this.type !== "attachment") {
console.log("需要电子签名") console.log("需要电子签名")
// EventBus // EventBus
EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
// EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
this.handleUpdateRecord()
} else {// } else {//
this.handleUpdateRecord() this.handleUpdateRecord()
} }
@ -2080,4 +2081,7 @@ export default {
.no-border { .no-border {
border: none; border: none;
} }
.record-row{
text-align: left;
}
</style> </style>

+ 122
- 132
src/components/Template/StepComponents/CdmdComp.vue View File

@ -1,17 +1,21 @@
<!-- 细胞密度测定组件 -->
<template> <template>
<div class="cdmd-container"> <div class="cdmd-container">
<!-- 使用一个table包含所有测定组 --> <!-- 使用一个table包含所有测定组 -->
<table class="cdmd-table" cellspacing="0" cellpadding="0"> <table class="cdmd-table" cellspacing="0" cellpadding="0">
<!-- 根据cs值循环生成每个测定组 --> <!-- 根据cs值循环生成每个测定组 -->
<div v-for="index in Math.min(cs, 10)" :key="index">
<div v-for="(item, index) in tableData" :key="index" class="cdmd-group">
<!-- 第一行 --> <!-- 第一行 -->
<tr> <tr>
<td rowspan="3" class="first-col">{{ index }}</td>
<td rowspan="3" class="first-col">{{ index +1}}</td>
<td class="fixed-text">稀释倍数</td> <td class="fixed-text">稀释倍数</td>
<td class="fixed-text">1</td>
<td class="fixed-text">
<HandleFormItem :fieldItemLabel="fieldItemLabel" :fieldKey="prefixKey + 'xsbs' + index"
@blur="(v)=>handleBlur(v,index,'xsbs')" :item="inputItem" :value="item.xsbs" :index="index" />
</td>
<td class="fixed-text">细胞密度/mL</td> <td class="fixed-text">细胞密度/mL</td>
<td> <td>
<el-button type="success" size="mini" class="formula-btn">公式</el-button>
{{ item.xbmd }}
</td> </td>
</tr> </tr>
<!-- 第二行 --> <!-- 第二行 -->
@ -24,156 +28,131 @@
<!-- 第三行 --> <!-- 第三行 -->
<tr> <tr>
<td> <td>
<el-input
v-model="formData['zs' + index + '_1']"
size="mini"
placeholder="整数"
class="orange-input"
@blur="handleDataChange"
/>
<HandleFormItem :fieldItemLabel="fieldItemLabel" :fieldKey="prefixKey + 'zsg' + index"
:value="item.zsg" :item="inputItem" @blur="(v)=>handleBlur(v,index,'zsg')" :index="index" />
</td> </td>
<td> <td>
<el-input
v-model="formData['zs' + index + '_2']"
size="mini"
placeholder="整数"
class="orange-input"
@blur="handleDataChange"
/>
<HandleFormItem :fieldItemLabel="fieldItemLabel" :fieldKey="prefixKey + 'ysg' + index"
@blur="(v)=>handleBlur(v,index,'ysg')" :item="inputItem" :value="item.ysg" :index="index" />
</td> </td>
<td> <td>
<el-input
v-model="formData['zs' + index + '_3']"
size="mini"
placeholder="整数"
class="orange-input"
@blur="handleDataChange"
/>
<HandleFormItem :fieldItemLabel="fieldItemLabel" :fieldKey="prefixKey + 'zxg' + index"
:value="item.zxg" :item="inputItem" @blur="(v)=>handleBlur(v,index,'zxg')" :index="index" />
</td> </td>
<td> <td>
<el-input
v-model="formData['zs' + index + '_4']"
size="mini"
placeholder="整数"
class="orange-input"
@blur="handleDataChange"
/>
<HandleFormItem :fieldItemLabel="fieldItemLabel" :fieldKey="prefixKey + 'yxg' + index"
:value="item.yxg" :item="inputItem" @blur="(v)=>handleBlur(v,index,'yxg')" :index="index" />
</td> </td>
</tr> </tr>
</div> </div>
</table> </table>
<!-- 如果cs大于10显示提示信息 -->
<div v-if="cs > 10" class="cdmd-warning">
注意当前仅支持最多10次测定如需更多次数请调整参数
</div>
</div> </div>
</template> </template>
<script> <script>
export default {
props: {
cs: {
type: Number,
default: 4
},
item: {
type: Object,
default: () => ({})
},
formData: {
type: Object,
default: () => ({})
},
stepIndex: {
type: String,
default: ''
},
prefixKey: {
type: String,
default: ''
},
type: {
type: String,
default: 'cdmd'
}
import HandleFormItem from '../HandleFormItem.vue';
import { getuuid } from '@/utils/index.js';
export default {
inject: ['templateFillType'],
components: {
HandleFormItem
},
props: {
cs: {
type: [Number, String],
default: 0
}, },
data() {
return {
localFormData: {
jcbInfo: {
stepTableFormData: []
}
}
}
formData: {
type: Array,
default: () => []
}, },
watch: {
formData: {
immediate: true,
handler(newVal) {
this.localFormData = { ...newVal };
this.onDataChange();
},
deep: true
},
cs: {
immediate: true,
handler() {
this.onDataChange();
}
}
stepIndex: {
type: Number,
default: 0
},
prefixKey: {
type: String,
default: ''
},
fieldItemLabel: {
type: String,
default: ''
}, },
mounted() {
},
data() {
return {
tableData: [],
inputItem: {
type: 'inputNumber',
fillType: 'actFill',
precision: 0,
}
}
},
mounted() {
this.tableData = this.formData;
if(this.templateFillType == 'actFill' && this.tableData.length == 0) {
this.onDataChange(); this.onDataChange();
}
},
methods: {
getCellDensity(item) {
if(!item.xsbs || !item.zsg || !item.zxg || !item.ysg || !item.yxg) {
return '';
}
return ((+item.zsg + +item.zxg + +item.ysg + +item.yxg) /4) * item.xsbs*10000;
}, },
methods: {
//
handleDataChange() {
this.onDataChange();
},
//
handleBlur(v, index, key) {
this.tableData[index][key] = v;
const count = this.getCellDensity(this.tableData[index]);
this.tableData[index].xbmd = count;
// this.tableData = JSON.parse(JSON.stringify(this.tableData));
this.$emit('update', this.tableData);
},
// validateFormData
validateFormData() {
// CustomTable
const validateResult = this.$refs.tableRef.validateFormData();
//
onDataChange() {
//
const tableData = [];
const maxCols = Math.min(this.cs, 10);
for (let i = 1; i <= maxCols; i++) {
tableData.push({
index: i,
zs1: this.formData['zs' + i + '_1'] || '',
zs2: this.formData['zs' + i + '_2'] || '',
zs3: this.formData['zs' + i + '_3'] || '',
zs4: this.formData['zs' + i + '_4'] || '',
xbmd: '个/mL',
xsb: '1'
});
//
if (validateResult.valid) {
const filledData = this.$refs.tableRef.getFilledFormData();
const { stepTableFormData = [] } = filledData;
if (stepTableFormData.length === 0) {
return { valid: false, error: '请添加取板数据' };
} }
//
this.localFormData.jcbInfo = {
stepTableFormData: tableData
};
//
this.$emit('update', {
jcbInfo: {
stepTableFormData: tableData
}
}
console.log("validateResult",validateResult);
return validateResult;
},
onDataChange() {
//
const tableData = [];
for (let i = 1; i <= this.cs; i++) {
tableData.push({
index: i,
zsg: "",
zxg: "",
ysg: "",
yxg: "",
xsbs: "",
xbmd: "",
id: getuuid(),
}); });
},
//
getFormData() {
return this.localFormData;
} }
}
this.tableData = tableData;
this.$emit('update', this.tableData);
},
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.cdmd-container { .cdmd-container {
width: 100%;
width: 1100px;
margin: 10px 0; margin: 10px 0;
} }
@ -184,17 +163,28 @@
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
background-color: #fff; background-color: #fff;
td { td {
padding: 8px; padding: 8px;
text-align: center; text-align: center;
border: 1px solid #e8e8e8; border: 1px solid #e8e8e8;
vertical-align: middle; vertical-align: middle;
width: 200px;
}
.cdmd-group {
&:not(:first-child) {
td {
border-top: none;
}
}
} }
} }
.first-col { .first-col {
width: 100px;
width: 100px !important;
font-weight: 500; font-weight: 500;
color: #333; color: #333;
background-color: #f9f9f9; background-color: #f9f9f9;
@ -203,13 +193,13 @@
.orange-input { .orange-input {
width: 80px; width: 80px;
margin: 0 auto; margin: 0 auto;
::v-deep .el-input__inner { ::v-deep .el-input__inner {
background-color: #fff7e6 !important; background-color: #fff7e6 !important;
border-color: #ffa940 !important; border-color: #ffa940 !important;
color: #d46b08 !important; color: #d46b08 !important;
text-align: center; text-align: center;
&:focus { &:focus {
border-color: #d46b08 !important; border-color: #d46b08 !important;
box-shadow: 0 0 0 2px rgba(255, 169, 64, 0.2) !important; box-shadow: 0 0 0 2px rgba(255, 169, 64, 0.2) !important;
@ -228,12 +218,12 @@
color: #fff !important; color: #fff !important;
font-size: 12px; font-size: 12px;
padding: 4px 12px; padding: 4px 12px;
&:hover { &:hover {
background-color: #73d13d !important; background-color: #73d13d !important;
border-color: #73d13d !important; border-color: #73d13d !important;
} }
&:active { &:active {
background-color: #389e0d !important; background-color: #389e0d !important;
border-color: #389e0d !important; border-color: #389e0d !important;

+ 43
- 22
src/components/Template/StepComponents/xbjzpz/cdmd.vue View File

@ -1,6 +1,8 @@
<!-- 测定密度 --> <!-- 测定密度 -->
<template> <template>
<StepFormPackage :fieldItemLabel = "fieldItemLabel" ref="stepFormPackageRef" :prefixKey="stepIndex+'_'+'xbjzpz_cdmd'" @resetRecord = "resetRecord" :form-config="formConfig" :formData="formData" />
<StepFormPackage :fieldItemLabel="fieldItemLabel" ref="stepFormPackageRef" :prefixKey="stepIndex + '_' + 'xbjzpz_cdmd'"
@onCdmdUpdate="onCdmdUpdate"
@resetRecord="resetRecord" :form-config="formConfig" :formData="formData" />
</template> </template>
<script> <script>
@ -10,17 +12,29 @@ import stepMixins from '@/components/Template/mixins/stepMixins.js';
export default { export default {
mixins: [stepMixins], mixins: [stepMixins],
props: { props: {
sn: {
type: String,
default: 'cdmd',
},
},
sn: {
type: String,
default: 'cdmd',
},
},
components: { components: {
StepFormPackage StepFormPackage
}, },
methods: {
onCdmdUpdate(data){
const {formData} = data;
const flag = formData.every(item => !!item.xbmd);
if(flag){
const count = formData.length;
const sum = formData.reduce((acc, cur) => acc + cur.xbmd, 0);
const avg = sum / count;
this.$refs.stepFormPackageRef.updateFormData("gs", avg);
}
}
},
computed: { computed: {
formConfig() { formConfig() {
let config = [{
let config = [{
config: { config: {
text1: { text1: {
label: "使用倒置显微镜", label: "使用倒置显微镜",
@ -42,49 +56,56 @@ export default {
label: "次测定,每次滴片体积预计为", label: "次测定,每次滴片体积预计为",
type: "text", type: "text",
}, },
yjtj:{
yjtj: {
fillType: "preFill", fillType: "preFill",
type: "inputNumber", type: "inputNumber",
}, },
yjtjdw:{
yjtjdw: {
fillType: "preFill", fillType: "preFill",
type: "select", type: "select",
selectTo: "sjtjdw", selectTo: "sjtjdw",
options:this.getDictOptions('business_tjdw'),
options: this.getDictOptions('business_tjdw'),
}, },
text4:{
text4: {
label: ",实际滴片体积为", label: ",实际滴片体积为",
type: "text", type: "text",
}, },
sjtj:{
sjtj: {
fillType: "actFill", fillType: "actFill",
type: "inputNumber", type: "inputNumber",
compareTo:"yjtj",
copyFrom:"yjtj"
compareTo: "yjtj",
copyFrom: "yjtj"
}, },
sjtjdw:{
sjtjdw: {
fillType: "preFill", fillType: "preFill",
type: "select", type: "select",
options: this.getDictOptions('business_tjdw'),
options: this.getDictOptions('business_tjdw'),
}, },
text5:{
text5: {
label: "平均细胞密度为", label: "平均细胞密度为",
type: "text", type: "text",
}, },
gs: { gs: {
fillType: "actFill", fillType: "actFill",
type: "inputNumber", type: "inputNumber",
disabled: true,
}, },
cdmds:{
type:"cdmd"
},
text6:{
text6: {
label: "个/mL。", label: "个/mL。",
type: "text", type: "text",
}, },
} }
}]
},
{
config: {
cdmds: {
type: "cdmd"
},
}
}
]
return config return config
} }
}, },

+ 8
- 1
src/components/Template/StepFormPackage.vue View File

@ -57,7 +57,7 @@
<JcbComp @update="(data)=>onJcbUpdate(data,key)" :type = "sItem.type" :ref="'jcbComp_'+key" :stepIndex="stepIndex" :prefixKey="prefixKey+'_'+index" @resetRecord = "resetRecord" :item="sItem" :formData="formData[key]" /> <JcbComp @update="(data)=>onJcbUpdate(data,key)" :type = "sItem.type" :ref="'jcbComp_'+key" :stepIndex="stepIndex" :prefixKey="prefixKey+'_'+index" @resetRecord = "resetRecord" :item="sItem" :formData="formData[key]" />
</template> </template>
<template v-else-if="sItem.type === 'cdmd'"> <template v-else-if="sItem.type === 'cdmd'">
<CdmdComp @update="(data)=>onJcbUpdate(data,key)" :type = "sItem.type" :ref="'cdmdComp_'+key" :stepIndex="stepIndex" :prefixKey="prefixKey+'_'+index" :item="sItem" :formData="formData[key]" />
<CdmdComp @update="(data)=>onCdmdUpdate(data,key)" :type = "sItem.type" :cs="formFields.cs" :ref="'cdmdComp_'+key" :stepIndex="stepIndex" :prefixKey="prefixKey+'_'+index" :formData="formData[key]" />
</template> </template>
<div v-show="isShowOther(formFields[key])" class="flex flex1"> <div v-show="isShowOther(formFields[key])" class="flex flex1">
@ -175,6 +175,13 @@ export default {
justUpdateFilledFormData(); justUpdateFilledFormData();
}); });
}, },
onCdmdUpdate(data,key){
this.formFields[key] = data;
this.$nextTick(() => {
justUpdateFilledFormData();
this.$emit("onCdmdUpdate", {key,formData:this.formFields[key]});
});
},
// ZLSubPackage // ZLSubPackage
validateSubComponents() { validateSubComponents() {
const refs = []; const refs = [];

Loading…
Cancel
Save