2 Commits

4 changed files with 76 additions and 5 deletions
Unified View
  1. +57
    -4
      src/components/Template/HandleFormItem.vue
  2. +14
    -1
      src/views/business/comps/template/comps/gsp/GSP015.vue
  3. +1
    -0
      src/views/business/comps/template/comps/sp/SP0021.vue
  4. +4
    -0
      src/views/business/comps/template/formConfig/gsp/gsp015.js

+ 57
- 4
src/components/Template/HandleFormItem.vue View File

@ -72,13 +72,20 @@
</div> </div>
<div v-else-if="type === 'radioTree'" class="flex1 radio-tree-container" <div v-else-if="type === 'radioTree'" class="flex1 radio-tree-container"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '') + (error ? ' form-error-border' : '') + (item.noBorder ? ' no-border' : '') + (item.layout === 'horizontal' ? ' flex' : '')"> :class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '') + (error ? ' form-error-border' : '') + (item.noBorder ? ' no-border' : '') + (item.layout === 'horizontal' ? ' flex' : '')">
<el-radio-group v-model="inputValue" :disabled="getDisabled()" @change="onRadioTreeChange">
<el-radio-group v-model="inputValue.checkedValues" :disabled="getDisabled()" @input="onRadioTreeChange">
<div v-for="option in item.options" :key="option.value" class="radio-tree-item"> <div v-for="option in item.options" :key="option.value" class="radio-tree-item">
<el-radio :label="option.value"> <el-radio :label="option.value">
{{ option.label }} {{ option.label }}
</el-radio> </el-radio>
<div v-if="isShowOtherByCheckboxTree(option.value) && inputValue.checkedValues === option.value"
class="checkbox-tree-input-container">
<el-input maxlength="100" v-model="inputValue.otherValues[option.value]"
:disabled="getDisabled()" placeholder="请输入"
@blur="onCheckboxTreeOtherBlur(option.value, $event)" />
</div>
</div> </div>
</el-radio-group> </el-radio-group>
</div> </div>
<el-date-picker v-else-if="type === 'dateTime' || type === 'datePicker'" <el-date-picker v-else-if="type === 'dateTime' || type === 'datePicker'"
:type="type === 'dateTime' ? 'datetime' : 'date'" class="flex1" :type="type === 'dateTime' ? 'datetime' : 'date'" class="flex1"
@ -305,9 +312,11 @@ export default {
})); }));
} else if (this.type === 'fqyq' && !this.value) { } else if (this.type === 'fqyq' && !this.value) {
initialValue = { mainRadio: '', subRadio: '', inputValue: "" }; initialValue = { mainRadio: '', subRadio: '', inputValue: "" };
} else if (this.type === 'checkboxTree' && !this.value) {
} else if ((this.type === 'checkboxTree') && !this.value) {
const defaultCheckedValue = getDefaultValueByOptions(this.item.options || []); const defaultCheckedValue = getDefaultValueByOptions(this.item.options || []);
initialValue = { checkedValues: defaultCheckedValue, otherValues: {} }; initialValue = { checkedValues: defaultCheckedValue, otherValues: {} };
} else if ((this.type === 'radioTree') && !this.value) {
initialValue = { checkedValues: "", otherValues: {} };
} }
const { type } = this; const { type } = this;
return { return {
@ -748,7 +757,7 @@ export default {
}, },
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","radioTree"]
const typeObj = { const typeObj = {
actFill: "orange-border",// actFill: "orange-border",//
blxjsh: "orange-border",// blxjsh: "orange-border",//
@ -863,7 +872,9 @@ export default {
this.onCommonHandleSaveRecord(this.inputValue); this.onCommonHandleSaveRecord(this.inputValue);
}, },
onRadioTreeChange(val) { onRadioTreeChange(val) {
this.inputValue = val;
this.inputValue.checkedValues = val;
this.currentHandleType = 'checkboxTreeCheckbox';
this.currentCheckboxTreeValue = val;
this.onCommonHandleSaveRecord(this.inputValue); this.onCommonHandleSaveRecord(this.inputValue);
}, },
// //
@ -1126,6 +1137,16 @@ export default {
} }
return o[currentHandleType]; return o[currentHandleType];
}, },
getRadioTreeInfo() {
const { checkedValues, otherValues } = this.inputValue;
const { checkedValues: oldCheckedValues, otherValues: oldOtherValues } = this.oldValue;
const { currentHandleType, currentCheckboxTreeValue } = this;
const o = {
"checkboxTreeCheckbox": { oldValue: oldCheckedValues, newValue: checkedValues, des: "" },
"checkboxTreeOther": { oldValue: oldOtherValues[currentCheckboxTreeValue], newValue: otherValues[currentCheckboxTreeValue], des: `${currentCheckboxTreeValue}`, key: this.fieldKey + "_" + checkedValues },
}
return o[currentHandleType];
},
async onCommonHandleSaveRecord(val) { async onCommonHandleSaveRecord(val) {
const isEmpty = isValueEmpty(this.inputValue); const isEmpty = isValueEmpty(this.inputValue);
if (this.error && !isEmpty) { if (this.error && !isEmpty) {
@ -1197,6 +1218,17 @@ export default {
isOldValueEmpty = this.isUnSubmitted(current.key); isOldValueEmpty = this.isUnSubmitted(current.key);
} }
} else if(this.type === "radioTree"){
const current = this.getRadioTreeInfo();
const { oldValue = {}, newValue = {} } = current;
if (this.currentHandleType === "checkboxTreeCheckbox") {
isSame = isEqual(oldValue, newValue);
console.log(oldValue,newValue,oldValue !== newValue,"newValue")
isOldValueEmpty = oldValue === newValue;
} else {
isSame = isEqual(current.oldValue, current.newValue);
isOldValueEmpty = this.isUnSubmitted(current.key);
}
} else if (this.type === "checkbox") { } else if (this.type === "checkbox") {
isSame = isEqual(this.oldValue, this.inputValue) isSame = isEqual(this.oldValue, this.inputValue)
@ -1221,6 +1253,7 @@ export default {
// //
isUnSubmitted(key) { isUnSubmitted(key) {
const finallyKey = key || this.fieldKey; const finallyKey = key || this.fieldKey;
console.log(this.getSubmittedCodes(),finallyKey,"finallyKey")
const has = this.getSubmittedCodes().includes(finallyKey) const has = this.getSubmittedCodes().includes(finallyKey)
return !has; return !has;
}, },
@ -1289,10 +1322,23 @@ export default {
recordOldVlaue = `${oldValue?.label || ''}:${oldValue?.checked ? '勾选' : '未勾选'}`; recordOldVlaue = `${oldValue?.label || ''}:${oldValue?.checked ? '勾选' : '未勾选'}`;
recordValue = `${newValue.label || ''}:${newValue.checked ? '勾选' : '未勾选'}`; recordValue = `${newValue.label || ''}:${newValue.checked ? '勾选' : '未勾选'}`;
isModify = newValue.checked !== undefined; isModify = newValue.checked !== undefined;
} else {
recordOldVlaue = `${current.des + (current.oldValue || '')}`;
recordValue = `${current.des + (current.newValue || '')}`;
finallyKey = current.key; finallyKey = current.key;
isModify = !!current.oldValue;
}
} else if (this.type === "radioTree") {
const current = this.getRadioTreeInfo();
if (this.currentHandleType === "checkboxTreeCheckbox") {
const { oldValue = {}, newValue = {} } = current;
recordOldVlaue = `${oldValue || ''}`;
recordValue = `${newValue || ''}`;
isModify = newValue !== oldValue;
} else { } else {
recordOldVlaue = `${current.des + (current.oldValue || '')}`; recordOldVlaue = `${current.des + (current.oldValue || '')}`;
recordValue = `${current.des + (current.newValue || '')}`; recordValue = `${current.des + (current.newValue || '')}`;
finallyKey = current.key;
isModify = !!current.oldValue; isModify = !!current.oldValue;
} }
} else if (this.type === "checkbox") { } else if (this.type === "checkbox") {
@ -2120,4 +2166,11 @@ export default {
.record-row{ .record-row{
text-align: left; text-align: left;
} }
.radio-tree-item{
display: flex;
align-items: center;
&:not(:last-child) {
margin-bottom: 10px;
}
}
</style> </style>

+ 14
- 1
src/views/business/comps/template/comps/gsp/GSP015.vue View File

@ -222,9 +222,19 @@ export default {
}; };
}, },
mounted() { mounted() {
if (this.fillType === "actFill") {
setTimeout(() => {
this.handleUpdateCode();
}, 0);
}
}, },
methods: { methods: {
handleUpdateCode(){
const refs = ["jyTableRef"]
const {ecDataList = [],ybsmDataList= []} = this.fromData;
console.log(this.formData,"fff")
},
//blog //blog
async handleBeforeDownload({ html2pdf, options, pdfContent }) { async handleBeforeDownload({ html2pdf, options, pdfContent }) {
this.$modal.loading() this.$modal.loading()
@ -431,6 +441,7 @@ export default {
deleteConfig(item, type = "ybsmDataList") { deleteConfig(item, type = "ybsmDataList") {
if (this.formData[type].length > 1) { if (this.formData[type].length > 1) {
const configIndex = this.formData[type].findIndex(config => config.id === item.id); const configIndex = this.formData[type].findIndex(config => config.id === item.id);
console.log(configIndex,item,"configIndex")
if (configIndex > -1) { if (configIndex > -1) {
const newList = [...this.formData[type]] const newList = [...this.formData[type]]
newList.splice(configIndex, 1); newList.splice(configIndex, 1);
@ -478,6 +489,7 @@ export default {
...ybsmTableData, ...ybsmTableData,
jyStepTableFormData: jyTableData.stepTableFormData, jyStepTableFormData: jyTableData.stepTableFormData,
jyHeaderSelectFields: jyTableData.headerSelectFields, jyHeaderSelectFields: jyTableData.headerSelectFields,
id: item.id,
}; };
}); });
const eData = ecDataList.map((item, index) => { const eData = ecDataList.map((item, index) => {
@ -486,6 +498,7 @@ export default {
return { return {
...ecFormData, ...ecFormData,
...ecTableData, ...ecTableData,
id: item.id,
}; };
}); });
return { return {

+ 1
- 0
src/views/business/comps/template/comps/sp/SP0021.vue View File

@ -124,6 +124,7 @@ export default {
}, },
methods: { methods: {
// //
deleteConfig(item) { deleteConfig(item) {
// ybsmDataList // ybsmDataList
if (this.formData.ybsmDataList.length > 1) { if (this.formData.ybsmDataList.length > 1) {

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

@ -118,6 +118,8 @@ export const getQyTableColumns = ($this) => {
width: 200, width: 200,
bodyType: 'input', bodyType: 'input',
bodyFillType: 'preFill', bodyFillType: 'preFill',
subBodyType:"span",
subBodyKey: "qybhCode",
}, },
{ {
label: '制剂编号', label: '制剂编号',
@ -209,6 +211,8 @@ export const getJyTableColumns = ($this) => {
width: 200, width: 200,
bodyType: 'input', bodyType: 'input',
bodyFillType: 'preFill', bodyFillType: 'preFill',
subBodyType:"span",
subBodyKey: "jybhCode",
}, },
{ {
label: '取样编号', label: '取样编号',

Loading…
Cancel
Save