Browse Source

feat:[模板管理][sp021]

ouqian
luojie 1 month ago
parent
commit
54489501c1
4 changed files with 661 additions and 1 deletions
  1. +3
    -1
      src/views/business/comps/template/TemplateTable.vue
  2. +333
    -0
      src/views/business/comps/template/comps/gsp/GSP015.vue
  3. +324
    -0
      src/views/business/comps/template/formConfig/gsp/gsp015.js
  4. +1
    -0
      src/views/business/comps/template/mixins/templateMixin.js

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

@ -43,6 +43,7 @@ import GSP004 from "./comps/gsp/GSP004.vue";
import GSP005 from "./comps/gsp/GSP005.vue";
import GSP009 from "./comps/gsp/GSP009.vue";
import GSP010 from "./comps/gsp/GSP010.vue";
import GSP015 from "./comps/gsp/GSP015.vue";
////
import SYWZPZJHB from "./comps/gsp/SYWZPZJHB.vue";
@ -135,7 +136,7 @@ export default {
////
MJYLQSQD, SYWZPZJHB, DMYPPZJLB,
//
GSP001,GSP002, GSP003,GSP004,GSP005,GSP009, GSP010,
GSP001,GSP002, GSP003,GSP004,GSP005,GSP009, GSP010,GSP015,
//
SP001, SP003, SP00456,SP007, SP008, SP009,SP0019,SP0020,SP0021,
// PCR
@ -259,6 +260,7 @@ export default {
'GSP008': 'GSP002',
'GSP009': 'GSP009',
'GSP010': 'GSP010',
'GSP015': 'GSP015',
'GSP011': 'GSP009',
'GSP012': 'GSP002',
'GSP013': 'GSP002',

+ 333
- 0
src/views/business/comps/template/comps/gsp/GSP015.vue View File

@ -0,0 +1,333 @@
<!-- 供试品部给药制剂取样/前处理记录表 -->
<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="refConfig.baseInfoRef" :formConfig="baseInfoFormConfig" :formData="formData" />
<TableList label="template.common.gyzjInfo" :columns="gyzjColumns" :dataSource="resourceGyzj" />
<TableList label="template.common.sjInfo" :columns="sjColumns" :dataSource="resourceSj" />
<TableList label="template.common.instrumentInfo" :columns="yqColumns" :dataSource="yqResource" />
<LineLabel label="取样进样信息" />
<el-button class="mt-20" v-if="fillType === 'preFill'" type="primary" @click="onAdd">新增</el-button>
<el-button class="mt-20" v-if="fillType === 'actFill'" type="primary" @click="onExport">导出</el-button>
<div v-for="(item, index) in formData.ybsmDataList" :key="item.id" class="template-form-item">
<div class="config-header">
<div></div>
<el-popconfirm title="确认删除当前数据?" @confirm="deleteConfig(item)">
<el-button slot="reference" v-if="fillType === 'preFill'" type="text"
icon="el-icon-delete">{{
$t('template.common.deleteBtn')
}}</el-button>
</el-popconfirm>
</div>
<BaseInfoFormPackage fieldItemLabel="取样进样信息" :ref="`ybsmFormPackageRef${index}`"
:formConfig="ybsmFormConfig" @blur="onHandleBlur" :formData="item" />
<CustomTable :ref="`ybsmTableRef${index}`" :columns="ybsmColumns"
prefix = "qy"
:showOperation="fillType === 'actFill' || fillType === 'preFill'" :showAddRow="fillType === 'preFill'"
@onAddRow="() => addTableRow(index)"
fieldItemLabel="取样进样信息"
:formData="item">
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns"
@deleteRow="() => deleteTableRow(rowIndex, index)">
</TableOpertaionDelete>
</template>
</CustomTable>
<CustomTable :ref="`jyTableRef${index}`" :columns="yjColumns"
prefix = "jy"
fieldItemLabel="取样进样信息"
:showOperation="fillType === 'actFill'" :showAddRow="false"
:formData="{stepTableFormData:item.jyStepTableFormData || [], headerSelectFields: item.jyHeaderSelectFields || {}}">
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns"
@deleteRow="() => deleteTableRow(rowIndex, index)">
</TableOpertaionDelete>
</template>
</CustomTable>
</div>
<LineLabel label="二次稀释信息" />
<el-button class="mt-20" v-if="fillType === 'preFill'" type="primary" @click="onAdd('ecDataList')">新增</el-button>
<el-button class="mt-20" v-if="fillType === 'actFill'" type="primary" @click="onExport('ec')">导出</el-button>
<div v-for="(item, index) in formData.ecDataList" :key="item.id" class="template-form-item">
<div class="config-header">
<div></div>
<el-popconfirm title="确认删除当前数据?" @confirm="deleteConfig(item, 'ecDataList')">
<el-button slot="reference" v-if="fillType === 'preFill'" type="text"
icon="el-icon-delete">{{
$t('template.common.deleteBtn')
}}</el-button>
</el-popconfirm>
</div>
<BaseInfoFormPackage fieldItemLabel="二次稀释信息" :ref="`ecFormPackageRef${index}`"
:formConfig="ecFormConfig" @blur="onHandleBlur" :formData="item" />
<CustomTable :ref="`ecTableRef${index}`" :columns="yjColumns"
prefix = "ec"
fieldItemLabel="二次稀释信息"
:showOperation="fillType === 'preFill' ||fillType === 'actFill'"
:formData="item">
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns"
@deleteRow="() => deleteTableRow(rowIndex, index)">
</TableOpertaionDelete>
</template>
</CustomTable>
</div>
<Step :ref="`stepRef`" :formData="formData.stepData || []"></Step>
<BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark"
:ref="refConfig.remarkRef" :formConfig="remarkConig" :formData="formData" />
</div>
</div>
</div>
<!-- <button @click="onSave">保存</button> -->
</div>
</template>
<script>
import BaseInfoFormPackage from "@/components/Template/BaseInfoFormPackage";
import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete";
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 { uniqeResource } from "@/utils/calUnitTools";
import { getuuid, justUpdateFilledFormData } from "@/utils/index";
import { getBaseInfoFormConfig, getRemarkFormConfig, getYbsmFormConfig, getQyTableColumns,getJyTableColumns,getEcFormConfig } from "../../formConfig/gsp/gsp015";
const refConfig = {
baseInfoRef: "baseInfoRef",
remarkRef: "remarkRef",
stepRef: "stepRef",
}
const compRefs = Object.values(refConfig);
export default {
name: "SP0021",
components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable, TableOpertaionDelete },
mixins: [templateMixin],
props: {
fillType: {
type: String,
default: 'preFill',
},
sn: {
type: String,
default: '',
},
},
computed: {
//
remarkConig() {
return getRemarkFormConfig(this)
},
//
baseInfoFormConfig() {
return getBaseInfoFormConfig(this)
},
//
ybsmFormConfig() {
return getYbsmFormConfig(this)
},
//
ybsmColumns() {
return getQyTableColumns(this)
},
//
yjColumns() {
return getJyTableColumns(this)
},
//
ecFormConfig() {
return getEcFormConfig(this)
},
},
data() {
return {
refConfig,
currentIndex: -1,
};
},
mounted() {
},
methods: {
//
addTableRow(index) {
console.log(this.formData.ybsmDataList,"ybsmDataList")
this.$refs[`ybsmTableRef${index}`][0].addRow({
id: getuuid(),
})
this.$refs[`jyTableRef${index}`][0].addRow({
id: getuuid(),
})
},
onExport() {
},
//
deleteConfig(item,type="ybsmDataList") {
if (this.formData[type].length > 1) {
const configIndex = this.formData[type].findIndex(config => config.id === item.id);
if (configIndex > -1) {
const newList = [...this.formData[type]]
newList.splice(configIndex, 1);
this.$set(this.formData, type, newList);
this.$nextTick(() => {
//
justUpdateFilledFormData();
})
}
} else {
this.$message.warning('至少保留一条数据');
}
},
//
onAdd(type = "ybsmDataList") {
if (!this.formData[type]) {
this.$set(this.formData, type, []);
}
let defaultInfo = {
id: getuuid(),
stepData: [],
}
//
this.formData[type].push(defaultInfo);
},
//
deleteTableRow(rowIndex, index) {
this.$refs[`ybsmTableRef${index}`][0].deleteRow(rowIndex)
this.$refs[`jyTableRef${index}`][0].deleteRow(rowIndex)
},
//
getFilledFormData() {
//
const baseData = this.getFilledFormDataByRefs(compRefs);
const ybsmDataList = this.formData.ybsmDataList.map((item, index) => {
const ybsmFormData = this.$refs[`ybsmFormPackageRef${index}`][0]?.getFilledFormData() || {};
const ybsmTableData = this.$refs[`ybsmTableRef${index}`][0]?.getFilledFormData() || [];
const jyTableData = this.$refs[`jyTableRef${index}`][0]?.getFilledFormData() || [];
return {
...ybsmFormData,
...ybsmTableData,
jyStepTableFormData:jyTableData.stepTableFormData,
jyHeaderSelectFields: jyTableData.headerSelectFields,
};
});
const ecDataList = this.formData.ecDataList.map((item, index) => {
const ecFormData = this.$refs[`ecFormPackageRef${index}`][0]?.getFilledFormData() || {};
const ecTableData = this.$refs[`ecTableRef${index}`][0]?.getFilledFormData() || [];
return {
...ecFormData,
...ecTableData,
};
});
return {
...baseData,
ybsmDataList,
ecDataList
};
},
//
async getFormData() {
const refs = [];
const {ecDataList = [],ybsmDataList = []} = this.formData
//
for (let index = 0; index < ybsmDataList.length; index++) {
//
refs.push(`ybsmFormPackageRef${index}`)
refs.push(`ybsmTableRef${index}`)
refs.push(`jyTableRef${index}`)
}
for (let index = 0; index < ecDataList.length; index++) {
//
refs.push(`ecFormPackageRef${index}`)
refs.push(`ecTableRef${index}`)
}
//
let content = await this.validFormFields([...compRefs, ...refs]);
if (!content) return false;
//
return this.getFilledFormData();
},
getResource() {
let content = this.getFilledFormData();
//resource
let tmpResource = []
if (this.fillType === "actFill") {
//
tmpResource.push({
mc: content.targetName,
bh: content.targetCode + content.targetCodeSn,
ph: '',
ndz: content.targetActConcentration + content.targetActConcentrationUnit,
nd: content.targetActConcentration,
nddw: content.targetActConcentrationUnit,
ly: 'ELN配制',
sxrq: content.expireDate,
kc: content.targetActVolume,
kcdw: content.targetActVolumeUnit,
syl: null,
type: null,
elnType: this.product,
syldw: content.targetActVolumeUnit,
yxzq: content.effectivePeriod,
yxzqdw: content.effectivePeriodUnit,
})
}
//使
let allSjResource = [];
let allYqResource = [];
//
const stepResource = this.$refs[`stepRef`]?.getStepResource() || { sjResource: [], yqResource: [] };
allSjResource = [...allSjResource, ...(stepResource.sjResource || [])];
allYqResource = [...allYqResource, ...(stepResource.yqResource || [])];
this.resourceTmp = uniqeResource(tmpResource, allSjResource)
this.yqResourceTmp = allYqResource
return this.resourceTmp;
},
//
async onSave() {
let content = await this.getFormData();
console.log(content);
},
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
.mt-20 {
margin-top: 20px;
}
.print-btn {
margin-bottom: 20px;
}
.config-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
font-weight: bold;
font-size: 16px;
color: #303133;
}
.config-header .el-button {
color: #f56c6c;
font-size: 14px;
}
.config-header .el-button:hover {
color: #f78989;
}
</style>

+ 324
- 0
src/views/business/comps/template/formConfig/gsp/gsp015.js View File

@ -0,0 +1,324 @@
export const getBaseInfoFormConfig = ($this) => {
return [
{
type: 'cardItem',
config: {
studyMc: {
label: 'template.common.testName',
type: 'input',
disabled: true
},
studySn: {
label: 'template.common.testNumber',
type: 'input',
disabled: true
}
}
},
{
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'
}
}
}
]
}
//备注
export const getRemarkFormConfig = ($this) => {
return [
{
type: 'cellItem',
config: {
remark: {
label: '',
type: 'textarea',
fillType: 'actFill',
span: 1,
placeholder: 'template.common.remarkPlaceholder',
maxlength: 1000,
rows: 5
}
}
}
]
}
export const getYbsmFormConfig = ($this) => {
return [
{
type: 'step',
config: {
qysj: {
label: '取样时间',
type: 'input',
fillType: 'actFill',
maxlength: 50
},
xsy: {
label: "template.sp.sp003.xsy",
type: "input",
fillType: "preFill",
subType: "sj",
subKey: "subSolution",
subFillType: "actFill",
maxlength: 20,
}
}
}
]
}
//取样table
export const getQyTableColumns = ($this) => {
return [
{
label: '取样编号',
prop: 'qybh',
width: 280,
bodyType: 'input',
bodyFillType: 'preFill',
bodySubType: 'span',
bodySubKey: 'qybhcode',
},
{
label: '制剂编号',
prop: 'zjbh',
width: 280,
bodyType: 'gsp',
bodyFillType: 'actFill',
},
{
label: '预设制剂浓度',
prop: 'yszjnd',
width: 280,
headerSelectKey: 'yszjnddw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_nddw'),
bodyType: 'inputNumber',
bodyFillType: 'preFill',
headerSelectTo: 'sjzjnddw',
},
{
label: '实际制剂浓度',
prop: 'sjzjnd',
width: 280,
headerSelectKey: 'sjzjnddw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_nddw'),
bodyType: 'inputNumber',
bodyFillType: 'actFill',
copyFrom: 'yszjnd',
compareTo: 'yszjnd',
},
{
label: '制剂状态',
prop: 'zjzt',
width: 180,
bodyType: 'input',
bodyFillType: 'actFill',
},
{
label: '预设取样位置',
prop: 'ysqywz',
width: 180,
bodyType: 'select',
options: $this.getDictOptions('business_qywz'),
bodyFillType: 'actFill',
},
{
label: '预设取样位置',
prop: 'sjqywz',
width: 180,
bodyType: 'select',
options: $this.getDictOptions('business_qywz'),
bodyFillType: 'actFill',
compareTo: 'ysqywz',
},
{
label: '预设取样量',
prop: 'ysqyl',
width: 280,
headerSelectKey: 'ysqyldw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_tjdw'),
bodyType: 'inputNumber',
bodyFillType: 'preFill',
headerSelectTo: 'sjqydw',
},
{
label: '实际取样量',
prop: 'sjqyl',
width: 280,
headerSelectKey: 'sjqydw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_tjdw'),
bodyType: 'inputNumber',
bodyFillType: 'actFill',
copyFrom: 'ysqyldw',
compareTo: 'ysqyldw',
},
]
}
//进样table
export const getJyTableColumns = ($this) => {
return [
{
label: '进样编号',
prop: 'jybh',
width: 280,
bodyType: 'input',
bodyFillType: 'preFill',
bodySubType: 'span',
bodySubKey: 'jybhcode',
},
{
label: '取样编号',
prop: 'qybh',
width: 280,
bodyType: 'gsp',
bodyFillType: 'actFill',
},
{
label: '取样浓度',
prop: 'qynd',
width: 280,
headerSelectKey: 'qynddw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_nddw'),
bodyType: 'inputNumber',
bodyFillType: 'actFill',
},
{
label: '取样体积',
prop: 'qytj',
width: 280,
headerSelectKey: 'qytjdw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_tjdw'),
bodyType: 'inputNumber',
bodyFillType: 'actFill',
},
{
label: '标定体积',
prop: 'bdtj',
width: 280,
headerSelectKey: 'bdtjdw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_tjdw'),
bodyType: 'inputNumber',
bodyFillType: 'preFill',
},
{
label: '进样体积',
prop: 'jytj',
width: 280,
headerSelectKey: 'jytjdw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_tjdw'),
bodyType: 'inputNumber',
bodyFillType: 'actFill',
},
{
label: '稀释倍数',
prop: 'xsbs',
width: 280,
headerSelectKey: 'jytjdw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_tjdw'),
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodySubType: "inputNumber",
bodySubKey: "xsbsxsd",
bodySubFillType: "preFill",
showBodySub: $this.fillType === "preFill",
bodyDisabled: true,
bodyPrecisionKey: "xsbsxsd",
},
{
label: '终体积',
prop: 'ztj',
width: 280,
headerSelectKey: 'ztjdw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_tjdw'),
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodySubType: "inputNumber",
bodySubKey: "ztjxsd",
bodySubFillType: "preFill",
showBodySub: $this.fillType === "preFill",
bodyDisabled: true,
bodyPrecisionKey: "ztjxsd",
},
{
label: '实际进样浓度',
prop: 'sjjynd',
width: 280,
headerSelectKey: 'sjjynddw',
fillType: "preFill",
headerOptions: $this.getDictOptions('business_nddw'),
bodyType: 'inputNumber',
bodyFillType: 'actFill',
bodySubType: "inputNumber",
bodySubKey: "sjjyndsd",
bodySubFillType: "preFill",
showBodySub: $this.fillType === "preFill",
bodyDisabled: true,
bodyPrecisionKey: "sjjyndsd",
},
]
}
export const getEcFormConfig = ($this) => {
return [
{
type: "step",
config: {
xsy: {
label: 'template.sp.sp00456.xsy',
labelWidth: 80,
type: 'input',
fillType: 'preFill',
subType: 'sj',
subKey: 'subXsy',
subFillType: 'actFill',
maxlength: 20
},
}
}
]
}

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

@ -59,6 +59,7 @@ export default {
'business_cjdd', // 采集地点
'business_zpdd', // 制片地点
'business_cjbw', // 制片部位
'business_qywz', // 取样位置
],
props: {
templateData: {

Loading…
Cancel
Save