From 4ead3f1a8571b3536daedbd4a0268aebdfb86517 Mon Sep 17 00:00:00 2001
From: yuxc <653031404@qq.com>
Date: 星期三, 31 五月 2023 10:31:14 +0800
Subject: [PATCH] 1、对MDM服务的Feign进行改动
---
Source/UBCS-WEB/src/components/FormTemplate/index.vue | 182 ++++++++++++++++++++-------------------------
1 files changed, 81 insertions(+), 101 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
index 9c3b592..38a9f73 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
@@ -3,10 +3,11 @@
:visible.sync="dialogVisible"
v-dialogDrag
top="0vh"
- title="鎻愮ず"
+ :title="title"
class="avue-dialog avue-dialog--top"
:width="dialogOptions.width"
append-to-body
+ v-if="dialogVisible"
>
<avue-form
v-model="form"
@@ -16,48 +17,49 @@
:key="index"
>
<template :slot="item.prop + 'Label'" v-for="item in option.column">
- <span>{{ item.label }} </span>
- <el-tooltip
- v-if="item.keyAttr"
- class="item"
- effect="dark"
- content="璇ュ睘鎬т负鍏抽敭灞炴��"
- placement="top-start"
- >
- <i class="el-icon-star-on key_attr_icon"></i>
- </el-tooltip>
- <el-tooltip
- v-if="item.tip"
- class="item"
- effect="dark"
- :content="item.tip"
- placement="top-start"
- >
- <i class="el-icon-warning"></i>
- </el-tooltip>
+ <span>
+ <span>{{ item.label }} </span>
+ <el-tooltip
+ v-if="item.keyAttr"
+ class="item"
+ effect="dark"
+ content="璇ュ睘鎬т负鍏抽敭灞炴��"
+ placement="top-start"
+ >
+ <i class="el-icon-star-on key_attr_icon"></i>
+ </el-tooltip>
+ <el-tooltip
+ v-if="item.tip"
+ class="item"
+ effect="dark"
+ :content="item.tip"
+ placement="top-start"
+ >
+ <i class="el-icon-warning"></i>
+ </el-tooltip>
+ </span>
+ </template>
+ <template :slot="item.prop + ''" v-for="item in option.column">
+ <vciWebRefer v-if="item.type=='refer'" :options="item.originalItem"></vciWebRefer>
</template>
</avue-form>
- <div class="avue-dialog__footer">
+ <FindLike ref="findLike"></FindLike>
+ <div class="avue-dialog__footer" v-if="type !== 'detail'">
<el-button @click="close()">鍙� 娑�</el-button>
- <el-button @click="close()" type="primary">纭� 瀹�</el-button>
+ <el-button @click="close()" type="primary" :loading="submitBtnLoading">纭� 瀹�</el-button>
+ <el-button @click="findLinkSubmit" type="primary">鐩镐技鍍忔煡璇�</el-button>
</div>
- <el-dialog title="娴嬭瘯鍙傜収" :visible.sync="visible2" append-to-body>
- <div style="height: 100px;">
- <p>閮ㄩ棬鏁版嵁 {depName: '鎴戞槸閮ㄩ棬鍚嶇О', depId: '鎴戞槸閮ㄩ棬id'}</p>
- </div>
- <div class="avue-dialog__footer">
- <el-button @click="visible2 = false">鍙� 娑�</el-button>
- <el-button @click="czSubmit" type="primary">纭� 瀹�</el-button>
- </div>
- </el-dialog>
</el-dialog>
</template>
<script>
-import { getFormTemplate } from "../../api/common";
+import { getFormTemplate, executeCode, findLike } from "@/api/formTemplate";
import { getDictionary } from "../../api/system/dict";
+import FindLike from "./FindLike.vue";
+import vciWebRefer from "../refer/vciWebRefer.vue";
export default {
name: "FormTemplate",
+ components: { FindLike ,vciWebRefer},
props: {
visible: {
type: Boolean,
@@ -67,6 +69,22 @@
type: Array,
default: () => ["id"],
},
+ templateOid: {
+ type: String,
+ default: "",
+ },
+ codeClassifyOid: {
+ type: String,
+ default: "",
+ },
+ type: {
+ type: String,
+ default: 'add'
+ },
+ title: {
+ type: String,
+ default: '琛ㄥ崟妯℃澘'
+ }
},
data() {
return {
@@ -91,7 +109,7 @@
textarea: "textarea",
datetime: "datetime",
date: "date",
- file: "upload",
+ refer:'refer'
},
// 鍋囨暟鎹�
testItems: [
@@ -537,31 +555,6 @@
displayExtension: null,
extendAttrMap: null,
extendAttrString: null,
- field: "beizhushuoming",
- hidden: false,
- keyAttr: false,
- prefix: "",
- readOnly: false,
- referConfig: null,
- required: false,
- selectLibFlag: "",
- showField: null,
- suffix: "",
- text: "鏂囦欢鍔熻兘",
- tooltips: "",
- type: "file",
- unique: false,
- verify: "",
- },
- {
- comboxKey: null,
- customClass: null,
- data: null,
- dateFormate: "",
- defaultValue: "",
- displayExtension: null,
- extendAttrMap: null,
- extendAttrString: null,
field: "cz",
hidden: false,
keyAttr: false,
@@ -579,11 +572,10 @@
verify: "",
},
],
- visible2: false,
+ submitBtnLoading: false
};
},
- created() {
- },
+ created() {},
computed: {
dialogVisible: {
get() {
@@ -598,10 +590,8 @@
getFormTemplate() {
this.loading = true;
getFormTemplate({
- templateOid: "78B8C7C5-A042-0B96-FE6D-65421451782A",
- codeClassifyOid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96",
- page: 1,
- limit: 30,
+ templateOid: this.templateOid,
+ codeClassifyOid: this.codeClassifyOid,
})
.then((res) => {
if (res.status === 200) {
@@ -617,8 +607,7 @@
});
},
templateRender() {
- // const items = this.templateData.formDefineVO.items;
- const items = this.testItems;
+ const items = this.templateData.formDefineVO.items;
let column = [];
let dictKeys = [];
items.forEach((item) => {
@@ -626,12 +615,15 @@
if (item.hide) {
return;
}
- // 鎵嬫満瀛楀吀key缁熶竴寮傛璇锋眰鑾峰彇
- if (!this.$utilFunc.isEmpty(item.comboxKey)) {
+ if (
+ item.type === "combox" &&
+ item.comboxKey &&
+ (!Array.isArray(item.dicData) || item.dicData.length === 0)
+ ) {
dictKeys.push({ dictKey: item.comboxKey, field: item.field });
}
- // 绂佺敤閮ㄥ垎灞炴��
- if (this.disabledProp.includes(item.field)) {
+ // 绂佺敤閮ㄥ垎灞炴�э紙澶栭儴浼犲�肩鐢ㄥ拰鍙傜収绂佺敤锛�
+ if (this.disabledProp.includes(item.field) || this.$utilFunc.isValuableObj(item.referConfig)) {
item.readOnly = true;
}
// 璁剧疆琛ㄥ崟鏍¢獙鐨勮鍒欙紝鏂囨湰
@@ -646,10 +638,10 @@
let columnItem = {
label: item.text,
labelslot: true,
- prop: item.referConfig ? item.showField : item.field,
+ prop: this.$utilFunc.isValuableObj(item.referConfig) ? (item.showField || item.field) : item.field,
type: this.columnType[item.type],
dicData: this.getDataList(item.type, item.data),
- disabled: item.readOnly,
+ disabled: this.type === 'detail' ? true : item.readOnly,
prepend: this.preOrSufFixShow("text", item.prefix),
append: this.preOrSufFixShow("text", item.suffix),
prefixIcon: this.preOrSufFixShow("icon", item.prefix),
@@ -660,18 +652,12 @@
value: item.defaultValue,
tip: item.tip,
comboxKey: item.comboxKey,
- change: ({ value, column }) => {
- this.changeFun(value, column, item.displayExtension);
+ originalItem:item,
+ change: () => {
+ this.changeFun(item.displayExtension, item.prop);
},
+ span: item.type === "file" || item.type === "textarea" ? 24 : null,
click: this.clickFun(item.referConfig),
- // action:
- // item.type === "file"
- // ? "/api/ubcs-resource/oss/endpoint/put-file"
- // : "",
- // propsHttp: {
- // res: "data",
- // url: "link",
- // },
rules: [
{
required: item.required,
@@ -696,28 +682,16 @@
this.index++;
this.geDictData(dictKeys);
},
- changeFun(value, column, jsCode) {
- if (typeof jsCode === "string" && jsCode.length > 0) {
- eval(jsCode);
- }
+ changeFun(displayExtension, prop) {
+ // executeCode({displayExtension, data: this.form}).then(res => {
+ // this.form[prop] = res.data.data
+ // })
},
clickFun(referConfig) {
- if (referConfig) {
- return () => {
- this.visible2 = true
- }
+ if (this.type === 'detail') {
+ return
}
},
- czSubmit() {
- this.visible2 = false
- this.form = Object.assign(this.form, {
- depName: "鎴戞槸閮ㄩ棬鍚嶇О",
- depId: "鎴戞槸閮ㄩ棬id",
- });
- },
- close() {
- this.dialogVisible = false;
- },
// 鍓嶅悗缂�
preOrSufFixShow(type, val) {
if (this.$utilFunc.isEmpty(val) && typeof val !== "string") return;
@@ -764,11 +738,17 @@
});
});
},
+ findLinkSubmit() {
+ this.templateData.templateVO.data = this.form
+ console.log(this.$refs.findLike, 'this.$refs.findLike');
+ this.$refs.findLike.findLinkClick(this.templateData.templateVO)
+ }
},
watch: {
visible(newV) {
if (newV) {
this.getFormTemplate();
+ // this.templateRender()
}
},
},
--
Gitblit v1.10.0