Browse Source

fix:[模板管理][YP003代码格式回滚]

ouqian
ouqian 1 month ago
parent
commit
67a4c9e8f2
1 changed files with 266 additions and 325 deletions
  1. +266
    -325
      src/views/business/comps/template/comps/yp/YP003.vue

+ 266
- 325
src/views/business/comps/template/comps/yp/YP003.vue View File

@ -1,339 +1,280 @@
<!-- 配体结合分析溶液配制记录表 --> <!-- 配体结合分析溶液配制记录表 -->
<template> <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.instrumentInfo"
:columns="yqColumns"
:dataSource="yqResource"
/>
<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.instrumentInfo" :columns="yqColumns" :dataSource="yqResource" />
<LineLabel label="template.yp.yp003.ybxx" />
<LineLabel label="template.yp.yp003.ybxx" />
<CustomTable
:ref="`tableRef`"
:columns="tableColumns"
:formData="formData"
operationWidth="80px"
:prefixKey="`table`"
fieldItemLabel="template.yp.yp003.ybxx"
@clickButton="handleClickButton"
@onCheckboxTagChange="onCheckboxTagChange"
:showOperation="fillType === 'preFill'"
>
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete
:row="row"
:rowIndex="rowIndex"
:columns="columns"
@deleteRow="deleteRow"
></TableOpertaionDelete>
</template>
</CustomTable>
<LineLabel label="template.yp.yp003.fqxx" />
<Step ref="stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPackage
fieldItemLabel="template.yp.yp003.fqyq"
label="template.yp.yp003.fqyq"
ref="fqyqRef"
:formConfig="fqyqConig"
:formData="formData"
/>
<BaseInfoFormPackage
fieldItemLabel="template.common.remark"
label="template.common.remark"
ref="remarkRef"
:formConfig="remarkConig"
:formData="formData"
/>
</div>
</div>
</div>
<!-- <button @click="onSave">保存</button> -->
<ImportExcelDialog
ref="ImportExcelDialog"
@onLoadData="onLoadExcelData"
:downloadArr="['动物编号']"
@downloadExcelTemplate="downloadExcelTemplate"
/>
</div>
<CustomTable
:ref="`tableRef`"
:columns="tableColumns"
:formData="formData"
operationWidth = "80px"
:prefixKey = "`table`"
fieldItemLabel = "template.yp.yp003.ybxx"
@clickButton="handleClickButton"
@onCheckboxTagChange="onCheckboxTagChange"
:showOperation="fillType === 'preFill'"
>
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="deleteRow" ></TableOpertaionDelete>
</template>
</CustomTable>
<LineLabel label="template.yp.yp003.fqxx" />
<Step ref="stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPackage fieldItemLabel="template.yp.yp003.fqyq" label="template.yp.yp003.fqyq"
ref="fqyqRef" :formConfig="fqyqConig" :formData="formData" />
<BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark"
ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
</div>
</div>
</div>
<!-- <button @click="onSave">保存</button> -->
<ImportExcelDialog ref="ImportExcelDialog" @onLoadData="onLoadExcelData" :downloadArr="['动物编号']" @downloadExcelTemplate="downloadExcelTemplate" />
</div>
</template> </template>
<script> <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 { EventBus } from '@/utils/eventBus'
import { uniqeResource } from '@/utils/calUnitTools'
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 { EventBus } from "@/utils/eventBus";
import { uniqeResource } from "@/utils/calUnitTools";
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import TableOpertaionDelete from '@/components/Template/operation/TableOpertaionDelete.vue'
import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue"
import ImportExcelDialog from '../../dialog/ImportExcelDialog' import ImportExcelDialog from '../../dialog/ImportExcelDialog'
export default { export default {
name: 'YP003',
components: {
ImportExcelDialog,
BaseInfoFormPackage,
LineLabel,
TableList,
Step,
CustomTable,
TableOpertaionDelete
},
mixins: [templateMixin],
props: {
fillType: {
type: String,
default: 'preFill'
}
},
computed: {
//
fqyqConig() {
return [
{
type: 'cellItem',
config: {
fqyq: {
label: 'template.yp.yp003.sfyfzyq',
type: 'fqyq',
fillType: 'actFill',
span: 1
}
}
}
]
},
//
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
}
}
},
{
type: 'conditionItem',
label: 'template.common.processCondition',
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: 'conditionItem',
label: 'template.yp.yp003.yplx',
config: {
yplx: {
label: 'template.yp.yp003.yplx',
type: 'select',
fillType: 'preFill',
options: this.getDictOptions('business_yplx'),
otherCode: 'yplxOther'
}
}
},
{
type: 'cellItem',
label: 'template.lba.lba002.czsj',
config: {
startDate: {
label: 'template.common.startTime',
type: 'input'
},
endDate: {
label: 'template.common.endTime',
type: 'input'
}
}
}
]
},
//
tableColumns() {
return [
{
label: 'template.yp.yp003.cyd',
prop: 'cyd',
bodyType: 'input',
bodyFillType: 'actFill',
width: 100,
bodyMaxlength: 50
},
{
label: 'template.yp.yp003.dwbh',
prop: 'dwbh',
bodyType: 'checkboxTag',
bodyFillType: 'actFill',
bodySubType: 'button',
bodySubFillType: 'preFill',
bodySubButtonName: 'template.common.importTemplate',
bodySubKey: 'exportBtn',
showBodySub: this.fillType === 'preFill',
width: 280
},
{
label: 'template.yp.yp003.ypsl',
prop: 'ypsl',
bodyType: 'input',
bodyDisabled: true,
bodyFillType: 'actFill',
width: 80
}
]
}
},
data() {
return {
formData: {},
currentRowIndex: -1
}
},
mounted() {},
methods: {
//
handleClickButton(key, rowIndex, colIndex, e, data) {
if (key === 'exportBtn') {
this.currentRowIndex = rowIndex
this.$refs.ImportExcelDialog.show()
}
},
//
getFilledFormData() {
return this.getFilledFormDataByRefs([
'baseInfoRef',
'tableRef',
'stepRef',
'fqyqRef',
'remarkRef'
])
},
//
async getFormData() {
let content = await this.validFormFields([
'baseInfoRef',
'tableRef',
'stepRef',
'fqyqRef',
'remarkRef'
])
return content
},
getResource() {
//使
const stepResource = this.$refs.stepRef.getStepResource()
this.resourceTmp = stepResource.sjResource || []
this.yqResourceTmp = stepResource.yqResource || []
return this.resourceTmp
},
//
async onSave() {
let content = await this.$refs.stepRef.getFormData()
console.log(content)
},
//
deleteRow(rowIndex) {
const tableRef = this.$refs['tableRef']
if (tableRef) {
tableRef.deleteRow(rowIndex)
}
},
name: "YP003",
components: { ImportExcelDialog,BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable,TableOpertaionDelete },
mixins: [templateMixin],
props: {
fillType: {
type: String,
default: 'preFill',
},
},
computed: {
//
fqyqConig() {
return [
{
type: "cellItem",
config: {
fqyq: {
label: "template.yp.yp003.sfyfzyq",
type: "fqyq",
fillType: "actFill",
span: 1,
}
}
}
]
},
//
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,
},
}
},
{
type: "conditionItem",
label: 'template.common.processCondition',
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: "conditionItem",
label: 'template.yp.yp003.yplx',
config: {
yplx: {
label: 'template.yp.yp003.yplx',
type: "select",
fillType: "preFill",
options: this.getDictOptions('business_yplx'),
otherCode: "yplxOther",
},
}
},
{
type: "cellItem",
label: 'template.lba.lba002.czsj',
config: {
startDate: {
label: 'template.common.startTime',
type: "input",
},
endDate: {
label: 'template.common.endTime',
type: "input",
},
}
}
]
},
//
tableColumns() {
return [{
label: 'template.yp.yp003.cyd',
prop: 'cyd',
bodyType: 'input',
bodyFillType: 'actFill',
width: 100,
bodyMaxlength: 50,
},{
label: 'template.yp.yp003.dwbh',
prop: 'dwbh',
bodyType: 'checkboxTag',
bodyFillType: 'actFill',
bodySubType:"button",
bodySubFillType:"preFill",
bodySubButtonName:"template.common.importTemplate",
bodySubKey:"exportBtn",
showBodySub:this.fillType === "preFill",
width: 280,
},{
label: 'template.yp.yp003.ypsl',
prop: 'ypsl',
bodyType: 'input',
bodyDisabled: true,
bodyFillType: 'actFill',
width: 80,
}]
},
},
data() {
return {
formData: {},
currentRowIndex: -1,
};
},
mounted() {
},
methods: {
//
handleClickButton(key,rowIndex,colIndex,e,data){
if(key === "exportBtn"){
this.currentRowIndex = rowIndex;
this.$refs.ImportExcelDialog.show()
}
},
//
getFilledFormData() {
return this.getFilledFormDataByRefs(["baseInfoRef", "tableRef", "stepRef", "fqyqRef","remarkRef"])
},
//
async getFormData() {
let content = await this.validFormFields(["baseInfoRef", "tableRef", "stepRef", "fqyqRef","remarkRef"]);
return content;
},
getResource() {
//使
const stepResource = this.$refs.stepRef.getStepResource()
this.resourceTmp = stepResource.sjResource || []
this.yqResourceTmp = stepResource.yqResource || []
return this.resourceTmp;
},
//
async onSave() {
let content = await this.$refs.stepRef.getFormData();
console.log(content);
},
//
deleteRow(rowIndex) {
const tableRef = this.$refs['tableRef'];
if (tableRef) {
tableRef.deleteRow(rowIndex);
}
},
showImportExcelDialog() {
this.$refs.ImportExcelDialog.show()
},
onLoadExcelData(excelData) {
const data = excelData.splice(1)
const tagData = data.map((item) => {
return {
checked: undefined,
tagValue: item[0]
}
})
this.$refs.tableRef.updateDataSourceByRowIndex(this.currentRowIndex, {
dwbh: tagData
})
this.$refs.tableRef.onErrorUpdate(this.currentRowIndex, 1, 'dwbh', false)
this.$refs.ImportExcelDialog.cancel()
setTimeout(() => {
this.justUpdateFilledFormData()
}, 100)
},
downloadExcelTemplate(arr) {
this.exportExcel(arr)
},
onCheckboxTagChange(rowIndex, colIndex, data) {
const num = data.filter((item) => item.checked).length
this.$refs.tableRef.updateDataSourceByRowIndex(rowIndex, { ypsl: num })
}
}
}
showImportExcelDialog() {
this.$refs.ImportExcelDialog.show()
},
onLoadExcelData(excelData) {
const data = excelData.splice(1);
const tagData = data.map((item)=>{
return {
checked:undefined,
tagValue:item[0],
}
})
this.$refs.tableRef.updateDataSourceByRowIndex(this.currentRowIndex,{dwbh:tagData});
this.$refs.tableRef.onErrorUpdate(this.currentRowIndex, 1, 'dwbh', false)
this.$refs.ImportExcelDialog.cancel()
setTimeout(() => {
this.justUpdateFilledFormData();
}, 100);
},
downloadExcelTemplate(arr){
this.exportExcel(arr)
},
onCheckboxTagChange(rowIndex,colIndex,data){
const num = data.filter((item)=>item.checked).length;
this.$refs.tableRef.updateDataSourceByRowIndex(rowIndex, {'ypsl':num})
}
}
};
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
</style> </style>

Loading…
Cancel
Save