lslaiwy 1 month ago
parent
commit
554e3fa0c9
6 changed files with 226 additions and 61 deletions
  1. +78
    -52
      src/components/Template/BaseInfoFormPackage.vue
  2. +5
    -7
      src/components/Template/HandleFormItem.vue
  3. +1
    -1
      src/utils/formPackageCommon.js
  4. +3
    -1
      src/views/business/comps/template/TemplateTable.vue
  5. +124
    -0
      src/views/business/comps/template/comps/sp/SP0020.vue
  6. +15
    -0
      src/views/business/comps/template/formConfig/sp/SP0020.js

+ 78
- 52
src/components/Template/BaseInfoFormPackage.vue View File

@ -40,7 +40,7 @@
</div>
<div class="p-l-20">
<div v-show="isShowOther(formFields[key])">
<div class="form-title">{{ sItem.otherLabel ? $t(sItem.otherLabel) :
<div class="form-title" >{{ sItem.otherLabel ? $t(sItem.otherLabel) :
$t("template.common.other") }}</div>
<div class="flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel"
@ -84,22 +84,33 @@
:error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
</div>
<div v-else-if="sItem.type === 'select'">
<div v-else-if="sItem.type === 'select'" class = "flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
type="select" :item="sItem" v-model="formFields[key]" @copy="onCopy(sItem, key)"
@change="(e, type) => onSelectChange(key, e, type)" :error="errors[key]"
@update:error="errors[key] = false" :orange-bg="orangeBgFields[key]" />
<div v-show="isShowOther(formFields[key])" class="flex flex1 ml-10">
<div class="other-title" v-if="isShowOtherLabel(sItem)">{{ sItem.otherLabel ? $t(sItem.otherLabel) :
$t("template.common.other") }}</div>
<div class="flex">
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.otherCode" @blur="onBlur(key, $event)"
:item="getOtherItem(sItem)" v-model="formFields[sItem.otherCode]"
@copy="onCopy(sItem, key)" :error="errors[sItem.otherCode]"
@update:error="errors[sItem.otherCode] = false"
:orange-bg="orangeBgFields[sItem.otherCode]" />
</div>
</div>
</div>
<div v-else-if="sItem.type === 'input'" class="item-center">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
@blur="onBlur(key, $event)" :item="sItem" v-model="formFields[key]"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:ref = "key"
:orange-bg="orangeBgFields[key]" />
:ref="key" :orange-bg="orangeBgFields[key]" />
<span v-if="sItem.subType === 'text'" class="sub-text">{{ $t(sItem.subText) }}</span>
<HandleFormItem class="ml-10" v-else-if="sItem.subType === 'button'" type="button" :item="getButtonItem(sItem)"
:value="formFields[sItem.subKey]"
@clickButton="(e,val,data) => handleClickButton(e, sItem,val,data)" />
<HandleFormItem class="ml-10" v-else-if="sItem.subType === 'button'" type="button"
:item="getButtonItem(sItem)" :value="formFields[sItem.subKey]"
@clickButton="(e, val, data) => handleClickButton(e, sItem, val, data)" />
</div>
<div v-else-if="sItem.type === 'textarea'">
@ -125,22 +136,20 @@
<div v-else-if="isRegent(sItem)" class="flex1">
<HandleFormItem
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, key)"
:field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key" :type="sItem.type"
sourceFrom="baseInfoFormPackage" :error="errors[key]"
:field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
:type="sItem.type" sourceFrom="baseInfoFormPackage" :error="errors[key]"
@update:error="errors[key] = false"
@onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, key, sItem)"
:item="sItem" :value="formFields[key]" />
</div>
<!-- 勾选某些选项时出现其他输入框 -->
<div v-else-if="sItem.type === 'radioAndOther'" class="item-center">
<HandleFormItem
:field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key" type="radio"
:error="errors[key]"
@update:error="errors[key] = false"
@change="(e,type) => onSelectChange(key, e, type)"
:item="sItem" :value="formFields[key]" />
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
type="radio" :error="errors[key]" @update:error="errors[key] = false"
@change="(e, type) => onSelectChange(key, e, type)" :item="sItem"
:value="formFields[key]" />
<div v-show="isShowOtherByRadioAndOther(formFields[key], sItem)" class="flex1 ml-10">
<HandleFormItem :field-item-label="fieldItemLabel"
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.otherCode" @blur="onBlur(key, $event)"
:item="getRadioOtherItem(sItem)" v-model="formFields[sItem.otherCode]"
@copy="onCopy(sItem, key)" :error="errors[sItem.otherCode]"
@ -148,11 +157,12 @@
:orange-bg="orangeBgFields[sItem.otherCode]" />
</div>
</div>
<div v-else-if="sItem.type === 'fqyq'" class="flex1" :class="{ 'form-error-border': errors[key] }">
<div v-else-if="sItem.type === 'fqyq'" class="flex1"
:class="{ 'form-error-border': errors[key] }">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
type="fqyq" :item="sItem" :value="formFields[key]"
@change="(e) => onFqyqChange(key, e)"
:error="errors[key]" @update:error="errors[key] = false" />
@change="(e) => onFqyqChange(key, e)" :error="errors[key]"
@update:error="errors[key] = false" />
</div>
@ -166,7 +176,8 @@
<div v-for="(sItem, key) in item.config" class="c-Item flex item-center"
:class="getSpanClass(sItem)" :key="key">
<div class="step-form-title"
:style="{ 'width': sItem.labelWidth ? sItem.labelWidth + 'px' : '150px' }" v-if="sItem.label">
:style="{ 'width': sItem.labelWidth ? sItem.labelWidth + 'px' : '150px' }"
v-if="sItem.label">
{{ $t(sItem.label) }}</div>
<div v-if="sItem.type === 'dateTime'" class="flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
@ -180,8 +191,8 @@
@copy="onCopy(sItem, key)" @change="(e, type) => onSelectChange(key, e, type)"
:error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
<div v-show="isShowOther(formFields[key])" class="flex flex1">
<div class="other-title">{{ sItem.otherLabel ? $t(sItem.otherLabel) :
<div v-show="isShowOther(formFields[key])" class="flex flex1 ml-10">
<div class="other-title" v-if="isShowOtherLabel(sItem)">{{ sItem.otherLabel ? $t(sItem.otherLabel) :
$t("template.common.other") }}</div>
<div class="flex">
<HandleFormItem :field-item-label="fieldItemLabel"
@ -198,14 +209,16 @@
@blur="onBlur(key, $event)" class="flex1" :item="sItem" v-model="formFields[key]"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + sItem.subKey"
class="ml-10" v-if="sItem.subType === 'select'" type="select" :item="getSubItem(sItem)"
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.subKey" class="ml-10"
v-if="sItem.subType === 'select'" type="select" :item="getSubItem(sItem)"
v-model="formFields[sItem.subKey]" @copy="onCopy(sItem, key)"
@change="(e, type) => onSelectChange(sItem.subKey, e, type)" :error="errors[sItem.subKey]"
@update:error="errors[sItem.subKey] = false"
@change="(e, type) => onSelectChange(sItem.subKey, e, type)"
:error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
:orange-bg="orangeBgFields[sItem.subKey]" />
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + sItem.subKey"
class="ml-10" v-if="sItem.subType === 'input'" type="input" :item="getSubItem(sItem)"
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.subKey" class="ml-10"
v-if="sItem.subType === 'input'" type="input" :item="getSubItem(sItem)"
v-model="formFields[sItem.subKey]" @copy="onCopy(sItem, key)"
:error="errors[sItem.subKey]" @blur="onBlur(sItem.subKey, $event)"
@update:error="errors[sItem.subKey] = false"
@ -213,20 +226,22 @@
<div class="ml-10 item-span" v-else-if="sItem.subType === 'span'">{{
formFields[sItem.subKey] }}</div>
<span v-else-if="sItem.subType === 'text'" class="sub-text">{{ $t(sItem.subText) }}</span>
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + sItem.subKey"
class="ml-10" v-else-if="sItem.subType === 'clickable'" type="clickable"
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.subKey" class="ml-10"
v-else-if="sItem.subType === 'clickable'" type="clickable"
@clickable="handleClickable(sItem, sItem.subKey)" :item="getClickableItem(sItem)"
:error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
@resetRecord="resetRecord(sItem.subKey)" :value="formFields[sItem.subKey]" />
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + sItem.subKey"
class="ml-10" v-else-if="isRegent(sItem, 'subType')" :type="sItem.subType"
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.subKey" class="ml-10"
v-else-if="isRegent(sItem, 'subType')" :type="sItem.subType"
:item="getRegentItem(sItem, 'subType')" sourceFrom="baseInfoFormPackage"
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, sItem.subKey)"
@onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, sItem.subKey, sItem)"
:error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
:value="formFields[sItem.subKey]" />
<div v-show="isShowOther(formFields[sItem.subKey])" class="flex flex1">
<div class="other-title">{{ sItem.otherLabel ? $t(sItem.otherLabel) :
<div v-show="isShowOther(formFields[sItem.subKey])" class="flex flex1 ml-10">
<div class="other-title" v-if="isShowOtherLabel(sItem)">{{ sItem.otherLabel ? $t(sItem.otherLabel) :
$t("template.common.other") }}</div>
<div class="flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel"
@ -248,22 +263,25 @@
@input="onInputNumberChange(key, $event)" :value="formFields[key]"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + sItem.subKey"
class="ml-10" v-if="sItem.subType === 'select'" type="select" :item="getSubItem(sItem)"
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.subKey" class="ml-10"
v-if="sItem.subType === 'select'" type="select" :item="getSubItem(sItem)"
v-model="formFields[sItem.subKey]" @copy="onCopy(sItem, key)"
@change="(e, type) => onSelectChange(sItem.subKey, e, type)" :error="errors[sItem.subKey]"
@update:error="errors[sItem.subKey] = false"
@change="(e, type) => onSelectChange(sItem.subKey, e, type)"
:error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
:orange-bg="orangeBgFields[sItem.subKey]" />
<div class="ml-10 item-span" v-else-if="sItem.subType === 'span'">{{
formFields[sItem.subKey] }}</div>
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + sItem.subKey"
class="ml-10" v-else-if="sItem.subType === 'clickable'"
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.subKey" class="ml-10"
v-else-if="sItem.subType === 'clickable'"
@clickable="handleClickable(sItem, sItem.subKey)" :error="errors[sItem.subKey]"
type="clickable" @update:error="errors[sItem.subKey] = false"
@resetRecord="resetRecord(sItem.subKey)" :item="getClickableItem(sItem)"
:value="formFields[sItem.subKey]" />
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + sItem.subKey"
class="ml-10" v-else-if="isRegent(sItem, 'subType')" sourceFrom="baseInfoFormPackage"
<HandleFormItem :field-item-label="fieldItemLabel"
:field-key="prefixKey + '_' + sItem.subKey" class="ml-10"
v-else-if="isRegent(sItem, 'subType')" sourceFrom="baseInfoFormPackage"
:error="errors[sItem.subKey]" :type="sItem.subType"
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, sItem.subKey)"
@onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, sItem.subKey, sItem)"
@ -320,7 +338,7 @@
<script>
import HandleFormItem from "./HandleFormItem.vue";
import LineLabel from "./LineLabel.vue";
import { isShowOther,isShowOtherByRadioAndOther } from "@/utils/formPackageCommon.js";
import { isShowOther, isShowOtherByRadioAndOther } from "@/utils/formPackageCommon.js";
import { isRegent } from "@/utils/index.js";
import formPackageMixins from '@/components/Template/mixins/formPackageMixins.js'
@ -372,9 +390,9 @@ export default {
this.$emit('beforeReagentSubmit', { selectData: data, callback, key, formFields: this.formFields })
},
//
handleClickButton(e, item,val,data) {
handleClickButton(e, item, val, data) {
this.formFields[item.subKey] = val;
this.$emit("clickButton", item,data)
this.$emit("clickButton", item, data)
},
//
getButtonItem(sItem) {
@ -385,10 +403,17 @@ export default {
}
},
// fqyq
onFqyqChange(key, e){
console.log(e,key,'fqyq');
onFqyqChange(key, e) {
console.log(e, key, 'fqyq');
this.formFields[key] = e;
}
},
//
isShowOtherLabel(sItem){
if (sItem.hasOwnProperty("showOtherLabel")) {
return sItem.showOtherLabel
}
return true
},
}
}
@ -551,10 +576,11 @@ export default {
.mr-20 {
margin-right: 20px;
}
.form-error-border{
.form-error-border {
box-shadow: 0 0 6px #ffc3c3;
padding: 8px;
border-radius: 4px;
border: 1px solid #ff5d5d;
padding: 8px;
border-radius: 4px;
border: 1px solid #ff5d5d;
}
</style>

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

@ -23,6 +23,7 @@
<el-checkbox v-else-if="type === 'checkbox'" class="flex1" :multiple="item.multiple"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue"
:disabled="getDisabled()" :placeholder="getPlaceholder()" @change="onItemCheckboxChange">
{{ item.checkboxLabel }}
</el-checkbox>
<el-radio-group v-else-if="type === 'radio'" v-model="inputValue"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" :disabled="getDisabled()"
@ -308,10 +309,7 @@ export default {
watch: {
value(newVal) {
if (this.type === 'checkboxList' && newVal && typeof newVal === 'object') {
this.checkboxListValue = {
checkboxValues: newVal.checkboxValues || [],
otherValues: newVal.otherValues || {}
};
this.checkboxListValue = JSON.parse(JSON.stringify(newVal));
} else if (this.type === 'checkboxTag' && Array.isArray(newVal)) {
// checkboxTagvalue
this.checkboxTagList = newVal.map(tag => ({
@ -915,7 +913,7 @@ export default {
const { otherValues: oldOtherValues,checkboxValues: oldCheckboxValues } = this.oldCheckboxListValue;
const o = {
"checkboxListValue":{oldValue:oldCheckboxValues,newValue:checkboxValues,des:""},
"checkboxListOther":{oldValue:oldOtherValues[this.currentOtherCode],newValue:otherValues[this.currentOtherCode],des:""},
"checkboxListOther":{oldValue:oldOtherValues[this.currentOtherCode],newValue:otherValues[this.currentOtherCode],des:"样品信息:"},
}
return o[this.currentHandleType];
},
@ -1066,8 +1064,8 @@ export default {
isModify = !!this.oldFqyqValue.mainRadio
}else if(this.type === "checkboxList"){
const current = this.getCheckboxListInfo();
recordOldVlaue = `${current.des+current.oldValue}`;
recordValue = `${current.des+current.newValue}`;
recordOldVlaue = `${current.des+(current.oldValue || '')}`;
recordValue = `${current.des+(current.newValue || '')}`;
isModify = !!current.oldValue;
}
const record = {

+ 1
- 1
src/utils/formPackageCommon.js View File

@ -5,7 +5,7 @@ export const isShowOther = (v = [], col) => {
}
// 确保v是数组类型,以避免类型错误
const arr = Array.isArray(v) ? v : [v]
const otherArr = ['其他', '遮光', 'CA-QC Dilution-', '拒绝', '部分接受']
const otherArr = ['其他', '遮光', 'CA-QC Dilution-', '拒绝', '部分接受',"污染"]
return arr.some((item) => otherArr.includes(item))
}

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

@ -31,6 +31,7 @@ import SP007 from "./comps/sp/SP007.vue";
import SP008 from "./comps/sp/SP008.vue";
import SP009 from "./comps/sp/SP009.vue";
import SP0019 from "./comps/sp/SP0019.vue";
import SP0020 from "./comps/sp/SP0020.vue";
import Demo from "./comps/sp/Demo.vue";
//
import GSP001 from "./comps/gsp/GSP001.vue";
@ -111,7 +112,7 @@ export default {
//
GSP001,GSP002, GSP003, GSP004,GSP009, GSP010,
//
SP001, SP003, SP00456,SP007, SP008, SP009,SP0019,
SP001, SP003, SP00456,SP007, SP008, SP009,SP0019,SP0020,
// PCR
PCR002, PCR003, PCR004, PCR005,
//LBA
@ -206,6 +207,7 @@ export default {
'SP017': 'SP008',
'SP018': 'SP008',
'SP019': 'SP0019',
'SP020': 'SP0020',
//
'GSP001': 'GSP001',

+ 124
- 0
src/views/business/comps/template/comps/sp/SP0020.vue View File

@ -0,0 +1,124 @@
<!-- 生物样品分析溶液配制表 -->
<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" />
<LineLabel label="试验内容" />
<BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark"
ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
</div>
</div>
</div>
<!-- <button @click="onSave">保存</button> -->
</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 TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue"
import { getBaseInfoFormConfig} from "../../formConfig/sp/SP0019";
import { getSynrFormConfig} from "../../formConfig/sp/SP0020";
export default {
name: "SP0020",
components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable,TableOpertaionDelete },
mixins: [templateMixin],
props: {
fillType: {
type: String,
default: 'preFill',
},
},
computed: {
synrFormConfig(){
return getSynrFormConfig(this);
},
//
baseInfoFormConfig() {
return getBaseInfoFormConfig(this);
},
//
remarkConig() {
return [
{
type: "cellItem",
config: {
remark: {
label: "",
type: "textarea",
fillType: "actFill",
span: 1,
placeholder: 'template.common.remarkPlaceholder',
maxlength: 1000,
rows: 5
}
}
}
]
},
},
data() {
return {
formData: {},
compRefs:["baseInfoRef", "storageConditionRef", "spzxhRef","yqInfoTableRef","ryTableRef", "remarkRef"]
};
},
mounted() {
},
methods: {
onRegentSubmit(e){
const {selectInfo, key, col, rowIndex, colIndex, rowData} = e;
const {row} = selectInfo;
if(key === "rymc"){
const params = {
pzrq: row.pzrq,
sxr: row.sxr,
}
this.$refs.ryTableRef.updateDataSourceByRowIndex(rowIndex, params);
}
},
onYqSubmit(data, col, rowIndex, colIndex, row){
console.log(data, col, rowIndex, colIndex, row,"onRegentSubmit")
},
//
getFilledFormData() {
return this.getFilledFormDataByRefs(this.compRefs)
},
//
async getFormData() {
let content = await this.validFormFields(this.compRefs);
console.log(content)
return content;
},
//
async onSave() {
},
}
};
</script>
<style rel="stylesheet/scss" lang="scss">
.mt-20 {
margin-top: 20px;
}
.print-btn {
margin-bottom: 20px;
}
</style>

+ 15
- 0
src/views/business/comps/template/formConfig/sp/SP0020.js View File

@ -0,0 +1,15 @@
export const getSynrFormConfig = ($this) => {
return [
{
type: 'step',
config: {
yqmxh: {
label: '色谱柱型号',
type: 'yq',
fillType: 'actFill',
filledCodes:['mc','bh'],
},
}
},
]
}

Loading…
Cancel
Save