Browse Source

节点拆组件

xiaohaizhao 1 year ago
parent
commit
9dac72a9f7
2 changed files with 212 additions and 159 deletions
  1. 82 159
      packageA/workOrder/detail.vue
  2. 130 0
      packageA/workOrder/modules/nodes.vue

+ 82 - 159
packageA/workOrder/detail.vue

@@ -37,7 +37,6 @@
                 </view>
                 <view class="status">{{ detail.status }}</view>
             </view>
-
             <block v-if="detail.team.length">
                 <view class="label">巡检人员</view>
                 <view class="users">
@@ -47,51 +46,26 @@
                     </view>
                 </view>
             </block>
-            <block v-if="detail.nodes.length">
-                <view class="label">进度</view>
-                <view class="step-box">
-                    <view class="workorder" v-for="(item, index) in detail.nodes" :key="item.sa_workorder_nodeid">
-
-                        <view class="workorder-title">
-                            {{ index + 1 }}.{{ item.workpresetjson.workname }}
-                        </view>
-
-                        <navigator url="#" class="child" v-for="(child, childIndex) in item.child"
-                            :key="child.sa_workorder_nodeid">
-                            <view class="child-title">
-                                {{ index + 1 }}-{{ childIndex + 1 }}.{{ child.workpresetjson.workname }}
-                            </view>
-                            <view class="child-result">
-                                <view class="have-not-begun tag" v-if="child.status == 0">
-                                    未开始
-                                </view>
-                                <block v-else>
-                                    <view class="time">{{ child.changedate }}</view>
-                                    <view class="done tag" v-if="child.status == 1">
-                                        完成
-                                    </view>
-                                    <view class="underway tag" v-else>
-                                        进行中
-                                    </view>
-                                </block>
-                            </view>
-                        </navigator>
-                    </view>
-                </view>
-            </block>
-            <view style="height: 30px;" />
+            <nodes :nodes="detail.nodes" @nodeClick="nodeClick" />
+            <view style="height: 22vw;" />
         </My_listbox>
+        <but ref="but" :sa_workorderid="sa_workorderid" :status="detail.status" @onUpdate="getDetail" />
     </view>
 </template>
 
 <script>
+import but from "./modules/but"
+import nodes from "./modules/nodes"
 export default {
     name: "Detail",
+    components: { but, nodes },
     data() {
         return {
             detail: {
                 team: [],
-                nodes: []
+                nodes: [],
+                status: "",
+                node: null,
             },
             sa_workorderid: 0,
         }
@@ -103,7 +77,7 @@ export default {
     methods: {
         getDetail(init = false) {
             if (!init) return;
-            this.$Http.basic({
+            return this.$Http.basic({
                 "id": 20230208140103,
                 "content": {
                     "sa_workorderid": this.sa_workorderid
@@ -126,153 +100,102 @@ export default {
                 this.detail = res.data;
                 this.$refs.List.RefreshToComplete();
                 this.$refs.List.setHeight();
-
+                if (this.node) this.nodeClick(this.node)
             })
+        },
+        nodeClick(node) {
+            if (this.detail.status != '进行中') {
+                if (this.detail.status == '待开始') this.node = node;
+                this.$refs.but.onClick(true)
+                return
+            } else {
+                
+                console.log("跳转", node)
+
+
+            }
         }
     },
 }
 </script>
 
 <style lang="scss" scoped>
-.header {
+.container {
     position: relative;
-    padding: 10px;
-    width: 355px;
-    margin: 10px auto;
-    background: #fff;
-    border-radius: 4px;
-    box-sizing: border-box;
-    overflow: hidden;
-
-    .billno {
-        font-size: 16px;
-        font-weight: bold;
-        color: #004684;
-    }
-
-    .row {
-        display: flex;
-        font-size: 14px;
-        margin-top: 6px;
-
-        &-label {
-            flex-shrink: 0;
-            color: #666;
-        }
-    }
-
-    .status {
-        position: absolute;
-        top: 0;
-        right: 0;
-        padding: 4px 8px;
-        background: #FFEFEF;
-        color: #F65050;
-        font-size: 12px;
-        border-radius: 0 0 0 4px;
-    }
-}
 
-.label {
-    margin: 15px 0 10px 10px;
-    font-size: 13px;
-    color: #fff;
-}
-
-.users {
-    display: flex;
-    flex-wrap: wrap;
-    padding: 8px 6px 2px 6px;
-    width: 355px;
-    margin: 0 auto;
-    background: #fff;
-    border-radius: 4px;
-    box-sizing: border-box;
-    overflow: hidden;
-
-    .user {
-        padding: 2px 4px;
-        border: 1px solid #000;
-        color: #000;
-        font-size: 13px;
+    .header {
+        position: relative;
+        padding: 10px;
+        width: 355px;
+        margin: 10px auto;
+        background: #fff;
         border-radius: 4px;
-        margin-right: 6px;
-        margin-bottom: 6px;
         box-sizing: border-box;
-    }
+        overflow: hidden;
 
-    .leader {
-        background: #2A6AF2;
-        border: 0;
-        color: #fff;
-    }
-}
-
-.step-box {
-    width: 355px;
-    margin: 0 auto;
-    background: #fff;
-    box-sizing: border-box;
-    border-radius: 4px;
-    padding: 10px;
-    padding-top: 0;
-
-    .workorder {
-        width: 100%;
-        padding-bottom: 4px;
-        border-bottom: 1px dashed #ddd;
-
-        &-title {
+        .billno {
             font-size: 16px;
-            padding-top: 10px;
-            margin-bottom: 4px;
+            font-weight: bold;
+            color: #004684;
         }
 
-        .child {
-            padding: 6px;
-            border-radius: 4px;
-            overflow: hidden;
+        .row {
+            display: flex;
+            font-size: 14px;
+            margin-top: 6px;
 
-            &-title {
-                font-size: 14px;
+            &-label {
+                flex-shrink: 0;
+                color: #666;
             }
+        }
 
-            &-result {
-                margin-top: 4px;
-                display: flex;
-                align-items: center;
-
-                .have-not-begun {
-                    background: #E34D59;
-                }
+        .status {
+            position: absolute;
+            top: 0;
+            right: 0;
+            padding: 4px 8px;
+            background: #FFEFEF;
+            color: #F65050;
+            font-size: 12px;
+            border-radius: 0 0 0 4px;
+        }
+    }
 
-                .done {
-                    background: #4BA574;
-                }
+    .label {
+        margin: 15px 0 10px 10px;
+        font-size: 13px;
+        color: #fff;
+    }
 
-                .underway {
-                    background: #2151D1;
-                }
+    .users {
+        display: flex;
+        flex-wrap: wrap;
+        padding: 8px 6px 2px 6px;
+        width: 355px;
+        margin: 0 auto;
+        background: #fff;
+        border-radius: 4px;
+        box-sizing: border-box;
+        overflow: hidden;
 
-                .tag {
-                    font-size: 10px;
-                    padding: 4px;
-                    border-radius: 4px;
-                    color: #fff;
-                    margin-left: 6px;
-                }
+        .user {
+            padding: 2px 4px;
+            border: 1px solid #000;
+            color: #000;
+            font-size: 13px;
+            border-radius: 4px;
+            margin-right: 6px;
+            margin-bottom: 6px;
+            box-sizing: border-box;
+        }
 
-                .time {
-                    font-size: 14px;
-                    color: #999;
-                }
-            }
+        .leader {
+            background: #2A6AF2;
+            border: 0;
+            color: #fff;
         }
     }
 
-    .workorder:last-child {
-        padding-bottom: 0px;
-        border: 0;
-    }
 }
 </style>

+ 130 - 0
packageA/workOrder/modules/nodes.vue

@@ -0,0 +1,130 @@
+<template>
+    <view v-if="nodes.length">
+        <view class="label">进度</view>
+        <view class="step-box">
+            <view class="workorder" v-for="(item, index) in nodes" :key="item.sa_workorder_nodeid">
+                <view class="workorder-title">
+                    {{ index + 1 }}.{{ item.workpresetjson.workname }}
+                </view>
+                <navigator url="#" class="child" v-for="(child, childIndex) in item.child" @click="onClick(child)"
+                    :key="child.sa_workorder_nodeid">
+                    <view class="child-title">
+                        {{ index + 1 }}-{{ childIndex + 1 }}.{{ child.workpresetjson.workname }}
+                    </view>
+                    <view class="child-result">
+                        <view class="have-not-begun tag" v-if="child.status == 0">
+                            未开始
+                        </view>
+                        <block v-else>
+                            <view class="time">{{ child.changedate }}</view>
+                            <view class="done tag" v-if="child.status == 1">
+                                完成
+                            </view>
+                            <view class="underway tag" v-else>
+                                进行中
+                            </view>
+                        </block>
+                    </view>
+                </navigator>
+            </view>
+        </view>
+    </view>
+</template>
+
+<script>
+export default {
+    name: "nodes",
+    props: {
+        nodes: {
+            type: Array,
+            default: []
+        },
+        nodeClick: {
+            type: Function
+        }
+    },
+    data() {
+        return {
+            onClick(e) {
+                this.$emit("nodeClick", e)
+            },
+        }
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.label {
+    margin: 15px 0 10px 10px;
+    font-size: 13px;
+    color: #fff;
+}
+
+.step-box {
+    width: 355px;
+    margin: 0 auto;
+    background: #fff;
+    box-sizing: border-box;
+    border-radius: 4px;
+    padding: 10px;
+    padding-top: 0;
+
+    .workorder {
+        width: 100%;
+        padding-bottom: 4px;
+        border-bottom: 1px dashed #ddd;
+
+        &-title {
+            font-size: 16px;
+            padding-top: 10px;
+            margin-bottom: 4px;
+        }
+
+        .child {
+            padding: 6px;
+            border-radius: 4px;
+            overflow: hidden;
+
+            &-title {
+                font-size: 14px;
+            }
+
+            &-result {
+                margin-top: 4px;
+                display: flex;
+                align-items: center;
+
+                .have-not-begun {
+                    background: #E34D59;
+                }
+
+                .done {
+                    background: #4BA574;
+                }
+
+                .underway {
+                    background: #2151D1;
+                }
+
+                .tag {
+                    font-size: 10px;
+                    padding: 4px;
+                    border-radius: 4px;
+                    color: #fff;
+                    margin-left: 6px;
+                }
+
+                .time {
+                    font-size: 14px;
+                    color: #999;
+                }
+            }
+        }
+    }
+
+    .workorder:last-child {
+        padding-bottom: 0px;
+        border: 0;
+    }
+}
+</style>