linyanfei 3 years ago
parent
commit
322a505c33

+ 10 - 0
shanXiPlatform/src/api/branchoff/index.js

@@ -29,6 +29,7 @@ export function  getpointll(homeType , depotId) {
29
     method: 'get'
29
     method: 'get'
30
   })
30
   })
31
 }
31
 }
32
+//异常粮情省图的table
32
 export function  getyclq( data  ) {
33
 export function  getyclq( data  ) {
33
   return request({              
34
   return request({              
34
     url: `/csc-szls-business/grainConditionRecord/authority/getGrainErrorCount`,
35
     url: `/csc-szls-business/grainConditionRecord/authority/getGrainErrorCount`,
@@ -36,6 +37,15 @@ export function  getyclq( data  ) {
36
     data : data
37
     data : data
37
   })
38
   })
38
 }
39
 }
40
+//异常粮情库图的table
41
+export function  getyclqk( data  ) {
42
+  return request({              
43
+    url: `/csc-szls-business/grainConditionRecord/authority/getGrainErrorHouseList`,
44
+    method: 'post',
45
+    data : data
46
+  })
47
+}
48
+
39
 //异常粮情折线图
49
 //异常粮情折线图
40
 export function  getzxt( depotId) {
50
 export function  getzxt( depotId) {
41
   return request({
51
   return request({

+ 36 - 10
shanXiPlatform/src/api/grainCheck/index.js

@@ -11,14 +11,22 @@ export function getNewGrainInfo(data) {
11
   }
11
   }
12
 
12
 
13
 //  获取最全粮情信息
13
 //  获取最全粮情信息
14
-export function getAllPages(data) {
14
+/* export function getAllPages(data) {
15
     return request({
15
     return request({
16
       url: `csc-szls-business/grainConditionRecord/authority/getPage`,
16
       url: `csc-szls-business/grainConditionRecord/authority/getPage`,
17
       method: 'post',
17
       method: 'post',
18
       data
18
       data
19
+
19
     })
20
     })
20
-  }
21
+  } */
22
+  export function getAllPages(params) {
23
+    return request({
24
+      url: `csc-szls-business/grainConditionRecord/authority/getPage`,
25
+      method: 'get',
26
+      params
21
 
27
 
28
+    })
29
+  }
22
 // 新增时初始化页面数据
30
 // 新增时初始化页面数据
23
 export function getAddInfo(data) {
31
 export function getAddInfo(data) {
24
   return request({
32
   return request({
@@ -38,11 +46,11 @@ export function addInfo(data) {
38
 }
46
 }
39
 
47
 
40
   //查询
48
   //查询
41
-export function queryGrainInfo(data) {
49
+export function queryGrainInfo(params) {
42
   return request({
50
   return request({
43
     url: `csc-szls-business/grainConditionRecord/authority/getPage`,
51
     url: `csc-szls-business/grainConditionRecord/authority/getPage`,
44
-    method: 'post',
45
-    data
52
+    method: 'get',
53
+    params
46
   })
54
   })
47
 }
55
 }
48
 
56
 
@@ -51,7 +59,7 @@ export function queryGrainInfo(data) {
51
 //删除
59
 //删除
52
 export function deleteGrainInfo(id) {
60
 export function deleteGrainInfo(id) {
53
   return request({
61
   return request({
54
-    url: `csc-szls-business/grainConditionRecord/authority_button/deleteById/${id}`,
62
+    url: `csc-szls-business/grainConditionRecord/authority/deleteById/${id}`,
55
     method: 'delete',
63
     method: 'delete',
56
     // id
64
     // id
57
   })
65
   })
@@ -60,6 +68,7 @@ export function deleteGrainInfo(id) {
60
 //修改
68
 //修改
61
 export function editGrainInfo(data) {
69
 export function editGrainInfo(data) {
62
   return request({
70
   return request({
71
+    // url: `csc-szls-business/grainConditionRecord/authority_button/update`,
63
     url: `csc-szls-business/grainConditionRecord/authority_button/update`,
72
     url: `csc-szls-business/grainConditionRecord/authority_button/update`,
64
     method: 'post',
73
     method: 'post',
65
     data
74
     data
@@ -69,11 +78,12 @@ export function editGrainInfo(data) {
69
 //查看
78
 //查看
70
 export function checkGrainInfo(id) {
79
 export function checkGrainInfo(id) {
71
   return request({
80
   return request({
72
-    url: `csc-szls-business/grainConditionRecord/authority/getById/${id}`,
81
+    url: `csc-szls-business/grainRecordChild/authority/getById/${id}`,
73
     method: 'get'
82
     method: 'get'
74
   })
83
   })
75
 }
84
 }
76
 
85
 
86
+
77
 //处理待办项
87
 //处理待办项
78
 export function haveDone(id,auditState) {
88
 export function haveDone(id,auditState) {
79
   return request({
89
   return request({
@@ -88,7 +98,23 @@ export function haveDone1(userId,type,depotId,houseId,auditState) {
88
     method: 'get'
98
     method: 'get'
89
   })
99
   })
90
 }
100
 }
91
-//
101
+
102
+// 重构 --- 字典表查询(根据parentId查询)
103
+export function getGrainItems(parentId) {
104
+  return request({
105
+    // url: `/csc-szls-system-manage/basicsEnum/authority/getEnumAll`,
106
+    url: `/csc-szls-system-manage/basicsEnum/authority/getOnlyChildData/${parentId}`,
107
+    method: 'get',
108
+  })
109
+}
110
+
111
+//查询所有字典项 /basicsEnum/authority/getEnumAll
112
+export function getGrainAll() {
113
+  return request({
114
+     url: `/csc-szls-system-manage/basicsEnum/authority/getEnumAll`,
115
+    method: 'get',
116
+  })
117
+}
92
 //获取当前时间
118
 //获取当前时间
93
 export function getDateTimeNow(){
119
 export function getDateTimeNow(){
94
   var time = new Date();
120
   var time = new Date();
@@ -97,9 +123,9 @@ export function getDateTimeNow(){
97
 
123
 
98
   var hour = ("0" + time.getHours()).slice(-2)
124
   var hour = ("0" + time.getHours()).slice(-2)
99
   var minute = ("0" + time.getMinutes()).slice(-2)
125
   var minute = ("0" + time.getMinutes()).slice(-2)
100
-  // var second = ("0" + time.getSeconds()).slice(-2)
126
+  var second = ("0" + time.getSeconds()).slice(-2)
101
 
127
 
102
-  var today = time.getFullYear() + "-" + (month) + "-" + (day) + " " + (hour) + ":" + (minute)
128
+  var today = time.getFullYear() + "-" + (month) + "-" + (day) + " " + (hour) + ":" + (minute)+ ":" + (second)
103
   return today
129
   return today
104
 }
130
 }
105
 
131
 

+ 10 - 10
shanXiPlatform/src/api/sendMessageSocket.js

@@ -21,7 +21,7 @@ export function newWebSocket(uId,isclear){
21
     }
21
     }
22
     // 判断当前环境是否支持websocket
22
     // 判断当前环境是否支持websocket
23
     if(!isclear){
23
     if(!isclear){
24
-        console.log('开始连接websocket')
24
+        // console.log('开始连接websocket')
25
         window.websocketmessage = null;
25
         window.websocketmessage = null;
26
         if(window.WebSocket){
26
         if(window.WebSocket){
27
             if(!window.websocketmessage){
27
             if(!window.websocketmessage){
@@ -33,7 +33,7 @@ export function newWebSocket(uId,isclear){
33
             console.log("not support websocket");
33
             console.log("not support websocket");
34
         }
34
         }
35
     }
35
     }
36
- 
36
+
37
     // 连接成功建立的回调方法
37
     // 连接成功建立的回调方法
38
     window.websocketmessage.onopen = function(e){
38
     window.websocketmessage.onopen = function(e){
39
         heartCheck.reset().start();   // 成功建立连接后,重置心跳检测
39
         heartCheck.reset().start();   // 成功建立连接后,重置心跳检测
@@ -41,7 +41,7 @@ export function newWebSocket(uId,isclear){
41
     }
41
     }
42
     // 连接发生错误,连接错误时会继续尝试发起连接(尝试5次)
42
     // 连接发生错误,连接错误时会继续尝试发起连接(尝试5次)
43
     window.websocketmessage.onerror = function() {
43
     window.websocketmessage.onerror = function() {
44
-        console.log("onerror连接发生错误")
44
+        // console.log("onerror连接发生错误")
45
         websocket_connected_count++;
45
         websocket_connected_count++;
46
         // if(websocket_connected_count <= 5){
46
         // if(websocket_connected_count <= 5){
47
         //     newWebSocket(uId)
47
         //     newWebSocket(uId)
@@ -79,22 +79,22 @@ export function newWebSocket(uId,isclear){
79
                     messageData: JSON.stringify(messageData)
79
                     messageData: JSON.stringify(messageData)
80
                 })
80
                 })
81
             }
81
             }
82
-            
82
+
83
             // console.log('mymy',store.state.messageData)
83
             // console.log('mymy',store.state.messageData)
84
            //执行接收到消息的操作,一般是刷新UI
84
            //执行接收到消息的操作,一般是刷新UI
85
         }
85
         }
86
     }
86
     }
87
- 
87
+
88
     // 接受到服务端关闭连接时的回调方法
88
     // 接受到服务端关闭连接时的回调方法
89
     window.websocketmessage.onclose = function(){
89
     window.websocketmessage.onclose = function(){
90
-        console.log("onclose断开连接");
91
-        console.log(window.websocketmessage)
90
+        // console.log("onclose断开连接");
91
+        // console.log(window.websocketmessage)
92
     }
92
     }
93
     // 监听窗口事件,当窗口关闭时,主动断开websocket连接,防止连接没断开就关闭窗口,server端报错
93
     // 监听窗口事件,当窗口关闭时,主动断开websocket连接,防止连接没断开就关闭窗口,server端报错
94
     window.onbeforeunload = function(){
94
     window.onbeforeunload = function(){
95
         window.websocketmessage.close();
95
         window.websocketmessage.close();
96
     }
96
     }
97
- 
97
+
98
     // 心跳检测, 每隔一段时间检测连接状态,如果处于连接中,就向server端主动发送消息,来重置server端与客户端的最大连接时间,如果已经断开了,发起重连。
98
     // 心跳检测, 每隔一段时间检测连接状态,如果处于连接中,就向server端主动发送消息,来重置server端与客户端的最大连接时间,如果已经断开了,发起重连。
99
     var heartCheck = {
99
     var heartCheck = {
100
         timeout: 56*60*1000,        // 56分钟发一次心跳,比server端设置的连接时间稍微小一点,在接近断开的情况下以通信的方式去重置连接时间。
100
         timeout: 56*60*1000,        // 56分钟发一次心跳,比server端设置的连接时间稍微小一点,在接近断开的情况下以通信的方式去重置连接时间。
@@ -112,7 +112,7 @@ export function newWebSocket(uId,isclear){
112
                     if(window.websocketmessage.readyState == 1){
112
                     if(window.websocketmessage.readyState == 1){
113
                         // window.websocketmessage.send("ping");
113
                         // window.websocketmessage.send("ping");
114
                         console.log("心跳检测结果: 连接状态正常");
114
                         console.log("心跳检测结果: 连接状态正常");
115
-                        heartCheck.reset().start();    
115
+                        heartCheck.reset().start();
116
                     }else{
116
                     }else{
117
                         console.log('getuser',getUser())
117
                         console.log('getuser',getUser())
118
                         if(getUser()){
118
                         if(getUser()){
@@ -147,4 +147,4 @@ export function removeSession(id) {
147
       url: `/csc-szls-message/sysMessage/authority/removeSession/${id}`,
147
       url: `/csc-szls-message/sysMessage/authority/removeSession/${id}`,
148
       method: 'get',
148
       method: 'get',
149
     })
149
     })
150
-}
150
+}

+ 1 - 0
shanXiPlatform/src/layoutt/index.vue

@@ -42,6 +42,7 @@
42
       <span class="myspan">当前所在位置: 首页></span>
42
       <span class="myspan">当前所在位置: 首页></span>
43
       <span class="myspan" v-if="this.$store.state.isshowLibrary && this.$route.query.midprovinceName == '山西省'">山西省></span>
43
       <span class="myspan" v-if="this.$store.state.isshowLibrary && this.$route.query.midprovinceName == '山西省'">山西省></span>
44
       <span class="myspan" v-if="this.$store.state.isshowLibrary && this.$route.query.midprovinceName == ''">{{this.$store.state.depotName}}></span>
44
       <span class="myspan" v-if="this.$store.state.isshowLibrary && this.$route.query.midprovinceName == ''">{{this.$store.state.depotName}}></span>
45
+      <span class="myspan" v-if="this.$store.state.isshowLibrary && this.$route.query.midprovinceName != '' && this.$route.query.midprovinceName != '山西省'">{{this.$route.query.midprovinceName}}></span>
45
       <breadcrumb id="breadcrumb-container" style="height:54px;line-height:54px; " class="breadcrumb-container" />
46
       <breadcrumb id="breadcrumb-container" style="height:54px;line-height:54px; " class="breadcrumb-container" />
46
     </div>
47
     </div>
47
     <app-main></app-main>
48
     <app-main></app-main>

+ 8 - 0
shanXiPlatform/src/router/index.js

@@ -348,6 +348,14 @@ export const constantRoutes = [
348
         meta: { title: '异常粮情', icon: 'dashboard',isshowLibrary:true, affix: true },
348
         meta: { title: '异常粮情', icon: 'dashboard',isshowLibrary:true, affix: true },
349
       },
349
       },
350
       {
350
       {
351
+        path: 'cnyclqtable',
352
+        component: () => import('@/views/home/cnyclqtable'),
353
+        name: 'cnyclqtable',
354
+        hidden: true,
355
+        meta: { title: '粮情检查', icon: 'dashboard',isshowLibrary:true, affix: true },
356
+      },
357
+      
358
+      {
351
         path: 'gzjftable',
359
         path: 'gzjftable',
352
         component: () => import('@/views/home/gzjftable'),
360
         component: () => import('@/views/home/gzjftable'),
353
         name: 'gzjftable',
361
         name: 'gzjftable',

+ 206 - 0
shanXiPlatform/src/views/home/cnyclqtable.vue

@@ -0,0 +1,206 @@
1
+<template>
2
+    <div class="global">
3
+        <div class="contentContainerGg">
4
+            <div class="container">
5
+                <el-form :inline="true">
6
+                    <el-form-item label="时间:">
7
+                        <el-date-picker @change="timechange" id="getWeek" v-model="datetime" type="week" format="yyyy年WW周" placeholder="选择周">
8
+                        </el-date-picker>
9
+                    </el-form-item>
10
+                    <el-form-item>
11
+                        <el-button icon="el-icon-search" type="success" plain @click="getList()">
12
+                            查询</el-button>
13
+                    </el-form-item>
14
+                </el-form>
15
+                <el-table border :data="tableList" highlight-current-row style="width:100%" :header-cell-style="{background:'#f8f8f8'}">
16
+                    <el-table-column property="depotName" label="时间" align="center">
17
+                        <template slot-scope="scope">
18
+                            {{ scope.row.yearJoinWeek}}
19
+                        </template>
20
+                    </el-table-column>
21
+                    <el-table-column property="depotName" label="仓房" align="center">
22
+                        <template slot-scope="scope">
23
+                            <span style="color:green;" @click="houseclick(scope.$index, scope.row)"> {{ hourseDic[scope.row.houseId] }}</span>
24
+                        </template>
25
+                    </el-table-column>
26
+                    <el-table-column property="depotName" label="所属公司" align="center">
27
+                        <template slot-scope="scope">
28
+                            {{ depotDic[scope.row.depotId] }}
29
+                        </template>
30
+                    </el-table-column>
31
+                    <el-table-column label="粮情异常情况" align="center">
32
+                        <template slot-scope="scope">
33
+                            <p style="height:45px;line-height:45px;margin:0;padding-top:7px;">
34
+                                <span class='colorspano' v-if="scope.row.grainError == '191'"></span>
35
+                                <span class='colorspant' v-if="scope.row.grainError != '191'"></span>
36
+                            </p>
37
+                        </template>
38
+                    </el-table-column>
39
+                    <el-table-column property="operation" label="操作" align="center">
40
+                        <template slot-scope="scope">
41
+                            <el-button size="mini" type="detailbtn" @click="detailbtn(scope.$index, scope.row )">详情</el-button>
42
+                        </template>
43
+                    </el-table-column>
44
+                </el-table>
45
+                <div class="pagination-container">
46
+                    <el-pagination class="right" background :current-page.sync="listQuery.page" :page-size="listQuery.limit" :page-sizes="[10,20,30,40]" :total="total" @size-change="sizeChange" @current-change="pageChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
47
+                </div>
48
+            </div>
49
+        </div>
50
+    </div>
51
+</template>
52
+<script>
53
+import { getcf } from "@/api/organizationalStructureManagement/index.js"
54
+import { getyclqk } from "@/api/branchoff/index.js"
55
+export default {
56
+    data() {
57
+        return {
58
+            datetime: "",
59
+            // 列表数据
60
+            tableList: [],
61
+            // 分页
62
+            total: 0,
63
+            listLoading: true,
64
+            listQuery: {
65
+                page: 1,
66
+                limit: 10
67
+            },
68
+            roleList: [],
69
+            depotDic: [],
70
+            checkYear: "",
71
+            checkYearWeek: "",
72
+            condition: {}
73
+        }
74
+    },
75
+    created() {
76
+        this.condition = {
77
+            depotId: this.$route.query.depotId
78
+        }
79
+        this.getList()
80
+        this.depotDic = JSON.parse(localStorage.getItem("deportDic"))
81
+        this.hourseDic = JSON.parse(localStorage.getItem("hourseDic"))
82
+    },
83
+    methods: {
84
+        houseclick(index, row) {
85
+            this.$store.commit({
86
+                type: "changeDepotId",
87
+                depotId: row.depotId
88
+            })
89
+            this.$store.commit({
90
+                type: "changeHouseId",
91
+                houseId: row.houseId
92
+            })
93
+            this.$store.commit({
94
+                type: "changeHouseName",
95
+                houseName: this.hourseDic[row.houseId]
96
+            })
97
+            this.$store.commit({
98
+                type: "changeDepotName",
99
+                depotName: this.depotDic[row.depotId]
100
+            })
101
+            this.$router.push("/countQuality/warehouseInformation")
102
+        },
103
+        timechange() {
104
+            this.$nextTick(() => {
105
+                let week = document.querySelector("#getWeek").value
106
+                if (week == "") {
107
+                    this.condition = {
108
+                        depotId: this.$route.query.depotId
109
+                    }
110
+                    return
111
+                }
112
+                console.log(week, "weekweek")
113
+                this.checkYear = week.slice(0, 4)
114
+                this.checkYearWeek = week.slice(5, 7)
115
+                this.condition = {
116
+                    depotId: this.$route.query.depotId,
117
+                    checkYear: this.checkYear,
118
+                    checkYearWeek: this.checkYearWeek
119
+                }
120
+            })
121
+        },
122
+        getList() {
123
+            var condition = JSON.stringify(this.condition)
124
+            let data = {
125
+                condition: condition,
126
+                pageIndex: this.listQuery.page,
127
+                pageSize: this.listQuery.limit
128
+            }
129
+            getyclqk(data)
130
+                .then(res => {
131
+                    if (res.code == 200) {
132
+                        this.tableList = res.data.records
133
+                        this.listQuery.limit = res.data.size
134
+                        this.total = res.data.total
135
+                    } else {
136
+                        this.$message({
137
+                            type: "error",
138
+                            message: res.msg
139
+                        })
140
+                    }
141
+                })
142
+                .catch(err => {
143
+                    console.log(err)
144
+                })
145
+        },
146
+        sizeChange(v) {
147
+            this.listQuery.limit = v
148
+            this.getList()
149
+        },
150
+        pageChange(v) {
151
+            this.listQuery.page = v
152
+            this.getList()
153
+        },
154
+        detailbtn(index, row) {
155
+            this.$store.commit({
156
+                type: "changeDepotId",
157
+                depotId: row.depotId
158
+            })
159
+            this.$store.commit({
160
+                type: "changeHouseId",
161
+                houseId: row.houseId
162
+            })
163
+            this.$store.commit({
164
+                type: "changeHouseName",
165
+                houseName: this.hourseDic[row.houseId]
166
+            })
167
+            this.$store.commit({
168
+                type: "changeDepotName",
169
+                depotName: this.depotDic[row.depotId]
170
+            })
171
+            this.$router.push({
172
+                name: "AllGrain"
173
+            })
174
+        }
175
+    }
176
+}
177
+</script>
178
+<style lang="scss" scoped>
179
+.top {
180
+    height: 40px;
181
+    line-height: 40px;
182
+    border-bottom: 1px solid #ccc;
183
+}
184
+.container {
185
+    padding: 10px;
186
+}
187
+.pagination-container {
188
+    margin-top: 10px;
189
+    margin-right: 20px;
190
+    text-align: right;
191
+}
192
+.colorspano {
193
+    width: 140px;
194
+    height: 30px;
195
+    background-color: #199856;
196
+    display: inline-block;
197
+    border-radius: 5px;
198
+}
199
+.colorspant {
200
+    width: 140px;
201
+    height: 30px;
202
+    background-color: #ffff00;
203
+    display: inline-block;
204
+    border-radius: 5px;
205
+}
206
+</style>

+ 1 - 1
shanXiPlatform/src/views/home/storageStatusTable.vue

@@ -97,4 +97,4 @@ export default {
97
     margin-right: 20px;
97
     margin-right: 20px;
98
     text-align: right;
98
     text-align: right;
99
 }
99
 }
100
-</style>
100
+</style>

+ 28 - 30
shanXiPlatform/src/views/home/yclqtable.vue

@@ -13,32 +13,18 @@
13
                     </el-form-item>
13
                     </el-form-item>
14
                 </el-form>
14
                 </el-form>
15
                 <el-table border :data="tableList" highlight-current-row style="width:100%" :header-cell-style="{background:'#f8f8f8'}">
15
                 <el-table border :data="tableList" highlight-current-row style="width:100%" :header-cell-style="{background:'#f8f8f8'}">
16
-                    <!-- <el-table-column prop="operationTime" label="时间" align="center" /> -->
17
                     <el-table-column property="depotName" label="时间" align="center">
16
                     <el-table-column property="depotName" label="时间" align="center">
18
                         <template slot-scope="scope">
17
                         <template slot-scope="scope">
19
-                            {{ scope.row.checkYear }}年 {{ scope.row.checkYearWeek}}周
18
+                            {{ scope.row.yearJoinWeek}}
20
                         </template>
19
                         </template>
21
                     </el-table-column>
20
                     </el-table-column>
22
-                    <el-table-column v-if="this.$route.query.isshow" property="depotName" label="仓房" align="center">
21
+                    <el-table-column property="depotName" label="公司" align="center">
23
                         <template slot-scope="scope">
22
                         <template slot-scope="scope">
24
-                            <span style="color:green;" > {{ scope.row.depotId }}</span>
23
+                            {{ depotDic[scope.row.depotId] }}
25
                         </template>
24
                         </template>
26
                     </el-table-column>
25
                     </el-table-column>
27
-                    <el-table-column  property="depotName" label="公司" align="center">
28
-                        <template slot-scope="scope" >
29
-                             {{ depotDic[scope.row.depotId] }} 
30
-                        </template>
31
-                    </el-table-column>
32
-                    <el-table-column v-if="this.$route.query.isshow" label="粮情异常情况" align="center">
33
-                        <template slot-scope="scope">
34
-                            <p style="height:45px;line-height:45px;margin:0;padding-top:7px;">
35
-                                <span class='colorspano' v-if="scope.row.grainError == '191'"></span>
36
-                                <span class='colorspant' v-if="scope.row.grainError != '191'"></span>
37
-                            </p>
38
-                        </template>
39
-                    </el-table-column>
40
-                    <el-table-column v-if="!this.$route.query.isshow" prop="grainVarieties" label="仓房数量(个)" align="center" />
41
-                    <el-table-column v-if="!this.$route.query.isshow" prop="warehouseStatus" label="粮情异常仓房数量(个)" align="center" />
26
+                    <el-table-column  prop="houseCount" label="仓房数量(个)" align="center" />
27
+                    <el-table-column  prop="grainErrorCount" label="粮情异常仓房数量(个)" align="center" />
42
                     <el-table-column property="operation" label="操作" align="center">
28
                     <el-table-column property="operation" label="操作" align="center">
43
                         <template slot-scope="scope">
29
                         <template slot-scope="scope">
44
                             <el-button size="mini" type="detailbtn" @click="detailbtn(scope.$index, scope.row)">详情</el-button>
30
                             <el-button size="mini" type="detailbtn" @click="detailbtn(scope.$index, scope.row)">详情</el-button>
@@ -69,10 +55,16 @@ export default {
69
                 limit: 10
55
                 limit: 10
70
             },
56
             },
71
             roleList: [],
57
             roleList: [],
72
-            depotDic: []
58
+            depotDic: [],
59
+            checkYear: "",
60
+            checkYearWeek: "",
61
+            condition: {}
73
         }
62
         }
74
     },
63
     },
75
     created() {
64
     created() {
65
+        this.condition = {
66
+            depotId: this.$route.query.depotId
67
+        }
76
         this.getList()
68
         this.getList()
77
         this.depotDic = JSON.parse(localStorage.getItem("deportDic"))
69
         this.depotDic = JSON.parse(localStorage.getItem("deportDic"))
78
     },
70
     },
@@ -80,18 +72,24 @@ export default {
80
         timechange() {
72
         timechange() {
81
             this.$nextTick(() => {
73
             this.$nextTick(() => {
82
                 let week = document.querySelector("#getWeek").value
74
                 let week = document.querySelector("#getWeek").value
75
+                if (week == "") {
76
+                    this.condition = {
77
+                        depotId: this.$route.query.depotId
78
+                    }
79
+                    return
80
+                }
81
+                console.log(week, "weekweek")
83
                 this.checkYear = week.slice(0, 4)
82
                 this.checkYear = week.slice(0, 4)
84
                 this.checkYearWeek = week.slice(5, 7)
83
                 this.checkYearWeek = week.slice(5, 7)
84
+                this.condition = {
85
+                    depotId: this.$route.query.depotId,
86
+                    checkYear: this.checkYear,
87
+                    checkYearWeek: this.checkYearWeek
88
+                }
85
             })
89
             })
86
         },
90
         },
87
         getList() {
91
         getList() {
88
-            var condition = {
89
-                // depotId: this.$store.state.depotId,
90
-                depotId: this.$route.query.depotId,
91
-                checkYear: this.checkYear,
92
-                checkYearWeek: this.checkYearWeek
93
-            }
94
-            condition = JSON.stringify(condition)
92
+            var condition = JSON.stringify(this.condition)
95
             let data = {
93
             let data = {
96
                 condition: condition,
94
                 condition: condition,
97
                 pageIndex: this.listQuery.page,
95
                 pageIndex: this.listQuery.page,
@@ -124,10 +122,10 @@ export default {
124
         },
122
         },
125
         detailbtn(index, row) {
123
         detailbtn(index, row) {
126
             this.$router.push({
124
             this.$router.push({
127
-                name: "AllGrain",
125
+                name: "cnyclqtable",
128
                 query: {
126
                 query: {
129
-                    // depotId: row.depotId,
130
-                    // midprovinceName: this.$route.query.midprovinceName
127
+                    depotId: row.depotId,
128
+                    midprovinceName: this.depotDic[row.depotId]
131
                 }
129
                 }
132
             })
130
             })
133
         }
131
         }

+ 4 - 4
shanXiPlatform/src/views/login/index.vue

@@ -236,7 +236,7 @@ export default {
236
                   res.data.tokenInfo.access_token
236
                   res.data.tokenInfo.access_token
237
                 setToken(Authorization)
237
                 setToken(Authorization)
238
                 setUser(res.data.user)
238
                 setUser(res.data.user)
239
-                
239
+
240
                 this.getDeportDic()
240
                 this.getDeportDic()
241
                 this.getHourseDic()
241
                 this.getHourseDic()
242
                 this.getPersonDic()
242
                 this.getPersonDic()
@@ -444,7 +444,7 @@ export default {
444
     // }
444
     // }
445
 
445
 
446
     getpermission(homeType){
446
     getpermission(homeType){
447
-     
447
+
448
       var userInfo= JSON.parse(localStorage.getItem("userInfo"));
448
       var userInfo= JSON.parse(localStorage.getItem("userInfo"));
449
       console.log(userInfo,"当前用户信息")
449
       console.log(userInfo,"当前用户信息")
450
       var params={
450
       var params={
@@ -453,10 +453,10 @@ export default {
453
       sidebarPermission(params)
453
       sidebarPermission(params)
454
       .then(res=>{
454
       .then(res=>{
455
         if(res.code == 200){
455
         if(res.code == 200){
456
-         
456
+
457
              var permissions = res.data;
457
              var permissions = res.data;
458
              console.log(permissions,"当前用户权限。。。。。。")
458
              console.log(permissions,"当前用户权限。。。。。。")
459
-            
459
+
460
             localStorage.setItem("permission",JSON.stringify(permissions));
460
             localStorage.setItem("permission",JSON.stringify(permissions));
461
              if (homeType === 1) {
461
              if (homeType === 1) {
462
                   // 跳转分公司首页
462
                   // 跳转分公司首页

+ 91 - 33
shanXiPlatform/src/views/reservesManagement/grainCheck/allGrain/index.vue

@@ -37,14 +37,21 @@
37
           ><div class="grid-content bg-purple">
37
           ><div class="grid-content bg-purple">
38
             <div class="top_select">
38
             <div class="top_select">
39
               <span class="demonstration"> 检查类型: </span>
39
               <span class="demonstration"> 检查类型: </span>
40
-              <el-select v-model="check_person" placeholder="请选择">
41
-                <el-option
40
+              <el-select v-model="kind" placeholder="请选择">
41
+                <!-- <el-option
42
                   v-for="item in options"
42
                   v-for="item in options"
43
                   :key="item.value"
43
                   :key="item.value"
44
                   :label="item.label"
44
                   :label="item.label"
45
                   :value="item.label"
45
                   :value="item.label"
46
                 >
46
                 >
47
-                </el-option>
47
+                </el-option> -->
48
+                <el-option
49
+              v-for="item in grainKind"
50
+              :key="item.enumId"
51
+              :label="item.enumName"
52
+              :value="item.enumId"
53
+            >
54
+            </el-option>
48
               </el-select>
55
               </el-select>
49
             </div>
56
             </div>
50
           </div>
57
           </div>
@@ -88,8 +95,25 @@
88
           :index="indexMethod"
95
           :index="indexMethod"
89
         >
96
         >
90
         </el-table-column>
97
         </el-table-column>
91
-        <el-table-column prop="checkTime" label="记录时间" align="center" />
92
-        <el-table-column prop="checkPerson" label="检查类型" align="center" />
98
+        <el-table-column prop="operationTime" label="记录时间" align="center" >
99
+           <template slot-scope="scope">
100
+            <span>{{
101
+              scope.row.operationTime == null
102
+                ? scope.row.operationTime
103
+                : scope.row.operationTime.slice(0, 16)
104
+            }}</span>
105
+          </template>
106
+        </el-table-column>
107
+
108
+        <el-table-column prop="enumId" label="检查类型" align="center">
109
+          <template slot-scope="scope">
110
+            <p v-for="item in grainKind" :key="item.enumId">
111
+              <span v-if="scope.row.enumId == item.enumId">{{
112
+                item.enumName
113
+              }}</span>
114
+            </p>
115
+          </template>
116
+        </el-table-column>
93
         <el-table-column
117
         <el-table-column
94
           prop="anomalousStatus"
118
           prop="anomalousStatus"
95
           label="有无异常"
119
           label="有无异常"
@@ -97,8 +121,8 @@
97
           width="100px"
121
           width="100px"
98
         >
122
         >
99
           <template slot-scope="scope">
123
           <template slot-scope="scope">
100
-            <div class="yellow" v-if="scope.row.anomalousStatus == '1'"></div>
101
-            <div class="green" v-if="scope.row.anomalousStatus !== '1'"></div>
124
+            <div class="yellow" v-if="scope.row.anomalousStatus === 1"></div>
125
+            <div class="green" v-if="scope.row.anomalousStatus !== 1"></div>
102
           </template>
126
           </template>
103
         </el-table-column>
127
         </el-table-column>
104
         <el-table-column prop="recordStatus" label="状态" align="center">
128
         <el-table-column prop="recordStatus" label="状态" align="center">
@@ -111,13 +135,13 @@
111
             ></div>
135
             ></div>
112
             <p
136
             <p
113
               v-if="scope.row.recordStatus == 1"
137
               v-if="scope.row.recordStatus == 1"
114
-              style="height:45px;line-height:45px;margin:0 ; padding-top:7px;"
138
+
115
             >
139
             >
116
               <span>已完成</span>
140
               <span>已完成</span>
117
             </p>
141
             </p>
118
             <p
142
             <p
119
               v-if="scope.row.recordStatus == 0"
143
               v-if="scope.row.recordStatus == 0"
120
-              style="height:45px;line-height:45px;margin:0 ; padding-top:7px;"
144
+
121
             >
145
             >
122
               <span>进行中</span>
146
               <span>进行中</span>
123
             </p>
147
             </p>
@@ -145,7 +169,7 @@
145
               size="mini"
169
               size="mini"
146
               @click="handleCheck(1, scope.$index, scope.row)"
170
               @click="handleCheck(1, scope.$index, scope.row)"
147
               v-if="
171
               v-if="
148
-                scope.row.checkPerson == '保管员每周检查粮情' &&
172
+                scope.row.enumId == 19 &&
149
                   $tools.IsPermission(134)
173
                   $tools.IsPermission(134)
150
               "
174
               "
151
               type="detailbtn"
175
               type="detailbtn"
@@ -158,7 +182,7 @@
158
               type="editbtn"
182
               type="editbtn"
159
               @click="handleEdit(3, scope.$index, scope.row)"
183
               @click="handleEdit(3, scope.$index, scope.row)"
160
               v-if="
184
               v-if="
161
-                scope.row.checkPerson == '保管员每周检查粮情' &&
185
+                scope.row.enumId == 19 &&
162
                   scope.row.recordStatus == 0 &&
186
                   scope.row.recordStatus == 0 &&
163
                   $tools.IsPermission(135)
187
                   $tools.IsPermission(135)
164
               "
188
               "
@@ -168,13 +192,13 @@
168
               size="mini"
192
               size="mini"
169
               type="dangerbtn"
193
               type="dangerbtn"
170
               v-if="
194
               v-if="
171
-                (scope.row.checkPerson == '保管员每周检查粮情' &&
195
+                (scope.row.enumId == 19 &&
172
                   $tools.IsPermission(332)) ||
196
                   $tools.IsPermission(332)) ||
173
-                  (scope.row.checkPerson == '主管科长每2周检查粮情' &&
197
+                  (scope.row.enumId == 20 &&
174
                     $tools.IsPermission(333)) ||
198
                     $tools.IsPermission(333)) ||
175
-                  (scope.row.checkPerson == '分管副总每月检查粮情' &&
199
+                  (scope.row.enumId == 21 &&
176
                     $tools.IsPermission(334)) ||
200
                     $tools.IsPermission(334)) ||
177
-                  (scope.row.checkPerson == '总经理每季检查粮情' &&
201
+                  (scope.row.enumId == 22 &&
178
                     $tools.IsPermission(335))
202
                     $tools.IsPermission(335))
179
               "
203
               "
180
               @click="handleDelete(scope.$index, scope.row)"
204
               @click="handleDelete(scope.$index, scope.row)"
@@ -207,7 +231,8 @@ import {
207
   checkGrainInfo,
231
   checkGrainInfo,
208
   deleteGrainInfo,
232
   deleteGrainInfo,
209
   editGrainInfo,
233
   editGrainInfo,
210
-  getDateTimeNow
234
+  getDateTimeNow,
235
+  getGrainItems
211
 } from "@/api/grainCheck/index"
236
 } from "@/api/grainCheck/index"
212
 export default {
237
 export default {
213
   // components: { Pagination },
238
   // components: { Pagination },
@@ -219,6 +244,8 @@ export default {
219
       data2: [],
244
       data2: [],
220
       depotId: this.$store.state.depotId,
245
       depotId: this.$store.state.depotId,
221
       houseId: this.$store.state.houseId,
246
       houseId: this.$store.state.houseId,
247
+      grainKind: [], //粮情检查类别
248
+
222
       // select 选项数据
249
       // select 选项数据
223
       options: [
250
       options: [
224
         {
251
         {
@@ -238,7 +265,7 @@ export default {
238
           label: "总经理每季检查粮情"
265
           label: "总经理每季检查粮情"
239
         }
266
         }
240
       ],
267
       ],
241
-      check_person: "",
268
+      kind:'',
242
       value2: "",
269
       value2: "",
243
       type: "", //判断是否从更多纪录跳转过来
270
       type: "", //判断是否从更多纪录跳转过来
244
       // 分页
271
       // 分页
@@ -255,15 +282,17 @@ export default {
255
   mounted() {
282
   mounted() {
256
     this.activeName = this.$route.name
283
     this.activeName = this.$route.name
257
     let routeParams = this.$route.query
284
     let routeParams = this.$route.query
258
-    // console.log(routeParams,'routerouteParams')
259
-    console.log(routeParams.type, "type")
260
-    console.log(this.data2, "this.data2")
285
+    console.log(routeParams,'routerouteParams')
286
+    // console.log(routeParams.type, "type")
287
+    // console.log(this.data2, "this.data2")
261
     this.type = routeParams.type
288
     this.type = routeParams.type
289
+    this.getGrainList() //进入页面先拿到粮情类型字典表
262
     if (this.type == "" || this.type == null || this.type == undefined) {
290
     if (this.type == "" || this.type == null || this.type == undefined) {
263
       this.getList()
291
       this.getList()
264
     } else if (this.type == 5) {
292
     } else if (this.type == 5) {
265
-      console.log(routeParams.data.checkPerson, "routeParams.data.checkPerson")
266
-      this.check_person = routeParams.data.checkPerson
293
+      // console.log(routeParams.data.enumId,'enumId')
294
+      this.kind = routeParams.data.enumId
295
+
267
       this.handleQuery()
296
       this.handleQuery()
268
     }
297
     }
269
   },
298
   },
@@ -280,6 +309,18 @@ export default {
280
     }
309
     }
281
   },
310
   },
282
   methods: {
311
   methods: {
312
+    // 获取粮情字典项
313
+    getGrainList() {
314
+      const parentId = 18 //粮情检查类型parentId
315
+      getGrainItems(parentId)
316
+        .then(res => {
317
+          console.log(res, "res字典粮情检查类型")
318
+          this.grainKind = res.data
319
+        })
320
+        .catch(err => {
321
+          console.log(err)
322
+        })
323
+    },
283
     // 获取数据
324
     // 获取数据
284
     getList() {
325
     getList() {
285
       let condition = {
326
       let condition = {
@@ -287,13 +328,13 @@ export default {
287
         depotId: this.depotId
328
         depotId: this.depotId
288
       }
329
       }
289
       let data = {
330
       let data = {
290
-        condition: JSON.stringify(condition),
331
+        Condition: JSON.stringify(condition),
291
         pageIndex: this.listQuery.page,
332
         pageIndex: this.listQuery.page,
292
         pageSize: this.listQuery.limit
333
         pageSize: this.listQuery.limit
293
       }
334
       }
294
       getAllPages(data)
335
       getAllPages(data)
295
         .then(res => {
336
         .then(res => {
296
-          console.log(res)
337
+          console.log(res,'全部粮情信息')
297
           if (res.code == 200) {
338
           if (res.code == 200) {
298
             console.log(res, "res.data.records")
339
             console.log(res, "res.data.records")
299
             this.data2 = res.data.records
340
             this.data2 = res.data.records
@@ -301,6 +342,7 @@ export default {
301
             this.listQuery.limit = res.data.size
342
             this.listQuery.limit = res.data.size
302
             this.total = res.data.total
343
             this.total = res.data.total
303
             // console.log(this.listQuery, "分页信息")
344
             // console.log(this.listQuery, "分页信息")
345
+            console.log(this.data2,'this.data2.....')
304
           }
346
           }
305
         })
347
         })
306
         .catch(err => {
348
         .catch(err => {
@@ -309,7 +351,7 @@ export default {
309
     },
351
     },
310
     // 查询
352
     // 查询
311
     handleQuery() {
353
     handleQuery() {
312
-      let condition = {
354
+      /* let condition = {
313
         check_person: this.check_person,
355
         check_person: this.check_person,
314
         // check_person: "科长每两周检查粮情",
356
         // check_person: "科长每两周检查粮情",
315
         check_start_time: this.value2[0],
357
         check_start_time: this.value2[0],
@@ -324,9 +366,22 @@ export default {
324
         pageSize: this.listQuery.limit,
366
         pageSize: this.listQuery.limit,
325
 
367
 
326
         condition: JSON.stringify(condition)
368
         condition: JSON.stringify(condition)
369
+      } */
370
+      let condition = {
371
+        houseId: this.houseId,
372
+        depotId: this.depotId,
373
+        startTime: this.value2[0],
374
+        endTime: this.value2[1],
375
+        enumId: this.kind
376
+      }
377
+      let data8 = {
378
+        pageIndex: this.listQuery.page,
379
+        pageSize: this.listQuery.limit,
380
+        condition: JSON.stringify(condition)
327
       }
381
       }
328
-      console.log(data3,'data3')
329
-      queryGrainInfo(data3)
382
+
383
+      console.log(data8,'data----')
384
+      queryGrainInfo(data8)
330
         .then(res => {
385
         .then(res => {
331
           this.data2 = res.data.records
386
           this.data2 = res.data.records
332
           this.total = res.data.total
387
           this.total = res.data.total
@@ -354,8 +409,8 @@ export default {
354
     },
409
     },
355
     // 删除
410
     // 删除
356
     handleDelete(a, b) {
411
     handleDelete(a, b) {
357
-      console.log(b.id)
358
-      // this.allGrainData.splice(a, 1)
412
+/*       console.log(a,'a')
413
+      // console.log(b.id,'b') */
359
 
414
 
360
       this.$confirm("确定删除该项记录?", "提示", {
415
       this.$confirm("确定删除该项记录?", "提示", {
361
         confirmButtonClass: "el-button--success is-plain",
416
         confirmButtonClass: "el-button--success is-plain",
@@ -366,22 +421,25 @@ export default {
366
         let id = b.id
421
         let id = b.id
367
         deleteGrainInfo(id)
422
         deleteGrainInfo(id)
368
           .then(res => {
423
           .then(res => {
369
-            console.log(res)
424
+            if(res.code == 200){
425
+              console.log(res,'res')
370
             this.$message({
426
             this.$message({
371
               message: "恭喜你,删除成功了!",
427
               message: "恭喜你,删除成功了!",
372
               type: "success"
428
               type: "success"
373
             })
429
             })
374
             this.getList()
430
             this.getList()
431
+            }
432
+
375
           })
433
           })
376
           .catch(err => {
434
           .catch(err => {
377
-            console.log(err)
435
+            console.log(err,'err信息')
378
           })
436
           })
379
       })
437
       })
380
     },
438
     },
381
     // 修改
439
     // 修改
382
     handleEdit(type, index, row) {
440
     handleEdit(type, index, row) {
383
       // console.log(row, "row")
441
       // console.log(row, "row")
384
-      row.checkTime = getDateTimeNow
442
+      row.checkTime = getDateTimeNow()
385
       // console.log(row.checkTime,'row.checktime')
443
       // console.log(row.checkTime,'row.checktime')
386
       this.$router.push({
444
       this.$router.push({
387
         path: "/grainCheck/addNewGrain",
445
         path: "/grainCheck/addNewGrain",
@@ -398,7 +456,7 @@ export default {
398
     //清空
456
     //清空
399
     clear() {
457
     clear() {
400
       this.value2 = ""
458
       this.value2 = ""
401
-      this.check_person = ""
459
+      this.kind = ""
402
       this.handleQuery() // 清空选项同时查询数据回显
460
       this.handleQuery() // 清空选项同时查询数据回显
403
     },
461
     },
404
     handleClick(tab, event) {
462
     handleClick(tab, event) {

+ 464 - 197
shanXiPlatform/src/views/reservesManagement/grainCheck/newGrain/addNewGrain.vue

@@ -5,8 +5,8 @@
5
         <span>粮情检测类型:</span>
5
         <span>粮情检测类型:</span>
6
         <span>{{ checkPerson }}</span>
6
         <span>{{ checkPerson }}</span>
7
       </div>
7
       </div>
8
-
9
-      <div class="table">
8
+      <!-- 2新增3修改 -->
9
+      <div class="table" v-show="type == 2 || type == 3">
10
         <el-table
10
         <el-table
11
           border
11
           border
12
           :header-cell-style="{ background: '#f8f8f8' }"
12
           :header-cell-style="{ background: '#f8f8f8' }"
@@ -23,53 +23,110 @@
23
             label="序号"
23
             label="序号"
24
             width="50px"
24
             width="50px"
25
           />
25
           />
26
+          <el-table-column prop="createDate" label="检查时间" align="center">
27
+            <template slot-scope="scope">
28
+              <span>{{
29
+                scope.row.createDate == null
30
+                  ? scope.row.createDate
31
+                  : scope.row.createDate.slice(0, 16)
32
+              }}</span>
33
+            </template>
34
+          </el-table-column>
26
           <el-table-column
35
           <el-table-column
27
-            prop="createTime"
28
-            label="检查时间"
36
+            prop="fieldValue"
37
+            label="检查项对应名称"
29
             align="center"
38
             align="center"
30
-          /><el-table-column
39
+            v-if="false"
40
+          />
41
+          <el-table-column prop="enumName" label="检查项" align="center" />
42
+          <el-table-column prop="enumOrder" label="选项" align="center">
43
+            <template slot-scope="scope">
44
+              <el-radio-group
45
+                v-model="scope.row.enumOrder"
46
+                @change.native="showClick(scope.$index, scope.row)"
47
+                :disabled="isDetail"
48
+              >
49
+                <el-radio label="1">是</el-radio>
50
+                <el-radio label="0">否</el-radio>
51
+                <el-link
52
+                  :underline="false"
53
+                  class="spike"
54
+                  id="spike"
55
+                  v-if="
56
+                    scope.row.enumOrder == 1 &&
57
+                      scope.row.enumName.indexOf('异常') != -1
58
+                  "
59
+                  @click="showHandler(scope.row)"
60
+                >
61
+                  {{ scope.row.enumName + "  >>" }}
62
+                </el-link>
63
+              </el-radio-group>
64
+            </template>
65
+          </el-table-column>
66
+        </el-table>
67
+      </div>
68
+      <!-- 1查看 -->
69
+      <div class="table" v-show="type == 1">
70
+        <el-table
71
+          border
72
+          :header-cell-style="{ background: '#f8f8f8' }"
73
+          ref="orderTable"
74
+          highlight-current-row
75
+          :data="tbdata"
76
+          height="631"
77
+          row-key="index"
78
+          @current-change="handleCurrentChange"
79
+        >
80
+          <el-table-column
81
+            type="index"
82
+            align="center"
83
+            label="序号"
84
+            width="50px"
85
+          />
86
+          <el-table-column prop="createDate" label="检查时间" align="center">
87
+            <template slot-scope="scope">
88
+              <span>{{
89
+                scope.row.createDate == null
90
+                  ? scope.row.createDate
91
+                  : scope.row.createDate.slice(0, 16)
92
+              }}</span>
93
+            </template>
94
+          </el-table-column>
95
+          <el-table-column
31
             prop="fieldValue"
96
             prop="fieldValue"
32
             label="检查项对应名称"
97
             label="检查项对应名称"
33
             align="center"
98
             align="center"
34
             v-if="false"
99
             v-if="false"
35
           />
100
           />
36
-          <el-table-column prop="fieldDetail" label="检查项" align="center" />
37
-          <el-table-column prop="whether" label="选项" align="center">
101
+          <el-table-column prop="enumName" label="检查项" align="center" />
102
+          <el-table-column prop="enumOrder" label="选项" align="center">
38
             <template slot-scope="scope">
103
             <template slot-scope="scope">
39
               <el-radio-group
104
               <el-radio-group
40
-                v-model="scope.row.whether.radio"
105
+                v-model="scope.row.enumOrder"
41
                 @change.native="showClick(scope.$index, scope.row)"
106
                 @change.native="showClick(scope.$index, scope.row)"
42
                 :disabled="isDetail"
107
                 :disabled="isDetail"
43
               >
108
               >
44
-                <el-radio label="1">{{ scope.row.whether.status1 }}</el-radio>
45
-                <el-radio label="0">{{ scope.row.whether.status2 }}</el-radio>
46
-                <!--                 <div v-if="type == '2' ">
47
-                  <el-button>新增显示</el-button>
48
-                </div> -->
49
-                <!-- <div v-if="type == '1' || type == '3'"> -->
109
+                <el-radio label="1">是</el-radio>
110
+                <el-radio label="0">否</el-radio>
50
                 <el-link
111
                 <el-link
51
                   :underline="false"
112
                   :underline="false"
52
                   class="spike"
113
                   class="spike"
53
                   id="spike"
114
                   id="spike"
54
                   v-if="
115
                   v-if="
55
-                    scope.row.whether.radio == 1 &&
56
-                      scope.row.fieldDetail.indexOf('异常') != -1
116
+                    scope.row.enumOrder == 1 &&
117
+                      scope.row.enumName.indexOf('异常') != -1
57
                   "
118
                   "
58
                   @click="showHandler(scope.row)"
119
                   @click="showHandler(scope.row)"
59
                 >
120
                 >
60
-                  {{ scope.row.fieldDetail + "  >>" }}
121
+                  {{ scope.row.enumName + "  >>" }}
61
                 </el-link>
122
                 </el-link>
62
-                <!-- </div> -->
63
-
64
-                <!-- <el-button   v-if='scope.row.whether.radio ==1 && scope.row.fieldDetail.indexOf("异常") != -1'>{{scope.row.fieldDetail + '  >>'}}</el-button> -->
65
               </el-radio-group>
123
               </el-radio-group>
66
             </template>
124
             </template>
67
           </el-table-column>
125
           </el-table-column>
68
         </el-table>
126
         </el-table>
69
       </div>
127
       </div>
70
-
71
       <div class="btns">
128
       <div class="btns">
72
-        <el-button type="cancel" @click="cancel()"> 返回 </el-button>
129
+        <el-button type="cancel" @click="back()"> 返回 </el-button>
73
 
130
 
74
         <el-button
131
         <el-button
75
           type="savebtn"
132
           type="savebtn"
@@ -87,10 +144,6 @@
87
           @click="saveInfo"
144
           @click="saveInfo"
88
           >保存</el-button
145
           >保存</el-button
89
         >
146
         >
90
-
91
-        <!--       <div v-if='type="1" || type="3"'>
92
-
93
-      </div> -->
94
       </div>
147
       </div>
95
 
148
 
96
       <!-- 新增虫害异常 -->
149
       <!-- 新增虫害异常 -->
@@ -126,7 +179,7 @@
126
           </el-form-item>
179
           </el-form-item>
127
         </el-form>
180
         </el-form>
128
         <div slot="footer" class="dialog-footer">
181
         <div slot="footer" class="dialog-footer">
129
-          <el-button @click="dialogFormVisible = false" type="cancel"
182
+          <el-button @click="cancel('abnormalPest')" type="cancel"
130
             >取 消</el-button
183
             >取 消</el-button
131
           >
184
           >
132
           <el-button type="savebtn" @click="saveFormData()">确 定</el-button>
185
           <el-button type="savebtn" @click="saveFormData()">确 定</el-button>
@@ -147,7 +200,7 @@
147
           ></el-input>
200
           ></el-input>
148
         </el-form>
201
         </el-form>
149
         <div slot="footer" class="dialog-footer">
202
         <div slot="footer" class="dialog-footer">
150
-          <el-button @click="dialogFormVisible1 = false" type="cancel"
203
+          <el-button @click="cancel('abnormalWater')" type="cancel"
151
             >取 消</el-button
204
             >取 消</el-button
152
           >
205
           >
153
           <el-button type="savebtn" @click="dialogFormVisible1 = false"
206
           <el-button type="savebtn" @click="dialogFormVisible1 = false"
@@ -171,7 +224,7 @@
171
           </el-form-item>
224
           </el-form-item>
172
         </el-form>
225
         </el-form>
173
         <div slot="footer" class="dialog-footer">
226
         <div slot="footer" class="dialog-footer">
174
-          <el-button @click="dialogFormVisible2 = false" type="cancel"
227
+          <el-button @click="cancel('abnormalGrain')" type="cancel"
175
             >取 消</el-button
228
             >取 消</el-button
176
           >
229
           >
177
           <el-button type="savebtn" @click="saveForm">确 定</el-button>
230
           <el-button type="savebtn" @click="saveForm">确 定</el-button>
@@ -190,7 +243,8 @@ import {
190
   addInfo,
243
   addInfo,
191
   getDateTimeNow,
244
   getDateTimeNow,
192
   haveDone, //处理待办
245
   haveDone, //处理待办
193
-  haveDone1
246
+  haveDone1,
247
+  getGrainItems
194
 } from "@/api/grainCheck/index"
248
 } from "@/api/grainCheck/index"
195
 export default {
249
 export default {
196
   name: "AddNewGrain",
250
   name: "AddNewGrain",
@@ -217,7 +271,7 @@ export default {
217
         pestDensity: "", // 虫害密度
271
         pestDensity: "", // 虫害密度
218
         occurArea: "", //发生面积
272
         occurArea: "", //发生面积
219
         occurPosition: "", // 发生部位
273
         occurPosition: "", // 发生部位
220
-        pestType: " ", // 虫害种类
274
+        pestType: "", // 虫害种类
221
         abnormalGrain: "", // 粮情异常描述
275
         abnormalGrain: "", // 粮情异常描述
222
         abnormalWater: "" // 水分检测异常描述
276
         abnormalWater: "" // 水分检测异常描述
223
       },
277
       },
@@ -230,8 +284,9 @@ export default {
230
       // 每行id
284
       // 每行id
231
       id: "",
285
       id: "",
232
       // 按钮类型
286
       // 按钮类型
233
-      type: "",
287
+      type: "", // 2:新增 1:查看 3:修改
234
       show: "true", //查看时不显示改为false
288
       show: "true", //查看时不显示改为false
289
+      isExist: false, //点击选项时判断是否存在该项数据,存在更新,不存在新增
235
       // 检查类型
290
       // 检查类型
236
       checkPerson: "",
291
       checkPerson: "",
237
       data2: {}, //待办传参过来的数据
292
       data2: {}, //待办传参过来的数据
@@ -261,27 +316,52 @@ export default {
261
           // pestOccurArea: "",
316
           // pestOccurArea: "",
262
           pestType: ""
317
           pestType: ""
263
         }
318
         }
319
+      },
320
+      // 重构后的新增数据模板
321
+      data5: {
322
+        grainConditionRecord: {
323
+          anomalousStatus: 0, //异常状态(0无异常,1有异常)
324
+          checkPerson: 0, //检查人
325
+          checkYear: 0, //检查年份(用于粮情异常等,做年统计)
326
+          checkYearWeek: 0, //检查所在年第几周
327
+          depotId: 0, //库id
328
+          enumId: 0, //检查类型
329
+          enumOrder: 0, //用于同公共枚举同步顺序
330
+          houseId: 0, //仓房id
331
+          id: 0, //粮情检测记录id
332
+          operationTime: "", //检查(操作)时间
333
+          recordStatus: 0, //记录状态(0进行中,1完成)
334
+          grainError: null, //粮情异常,值为对应的enumId
335
+          insectPestError: null, //虫害异常 值为对应的enumId
336
+          wetCheckError: null //水分检测异常 值为对应的enumId
337
+        },
338
+        grainConditionRecordChildren: [
339
+          /* {
340
+            anomalousStatus: 0, //是否异常_选项(0:否,1:是)
341
+            enumId: 0, //检查类型
342
+            id: 0, //粮情检查新增检查项
343
+            operationTime: "string", //操作时间
344
+            parentId: 0 //关联主表id(检查人id-保管员或总经理等)
345
+          } */
346
+        ]
264
       }
347
       }
265
     }
348
     }
266
   },
349
   },
267
-  /*   created(){
268
-     this.$nextTick(() => {
269
-
270
-    if (this.$route.query.type == '1') {
271
-      this.reast()
272
-      this.pageTitle = '查看'
273
-      this.isDetail = true
274
-      this.detailInfo()
275
-    }
276
-  }, */
277
 
350
 
278
   mounted() {
351
   mounted() {
279
     // 初始化的时候把参数拼接到要传输的数据里
352
     // 初始化的时候把参数拼接到要传输的数据里
280
     let routeParams = this.$route.query
353
     let routeParams = this.$route.query
281
-    /*     console.log(routeParams,'routeParams')
282
-    console.log(this.$store.state.depotId,'this.$store.state.depotId') */
354
+    // console.log(routeParams, "routeParams")
355
+    // console.log(this.$store.state.depotId, "this.$store.state.depotId")
283
     this.userInfo = JSON.parse(localStorage.getItem("userInfo"))
356
     this.userInfo = JSON.parse(localStorage.getItem("userInfo"))
284
     this.uid = this.userInfo.uid
357
     this.uid = this.userInfo.uid
358
+
359
+    if (routeParams.type == 3) {
360
+      this.data5.grainConditionRecord = routeParams.data
361
+    }
362
+
363
+    this.data5.grainConditionRecord.checkPerson = this.userInfo.uid
364
+    this.data5.grainConditionRecord.enumId = routeParams.data.enumId
285
     // console.log(this.$route.query.daibanObj,'this.$route.query.daibanObj')
365
     // console.log(this.$route.query.daibanObj,'this.$route.query.daibanObj')
286
     //待办数据
366
     //待办数据
287
     this.data2 = this.$route.query.daibanObj
367
     this.data2 = this.$route.query.daibanObj
@@ -291,17 +371,14 @@ export default {
291
     this.id = routeParams.data.id
371
     this.id = routeParams.data.id
292
     // console.log(this.id,'this.id')
372
     // console.log(this.id,'this.id')
293
     this.type = routeParams.type
373
     this.type = routeParams.type
294
-    this.checkPerson = routeParams.data.checkPerson
295
-    this.data = routeParams
296
-    this.describe = JSON.parse(routeParams.data.checkDescribe)
297
-    this.data3.checkTime = routeParams.data.checkTime
298
-    this.data3.checkPerson = routeParams.data.checkPerson
299
-    this.data3.recordStatus = routeParams.data.recordStatus
300
-    this.data3.anomalousStatus = routeParams.data.anomalousStatus
374
+    // console.log(this.type, "this.type....")
375
+    // this.checkPerson = routeParams.data.checkPerson
376
+    // this.data = routeParams
377
+    // this.describe = JSON.parse(routeParams.data.checkDescribe)
301
 
378
 
302
     // 获取用户的库id和仓房id
379
     // 获取用户的库id和仓房id
303
     let userinfo = JSON.parse(localStorage.getItem("userInfo"))
380
     let userinfo = JSON.parse(localStorage.getItem("userInfo"))
304
-    console.log(userinfo, "userinfo............")
381
+    // console.log(userinfo, "userinfo............")
305
     // this.depot_id = this.$store.state.depotId
382
     // this.depot_id = this.$store.state.depotId
306
     // this.house_id = userinfo.houseId
383
     // this.house_id = userinfo.houseId
307
     // console.log(routeParams.data,'routeParams.data')
384
     // console.log(routeParams.data,'routeParams.data')
@@ -309,144 +386,196 @@ export default {
309
       this.show = false
386
       this.show = false
310
     } else if (this.type == 3) {
387
     } else if (this.type == 3) {
311
       if (Object.getOwnPropertyNames(this.describe).length - 1 == 14) {
388
       if (Object.getOwnPropertyNames(this.describe).length - 1 == 14) {
312
-        console.log(Object.getOwnPropertyNames(this.describe).length, "0.0.0.")
389
+        // console.log(Object.getOwnPropertyNames(this.describe).length, "0.0.0.")
313
         this.flag = true
390
         this.flag = true
314
       }
391
       }
315
     }
392
     }
316
-    /* if(this.type !==2 && Object.getOwnPropertyNames(this.describe).length-1 ==14){
317
-      // console.log('this.flag')
318
-      this.flag = true
319
-    } */
393
+
320
     // 新增初始化数据
394
     // 新增初始化数据
321
     this.getinfo()
395
     this.getinfo()
322
   },
396
   },
323
 
397
 
324
   methods: {
398
   methods: {
325
     showHandler(val) {
399
     showHandler(val) {
326
-      // console.log(val,'val...')
327
-      if (val.fieldValue == "pest_abnormal") {
400
+      // console.log(val, "val...")
401
+      if (val.enumId == 189) {
328
         this.dialogFormVisible = true
402
         this.dialogFormVisible = true
329
-      } else if (val.fieldValue == "water_abnormal") {
403
+      } else if (val.enumId == 190) {
330
         this.dialogFormVisible1 = true
404
         this.dialogFormVisible1 = true
331
-      } else if (val.fieldValue == "grain_abnormal") {
405
+      } else if (val.enumId == 191) {
332
         this.dialogFormVisible2 = true
406
         this.dialogFormVisible2 = true
333
       }
407
       }
334
     },
408
     },
335
     getinfo() {
409
     getinfo() {
336
       // 目前只有一页,在前端写死了请求参数
410
       // 目前只有一页,在前端写死了请求参数
337
       // 在内部判断是新增修改还是查看
411
       // 在内部判断是新增修改还是查看
338
-      let condition = {
339
-        table_name: "grain_condition_record",
340
-        field_name: "check_list"
341
-      }
342
-      let data1 = {
343
-        pageIndex: 1,
344
-        pageSize: 30,
345
-        condition: JSON.stringify(condition)
346
-      }
347
-      // console.log(this.type,'type...')
348
-      if (this.type == "2") {
349
-        getAddInfo(data1)
412
+
413
+      // console.log(this.type, "type...")
414
+      if (this.type == 2) {
415
+        // console.log("新增页面初始化")
416
+        getGrainItems(19)
350
           .then(res => {
417
           .then(res => {
351
-            //新增初始化
352
-            this.tbdata = res.data.records
353
-            this.depot_id = this.$store.state.depotId
354
-            /*           console.log(this.$store.state.houseId,'this.$store.state.houseId')
355
-          console.log(this.$store.state.depotId,'this.$store.state.depotId')
356
-          console.log(this.data2,'this.data2')
357
-          console.log(this.userInfo.depotId,'this.userInfo.depotId') */
418
+            if (res.code == 200) {
419
+              // console.log(res, "res字典19")
420
+              this.tbdata = res.data
421
+              // 新增时把检查项数据给保存下来
422
+              this.data5.grainConditionRecordChildren = JSON.parse(
423
+                JSON.stringify(res.data)
424
+              )
425
+              this.data5.grainConditionRecordChildren.map(item => {
426
+                item.id = null
427
+                delete item.delFlag
428
+                delete item.parentId
429
+                delete item.remark
430
+                delete item.enumName
431
+                delete item.enumOrder
432
+                delete item.createDate
433
+              })
434
+              // console.log(this.tbdata, "tbdata.......")
435
+              // console.log(
436
+              //   this.data5.grainConditionRecordChildren,
437
+              //   " this.data5.grainConditionRecordChildren......."
438
+              // )
439
+            }
358
           })
440
           })
359
           .catch(err => {
441
           .catch(err => {
360
             console.log(err)
442
             console.log(err)
361
           })
443
           })
362
       } else if (this.type == "1") {
444
       } else if (this.type == "1") {
363
         //查看
445
         //查看
364
-        this.isDetail = true
365
-        getAddInfo(data1)
446
+        // 检查项初始化
447
+        getGrainItems(19)
366
           .then(res => {
448
           .then(res => {
367
-            // console.log(res)
368
-            this.tbdata = res.data.records
369
-            // console.log("产看修改初始化")
370
             if (res.code == 200) {
449
             if (res.code == 200) {
371
-              // 如果成功,就再次调用查看接口
450
+              this.tbdata = res.data
451
+              // this.data5.grainConditionRecordChildren = JSON.parse(JSON.stringify(res.data))
452
+              // console.log(this.tbdata, "tbdata.......")
453
+              //获取查看数据
372
               checkGrainInfo(this.id)
454
               checkGrainInfo(this.id)
373
                 .then(res => {
455
                 .then(res => {
374
-                  this.describe = JSON.parse(res.data.checkDescribe)
375
-                  //如果有异常项,就把异常项的值赋值给form数据源
376
-                  this.form.pestDensity = this.data.data.grainAbnormalDescribe.pestDensity
377
-                  this.form.occurArea = this.data.data.grainAbnormalDescribe.occurArea
378
-                  this.form.occurPosition = this.data.data.grainAbnormalDescribe.occurPosition
379
-                  this.form.pestType = this.data.data.grainAbnormalDescribe.pestType
380
-                  this.form.abnormalGrain = this.data.data.grainAbnormalDescribe.abnormalGrain
381
-                  this.form.abnormalWater = this.data.data.grainAbnormalDescribe.abnormalWater
382
-
383
-                  /* 遍历this.describe的key跟初始化时的每一项的fieldValue匹配,
384
-            匹配成功则把时间跟choose赋值给数据源tbdata */
456
+                  if (res.code == 200) {
457
+                    // console.log(res, "获取查看数据")
385
 
458
 
386
-                  for (const key in this.describe) {
387
                     for (let i = 0; i < this.tbdata.length; i++) {
459
                     for (let i = 0; i < this.tbdata.length; i++) {
388
-                      if (key == this.tbdata[i].fieldValue) {
389
-                        this.tbdata[i].createTime = this.describe[key].time
390
-                        this.tbdata[i].whether.radio = this.describe[key].choose
460
+                      for (let j = 0; j < res.data.length; j++) {
461
+                        if (this.tbdata[i].enumId == res.data[j].enumId) {
462
+                          // console.log(this.tbdata.indexOf(this.tbdata[i]),"this.tbdata[i]的index" )
463
+                          // console.log( res.data.indexOf(res.data[j]),"res.data.indexOf(res.data[j])")
464
+                          // var itemIndex = this.tbdata.indexOf(this.tbdata[i])
465
+                          if (
466
+                            this.tbdata[i].enumId == 189 ||
467
+                            this.tbdata[i].enumId == 190 ||
468
+                            this.tbdata[i].enumId == 191
469
+                          ) {
470
+                            // console.log(this.tbdata[i].enumName)
471
+                            this.tbdata[i].createDate =
472
+                              res.data[j].operationTime
473
+                            this.tbdata[i].enumOrder = String(
474
+                              res.data[j].anomalousStatus
475
+                            )
476
+                            //如果有异常项,就把异常项的值赋值给form数据源
477
+
478
+                            if (res.data[j].anomalousStatus == 1) {
479
+                              this.form = JSON.parse(res.data[j].errorDescribed)
480
+                              // console.log(this.form, "this.form")
481
+                              // console.log(
482
+                              //   res.data[j].errorDescribed,
483
+                              //   "res.data[j].errorDescribed"
484
+                              // )
485
+                            }
486
+                          } else {
487
+                            this.tbdata[i].createDate =
488
+                              res.data[j].operationTime
489
+                            this.tbdata[i].enumOrder = String(
490
+                              res.data[j].anomalousStatus
491
+                            )
492
+                          }
493
+                        }
391
                       }
494
                       }
392
                     }
495
                     }
393
-                    // if(key ==this.)
394
                   }
496
                   }
395
                 })
497
                 })
396
                 .catch(err => {
498
                 .catch(err => {
397
-                  console.log(err)
499
+                  console.log(err, "获取查看数据失败信息")
398
                 })
500
                 })
399
             }
501
             }
400
           })
502
           })
401
           .catch(err => {
503
           .catch(err => {
402
             console.log(err)
504
             console.log(err)
403
           })
505
           })
506
+        this.isDetail = true
404
       } else if (this.type == "3") {
507
       } else if (this.type == "3") {
405
         //修改
508
         //修改
406
-        getAddInfo(data1)
509
+        // 检查项初始化
510
+        getGrainItems(19)
407
           .then(res => {
511
           .then(res => {
408
-            // console.log(res,'修改接口获取到的数据')
409
-            this.tbdata = res.data.records
410
-            // console.log("产看修改初始化")
411
             if (res.code == 200) {
512
             if (res.code == 200) {
412
-              // 如果成功,就再次调用查看接口
513
+              // console.log(res, "res修改数据")
514
+              this.tbdata = res.data
515
+              // console.log(this.tbdata, "tbdata.......")
516
+              //获取数据
413
               checkGrainInfo(this.id)
517
               checkGrainInfo(this.id)
414
                 .then(res => {
518
                 .then(res => {
415
-                  console.log(res.data, "修改查看res")
416
-                  this.data3 = res.data
417
-                  // this.data3.checkDescribe = JSON.parse(res.data.checkDescribe)
418
-                  this.describe = JSON.parse(res.data.checkDescribe)
419
-                  this.data3.checkDescribe = this.describe
420
-
421
-                  //如果有异常项,就把异常项的值赋值给form数据源
422
-                  this.form.pestDensity = this.data.data.grainAbnormalDescribe.pestDensity
423
-                  this.form.occurArea = this.data.data.grainAbnormalDescribe.occurArea
424
-                  this.form.occurPosition = this.data.data.grainAbnormalDescribe.occurPosition
425
-                  this.form.pestType = this.data.data.grainAbnormalDescribe.pestType
426
-                  this.form.abnormalGrain = this.data.data.grainAbnormalDescribe.abnormalGrain
427
-                  this.form.abnormalWater = this.data.data.grainAbnormalDescribe.abnormalWater
428
-                  // console.log(this.form,'this.form............')
429
-                  /* 遍历this.describe的key跟初始化时的每一项的fieldValue匹配,
430
-            匹配成功则把时间跟choose赋值给数据源tbdata */
519
+                  if (res.code == 200) {
520
+                    // console.log(res, "获取修改数据")
521
+                    /*  res.data.forEach(item =>{
522
+                delete item.parentId
523
+              }) */
524
+                    // this.data5.grainConditionRecordChildren = JSON.parse(JSON.stringify(res.data))
431
 
525
 
432
-                  for (const key in this.describe) {
526
+                    this.data5.grainConditionRecordChildren = res.data
433
                     for (let i = 0; i < this.tbdata.length; i++) {
527
                     for (let i = 0; i < this.tbdata.length; i++) {
434
-                      if (key == this.tbdata[i].fieldValue) {
435
-                        this.tbdata[i].createTime = this.describe[key].time
436
-                        this.tbdata[i].whether.radio = this.describe[key].choose
528
+                      for (let j = 0; j < res.data.length; j++) {
529
+                        if (this.tbdata[i].enumId == res.data[j].enumId) {
530
+                          if (
531
+                            this.tbdata[i].enumId == 189 ||
532
+                            this.tbdata[i].enumId == 190 ||
533
+                            this.tbdata[i].enumId == 191
534
+                          ) {
535
+                            // console.log(this.tbdata[i].enumName)
536
+                            this.tbdata[i].createDate =
537
+                              res.data[j].operationTime
538
+                            this.tbdata[i].enumOrder = String(
539
+                              res.data[j].anomalousStatus
540
+                            )
541
+                            //如果有异常项,就把异常项的值赋值给form数据源
542
+                            if (res.data[j].anomalousStatus == 1) {
543
+                              this.form = JSON.parse(res.data[j].errorDescribed)
544
+                              // console.log(this.form, "this.form")
545
+                              // console.log(
546
+                              //   res.data[j].errorDescribed,
547
+                              //   "res.data[j].errorDescribed"
548
+                              // )
549
+                            }
550
+
551
+                            //  this.data5.grainConditionRecordChildren.push(res.data[i])
552
+                          } else {
553
+                            this.tbdata[i].createDate =
554
+                              res.data[j].operationTime
555
+                            // this.tbdata[i].enumOrder = res.data[j].anomalousStatus
556
+                            this.tbdata[i].enumOrder = String(
557
+                              res.data[j].anomalousStatus
558
+                            )
559
+                            // this.data5.grainConditionRecordChildren.push(res.data[i])
560
+                          }
561
+                        }
437
                       }
562
                       }
438
                     }
563
                     }
439
-                    // if(key ==this.)
564
+                    // console.log(
565
+                    //   this.data5.grainConditionRecordChildren,
566
+                    //   "this.data5.grainConditionRecordChildren"
567
+                    // )
440
                   }
568
                   }
441
                 })
569
                 })
442
                 .catch(err => {
570
                 .catch(err => {
443
-                  console.log(err)
571
+                  console.log(err, "获取查看数据失败信息")
444
                 })
572
                 })
445
             }
573
             }
446
           })
574
           })
447
           .catch(err => {
575
           .catch(err => {
448
             console.log(err)
576
             console.log(err)
449
           })
577
           })
578
+        // this.isDetail = true
450
       }
579
       }
451
     },
580
     },
452
 
581
 
@@ -466,87 +595,167 @@ export default {
466
     handleCurrentChange() {},
595
     handleCurrentChange() {},
467
     // 通过判断单选按钮的选择,弹出异常表单
596
     // 通过判断单选按钮的选择,弹出异常表单
468
     showClick(index, val) {
597
     showClick(index, val) {
469
-      console.log(this.tbdata,'this.tbdata')
470
-      console.log(index,'-index',val,'--val....')
598
+      this.isExist = false
599
+      // console.log(this.tbdata, "this.tbdata000...")
600
+      // var arr = this.tbdata
601
+      // console.log(index, "-index", val, "--val....")
602
+      // console.log(
603
+      //   this.data5.grainConditionRecordChildren,
604
+      //   "this.data5.grainConditionRecordChildren"
605
+      // )
471
       let time = getDateTimeNow()
606
       let time = getDateTimeNow()
472
-      this.tbdata[index].createTime = time
473
-      // 动态的把当前检查项作为对象名称保存到checkDescribe
474
-      this.data3.checkDescribe[this.tbdata[index].fieldValue] = {
475
-        choose: this.tbdata[index].whether.radio,
476
-        time: this.tbdata[index].createTime
477
-      }
478
-     if (
479
-          this.tbdata[6].fieldValue == "pest_abnormal"  && this.tbdata[6].whether.radio == 1 ||
480
-          this.tbdata[7].fieldValue == "water_abnormal" && this.tbdata[7].whether.radio == 1 ||
481
-          this.tbdata[8].fieldValue == "grain_abnormal" && this.tbdata[8].whether.radio == 1
482
-        ) {
483
-          this.data3.anomalousStatus = 1
484
-          console.log(this.data3.anomalousStatus,'异常触发')
485
-        }else if(
486
-          (this.tbdata[6].fieldValue == "pest_abnormal"  && this.tbdata[6].whether.radio == 0) &&
487
-          (this.tbdata[7].fieldValue == "water_abnormal" && this.tbdata[7].whether.radio == 0) &&
488
-          (this.tbdata[8].fieldValue == "grain_abnormal" && this.tbdata[8].whether.radio == 0)
489
-        ){
490
-          this.data3.anomalousStatus = 0
491
-          console.log(this.data3.anomalousStatus,'this.data3.anomalousStatus')
607
+      // 重构--时间字段名称改变
608
+      this.tbdata[index].createDate = time
609
+      // 动态的把当前检查项作为对象名称保存到grainConditionRecordChildren
610
+      // this.data5.grainConditionRecordChildren
492
 
611
 
612
+      // 判断当前数组长度是否为0,若为0 则直接新增数据,否则进行遍历看当前是否存在
613
+      // console.log(this.data5.grainConditionRecordChildren.length, "length...")
614
+      if (this.data5.grainConditionRecordChildren.length == 0) {
615
+        // console.log("此时数组为空,可以直接新增")
616
+        this.data5.grainConditionRecordChildren.push({
617
+          anomalousStatus: Number(val.enumOrder), //是否异常_选项(0:否,1:是)
618
+          enumId: val.enumId,
619
+          id: val.id,
620
+          operationTime: val.createDate
621
+        })
622
+      } else {
623
+        // 数组不为空时遍历数组,判断数组中是否已存在该项数据
624
+        // console.log("判断数据是否已存在")
625
+        for (const i in this.data5.grainConditionRecordChildren) {
626
+          // console.log(i, "i")
627
+          if (this.data5.grainConditionRecordChildren[i].enumId == val.enumId) {
628
+            // 数组中存在该项数据,则更新该数据
629
+            this.data5.grainConditionRecordChildren[i].anomalousStatus = Number(
630
+              val.enumOrder
631
+            )
632
+            this.data5.grainConditionRecordChildren[i].operationTime =
633
+              val.createDate
634
+            // this.data5.grainConditionRecordChildren[i].anomalousStatus = Number(val.enumOrder)
635
+            this.isExist = true
636
+            // console.log(this.isExist, "this.isExist")
637
+            break
638
+          }
493
         }
639
         }
640
+        /* console.log(this.isExist, "isexist")
641
+        if (!this.isExist) {
642
+          console.log("数组中无此元素,可以新增")
643
+          this.data5.grainConditionRecordChildren.push({
644
+            anomalousStatus: Number(val.enumOrder), //是否异常_选项(0:否,1:是)
645
+            enumId: val.enumId,
646
+            id: val.id,
647
+            operationTime: val.createDate
648
+          })
649
+        } */
650
+      }
494
 
651
 
495
-      // console.log(this.data3.checkDescribe,'this.data3.checkDescribe....')
496
-      let len = Object.getOwnPropertyNames(this.data3.checkDescribe).length - 1
652
+      // console.log(
653
+      //   this.data5.grainConditionRecordChildren,
654
+      //   "this.data5.grainConditionRecordChildren....."
655
+      // )
656
+      // console.log(this.data5,'this.data5------')
657
+      // enumId: 189(虫害异常)、190(水分检测异常)、191(异常粮情)
658
+      var count = 0
659
+      this.data5.grainConditionRecordChildren.forEach(item => {
660
+        if (item.anomalousStatus != undefined) {
661
+          count += 1
662
+          // console.log(count,'count')
663
+        }
664
+      })
665
+      // let len = this.data5.grainConditionRecordChildren.length
497
       // console.log(len,'len............')
666
       // console.log(len,'len............')
498
-      //判断map对象的长度,改变暂存按钮的状态
499
-      if (len < 14) {
667
+      //判断数组的长度,改变暂存按钮的状态
668
+      if (count < 14) {
500
         this.flag = false
669
         this.flag = false
501
-        this.data3.recordStatus = 0
670
+        this.data5.grainConditionRecord.recordStatus = 0
671
+        // this.data3.recordStatus = 0
502
       } else {
672
       } else {
503
         this.flag = true
673
         this.flag = true
504
-        this.data3.recordStatus = 1
674
+        this.data5.grainConditionRecord.recordStatus = 1
675
+        // this.data3.recordStatus = 1
505
       }
676
       }
506
       // console.log(val.whether.radio)
677
       // console.log(val.whether.radio)
507
       // 通过判断radio值是否为1,控制异常项弹出框 (单选框1:是 0:否)
678
       // 通过判断radio值是否为1,控制异常项弹出框 (单选框1:是 0:否)
508
-      if (val.whether.radio == 1) {
509
-        if (val.fieldValue == "pest_abnormal") {
510
-          this.dialogFormVisible = true
511
-        }
512
-        if (val.fieldValue == "water_abnormal") {
513
-          this.dialogFormVisible1 = true
514
-        }
515
-        if (val.fieldValue == "grain_abnormal") {
516
-          // console.log("进了粮情异常表单")
517
-          this.dialogFormVisible2 = true
518
-        }
519
-
679
+      if (val.enumId == 189 && val.enumOrder == 1) {
680
+        // console.log('触发虫害异常')
681
+        this.dialogFormVisible = true
682
+      }
683
+      if (val.enumId == 190 && val.enumOrder == 1) {
684
+        // console.log('触发水分异常')
685
+        this.dialogFormVisible1 = true
686
+      }
687
+      if (val.enumId == 191 && val.enumOrder == 1) {
688
+        // console.log('触发粮情异常')
689
+        this.dialogFormVisible2 = true
520
       }
690
       }
691
+
521
       //判断异常项是否被选中是,选中则改变异常状态
692
       //判断异常项是否被选中是,选中则改变异常状态
522
     },
693
     },
523
     // 暂存或者保存
694
     // 暂存或者保存
524
     saveInfo() {
695
     saveInfo() {
525
-      this.data3.grainAbnormalDescribe = this.form
526
-      this.data3.checkTime = getDateTimeNow()
696
+      // this.data3.grainAbnormalDescribe = this.form
697
+      // this.data3.checkTime = getDateTimeNow()
698
+      this.data5.grainConditionRecord.operationTime = getDateTimeNow()
699
+      /* this.data5.grainConditionRecord.depotId = this.depot_id
700
+       this.data5.grainConditionRecord.houseId = this.house_id */
527
       // console.log(this.data3.checkTime,'this.data3.checkTime')
701
       // console.log(this.data3.checkTime,'this.data3.checkTime')
528
       this.loading = true
702
       this.loading = true
529
       if (this.type == "2") {
703
       if (this.type == "2") {
530
-        this.data3.depotId = this.depot_id
531
-        this.data3.houseId = this.house_id
532
-        console.log(this.house_id, "house_id")
533
-        console.log(this.data3.houseId, "this.data3.houseId...")
534
-        this.data3.checkDescribe = JSON.stringify(this.data3.checkDescribe)
704
+        this.data5.grainConditionRecord.depotId = this.depot_id
705
+        this.data5.grainConditionRecord.houseId = this.house_id
706
+        // console.log(this.house_id, "house_id")
707
+        // console.log(this.data3.houseId, "this.data3.houseId...")
708
+        // this.data3.checkDescribe = JSON.stringify(this.data3.checkDescribe)
709
+        // 如果有异常项,则分别给异常项赋值对应的字典表id
710
+        this.data5.grainConditionRecordChildren.forEach(ele => {
711
+          if (ele.enumId == 189 && ele.anomalousStatus == 1) {
712
+            this.data5.grainConditionRecord.insectPestError = ele.enumId
713
+          } else if (ele.enumId == 190 && ele.anomalousStatus == 1) {
714
+            this.data5.grainConditionRecord.wetCheckError = ele.enumId
715
+          } else if (ele.enumId == 191 && ele.anomalousStatus == 1) {
716
+            this.data5.grainConditionRecord.grainError = ele.enumId
717
+          }
718
+          //  判断异常项是否被选中 '是'
719
+          if (
720
+            (ele.enumId == 189 && ele.anomalousStatus == 1) ||
721
+            (ele.enumId == 190 && ele.anomalousStatus == 1) ||
722
+            (ele.enumId == 191 && ele.anomalousStatus == 1)
723
+          ) {
724
+            ele.errorDescribed = JSON.stringify(this.form)
725
+            // console.log(ele,'ele.............')
726
+            if (
727
+              this.data5.grainConditionRecord.anomalousStatus == 0 ||
728
+              this.data5.grainConditionRecord.anomalousStatus == null
729
+            ) {
730
+              this.data5.grainConditionRecord.anomalousStatus = 1
731
+              // console.log(
732
+              //   this.data5.grainConditionRecord.anomalousStatus,
733
+              //   "触发异常"
734
+              // )
735
+            }
736
+          } /* else if(this.data5.grainConditionRecord.anomalousStatus == 1){
737
+          this.data5.grainConditionRecord.anomalousStatus = 0
738
+          console.log(this.data5.grainConditionRecord.anomalousStatus,'异常解除')
739
+        } */
740
+        })
741
+        console.log(JSON.parse(JSON.stringify(this.data5)), "this.data5----")
535
 
742
 
536
-        addInfo(this.data3)
743
+        addInfo(JSON.parse(JSON.stringify(this.data5)))
537
           .then(res => {
744
           .then(res => {
538
-            console.log(this.data3, "this.data3")
539
-            console.log(res,'res222111...')
540
-            console.log('新增成功........')
745
+            // console.log(this.data3, "this.data3")
746
+            // console.log(res, "res222111...")
747
+
748
+            if (res.code == 200) {
749
+              // console.log(res,'res=200')
750
+              // console.log("新增成功........")
541
               this.loading = false
751
               this.loading = false
542
               this.$message({
752
               this.$message({
543
-              message: "新增成功!",
544
-              type: "success"
545
-            })
546
-            this.$router.push({
547
-              path: "/reservesManagement/grainCheck/newGrain"
548
-            })
549
-            if (res.code == 200) {
753
+                message: "新增成功!",
754
+                type: "success"
755
+              })
756
+              this.$router.push({
757
+                path: "/reservesManagement/grainCheck/newGrain"
758
+              })
550
 
759
 
551
               if (!(JSON.stringify(this.data2) == {})) {
760
               if (!(JSON.stringify(this.data2) == {})) {
552
                 if (
761
                 if (
@@ -557,14 +766,14 @@ export default {
557
                   //当选项全部被选中后调用接口
766
                   //当选项全部被选中后调用接口
558
                   let auditState = 4 //4 是已完成
767
                   let auditState = 4 //4 是已完成
559
                   //判断是否切换仓房,或者仓房发生改变
768
                   //判断是否切换仓房,或者仓房发生改变
560
-                  console.log(this.house_id,this.data2.houseId,'houseId')
769
+                  // console.log(this.house_id, this.data2.houseId, "houseId")
561
                   if (this.house_id == this.data2.houseId) {
770
                   if (this.house_id == this.data2.houseId) {
562
                     haveDone(this.data2.id, auditState)
771
                     haveDone(this.data2.id, auditState)
563
                       .then(res => {
772
                       .then(res => {
564
                         console.log(res, "res.......")
773
                         console.log(res, "res.......")
565
                       })
774
                       })
566
                       .catch(err => {
775
                       .catch(err => {
567
-                        console.log(err)
776
+                        console.log(err, "654213")
568
                       })
777
                       })
569
                   } else {
778
                   } else {
570
                     let userId = this.uid
779
                     let userId = this.uid
@@ -589,18 +798,54 @@ export default {
589
                   }
798
                   }
590
                 }
799
                 }
591
               }
800
               }
592
-
593
             }
801
             }
594
-
595
           })
802
           })
596
           .catch(err => {
803
           .catch(err => {
597
             this.loading = false
804
             this.loading = false
598
-            console.log(err, "获取不到仓房houseId")
805
+            console.log(err, "新增错误信息")
599
           })
806
           })
600
       } else if (this.type == "1" || this.type == "3") {
807
       } else if (this.type == "1" || this.type == "3") {
601
-        this.data3.checkDescribe = JSON.stringify(this.data3.checkDescribe)
602
-        // console.log(this.data3,'xiugai hou 的data3')
603
-        editGrainInfo(this.data3)
808
+        // this.data3.checkDescribe = JSON.stringify(this.data3.checkDescribe)
809
+        this.data5.grainConditionRecord.depotId = this.depot_id
810
+        this.data5.grainConditionRecord.houseId = this.house_id
811
+        // console.log(this.house_id, "house_id")
812
+        // console.log(this.data3.houseId, "this.data3.houseId...")
813
+        // this.data3.checkDescribe = JSON.stringify(this.data3.checkDescribe)
814
+        // 如果有异常项,则分别给异常项赋值对应的字典表id
815
+        this.data5.grainConditionRecordChildren.forEach(ele => {
816
+          if (ele.enumId == 189 && ele.anomalousStatus == 1) {
817
+            this.data5.grainConditionRecord.insectPestError = ele.enumId
818
+          } else if (ele.enumId == 190 && ele.anomalousStatus == 1) {
819
+            this.data5.grainConditionRecord.wetCheckError = ele.enumId
820
+          } else if (ele.enumId == 191 && ele.anomalousStatus == 1) {
821
+            this.data5.grainConditionRecord.grainError = ele.enumId
822
+          }
823
+          //  判断异常项是否被选中 '是'
824
+          if (
825
+            (ele.enumId == 189 && ele.anomalousStatus == 1) ||
826
+            (ele.enumId == 190 && ele.anomalousStatus == 1) ||
827
+            (ele.enumId == 191 && ele.anomalousStatus == 1)
828
+          ) {
829
+            ele.errorDescribed = JSON.stringify(this.form)
830
+            // console.log(ele,'ele.............')
831
+            if (
832
+              this.data5.grainConditionRecord.anomalousStatus == 0 ||
833
+              this.data5.grainConditionRecord.anomalousStatus == null
834
+            ) {
835
+              this.data5.grainConditionRecord.anomalousStatus = 1
836
+              // console.log(
837
+              //   this.data5.grainConditionRecord.anomalousStatus,
838
+              //   "触发异常"
839
+              // )
840
+            }
841
+          } /* else if(this.data5.grainConditionRecord.anomalousStatus == 1){
842
+          this.data5.grainConditionRecord.anomalousStatus = 0
843
+          console.log(this.data5.grainConditionRecord.anomalousStatus,'异常解除')
844
+        } */
845
+        })
846
+        console.log(JSON.parse(JSON.stringify(this.data5)), "this.data5----")
847
+        console.log(this.data5, "xiugai hou 的data5")
848
+        editGrainInfo(this.data5)
604
           .then(res => {
849
           .then(res => {
605
             this.loading = true
850
             this.loading = true
606
             // console.log(res,'修改后的数据...')
851
             // console.log(res,'修改后的数据...')
@@ -622,7 +867,29 @@ export default {
622
       }
867
       }
623
     },
868
     },
624
     // 取消按钮
869
     // 取消按钮
625
-    cancel() {
870
+    cancel(a) {
871
+      if (a == "abnormalPest") {
872
+        // 虫害异常
873
+        /*  console.log(this.form.pestDensity,'pestDensity')
874
+        console.log(this.form.occurPosition,'occurPosition')
875
+        console.log(this.form.occurArea,'occurArea')
876
+        console.log(this.form.pestType,'pestType') */
877
+
878
+        this.dialogFormVisible = false
879
+      } else if (a == "abnormalWater") {
880
+        // 水分检测异常
881
+        // console.log(this.form.abnormalWater,'abnormalWater')
882
+
883
+        this.dialogFormVisible1 = false
884
+      } else if (a == "abnormalGrain") {
885
+        // 粮情异常
886
+        // console.log(this.form.abnormalGrain,'abnormalGrain')
887
+
888
+        this.dialogFormVisible2 = false
889
+      }
890
+    },
891
+    // 返回按钮
892
+    back() {
626
       // 判断一下是从最新粮情进的新增还是从全部粮情的查看修改进来的
893
       // 判断一下是从最新粮情进的新增还是从全部粮情的查看修改进来的
627
       if (this.type == "2") {
894
       if (this.type == "2") {
628
         this.$router.push({
895
         this.$router.push({

+ 256 - 101
shanXiPlatform/src/views/reservesManagement/grainCheck/newGrain/index.vue

@@ -15,9 +15,31 @@
15
           width="50px"
15
           width="50px"
16
           sortable
16
           sortable
17
         />
17
         />
18
-        <el-table-column prop="checkPerson" label="检查类型" align="center" />
19
-        <el-table-column prop="checkTime" label="最后记录时间" align="center" />
20
-        <el-table-column prop="recordStatus" label="状态" align="center">
18
+        <el-table-column prop="enumId" label="检查类型" align="center">
19
+          <template slot-scope="scope">
20
+            <p v-for="item in grainKind" :key="item.enumId">
21
+              <span v-if="scope.row.enumId == item.enumId">{{
22
+                item.enumName
23
+              }}
24
+              </span>
25
+            </p>
26
+          </template>
27
+        </el-table-column>
28
+        <!-- operationTime -->
29
+        <el-table-column
30
+          prop="operationTime"
31
+          label="最后记录时间"
32
+          align="center"
33
+        >
34
+          <template slot-scope="scope">
35
+            <span>{{
36
+              scope.row.operationTime == null
37
+                ? scope.row.operationTime
38
+                : scope.row.operationTime.slice(0, 16)
39
+            }}</span>
40
+          </template>
41
+        </el-table-column>
42
+        <el-table-column prop="recordStatus" label="状态" align="center"  width="100">
21
           <template slot-scope="scope">
43
           <template slot-scope="scope">
22
             <!-- <div disable-transitions>
44
             <!-- <div disable-transitions>
23
               {{
45
               {{
@@ -28,9 +50,7 @@
28
             </div> -->
50
             </div> -->
29
             <div
51
             <div
30
               disable-transitions
52
               disable-transitions
31
-              v-if="
32
-                scope.row.recordStatus == '' || scope.row.recordStatus == null
33
-              "
53
+              v-if="scope.row.recordStatus == null"
34
             ></div>
54
             ></div>
35
             <!--  <div
55
             <!--  <div
36
               class="yellow"
56
               class="yellow"
@@ -42,22 +62,16 @@
42
             <!-- <div class="green" disable-transitions v-if="scope.row.recordStatus == '1'">
62
             <!-- <div class="green" disable-transitions v-if="scope.row.recordStatus == '1'">
43
               已完成
63
               已完成
44
             </div> -->
64
             </div> -->
45
-            <p
46
-              v-if="scope.row.recordStatus == '1'"
47
-              style="height:45px;line-height:45px;margin:0 ; padding-top:7px;"
48
-            >
65
+            <p v-if="scope.row.recordStatus == '1'">
49
               <span>已完成</span>
66
               <span>已完成</span>
50
             </p>
67
             </p>
51
-            <p
52
-              v-if="scope.row.recordStatus == '0'"
53
-              style="height:45px;line-height:45px;margin:0 ; padding-top:7px;"
54
-            >
68
+            <p v-if="scope.row.recordStatus == '0'">
55
               <span>进行中</span>
69
               <span>进行中</span>
56
             </p>
70
             </p>
57
           </template>
71
           </template>
58
         </el-table-column>
72
         </el-table-column>
59
         <!-- :formatter="formatterColumn" -->
73
         <!-- :formatter="formatterColumn" -->
60
-        <!-- <el-table-column prop="anomalousStatus" label="有无异常" align="center">
74
+        <el-table-column prop="anomalousStatus" label="有无异常" align="center" width="120">
61
           <template slot-scope="scope">
75
           <template slot-scope="scope">
62
             <div
76
             <div
63
               disable-transitions
77
               disable-transitions
@@ -67,22 +81,32 @@
67
               "
81
               "
68
             ></div>
82
             ></div>
69
             <div disable-transitions v-if="scope.row.anomalousStatus == '0'">
83
             <div disable-transitions v-if="scope.row.anomalousStatus == '0'">
70
-              无
84
+              <!-- 无 -->
85
+              <span class="colorspano"></span>
71
             </div>
86
             </div>
72
             <div disable-transitions v-if="scope.row.anomalousStatus == '1'">
87
             <div disable-transitions v-if="scope.row.anomalousStatus == '1'">
73
-              有
88
+              <!-- 有 -->
89
+              <span class="colorspant"></span>
74
             </div>
90
             </div>
75
           </template>
91
           </template>
76
         </el-table-column>
92
         </el-table-column>
77
-         <el-table-column prop="checkList" label="异常项" align="center" >
93
+        <el-table-column prop="checkList" label="异常项" align="center"  width="250">
78
           <template slot-scope="scope">
94
           <template slot-scope="scope">
79
-            <div
80
-
81
-              disable-transitions
82
-              >{{ scope.row.waterAbnormal== '1'?'水分检测异常': '' }} {{ scope.row.grainAbnormal== '1'?'粮情异常': ''}} {{scope.row.pestAbnormal == '1'?'虫害异常': ''}} </div
83
-            >
95
+            <div disable-transitions>
96
+              <p class="anomalousItem" v-for="item in checkItems" :key="item.enumId">
97
+              <span v-show="scope.row.insectPestError == item.enumId">
98
+                {{item.enumName}}
99
+              </span>
100
+              <span v-show="scope.row.grainError == item.enumId">
101
+                {{item.enumName}}
102
+              </span>
103
+              <span v-show="scope.row.wetCheckError == item.enumId">
104
+                 {{item.enumName}}
105
+              </span>
106
+            </p>
107
+            </div>
84
           </template>
108
           </template>
85
-        </el-table-column> -->
109
+        </el-table-column>
86
         <el-table-column
110
         <el-table-column
87
           prop="operation"
111
           prop="operation"
88
           label="操作"
112
           label="操作"
@@ -96,10 +120,10 @@
96
               style="border:1px solid seagreen;color:seagreen"
120
               style="border:1px solid seagreen;color:seagreen"
97
               @click="add(2, scope.$index, scope.row)"
121
               @click="add(2, scope.$index, scope.row)"
98
               v-if="
122
               v-if="
99
-                (scope.row.checkPerson == '保管员每周检查粮情' && $tools.IsPermission(131)) ||
100
-                (scope.row.checkPerson == '主管科长每2周检查粮情' && $tools.IsPermission(206)) ||
101
-                (scope.row.checkPerson == '分管副总每月检查粮情' && $tools.IsPermission(207)) ||
102
-                (scope.row.checkPerson == '总经理每季检查粮情' && $tools.IsPermission(208))
123
+                (scope.row.enumId == 19 && $tools.IsPermission(131)) ||
124
+                  (scope.row.enumId == 20 && $tools.IsPermission(206)) ||
125
+                  (scope.row.enumId == 21 && $tools.IsPermission(207)) ||
126
+                  (scope.row.enumId == 22 && $tools.IsPermission(208))
103
               "
127
               "
104
               :disabled="flag"
128
               :disabled="flag"
105
               >新增</el-button
129
               >新增</el-button
@@ -126,7 +150,9 @@ import {
126
   addInfo,
150
   addInfo,
127
   getDateTimeNow,
151
   getDateTimeNow,
128
   haveDone,
152
   haveDone,
129
-  haveDone1
153
+  haveDone1,
154
+  getGrainItems,
155
+  getGrainAll
130
 } from "@/api/grainCheck/index"
156
 } from "@/api/grainCheck/index"
131
 export default {
157
 export default {
132
   name: "NewGrain",
158
   name: "NewGrain",
@@ -136,6 +162,7 @@ export default {
136
       userInfo: "",
162
       userInfo: "",
137
       role: "", //用户角色
163
       role: "", //用户角色
138
       uid: "",
164
       uid: "",
165
+      depotDic:'',
139
       //库id
166
       //库id
140
       depotId: "",
167
       depotId: "",
141
       // 仓房id
168
       // 仓房id
@@ -143,45 +170,66 @@ export default {
143
       // 最新粮情数据
170
       // 最新粮情数据
144
       abnormalItems: [],
171
       abnormalItems: [],
145
       data: [],
172
       data: [],
146
-      sortData: [],
147
-      data2: {},
148
-      // back:'',
149
-      //待办跳转过来改变其他的选项的新增按钮不能点击
150
-      flag: false,
151
-      /*   newGrainData: [
173
+      sortData: [
152
         {
174
         {
153
-          checkPerson: "保管员每周检查粮情",
154
-          checkTime: "",
155
-          recordStatus: "",
156
-          anomalousStatus: "",
157
-          checkList: "",
158
-          id: 1
175
+          id: null,
176
+          enumId: 22,
177
+          operationTime: null,
178
+          recordStatus: null,
179
+          anomalousStatus: null,
180
+          checkPerson: null,
181
+          houseId: null,
182
+          depotId: null,
183
+          checkYear: null,
184
+          checkYearWeek: null,
185
+          enumOrder: null
159
         },
186
         },
160
         {
187
         {
161
-          checkPerson: "主管科长每两周检查粮情",
162
-          checkTime: "",
163
-          recordStatus: "",
164
-          anomalousStatus: "",
165
-          checkList: "",
166
-          id: 2
188
+          id: null,
189
+          enumId: 21,
190
+          operationTime: null,
191
+          recordStatus: null,
192
+          anomalousStatus: null,
193
+          checkPerson: null,
194
+          houseId: null,
195
+          depotId: null,
196
+          checkYear: null,
197
+          checkYearWeek: null,
198
+          enumOrder: null
167
         },
199
         },
168
         {
200
         {
169
-          checkPerson: "分管副总每月检查粮情",
170
-          checkTime: "",
171
-          recordStatus: "",
172
-          anomalousStatus: "",
173
-          checkList: "",
174
-          id: 3
201
+          id: null,
202
+          enumId: 19,
203
+          operationTime: null,
204
+          recordStatus: null,
205
+          anomalousStatus: null,
206
+          checkPerson: null,
207
+          houseId: null,
208
+          depotId: null,
209
+          checkYear: null,
210
+          checkYearWeek: null,
211
+          enumOrder: null
175
         },
212
         },
176
         {
213
         {
177
-          checkPerson: "总经理每季检查粮情",
178
-          checkTime: "",
179
-          recordStatus: "",
180
-          anomalousStatus: "",
181
-          checkList: "",
182
-          id: 4
214
+          id: 11,
215
+          enumId: 20,
216
+          operationTime: "2021-03-01 13:55:01",
217
+          recordStatus: 1,
218
+          anomalousStatus: 0,
219
+          checkPerson: 1,
220
+          houseId: 94,
221
+          depotId: 2,
222
+          checkYear: 2021,
223
+          checkYearWeek: 10,
224
+          enumOrder: 0
183
         }
225
         }
184
-      ], */
226
+      ],
227
+      data2: {},
228
+      grainKind: [], //粮情检查类别
229
+      checkItems:[],// 保管员检查项
230
+      // back:'',
231
+      //待办跳转过来改变其他的选项的新增按钮不能点击
232
+      flag: false,
185
       tindex: "",
233
       tindex: "",
186
       // 先自定义后台接收数据的模板然后拼接
234
       // 先自定义后台接收数据的模板然后拼接
187
       data3: {
235
       data3: {
@@ -194,6 +242,7 @@ export default {
194
         recordStatus: "",
242
         recordStatus: "",
195
         anomalousStatus: "",
243
         anomalousStatus: "",
196
         ready: "",
244
         ready: "",
245
+
197
         grainAbnormalDescribe: {
246
         grainAbnormalDescribe: {
198
           abnormalGrain: "",
247
           abnormalGrain: "",
199
           abnormalWater: "",
248
           abnormalWater: "",
@@ -203,6 +252,36 @@ export default {
203
           pestType: ""
252
           pestType: ""
204
         }
253
         }
205
       },
254
       },
255
+
256
+      // 重构后的新增数据模板
257
+      data5: {
258
+        grainConditionRecord: {
259
+          anomalousStatus: 0, //异常状态(0无异常,1有异常)
260
+          checkPerson: null, //检查人
261
+          // checkYear: 0,//检查年份(用于粮情异常等,做年统计)
262
+          // checkYearWeek: 0,//检查所在年第几周
263
+          depotId: null, //库id
264
+          enumId: null, //检查类型
265
+          enumOrder: 0, //用于同公共枚举同步顺序
266
+          houseId: null, //仓房id
267
+          id: null, //粮情检测记录id
268
+          operationTime: "string", //检查(操作)时间
269
+          recordStatus: 0, //记录状态(0进行中,1完成)
270
+          grainError:null, //粮情异常,值为对应的enumId
271
+          insectPestError:null, //虫害异常 值为对应的enumId
272
+          wetCheckError:null, //水分检测异常 值为对应的enumId
273
+
274
+        },
275
+        grainConditionRecordChildren: [
276
+          // {
277
+          //   anomalousStatus: 0, //是否异常_选项(0:否,1:是)
278
+          //   enumId: null, //检查类型
279
+          //   id: null, //粮情检查新增检查项
280
+          //   operationTime: "string", //操作时间
281
+          //   parentId: null //关联主表id(检查人id-保管员或总经理等)
282
+          // }
283
+        ]
284
+      },
206
       //如果是从待办进入的粮情,则把路由带的参数赋值给data4
285
       //如果是从待办进入的粮情,则把路由带的参数赋值给data4
207
       data4: {}
286
       data4: {}
208
     }
287
     }
@@ -211,12 +290,11 @@ export default {
211
     // console.log(decodeURIComponent(JSON.parse(this.$route.query)))
290
     // console.log(decodeURIComponent(JSON.parse(this.$route.query)))
212
     // console.log(this.$route.query,'this.$route.query........')
291
     // console.log(this.$route.query,'this.$route.query........')
213
     this.userInfo = JSON.parse(localStorage.getItem("userInfo"))
292
     this.userInfo = JSON.parse(localStorage.getItem("userInfo"))
293
+
214
     console.log(this.userInfo.roleName, "this.userInfo.roleName00000000")
294
     console.log(this.userInfo.roleName, "this.userInfo.roleName00000000")
215
-    /* switch(this.userInfo.roleName){
216
-      case 0:
217
-        role = ''
218
-    } */
295
+    this.data5.grainConditionRecord.checkPerson = this.userInfo.uid
219
     this.uid = this.userInfo.uid
296
     this.uid = this.userInfo.uid
297
+    // 此处是从待办跳转到本页面时传递过来的参数,用data2收集保存
220
     this.data2 = this.$route.query
298
     this.data2 = this.$route.query
221
     // console.log(this.houseId,'本页面仓房号')
299
     // console.log(this.houseId,'本页面仓房号')
222
 
300
 
@@ -233,11 +311,12 @@ export default {
233
       } */
311
       } */
234
     }
312
     }
235
     // this.id = this.$route.query.id
313
     // this.id = this.$route.query.id
236
-
237
     this.activeName = this.$route.name
314
     this.activeName = this.$route.name
238
     // this.houseId = this.$store.state.houseId;
315
     // this.houseId = this.$store.state.houseId;
239
     this.depotId = this.$store.state.depotId
316
     this.depotId = this.$store.state.depotId
240
     // this.depotId=houseData.parentCode;
317
     // this.depotId=houseData.parentCode;
318
+    this.getGrainList()
319
+
241
     this.getList()
320
     this.getList()
242
   },
321
   },
243
   computed: {
322
   computed: {
@@ -253,22 +332,56 @@ export default {
253
     }
332
     }
254
   },
333
   },
255
   methods: {
334
   methods: {
335
+    // 获取粮情字典项
336
+    getGrainList() {
337
+      const parentId = 18 //粮情检查类型parentId
338
+      getGrainItems(parentId)
339
+        .then(res => {
340
+          console.log(res, "res字典粮情检查类型")
341
+          this.grainKind = res.data
342
+        })
343
+        .catch(err => {
344
+          console.log(err)
345
+        })
346
+      // 保管员检查类型下的检查项字典表
347
+       getGrainItems(19)
348
+          .then(res => {
349
+            if (res.code == 200) {
350
+              console.log(res, "保管员检查项字典")
351
+              this.checkItems = res.data
352
+              console.log(this.checkItems, "checkItems.......")
353
+            }
354
+          })
355
+          .catch(err => {
356
+            console.log(err)
357
+          })
358
+    },
256
     //获取最新粮情
359
     //获取最新粮情
257
     getList() {
360
     getList() {
258
       // let userinfo =JSON.parse(localStorage.getItem("userInfo"))
361
       // let userinfo =JSON.parse(localStorage.getItem("userInfo"))
259
       // console.log(JSON.parse(userinfo),'userInfo')
362
       // console.log(JSON.parse(userinfo),'userInfo')
260
-      // console.log(userinfo.depotId)
363
+      // console.log(userinfo.depotId,'userinfo.depotId')
261
       // console.log('121111........')
364
       // console.log('121111........')
262
-      let condition = {
263
-        houseId: /* (this.houseId ==null || this.houseId ==undefined)?  */ this.houseId ,
264
-        depotId: this.depotId
265
-      }
365
+      // let condition = {
366
+      //   houseId: /* (this.houseId ==null || this.houseId ==undefined)?  */ this.houseId ,
367
+      //   depotId: this.depotId
368
+      // }
266
       // console.log(JSON.stringify(condition),'1111')
369
       // console.log(JSON.stringify(condition),'1111')
370
+      // let data = {
371
+
372
+      //   condition: JSON.stringify(condition)
373
+      // }
267
       let data = {
374
       let data = {
268
-        /* pageIndex: 1,
269
-        pageSize: 10, */
270
-        condition: JSON.stringify(condition)
375
+        depotId:
376
+          this.depotId !== null || this.depotId !== undefined
377
+            ? this.depotId
378
+            : this.userInfo.depotId,
379
+        houseId:
380
+          this.houseId !== null || this.houseId !== undefined
381
+            ? this.houseId
382
+            : 94
271
       }
383
       }
384
+      console.log(data, "data")
272
       getNewGrainInfo(data)
385
       getNewGrainInfo(data)
273
         .then(res => {
386
         .then(res => {
274
           console.log(res.data, "res000")
387
           console.log(res.data, "res000")
@@ -283,22 +396,24 @@ export default {
283
     sort() {
396
     sort() {
284
       var sortdata = this.data
397
       var sortdata = this.data
285
       // 如果sortData是空的,使用splice进行排序,不准确
398
       // 如果sortData是空的,使用splice进行排序,不准确
286
-      this.sortData = [0, 0, 0, 0]
399
+      // this.sortData = [0, 0, 0, 0]
400
+
401
+      console.log(this.sortData,'sortData.......')
287
       if (sortdata.length !== 0) {
402
       if (sortdata.length !== 0) {
288
         for (let i = 0; i < sortdata.length; i++) {
403
         for (let i = 0; i < sortdata.length; i++) {
289
-          if (sortdata[i].checkPerson == "总经理每季检查粮情") {
404
+          if (sortdata[i].enumId == 22) {
290
             console.log(sortdata[i], "总经理 ")
405
             console.log(sortdata[i], "总经理 ")
291
             this.sortData.splice(0, 1, sortdata[i])
406
             this.sortData.splice(0, 1, sortdata[i])
292
           }
407
           }
293
-          if (sortdata[i].checkPerson == "分管副总每月检查粮情") {
408
+          if (sortdata[i].enumId == 21) {
294
             console.log(this.data[i], "分管副总")
409
             console.log(this.data[i], "分管副总")
295
             this.sortData.splice(1, 1, sortdata[i])
410
             this.sortData.splice(1, 1, sortdata[i])
296
           }
411
           }
297
-          if (sortdata[i].checkPerson === "主管科长每2周检查粮情") {
412
+          if (sortdata[i].enumId === 20) {
298
             console.log(this.data[i], "主管科长")
413
             console.log(this.data[i], "主管科长")
299
             this.sortData.splice(2, 1, sortdata[i])
414
             this.sortData.splice(2, 1, sortdata[i])
300
           }
415
           }
301
-          if (sortdata[i].checkPerson == "保管员每周检查粮情") {
416
+          if (sortdata[i].enumId == 19) {
302
             console.log(this.data[i], "保管员")
417
             console.log(this.data[i], "保管员")
303
             this.sortData.splice(3, 1, sortdata[i])
418
             this.sortData.splice(3, 1, sortdata[i])
304
           }
419
           }
@@ -318,16 +433,24 @@ export default {
318
       }
433
       }
319
     },
434
     },
320
     // 除保管员外弹窗
435
     // 除保管员外弹窗
321
-    open(val) {
436
+    open(val,index) {
322
       // console.log(this.$route.query, "保管员外的角色")
437
       // console.log(this.$route.query, "保管员外的角色")
438
+      console.log(val, "val...")
439
+      console.log(index,'index')
440
+      this.data5.grainConditionRecord.depotId = this.depotId
441
+      this.data5.grainConditionRecord.houseId = this.houseId
442
+      this.data5.grainConditionRecord.enumId = val.enumId
443
+      console.log(val.enumId, "当前角色信息id")
444
+      console.log(this.grainKind, "角色类别字典")
445
+      var item = this.grainKind.find(item => item.enumId == val.enumId)
446
+      console.log(item.enumName, "item")
447
+      console.log(item,'item数据')
323
 
448
 
324
-      val.depotId = this.depotId
325
-      val.houseId = this.houseId
326
-      // console.log(val, "当前角色信息")
327
       // console.log(this.data2,'this.data2..........')
449
       // console.log(this.data2,'this.data2..........')
328
       const h = this.$createElement
450
       const h = this.$createElement
329
       this.$msgbox({
451
       this.$msgbox({
330
-        title: "新增" + val.checkPerson,
452
+        // title: "新增" + val.checkPerson,
453
+        title: "新增" + item.enumName,
331
         /* message: h('p', null, [
454
         /* message: h('p', null, [
332
             h('span', null, '内容可以是 '),
455
             h('span', null, '内容可以是 '),
333
             h('i', { style: 'color: teal' }, 'VNode')
456
             h('i', { style: 'color: teal' }, 'VNode')
@@ -341,8 +464,16 @@ export default {
341
           if (action === "confirm") {
464
           if (action === "confirm") {
342
             instance.confirmButtonLoading = true
465
             instance.confirmButtonLoading = true
343
             // instance.type = success
466
             // instance.type = success
344
-            val.recordStatus = 1
345
-            val.checkTime = getDateTimeNow()
467
+            this.data5.grainConditionRecord.recordStatus = 1
468
+            // operationTime
469
+            this.data5.grainConditionRecord.operationTime = getDateTimeNow()
470
+            console.log(this.sortData,'sortData')
471
+            console.log(this.sortData[index],'sortData[index]')
472
+            // 临时修改对应项的操作时间,造成数据实时更新的假象,实际更新需要重新刷新
473
+            this.sortData[index].operationTime = getDateTimeNow()
474
+            this.sortData[index].recordStatus = 1
475
+            this.sortData[index].anomalousStatus = 0
476
+
346
             instance.confirmButtonText = "新增中..."
477
             instance.confirmButtonText = "新增中..."
347
             setTimeout(() => {
478
             setTimeout(() => {
348
               done()
479
               done()
@@ -355,9 +486,14 @@ export default {
355
           }
486
           }
356
         }
487
         }
357
       }).then(action => {
488
       }).then(action => {
358
-        addInfo(val)
489
+        // 此处新增参数应该改为data5模板
490
+        console.log(this.data5, "this.data5...")
491
+        addInfo(this.data5)
359
           .then(res => {
492
           .then(res => {
493
+            console.log(res, "res增")
360
             if (res.code == 200) {
494
             if (res.code == 200) {
495
+              // this.sortData.operationTime = this.data5.grainConditionRecord.operationTime
496
+
361
               console.log(this.houseId, "this.houseId")
497
               console.log(this.houseId, "this.houseId")
362
               console.log(this.data2.houseId, "this.data2.houseId")
498
               console.log(this.data2.houseId, "this.data2.houseId")
363
               let auditState = 4 //4 是已完成
499
               let auditState = 4 //4 是已完成
@@ -384,15 +520,20 @@ export default {
384
                   })
520
                   })
385
               }
521
               }
386
               console.log(res, "新增成功")
522
               console.log(res, "新增成功")
523
+              this.$message({
524
+                type: "success",
525
+                message: "新增成功"
526
+              })
527
+            } else {
528
+              this.$message({
529
+                type: "err",
530
+                message: res.msg
531
+              })
387
             }
532
             }
388
           })
533
           })
389
           .catch(err => {
534
           .catch(err => {
390
             console.log(err)
535
             console.log(err)
391
           })
536
           })
392
-        this.$message({
393
-          type: "success",
394
-          message: "新增成功 "
395
-        })
396
       })
537
       })
397
     },
538
     },
398
     // 新增按钮
539
     // 新增按钮
@@ -405,8 +546,10 @@ export default {
405
       if (Object.keys(this.data2).length === 0) {
546
       if (Object.keys(this.data2).length === 0) {
406
         //query为空是正常操作
547
         //query为空是正常操作
407
         // console.log(id,'query为空')
548
         // console.log(id,'query为空')
408
-        if (row.checkPerson == "保管员每周检查粮情") {
409
-          row.checkTime = getDateTimeNow()
549
+        // if (row.checkPerson == "保管员每周检查粮情") {
550
+        if (row.enumId == 19) {
551
+          // operationTime
552
+          row.operationTime = getDateTimeNow()
410
           // console.log(row.checkTime,'time')
553
           // console.log(row.checkTime,'time')
411
           // console.log(this.data2,' back: this.data2')
554
           // console.log(this.data2,' back: this.data2')
412
           this.$router.push({
555
           this.$router.push({
@@ -414,8 +557,8 @@ export default {
414
             query: { type: type, pid: row.id, data: row }
557
             query: { type: type, pid: row.id, data: row }
415
           })
558
           })
416
         } else {
559
         } else {
417
-          // console.log("科长,副总,总经理")
418
-          this.open(row)
560
+          console.log(row, "科长,副总,总经理")
561
+          this.open(row,index)
419
         }
562
         }
420
       } else if (Object.keys(this.data2).length !== 0) {
563
       } else if (Object.keys(this.data2).length !== 0) {
421
         //query不为空是从待办跳过来的
564
         //query不为空是从待办跳过来的
@@ -423,12 +566,14 @@ export default {
423
         // console.log(this.data2, "query 不 为空 ")
566
         // console.log(this.data2, "query 不 为空 ")
424
         // console.log(this.data2.workName, "query.workName............")
567
         // console.log(this.data2.workName, "query.workName............")
425
         // console.log(this.data2,'this.data2...')
568
         // console.log(this.data2,'this.data2...')
426
-        if (row.checkPerson == "保管员每周检查粮情") {
569
+        if (row.enumId == 19) {
570
+          // 19是保管员
427
           // console.log(this.data2.workName,'this.data2.workName')
571
           // console.log(this.data2.workName,'this.data2.workName')
428
           // console.log(row.checkPerson,'row.checkPerson')
572
           // console.log(row.checkPerson,'row.checkPerson')
429
           if (this.data2.workName == "保管员每周粮情检查") {
573
           if (this.data2.workName == "保管员每周粮情检查") {
430
             //保管员待办
574
             //保管员待办
431
-            row.checkTime = getDateTimeNow()
575
+            // operationTime
576
+            row.operationTime = getDateTimeNow()
432
             this.$router.push({
577
             this.$router.push({
433
               path: "/grainCheck/addNewGrain",
578
               path: "/grainCheck/addNewGrain",
434
               query: {
579
               query: {
@@ -440,7 +585,7 @@ export default {
440
             })
585
             })
441
           }
586
           }
442
           // console.log('保管员')
587
           // console.log('保管员')
443
-          /*         console.log(row, "row....")
588
+          /*
444
         console.log(this.data, "data111") */
589
         console.log(this.data, "data111") */
445
           /*  row.checkTime = getDateTimeNow()
590
           /*  row.checkTime = getDateTimeNow()
446
           // console.log(row.checkTime,'time')
591
           // console.log(row.checkTime,'time')
@@ -450,7 +595,7 @@ export default {
450
           }) */
595
           }) */
451
         } else {
596
         } else {
452
           // console.log("科长,副总,总经理")
597
           // console.log("科长,副总,总经理")
453
-          this.open(row)
598
+          this.open(row,index)
454
         }
599
         }
455
       }
600
       }
456
       // console.log(row,'111000')
601
       // console.log(row,'111000')
@@ -505,7 +650,7 @@ export default {
505
   font-size: 13px;
650
   font-size: 13px;
506
 }
651
 }
507
 .colorspano {
652
 .colorspano {
508
-  width: 140px;
653
+  width: 100px;
509
   height: 30px;
654
   height: 30px;
510
   background-color: #199856;
655
   background-color: #199856;
511
   display: inline-block;
656
   display: inline-block;
@@ -514,7 +659,7 @@ export default {
514
   line-height: 30px;
659
   line-height: 30px;
515
 }
660
 }
516
 .colorspant {
661
 .colorspant {
517
-  width: 140px;
662
+  width: 100px;
518
   height: 30px;
663
   height: 30px;
519
   background-color: #ffff00;
664
   background-color: #ffff00;
520
   display: inline-block;
665
   display: inline-block;
@@ -523,10 +668,20 @@ export default {
523
   line-height: 30px;
668
   line-height: 30px;
524
 }
669
 }
525
 .colorspanr {
670
 .colorspanr {
526
-  width: 140px;
671
+  width: 100px;
527
   height: 30px;
672
   height: 30px;
528
   background-color: #ff9933;
673
   background-color: #ff9933;
529
   display: inline-block;
674
   display: inline-block;
530
   border-radius: 5px;
675
   border-radius: 5px;
531
 }
676
 }
677
+.anomalousItem{
678
+  display: inline-block;
679
+  word-break: keep-all;
680
+  white-space: nowrap;
681
+  font-size: 12px;
682
+  font-weight: 800;
683
+  span {
684
+    padding-right: 5px;
685
+  }
686
+}
532
 </style>
687
 </style>

+ 5 - 5
shanXiPlatform/src/views/systemManagement/userManagement/approverManagement/index.vue

@@ -59,9 +59,9 @@ export default {
59
             //库id
59
             //库id
60
             depotId: 1,
60
             depotId: 1,
61
             roleArr: [],
61
             roleArr: [],
62
-            //33--主管科长   35---分管副总经理   34---总经理  54--分公司主管
62
+            //33--主管科长   35---分管副总经理   34---总经理  37--分公司主管
63
             //角色id
63
             //角色id
64
-            rolesId: "33,34,35,54",
64
+            rolesId: "33,34,35,37",
65
             //初始化审批人下拉选
65
             //初始化审批人下拉选
66
             approverSelect: [],
66
             approverSelect: [],
67
             // 表格数据初始化
67
             // 表格数据初始化
@@ -539,7 +539,7 @@ export default {
539
                             } else if (
539
                             } else if (
540
                                 item.title.indexOf("分公司主管处室") != -1
540
                                 item.title.indexOf("分公司主管处室") != -1
541
                             ) {
541
                             ) {
542
-                                this.$set(item, "approverSelect", res.data[54])
542
+                                this.$set(item, "approverSelect", res.data[37])
543
                             }
543
                             }
544
                         })
544
                         })
545
                     }
545
                     }
@@ -553,9 +553,9 @@ export default {
553
             if (this.type == "tf") {
553
             if (this.type == "tf") {
554
                 this.tableData = this.meVentilation
554
                 this.tableData = this.meVentilation
555
             } else if (this.type == "xzjh") {
555
             } else if (this.type == "xzjh") {
556
-                this.tableData = this.fumigation
556
+                // this.tableData = this.fumigation
557
             } else if (this.type == "xzsq") {
557
             } else if (this.type == "xzsq") {
558
-                this.tableData = this.fumigation1
558
+                // this.tableData = this.fumigation1
559
             } else if (this.type == "yjcg") {
559
             } else if (this.type == "yjcg") {
560
                 this.tableData = this.drugPurchase
560
                 this.tableData = this.drugPurchase
561
             } else if (this.type == "yjly") {
561
             } else if (this.type == "yjly") {