From 650e413caddf7d14d6929f8f287d5f443660cb7a Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期一, 16 十月 2023 15:14:52 +0800
Subject: [PATCH] 编码申请测试表单回显和码值保存
---
Source/UBCS-WEB/src/views/code/Match.vue | 12 ++
Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue | 8 +
Source/UBCS-WEB/src/views/code/codeApply.vue | 165 ++++++++++++++++++++++++++++++++++++++++-
Source/UBCS-WEB/src/api/code/codeApply.js | 12 ++
4 files changed, 189 insertions(+), 8 deletions(-)
diff --git a/Source/UBCS-WEB/src/api/code/codeApply.js b/Source/UBCS-WEB/src/api/code/codeApply.js
index f51069c..6e9bc1a 100644
--- a/Source/UBCS-WEB/src/api/code/codeApply.js
+++ b/Source/UBCS-WEB/src/api/code/codeApply.js
@@ -13,11 +13,12 @@
//缂栫爜鐢宠鎺т欢
export const getUsedTemplateByClassifyOid = (params) => {
return request({
- url: '/api/ubcs-code/codeApplySwingController/getUsedTemplateByClassifyOid',
+ url: '/api/ubcs-code/codeApplySwingController/getFormDefineByTemplateOid',
method: 'get',
params
})
}
+//鐮佸��
export function getCodeRule(params) {
return request({
url: 'api/ubcs-code/mdmEngineController/getCodeRuleByClassifyOid',
@@ -25,3 +26,12 @@
params
})
}
+
+//淇濆瓨
+export function addSaveCode(data) {
+ return request({
+ url: 'api/ubcs-code/mdmEngineController/addSaveCode',
+ method: 'post',
+ data
+ })
+}
diff --git a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
index 2f3f08b..c2181d5 100644
--- a/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
+++ b/Source/UBCS-WEB/src/components/FormTemplate/FormTemplate.vue
@@ -62,6 +62,10 @@
type: String,
default: "",
},
+ LoadingStatus:{
+ type: String,
+ default : "code"
+ },
// 鍒楄〃鏁版嵁oid
rowOid: {
type: String,
@@ -129,7 +133,9 @@
this.handleResize();
},
created() {
-
+ if (this.LoadingStatus === 'code') {
+ this.loading = false;
+ }
},
computed: {
localTrendsSpan() {
diff --git a/Source/UBCS-WEB/src/views/code/Match.vue b/Source/UBCS-WEB/src/views/code/Match.vue
index 3c2ade7..9a98bd2 100644
--- a/Source/UBCS-WEB/src/views/code/Match.vue
+++ b/Source/UBCS-WEB/src/views/code/Match.vue
@@ -216,8 +216,16 @@
searchHandler() {
this.findvisible = true;
},
- echoContion(row) {
-
+ echoContion(val) {
+ console.log(...val)
+ // FindData({
+ // templateOid: this.templateOid,
+ // codeClassifyOid: this.codeClassifyOid,
+ // ...val,
+ // }).then((res) => {
+ // this.tableData = res.data.data;
+ // this.page.total = res.data.total
+ // });
},
deleteHandler() {
const length = this.selectRow.length;
diff --git a/Source/UBCS-WEB/src/views/code/codeApply.vue b/Source/UBCS-WEB/src/views/code/codeApply.vue
index 0475372..c9df49d 100644
--- a/Source/UBCS-WEB/src/views/code/codeApply.vue
+++ b/Source/UBCS-WEB/src/views/code/codeApply.vue
@@ -18,6 +18,7 @@
key="masterForm" data-key="masterForm"
v-bind="$attrs"
:type="type"
+ :LoadingStatus="status"
:TreeValue="TreeValue"
:eventList="eventList"
ref="FormTemplate"
@@ -35,8 +36,15 @@
@getFormData="getCodeApplyFormData"
@referConfigDataUpdate="referConfigDataUpdate"
></FormTemplate>
+ <el-button
+ @click="submit()"
+ type="primary"
+ size="small"
+ style="float: right"
+ >淇濆瓨</el-button>
</el-tab-pane>
</el-tabs>
+
</div>
</basic-container>
</el-col>
@@ -44,15 +52,48 @@
</template>
<script>
-import {getAuthTree,getUsedTemplateByClassifyOid,getCodeRule} from '@/api/code/codeApply.js'
+import {getAuthTree,getUsedTemplateByClassifyOid,getCodeRule,addSaveCode} from '@/api/code/codeApply.js'
export default {
name: "codeApply",
components: { FormTemplate: () => import('@/components/FormTemplate/FormTemplate') },
data() {
return {
+ 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",
+ ],
codeClassifyOid:'',
type:'add',
+ status:'code',
TreeValue:'',
dialogVisible:true,
setForm:{},
@@ -61,6 +102,8 @@
activeName: "codeApply",
showCodeApply: false,
eventList:[],
+ showResembleQuery:false,
+ hasResemble:false,
form: {},
TreeData:[],
TreeOption: {
@@ -110,6 +153,106 @@
this.getTreeData()
},
methods:{
+ async submit() {
+ // 杩涜琛ㄥ崟鏍¢獙
+ const formValidate = await this.$refs.FormTemplate.validate();
+ if (!formValidate) return;
+ let codeValidate = true;
+ // 杩涜鐮佸�肩敵璇锋牎楠�
+ // if (this.showCodeApply) {
+ // codeValidate = await this.$refs.CodeApply.validate();
+ // if (!codeValidate) {
+ // this.activeName = "codeApply";
+ // return false;
+ // }
+ // }
+ let resembleQueryList = [];
+ if (this.showResembleQuery && this.$refs.resembleQueryRef) {
+ // 杩涜鐩镐技椤规煡璇�
+ resembleQueryList = await this.$refs.resembleQueryRef.resembleQuery(
+ this.form
+ );
+ }
+ if (resembleQueryList.length > 0) {
+ await this.$confirm(
+ `璇ョ墿鏂欏凡鏈�${resembleQueryList.length}鏉$浉浼兼暟鎹紝鏄惁缁х画淇濆瓨锛焋,
+ "闇�瑕佹偍纭",
+ {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }
+ );
+ }
+ // 鎺掗櫎涓�浜涘瓧娈�
+ const noData = [
+ "jiliangdwname",
+ "materialtypeText",
+ "morengongysname",
+ "$caigouwl",
+ "$xiaoshouwl",
+ "$shifoupihaoguanli",
+ "lcstatus_text",
+ "hesuanfenleiname",
+ "$kucunwl",
+ "oldcode",
+ "lastmodifier"
+ ];
+ let resForm = {};
+ const { defaultValue, formValue } = this.getDefaultValueAndFormValues(
+ this.form
+ );
+ noData.forEach((item) => {
+ this.$delete(formValue, item);
+ });
+ const keys = Object.keys(formValue);
+ keys.forEach((item, index) => {
+ keys.forEach((itm, idx) => {
+ if ((item === ('$' + itm)) && idx !== index) {
+ this.$delete(formValue, keys[index]);
+ }
+ })
+ });
+
+ resForm.data = formValue;
+ resForm = Object.assign({}, resForm, defaultValue);
+ resForm.secDTOList = this.secVOList.map((item) => {
+ return {
+ secOid: item.oid,
+ secValue: this.codeApplyForm[item.oid],
+ };
+ });
+ resForm.codeClassifyOid = this.codeClassifyOid;
+ resForm.codeRuleOid = this.codeRuleOid;
+ resForm.templateOid = this.templateOid;
+ // this.$emit("submit", resForm);
+ addSaveCode(resForm).then(res => {
+ this.$nextTick(() => {
+ this.addvisible = false;
+ this.$message.success("淇濆瓨鎴愬姛");
+ this.onLoad()
+ })
+ })
+ console.log(resForm)
+ },
+ 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,
+ };
+ },
getFormData(form) {
this.form = form;
},
@@ -139,14 +282,28 @@
});
},
nodeClick(row){
- // console.log(row)
+ console.log(row)
this.TreeValue=row.text.split(" ")[0].trim();
this.codeClassifyOid = row.oid;
getUsedTemplateByClassifyOid({ 'codeClassifyOid': this.codeClassifyOid,templateOid:' 97e979919a1f1dca67290e85fee22688' }).then((res) => {
console.log('===res',res)
- if (res.data.code === 200) {
+ if (res.status === 200) {
+ this.hasResemble =
+ res.data.resembleTableVO &&
+ res.data.resembleTableVO.cols &&
+ res.data.resembleTableVO.cols.length > 0;
+ this.resembleTableColumn = res.data.resembleTableVO.cols || [];
+ if (this.hasResemble) {
+ this.activeName = "resembleQuery";
+ this.showResembleQuery = true;
+ } else {
+ this.showResembleQuery = false;
+ }
this.$nextTick(() => {
- this.eventList=res.data.data.attributes
+ this.$refs.FormTemplate.templateRender(
+ res.data.formDefineVO.items
+ );
+ this.eventList=res.data.templateVO.attributes
// this.$refs.FormTemplate.$emit('eventList', res.data.templateVO.attributes);
if (Object.keys(this.setForm).length > 0) {
this.$refs.FormTemplate.form = this.setForm;
--
Gitblit v1.9.3