Browse Source

工单工序

xiaohaizhao 1 year ago
parent
commit
aa9fc3e245

+ 37 - 12
packageA/workOrder/detail.vue

@@ -35,7 +35,7 @@
                     <view class="row-label">备注说明:</view>
                     <view class="row-value">{{ detail.remarks || ' --' }}</view>
                 </view>
-                <view class="status">{{ detail.status }}</view>
+                <view class="status" :style="[statusStyle(detail.status)]">{{ detail.status }}</view>
             </view>
             <block v-if="detail.team.length">
                 <view class="label">巡检人员</view>
@@ -60,13 +60,38 @@ import nodes from "./modules/nodes"
 export default {
     name: "Detail",
     components: { but, nodes },
+    computed: {
+        statusStyle() {
+            return function (status) {
+                let obj = {};
+                switch (status) {
+                    case '待接单':
+                        obj = { color: '#EB4B5C', background: 'rgba(235, 75, 92, .2)' }
+                        break;
+                    case '待开始':
+                        obj = { color: '#3874F6', background: 'rgba(56, 116, 246, .2)' }
+                        break;
+                    case '进行中':
+                        obj = { color: '#5AB73F', background: 'rgba(90, 183, 63, .2)' };
+                        break;
+                    case '已完成':
+                        obj = { color: '#F27F37', background: 'rgba(242, 127, 55, .2)' };
+                        break;
+                    default:
+                        obj = { color: '#999999', background: 'rgba(153, 153, 153, .2)' }
+                        break;
+                }
+                return obj
+            }
+        }
+    },
     data() {
         return {
             detail: {
                 team: [],
                 nodes: [],
                 status: "",
-                node: null,
+                child: null,
             },
             isShowBut: true,
             sa_workorderid: 0,
@@ -75,6 +100,10 @@ export default {
     onLoad(options) {
         this.sa_workorderid = options.id;
         this.getDetail(true)
+        this.$Http.updateNodes = this.getDetail.bind(this);
+    },
+    onUnload() {
+        delete this.$Http.updateNodes;
     },
     methods: {
         getDetail(init = false) {
@@ -102,25 +131,24 @@ export default {
                 this.detail = res.data;
                 this.$refs.List.RefreshToComplete();
                 this.$refs.List.setHeight();
-                if (this.node) this.nodeClick(this.node)
+                if (this.child) this.nodeClick(this.child)
             })
         },
-        nodeClick(node) {
-            this.$Http.node = node;
+        nodeClick(child) {
             if (['待接单', '待开始'].includes(this.detail.status)) {
-                if (this.detail.status == '待开始') this.node = node;
+                if (this.detail.status == '待开始') this.child = child;
                 this.$refs.but.onClick(true)
             } else if (['暂停', '作废', '已完成'].includes(this.detail.status)) {
                 // 3、暂停/作废/已完成的工单,点击工序详情可查询,不可编辑;
                 uni.navigateTo({
-                    url: '/packageA/workOrder/setNode?readOnly=true'
+                    url: `/packageA/workOrder/setNode?isReadOnly=true&sa_workorderid=${this.detail.sa_workorderid}&sa_workorder_nodeid=${child.sa_workorder_nodeid}&w_deviceid=${this.detail.w_deviceid}`
                 });
             } else if (this.detail.status == '进行中') {
                 // 2、已开始的工单(工单状态为进行中),点击工序进入工序详情,若工序未完成,可查询可编辑;已完成工序仅查询不可编辑
                 uni.navigateTo({
-                    url: '/packageA/workOrder/setNode'
+                    url: `/packageA/workOrder/setNode?sa_workorderid=${this.detail.sa_workorderid}&sa_workorder_nodeid=${child.sa_workorder_nodeid}&w_deviceid=${this.detail.w_deviceid}`
                 });
-                this.node = null;
+                this.child = null;
             }
         },
         onUnShowBut(e) {
@@ -128,7 +156,6 @@ export default {
         }
     },
     onUnload() {
-        delete this.$Http.node
     }
 }
 </script>
@@ -169,8 +196,6 @@ export default {
             top: 0;
             right: 0;
             padding: 4px 8px;
-            background: #FFEFEF;
-            color: #F65050;
             font-size: 12px;
             border-radius: 0 0 0 4px;
         }

+ 37 - 0
packageA/workOrder/index.vue

@@ -11,6 +11,7 @@
         <My_search ref="My_search" @onFilter="onFilter" @startSearch="startSearch" dateRange />
         <My_listbox ref="List" @getlist="getlist" :empty='empty'>
             <work-order-list :list1="list" />
+            <view style="height: 30px;" />
         </My_listbox>
     </view>
 </template>
@@ -38,6 +39,10 @@ export default {
     },
     mounted() {
         this.getlist();
+        this.$Http.updateWorkorder = this.updete.bind(this)
+    },
+    onUnload() {
+        delete this.$Http.updateWorkorder;
     },
     methods: {
         getlist(init = false) {
@@ -75,6 +80,38 @@ export default {
                 this.content = content;
             })
         },
+        updete() {
+            let content = JSON.parse(JSON.stringify(this.content));
+            content.pageSize = content.pageNumber - 1 * content.pageSize;
+            content.pageNumber = 1;
+            this.$Http.basic({
+                "id": "20231007095502",
+                content
+            }).then(res => {
+                console.log("更新工单列表", res)
+                if (this.cutoff(res.msg)) return;
+                this.$refs.List.RefreshToComplete();
+                this.$refs.List.setHeight();
+                this.$refs.My_search.onFinish()
+                this.empty = !res.data.length;
+                let list = res.data.map(v => {
+                    switch (v.sourcetable) {
+                        case "w_eventid":
+                            v.source = "巡检:" + (v.planno || ' --')
+                            break;
+                        case "w_event_log":
+                            v.source = "告警:" + (v.eventname || ' --')
+                            break;
+                        default:
+                            v.source = "现场"
+                            break;
+                    }
+                    v.users = v.teamRows.map(u => u.name).join(",")
+                    return v
+                })
+                this.list = list;
+            })
+        },
         startSearch(e) {
             this.content.where.condition = e;
             this.getlist(true)

+ 2 - 1
packageA/workOrder/modules/but.vue

@@ -92,7 +92,8 @@ export default {
                                 return;
                             }
                             if (that.cutoff(res.msg, this.toast)) return that.loading = false;
-
+                            this.$Http.updateWorkorder && this.$Http.updateWorkorder();
+                            this.$Http.updateWorkorderList && this.$Http.updateWorkorderList(true);
                             that.$emit("onUpdate", true)
                         })
                     }

+ 26 - 4
pages/index/modules/workorderList.vue

@@ -18,7 +18,7 @@
             <view class="row">
                 参与人:{{ item.users.length ? item.users : ' --' }}
             </view>
-            <view class="status">{{ item.status }}</view>
+            <view class="status" :style="[statusStyle(item.status)]">{{ item.status }}</view>
         </navigator>
     </view>
 </template>
@@ -35,7 +35,31 @@ export default {
             type: Array,
         }
     },
-    components: {},
+    computed: {
+        statusStyle() {
+            return function (status) {
+                let obj = {};
+                switch (status) {
+                    case '待接单':
+                        obj = { color: '#EB4B5C', background: 'rgba(235, 75, 92, .2)' }
+                        break;
+                    case '待开始':
+                        obj = { color: '#3874F6', background: 'rgba(56, 116, 246, .2)' }
+                        break;
+                    case '进行中':
+                        obj = { color: '#5AB73F', background: 'rgba(90, 183, 63, .2)' };
+                        break;
+                    case '已完成':
+                        obj = { color: '#F27F37', background: 'rgba(242, 127, 55, .2)' };
+                        break;
+                    default:
+                        obj = { color: '#999999', background: 'rgba(153, 153, 153, .2)' }
+                        break;
+                }
+                return obj
+            }
+        }
+    },
     name: "workorderList",
     data() {
         return {
@@ -120,8 +144,6 @@ export default {
         top: 0;
         right: 0;
         padding: 4px 8px;
-        background: #FFEFEF;
-        color: #F65050;
         font-size: 12px;
         border-radius: 0 0 0 4px;
     }

+ 7 - 3
static/iconfont/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 4091725 */
-  src: url('//at.alicdn.com/t/c/font_4091725_n0q4ed0yw5i.woff2?t=1695714213625') format('woff2'),
-       url('//at.alicdn.com/t/c/font_4091725_n0q4ed0yw5i.woff?t=1695714213625') format('woff'),
-       url('//at.alicdn.com/t/c/font_4091725_n0q4ed0yw5i.ttf?t=1695714213625') format('truetype');
+  src: url('//at.alicdn.com/t/c/font_4091725_i84mgg6w1bb.woff2?t=1697074062214') format('woff2'),
+       url('//at.alicdn.com/t/c/font_4091725_i84mgg6w1bb.woff?t=1697074062214') format('woff'),
+       url('//at.alicdn.com/t/c/font_4091725_i84mgg6w1bb.ttf?t=1697074062214') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,10 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-dibu-diudan:before {
+  content: "\e6a3";
+}
+
 .icon-a-wodemendianxinxidizhi:before {
   content: "\e64b";
 }