Browse Source

feat:[模板管理][update]

luojie
luojie 3 weeks ago
parent
commit
1fee36d3e8
5 changed files with 215 additions and 105 deletions
  1. +49
    -54
      src/components/Template/HandleFormItem.vue
  2. +116
    -39
      src/components/Template/StepComponents/ZLSubPackage.vue
  3. +16
    -6
      src/components/Template/StepComponents/ry/zlfz.vue
  4. +12
    -2
      src/components/Template/StepFormPackage.vue
  5. +22
    -4
      src/utils/formPackageCommon.js

+ 49
- 54
src/components/Template/HandleFormItem.vue View File

@ -3,11 +3,10 @@
<div class="flex" :class="getFlexClass()"> <div class="flex" :class="getFlexClass()">
<!-- @copy.native.capture.prevent="handleFalse" <!-- @copy.native.capture.prevent="handleFalse"
@cut.native.capture.prevent="handleFalse" --> @cut.native.capture.prevent="handleFalse" -->
<el-input
v-if="type === 'input'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" @blur="onBlur"
type = "textarea" :autosize="{ minRows: 1, maxRows: 6 }" resize = "none"
:placeholder="getPlaceholder()" v-model="inputValue" @input="onInputChange" @change="onInputChange" />
<el-input v-if="type === 'input'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" @blur="onBlur" type="textarea"
:autosize="{ minRows: 1, maxRows: 6 }" resize="none" :placeholder="getPlaceholder()"
v-model="inputValue" @input="onInputChange" @change="onInputChange" />
<el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 1000" :disabled="getDisabled()" <el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 1000" :disabled="getDisabled()"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" type="textarea" show-word-limit :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" type="textarea" show-word-limit
resize="none" @blur="onBlur" :rows="item.rows || 3" :placeholder="getPlaceholder()" v-model="inputValue" resize="none" @blur="onBlur" :rows="item.rows || 3" :placeholder="getPlaceholder()" v-model="inputValue"
@ -20,9 +19,8 @@
<el-select v-else-if="type === 'select'" class="flex1" :multiple="item.multiple" <el-select v-else-if="type === 'select'" class="flex1" :multiple="item.multiple"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" v-model="inputValue"
:disabled="getDisabled()" :placeholder="getPlaceholder()" @remove-tag="onRemoveTag" :disabled="getDisabled()" :placeholder="getPlaceholder()" @remove-tag="onRemoveTag"
:remote = "item.selectRemote || false"
:remote-method="remoteMethod"
@visible-change="onSelectBlur" @change="onInputChange" filterable>
:remote="item.selectRemote || false" :remote-method="remoteMethod" @visible-change="onSelectBlur"
@change="onInputChange" filterable>
<el-option v-for="op in item.options" :key="op.value" :label="op.label" :value="op.value"> <el-option v-for="op in item.options" :key="op.value" :label="op.label" :value="op.value">
</el-option> </el-option>
</el-select> </el-select>
@ -79,16 +77,10 @@
:format="type === 'dateTime' ? 'yyyy/MM/dd HH:mm:ss' : 'yyyy/MM/dd'" :placeholder="getPlaceholder()" :format="type === 'dateTime' ? 'yyyy/MM/dd HH:mm:ss' : 'yyyy/MM/dd'" :placeholder="getPlaceholder()"
@change="(val) => onDateChange(val, type === 'dateTime' ? 'yyyy/MM/DD HH:mm:ss' : 'yyyy/MM/DD')"> @change="(val) => onDateChange(val, type === 'dateTime' ? 'yyyy/MM/DD HH:mm:ss' : 'yyyy/MM/DD')">
</el-date-picker> </el-date-picker>
<el-date-picker
v-else-if="type === 'dateTimeRange'"
v-model="inputValue"
type="datetimerange"
range-separator="至"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"
:disabled="getDisabled()"
:picker-options="pickerOptions"
@change="(val) => onDateChange(val, 'yyyy/MM/DD HH:mm:ss')"
start-placeholder="开始日期"
<el-date-picker v-else-if="type === 'dateTimeRange'" v-model="inputValue" type="datetimerange"
range-separator="至" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"
:disabled="getDisabled()" :picker-options="pickerOptions"
@change="(val) => onDateChange(val, 'yyyy/MM/DD HH:mm:ss')" start-placeholder="开始日期"
end-placeholder="结束日期"> end-placeholder="结束日期">
</el-date-picker> </el-date-picker>
<el-button v-else-if="type === 'button'" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" <el-button v-else-if="type === 'button'" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"
@ -112,9 +104,8 @@
<template v-else-if="type === 'attachment'"> <template v-else-if="type === 'attachment'">
<el-upload ref="uploadRef" class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview" <el-upload ref="uploadRef" class="upload-demo" :action="uploadFileUrl" :on-preview="handlePreview"
:headers="headers" :before-remove="beforeRemove" :on-remove="handleRemove" multiple :limit="10" :headers="headers" :before-remove="beforeRemove" :on-remove="handleRemove" multiple :limit="10"
:disabled="getDisabled()"
:on-success="handleSuccess" :on-change="handleChange" :on-exceed="handleExceed"
:file-list="fileList" :auto-upload="false">
:disabled="getDisabled()" :on-success="handleSuccess" :on-change="handleChange"
:on-exceed="handleExceed" :file-list="fileList" :auto-upload="false">
<el-button :disabled="getDisabled()" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" <el-button :disabled="getDisabled()" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')"
size="small" type="primary">点击上传</el-button> size="small" type="primary">点击上传</el-button>
<span v-if="error" class="atta-tips">请上传附件</span> <span v-if="error" class="atta-tips">请上传附件</span>
@ -215,7 +206,8 @@
</div> </div>
</div> </div>
</div> </div>
<el-dialog :close-on-click-modal="false" append-to-body :title="(templateFillType == 'actFill' || templateFillType == 'blxjsh') ? '意见回复' : '复核意见'"
<el-dialog :close-on-click-modal="false" append-to-body
:title="(templateFillType == 'actFill' || templateFillType == 'blxjsh') ? '意见回复' : '复核意见'"
:visible.sync="visible" width="30%"> :visible.sync="visible" width="30%">
<el-input v-model="replyContent" type="textarea" show-word-limit resize="none" rows="8" placeholder="输入内容" <el-input v-model="replyContent" type="textarea" show-word-limit resize="none" rows="8" placeholder="输入内容"
maxlength="500" /> maxlength="500" />
@ -232,12 +224,12 @@ import Question from "./icons/Question.vue";
import DecimalInput from "./DecimalInput.vue"; import DecimalInput from "./DecimalInput.vue";
import { EventBus } from "@/utils/eventBus"; import { EventBus } from "@/utils/eventBus";
import moment from "moment"; import moment from "moment";
import { getuuid, isEqual, deepClone, getDefaultValueByOptions, isValueEmpty,isRegent } from "@/utils/index.js";
import { getuuid, isEqual, deepClone, getDefaultValueByOptions, isValueEmpty, isRegent } from "@/utils/index.js";
import { getToken } from "@/utils/auth"; import { getToken } from "@/utils/auth";
import { isShowOtherByCheckboxTree } from "@/utils/formPackageCommon"; import { isShowOtherByCheckboxTree } from "@/utils/formPackageCommon";
export default { export default {
inject: ['templateData', 'templateFillType',"getSubmittedCodes","updateSubmittedCodes", "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"],
inject: ['templateData', 'templateFillType', "getSubmittedCodes", "updateSubmittedCodes", "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"],
components: { components: {
Question, Question,
DecimalInput, DecimalInput,
@ -307,7 +299,7 @@ export default {
const defaultCheckedValue = getDefaultValueByOptions(this.item.options || []); const defaultCheckedValue = getDefaultValueByOptions(this.item.options || []);
initialValue = { checkedValues: defaultCheckedValue, otherValues: {} }; initialValue = { checkedValues: defaultCheckedValue, otherValues: {} };
} }
const {type} = this;
const { type } = this;
return { return {
inputValue: initialValue, inputValue: initialValue,
oldValue: typeof initialValue === 'object' ? JSON.parse(JSON.stringify(initialValue)) : initialValue, // oldValue: typeof initialValue === 'object' ? JSON.parse(JSON.stringify(initialValue)) : initialValue, //
@ -343,7 +335,7 @@ export default {
// disabledDate(time) { // disabledDate(time) {
// return time.getTime() > Date.now(); // return time.getTime() > Date.now();
// }, // },
shortcuts: type === 'dateTimeRange' ? undefined:[{
shortcuts: type === 'dateTimeRange' ? undefined : [{
text: '今天', text: '今天',
onClick(picker) { onClick(picker) {
picker.$emit('pick', new Date()); picker.$emit('pick', new Date());
@ -354,7 +346,7 @@ export default {
} }
}, },
watch: { watch: {
value(newVal) { value(newVal) {
if (this.type === 'checkboxTag' && Array.isArray(newVal)) { if (this.type === 'checkboxTag' && Array.isArray(newVal)) {
// checkboxTagvalue // checkboxTagvalue
@ -412,7 +404,7 @@ export default {
return false; return false;
}, },
getFlexClass() { getFlexClass() {
const noFlexArr = ["radio", "checkboxTag", "fqyq"]
const noFlexArr = ["radio", "checkboxTag", "fqyq","button"]
return noFlexArr.includes(this.type) ? '' : 'flex1' return noFlexArr.includes(this.type) ? '' : 'flex1'
}, },
getDecimalDigits() { getDecimalDigits() {
@ -524,7 +516,7 @@ export default {
// //
// //
this.pendingRemoveFile = { file, fileList: this.fileList }; this.pendingRemoveFile = { file, fileList: this.fileList };
console.log("fillll")
console.log("fillll")
// //
EventBus.$emit('showEditSignDialog', { uuid: this.uuid }); EventBus.$emit('showEditSignDialog', { uuid: this.uuid });
@ -611,8 +603,8 @@ console.log("fillll")
this.inputValue = data.selectedId; this.inputValue = data.selectedId;
const { filledCodes = [] } = this.item; const { filledCodes = [] } = this.item;
console.log(filledCodes, "filledCodes") console.log(filledCodes, "filledCodes")
const { selectInfo, row,checkType } = data;
if (filledCodes.length > 0 && checkType !=="checkbox") {
const { selectInfo, row, checkType } = data;
if (filledCodes.length > 0 && checkType !== "checkbox") {
this.inputValue = row[filledCodes[0]] + "(" + row[filledCodes[1]] + ")"; this.inputValue = row[filledCodes[0]] + "(" + row[filledCodes[1]] + ")";
} }
this.selectRegentInfo = data; this.selectRegentInfo = data;
@ -621,7 +613,7 @@ console.log("fillll")
}, },
/// ///
onCommonHandleRegent(item, type) { onCommonHandleRegent(item, type) {
const {fillType = "actFill"} = item;
const { fillType = "actFill" } = item;
if (this.templateFillType !== fillType) { if (this.templateFillType !== fillType) {
return return
} }
@ -651,10 +643,10 @@ console.log("fillll")
}; };
if (type === "mix") { if (type === "mix") {
params.mixType = true; params.mixType = true;
}
}
if (item.qxbdType) { if (item.qxbdType) {
params.qxbdType = item.qxbdType; params.qxbdType = item.qxbdType;
}
}
if (item.checkType) { if (item.checkType) {
params.checkType = item.checkType; params.checkType = item.checkType;
} }
@ -670,7 +662,7 @@ console.log("fillll")
onDateChange(val, format) { onDateChange(val, format) {
if (this.type === 'dateTimeRange') { if (this.type === 'dateTimeRange') {
this.inputValue = [moment(val[0]).format(format), moment(val[1]).format(format)]; this.inputValue = [moment(val[0]).format(format), moment(val[1]).format(format)];
}else{
} else {
this.inputValue = moment(val).format(format); this.inputValue = moment(val).format(format);
} }
this.onCommonHandleSaveRecord(this.inputValue); this.onCommonHandleSaveRecord(this.inputValue);
@ -742,7 +734,7 @@ console.log("fillll")
}, },
getFillTypeStyle(type) { getFillTypeStyle(type) {
const { fillType } = this.item; const { fillType } = this.item;
const filterType = ["attachment", "checkboxTag", "fqyq", "checkboxTree","radio"]
const filterType = ["attachment", "checkboxTag", "fqyq", "checkboxTree", "radio"]
const typeObj = { const typeObj = {
actFill: "orange-border",// actFill: "orange-border",//
blxjsh: "orange-border",// blxjsh: "orange-border",//
@ -1098,10 +1090,10 @@ console.log("fillll")
const { mainRadio: oldMainRadio, inputValue: oldInputValue, subRadio: oldSubRadio } = this.oldFqyqValue; const { mainRadio: oldMainRadio, inputValue: oldInputValue, subRadio: oldSubRadio } = this.oldFqyqValue;
const o = { const o = {
"mainRadio": { oldValue: oldMainRadio, newValue: mainRadio, des: "" }, "mainRadio": { oldValue: oldMainRadio, newValue: mainRadio, des: "" },
"inputValue": { oldValue: oldInputValue, newValue: inputValue, des: "",key: this.fieldKey+"_inputValue" },
"inputValue": { oldValue: oldInputValue, newValue: inputValue, des: "", key: this.fieldKey + "_inputValue" },
"subRadio": { oldValue: oldSubRadio, newValue: subRadio, des: "是否在规定时间完成:" } "subRadio": { oldValue: oldSubRadio, newValue: subRadio, des: "是否在规定时间完成:" }
} }
console.log(o, this.currentHandleType, this.fqyqValue,"fqyqValue")
console.log(o, this.currentHandleType, this.fqyqValue, "fqyqValue")
return o[this.currentHandleType]; return o[this.currentHandleType];
}, },
getCheckboxTreeInfo() { getCheckboxTreeInfo() {
@ -1112,7 +1104,7 @@ console.log("fillll")
const oldItem = oldCheckedValues.find(item => item.label === currentCheckboxTreeValue); const oldItem = oldCheckedValues.find(item => item.label === currentCheckboxTreeValue);
const o = { const o = {
"checkboxTreeCheckbox": { oldValue: oldItem, newValue: newItem, des: "" }, "checkboxTreeCheckbox": { oldValue: oldItem, newValue: newItem, des: "" },
"checkboxTreeOther": { oldValue: oldOtherValues[currentCheckboxTreeValue], newValue: otherValues[currentCheckboxTreeValue], des: `${currentCheckboxTreeValue}`,key: this.fieldKey+"_"+currentCheckboxTreeValue },
"checkboxTreeOther": { oldValue: oldOtherValues[currentCheckboxTreeValue], newValue: otherValues[currentCheckboxTreeValue], des: `${currentCheckboxTreeValue}`, key: this.fieldKey + "_" + currentCheckboxTreeValue },
} }
return o[currentHandleType]; return o[currentHandleType];
}, },
@ -1171,9 +1163,9 @@ console.log("fillll")
} else if (this.type === "fqyq") { } else if (this.type === "fqyq") {
const current = this.getFqyqInfo(); const current = this.getFqyqInfo();
isSame = isEqual(current.oldValue, current.newValue); isSame = isEqual(current.oldValue, current.newValue);
if(this.currentHandleType === "inputValue"){
isOldValueEmpty =this.isUnSubmitted(current.key);
}else{
if (this.currentHandleType === "inputValue") {
isOldValueEmpty = this.isUnSubmitted(current.key);
} else {
isOldValueEmpty = isValueEmpty(current.oldValue); isOldValueEmpty = isValueEmpty(current.oldValue);
} }
} else if (this.type === "checkboxTree") { } else if (this.type === "checkboxTree") {
@ -1188,10 +1180,10 @@ console.log("fillll")
} }
} else if(this.type === "checkbox"){
} else if (this.type === "checkbox") {
isSame = isEqual(this.oldValue, this.inputValue) isSame = isEqual(this.oldValue, this.inputValue)
isOldValueEmpty =this.isUnSubmitted();
}else {
isOldValueEmpty = this.isUnSubmitted();
} else {
isSame = isEqual(this.oldValue, this.inputValue) isSame = isEqual(this.oldValue, this.inputValue)
isOldValueEmpty = this.isUnSubmitted(); isOldValueEmpty = this.isUnSubmitted();
} }
@ -1199,7 +1191,7 @@ console.log("fillll")
if (isSame) { if (isSame) {
return; return;
} }
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 });
@ -1209,9 +1201,9 @@ console.log("fillll")
}, },
// //
isUnSubmitted(key){
isUnSubmitted(key) {
const finallyKey = key || this.fieldKey; const finallyKey = key || this.fieldKey;
const has = this.getSubmittedCodes().includes(finallyKey)
const has = this.getSubmittedCodes().includes(finallyKey)
return !has; return !has;
}, },
@ -1265,7 +1257,7 @@ console.log("fillll")
const current = this.getFqyqInfo(); const current = this.getFqyqInfo();
recordOldVlaue = `${current.des + current.oldValue}`; recordOldVlaue = `${current.des + current.oldValue}`;
recordValue = `${current.des + current.newValue}`; recordValue = `${current.des + current.newValue}`;
if(this.currentHandleType === "inputValue"){
if (this.currentHandleType === "inputValue") {
finallyKey = current.key; finallyKey = current.key;
} }
isModify = !!this.oldFqyqValue.mainRadio isModify = !!this.oldFqyqValue.mainRadio
@ -1283,11 +1275,11 @@ console.log("fillll")
recordValue = `${current.des + (current.newValue || '')}`; recordValue = `${current.des + (current.newValue || '')}`;
isModify = !!current.oldValue; isModify = !!current.oldValue;
} }
}else if(this.type === "checkbox"){
recordOldVlaue = `${this.item.checkboxLabel || ""}:${this.oldValue?'勾选':'未勾选'}`;
recordValue = `${this.item.checkboxLabel||""}:${this.inputValue?'勾选':'未勾选'}`;
} else if (this.type === "checkbox") {
recordOldVlaue = `${this.item.checkboxLabel || ""}:${this.oldValue ? '勾选' : '未勾选'}`;
recordValue = `${this.item.checkboxLabel || ""}:${this.inputValue ? '勾选' : '未勾选'}`;
isModify = this.oldValue !== ''; isModify = this.oldValue !== '';
}else if(this.type === "attachment"){
} else if (this.type === "attachment") {
const attList = JSON.parse(recordValue); const attList = JSON.parse(recordValue);
const oldAttList = JSON.parse(recordOldVlaue || "[]"); const oldAttList = JSON.parse(recordOldVlaue || "[]");
recordValue = attList.map(item => item.name).join(";"); recordValue = attList.map(item => item.name).join(";");
@ -1423,7 +1415,7 @@ console.log("fillll")
return this.templateFillType !== "preFill" return this.templateFillType !== "preFill"
} else if (fillType === "blxjsh") {//fillTypeblxjsh } else if (fillType === "blxjsh") {//fillTypeblxjsh
return this.templateFillType !== "blxjsh" return this.templateFillType !== "blxjsh"
}else {
} else {
return true return true
} }
} }
@ -1631,6 +1623,7 @@ console.log("fillll")
.el-checkbox__inner { .el-checkbox__inner {
border-color: #f9c588 !important; border-color: #f9c588 !important;
} }
&.is-checked { &.is-checked {
.el-checkbox__label { .el-checkbox__label {
color: #606266; color: #606266;
@ -1859,6 +1852,7 @@ console.log("fillll")
color: #606266; color: #606266;
flex: 1; flex: 1;
background-color: #fff; background-color: #fff;
&.disabled { &.disabled {
cursor: not-allowed; cursor: not-allowed;
color: #c0c4cc; color: #c0c4cc;
@ -2069,6 +2063,7 @@ console.log("fillll")
border-radius: 4px; border-radius: 4px;
border: 1px solid #ff5d5d; border: 1px solid #ff5d5d;
} }
.no-border { .no-border {
border: none; border: none;
} }

+ 116
- 39
src/components/Template/StepComponents/ZLSubPackage.vue View File

@ -2,10 +2,10 @@
<template> <template>
<div class="zl-container"> <div class="zl-container">
<div class="dialog-content"> <div class="dialog-content">
<div class="header-container">
<div class="zl-header-container">
<div class="header-item" v-for="item in subConfig" :key="item.key"> <div class="header-item" v-for="item in subConfig" :key="item.key">
<div class="header-title">{{ item.label }}</div> <div class="header-title">{{ item.label }}</div>
<HandleFormItem fieldItemLabel = "质量分装" :fieldKey = item.fieldKey
<HandleFormItem fieldItemLabel = "质量分装" :fieldKey = 'prefixKey+stepIndex + item.fieldKey'
:item="item" :error="formErrors[item.key]" :item="item" :error="formErrors[item.key]"
:type="item.type" :type="item.type"
@blur = "(e)=>onCommonBlur(e,item.key)" @blur = "(e)=>onCommonBlur(e,item.key)"
@ -16,14 +16,14 @@
<div class="header-title">分装编号</div> <div class="header-title">分装编号</div>
<div class="header-title">单位</div> <div class="header-title">单位</div>
<div class="unit-select"> <div class="unit-select">
<HandleFormItem fieldKey = "clfz_dw" :item="unitItem" type="select" :error="formErrors.dw"
<HandleFormItem :fieldKey = "prefixKey+stepIndex + 'dw'" :item="unitItem" type="select" :error="formErrors.dw"
@blur="(e) => onCommonBlur(e, 'dw')" v-model="formData.dw" /> @blur="(e) => onCommonBlur(e, 'dw')" v-model="formData.dw" />
</div> </div>
</div> </div>
<div class="header-item"> <div class="header-item">
<div class="header-title">预设每份容量</div> <div class="header-title">预设每份容量</div>
<div class="unit-select"> <div class="unit-select">
<HandleFormItem :fieldKey="formData.mybh + '_mfbzl'" type="inputNumber"
<HandleFormItem :fieldKey="prefixKey+stepIndex + formData.mybh + '_mfbzl'" type="inputNumber"
:error="formErrors.mfbzl" :isFieldsRecord="false" :item="preInputNumberItem" :error="formErrors.mfbzl" :isFieldsRecord="false" :item="preInputNumberItem"
v-model="formData.mfbzl" /> v-model="formData.mfbzl" />
</div> </div>
@ -33,22 +33,23 @@
</div> </div>
</div> </div>
<div class="content-container"> <div class="content-container">
<div class="header-container">
<div class="zl-header-container">
<div v-for="(item, index) in fzList" class="list-item" :key="index"> <div v-for="(item, index) in fzList" class="list-item" :key="index">
<div class="list-label">{{ formData.mybh }}-set{{ item.subCode }}</div>
<HandleFormItem fieldItemLabel = "质量分装" :fieldKey = "'clfz_set'+index+'_prenum'" :item="preInputNumberItem"
<div class="list-label" v-if="item.subCode">{{ formData.mybh }}-set{{ item.subCode }}</div>
<HandleFormItem fieldItemLabel = "质量分装" :fieldKey = "prefixKey+stepIndex + 'clfz_set'+index+'_prenum'" :item="preInputNumberItem"
:error="hasError(index, 'prenum')" :error="hasError(index, 'prenum')"
:disabled="true" :disabled="true"
type="inputNumber" @blur="onBlurFzNum(index,'prenum')" v-model="item.prenum" /> type="inputNumber" @blur="onBlurFzNum(index,'prenum')" v-model="item.prenum" />
<HandleFormItem fieldItemLabel = "质量分装" :fieldKey = "'clfz_set'+index+'_actnum'" class="ml-5" :item="inputNumberItem"
<HandleFormItem fieldItemLabel = "质量分装" :fieldKey = "prefixKey+stepIndex + 'clfz_set'+index+'_actnum'" class="ml-5" :item="inputNumberItem"
:error="hasError(index, 'actnum')" :error="hasError(index, 'actnum')"
type="inputNumber" @blur="onBlurFzNum(index,'actnum')" v-model="item.actnum" /> type="inputNumber" @blur="onBlurFzNum(index,'actnum')" v-model="item.actnum" />
<HandleFormItem
class="ml-5"
type="button"
:item="getButtonItem()"
@clickButton="(e)=>onGetValue(item)" />
<el-button class="ml-5" v-if="templateFillType == 'actFill'" type="primary" plain @click="onGetValue(item)">获取值</el-button>
<el-button class="ml-5" v-if="templateFillType == 'actFill'" type="primary" plain @click="onPrint(item)">打印</el-button>
</div> </div>
</div>
<div class="sure-button-row">
<el-button v-if="templateFillType == 'actFill'" class="ml-5" type="primary" @click="onSure">确定</el-button>
</div> </div>
</div> </div>
</div> </div>
@ -59,7 +60,7 @@
import HandleFormItem from '@/components/Template/HandleFormItem.vue'; import HandleFormItem from '@/components/Template/HandleFormItem.vue';
import { EventBus } from '@/utils/eventBus'; import { EventBus } from '@/utils/eventBus';
import { getLatestSn } from '@/api/template'; import { getLatestSn } from '@/api/template';
import { isValueEmpty } from '@/utils/index.js';
import { isValueEmpty,justUpdateFilledFormData } from '@/utils/index.js';
export default { export default {
inject: ['templateFillType'], inject: ['templateFillType'],
dicts: [ dicts: [
@ -73,6 +74,14 @@ export default {
type: Object, type: Object,
default: () => ({}) default: () => ({})
}, },
prefixKey: {
type: String,
default: ""
},
stepIndex: {
type: Number,
default: 0
},
}, },
data() { data() {
return { return {
@ -165,22 +174,68 @@ export default {
maxlength: 3, maxlength: 3,
unit:"份", unit:"份",
}, },
{//
fieldKey:"clfz_dw1",
type:"span",
},
// {//
// fieldKey:"clfz_dw1",
// type:"span",
// },
] ]
}, },
}, },
methods: { methods: {
onSure(){
this.$emit("onSubPackageSubmit");
},
onPrint(item){
console.log(item,"打印");
},
updateFormData(data){ updateFormData(data){
this.formData = {...this.formData,...data}; this.formData = {...this.formData,...data};
if(data.mybh){
this.updateCode(data.mybh);
}
},
//
async updateCode(mybh){
const { fzList } = this;
if(isValueEmpty(mybh) || isValueEmpty(fzList)){
return;
}
const result = await getLatestSn({
pre: mybh,
count: fzList.length,
type: 2,
})
if(result.code === 200){
const codes = result.data;
//
for (let i = 0; i < fzList.length; i++) {
fzList[i].subCode = codes[i];
}
justUpdateFilledFormData()
}
}, },
// //
getButtonItem() { getButtonItem() {
return { return {
fillType: "actFill", fillType: "actFill",
buttonName:"获取值", buttonName:"获取值",
key:"hqz",
}
},
//
getPrintButtonItem() {
return {
fillType: "actFill",
buttonName:"打印",
key:"print",
}
},
//
getSureButtonItem() {
return {
fillType: "actFill",
buttonName:"确定",
key:"sure",
} }
}, },
close() { close() {
@ -189,6 +244,31 @@ export default {
this.formData = {}; this.formData = {};
this.resetErrors(); this.resetErrors();
}, },
onAverage() {
const { mfbzl } = this.formData;
this.fzList.forEach((item, index) => {
item.prenum = mfbzl;
//
if (this.fzListErrors[index] !== undefined) {
this.$set(this.fzListErrors, index, false);
}
})
//
this.formErrors.mfbzl = false;
justUpdateFilledFormData()
},
onReset() {
this.fzList.forEach((item, index) => {
item.num = "";
//
if (this.fzListErrors[index] !== undefined) {
this.$set(this.fzListErrors, index, false);
}
})
//
this.formErrors.mfbzl = false;
justUpdateFilledFormData()
},
validateFormData() { validateFormData() {
let isValid = true; let isValid = true;
@ -255,29 +335,15 @@ export default {
// //
this.fzList = []; this.fzList = [];
this.fzListErrors = []; this.fzListErrors = [];
const result = await getLatestSn({
pre: this.formData.mybh,
count: e,
type: 2,
})
if(result.code === 200){
const codes = result.data;
//
for (let i = 0; i < e; i++) {
for (let i = 0; i < e; i++) {
this.fzList.push({ this.fzList.push({
prenum: "", prenum: "",
actnum: "", actnum: "",
subCode: codes[i],
subCode: "",
}); });
} }
const params = {
type: "fieldChanged",
newRecord: null,
resourceList: null,
}
EventBus.$emit("onModifyRecord", params);
}
justUpdateFilledFormData()
}, },
onGetValue(item) { onGetValue(item) {
@ -416,9 +482,9 @@ export default {
align-items: center; align-items: center;
} }
.header-container {
.zl-header-container {
display: grid; display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-columns: repeat(2, 1fr);
grid-gap: 20px; grid-gap: 20px;
margin-top: 10px; margin-top: 10px;
} }
@ -429,6 +495,7 @@ export default {
border-radius: 4px; border-radius: 4px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start;
// padding: 20px; // padding: 20px;
} }
@ -459,5 +526,15 @@ export default {
margin-right: 5px; margin-right: 5px;
// width: 200px; // width: 200px;
} }
.sure-button-row{
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
position: relative;
padding: 20px;
}
.absolute{
position: absolute;
}
</style> </style>

+ 16
- 6
src/components/Template/StepComponents/ry/zlfz.vue View File

@ -1,8 +1,9 @@
<!-- 质量分装 --> <!-- 质量分装 -->
<template> <template>
<StepFormPackage <StepFormPackage
@onDialogSubmit = "onDialogSubmit"
@onRegentSubmit = "onRegentSubmit"
ref="stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_zlfz'" @resetRecord="resetRecord" :form-config="formConfig" ref="stepFormPackageRef" :prefixKey="stepIndex+'_'+'ry_zlfz'" @resetRecord="resetRecord" :form-config="formConfig"
@onSubPackageSubmit="onSubPackageSubmit"
:formData="formData" /> :formData="formData" />
</template> </template>
@ -28,7 +29,7 @@ export default {
type: "input", type: "input",
fillType: "preFill", fillType: "preFill",
}, },
yq: {
gsp: {
type: "gsp", type: "gsp",
fillType: "actFill", fillType: "actFill",
}, },
@ -49,13 +50,22 @@ export default {
} }
}, },
methods: { methods: {
onDialogSubmit(data,key){
console.log(data,key,"onDialogSubmit")
if(key === 'yq'){//
this.$refs.stepFormPackageRef.updateZlfzData("zlfz",{mybh:data.selectedId});
onRegentSubmit(data){
console.log(data,"onRegentSubmit")
const {key,selectInfo} = data;
if(key === 'gsp'){//
this.$refs.stepFormPackageRef.updateZlfzData("zlfz",{mybh:selectInfo.selectedId});
// this.formData[key] = data; // this.formData[key] = data;
} }
},
async onSubPackageSubmit(data){
const {key} = data;
if(key === 'zlfz'){
const formData = await this.$refs.stepFormPackageRef.getFormData();
console.log(formData,"formData")
}
} }
} }
} }

+ 12
- 2
src/components/Template/StepFormPackage.vue View File

@ -49,7 +49,9 @@
<span>{{ formFields[key] }}</span> <span>{{ formFields[key] }}</span>
</template> </template>
<template v-else-if="sItem.type === 'zlfz'"> <template v-else-if="sItem.type === 'zlfz'">
<ZLSubPackage @update="(data)=>onSubPackageUpdate(data,key)" :subData = "formFields[key]" :ref="'zlSubPackageRef_'+key" />
<ZLSubPackage
@onSubPackageSubmit="onSubPackageSubmit(key) "
:stepIndex="stepIndex" :prefixKey="prefixKey+'_'+index" @update="(data)=>onSubPackageUpdate(data,key)" :subData = "formFields[key]" :ref="'zlSubPackageRef_'+key" />
</template> </template>
<div v-show="isShowOther(formFields[key])" class="flex flex1"> <div v-show="isShowOther(formFields[key])" class="flex flex1">
@ -97,6 +99,10 @@ export default {
prefixKey: { prefixKey: {
type: String, type: String,
default: "" default: ""
},
stepIndex: {
type: Number,
default: 0
} }
}, },
mounted() { mounted() {
@ -115,6 +121,10 @@ export default {
} }
}, },
methods: { methods: {
//
onSubPackageSubmit(key){
this.$emit("onSubPackageSubmit", {key,formData:this.formFields});
},
// /// // ///
onRegentSubmit(data,key,item){ onRegentSubmit(data,key,item){
this.updateFormData(key,data.selectedId); this.updateFormData(key,data.selectedId);
@ -123,7 +133,7 @@ export default {
this.allFieldsConfig[key].sjSelectType = data.selectType; this.allFieldsConfig[key].sjSelectType = data.selectType;
} }
this.formFields[`selectInfo_${key}`] = data.selectInfo; this.formFields[`selectInfo_${key}`] = data.selectInfo;
// this.$emit("onRegentSubmit", {selectInfo:data,key,config:item});
this.$emit("onRegentSubmit", {selectInfo:data,key,config:item});
}, },
getRegentItem(item,fieldCode="type"){ getRegentItem(item,fieldCode="type"){
const type = item[fieldCode] ; const type = item[fieldCode] ;

+ 22
- 4
src/utils/formPackageCommon.js View File

@ -5,7 +5,7 @@ export const isShowOther = (v = [], col) => {
} }
// 确保v是数组类型,以避免类型错误 // 确保v是数组类型,以避免类型错误
const arr = Array.isArray(v) ? v : [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)) return arr.some((item) => otherArr.includes(item))
} }
@ -19,7 +19,25 @@ export const isShowOtherByRadioAndOther = (v = '', col) => {
} }
//checkboxTree判断是否显示其他输入框 //checkboxTree判断是否显示其他输入框
export const isShowOtherByCheckboxTree = (v = "")=>{
const otherArr = ['其他', '样品信息', '样品','部分接受']
return otherArr.includes(v)
export const isShowOtherByCheckboxTree = (v = "") => {
const otherArr = ['其他', '样品信息', '样品', '部分接受', '给药 ',
'样本采集',
'日常观察 ',
'皮肤评分',
'眼刺激评分',
'麻醉 ',
'交配确认',
'PND检测',
'神经行为功能评测',
'血糖测定',
'遥测数据采集',
'呼吸检测',
'血压测定',
'心电检测',
'体温测定',
'毒代 TK',
'药代 PK'
, '细胞因子']
return otherArr.includes(v)
} }

Loading…
Cancel
Save