Browse Source

feat:[模板管理][checkbox-tree]

ouqian
luojie 1 month ago
parent
commit
e3bf06c323
5 changed files with 200 additions and 156 deletions
  1. +175
    -147
      src/components/Template/HandleFormItem.vue
  2. +1
    -1
      src/components/Template/Step.vue
  3. +6
    -6
      src/components/Template/StepFormPackage.vue
  4. +18
    -1
      src/utils/index.js
  5. +0
    -1
      src/views/business/comps/template/dialog/SelectMixReagentDialog.vue

+ 175
- 147
src/components/Template/HandleFormItem.vue View File

@ -42,8 +42,9 @@
</el-checkbox>
<div v-if="isShowCheckboxListOther(option)">
<el-input v-model="checkboxListValue.otherValues[option.otherCode]"
:class="{ 'error-border': isOtherInputError(option.otherCode) }"
:placeholder="option.otherPlaceholder || '请输入'" @blur="onCheckboxListOtherBlur($event, option.otherCode)"/>
:class="{ 'error-border': isOtherInputError(option.otherCode) }"
:placeholder="option.otherPlaceholder || '请输入'"
@blur="onCheckboxListOtherBlur($event, option.otherCode)" />
</div>
</div>
</el-checkbox-group>
@ -51,28 +52,23 @@
<div v-else-if="type === 'checkboxTree'" class="flex1 checkbox-list-container"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')">
<div v-for="group in item.options" :key="group.value" class="checkbox-tree-group">
<el-checkbox
:label="group.value"
:disabled="getDisabled()"
:checked="isCheckboxTreeChecked(group.value)"
<el-checkbox :label="group.value" :disabled="getDisabled()"
:value="getCheckboxTreeChecked(group.value)"
@change="onCheckboxTreeChange(group.value, $event)">
{{ group.label }}
</el-checkbox>
<div v-if="group.children && group.children.length > 0" class="checkbox-tree-children">
<div v-for="child in group.children" :key="child.value" class="checkbox-tree-item">
<el-checkbox
:label="child.value"
:disabled="getDisabled()"
:checked="isCheckboxTreeChecked(child.value)"
<el-checkbox :label="child.value" :disabled="getDisabled()"
:value="getCheckboxTreeChecked(child.value)"
@change="onCheckboxTreeChange(child.value, $event)">
{{ child.label }}
</el-checkbox>
<div v-if="(child.value === '样品信息' || child.value === '其他') && isCheckboxTreeChecked(child.value)" class="checkbox-tree-input-container">
<el-input
v-model="checkboxTreeValue.otherValues[child.value]"
:class="{ 'error-border': isCheckboxTreeOtherInputError(child.value) }"
placeholder="请输入"
@blur="onCheckboxTreeOtherBlur(child.value, $event)"/>
<div v-if="(child.value === '样品信息' || child.value === '其他') && isCheckboxTreeChecked(child.value)"
class="checkbox-tree-input-container">
<el-input v-model="inputValue.otherValues[child.value]"
:class="{ 'error-border': isCheckboxTreeOtherInputError(child.value) }"
placeholder="请输入" @blur="onCheckboxTreeOtherBlur(child.value, $event)" />
</div>
</div>
</div>
@ -117,7 +113,8 @@
<div slot="tip" class="el-upload__tip">支持扩展名.rar .zip .doc .docx .pdf .jpg文件大小不超过2MB</div>
</el-upload>
</template>
<div v-else-if="type === 'checkboxTag'" class="flex1 checkbox-tag-wrapper" :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')">
<div v-else-if="type === 'checkboxTag'" class="flex1 checkbox-tag-wrapper"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')">
<div v-for="(tag, tagIndex) in checkboxTagList" :key="tagIndex" class="checkbox-tag-container">
<div class="checkbox-tag-item">
<el-checkbox v-model="tag.checked" :disabled="getDisabled()"
@ -125,8 +122,8 @@
<div class="tag-content blue-border">
<el-input v-if="templateFillType === 'preFill'" v-model="tag.tagValue"
:ref="'tagInput_' + tagIndex" :maxlength="item.maxlength || 20"
@blur="onTagBlur(tagIndex)" @keyup.enter.native="onTagBlur(tagIndex)"
placeholder="请输入" size="mini" class="tag-input" />
@blur="onTagBlur(tagIndex)" @keyup.enter.native="onTagBlur(tagIndex)" placeholder="请输入"
size="mini" class="tag-input" />
<el-tag v-else :type="'info'" class="tag-display" :closable="false">
{{ tag.tagValue }}
</el-tag>
@ -140,13 +137,16 @@
</div>
</div>
<div v-else-if="type === 'fqyq'" :class="getFillTypeStyle()">
<el-radio-group v-model="fqyqValue.mainRadio" :disabled="getDisabled()" @input="onFqyqRadioChange($event,'mainRadio')">
<el-radio-group v-model="fqyqValue.mainRadio" :disabled="getDisabled()"
@input="onFqyqRadioChange($event, 'mainRadio')">
<div class="item-center mb-10">
<el-radio label="是"></el-radio>
<div class="item-center" v-if="fqyqValue.mainRadio === '是'">
<el-input class="fqyq-input" maxlength="100" v-model="fqyqValue.inputValue" :disabled="getDisabled()" placeholder="请输入" @blur="onFqyqInputBlur" ></el-input>
<el-input class="fqyq-input" maxlength="100" v-model="fqyqValue.inputValue"
:disabled="getDisabled()" placeholder="请输入" @blur="onFqyqInputBlur"></el-input>
<div class="fs-14 mr-10">是否在规定时间完成</div>
<el-radio-group v-model="fqyqValue.subRadio" :disabled="getDisabled()" @input="onFqyqRadioChange($event,'subRadio')">
<el-radio-group v-model="fqyqValue.subRadio" :disabled="getDisabled()"
@input="onFqyqRadioChange($event, 'subRadio')">
<el-radio label="是"></el-radio>
<el-radio label="否"></el-radio>
</el-radio-group>
@ -227,7 +227,7 @@ import moment from "moment";
import { deepClone } from "@/utils/index";
import { getuuid } from "@/utils/index.js";
import { getToken } from "@/utils/auth"
import { isValueEmpty } from '@/utils/index.js';
import { isValueEmpty, getDefaultValueByOptions } from '@/utils/index.js';
export default {
inject: ['templateData', 'templateFillType', "getZdxgjl", "getFhyjjl", "updateZdxgjl", "replaceFhyjjl", "updateFhyjjl", "getFieldCheckObj", "updateFieldCheckObj"],
@ -286,14 +286,15 @@ export default {
},
data() {
let initialValue = this.value;
console.log(this.value, "check value");
let initialOtherValues = {}, checkboxTagList = [];
if(this.type === 'checkboxList' && !this.value) {
if (this.type === 'checkboxList' && !this.value) {
initialValue = {
checkboxValues: [],
otherValues: {}
};
} else if (this.type === 'checkboxTag' && Array.isArray(this.value)) {
// checkboxTagvalue
checkboxTagList = this.value.map(tag => ({
@ -301,11 +302,14 @@ export default {
tagValue: tag.tagValue || ''
}));
} else if (this.type === 'fqyq' && !this.value) {
initialValue = {mainRadio: '', subRadio: '',inputValue:""};
initialValue = { mainRadio: '', subRadio: '', inputValue: "" };
} else if (this.type === 'checkboxTree' && !this.value) {
const defaultCheckedValue = getDefaultValueByOptions(this.item.options || []);
initialValue = { checkedValues: defaultCheckedValue, otherValues: {} };
}
return {
inputValue: initialValue,
oldValue: initialValue, //
oldValue: typeof initialValue === 'object' ? JSON.parse(JSON.stringify(initialValue)) : initialValue, //
showModal: false, //
modificationRecords: [], //
modalTimer: null, //
@ -318,12 +322,9 @@ export default {
checkboxTagList: checkboxTagList, // checkboxTag
oldCheckboxTagList: JSON.parse(JSON.stringify(checkboxTagList)), // checkboxTagList
fqyqValue: initialValue, // fqyq
oldFqyqValue: {...initialValue}, // fqyq
oldFqyqValue: { ...initialValue }, // fqyq
checkboxListValue: initialValue, // checkboxList
oldCheckboxListValue: JSON.parse(JSON.stringify(initialValue)), // checkboxList
checkboxTreeValue: this.type === 'checkboxTree' ? (this.value || { checkedValues: [], otherValues: {} }) : {}, // checkboxTree
oldCheckboxTreeValue: this.type === 'checkboxTree' ? JSON.parse(JSON.stringify(this.value || { checkedValues: [], otherValues: {} })) : {}, // checkboxTree
checkboxTreeFirstCheck: this.type === 'checkboxTree' ? {} : {}, //
uuid: getuuid(), // EventBus
regentType: ['sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq', 'jcb', 'qxbd'], ////
selectRegentInfo: {},////
@ -334,14 +335,16 @@ export default {
},
pendingUploadFile: null, //
pendingRemoveFile: null, //
currentTagIndex:-1,//checkboxTag
currentHandleType:'',//
currentOtherCode:'',//otherCode
currentTagIndex: -1,//checkboxTag
currentHandleType: '',//
currentOtherCode: '',//otherCode
currentCheckboxTreeValue: '',//checkboxTree
}
},
watch: {
value(newVal) {
console.log(newVal, "newVal")
if (this.type === 'checkboxList' && newVal && typeof newVal === 'object') {
this.checkboxListValue = JSON.parse(JSON.stringify(newVal));
} else if (this.type === 'checkboxTag' && Array.isArray(newVal)) {
@ -357,12 +360,8 @@ export default {
inputValue: newVal.inputValue || '',
subRadio: newVal.subRadio || ''
};
} else if (this.type === 'checkboxTree' && newVal && typeof newVal === 'object') {
// checkboxTree
this.checkboxTreeValue = JSON.parse(JSON.stringify(newVal));
this.oldCheckboxTreeValue = JSON.parse(JSON.stringify(newVal));
} else {
this.inputValue = newVal;
this.inputValue = typeof newVal === 'object' ? JSON.parse(JSON.stringify(newVal)) : newVal;
}
}
},
@ -398,7 +397,7 @@ export default {
},
methods: {
getFlexClass() {
const noFlexArr = ["radio", "checkboxTag","fqyq"]
const noFlexArr = ["radio", "checkboxTag", "fqyq"]
return noFlexArr.includes(this.type) ? '' : 'flex1'
},
getDecimalDigits() {
@ -636,7 +635,7 @@ export default {
};
if (type === "mix") {
params.mixType = true;
}else if(item.qxbdType){
} else if (item.qxbdType) {
params.qxbdType = item.qxbdType;
}
}
@ -719,7 +718,7 @@ export default {
},
getFillTypeStyle(type) {
const { fillType } = this.item;
const filterType = ["attachment","checkboxTag","fqyq","checkboxTree"]
const filterType = ["attachment", "checkboxTag", "fqyq", "checkboxTree"]
const typeObj = {
actFill: "orange-border",//
green: "green-border",
@ -861,7 +860,7 @@ export default {
},
// checkboxList
isShowCheckboxListOther(option) {
const {checkboxValues } = this.checkboxListValue
const { checkboxValues } = this.checkboxListValue
if (!checkboxValues) {
return false;
}
@ -920,80 +919,85 @@ export default {
this.checkboxListValue.otherValues[otherCode] = e.target.value;
this.onCommonHandleSaveRecord(e.target.value);
},
// checkboxTree
isCheckboxTreeChecked(value) {
return this.checkboxTreeValue.checkedValues && this.checkboxTreeValue.checkedValues.includes(value);
if (!this.inputValue || !this.inputValue.checkedValues) {
return false;
}
const checkedItem = this.inputValue.checkedValues.find(item => item.label === value);
return checkedItem && checkedItem.checked;
},
// checkboxTree
isCheckboxTreeOtherInputError(value) {
if (!this.error) {
return false;
}
return isValueEmpty(this.checkboxTreeValue.otherValues[value]);
return isValueEmpty(this.inputValue.otherValues[value]);
},
// checkboxTree
getCheckboxTreeChecked(value) {
const { checkedValues } = this.inputValue
const o = checkedValues.find(item => item.label === value) || {};
return !!o.checked;
},
// checkboxTree
onCheckboxTreeChange(value, checked) {
this.currentHandleType = 'checkboxTree';
this.currentHandleType = 'checkboxTreeCheckbox';
this.currentCheckboxTreeValue = value;
// checkedValues
if (!this.checkboxTreeValue.checkedValues) {
this.checkboxTreeValue.checkedValues = [];
}
// otherValues
if (!this.checkboxTreeValue.otherValues) {
this.checkboxTreeValue.otherValues = {};
}
//
// checkedValues
let checkedItem = this.inputValue.checkedValues.find(item => item.label === value);
if (checked) {
if (!this.checkboxTreeValue.checkedValues.includes(value)) {
this.checkboxTreeValue.checkedValues.push(value);
}
checkedItem.checked = true;
//
this.checkParentIfNeeded(value);
} else {
const index = this.checkboxTreeValue.checkedValues.indexOf(value);
if (index > -1) {
this.checkboxTreeValue.checkedValues.splice(index, 1);
// otherValues
delete this.checkboxTreeValue.otherValues[value];
}
// false
checkedItem.checked = false;
// otherValues
delete this.inputValue.otherValues[value];
}
//
const isFirstCheck = !this.checkboxTreeFirstCheck[value];
if (isFirstCheck) {
this.checkboxTreeFirstCheck[value] = true;
//
this.emitCheckboxTreeValue();
this.updateCheckboxTreeOldValue();
} else {
//
this.onCommonHandleSaveRecord();
this.onCommonHandleSaveRecord();
},
//
checkParentIfNeeded(childValue) {
//
if (this.item && this.item.options) {
for (const group of this.item.options) {
if (group.children && group.children.length > 0) {
// childValuegroupchildren
const childExists = group.children.some(child => child.value === childValue);
if (childExists) {
//
let parentItem = this.inputValue.checkedValues.find(item => item.label === group.value);
if (!parentItem) {
//
parentItem = { label: group.value, checked: true };
this.inputValue.checkedValues.push(parentItem);
} else if (!parentItem.checked) {
//
parentItem.checked = true;
}
break;
}
}
}
}
},
// checkboxTree
onCheckboxTreeOtherBlur(value, e) {
this.currentHandleType = "checkboxTreeOther";
this.currentCheckboxTreeValue = value;
this.checkboxTreeValue.otherValues[value] = e.target.value;
this.inputValue.otherValues[value] = e.target.value;
this.onCommonHandleSaveRecord(e.target.value);
},
// checkboxTree
emitCheckboxTreeValue() {
this.$emit('input', JSON.parse(JSON.stringify(this.checkboxTreeValue)));
this.$emit('change', JSON.parse(JSON.stringify(this.checkboxTreeValue)));
},
// checkboxTree
updateCheckboxTreeOldValue() {
this.oldCheckboxTreeValue = JSON.parse(JSON.stringify(this.checkboxTreeValue));
},
// question
onClickQuestion() {
const { templateFillType } = this;
@ -1022,25 +1026,37 @@ export default {
this.visible = true;
}
},
getCheckboxListInfo(){
const { otherValues,checkboxValues } = this.checkboxListValue;
const { otherValues: oldOtherValues,checkboxValues: oldCheckboxValues } = this.oldCheckboxListValue;
getCheckboxListInfo() {
const { otherValues, checkboxValues } = this.checkboxListValue;
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:"样品信息:"},
"checkboxListValue": { oldValue: oldCheckboxValues, newValue: checkboxValues, des: "" },
"checkboxListOther": { oldValue: oldOtherValues[this.currentOtherCode], newValue: otherValues[this.currentOtherCode], des: "样品信息:" },
}
return o[this.currentHandleType];
},
getFqyqInfo(){
const { mainRadio,inputValue,subRadio } = this.fqyqValue;
const { mainRadio: oldMainRadio,inputValue: oldInputValue,subRadio: oldSubRadio } = this.oldFqyqValue;
const o ={
"mainRadio":{oldValue:oldMainRadio,newValue:mainRadio,des:""},
"inputValue":{oldValue:oldInputValue,newValue:inputValue,des:""},
"subRadio":{oldValue:oldSubRadio,newValue:subRadio,des:"是否在规定时间完成:"}
getFqyqInfo() {
const { mainRadio, inputValue, subRadio } = this.fqyqValue;
const { mainRadio: oldMainRadio, inputValue: oldInputValue, subRadio: oldSubRadio } = this.oldFqyqValue;
const o = {
"mainRadio": { oldValue: oldMainRadio, newValue: mainRadio, des: "" },
"inputValue": { oldValue: oldInputValue, newValue: inputValue, des: "" },
"subRadio": { oldValue: oldSubRadio, newValue: subRadio, des: "是否在规定时间完成:" }
}
return o[this.currentHandleType];
},
getCheckboxTreeInfo() {
const { checkedValues, otherValues } = this.inputValue;
const { checkedValues: oldCheckedValues, otherValues: oldOtherValues } = this.oldValue;
const { currentHandleType, currentCheckboxTreeValue } = this;
const newItem = checkedValues.find(item => item.label === currentCheckboxTreeValue);
const oldItem = oldCheckedValues.find(item => item.label === currentCheckboxTreeValue);
const o = {
"checkboxTreeCheckbox": { oldValue: oldItem, newValue: newItem, des: "" },
"checkboxTreeOther": { oldValue: oldOtherValues[currentCheckboxTreeValue], newValue: otherValues[currentCheckboxTreeValue], des: "样品信息:" },
}
return o[currentHandleType];
},
async onCommonHandleSaveRecord(val) {
const isEmpty = isValueEmpty(this.inputValue);
if (this.error && !isEmpty) {
@ -1084,14 +1100,13 @@ export default {
this.$emit("change", this.inputValue);
return;
}
//
let isSame = true, isOldValueEmpty = true;
const { currentHandleType } = this;
// checkboxListotherValues
if (this.type === 'checkboxList') {
const current = this.getCheckboxListInfo();
isSame = this.isEqual(current.oldValue,current.newValue);
isSame = this.isEqual(current.oldValue, current.newValue);
isOldValueEmpty = isValueEmpty(current.oldValue);
} else if (this.type === "checkboxTag") {
// checkboxTagtagIndex
@ -1101,17 +1116,25 @@ export default {
isOldValueEmpty = isValueEmpty(oldTag.checked);
} else if (this.type === "fqyq") {
const current = this.getFqyqInfo();
isSame = this.isEqual(current.oldValue,current.newValue);
isSame = this.isEqual(current.oldValue, current.newValue);
isOldValueEmpty = isValueEmpty(current.oldValue);
} else if (this.type === "checkboxTree") {
// checkboxTreecheckedValues
isSame = this.isEqual(this.oldCheckboxTreeValue.checkedValues, this.checkboxTreeValue.checkedValues);
isOldValueEmpty = isValueEmpty(this.oldCheckboxTreeValue.checkedValues);
const current = this.getCheckboxTreeInfo();
const { oldValue, newValue } = current;
if (this.currentHandleType === "checkboxTreeCheckbox") {
isSame = this.isEqual(oldValue.checked, newValue.checked);
isOldValueEmpty = isValueEmpty(oldValue.checked);
} else {
isSame = this.isEqual(current.oldValue, current.newValue);
isOldValueEmpty = isValueEmpty(current.oldValue);
}
} else {
isSame = this.isEqual(this.oldValue, this.inputValue)
isOldValueEmpty = isValueEmpty(this.oldValue);
}
console.log(isSame,isOldValueEmpty,this.fqyqValue,this.oldFqyqValue,"isSame")
console.log(isSame, isOldValueEmpty, this.currentCheckboxTreeValue, this.oldValue, this.inputValue, "isSame")
if (isSame) {
return;
}
@ -1147,18 +1170,11 @@ export default {
// 退
this.fqyqValue = JSON.parse(JSON.stringify(this.oldFqyqValue));
oldValue = { ...this.fqyqValue };
} else if (this.type === "checkboxTree") {
// checkboxTree退
this.checkboxTreeValue = JSON.parse(JSON.stringify(this.oldCheckboxTreeValue));
oldValue = JSON.parse(JSON.stringify(this.oldCheckboxTreeValue));
}
this.inputValue = this.oldValue;
this.inputValue = typeof oldValue === 'object' ? JSON.parse(JSON.stringify(oldValue)) : oldValue;
this.$emit('input', oldValue); // v-model
// this.$emit("blur", this.oldValue);
this.$emit("change", oldValue, "cancel");
if (this.item.type === "clickable") {
this.$emit("resetRecord");
}
},
//
@ -1181,22 +1197,27 @@ export default {
isModify = oldTag.checked !== undefined;
} else if (this.type === "fqyq") {
const current = this.getFqyqInfo();
recordOldVlaue = `${current.des+current.oldValue}`;
recordValue = `${current.des+current.newValue}`;
isModify = !!this.oldFqyqValue.mainRadio
}else if(this.type === "checkboxList"){
recordOldVlaue = `${current.des + current.oldValue}`;
recordValue = `${current.des + current.newValue}`;
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;
} else if (this.type === "checkboxTree") {
// checkboxTree
const value = this.currentCheckboxTreeValue;
const oldChecked = this.oldCheckboxTreeValue.checkedValues && this.oldCheckboxTreeValue.checkedValues.includes(value);
const currentChecked = this.checkboxTreeValue.checkedValues && this.checkboxTreeValue.checkedValues.includes(value);
recordOldVlaue = `${value}:${oldChecked ? '勾选' : '未勾选'}`;
recordValue = `${value}:${currentChecked ? '勾选' : '未勾选'}`;
isModify = oldChecked !== undefined;
const current = this.getCheckboxTreeInfo();
if (this.currentHandleType === "checkboxTreeCheckbox") {
const { oldValue, newValue } = current;
recordOldVlaue = `${oldValue.label || ''}:${oldValue.checked ? '勾选' : '未勾选'}`;
recordValue = `${newValue.label || ''}:${newValue.checked ? '勾选' : '未勾选'}`;
isModify = newValue.checked !== undefined;
} else {
recordOldVlaue = current.oldValue;
recordValue = current.newValue;
isModify = !!current.oldValue;
}
}
const record = {
...baseInfo,
@ -1229,9 +1250,6 @@ export default {
} else if (this.type === "fqyq") {
//
this.oldFqyqValue = JSON.parse(JSON.stringify(this.fqyqValue));
} else if (this.type === "checkboxTree") {
// checkboxTree
this.oldCheckboxTreeValue = JSON.parse(JSON.stringify(this.checkboxTreeValue));
}
let value = this.inputValue;
if (this.type === 'checkboxList') {
@ -1243,8 +1261,6 @@ export default {
value = [...this.checkboxTagList];
} else if (this.type === "fqyq") {
value = { ...this.fqyqValue };
} else if (this.type === "checkboxTree") {
value = JSON.parse(JSON.stringify(this.checkboxTreeValue));
}
if (this.type === "button") {
this.$emit('clickButton', this.item, this.inputValue, data);
@ -1253,7 +1269,7 @@ export default {
}
}
//
this.oldValue = value; //
this.oldValue = typeof value === 'object' ? JSON.parse(JSON.stringify(value)) : value; //
this.$emit("blur", value);
this.$emit('input', value);
this.$emit("change", value, data ? "save" : "");
@ -1891,6 +1907,7 @@ export default {
border-color: #f9c588;
}
}
.el-radio__inner {
border-color: #f9c588;
}
@ -1948,28 +1965,39 @@ export default {
}
}
}
.fqyq-input{
.fqyq-input {
width: 500px;
margin-right:10px;
margin-right: 10px;
}
.mb-10{
.mb-10 {
margin-bottom: 10px;
}
.fs-14{
.fs-14 {
font-size: 14px;
}
.mr-10{
.mr-10 {
margin-right: 10px;
}
.checkbox-tree-children{
.checkbox-tree-children {
margin-left: 30px;
padding:16px 0;
padding: 16px 0;
gap: 16px;
display: grid;
grid-template-columns: repeat(4, 1fr);
}
.checkbox-tree-item{
.checkbox-tree-item {
box-sizing: border-box;
display: flex;
align-items: center;
}
.checkbox-tree-input-container{
margin-left: 10px;
width: 500px;
}
</style>

+ 1
- 1
src/components/Template/Step.vue View File

@ -13,7 +13,7 @@
<!-- 根据步骤类型显示对应的表单 -->
<!-- 根据步骤类型显示对应的表单 -->
<component class="flex1" :sn="step.type" :is="getStepComponent(step.type)" :formData="step.formData"
@update="onFormUpdate(index, $event)" :ref="'stepCompRef_' + index">
@update="onFormUpdate(index, $event)" :stepIndex = "index" :ref="'stepCompRef_' + index">
</component>
<div v-if="templateFillType === 'preFill'" class="step-header-item">
<el-popconfirm

+ 6
- 6
src/components/Template/StepFormPackage.vue View File

@ -4,25 +4,25 @@
<div v-for="(sItem, key) in item.config" class="step-item" :key="key">
<template v-if="sItem.type === 'input'">
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" @blur="onBlur(key, $event)"
:item="sItem" v-model="formFields[key]" :field-key="prefixKey + '_' + key"
:item="sItem" v-model="formFields[key]" :field-key="prefixKey+uuid + '_' + key"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
</template>
<template v-else-if="sItem.type === 'inputNumber'">
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+uuid + '_' + key"
type="inputNumber" @blur="onBlur(key, $event)" :item="sItem"
@input="onInputNumberChange(key, $event)" v-model="formFields[key]" @copy="onCopy(sItem, key)"
:error="errors[key]" @update:error="errors[key] = false" :orange-bg="orangeBgFields[key]" />
</template>
<template v-else-if="sItem.type === 'select'">
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+uuid + '_' + key"
type="select" @blur="onBlur(key, $event)" :item="sItem" v-model="formFields[key]"
@change="onSelectChange(key, $event, sItem.type)"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
</template>
<template v-else-if="sItem.type === 'checkbox'">
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+uuid + '_' + key"
type="checkbox" :item="sItem" v-model="formFields[key]"
@change="onSelectChange(key, $event, sItem.type)"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
@ -36,7 +36,7 @@
</template>
<!-- 仪器instrumentsj(药剂) gsp(供试品) mix药剂/供试品/给药制剂 -->
<template v-else-if="isRegent(sItem)">
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
<HandleFormItem class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+uuid + '_' + key"
:type="sItem.type" :error="errors[key]"
@onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)"
@update:error="errors[key] = false" :item="getRegentItem(sItem)"
@ -55,7 +55,7 @@
<div v-show="isShowOther(formFields[key])" class="flex flex1">
<div class="other-title">{{sItem.otherLabel ? $t(sItem.otherLabel) : $t("template.common.other") }}</div>
<HandleFormItem sourceFrom = "step" class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+sItem.otherCode" @blur="onBlur(key, $event)" :item="getOtherItem(sItem)"
<HandleFormItem sourceFrom = "step" class="step-row" :field-item-label="fieldItemLabel" :field-key="prefixKey+uuid+'_'+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]" />

+ 18
- 1
src/utils/index.js View File

@ -441,7 +441,7 @@ export function isValueEmpty(value) {
if (Array.isArray(value) && value.length === 0) {
return true
}
if (Object.keys(value).length === 0) {
if (Object.keys(value).length === 0 && typeof value === 'object') {
return true;
}
return false
@ -584,3 +584,20 @@ export function getStringWidth(str) {
}
return width
}
//根据选项获取默认值,为了
export const getDefaultValueByOptions = (options = []) => {
const arr = [];
options.forEach(item => {
const { children = [], label } = item;
//目前只考虑2层,也不考虑label值重复的问题;
if (children.length > 0) {
children.forEach(child => {
arr.push({ label: child.label, checked: undefined })
})
} else {
arr.push({ label, checked: undefined })
}
})
return arr;
}

+ 0
- 1
src/views/business/comps/template/dialog/SelectMixReagentDialog.vue View File

@ -28,7 +28,6 @@ import SelectDept from "@/views/business/comps/select/SelectDept";
import { public_sjList, public_gyzjList, public_gspList, public_xbList,public_jcbList,public_qxFormFillList } from '@/api/business/public/public';
import { getSjSearchForm, getSjColumns, getGyzjSearchForm, getGyzjColumns, getGspSearchForm, getGspColumns, getXbSearchForm, getXbColumns,getJcbSearchForm,getJcbColumns,getQxbdSearchForm,getQxbdColumns } from '@/views/business/comps/template/formConfig/formConfig.js';
import { EventBus } from "@/utils/eventBus";
console.log(this,"this")
const typeMap = {
'1': {
searchForm: getSjSearchForm(),

Loading…
Cancel
Save