Browse Source

fix:[模板管理]新增GSP003

lkf
15881625488@163.com 2 months ago
parent
commit
a631be7f53
4 changed files with 483 additions and 0 deletions
  1. +4
    -0
      src/lang/en/template/gsp.js
  2. +4
    -0
      src/lang/zh/template/gsp.js
  3. +3
    -0
      src/views/business/comps/template/TemplateTable.vue
  4. +472
    -0
      src/views/business/comps/template/comps/gsp/GSP003.vue

+ 4
- 0
src/lang/en/template/gsp.js View File

@ -31,5 +31,9 @@ export default {
// 毒麻药品配制记录表
DMYPPZJLB:{
},
GSP003:{
calcConditionLabel:'计算公式',
sfxyzjfx:'是否需要制剂分析'
}
}

+ 4
- 0
src/lang/zh/template/gsp.js View File

@ -31,5 +31,9 @@ export default {
// 毒麻药品配制记录表
DMYPPZJLB:{
},
GSP003:{
calcConditionLabel:'计算公式',
sfxyzjfx:'是否需要制剂分析'
}
}

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

@ -41,6 +41,7 @@ import SP017 from "./comps/sp/SWYPFXFFXYPZBB/SP017.vue";
import SP018 from "./comps/sp/SWYPFXFFXYPZBB/SP018.vue";
import Demo from "./comps/sp/Demo.vue";
//
import GSP003 from "./comps/gsp/GSP003.vue";
////
import SYWZPZJHB from "./comps/gsp/SYWZPZJHB.vue";
@ -73,6 +74,7 @@ export default {
////
MJYLQSQD, SYWZPZJHB, DMYPPZJLB,
//
GSP003,
//
SP001, SP003, SP00456,SP007, SP008, SP009, SP010, SP011, SP012, SP013, SP014, SP015, SP016, SP017, SP018,
// PCR
@ -126,6 +128,7 @@ export default {
'SP018': 'SP018',
//
'GSP001': 'DMYPPZJLB',
'GSP003': 'GSP003',
////
'SYWZPZJHB': 'SYWZPZJHB',
'MJYLQSQD': 'MJYLQSQD',

+ 472
- 0
src/views/business/comps/template/comps/gsp/GSP003.vue View File

@ -0,0 +1,472 @@
<!-- 试验物质配制记录表 -->
<template>
<div>
<div class="detail-container">
<div class="detail-title"><img src="@/assets/images/detail-title.png">{{ formData.bdmc }}<img
src="@/assets/images/detail-title.png" /></div>
<div class="detail-content">
<div class="content">
<!-- 基本信息 -->
<BaseInfoFormPackage fieldItemLabel="template.common.baseInfo" label="template.common.baseInfo"
ref="baseInfoRef" :formConfig="baseInfoFormConfig" :formData="formData" />
<!-- 基本信息 -->
<TableList label="template.common.reagentInfo" :columns="sysjColumns" :dataSource="resource" />
<TableList label="template.common.wzInfo" :columns="sywzColumns" :dataSource="resourceWz" />
<TableList label="template.common.instrumentInfo" :columns="yqColumns" :dataSource="yqResource" />
<!-- 存储条件 -->
<BaseInfoFormPackage fieldItemLabel="template.common.storageCondition"
label="template.common.storageCondition" ref="storageConditionRef"
:formConfig="storageFormConfig" :formData="formData" />
<!-- 计算公式 -->
<BaseInfoFormPackage fieldItemLabel="template.gsp.GSP003.calcConditionLabel"
label="template.gsp.GSP003.calcConditionLabel" ref="calcConditionRef"
:formConfig="calcFormConfig" :formData="formData" />
<LineLabel label="template.common.operationSteps" />
<!-- 操作步骤 -->
<div v-for="(formConfig, ladderIndex) in formData.formConfigs" :key="'ladder_' + ladderIndex">
<div class="template-form-item">
<div class="config-header-right">
<el-button v-if="fillType === 'preFill'" type="primary" @click="handleAddFormConfig">{{
$t('template.common.addBtn') }}</el-button>
<el-button v-if="fillType === 'preFill' && formData.formConfigs.length > 1"
type="danger" @click="handleDeleteFormConfig(ladderIndex)">{{
$t('template.common.deleteBtn')
}}</el-button>
<el-button class="print-btn" v-if="fillType === 'actFill'" type="primary"
@click="printTag">{{ $t('template.common.bqdy') }}</el-button>
</div>
<BaseInfoFormPackage fieldItemLabel="template.common.operationSteps"
:ref="`formConfigStepFormPackageRef_${ladderIndex}`" :formConfig="stepFormConfig"
:formData="formConfig" />
<Step class="mt-0 s-container" :ref="`formStepRef_${ladderIndex}`"
:formData="formConfig.stepData" :fieldItemLabel="$t('template.common.jtpz')"
:prefixKey="'form_' + ladderIndex"></Step>
</div>
</div>
<!-- 备注 -->
<BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark"
ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
</div>
</div>
</div>
</div>
</template>
<script>
import BaseInfoFormPackage from "@/components/Template/BaseInfoFormPackage";
import LineLabel from "@/components/Template/LineLabel";
import TableList from "@/components/Template/Table";
import Step from "@/components/Template/Step";
import templateMixin from "../../mixins/templateMixin";
import CustomTable from '@/components/Template/CustomTable.vue';
import { getLatestSn } from '@/api/template';
import { EventBus } from "@/utils/eventBus";
import { uniqeResource } from "@/utils/calUnitTools";
import { debounce } from 'lodash-es'
import { duplicateResource, getExpireDate } from "@/utils/index.js";
export default {
name: "GSP003",
components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable },
mixins: [templateMixin],
props: {
fillType: {
type: String,
default: 'preFill',
},
},
computed: {
//
calcFormConfig() {
return [
{
type: "cardItem",
config: {
calcFormConfig: {
label: 'template.gsp.GSP003.calcConditionLabel',
type: "input",
fillType: "preFill",
maxlength: 50
},
}
}
];
},
//
storageFormConfig() {
return [
{
type: "step",
config: {
storageCondition: {
label: 'template.common.storageConditionLabel',
type: "select",
fillType: "preFill",
options: this.getDictOptions("business_cctj"),
otherCode: "storageConditionOther",
},
}
}
];
},
//
remarkConig() {
return [
{
type: "cellItem",
config: {
remark: {
label: "",
type: "textarea",
fillType: "actFill",
span: 1,
placeholder: 'template.common.remarkPlaceholder',
maxlength: 1000,
rows: 5
}
}
}
]
},
//
baseInfoFormConfig() {
return [
{
type: "cardItem",
config: {
studyMc: {
label: 'template.common.testName',
type: "input",
disabled: true,
},
studySn: {
label: 'template.common.testNumber',
type: "input",
disabled: true,
},
methodCode: {
label: 'template.common.methodCode',
type: "input",
fillType: "preFill",
maxlength: 50
},
versionNum: {
label: 'template.common.versionNumber',
type: "inputNumber",
fillType: "actFill",
prepend: "V",
maxlength: 50
},
}
},
{
type: "conditionItem",
label: 'template.common.testConfigurationConditions',
config: {
pre: {
label: 'template.common.preFill',
type: "select",
multiple: true,
fillType: "preFill",
options: this.getDictOptions('business_pztj'),
otherCode: "preOther",
},
act: {
label: 'template.common.actualFill',
type: "select",
fillType: "actFill",
otherCode: "actOther",
multiple: true,
compareTo: "pre",
options: this.getDictOptions('business_pztj')
}
}
},
{
type: "cellItem",
label: 'template.common.configurationTime',
config: {
startDate: {
label: 'template.common.startTime',
type: "input",
},
endDate: {
label: 'template.common.endTime',
type: "input",
},
}
}
]
},
//
stepFormConfig() {
return [
{
type: "step",
config: {
sfxyzjfx: {
label: 'template.gsp.GSP003.sfxyzjfx',
type: "select",
fillType: "actFill",
options: [
{label:'是',value:'是'},
{label:'否',value:'否'}
]
},
targetName: {
label: 'template.common.targetSolutionName',
type: "input",
fillType: "preFill",
maxlength: 50
},
targetCode: {
label: 'template.common.targetSolutionCode',
type: "input",
subType: "span",
fillType: "preFill",
subKey: "targetCodeSn",
maxlength: 20
},
targetPreConcentration: {
label: 'template.common.targetPreConcentration',
type: "inputNumber",
subType: "select",
subKey: "targetPreConcentrationUnit",
fillType: "preFill",
subOptions: this.getDictOptions('business_nddw'),
maxlength: 10,
selectTo: "targetActConcentrationUnit",//
},
targetActConcentration: {
label: 'template.common.targetActConcentration',
type: "inputNumber",
subType: "select",
subKey: "targetActConcentrationUnit",
compareTo: "targetPreConcentration",//
fillType: "actFill",
subFillType: "preFill",
subOptions: this.getDictOptions('business_nddw'),
copyFrom: "targetPreConcentration",//
maxlength: 10
},
targetPreVolume: {
label: 'template.common.targetPreVolume',
type: "inputNumber",
subType: "select",
subKey: "targetPreVolumeUnit",
subOptions: this.getDictOptions('business_tjdw'),
fillType: "preFill",
maxlength: 10,
selectTo: "targetActVolumeUnit",//
},
targetActVolume: {
label: 'template.common.targetActVolume',
type: "inputNumber",
subType: "select",
subKey: "targetActVolumeUnit",
fillType: "actFill",
subFillType: "preFill",
subOptions: this.getDictOptions('business_tjdw'),
compareTo: "targetPreVolume",//
copyFrom: "targetPreVolume",//
maxlength: 10
},
effectivePeriod: {
label: 'template.common.effectivePeriod',
type: "inputNumber",
subType: "select",
subKey: "effectivePeriodUnit",
fillType: "preFill",
subOptions: this.getDictOptions('business_yxqdw'),
maxlength: 10
},
expireDate: {
label: 'template.common.expireDate',
type: "input",
},
}
}
]
},
},
data() {
return {
formData: {}
};
},
mounted() {
const formData = this.getFormDataByTemplateData();
if (!formData.targetCodeSn && this.fillType === "actFill") {
this.getCode(formData);
} else {
if (!this.formData.formConfigs) {
this.$set(this.formData, 'formConfigs', []);
this.formData.formConfigs.push({
formConfigs: [],
});
}
}
},
methods: {
//
handleAddFormConfig() {
if (!this.formData.formConfigs) {
this.$set(this.formData, 'formConfigs', []);
}
this.formData.formConfigs.push({
formConfigs: [],
});
},
//
handleDeleteFormConfig(index) {
this.formData.formConfigs.splice(index, 1);
},
//todo
printTag() {
const printConfig = this.getBasePrintConfig();
const { storageCondition, targetCodeSn } = this.formData;
printConfig["存储条件"] = storageCondition;
printConfig["编号"] = targetCodeSn;
EventBus.$emit('showTagPrintDialog', { printConfig })
},
//
getCode: debounce(async function (v) {
if (this.formData.formConfigs && this.formData.formConfigs.length > 0) {
for (let i = 0; i < this.formData.formConfigs.length; i++) {
let item = this.formData.formConfigs[i]
const result = await getLatestSn({
count: 1,
pre: item.targetCode,
type: 1
})
if (result.code == 200) {
this.$refs[`formConfigStepFormPackageRef_${i}`][0].updateFormData("targetCodeSn", result.data[0])
}
}
}
}, 100),
//
getFilledFormData() {
const baseData = this.$refs.baseInfoRef.getFilledFormData();
const conditionData = this.$refs.storageConditionRef.getFilledFormData();
const formConfigsData = [];
if (this.formData.formConfigs && this.formData.formConfigs.length > 0) {
for (let i = 0; i < this.formData.formConfigs.length; i++) {
const formData = this.$refs[`formConfigStepFormPackageRef_${i}`][0].getFilledFormData();
const stepData = this.$refs[`formStepRef_${i}`][0].getFilledFormData();
if(this.formData.startDate&&formData.effectivePeriod&&formData.effectivePeriodUnit){
formData.expireDate=getExpireDate(this.formData.startDate, formData.effectivePeriod, formData.effectivePeriodUnit)
}
formConfigsData.push({
...formData,
...stepData,
});
}
}
const remarkData = this.$refs.remarkRef.getFilledFormData();
return {
...baseData,
...conditionData,
formConfigs: formConfigsData,
...remarkData
}
},
//
async validFields() {
//
let refsToValidate = ["baseInfoRef", "storageConditionRef", "remarkRef"];
if (this.formData.formConfigs && this.formData.formConfigs.length > 0) {
for (let i = 0; i < this.formData.formConfigs.length; i++) {
refsToValidate.push(`formConfigStepFormPackageRef_${i}`);
refsToValidate.push(`formStepRef_${i}`);
}
}
return await this.validFormFields(refsToValidate);
},
//
async getFormData() {
//
const validFlag = await this.validFields();
if (!validFlag) {
return false;
}
let content = this.getFilledFormData();
return content;
},
//使
getResource() {
let content = this.getFilledFormData();
//resource
let tmpResource = []
if (this.fillType === "actFill") {
let tableList = content.formConfigs
if (tableList && tableList.length > 0) {
for (let i = 0; i < tableList.length; i++) {
let item = tableList[i]
tmpResource.push({
mc: item.targetName,
bh: item.targetCode + item.targetCodeSn,
ph: '',
ndz: item.targetActConcentration + item.targetActConcentrationUnit,
nd: item.targetActConcentration,
nddw: item.targetActConcentrationUnit,
ly: 'ELN配制',
sxrq: item.expireDate,
kc: item.targetActVolume,
kcdw: item.targetActVolumeUnit,
syl: null,
type: null,
elnType: this.product,
syldw: item.targetActVolumeUnit,
yxzq: item.effectivePeriod,
yxzqdw: item.effectivePeriodUnit,
})
}
}
}
//使
const stepResource = this.getStepResource()
this.resourceTmp = uniqeResource(tmpResource, stepResource.sjResource || [])
this.yqResourceTmp = stepResource.yqResource || []
debugger
return this.resourceTmp;
},
//使
getStepResource() {
const sjResource = [], yqResource = [];
if (this.formData.formConfigs && this.formData.formConfigs.length > 0) {
for (let i = 0; i < this.formData.formConfigs.length; i++) {
const paralleResource = this.$refs[`formStepRef_${i}`][0].getStepResource();
sjResource.push(...paralleResource.sjResource);
yqResource.push(...paralleResource.yqResource);
}
}
//
const { sj, yq } = duplicateResource(sjResource, yqResource)
return { sjResource: sj, yqResource: yq };
},
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
.mt-20 {
margin-top: 20px;
}
.print-btn {
margin-bottom: 20px;
}
.config-header-right {
margin-bottom: 15px;
font-weight: bold;
font-size: 16px;
color: #303133;
text-align: right;
width: 100%;
}
</style>

Loading…
Cancel
Save