From d9d6113f29716298c5320606b7c2c6b94a758d1b Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 18 三月 2024 17:31:01 +0800
Subject: [PATCH] 工单下发页面完善

---
 src/views/system/work-order/distribute/index.vue |   59 +++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/src/views/system/work-order/distribute/index.vue b/src/views/system/work-order/distribute/index.vue
index 0a0f18c..8e9ab85 100644
--- a/src/views/system/work-order/distribute/index.vue
+++ b/src/views/system/work-order/distribute/index.vue
@@ -2,7 +2,7 @@
   <div class="row">
     <el-row type="flex" justify="left">
       <el-col :span="24" style="position: relative">
-        <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
+        <el-menu :default-active="activeIndex" class="el-menu" mode="horizontal" @select="handleSelect">
           <el-menu-item index="0" @click="changeUnit(null, '鍏ㄩ儴')">
             鍏ㄩ儴鍗曚綅
           </el-menu-item>
@@ -27,13 +27,19 @@
     <el-row class="op-warp" type="flex" justify="left" >
       <el-col :span="24">
         <el-button size="small" type="info" @click="selectedDistribute" class="op">涓嬪彂閫変腑宸ュ崟</el-button>
-        <el-button size="small" type="danger" @click="allDistribute" class="op">鍏ㄩ儴涓嬪彂</el-button>
+        <el-popconfirm
+          @confirm="allDistribute"
+          title="纭畾瑕佷笅鍙戞墍鏈夊伐鍗曞悧锛�"
+        >
+          <el-button size="small" type="danger"  class="op" slot="reference">鍏ㄩ儴涓嬪彂</el-button>
+        </el-popconfirm>
+
         <el-popover
           class="op"
           placement="right"
           width="300px"
           trigger="click">
-          <span style="font-weight: bold;font-size: 16px">蹇�熶笅鍙�</span>
+          <span style="font-weight: bold;font-size: 16px">蹇嵎涓嬪彂</span>
           <el-form ref="fastDistributeForm" :model="fastDistributeForm" :rules="fastDistributeRules" label-width="80px">
             <el-form-item label="蹇嵎鏂瑰紡" prop="fastWay">
               <el-radio v-model="fastDistributeForm.fastWay" label="0">鏈�杩�30鍒嗛挓</el-radio>
@@ -89,6 +95,7 @@
 </template>
 
 <script>
+import {distributeWorkOrder, fastDistribute} from '@/api/platform/work-order'
 export default {
   name: 'index',
   data() {
@@ -102,7 +109,7 @@
       fastTimeRange: [],
       // 涓嬪彂
       fastDistributeForm: {
-        fastWay: '',
+        fastWay: null,
         fastNumLimit: null,
         start: null,
         end: null,
@@ -118,8 +125,9 @@
         ],
       },
       queryParams: {
+        unitId: null,
         pageNum: 1,
-        pageSize: 10,
+        pageSize: 20,
       },
       // 鎬绘潯鏁�
       total: 0,
@@ -130,11 +138,23 @@
       workOrderList: [],
     }
   },
+  mounted() {
+    this.page();
+  },
   methods: {
+    page() {
+      this.loading = true;
+      distributeWorkOrder(this.queryParams).then(res => {
+        this.workOrderList = res.data;
+        this.total = res.total;
+        this.loading = false;
+      })
+    },
     changeUnit(unitId, unitName) {
       this.unitId = unitId;
+      this.queryParams.unitId = unitId;
       this.unitName = unitName;
-      // todo 瑙﹀彂鏁版嵁鏌ヨ
+      this.page()
     },
     clearFastDistributeForm() {
       this.fastDistributeForm.fastWay = ''
@@ -146,17 +166,12 @@
     allDis() {},
     // 鍏ㄩ儴涓嬪彂
     allDistribute() {
-      this.$modal.confirm("纭畾瑕佷笅鍙�" + (this.unitId ? this.unitName + "涓嬬殑" : "鎵�鏈夊伐鍗�") + "鍚楋紵").then(function() {
-        return this.allDis();
-      }).then(() => {
-        // this.getList();
-        // this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
-      }).catch(() => {});
+      this.fastDistribute();
     },
     // 蹇�熶笅鍙�
     fastDistribute() {
-      this.$refs['fastDistributeForm'].validate((valid) => {
-        if (valid) {
+      // this.$refs['fastDistributeForm'].validate((valid) => {
+      //   if (valid) {
           // 濡傛灉鏄嚜瀹氫箟鏂瑰紡锛岄偅涔堟椂闂存蹇呭~
           if (this.fastDistributeForm.fastWay === '101' && !this.fastTimeRange.length > 0) {
             this.$message.warning("璇烽�夋嫨鏃堕棿鑼冨洿")
@@ -167,11 +182,14 @@
             this.fastDistributeForm.end = this.fastTimeRange[1]
           }
           this.fastDistributeForm.unitId = this.unitId
-          // todo 鎻愪氦蹇�熷彂甯冭姹�
-        } else {
-          return false
-        }
-      })
+          fastDistribute(this.fastDistributeForm).then(res => {
+            // this.clearFastDistributeForm();
+            this.page();
+          })
+        // } else {
+        //   return false
+        // }
+      // })
     },
     // 閫変腑宸ュ崟涓嬪彂
     selectedDistribute() {
@@ -179,7 +197,7 @@
         this.$message.warning("璇峰厛閫夋嫨瑕佷笅鍙戠殑宸ュ崟")
         return
       }
-      // todo 涓嬪彂宸ュ崟
+      this.fastDistribute();
     },
     handleSelect(key, keyPath) {
       console.log(key, keyPath);
@@ -213,4 +231,5 @@
   top: 10px;
   right:5px
 }
+
 </style>

--
Gitblit v1.8.0