From bd8c4d0191879275492ab70798b9be267dc9f5b8 Mon Sep 17 00:00:00 2001
From: lihang <lihang@vci-tech.com>
Date: 星期五, 12 五月 2023 17:00:53 +0800
Subject: [PATCH] 业务类型新增按钮

---
 Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue |  212 +++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 191 insertions(+), 21 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
index 5a75644..c56390b 100644
--- a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
+++ b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
@@ -4,47 +4,84 @@
     :visible.sync="showSubmitDialog"
     append-to-body
     @close="closeSubmitDialog"
-    width="70%"
+    width="74%"
     >
         <el-form ref="form" :model="btmType" show-message="true" inline>
             <el-form-item label="鑻辨枃鍚嶇О:" label-width="100px">
-                <el-input v-model="btmType.id" prefix-icon="el-icon-finished"></el-input>
+                <el-input v-model="btmType.id" :prefix-icon="icons.key"></el-input>
             </el-form-item>
             <el-form-item label="涓枃鍚嶇О:" label-width="100px">
-                <el-input v-model="btmType.name" prefix-icon="el-icon-info"></el-input>
+                <el-input v-model="btmType.name" :prefix-icon="icons.name"></el-input>
             </el-form-item>
             <el-form-item label="鏁版嵁搴撹〃鍚�:" label-width="100px">
-                <el-input v-model="btmType.tableName" prefix-icon="el-icon-date"></el-input>
+                <el-input v-model="btmType.tableName" :prefix-icon="icons.tableName"></el-input>
             </el-form-item>
             <el-form-item label="鎵�灞為鍩�:" label-width="100px">
-                <el-select v-model="btmType.domain" prefix-icon="el-icon-folder-opened">
+                <el-select v-model="btmType.domain" :prefix-icon="icons.domain">
                     <el-option v-for="item in domainOption"
                     :label="item"></el-option>
                 </el-select>
             </el-form-item>
             <el-form-item label="鐗堟湰瑙勫垯:" label-width="100px">
-                <el-input v-model="btmType.revisionRuleId" prefix-icon="el-icon-s-check"></el-input>
+                <el-input v-model="btmType.revisionRuleId" :prefix-icon="icons.revisionRule">
+                    <i slot="suffix" class="el-input__icon el-icon-search"></i>
+                </el-input>
             </el-form-item>
             <el-form-item label="鐢熷懡鍛ㄦ湡:" label-width="100px">
-                <el-input v-model="btmType.lifeCycleId" prefix-icon="el-icon-refresh-right"></el-input>
+                <el-input v-model="btmType.lifeCycleId" :prefix-icon="icons.lifeCycle">
+                    <i slot="suffix" class="el-input__icon el-icon-search"></i>
+                </el-input>
             </el-form-item>
             <el-form-item label="瑙嗗浘:" label-width="100px">
-                <el-input v-model="btmType.view" prefix-icon="el-icon-view"></el-input>
+                <el-input v-model="btmType.view" :prefix-icon="icons.view"></el-input>
             </el-form-item>
             <el-form-item label="鎻忚堪:" label-width="100px">
                 <el-input v-model="btmType.description" 
-                prefix-icon="el-icon-chat-line-square" 
-                style="width:254%;"></el-input>
+                :prefix-icon="icons.desc" 
+                ></el-input>
             </el-form-item>
         </el-form>
-        <avue-crud :option="option" :data="btmType.attributes"></avue-crud>
+        <avue-crud :option="option" :data="btmType.attributes" :page.sync="page" ref="attrTable">
+            <template slot-scope="scope" slot="menuLeft">
+                <el-button type="danger"
+                icon="el-icon-plus"
+                size="small"
+                @click="rowAdd()">灞炴�ч�夋嫨</el-button>
+            </template>
+            
+        </avue-crud>
+        <el-button @click="submitBtmType">纭畾</el-button>
+            <el-button @click="cancleSubmitBtmType">鍙栨秷</el-button>
+
+
+        <el-dialog title="灞炴�ф睜"
+            :visible="attrRef.visible"
+            append-to-body
+            @close="closeAttrDialog"
+            width="80%"
+        >
+            <avue-crud class="attrRef" 
+            :option="attrRef.option" 
+            :data="attrRef.data" 
+            :page.sync="attrRef.page"
+            ref="attrRef"
+            @on-load="attrRefOnLoad"
+            @selection-change="selectionChange">
+                <template slot="name" slot-scope="scope" >
+                    <el-tag>{{scope}}</el-tag>
+                </template>
+            </avue-crud>
+            <el-button @click="confirmSelectAttr">纭畾</el-button>
+            <el-button @click="cancleSelectAttr">鍙栨秷</el-button>
+        </el-dialog>
     </el-dialog>
 </template>
 
 
 <script>
-import { } from '@/api/omd/btmType';
-import { } from '@/api/omd/OmdAttribute';
+
+import {  } from '@/api/omd/btmType';
+import { getPage } from '@/api/omd/OmdAttribute';
 export default {
     name: 'BusinessAdd',
     props: {
@@ -53,19 +90,28 @@
         },
         domainOption:{
             type: Array
+        },
+        icons: {
+            type: Array
         }
     },
     data() {
         return {
             form: {},
             showSubmitDialog : false,
+            page: {
+                currentPage: 1,
+                pageSize:10
+            },
             option: {
                 height: "330px",
-                selection: true,
                 headerAlign: 'center',
                 border: true,
                 index: true,
-                rowKey: 'id',
+                rowKey: 'oid',
+                addBtn: false,
+                refreshBtn: false,
+                columnBtn:false,
                 tabs: true,
                 menu: false,
                 highlightCurrentRow: true,
@@ -73,7 +119,7 @@
                     {
                         label: '灞炴�ц嫳鏂囧悕绉�',
                         prop: 'id',
-                        align: 'center'
+                        align: 'left'
                     }, {
                         label: '灞炴�т腑鏂囧悕绉�',
                         prop: 'name',
@@ -81,7 +127,53 @@
                     },
                     {
                         label: "灞炴�х被鍨�",
-                        prop: "attrDataType",
+                        prop: "typeValue",
+                        align: 'center',
+                        slot: true
+                    },
+                    {
+                        label: "榛樿鍊�",
+                        prop: "defaultValue",
+                        cell: 'true',
+                        align: 'center'
+                    },
+                    {
+                        label: "璇存槑",
+                        prop: "description",
+                        cell: 'true',
+                        align: 'center'
+                    }
+                ]
+            },
+            attrRef:{
+                visible:false,
+                page: {
+                    currentPage:1,
+                    pageSize:10,
+                    key:''
+                },
+                option:{
+                    height: 360,
+                    addBtn: false,
+                    refreshBtn: false,
+                    columnBtn: false,
+                    selection: true,
+                    menu: false,
+                    border: true,
+                    column: [
+                        {
+                        label: '灞炴�ц嫳鏂囧悕绉�',
+                        prop: 'key',
+                        align: 'left',
+                        width: 230
+                    }, {
+                        label: '灞炴�т腑鏂囧悕绉�',
+                        prop: 'label',
+                        align: 'center'
+                    },
+                    {
+                        label: "灞炴�х被鍨�",
+                        prop: "typeValue",
                         align: 'center'
                     },
                     {
@@ -90,23 +182,101 @@
                         align: 'center'
                     },
                     {
+                        label: '鍏佽涓虹┖',
+                        prop: 'nullable',
+                        type: 'switch',
+                        display: false,
+                        hide: true,
+                        labelWidth: 132,
+                        dicData: [{
+                        label: '鍚�',
+                        value: 1
+                        }, {
+                        label: '鏄�',
+                        value: 0
+                        }]
+                    },
+                    {
                         label: "璇存槑",
                         prop: "description",
                         align: 'center'
                     }
-                ]
-            },
+                    ]
+                },
+                data: [],
+                queryNotIn: []
+            }
         }
     },
     created() {
-        console.log('123');
+
     },
     methods: {
         closeSubmitDialog(){
             this.showSubmitDialog = false;
+            this.btmType = {};
+        },
+        closeAttrDialog(){
+            this.attrRef.visible = false;
+        },
+        rowAdd(){
+            this.attrRef.visible = true;
+            this.$refs.attrRef.refreshTable();
+            this.attrRefOnLoad();
+       
+        },
+        attrRefOnLoad(){
+            var str = '';
+            this.attrRef.queryNotIn.forEach(item => {
+                str = str + item + ','
+            });
+            getPage(this.attrRef.page.currentPage, this.attrRef.page.pageSize,{'condition["key_like"]':this.attrRef.page.key}).then(res => {
+                const data = res.data.data;
+                this.attrRef.page.total = data.total;
+                this.attrRef.data = data.records;
+            })
+        },
+        selectionChange(list){
+            this.attrRef.selectData = list;
+        },
+        confirmSelectAttr(){
+            this.btmType.attributes = [];
+            this.attrRef.selectData.forEach(item => {
+                this.btmType.attributes.push({
+                    id: item.key,
+                    name: item.label,
+                    typeValue: item.typeValue,
+                    defaultValue: item.defaultValue,
+                    description: item.description
+                });
+                this.attrRef.queryNotIn.push(item.key);
+            });
+            this.closeAttrDialog();
+        },
+        cancleSelectAttr(){
+            this.attrRef.selectData = [];
+            this.closeAttrDialog();
+        },
+        submitBtmType(){
+            // 娣诲姞瀹屾垚锛屽洖璋冪埗缁勪欢鐨勫埛鏂�
+            console.log(this.btmType);
+            this.$emit('refreshTable');
+        },
+        cancleSubmitBtmType(){
+            this.btmType = {};
+            this.btmType.attributes = [];
+            console.log(this.btmType);
+        },
+        refreshAttrTable(){
+            this.$refs.attrTable.refreshTable();
         }
     }
 }
 </script>
 
-<style></style>
\ No newline at end of file
+<style>
+/* 灞炴�ф睜鍙傜収鍒楄〃 */
+.attrRef > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu{
+        display: none !important;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3