From d6833c760d1f00082555bbe55feb05b41e761e6c Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Mon, 13 Nov 2023 10:41:15 +0800
Subject: [PATCH] fix:责任单位维护

---
 src/views/list/Unit.vue |  132 ++++++++++++++++++++++----------------------
 1 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/src/views/list/Unit.vue b/src/views/list/Unit.vue
index 511d816..68bb462 100644
--- a/src/views/list/Unit.vue
+++ b/src/views/list/Unit.vue
@@ -80,6 +80,7 @@
           <a-cascader
             v-model="editForm.parentCode"
             placeholder="���������"
+            change-on-select
             :options="newParentListOptions"
             @change="positionLevel"
             :disabled="pageState === 'view'"
@@ -200,15 +201,17 @@
         unitName:'',
         parentCode: [],
         areaCode:'',
-        state:Number,
+        state:'0',
     }
 
   private pagination:any={
     total:0,
     current:1,
-    pageSize:5,
-    showSizeChanger: false,
-    showQuickJumper: false,
+    pageSize:10,
+    showSizeChanger: true,
+    showQuickJumper: true,
+    pageSizeOptions: ['10', '30', '60', '100'],
+    showTotal: (total:number) => `������ ${this.pagination.total} ���������`,  //���������������������������
   };
 
     @Watch('serch.name')
@@ -244,16 +247,28 @@
     
     private title: any = null;
 
-    private columns: any[] = [{
-            title: '������',
+  private columns: any[] = [
+      {
+      title: "������",
+      dataIndex: "key",
+      key: "key",
+      align: "center",
+      customRender: (text,record,index) => `${index+1}`,
+      width: 60,
+    },
+    {
+      title: '������',
+             align: "center",
             dataIndex: 'unitName',
         },
         {
-            title: '������������',
+          title: '������������',
+             align: "center",
             dataIndex: 'parentName',
         },
         {
-            title: '������������',
+          title: '������������',
+             align: "center",
             dataIndex: 'areaName',
         },
         {
@@ -261,16 +276,25 @@
             dataIndex: 'updateTime',
         },
         {
-            title: '���������',
+          title: '���������',
+             align: "center",
             dataIndex: 'createName',
         },
         {
             title: '������',
-            dataIndex: 'state',
+          dataIndex: 'state',
+             align: "center",
             customRender: this.progressStateRender,
+    },
+            {
+            title: '������������',
+          dataIndex: 'isInvalid',
+             align: "center",
+            customRender: this.progressIsInvalidRender,
         },
         {
-            title: '������',
+          title: '������',
+             align: "center",
             customRender: this.opRender,
         },
     ];
@@ -286,24 +310,27 @@
     console.log(this.serch)
        const data = this.serch.parentCode
         let code =data[data.length-1]
+        
         get("unit/selectUint",{
             name:this.serch.name,
             parentCode:code,
             parentCodeList:this.serch.parentCode,
             areaCode:this.serch.areaCode,
-            current: this.pagination.current,
-            page:1,
-            size: 20
+            page:this.pagination.current,
+            size: this.pagination.pageSize
         }).then(res=>{
-          this.dataSource =res.data.data.item
+          this.dataSource = res.data.data.item
+          this.pagination.total = res.data.data.total
         })
         .catch(err=>{
             console.log(err);
         })
     }
 
-    private handlerTableChange(pagination: any, filter: any, sorter: any): void {
+  private handlerTableChange(pagination: any, filter: any, sorter: any): void {
+      console.log('pagination',pagination)
       this.pagination.current = pagination.current
+      this.pagination.pageSize = pagination.pageSize
       this.pagination.total = pagination.total
       this.handleSearch()
     }
@@ -326,7 +353,7 @@
             parentCode: code,
             parentCodeList:this.editForm.parentCode,
             areaCode: this.editForm.areaCode,
-            state:this.editForm.state
+            state:parseInt(this.editForm.state)
         }).then((res: any) => {
            this.handleSearch()
           this.visibleCreateModal = false
@@ -334,7 +361,7 @@
             unitName:'',
             parentCode: [],
             areaCode:'',
-            state: Number,
+            state: '0',
             parentCodeList:[]
           }
         }).catch((err)=>{
@@ -355,7 +382,7 @@
         unitName:'',
         parentCode: [],
         areaCode:'',
-        state: Number,
+        state: '0',
         parentCodeList:[]
       }
     }
@@ -364,7 +391,7 @@
         unitName:'',
         parentCode: [],
         areaCode:'',
-        state: Number,
+        state: '0',
         parentCodeList:[]
       }
       this.visibleInvalidityModal = false;
@@ -455,13 +482,19 @@
         });
   }
     
-    private progressStateRender(text: string) {
+  private progressIsInvalidRender(text: Number) {
+        if (text === 0) {
+            return <a-badge status = 'success' text = '���������' />;
+        }
+        return <a-badge status = 'error' text = '���������' />;
+  }
+  
+  private progressStateRender(text: string) {
         if (text === '0') {
             return <a-badge status = 'success' text = '������' />;
         }
         return <a-badge status = 'processing' text = '���������' />;
   }
-    
     private async handleUpdateModalVisible(visible: boolean, record: any): void {
       this.visibleCreateModal = true;
       await this.positionLevel(record.parentCodeList)
@@ -485,69 +518,36 @@
     }
   private opRender(text: string, record: any, index: number) {
     // ������console
-    console.log('1111',text)
-    console.log('2222',record)
-    console.log('333', index)
-      if (record.state==='1') { 
-        if (record.isInvalid ===0) {
-       return   <div>
-            <a onClick = {
-                () => this.handleUpdateModalVisible(true, record)
-            } > ������ </a>
-          <a-divider type='vertical' />
+    console.log('record',record)
+    if (record.state === '0') {
+      if (Number(record.isInvalid) === 0) {
+        return <div>
               <a onClick = {
                 () => this.handleDetailModalVisible(true, record)
             } > ������ </a>
-            <a-divider type = 'vertical'  / >
-            <a v-show="record.state !=='1'" onClick={ () => this.handleAssert(record)
-              } >������</a>
             <a-divider type = 'vertical' />
-            <a v-show="record.isInvalid !=='0'" onClick = {
+            <a  onClick = {
                 () => this.handleInvalidity(record)
             } >������</a>
             </div>
-        } else {
-           return   <div>
-            <a onClick = {
-                () => this.handleUpdateModalVisible(true, record)
-            } > ������ </a>
-          <a-divider type='vertical' />
-              <a onClick = {
-                () => this.handleDetailModalVisible(true, record)
-            } > ������ </a>
-            <a-divider type = 'vertical'  / >
-            <a v-show="record.state !=='1'" onClick={ () => this.handleAssert(record)
-              } >������</a>
-           
-            </div>
-        }
       } else {
-          if (record.isInvalid ===0) {
-       return   <div>
-            <a onClick = {
-                () => this.handleUpdateModalVisible(true, record)
-            } > ������ </a>
-          <a-divider type='vertical' />
+         return <div>
               <a onClick = {
                 () => this.handleDetailModalVisible(true, record)
             } > ������ </a>
-            <a-divider type = 'vertical' />
-            <a v-show="record.isInvalid !=='0'" onClick = {
-                () => this.handleInvalidity(record)
-            } >������</a>
             </div>
+      }
         } else {
            return   <div>
-            <a onClick = {
-                () => this.handleUpdateModalVisible(true, record)
-            } > ������ </a>
-          <a-divider type='vertical' />
               <a onClick = {
                 () => this.handleDetailModalVisible(true, record)
             } > ������ </a>
+            <a-divider type='vertical' />
+             <a onClick = {
+                () => this.handleUpdateModalVisible(true, record)
+            } > ������ </a>
             </div>
         }
-    }
       this.handleSearch();
     }
 

--
Gitblit v1.8.0