浏览代码

工时修改

seimin 2 年之前
父节点
当前提交
656ebeec9b

+ 183 - 29
src/components/WorkHourManagement/index.vue

@@ -3,30 +3,52 @@
3 3
     <div class="head">
4 4
       <p>
5 5
         <span>{{ model.workName }}</span>
6
-        <span class="textRight"></span>
6
+        <span class="textRight">单价:<strong class="fontBold">{{ model.wage }}元</strong></span>
7 7
       </p>
8 8
     </div>
9 9
     <p>
10 10
       <span class="fl"></span>
11
-      <span class="fr"><span class="totalPrice">单次:<strong class="fontBold">{{model.wage}}元</strong></span></span>
11
+      <span class="fr"><strong class="fontBold">×{{ model.workHourNum2 }}{{ model.workUnit }}</strong>&emsp;&emsp;<span class="totalPrice">总价:<strong class="fontBold">{{model.workHourNum2 * model.wage}}元</strong></span></span>
12 12
     </p>
13
+    <!-- 弹窗 -->
14
+    <showModel
15
+      v-if="models.disjunctor"
16
+      :title="models.title"
17
+      :icon="models.icon"
18
+      :disjunctor="models.disjunctor"
19
+      @ok="ok"
20
+      @cancel="cancel"
21
+      @remove="remove"
22
+      :operate="models.operate"
23
+      selectName="gs_edit"
24
+      :data="gsData"
25
+    ></showModel>
13 26
   </div>
14 27
 </template>
15 28
 
16 29
 <script>
30
+import showModel from "../showModel/showModel.vue";
17 31
 export default {
18 32
   name: "WorkHourManagement",
19 33
   data() {
20 34
     return {
35
+      gsData: {},
21 36
       loadShow: true,
37
+      // 弹窗model
38
+      models: {
39
+        disjunctor: false
40
+      },
22 41
     };
23 42
   },
24 43
   props: ["model", "id", "summaryId", "incidentId", "summaryObj"],
44
+  components: {
45
+    showModel,
46
+  },
25 47
   methods: {
26 48
     // 移除
27 49
     remove(data) {
28 50
       console.log(data);
29
-      console.log(String(this.summaryObj.workHourManagementList.map(v => v.id).filter(v => v != this.id)))
51
+      return;
30 52
       const toast = this.$createToast({
31 53
         txt: "Loading...",
32 54
         mask: true
@@ -34,20 +56,82 @@ export default {
34 56
       toast.show();
35 57
       this.$http
36 58
         .post("service/bpm/data/addSummaryDoc", {
37
-            "workHourIds": String(this.summaryObj.workHourManagementList.map(v => v.id).filter(v => v != this.id)),
59
+            "workHourManagementList": [
60
+                {
61
+                    "workHourId": data.gs.id,
62
+                    "workHourNum": data.workHourNum
63
+                }
64
+            ],
38 65
             "summaryId": this.summaryId,
66
+            "remove": 'remove',
39 67
         })
40 68
         .then(res => {
41 69
           toast.hide();
70
+          this.models.disjunctor = false;
42 71
           if (res.data.status == 200) {
43 72
             this.$createDialog({
44 73
               type: "alert",
74
+              title: "操作成功",
45 75
               icon: "cubeic-right",
76
+              onConfirm: (e, promptValue) => {
77
+                this.loadShow = false;
78
+                this.$emit("refresh");
79
+              }
80
+            }).show();
81
+          } else {
82
+            this.$createDialog({
83
+              type: "alert",
84
+              title: "系统错误,请稍后再试!",
85
+              icon: "cubeic-wrong",
86
+              onConfirm: (e, promptValue) => {
87
+                this.loadShow = false;
88
+                this.$emit("refresh");
89
+              }
90
+            }).show();
91
+          }
92
+        });
93
+    },
94
+    //确定
95
+    ok(data) {
96
+      console.log(data);
97
+      const reg = /(^[1-9][0-9]*$)/;
98
+      if(!reg.test(data.workHourNum2)){
99
+          this.$createDialog({
100
+            type: "alert",
101
+            title: "请输入大于0的正整数!",
102
+            icon: "cubeic-warn"
103
+          }).show();
104
+          return;
105
+      }
106
+      const toast = this.$createToast({
107
+        txt: "Loading...",
108
+        mask: true
109
+      });
110
+      toast.show();
111
+      this.$http
112
+        .post("service/bpm/data/addSummaryDoc", {
113
+            "workHourManagementList": [
114
+                {
115
+                    "workHourId": data.gs.id,
116
+                    "workHourNum": data.workHourNum2,
117
+                    "workHourParent": data.gs.workHourParent
118
+                }
119
+            ],
120
+            "summaryId": this.summaryId,
121
+            "modifyNum": 'edit',
122
+        })
123
+        .then(res => {
124
+          toast.hide();
125
+          this.models.disjunctor = false;
126
+          if (res.data.status == 200) {
127
+            this.$createDialog({
128
+              type: "alert",
46 129
               title: "操作成功",
130
+              icon: "cubeic-right",
47 131
               onConfirm: (e, promptValue) => {
48 132
                 this.loadShow = false;
49 133
                 this.$emit("refresh");
50
-              },
134
+              }
51 135
             }).show();
52 136
           } else {
53 137
             this.$createDialog({
@@ -62,32 +146,102 @@ export default {
62 146
           }
63 147
         });
64 148
     },
149
+    //取消
150
+    cancel() {
151
+      this.models.disjunctor = false;
152
+    },
153
+    // 移除
154
+    // remove(data) {
155
+    //   console.log(data);
156
+    //   console.log(String(this.summaryObj.workHourManagementList.map(v => v.id).filter(v => v != this.id)))
157
+    //   const toast = this.$createToast({
158
+    //     txt: "Loading...",
159
+    //     mask: true
160
+    //   });
161
+    //   toast.show();
162
+    //   this.$http
163
+    //     .post("service/bpm/data/addSummaryDoc", {
164
+    //         "workHourIds": String(this.summaryObj.workHourManagementList.map(v => v.id).filter(v => v != this.id)),
165
+    //         "summaryId": this.summaryId,
166
+    //     })
167
+    //     .then(res => {
168
+    //       toast.hide();
169
+    //       if (res.data.status == 200) {
170
+    //         this.$createDialog({
171
+    //           type: "alert",
172
+    //           icon: "cubeic-right",
173
+    //           title: "操作成功",
174
+    //           onConfirm: (e, promptValue) => {
175
+    //             this.loadShow = false;
176
+    //             this.$emit("refresh");
177
+    //           },
178
+    //         }).show();
179
+    //       } else {
180
+    //         this.$createDialog({
181
+    //           type: "alert",
182
+    //           title: "系统错误,请稍后再试!",
183
+    //           icon: "cubeic-wrong",
184
+    //           onConfirm: (e, promptValue) => {
185
+    //             this.loadShow = false;
186
+    //             this.$emit("refresh");
187
+    //           }
188
+    //         }).show();
189
+    //       }
190
+    //     });
191
+    // },
65 192
     // 弹窗
66
-    showModal(item){
67
-      this.$createDialog({
68
-        type: "confirm",
69
-        title: "提示",
70
-        content: `您确认要移除工时【${item.workName}】吗`,
71
-        icon: "cubeic-right",
72
-        confirmBtn: {
73
-          text: "确定",
74
-          active: true,
75
-          disabled: false,
76
-          href: "javascript:;"
77
-        },
78
-        cancelBtn: {
79
-          text: "取消",
80
-          active: false,
81
-          disabled: false,
82
-          href: "javascript:;"
83
-        },
84
-        onConfirm: (e, promptValue) => {
85
-          this.loadShow = true;
86
-          this.remove(item);
193
+    showModal(item) {
194
+      console.log(item)
195
+      this.modelsData = item;
196
+      this.gsData = {
197
+        gs: {
198
+          wage: item.wage,
199
+          workName: item.workName,
200
+          workUnit: item.workUnit,
201
+          id: item.id,
202
+          workHourParent: item.parent?item.parent.id:undefined
87 203
         },
88
-        onCancel: () => {}
89
-      }).show();
90
-    }
204
+        incidentId: this.incidentId,
205
+        summaryId: this.summaryId,
206
+        workHourNum2: item.workHourNum2,
207
+      }
208
+      this.models = {
209
+        disjunctor: true,
210
+        title: "提示",
211
+        icon: "warn",
212
+        operate: {
213
+          ok: "确定",
214
+          cancel: "取消",
215
+          remove: '移除'
216
+        }
217
+      };
218
+    },
219
+    // 弹窗
220
+    // showModal(item){
221
+    //   this.$createDialog({
222
+    //     type: "confirm",
223
+    //     title: "提示",
224
+    //     content: `您确认要移除工时【${item.workName}${item.workUnit}】吗`,
225
+    //     icon: "cubeic-right",
226
+    //     confirmBtn: {
227
+    //       text: "确定",
228
+    //       active: true,
229
+    //       disabled: false,
230
+    //       href: "javascript:;"
231
+    //     },
232
+    //     cancelBtn: {
233
+    //       text: "取消",
234
+    //       active: false,
235
+    //       disabled: false,
236
+    //       href: "javascript:;"
237
+    //     },
238
+    //     onConfirm: (e, promptValue) => {
239
+    //       this.loadShow = true;
240
+    //       this.remove(item);
241
+    //     },
242
+    //     onCancel: () => {}
243
+    //   }).show();
244
+    // }
91 245
   },
92 246
   created() {
93 247
     console.log(this.model);

+ 14 - 1
src/components/showModel/showModel.vue

@@ -67,6 +67,12 @@
67 67
           <div class="hc_item">单价:{{ data.hc.endPrice }}元</div>
68 68
           <div class="hc_item">使用数量:<cube-input type="number" style="flex:1" v-model="consumablesNum"></cube-input></div>
69 69
         </div>
70
+        <!-- 工时 -->
71
+        <div class="select-wrap hc" v-if="selectName === 'gs_edit'">
72
+          <div class="hc_item">工时名称:{{ data.gs.workName }}<span v-if="data.workUnit">{{ data.gs.workUnit }}</span></div>
73
+          <div class="hc_item">单价:{{ data.gs.wage }}元</div>
74
+          <div class="hc_item">使用数量:<cube-input type="number" style="flex:1" v-model="workHourNum2"></cube-input></div>
75
+        </div>
70 76
       </div>
71 77
       <div class="showModel__footer">
72 78
         <div v-if="operate.ok" class="showModel__ok" @click="ok">
@@ -98,6 +104,7 @@ export default {
98 104
   data() {
99 105
     return {
100 106
       consumablesNum: this.data ? (this.data.consumablesNum ? this.data.consumablesNum : 1) : 1,
107
+      workHourNum2: this.data ? (this.data.workHourNum2 ? this.data.workHourNum2 : 1) : 1,
101 108
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
102 109
       logs: [],
103 110
       time: 5, //5秒后自动关闭
@@ -329,6 +336,8 @@ export default {
329 336
         this.$emit("ok", this.selectUserId);
330 337
       } else if (this.selectName === "hc_add" || this.selectName === "hc_edit") {
331 338
         this.$emit("ok", {hc: this.data.hc, consumablesNum:this.consumablesNum});
339
+      } else if (this.selectName === "gs_edit") {
340
+        this.$emit("ok", {gs: this.data.gs, workHourNum2:this.workHourNum2});
332 341
       } else if (this.textName === "textarea") {
333 342
         this.$emit("ok", this.textareaData);
334 343
       } else {
@@ -337,7 +346,11 @@ export default {
337 346
     },
338 347
     // 移除
339 348
     remove(){
340
-      this.$emit("remove", {hc: this.data.hc, consumablesNum:this.consumablesNum});
349
+      if(this.selectName === "hc_edit"){
350
+        this.$emit("remove", {hc: this.data.hc, consumablesNum:this.consumablesNum});
351
+      }else if(this.selectName === "gs_edit"){
352
+        this.$emit("remove", {gs: this.data.gs, workHourNum2:this.workHourNum2});
353
+      }
341 354
     },
342 355
     // 取消
343 356
     cancel() {

+ 1 - 1
src/router/index.js

@@ -116,7 +116,7 @@ export default new Router({
116 116
       },
117 117
     },
118 118
     {
119
-      path: '/main/workHourManagementTwo/:incidentId/:summaryId/:parentId/:parentName/:processInstanceId',
119
+      path: '/main/workHourManagementTwo/:incidentId/:summaryId/:parentId/:parentName/:parentUnit/:processInstanceId',
120 120
       name: 'WorkHourManagementTwo',
121 121
       component: WorkHourManagementTwo,
122 122
       meta: {

+ 2 - 2
src/views/WorkHourManagementOne.vue

@@ -16,7 +16,7 @@
16 16
               >
17 17
                 <div class="head">
18 18
                   <p>
19
-                    <span>{{ item.workName }}</span>
19
+                    <span>{{ item.workName }}<span v-if="item.workUnit">({{ item.workUnit }})</span></span>
20 20
                   </p>
21 21
                 </div>
22 22
               </div>
@@ -106,7 +106,7 @@ export default {
106 106
     // 弹窗
107 107
     toDetail(item) {
108 108
       this.$router.push({
109
-        path: `/main/WorkHourManagementTwo/${this.$route.params.incidentId}/${this.$route.params.summaryId}/${item.id}/${item.workName}/${this.$route.params.processInstanceId}`
109
+        path: `/main/WorkHourManagementTwo/${this.$route.params.incidentId}/${this.$route.params.summaryId}/${item.id}/${item.workName}/${item.workUnit}/${this.$route.params.processInstanceId}`
110 110
       });
111 111
     },
112 112
     // 获取列表

+ 15 - 7
src/views/WorkHourManagementTwo.vue

@@ -2,7 +2,7 @@
2 2
   <div class="bgColor">
3 3
     <div slot="content" class="scroll-wrapper">
4 4
       <div class="demo">
5
-        <div class="header">一级目录选择的是:{{ $route.params.parentName }}</div>
5
+        <div class="header">一级目录选择的是:{{ $route.params.parentName }}<span v-if="$route.params.parentUnit!=='undefined'">{{ $route.params.parentUnit }}</span></div>
6 6
         <div class="scroll-list-wrap">
7 7
           <cube-scroll
8 8
             :data="items"
@@ -47,6 +47,7 @@ import LoadIng from "./loading.vue";
47 47
 export default {
48 48
   data() {
49 49
     return {
50
+      workHourManagementList:[],
50 51
       itemsCopy:[],
51 52
       checkList:[],
52 53
       hcData: {},
@@ -80,6 +81,12 @@ export default {
80 81
     // 确定
81 82
     subVali(){
82 83
       console.log(this.checkList);
84
+      console.log(this.workHourManagementList);
85
+      let workHourManagementMap = {};
86
+      this.workHourManagementList.forEach(v => {
87
+        workHourManagementMap[v.id] = v.workHourNum2;
88
+      })
89
+      console.log(workHourManagementMap);
83 90
       const toast = this.$createToast({
84 91
         txt: "Loading...",
85 92
         mask: true
@@ -87,7 +94,8 @@ export default {
87 94
       toast.show();
88 95
       this.$http
89 96
         .post("service/bpm/data/addSummaryDoc", {
90
-            "workHourIds": String(this.checkList),
97
+            "workHourParent":this.$route.params.parentId,
98
+            "workHourManagementList": this.checkList.map(v => ({workHourId: v, workHourNum: workHourManagementMap[v] || 1, workHourParent: this.$route.params.parentId})),
91 99
             "summaryId": this.$route.params.summaryId
92 100
         })
93 101
         .then(res => {
@@ -130,7 +138,7 @@ export default {
130 138
     // 弹窗
131 139
     toDetail(item) {
132 140
       this.$router.push({
133
-        path: `/main/WorkHourManagementTwo/${this.$route.params.incidentId}/${this.summaryId}/${item.id}/${this.$route.params.processInstanceId}`
141
+        path: `/main/WorkHourManagementTwo/${this.$route.params.incidentId}/${this.summaryId}/${item.id}/${item.workName}/${item.workUnit}/${this.$route.params.processInstanceId}`
134 142
       });
135 143
     },
136 144
     // 获取列表
@@ -145,8 +153,8 @@ export default {
145 153
         )
146 154
         .then((res) => {
147 155
           if(res.data.status == 200){
148
-            let workHourManagementList = res.data.workHourManagementList || [];
149
-            this.checkList = workHourManagementList.map(v => v.id);
156
+            this.workHourManagementList = res.data.workHourManagementList || [];
157
+            this.checkList = this.workHourManagementList.map(v => v.id);
150 158
             console.log(this.checkList)
151 159
             // ###########################
152 160
             let postData = {
@@ -167,10 +175,10 @@ export default {
167 175
                     this.wushuju = false;
168 176
                     if (this.searching) {
169 177
                       this.items = res.data.list;
170
-                      this.itemsCopy = res.data.list.map(v => ({label:v.workName, value: v.id}));
178
+                      this.itemsCopy = res.data.list.map(v => ({label:v.workName + (v.workUnit?'('+v.workUnit+')':''), value: v.id}));
171 179
                     } else {
172 180
                       this.items = this.items.concat(res.data.list);
173
-                      this.itemsCopy = this.itemsCopy.concat(res.data.list.map(v => ({label:v.workName, value: v.id})));
181
+                      this.itemsCopy = this.itemsCopy.concat(res.data.list.map(v => ({label:v.workName + (v.workUnit?'('+v.workUnit+')':''), value: v.id})));
174 182
                     }
175 183
                   } else {
176 184
                     this.wushuju = true;

+ 8 - 13
src/views/summaryOrder.vue

@@ -43,7 +43,7 @@
43 43
             <span class="dash dash-jia"></span>
44 44
           </p>
45 45
           <p class="textCenter total">
46
-            <span>汇总单总价:<strong class="fontBold">{{ totalPriceConsumable + totalPriceWorkHourManagement }}元</strong></span>
46
+            <span>汇总单总价:<strong class="fontBold">{{ totalMaintenancePrice }}元</strong></span>
47 47
           </p>
48 48
         </div>
49 49
       </div>
@@ -71,8 +71,9 @@ export default {
71 71
   data() {
72 72
     return {
73 73
       // 耗材总价格
74
-      totalPriceConsumable: 0,
75
-      totalPriceWorkHourManagement: 0,
74
+      totalMaintenancePrice: null,
75
+      totalPriceConsumable: null,
76
+      totalPriceWorkHourManagement: null,
76 77
       summaryObj: {},
77 78
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
78 79
       id: "",
@@ -175,16 +176,10 @@ export default {
175 176
         toast.hide();
176 177
         if(res.data.status == 200){
177 178
           this.summaryObj = res.data;
178
-          if(this.summaryObj.consumableList){
179
-            this.totalPriceConsumable = this.summaryObj.consumableList.reduce((pre, current) => pre + current.consumableEndPrice * current.consumablesNum, 0)
180
-          }else{
181
-            this.totalPriceConsumable = 0;
182
-          }
183
-          if(this.summaryObj.workHourManagementList){
184
-            this.totalPriceWorkHourManagement = this.summaryObj.workHourManagementList.reduce((pre, current) => pre + current.wage, 0)
185
-          }else{
186
-            this.totalPriceWorkHourManagement = 0;
187
-          }
179
+          this.totalMaintenancePrice = this.summaryObj.totalMaintenancePrice;
180
+          this.totalMaintenancePrice = this.summaryObj.totalMaintenancePrice;
181
+          this.totalPriceConsumable = this.summaryObj.consumablePrice;
182
+          this.totalPriceWorkHourManagement = this.summaryObj.workHourPrice;
188 183
           this.summaryId = res.data.summaryId;
189 184
         }else if(res.data.status == 201){
190 185
           // 事件第一次绑定汇总单

+ 8 - 13
src/views/summaryOrderDetail.vue

@@ -23,7 +23,7 @@
23 23
             <span>工时总价:<strong class="fontBold">{{ totalPriceWorkHourManagement }}元</strong></span>
24 24
           </p>
25 25
           <p class="textCenter total">
26
-            <span>汇总单总价:<strong class="fontBold">{{ totalPriceConsumable + totalPriceWorkHourManagement }}元</strong></span>
26
+            <span>汇总单总价:<strong class="fontBold">{{ totalMaintenancePrice }}元</strong></span>
27 27
           </p>
28 28
         </div>
29 29
       </div>
@@ -50,8 +50,9 @@ export default {
50 50
   data() {
51 51
     return {
52 52
       // 耗材总价格
53
-      totalPriceConsumable: 0,
54
-      totalPriceWorkHourManagement: 0,
53
+      totalMaintenancePrice: null,
54
+      totalPriceConsumable: null,
55
+      totalPriceWorkHourManagement: null,
55 56
       summaryObj: {},
56 57
       loginUser: JSON.parse(localStorage.getItem("loginUser")),
57 58
       id: "",
@@ -113,16 +114,10 @@ export default {
113 114
         toast.hide();
114 115
         if(res.data.status == 200){
115 116
           this.summaryObj = res.data;
116
-          if(this.summaryObj.consumableList){
117
-            this.totalPriceConsumable = this.summaryObj.consumableList.reduce((pre, current) => pre + current.consumableEndPrice * current.consumablesNum, 0)
118
-          }else{
119
-            this.totalPriceConsumable = 0;
120
-          }
121
-          if(this.summaryObj.workHourManagementList){
122
-            this.totalPriceWorkHourManagement = this.summaryObj.workHourManagementList.reduce((pre, current) => pre + current.wage, 0)
123
-          }else{
124
-            this.totalPriceWorkHourManagement = 0;
125
-          }
117
+          this.totalMaintenancePrice = this.summaryObj.totalMaintenancePrice;
118
+          this.totalPriceConsumable = this.summaryObj.consumablePrice;
119
+          this.totalPriceWorkHourManagement = this.summaryObj.workHourPrice;
120
+
126 121
           this.summaryId = res.data.summaryId;
127 122
         }else if(res.data.status == 201){
128 123
           // 事件第一次绑定汇总单