From 495da50c21fa91b3bd0d37d2ed158a0ba0d79335 Mon Sep 17 00:00:00 2001
From: 康东 <98470202+kangdong59@users.noreply.github.com>
Date: 星期一, 26 六月 2023 11:12:18 +0800
Subject: [PATCH] 业务类型Feign模糊查询
---
Source/UBCS-WEB/src/components/FormTemplate/index.vue | 213 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 186 insertions(+), 27 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/FormTemplate/index.vue b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
index a5e99a0..f37041e 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/index.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/index.vue
@@ -3,9 +3,8 @@
:visible.sync="dialogVisible"
v-if="dialogVisible"
v-dialogDrag
- top="0vh"
+ top="5vh"
:title="title"
- class="avue-dialog avue-dialog--top"
:width="width"
append-to-body
@opened="openDialog"
@@ -25,7 +24,8 @@
v-if="
type !== 'detail' &&
dialogVisible &&
- (showCodeApply || showResembleQuery)
+ (showCodeApply || showResembleQuery) &&
+ type !== 'preview'
"
>
<el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
@@ -36,7 +36,8 @@
:selfColumnType="selfColumnType"
:selfColumnConfig="selfColumnConfig"
ref="CodeApply"
- @getFormData="getFormData"
+ @getFormData="getCodeApplyFormData"
+ @referConfigDataUpdate="referConfigDataUpdate"
></FormTempalte>
</el-tab-pane>
<el-tab-pane
@@ -56,18 +57,25 @@
</el-tab-pane>
</el-tabs>
</div>
- <div class="avue-dialog__footer" v-if="type !== 'detail'">
- <el-button @click="close()">鍙� 娑�</el-button>
- <el-button @click="submit()" type="primary" :loading="submitBtnLoading"
- >纭� 瀹�</el-button
- >
- <el-button
- @click="resembleQuerySubmit"
- type="primary"
- v-if="showResembleQuery"
- >鐩镐技鍍忔煡璇�</el-button
- >
- </div>
+ <template #footer>
+ <div class="" v-if="type !== 'detail'">
+ <el-button @click="close()" size="small">鍙� 娑�</el-button>
+ <el-button
+ @click="submit()"
+ type="primary"
+ :loading="submitBtnLoading"
+ size="small"
+ >{{ submitText }}</el-button
+ >
+ <el-button
+ @click="resembleQuerySubmit"
+ type="primary"
+ size="small"
+ v-if="showResembleQuery"
+ >鐩镐技鍍忔煡璇�</el-button
+ >
+ </div>
+ </template>
</el-dialog>
</template>
@@ -104,6 +112,10 @@
type: String,
default: "",
},
+ submitText: {
+ type: String,
+ default: "纭� 瀹�",
+ },
},
data() {
return {
@@ -113,6 +125,7 @@
resembleTableColumn: [],
secVOList: [],
form: {},
+ codeApplyForm: {},
activeName: "codeApply",
showCodeApply: true,
showResembleQuery: true,
@@ -127,6 +140,8 @@
required: this.isRequired,
dicData: this.getOptionList,
type: this.getType,
+ referConfig: this.getReferConfig,
+ readOnly: this.getDisabled,
},
exchange: {
text: "name",
@@ -146,6 +161,38 @@
},
},
},
+ defaultKeys: [
+ "oid",
+ "id",
+ "name",
+ "description",
+ "revisionoid",
+ "nameoid",
+ "btmname",
+ "lastr",
+ "firstr",
+ "lastv",
+ "firstv",
+ "creator",
+ "createtime",
+ "lastModifier",
+ "lastmodifytime",
+ "revisionrule",
+ "revisionseq",
+ "revisionvalue",
+ "versionrule",
+ "versionseq",
+ "versionvalue",
+ "lcstatus",
+ "ts",
+ "owner",
+ "checkinby",
+ "checkintime",
+ "checkoutby",
+ "checkouttime",
+ "copyfromversion",
+ "secretgrade",
+ ],
};
},
created() {},
@@ -162,7 +209,7 @@
methods: {
openDialog() {
this.getFormTemplate();
- if (this.type === 'add') {
+ if (this.type === "add") {
this.getCodeRule();
}
},
@@ -183,20 +230,20 @@
res.data.resembleTableVO.cols.length > 0;
this.resembleTableColumn = res.data.resembleTableVO.cols || [];
if (this.hasResemble) {
- this.activeName = 'resembleQuery'
- this.showResembleQuery = true
+ this.activeName = "resembleQuery";
+ this.showResembleQuery = true;
}
this.$refs.FormTempalte.templateRender(res.data.formDefineVO.items);
}
})
.catch((err) => {
this.loading = false;
- console.log(err);
});
},
// 鑾峰彇鐮佸�肩敵璇锋暟鎹�
getCodeRule() {
getCodeRule({ codeClassifyOid: this.codeClassifyOid }).then((res) => {
+ console.log(res, "resresresresres");
if (res.data && res.data.code === 200) {
const typeList = [
"codefixedsec",
@@ -205,15 +252,16 @@
"coderefersec",
];
this.secVOList = (res.data.data.secVOList || []).filter((item) =>
- typeList.includes(item)
+ typeList.includes(item.secType)
);
+ console.log(this.secVOList, "this.secVOListthis.secVOList");
this.$nextTick(() => {
- if (this.secVOList.length > 0 && this.type === 'add') {
- this.showCodeApply = true
- this.activeName = 'codeApply'
+ if (this.secVOList.length > 0 && this.type === "add") {
+ this.showCodeApply = true;
+ this.activeName = "codeApply";
this.$refs.CodeApply.templateRender(this.secVOList);
} else {
- this.showCodeApply = false
+ this.showCodeApply = false;
}
});
}
@@ -222,6 +270,21 @@
getFormData(form) {
this.form = form;
},
+ getCodeApplyFormData(codeApplyForm) {
+ this.codeApplyForm = codeApplyForm;
+ },
+ // 鍙傜収缁勪欢鏁版嵁鍙樻洿
+ referConfigDataUpdate(data) {
+ const { field } = data;
+ this.secVOList = this.secVOList.map((item) => {
+ if (item.parentClassifySecOid === field) {
+ this.$refs.CodeApply.form[item.oid] = undefined;
+ this.$refs.CodeApply.form[item.name] = undefined;
+ }
+ return item;
+ });
+ this.$refs.CodeApply.templateRender(this.secVOList);
+ },
resembleQuerySubmit() {
this.activeName = "resembleQuery";
this.$refs.resembleQueryRef.resembleQuery(this.form);
@@ -238,7 +301,8 @@
let codeValidate = true;
// 杩涜鐮佸�肩敵璇锋牎楠�
if (this.showCodeApply) {
- codeValidate = await this.$refs.codeApply.validate();
+ codeValidate = await this.$refs.CodeApply.validate();
+ console.log(9999);
if (!codeValidate) return;
}
// 杩涜鐩镐技椤规煡璇�
@@ -246,7 +310,22 @@
this.form
);
if (resembleQueryList.length === 0) {
- this.$emit("submit", this.form);
+ let resForm = {};
+ const { defaultValue, formValue } = this.getDefaultValueAndFormValues(
+ this.form
+ );
+ resForm.data = formValue;
+ resForm = Object.assign({}, resForm, defaultValue);
+ resForm.secDTOList = [];
+ for (const key in this.codeApplyForm) {
+ if (Object.hasOwnProperty.call(this.codeApplyForm, key)) {
+ const value = this.codeApplyForm[key];
+ if (value) {
+ resForm.secDTOList.push({ [key]: value });
+ }
+ }
+ }
+ this.$emit("submit", resForm);
} else {
this.$confirm(
`璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋,
@@ -263,9 +342,89 @@
.catch(() => {});
}
},
+ getDefaultValueAndFormValues(form) {
+ let defaultValue = {};
+ let formValue = {};
+ for (const key in form) {
+ if (Object.hasOwnProperty.call(form, key)) {
+ const element = form[key];
+ if (this.defaultKeys.includes(key)) {
+ defaultValue[key] = element;
+ } else {
+ formValue[key] = element;
+ }
+ }
+ }
+ return {
+ defaultValue,
+ formValue,
+ };
+ },
getType(item) {
return this.selfColumnType[item.sectype];
},
+ getReferConfig(item) {
+ let params = {};
+ if (item.sectype == "codeclassifysec") {
+ params = {
+ isMuti: false,
+ type: "grid",
+ tableConfig: {
+ limit: -1,
+ cols: [
+ {
+ field: "id",
+ title: "鑻辨枃鍚嶇О",
+ sort: true,
+ width: 150,
+ },
+ {
+ field: "name",
+ title: "涓枃鍚嶇О",
+ sort: true,
+ width: 150,
+ },
+ {
+ field: "description",
+ title: "鎻忚堪",
+ width: 250,
+ },
+ ],
+ queryColumns: [
+ {
+ field: "id",
+ title: "鑻辨枃鍚嶇О",
+ },
+ {
+ field: "name",
+ title: "涓枃鍚嶇О",
+ },
+ ],
+ },
+ url: "api/ubcs-code/ubcs-code/mdmEngineController/listCodeClassifyValueBySecOid",
+ extraParams: {
+ classifySecOid: item.oid,
+ parentClassifyValueOid: item.parentClassifySecOid
+ ? this.codeApplyForm[item.parentClassifySecOid]
+ : "",
+ },
+ };
+ } else if (item.sectype == "coderefersec") {
+ params = JSON.parse(item.referValueInfo);
+ }
+ return params;
+ },
+ getDisabled(item) {
+ if (item.sectype === "codeclassifysec") {
+ if (item.parentClassifySecOid) {
+ if (!this.codeApplyForm[item.parentClassifySecOid]) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+ },
isRequired(item) {
return item.nullableFlag != "true";
},
--
Gitblit v1.10.0