Explorar o código

联锁管理合并删除等

yuhan hai 9 meses
pai
achega
f69a52adc8

+ 23 - 43
src/views/module_interLock/InterlockSummary/InterlockSummaryList.vue

@@ -70,10 +70,10 @@
         :dataSource="dataSource"
         :pagination="ipagination"
         :loading="loading"
-        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
         class="j-table-force-nowrap"
         :customRow="customRow"
         @change="handleTableChange">
+        <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
 
         <template slot="htmlSlot" slot-scope="text">
           <div v-html="text"></div>
@@ -95,7 +95,7 @@
           </a-button>
         </template>
 
-        <span slot="action" slot-scope="text, record">
+        <!-- <span slot="action" slot-scope="text, record">
           <a @click="handleEdit(record)">编辑</a>
 
           <a-divider type="vertical" />
@@ -112,7 +112,7 @@
               </a-menu-item>
             </a-menu>
           </a-dropdown>
-        </span>
+        </span> -->
 
       </a-table>
     </div>
@@ -240,51 +240,31 @@
             fixed:"right",
             width:147,
             // scopedSlots: { customRender: 'action' },
-            customRender:function (t,r,index) {
-              var childrenVal
-              var childrenVal2
-              var childrenVal3
-              var childrenVal4
-              var childrenVal5
-              childrenVal = (<a id='edit'>编辑</a>)
-              childrenVal2 = (<a-divider type="vertical" />)
-              childrenVal3 = (<a id='detail'>详情</a>)
-              childrenVal4 = (<a-divider type="vertical" />)
-              childrenVal5 = (
-              <a-popconfirm title="确定删除吗?">
-                <a id='delete'>删除</a>
-              </a-popconfirm>)
+            customRender: (text,record,index)=> {
+              var childrenEdit = (<a onclick={() => { this.handleEdit(record) }}>编辑</a>)
+              var childrenDivider = (<a-divider type="vertical" />)
+              var childrenMore = (
+                <a-dropdown>
+                  <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
+                  <a-menu slot="overlay">
+                    <a-menu-item>
+                      <a onClick={() => {this.handleDetail(record)}}>详情</a>
+                    </a-menu-item>
+                    <a-menu-item>
+                      <a-popconfirm title="确定删除吗?" onConfirm={() => this.handleDelete(record.summaryid)}>
+                        <a>删除</a>
+                      </a-popconfirm>
+                    </a-menu-item>
+                  </a-menu>
+                </a-dropdown>
+              )
               return {
-                children: [childrenVal,childrenVal2,childrenVal3,childrenVal4,childrenVal5],
+                children: [childrenEdit,childrenDivider,childrenMore],
                 attrs: {
-                  rowSpan: r.rowSpan
+                  rowSpan: record.rowSpan
                 }
               }
             },
-            customCell: (row, index) => {
-              return {
-                on: {
-                  click: (e) => {
-                    let that = this
-                    document.addEventListener('click', function(event) {
-                      var clickedElement = event.target;
-                      var elementId = clickedElement.id;
-                      console.log('点击',elementId,clickedElement);
-                      if (elementId == 'edit') {
-                        console.log('这一行的信息',row, index)
-                        that.handleEdit(row);
-                      }
-                      if (elementId == 'detail') {
-                        that.handleDetail(row);
-                      }
-                      if (elementId == 'delete') {
-                        // that.handleDelete(row, index);
-                      }
-                    });
-                  },
-                },
-              };
-            },
           }
         ],
         url: {

+ 6 - 2
src/views/module_interLock/InterlockSummary/modules/InterlockSummaryForm.vue

@@ -404,7 +404,7 @@
         this.conditionDataSource.splice(index, 1)
       },
       // 新增联锁-弹窗
-      add () {  
+      add () {
         // this.edit(this.modelDefault);
         this.visible = true;
       },
@@ -426,6 +426,10 @@
         // 触发表单验证
         this.$refs.form.validate(valid => {
           if (valid) {
+            if(this.conditionDataSource.length===0){
+              this.$message.error('联锁条件未设置')
+              return false
+            }
             that.confirmLoading = true;
             let httpurl = '';
             let method = '';
@@ -454,7 +458,7 @@
               that.confirmLoading = false;
             })
           }
-         
+
         })
       },
     }