From 3917aa1ec3ba4fd6c4f3da76c70236768fc229ee Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 25 一月 2024 22:14:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue | 954 +++++++++++++++++++++++++++++++---------------------------
1 files changed, 507 insertions(+), 447 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
index e7fe577..e59f156 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
@@ -1,37 +1,38 @@
-<!-- eslint-disable vue/valid-v-for -->
-<!-- eslint-disable vue/require-v-for-key -->
<template>
<div>
<avue-form
- v-model="form"
- :option="option"
- v-loading="loading"
- ref="form"
- :style="{ minHeight: loading ? '300px' : '' }"
:key="updateIndex"
+ ref="form"
+ v-model="form"
+ v-loading="loading"
+ :option="option"
+ :style="{ minHeight: loading ? '300px' : '' }"
>
- <template :slot="item.prop + 'Label'" v-for="item in slotColumnList">
+ <template v-for="item in slotColumnList" :slot="item.prop + 'Label'">
<span>
<span>{{ item.label }} </span>
<el-tooltip
v-if="item.keyAttr"
class="item"
- effect="dark"
content="璇ュ睘鎬т负鍏抽敭灞炴��"
+ effect="dark"
placement="top-start"
>
<i class="el-icon-star-on key_attr_icon"></i>
</el-tooltip>
</span>
</template>
- <template :slot="item.prop + ''" v-for="item in slotColumnList">
+ <template v-for="item in slotColumnList" :slot="item.prop + ''">
<vciWebRefer
- v-if="item.type == 'refer'"
- :referConfig="item.referConfig || {}"
- :value="form[item.referConfig.field] || item.value"
- :text="form[item.referConfig.showField]"
+ v-if="item.type == 'refer'" :key="item.dataKey"
+ referType="master"
+ :data-key="item.dataKey"
:disabled="item.disabled"
:display="item.display"
+ :referConfig="item.referConfig || {}"
+ :reloadData="item.referConfig.reloadData || false"
+ :text="form[item.referConfig.showField]"
+ :value="form[item.referConfig.field] || item.value"
@setReferValue="setReferValue"
></vciWebRefer>
</template>
@@ -40,17 +41,18 @@
</template>
<script>
-import { getFormDetail } from "@/api/formTemplate";
-import { getDictionary } from "../../api/system/dict";
+import {getFormDetail} from "@/api/formTemplate";
+import {getEnumDictionary} from "../../api/system/dict";
import vciWebRefer from "../refer/vciWebRefer.vue";
+
export default {
name: "FormTemplate",
- components: { vciWebRefer },
+ components: {vciWebRefer},
props: {
// 榛樿绂佺敤鍏冪礌
disabledProp: {
type: Array,
- default: () => ["id","lcstatus"],
+ default: () => ["id", "lcstatus"],
},
templateOid: {
type: String,
@@ -59,6 +61,10 @@
codeClassifyOid: {
type: String,
default: "",
+ },
+ LoadingStatus: {
+ type: String,
+ default: "code"
},
// 鍒楄〃鏁版嵁oid
rowOid: {
@@ -80,9 +86,44 @@
type: Object,
default: () => ({}),
},
+ // 涓�琛屾斁鍑犱釜琛ㄥ崟
+ trendsSpan: {
+ type: Number,
+ default: 8,
+ },
+ TreeValue: {
+ type: String,
+ default: "",
+ },
+ eventList: {
+ type: Array
+ },
+ status: {
+ type: String,
+ default: "",
+ },
+ selectRow: {
+ type: Array,
+ default: []
+ }
},
data() {
return {
+ selectValue: "",
+ //骞翠唬鍙�
+ dataYearCode: {
+ type: "",
+ value: ""
+ },
+ filteredObject: {},
+ filteredArray: [],
+ isSeriesType: {},
+ attrList: [],
+ add: '',
+ codeattrsecValue: '',
+ ValidataValue: false,
+ eventFlag: {},
+ TreeValueForm: '',
updateIndex: 0,
form: {},
option: {
@@ -103,407 +144,94 @@
date: "date",
refer: "refer",
},
- // 鍋囨暟鎹�
- testItems: [
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "id",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "浼犲�肩鐢ㄥ姛鑳�",
- tooltips: "",
- type: "combox",
- unique: false,
- verify: "",
- },
- {
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "state",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: true,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "鎺ュ彛绂佺敤鍔熻兘",
- tooltips: "",
- type: "combox",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "oldcode",
- hidden: false,
- keyAttr: false,
- prefix: "el-icon-search",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "鏂囨湰鍚庣紑娴嬭瘯",
- text: "鍓嶅悗缂�鍔熻兘",
- tooltips: "",
- type: "text",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "materialname",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: true,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "姝e垯鏍¢獙鍔熻兘",
- tooltips: "璇疯緭鍏ユ暟瀛�",
- type: "text",
- unique: false,
- verify: /^[0-9]+$/g,
- },
- {
- comboxKey: null,
- customClass: null,
- data: [
- {
- attributes: {},
- key: "model_type",
- value: "妯″瀷",
- },
- {
- attributes: {},
- key: "part_type",
- value: "闆朵欢",
- },
- ],
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "dataSelect",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "鐩存帴杩斿洖涓嬫媺",
- tooltips: "",
- type: "combox",
- unique: false,
- verify: "",
- },
- {
- comboxKey: "formTemplateTest",
- customClass: null,
- data: [],
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "dictSelect",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "瀛楀吀杩斿洖涓嬫媺",
- tooltips: "",
- type: "combox",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "firstfl",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "鏁板瓧杈撳叆妗�",
- tooltips: "",
- type: "number",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "yyyy-MM-dd HH:mm:ss",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "datetime",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "鏃ユ湡鏃堕棿閫夋嫨鍣�",
- tooltips: "",
- type: "datetime",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "time",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "鏃堕棿閫夋嫨鍣�",
- tooltips: "",
- type: "date",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "false",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "xiaoshouwl",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "寮�鍏�",
- tooltips: "",
- type: "truefalse",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "鎴戞槸榛樿鍊�",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "tuhao",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "榛樿鍊煎姛鑳�",
- tooltips: "鎻愮ず",
- type: "text",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "xinghaoguige",
- hidden: false,
- keyAttr: true,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "灞炴�у叧閿��",
- tooltips: "",
- type: "text",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "jiliangdw",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- tip: "鎴戞槸鎻愮ず鍔熻兘",
- required: false,
- selectLibFlag: "",
- showField: "jiliangdwname",
- suffix: "",
- text: "鎻愮ず鍔熻兘",
- tooltips: "",
- type: "text",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "textarea",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "鏂囨湰鍩�",
- tooltips: "",
- type: "textarea",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
- field: "cz",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: true,
- referConfig: {},
- required: false,
- selectLibFlag: "",
- showField: "depId",
- suffix: "",
- text: "鍙傜収",
- tooltips: "",
- type: "refer",
- unique: false,
- verify: "",
- },
- ],
- trendsSpan: 8,
defaultValue: {},
// 琛ㄥ崟灞炴��
attributes: [],
slotColumnList: [],
+ isShow: "",
};
},
mounted() {
this.handleResize();
},
+ updated() {
+ },
+ created() {
+ if (this.LoadingStatus === 'code') {
+ this.loading = false;
+ }
+ },
+ computed: {
+ localTrendsSpan() {
+ if (this.trendsSpan) {
+ return this.trendsSpan;
+ } else {
+ let windowWidth = document.body.clientWidth;
+ return 24 / Math.floor(windowWidth / 500);
+ }
+ },
+
+ },
+ watch: {
+ // 琛ㄥ崟鏁版嵁淇敼鍙嶉鍒扮埗缁勪欢
+ form: {
+ deep: true,
+ immediate: true,
+ handler(newV) {
+ this.$emit("getFormData", newV);
+ },
+ },
+ attrList: {
+ deep: true,
+ immediate: true,
+ handler(newVal, oldVal) {
+ if (newVal) {
+ this.$emit("attrList", newVal)
+ }
+ }
+ },
+ TreeValue: {
+ handler(newval, oldval) {
+ if (newval) {
+ this.TreeValueForm = newval;
+ }
+ },
+ deep: true,
+ immediate: true
+ },
+ isShow: {
+ handler(newV) {
+ this.$emit("isShow", newV)
+ }
+ },
+ dataYearCode: {
+ deep: true,
+ immediate: true,
+ handler(newV) {
+ this.$emit("dataYearCode", newV)
+ }
+ },
+ selectRow: {
+ handler(newval) {
+ // console.log(newval);
+ let ids = newval.map(item => item.id);
+ this.selectValue = ids.join(",");
+ },
+ deep: true,
+ immediate: true
+ }
+ },
methods: {
// 娓叉煋琛ㄥ崟妯℃澘
- templateRender(formItemList) {
+ templateRender(formItemList, TreeValue) {
+ if (this.eventList) {
+ this.eventFlag = this.eventList.some(item => {
+ if (item.classifyInvokeEditFlag === 'true') {
+ this.eventObject = item;
+ return true;
+ }
+ });
+ }
// 鏃犻渶鍒嗙粍鏁版嵁
let column = [];
let group = [];
@@ -511,6 +239,16 @@
let slotColumnList = [];
formItemList.forEach((formItem) => {
formItem = this.resetFormConfig(formItem);
+ //灞炴�х爜娈佃鍒�
+ if (formItem.secType === "codeattrsec") {
+ this.attrList.push(formItem);
+ }
+ //鏇存敼鏂瑰紡
+ if (formItem.field === "codeStandardEditType") {
+ if (this.status === "amend") {
+ formItem.readOnly = true;
+ }
+ }
if (formItem.type === "line") {
group.push({
label: formItem.text,
@@ -520,20 +258,22 @@
});
return;
}
+
if (
formItem.type === "combox" &&
formItem.comboxKey &&
- (!Array.isArray(formItem.dicData) || formItem.dicData.length === 0) &&(!Array.isArray(formItem.data) || formItem.data.length === 0)
+ (!Array.isArray(formItem.dicData) || formItem.dicData.length === 0) &&
+ (!Array.isArray(formItem.data) || formItem.data.length === 0)
) {
- dictKeys.push({ dictKey: formItem.comboxKey, field: formItem.field });
+ dictKeys.push({dictKey: formItem.comboxKey, field: formItem.field});
}
// 绂佺敤閮ㄥ垎灞炴�э紙澶栭儴浼犲�肩鐢ㄥ拰鍙傜収绂佺敤锛�
if (this.disabledProp.includes(formItem.field)) {
formItem.readOnly = true;
}
- if(formItem.field=='lcstatus'){
- formItem.field=formItem.field+'_text';
- formItem.readOnly=true;
+ if (formItem.field == "lcstatus") {
+ formItem.field = formItem.field + "_text";
+ formItem.readOnly = true;
}
// 璁剧疆琛ㄥ崟鏍¢獙鐨勮鍒欙紝鏂囨湰
let message = "璇烽�夋嫨";
@@ -542,7 +282,39 @@
message = "璇疯緭鍏�";
trigger = "blur";
}
+ let fieldMapKey = ''
+ if (formItem.type == "refer" && !formItem.fieldMap) {
+ fieldMapKey = formItem.field + 'Id'
+ formItem.fieldMap = {}
+ formItem.fieldMap[fieldMapKey] = 'id'
+ formItem.fieldMap[formItem.field + 'id'] = 'id'
+ }
+
let columnItem = {
+ change: (val) => {
+ if (val.column.field === "drawingno") {
+ this.codeattrsecValue = val.value;
+ return;
+ }
+ //淇涓�-绯诲垪鍙�
+ if (val.column.field === "reviseSeries") {
+ if (val.value === "false") {
+ this.isShow = true;
+ } else {
+ this.isShow = false;
+ }
+ }
+ if (val.column.field === "releaseDate") {
+ if (val.value) {
+ this.dataYearCode.type = val.column.valueFormat;
+ this.dataYearCode.value = val.value;
+ } else {
+ this.dataYearCode.type = "";
+ this.dataYearCode.value = "";
+ }
+ }
+ },
+ dataKey: formItem.dataKey || formItem.field,
label: formItem.text,
labelslot: true,
prop: this.$utilFunc.isValuableObj(formItem.referConfig)
@@ -551,15 +323,21 @@
field: formItem.field,
type: this.columnType[formItem.type],
dicData: this.getDataList(formItem.type, formItem.data),
- disabled: this.type === "detail" ? true : formItem.readOnly,
+ disabled: this.type === "detail" ? true : formItem.readOnly || (formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ? true : false) ||
+ ((formItem.name === "绯诲垪鍙�" && this.status && (formItem.field === "reviseSeries" && formItem.value == 'false') ? true : false)),
prepend: this.preOrSufFixShow("text", formItem.prefix),
append: this.preOrSufFixShow("text", formItem.suffix),
prefixIcon: this.preOrSufFixShow("icon", formItem.prefix),
suffixIcon: this.preOrSufFixShow("icon", formItem.suffix),
- valueFormat: formItem.dateFormate,
+ valueFormat: formItem.dateFormate || "yyyy-MM-dd HH:mm:ss",
format: formItem.dateFormate,
keyAttr: formItem.keyAttr,
- value: formItem.defaultValue,
+ value: formItem.defaultValue || (formItem.dicData && formItem.dicData.length > 0 && formItem.secType == "codefixedsec" ? formItem.dicData[0].id : null) ||
+ (formItem.secType == "codedatesec" ? formItem.codeDateValue : null) || (TreeValue && formItem.secType == "codelevelsec" ? TreeValue : null) ||
+ (formItem.secType == "codeattrsec" ? this.add : null) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null) ||
+ (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null) ||
+ //鐖剁粍浠跺鏋滄槸鍙傜収鏁版嵁浼氬皢selectRow缃┖,selectRow涓嶄负绌哄氨璇存槑涓嶆槸鍙傜収瑕佸洖濉簮鏍囧噯鍙锋暟鎹�
+ (this.status === "amend" ? (this.selectRow && (formItem.field === "oldcode" ? this.selectValue : null)) : null),
placeholder: formItem.inputTip,
comboxKey: formItem.comboxKey,
tip: formItem.tooltips,
@@ -569,18 +347,23 @@
referConfig:
formItem.type == "refer"
? {
- title: formItem.text,
- showField: formItem.showField || formItem.field,
- field: formItem.field,
- placeholder: formItem.inputTip,
- options: formItem.referConfig,
- }
+ title: formItem.text,
+ showField: formItem.showField || formItem.field,
+ field: formItem.field,
+ fieldMap: formItem.fieldMap || {},
+ placeholder: formItem.inputTip,
+ options: formItem.referConfig
+ }
: {},
- span: formItem.span ? formItem.span : formItem.type === "textarea" ? 24 : this.trendsSpan,
+ span: formItem.span
+ ? formItem.span
+ : formItem.type === "textarea"
+ ? 24
+ : this.localTrendsSpan,
rules: [
{
required: formItem.required,
- message: `璇�${message}${formItem.text}`,
+ message: `${message}${formItem.text}`,
trigger,
},
{
@@ -595,6 +378,7 @@
value: "key",
},
};
+ this.filteredObject = columnItem
slotColumnList.push(columnItem);
if (group.length === 0) {
column.push(columnItem);
@@ -602,6 +386,7 @@
group[group.length - 1]["column"].push(columnItem);
}
});
+
this.slotColumnList = slotColumnList;
this.$set(this.option, "column", column);
this.$set(this.option, "group", group);
@@ -612,6 +397,246 @@
this.geDictData(dictKeys);
this.getFormDetail();
+ },
+ //淇敼绾ц仈椤�
+ changeChildItem(items, TreeValue, type) {
+ type = type || "add";
+ let column = this.option.column;
+ let group = this.option.group;
+ // let column = [];
+ // let group = [];
+ let that = this;
+ items.forEach((item) => {
+ let formItem = this.resetFormConfig(item);
+ if (formItem.field == "lcstatus") {
+ formItem.field = formItem.field + "_text";
+ formItem.readOnly = true;
+ }
+ // 璁剧疆琛ㄥ崟鏍¢獙鐨勮鍒欙紝鏂囨湰
+ let message = "璇烽�夋嫨";
+ let trigger = "change";
+ if (formItem.type === "text") {
+ message = "璇疯緭鍏�";
+ trigger = "blur";
+ }
+ let fieldMapKey = ''
+ if (formItem.type == "refer" && !formItem.fieldMap) {
+ fieldMapKey = formItem.field + 'Id'
+ formItem.fieldMap = {}
+ formItem.fieldMap[fieldMapKey] = 'id'
+ formItem.fieldMap[formItem.field + 'id'] = 'id'
+ }
+ let columnItem = {
+ label: formItem.text,
+ labelslot: true,
+ prop: this.$utilFunc.isValuableObj(formItem.referConfig)
+ ? formItem.showField || formItem.field
+ : formItem.field,
+ field: formItem.field,
+ type: this.columnType[formItem.type],
+ dicData: this.getDataList(formItem.type, formItem.data),
+ disabled: this.type === "detail" ? true : formItem.readOnly || (formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ? true : false) ||
+ (this.status ? (formItem.field === "reviseSeries" ? (formItem.value == 'false' ? true : false) : false) : false),
+ prepend: this.preOrSufFixShow("text", formItem.prefix),
+ append: this.preOrSufFixShow("text", formItem.suffix),
+ prefixIcon: this.preOrSufFixShow("icon", formItem.prefix),
+ suffixIcon: this.preOrSufFixShow("icon", formItem.suffix),
+ valueFormat: formItem.dateFormate || "yyyy-MM-dd HH:mm:ss",
+ format: formItem.dateFormate,
+ keyAttr: formItem.keyAttr,
+ value: formItem.defaultValue || (formItem.dicData && formItem.dicData.length > 0 && formItem.secType == "codefixedsec" ? formItem.dicData[0].id : null) ||
+ (formItem.secType == "codedatesec" ? formItem.codeDateValue : null) || (TreeValue && formItem.secType == "codelevelsec" ? TreeValue : null) ||
+ (formItem.secType == "codeattrsec" ? this.add : null) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null) ||
+ (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null) ||
+ //鐖剁粍浠跺鏋滄槸鍙傜収鏁版嵁浼氬皢selectRow缃┖,selectRow涓嶄负绌哄氨璇存槑涓嶆槸鍙傜収瑕佸洖濉簮鏍囧噯鍙锋暟鎹�
+ (this.status === "amend" ? (this.selectRow && (formItem.field === "oldcode" ? this.selectValue : null)) : null),
+ placeholder: formItem.inputTip,
+ comboxKey: formItem.comboxKey,
+ tip: formItem.tooltips,
+ display: !formItem.hidden,
+ maxlength: formItem.maxlength,
+ filterable: true,
+ referConfig:
+ formItem.type == "refer"
+ ? {
+ title: formItem.text,
+ showField: formItem.showField || formItem.field,
+ field: formItem.field,
+ fieldMap: formItem.fieldMap || {},
+ placeholder: formItem.inputTip,
+ options: formItem.referConfig
+ }
+ : {},
+ span: formItem.span
+ ? formItem.span
+ : formItem.type === "textarea"
+ ? 24
+ : this.localTrendsSpan,
+ rules: [
+ {
+ required: formItem.required,
+ message: `${message}${formItem.text}`,
+ trigger,
+ },
+ {
+ // 濡傛灉娌℃湁姝e垯鍒欏尮閰嶄换浣曞瓧绗�
+ pattern: formItem.verify ? formItem.verify : /[\s\S.]*/g,
+ message: formItem.tooltips,
+ trigger,
+ },
+ ],
+ props: {
+ label: "value",
+ value: "key",
+ },
+ };
+ if (group.length === 0) {
+ that.slotColumnList.forEach((colItem, index) => {
+ if (colItem.field == columnItem.field) {
+ that.slotColumnList[index] = columnItem;
+ column[index] = columnItem;
+ return;
+ }
+ })
+ } else {
+ that.slotColumnList.forEach((colItem, index) => {
+ if (colItem.field == columnItem.field) {
+ that.slotColumnList[index] = columnItem;
+ return;
+ }
+ })
+ group.forEach((groupItem, index) => {
+ groupItem.column.forEach((colItem, colIndex) => {
+ if (colItem.field == columnItem.field) {
+ group[index].column[colIndex] = columnItem;
+ return;
+ }
+ })
+ });
+ }
+ });
+ that.$set(that.option, "column", column);
+ that.$set(that.option, "group", group);
+ },
+ //鏍囧噯-淇
+ changeStatusItem(items, TreeValue, type) {
+ type = type || "add";
+ // let column = this.option.column;
+ // let group = this.option.group;
+ let column = [];
+ let group = [];
+ let that = this;
+ items.forEach((item) => {
+ let formItem = this.resetFormConfig(item);
+ if (formItem.field == "lcstatus") {
+ formItem.field = formItem.field + "_text";
+ formItem.readOnly = true;
+ }
+ // 璁剧疆琛ㄥ崟鏍¢獙鐨勮鍒欙紝鏂囨湰
+ let message = "璇烽�夋嫨";
+ let trigger = "change";
+ if (formItem.type === "text") {
+ message = "璇疯緭鍏�";
+ trigger = "blur";
+ }
+ let fieldMapKey = ''
+ if (formItem.type == "refer" && !formItem.fieldMap) {
+ fieldMapKey = formItem.field + 'Id'
+ formItem.fieldMap = {}
+ formItem.fieldMap[fieldMapKey] = 'id'
+ formItem.fieldMap[formItem.field + 'id'] = 'id'
+ }
+ let columnItem = {
+ label: formItem.text,
+ labelslot: true,
+ prop: this.$utilFunc.isValuableObj(formItem.referConfig)
+ ? formItem.showField || formItem.field
+ : formItem.field,
+ field: formItem.field,
+ type: this.columnType[formItem.type],
+ dicData: this.getDataList(formItem.type, formItem.data),
+ disabled: this.type === "detail" ? true : formItem.readOnly || (formItem.codeValueApplyStatus && formItem.codeValueApplyStatus == 2 ? true : false) ||
+ (this.status ? (formItem.field === "reviseSeries" ? (formItem.value == 'false' ? true : false) : false) : false),
+ prepend: this.preOrSufFixShow("text", formItem.prefix),
+ append: this.preOrSufFixShow("text", formItem.suffix),
+ prefixIcon: this.preOrSufFixShow("icon", formItem.prefix),
+ suffixIcon: this.preOrSufFixShow("icon", formItem.suffix),
+ valueFormat: formItem.dateFormate || "yyyy-MM-dd HH:mm:ss",
+ format: formItem.dateFormate,
+ keyAttr: formItem.keyAttr,
+ value: formItem.defaultValue || (formItem.dicData && formItem.dicData.length > 0 && formItem.secType == "codefixedsec" ? formItem.dicData[0].id : null) ||
+ (formItem.secType == "codedatesec" ? formItem.codeDateValue : null) || (TreeValue && formItem.secType == "codelevelsec" ? TreeValue : null) ||
+ (formItem.secType == "codeattrsec" ? this.add : null) || (this.status === "apply" && formItem.field === "codeStandardEditType" ? "1" : null) ||
+ (this.status === "amend" && formItem.field === "codeStandardEditType" ? "2" : null) ||
+ //鐖剁粍浠跺鏋滄槸鍙傜収鏁版嵁浼氬皢selectRow缃┖,selectRow涓嶄负绌哄氨璇存槑涓嶆槸鍙傜収瑕佸洖濉簮鏍囧噯鍙锋暟鎹�
+ (this.status === "amend" ? (this.selectRow && (formItem.field === "oldcode" ? this.selectValue : null)) : null),
+ placeholder: formItem.inputTip,
+ comboxKey: formItem.comboxKey,
+ tip: formItem.tooltips,
+ display: !formItem.hidden,
+ maxlength: formItem.maxlength,
+ filterable: true,
+ referConfig:
+ formItem.type == "refer"
+ ? {
+ title: formItem.text,
+ showField: formItem.showField || formItem.field,
+ field: formItem.field,
+ fieldMap: formItem.fieldMap || {},
+ placeholder: formItem.inputTip,
+ options: formItem.referConfig
+ }
+ : {},
+ span: formItem.span
+ ? formItem.span
+ : formItem.type === "textarea"
+ ? 24
+ : this.localTrendsSpan,
+ rules: [
+ {
+ required: formItem.required,
+ message: `${message}${formItem.text}`,
+ trigger,
+ },
+ {
+ // 濡傛灉娌℃湁姝e垯鍒欏尮閰嶄换浣曞瓧绗�
+ pattern: formItem.verify ? formItem.verify : /[\s\S.]*/g,
+ message: formItem.tooltips,
+ trigger,
+ },
+ ],
+ props: {
+ label: "value",
+ value: "key",
+ },
+ };
+ if (group.length === 0) {
+ that.slotColumnList.forEach((colItem, index) => {
+ if (colItem.field == columnItem.field) {
+ that.slotColumnList[index] = columnItem;
+ column[index] = columnItem;
+ return;
+ }
+ })
+ } else {
+ that.slotColumnList.forEach((colItem, index) => {
+ if (colItem.field == columnItem.field) {
+ that.slotColumnList[index] = columnItem;
+ return;
+ }
+ })
+ group.forEach((groupItem, index) => {
+ groupItem.column.forEach((colItem, colIndex) => {
+ if (colItem.field == columnItem.field) {
+ group[index].column[colIndex] = columnItem;
+ return;
+ }
+ })
+ });
+ }
+ });
+ that.$set(that.option, "column", column);
+ that.$set(that.option, "group", group);
},
// 浣跨敤浼犲叆鐨勮〃鍗曟暟鎹厤缃�
resetFormConfig(formItem) {
@@ -630,6 +655,7 @@
if (Object.hasOwnProperty.call(element, newAttr)) {
const oldAttr = element[newAttr];
formItem[newAttr] = formItem[oldAttr];
+
}
}
} else if (configType === "directVoluation") {
@@ -646,9 +672,9 @@
},
// 鏍规嵁灞忓箷鍔ㄦ�侀厤缃〃鍗曞竷灞�
handleResize() {
- let windowWidth = document.body.clientWidth;
- this.trendsSpan = 24 / Math.floor(windowWidth / 500);
- this.updateIndex++;
+ // let windowWidth = document.body.clientWidth;
+ // this.trendsSpan = 24 / Math.floor(windowWidth / 500);
+ // this.updateIndex++;
},
// 鍓嶅悗缂�
preOrSufFixShow(type, val) {
@@ -679,13 +705,13 @@
// 寮傛鑾峰彇瀛楀吀鏁版嵁
geDictData(dictKeys) {
dictKeys.forEach((dictObj) => {
- getDictionary({ code: dictObj.dictKey }).then((res) => {
+ getEnumDictionary({code: dictObj.dictKey}).then((res) => {
if (res.data && res.data.code === 200) {
this.option.column = this.option.column.map((item) => {
if (item.field === dictObj.field) {
let dictData = (res.data.data || []).map((itm) => {
- itm.value = itm.dictValue;
- itm.key = itm.dictKey;
+ itm.value = itm.itemName;
+ itm.key = itm.itemValue;
return itm;
});
item.dicData = dictData;
@@ -703,6 +729,7 @@
if (valid) {
done();
resolve(true);
+ this.ValidataValue = true;
} else {
resolve(false);
}
@@ -712,30 +739,63 @@
// 鑾峰彇琛ㄥ崟璇︽儏鏁版嵁
getFormDetail() {
if (this.type === "add") return;
- getFormDetail({ templateOid: this.templateOid, oid: this.rowOid }).then(
- (res) => {
- this.form = Object.assign(this.form, res.data.data[0]);
- this.loading = false;
- }
- );
+ if (this.templateOid) {
+ getFormDetail({templateOid: this.templateOid, oid: this.rowOid}).then(
+ (res) => {
+ this.form = Object.assign(this.form, res.data.data[0]);
+ this.loading = false;
+ }
+ );
+ return;
+ }
+
},
setReferValue(data) {
if (data.field) {
this.form[data.field] = data.value || "";
this.form[data.showField] = data.text || "";
- this.$emit("getFormData", this.form);
+ if (data.fieldMap) {
+ //璇存槑闇�瑕佹槧灏�
+ for (let key in data.fieldMap) {
+ let mapFields = data.fieldMap[key].split(",");
+ let value = [];
+ data.rawData.forEach(_item => {
+ var temp;
+ if (!_item.attributes) {
+ _item.attributes = _item;
+ }
+ if (!_item.attributes.data) {
+ _item.attributes.data = {};
+ }
+ if (mapFields.length == 1) {
+ var mapField = mapFields[0];
+ if (mapField.indexOf("attribute.") > -1) {
+ temp = _item['attributes'][mapField.subString("attribute.".length)] || _item['attributes']['data'][mapField.subString("attribute.".length)];
+ } else {
+ temp = _item['attributes'][mapField] || _item['attributes']['data'][mapField] || _item[mapField];
+ }
+ } else {
+ //鏈夊涓�
+ var mutiTemp = [];
+ layui.each(mapFields, function (_indexField, _itemField) {
+ if (_itemField.indexOf("attribute.") > -1) {
+ mutiTemp.push(_item['attributes'][_itemField.subString("attribute.".length)] || _item['attributes']['data'][_itemField.subString("attribute.".length)]);
+ } else {
+ mutiTemp.push(_item['attributes'][_itemField] || _item['attributes']['data'][_itemField] || _item[_itemField]);
+ }
+ });
+ temp = mutiTemp.join(' ');
+ }
+ if (temp != null && temp != '') {
+ value.push(temp);
+ }
+ })
+ this.form[key] = value.join(',');
+ }
+ }
this.$emit("referConfigDataUpdate", data);
+ this.$emit("getFormData", this.form);
}
- },
- },
- watch: {
- // 琛ㄥ崟鏁版嵁淇敼鍙嶉鍒扮埗缁勪欢
- form: {
- deep: true,
- immediate: true,
- handler(newV) {
- this.$emit("getFormData", newV);
- },
},
},
};
--
Gitblit v1.9.3