From 41021633bfee5b5c9c57cb888423f3392c530f98 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期一, 25 三月 2024 18:31:08 +0800
Subject: [PATCH] 业务类型bug修改,集成接口,远程部署等功能修改。

---
 Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue | 1117 +++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 862 insertions(+), 255 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
index c56390b..7cfaf5b 100644
--- a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
+++ b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
@@ -1,282 +1,889 @@
 <template>
-    <el-dialog 
-    title="涓氬姟绫诲瀷"
+  <el-dialog
+    v-loading="loading"
     :visible.sync="showSubmitDialog"
     append-to-body
+    style="height: 115vh;"
+    title="涓氬姟绫诲瀷"
+    top="6vh"
+    width="70%"
     @close="closeSubmitDialog"
-    width="74%"
+  >
+    <el-form ref="form" :model="btmType" :rules="rules" class="btmTypeForm" inline label-suffix=":" show-message="true"
+             size="medium" status-icon="true" @resetFields="resetForm">
+      <el-form-item label="鑻辨枃鍚嶇О" label-width="100px" prop="id" required="true">
+        <el-input v-model="btmType.id" :disabled="false" :prefix-icon="icons.key"></el-input>
+      </el-form-item>
+      <el-form-item label="涓枃鍚嶇О" label-width="100px">
+        <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="icons.tableName"></el-input>
+      </el-form-item> -->
+      <el-form-item class="domainSelect" label="鎵�灞為鍩�" label-width="100px" prop="domain">
+        <el-select v-model="btmType.bizDomain" :prefix-icon="icons.domain" placeholder="璇烽�夋嫨棰嗗煙" @change="domainChange">
+          <el-option v-for="item in domainOption"
+                     :key="item.value" :label="item.label" :value="item.value">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="鐗堟湰瑙勫垯" label-width="100px">
+        <el-input v-model="btmType.revisionRuleName"
+                  :prefix-icon="icons.revisionRule"
+                  :suffix-icon="icons.referType"
+                  class="revisionRule"
+                  clearable
+                  placeholder="璇烽�夋嫨锛岀暀绌哄垯涓嶈繘琛岀鐞�"
+                  @change="ruleChange"
+                  @clear="clearRevision"
+                  @focus="openRevision">
+        </el-input>
+      </el-form-item>
+      <el-form-item label="鐢熷懡鍛ㄦ湡" label-width="100px">
+        <el-input v-model="btmType.lifeCycleName"
+                  :prefix-icon="icons.lifeCycle"
+                  :suffix-icon="icons.referType"
+                  class="lifeCycle"
+                  clearable
+                  placeholder="璇烽�夋嫨锛岀暀绌哄垯涓嶈繘琛岀鐞�"
+                  @clear="clearLifeCycle"
+                  @focus="openLifeCycle">
+        </el-input>
+      </el-form-item>
+      <!--      <div>-->
+      <!--        <el-form-item label="寮�鍚鍥�" label-width="100px" class="viewFlag">-->
+      <!--          <el-switch v-model="btmType.viewFlag" active-color="#13ce66" @change="viewChange"></el-switch>-->
+      <!--        </el-form-item>-->
+      <!--        <el-form-item label="瑙嗗浘璇彞" label-width="100px" class="viewInput">-->
+      <!--          <el-input v-model="btmType.view" :prefix-icon="icons.view" :disabled="!btmType.viewFlag"></el-input>-->
+      <!--        </el-form-item>-->
+      <!--      </div>-->
+      <el-form-item class="description" label="鎻忚堪" label-width="100px">
+        <el-input id="descId"
+                  v-model="btmType.description"
+                  :prefix-icon="icons.desc"
+                  class="descClass"
+        ></el-input>
+      </el-form-item>
+    </el-form>
+    <avue-crud ref="attrTable"
+               :data="btmType.attributes"
+               :option="option"
+               :page.sync="page">
+      <template slot="menuLeft" slot-scope="scope">
+        <el-button icon="el-icon-plus"
+                   size="small"
+                   type="danger"
+                   @click="rowAdd()">灞炴�ч�夋嫨
+        </el-button>
+      </template>
+      <template slot="attrDataTypeText" slot-scope="{row}">
+        <el-tag v-if=" row.attrDataTypeText">{{ row.attrDataTypeText }}</el-tag>
+      </template>
+      <template slot="isDefaultAttr" slot-scope="{row}">
+        <el-tag v-if="row.isDefaultAttr" type="success">鏄�</el-tag>
+        <el-tag v-else type="danger">鍚�</el-tag>
+      </template>
+      <template slot="menu" slot-scope="{row,index}">
+        <el-button v-if="!row.$cellEdit" icon="el-icon-edit" size="small" type="text" @click="cellEditClick(row,index)">
+          缂栬緫
+        </el-button>
+        <el-button v-if="!row.$cellEdit" icon="el-icon-delete" size="small" type="text"
+                   @click="removeFormAttrTable(row,index)">绉婚櫎
+        </el-button>
+        <el-button v-if="row.$cellEdit" icon="el-icon-check" size="small" type="text" @click="cellEditSave(row,index)">
+          淇濆瓨
+        </el-button>
+      </template>
+    </avue-crud>
+    <div slot="footer" class="dialog-footer">
+      <el-button type="primary" @click="submitBtmType">纭畾</el-button>
+      <el-button @click="cancleSubmitBtmType">鍙栨秷</el-button>
+    </div>
+
+    <!-- 灞炴�ф睜鐨勯�夋嫨 -->
+    <el-dialog :visible="attrRef.visible"
+               append-to-body
+               title="灞炴�ф睜"
+               width="80%"
+               @close="closeAttrDialog"
     >
-        <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="icons.key"></el-input>
-            </el-form-item>
-            <el-form-item label="涓枃鍚嶇О:" label-width="100px">
-                <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="icons.tableName"></el-input>
-            </el-form-item>
-            <el-form-item label="鎵�灞為鍩�:" label-width="100px">
-                <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="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="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="icons.view"></el-input>
-            </el-form-item>
-            <el-form-item label="鎻忚堪:" label-width="100px">
-                <el-input v-model="btmType.description" 
-                :prefix-icon="icons.desc" 
-                ></el-input>
-            </el-form-item>
-        </el-form>
-        <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>
+      <avue-crud ref="attrRef"
+                 v-loading="attrRef.loading"
+                 :data="attrRef.data"
+                 :option="attrRef.option"
+                 :page.sync="attrRef.page"
+                 class="attrRef"
+                 @on-load="attrRefOnLoad"
+                 @search-change="attrRefSearch"
+                 @selection-change="selectionChange">
+        <template slot="typeValue" slot-scope="scope">
+          <el-tag v-if="scope.row.typeValue">{{ scope.row.typeValue }}</el-tag>
+        </template>
+      </avue-crud>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="confirmSelectAttr">纭畾</el-button>
+        <el-button @click="cancleSelectAttr">鍙栨秷</el-button>
+      </div>
     </el-dialog>
+    <!-- 鐗堟湰瑙勫垯鐨勫弬鐓� -->
+    <el-dialog :visible.sync="revisionRef.visible"
+               append-to-body
+               title="璇烽�夋嫨鐗堟湰瑙勫垯"
+               width="80%">
+
+      <avue-crud ref="revisionRef"
+                 v-loading="revisionRef.loading"
+                 :data="revisionRef.data"
+                 :option="revisionRef.option"
+                 :page.sync="revisionRef.page"
+                 class="revisionRef"
+                 @row-click="revisionClick"
+                 @search-change="searchRevisionRule"
+                 @search-reset="clearSearchRevisionRule">
+        <template slot="radio"
+                  slot-scope="{row}">
+          <el-radio v-model="revisionRef.selectRow"
+                    :label="row.$index">&nbsp;
+          </el-radio>
+        </template>
+      </avue-crud>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="confirmRevision">纭畾</el-button>
+        <el-button @click="cancelRevision">鍙栨秷</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 鐢熷懡鍛ㄦ湡鐨勫弬鐓� -->
+    <el-dialog :visible.sync="lifeCycleRef.visible"
+               append-to-body
+               title="璇烽�夋嫨鐢熷懡鍛ㄦ湡"
+               width="80%">
+
+      <avue-crud ref="lifeCycleRef"
+                 v-loading="lifeCycleRef.loading"
+                 :data="lifeCycleRef.data"
+                 :option="lifeCycleRef.option"
+                 :page.sync="lifeCycleRef.page"
+                 class="lifeCycleRef"
+                 @row-click="lifeCycleClick"
+                 @search-change="searchLifeCycle"
+                 @search-reset="clearSearchLifeCycle">
+        <template slot="radio"
+                  slot-scope="{row}">
+          <el-radio v-model="lifeCycleRef.selectRow"
+                    :label="row.$index">&nbsp;
+          </el-radio>
+        </template>
+      </avue-crud>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="confirmLifeCycle">纭畾</el-button>
+        <el-button @click="cancelLifeCycle">鍙栨秷</el-button>
+      </div>
+    </el-dialog>
+  </el-dialog>
+
+
 </template>
 
 
 <script>
 
-import {  } from '@/api/omd/btmType';
-import { getPage } from '@/api/omd/OmdAttribute';
+import {add, update, defaultRequestHandler} from '@/api/omd/btmType';
+import {queryPage} from '@/api/omd/OmdAttribute';
+import {getPage} from '@/api/omd/revisionRule';
+import {getList} from '@/api/modeling/cycle';
+
 export default {
-    name: 'BusinessAdd',
-    props: {
-        btmType:{
-            type: Object
-        },
-        domainOption:{
-            type: Array
-        },
-        icons: {
-            type: Array
-        }
+  name: 'BusinessAdd',
+  props: {
+    btmType: {
+      type: Object,
+      default: {}
     },
-    data() {
-        return {
-            form: {},
-            showSubmitDialog : false,
-            page: {
-                currentPage: 1,
-                pageSize:10
+    domainOption: {
+      type: Array
+    },
+    icons: {
+      type: Array
+    },
+    type: {
+      type: String,
+    },
+  },
+  watch: {},
+  data() {
+    return {
+      form: {},
+      loading: false,
+      showSubmitDialog: false,
+      option: {
+        height: "330px",
+        selection: false,
+        headerAlign: 'center',
+        border: true,
+        index: true,
+        rowKey: 'id',
+        tabs: true,
+        menu: true,
+        editBtn: false,
+        delBtn: false,
+        columnBtn: false,
+        refreshBtn: false,
+        menuWidth: 150,
+        addBtn: false,
+        highlightCurrentRow: true,
+        column: [
+          {
+            label: '鑻辨枃鍚嶇О',
+            prop: 'id',
+            align: 'center',
+            disabled: true
+          }, {
+            label: '涓枃鍚嶇О',
+            prop: 'name',
+            align: 'center',
+            cell: true
+          }, {
+            label: "绫诲瀷",
+            prop: "attrDataTypeText",
+            align: 'center',
+            slot: true
+          },
+          {
+            label: "榛樿鍊�",
+            prop: "defaultValue",
+            align: 'center',
+            cell: true
+          },
+          {
+            label: "璇存槑",
+            prop: "description",
+            align: 'center',
+            cell: true
+          },
+          {
+            label: '榛樿瀛楁',
+            prop: 'isDefaultAttr',
+            align: 'center',
+            cell: true,
+            slot: true
+          }
+        ]
+      },
+      attrRef: {
+        visible: false,
+        page: {
+          currentPage: 1,
+          pageSize: 10,
+        },
+        loading: false,
+        key: null,
+        option: {
+          height: 360,
+          addBtn: false,
+          refreshBtn: false,
+          columnBtn: false,
+          selection: true,
+          menu: false,
+          border: true,
+          reserveSelection: true,
+          searchMenuSpan: 8,
+          highlightCurrentRow: true,
+          rowKey: 'id',
+          column: [
+            {
+              label: '鑻辨枃鍚嶇О',
+              prop: 'id',
+              align: 'left',
+              search: true,
+              disabled: true,
+              width: 230
+            }, {
+              label: '涓枃鍚嶇О',
+              prop: 'name',
+              align: 'center',
             },
-            option: {
-                height: "330px",
-                headerAlign: 'center',
-                border: true,
-                index: true,
-                rowKey: 'oid',
-                addBtn: false,
-                refreshBtn: false,
-                columnBtn:false,
-                tabs: true,
-                menu: false,
-                highlightCurrentRow: true,
-                column: [
-                    {
-                        label: '灞炴�ц嫳鏂囧悕绉�',
-                        prop: 'id',
-                        align: 'left'
-                    }, {
-                        label: '灞炴�т腑鏂囧悕绉�',
-                        prop: 'name',
-                        align: 'center'
-                    },
-                    {
-                        label: "灞炴�х被鍨�",
-                        prop: "typeValue",
-                        align: 'center',
-                        slot: true
-                    },
-                    {
-                        label: "榛樿鍊�",
-                        prop: "defaultValue",
-                        cell: 'true',
-                        align: 'center'
-                    },
-                    {
-                        label: "璇存槑",
-                        prop: "description",
-                        cell: 'true',
-                        align: 'center'
-                    }
-                ]
+            {
+              label: "绫诲瀷",
+              prop: "typeValue",
+              align: 'center',
+              slot: true,
             },
-            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'
-                    },
-                    {
-                        label: "榛樿鍊�",
-                        prop: "defaultValue",
-                        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: []
+            {
+              label: "榛樿鍊�",
+              prop: "defaultValue",
+              align: 'center'
+            },
+            {
+              label: '鍏佽涓虹┖',
+              prop: 'nullable',
+              type: 'switch',
+              display: false,
+              hide: true,
+              labelWidth: 132,
+              dicData: [{
+                label: '鍚�',
+                value: 1
+              }, {
+                label: '鏄�',
+                value: 0
+              }]
+            },
+            {
+              label: "璇存槑",
+              prop: "description",
+              cell: true,
+              align: 'center'
             }
-        }
+          ]
+        },
+        data: [],
+        queryNotIn: ''
+      },
+      revisionRef: {
+        visible: false,
+        page: {
+          currentPage: 1,
+          pageSize: 10
+        },
+        loading: false,
+        selectRow: '',
+        searchKey: null,
+        option: {
+          height: 360,
+          addBtn: false,
+          refreshBtn: false,
+          columnBtn: false,
+          menu: false,
+          border: true,
+          reserveSelection: true,
+          searchMenuSpan: 8,
+          searchShowBtn: false,
+          highlightCurrentRow: true,
+          column: [{
+            label: '閫夋嫨',
+            prop: 'radio',
+            width: 60,
+            hide: false
+          },
+            {
+              label: '鑻辨枃鍚嶇О',
+              prop: 'id',
+              disabled: true,
+              search: true
+            },
+            {
+              label: "涓枃鍚嶇О",
+              prop: "name",
+              search: true,
+            },
+            {
+              label: "璺宠穬瀛楃",
+              prop: "skipCode"
+            },
+            {
+              label: "鍒濆鍊�",
+              prop: "startCode"
+            },
+            {
+              label: "姝ラ暱",
+              prop: "serialStep"
+            },
+            {
+              label: "鍓嶇紑",
+              prop: "prefixCode"
+            },
+            {
+              label: "鍚庣紑",
+              prop: "suffixCode"
+            },
+            {
+              label: "鎻忚堪",
+              prop: "description",
+              type: "textarea"
+            }
+          ]
+        },
+      },
+      lifeCycleRef: {
+        visible: false,
+        page: {
+          currentPage: 1,
+          pageSize: 10
+        },
+        loading: false,
+        selectRow: '',
+        searchKey: null,
+        option: {
+          height: 360,
+          addBtn: false,
+          refreshBtn: false,
+          columnBtn: false,
+          menu: false,
+          border: true,
+          reserveSelection: true,
+          searchMenuSpan: 8,
+          searchShowBtn: false,
+          highlightCurrentRow: true,
+          column: [{
+            label: '閫夋嫨',
+            prop: 'radio',
+            width: 60,
+            hide: false
+          },
+            {
+              label: '鑻辨枃鍚嶇О',
+              prop: 'id',
+              disabled: true,
+              search: true
+            },
+            {
+              label: "涓枃鍚嶇О",
+              prop: "name",
+              search: true,
+            },
+            {
+              label: "璺宠穬瀛楃",
+              prop: "skipCode"
+            },
+            {
+              label: "鍒濆鍊�",
+              prop: "startCode"
+            },
+            {
+              label: "姝ラ暱",
+              prop: "serialStep"
+            },
+            {
+              label: "鍓嶇紑",
+              prop: "prefixCode"
+            },
+            {
+              label: "鍚庣紑",
+              prop: "suffixCode"
+            },
+            {
+              label: "鎻忚堪",
+              prop: "description",
+              type: "textarea"
+            }
+          ]
+        },
+      },
+      rules: {
+        id: [
+          {required: true, message: '璇疯緭鍏ヤ笟鍔$被鍨嬬紪鍙�', trigger: 'blur'},
+          {pattern: /^[A-Za-z]+$/, message: '涓氬姟绫诲瀷缂栧彿鍙兘涓鸿嫳鏂�', trigger: 'blur'},
+          {min: 2, max: 20, message: '闀垮害鍦�2鍒�20涓瓧绗�', trigger: 'blur'}
+        ],
+        name: [
+          {required: true, message: '璇疯緭鍏ヤ笟鍔$被鍨嬩腑鏂囧悕绉�', trigger: 'blur'}
+        ],
+        domain: [
+          {required: true, message: '璇烽�夋嫨鎵�灞為鍩�', trigger: 'blur'}
+        ]
+      },
+      domainData: [],
+      ruleData: [],
+      lifeData: [],
+      domainFirstSelection: true,
+      ruleFirstSelection: true,
+      lifeCycleSelection: true,
+    }
+  },
+  created() {
+
+  },
+  methods: {
+    getDefaultData(requestType, dataName, selectionName) {
+      if (this[selectionName]) {
+        defaultRequestHandler(requestType).then(res => {
+          this[dataName] = res.data.data;
+          res.data.data.forEach(item => {
+            let data = {
+              id: item.id,
+              name: item.name,
+              attrDataType: item.attrDataType,
+              attrDataTypeText: item.attrDataTypeText,
+              defaultValue: item.defaultValue,
+              description: item.description,
+              attributeLength: item.attributeLength,
+              referBtmTypeId: item.referTypeCode,
+              referBtmTypeName: item.referToName,
+              enumId: item.dictCode,
+              isDefaultAttr: item.isDefaultAttr
+            }
+            if (!this.btmType.attributes) {
+              this.btmType.attributes = [];
+            }
+            this.btmType.attributes.push(data);
+          })
+          this.attrRefOnLoad()
+          this[selectionName] = false;
+        });
+      }
     },
-    created() {
+    //鎵�灞為鍩焎hange
+    domainChange() {
+      this.getDefaultData('defaultAttr', 'domainData', 'domainFirstSelection');
+    },
+    //鐗堟湰瑙勫垯change
+    ruleHandler() {
+      this.getDefaultData('reVersionRule', 'ruleData', 'ruleFirstSelection');
+    },
+    //鐢熷懡鍛ㄦ湡change
+    lifeCycleHandler() {
+      this.getDefaultData('lifeCycle', 'lifeData', 'lifeCycleSelection');
+    },
+    //榛樿鍊艰姹�
+    defaultValueRequest() {
 
     },
-    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();
+    // 鍏抽棴缁勪欢寮圭獥
+    closeSubmitDialog() {
+      this.showSubmitDialog = false;
+      //鎵�灞為鍩熺姸鎬侀噸鏂拌祴鍊�
+      this.domainFirstSelection = true;
+      //鐗堟湰瑙勫垯鐘舵�侀噸鏂拌祴鍊�
+      this.ruleFirstSelection = true;
+      //鐢熷懡鍛ㄦ湡鐘舵�侀噸鏂拌祴鍊�
+      this.lifeCycleSelection = true;
+      //閲嶇疆鏍¢獙瑙勫垯
+      this.$refs.form.resetFields();
+    },
+    // 鍏抽棴灞炴�ф睜鏌ヨ寮圭獥
+    closeAttrDialog() {
+      this.attrRef.visible = false;
+    },
+    // 灞炴�ч�夋嫨娣诲姞
+    async rowAdd() {
+      await this.attrRefOnLoad();
+      this.attrRef.visible = true;
+    },
+    // 灞炴�ф睜鍔犺浇
+    attrRefOnLoad() {
+      if (this.attrRef.queryNotIn != '' && this.btmType.attributes !== undefined && this.btmType.attributes.length > 0) {
+        this.attrRef.queryNotIn = '';
+        this.btmType.attributes.forEach(item => {
+          this.attrRef.queryNotIn += (item.id + ",")
+        })
+      }
+      this.attrRef.loading = true;
+      queryPage(this.attrRef.key, this.attrRef.queryNotIn, this.attrRef.page.currentPage, this.attrRef.page.pageSize).then(res => {
+        const data = res.data.data;
+        this.attrRef.page.total = data.total;
+        this.attrRef.data = data.records;
+        this.attrRef.loading = false;
+      });
+    },
+    // 灞炴�ф睜妫�绱�
+    attrRefSearch(form, done) {
+      this.attrRef.key = form.id;
+      this.attrRefOnLoad();
+      done();
+      this.attrRef.key = null;
+    },
+    // 浠庡睘鎬ф睜涓Щ闄�
+    removeFormAttrTable(row, index) {
+      this.btmType.attributes.splice(index, 1);
+      this.attrRef.queryNotIn = "";
+      this.btmType.attributes.forEach(item => {
+        this.attrRef.queryNotIn += (item.id + ",")
+      })
+    },
+    // 灞炴�ф睜鍕鹃�変簨浠�
+    selectionChange(list) {
+      this.attrRef.selectData = list;
+    },
+    // 纭灞炴�ф睜鍕鹃��
+    confirmSelectAttr() {
+      if (!this.btmType.attributes) {
+        this.btmType.attributes = [];
+      }
+      // console.log(this.attrRef.selectData);
+      this.attrRef.selectData.forEach(item => {
+        this.btmType.attributes.push({
+          id: item.id,
+          name: item.name,
+          attrDataType: item.typeKey,
+          attrDataTypeText: item.typeValue,
+          defaultValue: item.defaultValue,
+          description: item.description,
+          attributeLength: item.maxLength,
+          referBtmTypeId: item.referTypeCode,
+          referBtmTypeName: item.referToName,
+          enumId: item.dictCode,
+        });
+        this.attrRef.queryNotIn += (item.id + ",")
+      });
+      this.attrRef.data = [];
+      this.$refs.attrRef.selectClear();
+      this.attrRef.selectData = [];
+      this.closeAttrDialog();
+    },
+    // 鍙栨秷灞炴�ф睜鍕鹃��
+    cancleSelectAttr() {
+      this.attrRef.selectData = [];
+      this.closeAttrDialog();
+    },
+    // 娣诲姞涓氬姟绫诲瀷
+    submitBtmType() {
+      // console.log(this.btmType);
+      if (!this.btmType.attributes) {
+        this.$message.warning("杩樻病鏈変负涓氬姟绫诲瀷閫夋嫨灞炴��");
+        return;
+      } else {
+        let nullFlag = false;
+        this.btmType.attributes.forEach(item => {
+          if (!item.name) {
+            this.$message.warning("绗�" + (item.$index + 1) + "琛岀殑涓枃鍚嶇О涓嶈兘涓虹┖");
+            nullFlag = true;
+            return;
+          }
+        })
+        if (nullFlag) {
+          return;
         }
+      }
+      this.btmType.attributes = this.btmType.attributes.filter(item => !item.isDefaultAttr);
+      add(this.btmType, true).then(res => {
+        // console.log(res)
+        // 娣诲姞瀹屾垚锛屽洖璋冪埗缁勪欢鐨勫埛鏂�
+        this.$message.success(res.data.msg);
+        this.cancleSubmitBtmType();
+        this.$emit('refreshTable');
+      })
+    },
+    // 鍙栨秷娣诲姞涓氬姟绫诲瀷
+    cancleSubmitBtmType() {
+      this.btmType = {};
+      this.btmType.attributes = [];
+      this.showSubmitDialog = false;
+    },
+    // 鍒锋柊灞炴�у垪琛�
+    refreshAttrTable() {
+      this.$nextTick(() => {
+        this.$refs.attrTable.refreshTable();
+      })
+    },
+    //
+    viewChange() {
+
+    },
+    // 鍒楄〃缂栬緫
+    cellEditClick(cell) {
+      // console.log(cell);
+      cell.$cellEdit = true;
+    },
+    // 鍒楄〃缂栬緫淇濆瓨
+    cellEditSave(row, index) {
+      this.btmType.attributes[index].name = row.name
+      this.btmType.attributes[index].defaultValue = row.defaultValue;
+      this.btmType.attributes[index].description = row.description;
+      row.$cellEdit = false;
+      // console.log(this.btmType.attributes);
+      this.$refs.attrTable.refreshTable();
+    },
+    // 鎵撳紑鐗堟湰瑙勫垯鍙傜収
+    openRevision() {
+      this.revisionRef.visible = true;
+      this.revisionRuleOnLoad();
+    },
+    // 鐗堟湰鍙傜収鍒楄〃鐨勯粯璁ゆ煡璇㈡柟娉�
+    revisionRuleOnLoad() {
+      this.revisionRef.loading = true;
+      getPage().then(res => {
+        this.revisionRef.data = res.data.data.records;
+        this.revisionRef.loading = false;
+      });
+
+      // this.$nextTick(() => {
+      //   this.$refs.revisionRef.refreshTable();
+      // });
+    },
+    // 鎵撳紑鐗堟湰瑙勫垯鍙傜収
+    openLifeCycle() {
+      this.lifeCycleRef.visible = true;
+      this.lifeCycleOnLoad();
+    },
+    // 鐢熷懡鍛ㄦ湡鍒楄〃鐨勯粯璁ゆ煡璇㈡柟娉�
+    lifeCycleOnLoad() {
+      this.lifeCycleRef.loading = true;
+      getList().then(res => {
+        this.lifeCycleRef.data = res.data.data.records;
+        this.lifeCycleRef.loading = false;
+      });
+      this.$nextTick(() => {
+        this.$refs.lifeCycleRef.refreshTable();
+      });
+    },
+    // 鍏抽棴鐗堟湰瑙勫垯鍙傜収寮圭獥
+    closeRevisionDialog() {
+      this.revisionRef.visible = false;
+    },
+    // 鍏抽棴鐢熷懡鍛ㄦ湡鍙傜収寮圭獥
+    closeLifeCycleDialog() {
+      this.lifeCycleRef.visible = false;
+    },
+    // 纭閫変腑鐗堟湰瑙勫垯
+    confirmRevision() {
+      this.btmType.revisionFlag = true;
+      this.btmType.revisionRuleId = this.revisionRef.selectData.id;
+      this.btmType.revisionRuleName = this.revisionRef.selectData.name;
+      this.btmType.inputRevisionFlag = false;
+      this.ruleHandler()
+      this.cancelRevision();
+
+    },
+    // 纭閫変腑鐢熷懡鍛ㄦ湡
+    confirmLifeCycle() {
+      this.btmType.lifeCycleFlag = true;
+      this.btmType.lifeCycleId = this.lifeCycleRef.selectData.id;
+      this.btmType.lifeCycleName = this.lifeCycleRef.selectData.name;
+      this.cancelLifeCycle();
+      this.lifeCycleHandler()
+    },
+    // 鍙栨秷閫変腑鐗堟湰瑙勫垯
+    cancelRevision() {
+      this.revisionRef.selectRow = '';
+      this.revisionRef.selectData = {};
+      this.closeRevisionDialog();
+    },
+    // 鍙栨秷閫変腑鐢熷懡鍛ㄦ湡
+    cancelLifeCycle() {
+      this.lifeCycleRef.selectRow = '';
+      this.lifeCycleRef.selectData = {};
+      this.closeLifeCycleDialog();
+    },
+    // 鐗堟湰瑙勫垯鍗曢��
+    revisionClick(row) {
+      this.revisionRef.selectRow = row.$index;
+      this.revisionRef.selectData = {
+        id: row.id,
+        name: row.name,
+      };
+    },
+    // 鐢熷懡鍛ㄦ湡鍗曢��
+    lifeCycleClick(row) {
+      this.lifeCycleRef.selectRow = row.$index;
+      this.lifeCycleRef.selectData = {
+        id: row.id,
+        name: row.name,
+      };
+    },
+    // 鍙栨秷鐗堟湰瑙勫垯
+    clearRevision() {
+      this.$delete(this.btmType, 'revisionFlag');
+      this.$delete(this.btmType, 'revisionRuleId');
+      this.$delete(this.btmType, 'revisionRuleName');
+      this.$delete(this.btmType, 'inputRevisionFlag');
+    },
+    // 鍙栨秷鐢熷懡鍛ㄦ湡
+    clearLifeCycle() {
+      this.$delete(this.btmType, 'lifeCycleFlag');
+      this.$delete(this.btmType, 'lifeCycleId');
+      this.$delete(this.btmType, 'lifeCycleName');
+    },
+    // 琛ㄥ崟閲嶇疆
+    resetForm() {
+      this.btmType = {};
+      this.$refs.form.resetFields();
+    },
+    /**
+     * 鎼滅储鐗堟湰瑙勫垯
+     * @param params 鎼滅储妗嗚緭鍏ュ��  {id: '',name: ''} 鐩存帴鑾峰彇灏辫
+     * @param done 鎵ц瀹屾垚鍚庣殑鍥炶皟
+     */
+    searchRevisionRule(params, done) {
+      let condition = {};
+      if (params.id) {
+        condition['id_like'] = params.id;
+      }
+      if (params.name) {
+        condition['name_like'] = params.name;
+      }
+      this.revisionRef.loading = true;
+      getPage(this.revisionRef.page.currentPage, this.revisionRef.page.pageSize, condition).then(res => {
+        this.revisionRef.data = res.data.data.records;
+      });
+      setTimeout(() => {
+        done();
+        this.revisionRef.loading = false;
+      }, 600);
+      this.$nextTick(() => {
+        this.$refs.revisionRef.refreshTable();
+      });
+    },
+    /**
+     * 鎼滅储鐢熷懡鍛ㄦ湡
+     * @param params 鎼滅储妗嗚緭鍏ュ��
+     * @param done 鎵ц瀹屾垚鍚庣殑鍥炶皟
+     */
+    searchLifeCycle(params, done) {
+      let condition = {};
+      if (params.id) {
+        condition['id_like'] = params.id;
+      }
+      if (params.name) {
+        condition['name_like'] = params.name;
+      }
+      this.lifeCycleRef.loading = true;
+      getList(this.lifeCycleRef.page.currentPage, this.lifeCycleRef.page.pageSize, condition).then(res => {
+        this.lifeCycleRef.data = res.data.data.records;
+      });
+      setTimeout(() => {
+        done();
+        this.lifeCycleRef.loading = false;
+      }, 600);
+      this.$nextTick(() => {
+        this.$refs.lifeCycleRef.refreshTable();
+      });
+    },
+    // 鍙栨秷鐗堟湰瑙勫垯鎼滅储
+    clearSearchRevisionRule(item) {
+      this.revisionRuleOnLoad();
+    },
+    // 鍙栨秷鐢熷懡鍛ㄦ湡鎼滅储
+    clearSearchLifeCycle(item) {
+      this.lifeCycleOnLoad();
+      console.log(item);
     }
+  }
 }
 </script>
 
 <style>
 /* 灞炴�ф睜鍙傜収鍒楄〃 */
-.attrRef > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu{
-        display: none !important;
+.attrRef > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu {
+  display: none !important;
 }
-</style>
\ No newline at end of file
+
+.revisionRef > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu {
+  display: none !important;
+}
+
+.lifeCycleRef > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu {
+  display: none !important;
+}
+
+.btmTypeForm > .el-form-item > .el-form-item__content > .el-input > .el-input__inner {
+  width: 260px;
+}
+
+.domainSelect > .el-form-item__content > .el-select > .el-input > .el-input__inner {
+  width: 260px;
+}
+
+.viewFlag {
+  width: 360px;
+}
+
+.viewInput > .el-form-item__content > .el-input > .el-input__inner {
+  width: 630px;
+}
+
+.descClass > .el-input__inner {
+  width: 1000px;
+}
+</style>

--
Gitblit v1.9.3