Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

csg6 vor 1 Jahr
Ursprung
Commit
85c8dca755

+ 8 - 0
src/api/danger.js

@@ -31,6 +31,14 @@ export function getUnclaimedList (params) {
31 31
     params
32 32
   })
33 33
 }
34
+// 查询分析对象列表
35
+export function getHazardList (params) {
36
+  return Axios({
37
+    url: '/app/doubledefense/hazard/list',
38
+    method: 'get',
39
+    params
40
+  })
41
+}
34 42
 // 获取部门数据
35 43
 export function getDeptTree (params) {
36 44
   return Axios({

+ 5 - 1
src/components/module/select.vue

@@ -27,11 +27,13 @@
27 27
 
28 28
 <script>
29 29
 export default {
30
-  props: ['title', 'value', 'options', 'verify', 'id'],
30
+  props: ['title', 'value', 'options', 'verify', 'id', 'disable'],
31 31
   name: 'Select',
32 32
   watch: {
33 33
     value (cur, old) {
34
+      console.log(cur, '这是传授那个的')
34 35
       if (!cur) {
36
+        this.internalValue = ''
35 37
         this.reminder = true
36 38
         this.className = 'el_input_focusTrue'
37 39
       } else {
@@ -42,6 +44,7 @@ export default {
42 44
     },
43 45
     options (cur, old) {
44 46
       this.option = cur
47
+      this.internalValue = ''
45 48
     }
46 49
   },
47 50
   data () {
@@ -91,6 +94,7 @@ export default {
91 94
       this.internalValue = selectedOptions.map(option => option.text)[selectedOptions.length - 1]
92 95
     },
93 96
     focus () {
97
+      if (this.disable) return
94 98
       this.show = true
95 99
       if (!this.internalValue) {
96 100
         this.className = 'el_input_blur'

+ 54 - 3
src/views/home/danger/addDanger.vue

@@ -7,12 +7,20 @@
7 7
       <Input title="隐患名称" :verify="true" v-model="addForm.dangerName" />
8 8
       <Input title="隐患描述" :verify="false" v-model="dangerDesc" />
9 9
       <Select
10
+      :disable="dangerType"
10 11
         :verify="true"
11 12
         title="所在区域"
12 13
         :options="getAreaTree"
13 14
         v-model="addForm.areaId"
14 15
       />
15 16
       <Select
17
+      :disable="dangerType"
18
+        :verify="true"
19
+        title="分析对象名称"
20
+        :options="getAreaTree1"
21
+        v-model="addForm.hazardId"
22
+      />
23
+      <Select
16 24
         :verify="true"
17 25
         title="隐患来源"
18 26
         :options="dangerSrcList"
@@ -75,7 +83,8 @@ import {
75 83
   upload,
76 84
   getDangerItem,
77 85
   editDanger,
78
-  convertImageToBase64Str
86
+  convertImageToBase64Str,
87
+  getHazardList
79 88
 } from '@/api/danger'
80 89
 export default {
81 90
   name: 'Vueh5CbsAddDanger',
@@ -100,8 +109,24 @@ export default {
100 109
       return new Date(2010, 0, 1)
101 110
     }
102 111
   },
112
+  watch: {
113
+    addForm: {
114
+      handler (val) {
115
+        if (val.areaId && (val.areaId !== this.areaIdOld)) {
116
+          console.log('进来了', val.areaId, this.areaIdOld)
117
+          this.getHazardList(val.areaId)
118
+          this.areaIdOld = val.areaId
119
+        }
120
+      },
121
+      deep: true,
122
+      immediate: true
123
+    }
124
+  },
103 125
   data () {
104 126
     return {
127
+      areaIdOld: '.',
128
+      dangerType: false,
129
+      getAreaTree1: [], // 分析对象名称列表
105 130
       dangerImage: '',
106 131
       dangerDesc: '', // 隐患描述
107 132
       controlMeasures: '', // 任务名称
@@ -111,6 +136,7 @@ export default {
111 136
         registTime: '', // 发现时间
112 137
         dangerName: '', // 隐患名称
113 138
         areaId: '', // 所属区域
139
+        hazardId: '', // 分析对象名称
114 140
         dangerLevel: 0, // 隐患等级
115 141
         dangerSrc: '', // 隐患来源
116 142
         hazardDangerType: '', // 隐患类型
@@ -143,10 +169,17 @@ export default {
143 169
     }
144 170
   },
145 171
 
146
-  created () {
172
+  async created () {
147 173
     console.log(new Date('2023-09-25 15:55:12').getDate())
148 174
     if (this.$route.params.id) {
149
-      this.addForm.areaId = this.$route.params.id
175
+      this.dangerType = true
176
+      this.getAreaTree1 = this.$route.params.list
177
+      this.addForm.areaId = this.$route.params.areaId
178
+      this.areaIdOld = this.$route.params.areaId
179
+      this.addForm.hazardId = this.$route.params.hazardId
180
+      // await this.getHazardList(this.$route.params.areaId)
181
+      console.log(this.addForm.hazardId, '第一个')
182
+      console.log(this.addForm.areaId, '第二个')
150 183
     }
151 184
     if (this.$route.query.id) {
152 185
       getDangerItem(this.$route.query.id).then(({ data }) => {
@@ -158,6 +191,7 @@ export default {
158 191
           this.addForm.registTime = data.data.registTime
159 192
           this.addForm.dangerName = data.data.dangerName
160 193
           this.addForm.areaId = data.data.areaId
194
+          this.addForm.hazardId = data.data.hazardId
161 195
           this.addForm.dangerLevel = data.data.dangerLevel
162 196
           this.addForm.dangerSrc = data.data.dangerSrc
163 197
           this.addForm.hazardDangerType = data.data.hazardDangerType
@@ -180,6 +214,19 @@ export default {
180 214
   },
181 215
 
182 216
   methods: {
217
+    getHazardList (id) {
218
+      getHazardList({ areaId: id }).then(({ data }) => {
219
+        if (data.code === 200) {
220
+          this.getAreaTree1 = this.getUsers(data.data)
221
+          this.addForm.hazardId = ''
222
+        }
223
+      })
224
+    },
225
+    getUsers (data) {
226
+      return data.map(item => {
227
+        return { text: item.hazardName, value: item.id }
228
+      })
229
+    },
183 230
     async toBase (list) {
184 231
       for await (const item of list) {
185 232
         const { data } = await convertImageToBase64Str({ url: item })
@@ -246,6 +293,7 @@ export default {
246 293
           this.itemForm.registTime = this.addForm.registTime
247 294
           this.itemForm.dangerName = this.addForm.dangerName
248 295
           this.itemForm.areaId = this.addForm.areaId
296
+          this.itemForm.hazardId = this.addForm.hazardId
249 297
           this.itemForm.dangerLevel = this.addForm.dangerLevel
250 298
           this.itemForm.dangerSrc = this.addForm.dangerSrc
251 299
           this.itemForm.hazardDangerType = this.addForm.hazardDangerType
@@ -266,7 +314,10 @@ export default {
266 314
           })
267 315
         } else {
268 316
           addDanger({
317
+            riskMeasureId: this.$route.params.riskMeasureId || '',
318
+            checkTaskInventoryRecordId: this.$route.params.id || '',
269 319
             areaId: this.addForm.areaId,
320
+            hazardId: this.addForm.hazardId,
270 321
             controlMeasures: this.controlMeasures,
271 322
             dangerDesc: this.dangerDesc,
272 323
             dangerImage: this.dangerImage,

+ 12 - 6
src/views/home/danger/dangerDetails.vue

@@ -47,24 +47,30 @@
47 47
               <p>{{ itemForm.areaName }}</p>
48 48
             </div>
49 49
             <div class="right">
50
-              <span>隐患类型</span>
50
+              <span>分析对象名称</span>
51 51
               <p>
52
-                {{ $findItemById(dangerTypeList, itemForm.hazardDangerType) }}
52
+                {{ itemForm.hazardName }}
53 53
               </p>
54 54
             </div>
55 55
           </div>
56 56
           <div class="textMain">
57 57
             <div class="left">
58
+              <span>隐患类型</span>
59
+              <p>
60
+                {{ $findItemById(dangerTypeList, itemForm.hazardDangerType) }}
61
+              </p>
62
+            </div>
63
+            <div class="right">
58 64
               <span>隐患来源</span>
59 65
               <p>{{ $findItemById(dangerSrcList, itemForm.dangerSrc) }}</p>
60 66
             </div>
61
-            <div class="right">
67
+          </div>
68
+          <div class="textMain">
69
+            <div class="left">
62 70
               <span>隐患等级</span>
63 71
               <p>{{ itemForm.dangerLevel ? "重大隐患" : "一般隐患" }}</p>
64 72
             </div>
65
-          </div>
66
-          <div class="textMain">
67
-            <div class="center">
73
+            <div class="right">
68 74
               <span>隐患描述</span>
69 75
               <p>{{ itemForm.dangerDesc || "无" }}</p>
70 76
             </div>

+ 19 - 5
src/views/home/polling/inspect.vue

@@ -32,7 +32,7 @@
32 32
                     </p>
33 33
                 </div>
34 34
                 <template #right>
35
-                  <button class="appearBtn" @click="addDanger(pro.areaId)">隐患上报</button>
35
+                  <button class="appearBtn" @click="addDanger(pro)">隐患上报</button>
36 36
                 </template>
37 37
               </van-swipe-cell>
38 38
               <p style="text-align: center;" v-if="!childrenList1.length">
@@ -52,7 +52,7 @@
52 52
                     </p>
53 53
                   </div>
54 54
                   <template #right>
55
-                    <button class="appearBtn" @click="addDanger(pro.areaId)">隐患上报</button>
55
+                    <button class="appearBtn" @click="addDanger(pro)">隐患上报</button>
56 56
                   </template>
57 57
                 </van-swipe-cell>
58 58
                 <p style="text-align: center;" @click="setList" v-if="!typeBtn && childrenList.length">
@@ -74,7 +74,7 @@
74 74
                     </p>
75 75
                   </div>
76 76
                   <template #right>
77
-                    <button class="appearBtn" @click="addDanger(pro.areaId)">隐患上报</button>
77
+                    <button class="appearBtn" @click="addDanger(pro)">隐患上报</button>
78 78
                   </template>
79 79
                 </van-swipe-cell>
80 80
                 <p style="text-align: center;" @click="setList" v-if="!typeBtn && childrenList.length">
@@ -95,6 +95,9 @@ import {
95 95
   getAreaCheckTaskList,
96 96
   getCheckTaskInventoryListByRistUnitId
97 97
 } from '@/api/polling'
98
+import {
99
+  getHazardList
100
+} from '@/api/danger'
98 101
 export default {
99 102
   name: 'VueSkInspect',
100 103
 
@@ -124,8 +127,19 @@ export default {
124 127
   },
125 128
 
126 129
   methods: {
127
-    addDanger (id) {
128
-      this.$router.push({ name: 'addDanger', params: { id } })
130
+    addDanger (item) {
131
+      console.log(item)
132
+      getHazardList({ areaId: item.areaId }).then(({ data }) => {
133
+        if (data.code === 200) {
134
+          this.getAreaTree1 = this.getUsers(data.data)
135
+          this.$router.push({ name: 'addDanger', params: { id: item.id, hazardId: item.hazardId, areaId: item.areaId, riskMeasureId: item.riskMeasureId, list: this.getUsers(data.data) } })
136
+        }
137
+      })
138
+    },
139
+    getUsers (data) {
140
+      return data.map(item => {
141
+        return { text: item.hazardName, value: item.id }
142
+      })
129 143
     },
130 144
     setTab (name) {
131 145
       this.typeBtn = false

+ 21 - 21
src/views/home/polling/task.vue

@@ -32,27 +32,27 @@ export default {
32 32
   },
33 33
 
34 34
   mounted () {
35
-    const nfcCode = Android.getNfcCode()
36
-    console.log(nfcCode, '这是nfc卡号')
37
-    if (nfcCode) {
38
-      register(nfcCode).then((res) => {
39
-        console.log('页面刷新的,重新调用列表数据了')
40
-        if (res.code === 200) {
41
-          console.log('打卡成功!!!!!')
42
-          this.$notify({
43
-            type: 'success',
44
-            message: res.msg,
45
-            duration: 1500
46
-          })
47
-        }
48
-      }).catch(err => {
49
-        console.log(err, '走到错误了')
50
-      })
51
-      this.areaList()
52
-    }
53
-    this.nfcTime = setInterval(() => {
54
-      this.getNfc()
55
-    }, 1000)
35
+    // const nfcCode = Android.getNfcCode()
36
+    // console.log(nfcCode, '这是nfc卡号')
37
+    // if (nfcCode) {
38
+    //   register(nfcCode).then((res) => {
39
+    //     console.log('页面刷新的,重新调用列表数据了')
40
+    //     if (res.code === 200) {
41
+    //       console.log('打卡成功!!!!!')
42
+    //       this.$notify({
43
+    //         type: 'success',
44
+    //         message: res.msg,
45
+    //         duration: 1500
46
+    //       })
47
+    //     }
48
+    //   }).catch(err => {
49
+    //     console.log(err, '走到错误了')
50
+    //   })
51
+    //   this.areaList()
52
+    // }
53
+    // this.nfcTime = setInterval(() => {
54
+    //   this.getNfc()
55
+    // }, 1000)
56 56
     this.areaList()
57 57
   },
58 58
   beforeDestroy () {