whj 1 ano atrás
pai
commit
330c64e2a0

+ 5 - 1
src/views/idle-assets/modules/BaseForm.vue

@@ -160,6 +160,10 @@ export default {
     },
     handleSbSelectd (rows) {
       const sbInfoDTOS = rows.map(item => {
+        if (this.sbInfoDTOS.includes(sb => sb.id === item.id)) {
+          console.log(22)
+          return
+        }
         return {
           id: item.id,
           name: item.name,
@@ -167,7 +171,7 @@ export default {
           positionNo: item.positionNo
         }
       })
-      this.sbInfoDTOS = [...sbInfoDTOS, ...this.sbInfoDTOS]
+      this.sbInfoDTOS = [...sbInfoDTOS, ...this.sbInfoDTOS].filter(item => item)
     },
     handleUpLoad (record) {
       this.$refs.upLoad.base(record)

+ 83 - 81
src/views/idle-assets/modules/SbInfoSelectModal.vue

@@ -1,22 +1,23 @@
 <template>
-  <a-modal
-    :title="modalTitle"
-    :width="1300"
-    :visible="visible"
-    :confirmLoading="confirmLoading"
-    class="ant-modal2"
-    @cancel="handleCancel"
-  >
-    <a-card :bordered="false">
-      <div class="table-page-search-wrapper">
-        <a-form layout="inline">
-          <a-row :gutter="48">
-            <a-col :md="8" :sm="24">
-              <a-form-item label="关键字">
-                <a-input v-model.trim="queryParam.keyword" placeholder="请输入名称/编码"/>
-              </a-form-item>
-            </a-col>
-            <!--            <a-col :md="8" :sm="24">
+  <div v-if="visible">
+    <a-modal
+      :title="modalTitle"
+      :width="1300"
+      :visible="visible"
+      :confirmLoading="confirmLoading"
+      class="ant-modal2"
+      @cancel="handleCancel"
+    >
+      <a-card :bordered="false">
+        <div class="table-page-search-wrapper">
+          <a-form layout="inline">
+            <a-row :gutter="48">
+              <a-col :md="8" :sm="24">
+                <a-form-item label="关键字">
+                  <a-input v-model.trim="queryParam.keyword" placeholder="请输入名称/编码"/>
+                </a-form-item>
+              </a-col>
+              <!--            <a-col :md="8" :sm="24">
               <a-form-item label="上层设备类型">
                 <a-tree-select
                   style="width: 100%"
@@ -30,72 +31,73 @@
                 </a-tree-select>
               </a-form-item>
             </a-col>-->
-            <a-col :md="6" :sm="24">
-              <a-form-item label="车间位置">
-                <a-select v-model="queryParam.positionId" placeholder="请选择">
-                  <a-select-option
-                    v-for="({id,name}) in sbPositionData"
-                    :key="id"
-                    :label="name"
-                    :value="id">{{ name }}
-                  </a-select-option>
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="设备类型">
-                <a-tree-select
-                  style="width: 100%"
-                  :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
-                  :treeData="treeData"
-                  :treeNodeFilterProp="'title'"
-                  :showSearch="true"
-                  placeholder="请选择"
-                  @change="handleChange"
-                >
-                </a-tree-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="8 || 24" :sm="24">
-              <span class="table-page-search-submitButtons">
-                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-                <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
-              </span>
-            </a-col>
-          </a-row>
-        </a-form>
-      </div>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="车间位置">
+                  <a-select v-model="queryParam.positionId" placeholder="请选择">
+                    <a-select-option
+                      v-for="({id,name}) in sbPositionData"
+                      :key="id"
+                      :label="name"
+                      :value="id">{{ name }}
+                    </a-select-option>
+                  </a-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="设备类型">
+                  <a-tree-select
+                    style="width: 100%"
+                    :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
+                    :treeData="treeData"
+                    :treeNodeFilterProp="'title'"
+                    :showSearch="true"
+                    placeholder="请选择"
+                    @change="handleChange"
+                  >
+                  </a-tree-select>
+                </a-form-item>
+              </a-col>
+              <a-col :md="8 || 24" :sm="24">
+                <span class="table-page-search-submitButtons">
+                  <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+                  <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
+                </span>
+              </a-col>
+            </a-row>
+          </a-form>
+        </div>
 
-      <div class="table-operator" style="margin-bottom: 8px;">
-      </div>
+        <div class="table-operator" style="margin-bottom: 8px;">
+        </div>
 
-      <s-table
-        ref="table"
-        size="default"
-        rowKey="id"
-        :columns="columns"
-        :data="loadData"
-        :alert="options.alert"
-        :customRow="options.customRow"
-        :rowSelection="options.rowSelection"
-        :scroll="{ x: 1300, y: BaseTool.Constant.scrollY }"
-        showPagination="auto"
-      >
-        <span slot="action" slot-scope="record">
-          <template>
+        <s-table
+          ref="table"
+          size="default"
+          rowKey="id"
+          :columns="columns"
+          :data="loadData"
+          :alert="options.alert"
+          :customRow="options.customRow"
+          :rowSelection="options.rowSelection"
+          :scroll="{ x: 1300, y: BaseTool.Constant.scrollY }"
+          showPagination="auto"
+        >
+          <span slot="action" slot-scope="record">
+            <template>
 
-          </template>
-        </span>
-        <span slot="status" slot-scope="text">
-          <badge :status="DictCache.COLOR.SB_INFO_STATUS[text]" :text="statusMap[text]" />
-        </span>
-      </s-table>
-    </a-card>
-    <template slot="footer">
-      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
-      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">选择</a-button>
-    </template>
-  </a-modal>
+            </template>
+          </span>
+          <span slot="status" slot-scope="text">
+            <badge :status="DictCache.COLOR.SB_INFO_STATUS[text]" :text="statusMap[text]" />
+          </span>
+        </s-table>
+      </a-card>
+      <template slot="footer">
+        <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
+        <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">选择</a-button>
+      </template>
+    </a-modal>
+  </div>
 </template>
 
 <script>