Commit cbeb361bfddf428708fdfdac8e585f7936061b97

Authored by wuxw
1 parent 57c370b2

v1.9 巡检功能修复一些显示的bug

src/api/inspection/inspectionPlanApi.js
... ... @@ -3,102 +3,167 @@ import { getCommunityId } from '@/api/community/communityApi'
3 3  
4 4 // 获取字典数据
5 5 export function getDict(dictType, state) {
6   - return request({
7   - url: '/dict.listDict',
8   - method: 'get',
9   - params: { dictType, state }
10   - }).then(res => res.data)
  6 + return new Promise((resolve, reject) => {
  7 + request({
  8 + url: '/dict.listDict',
  9 + method: 'get',
  10 + params: { dictType, state }
  11 + }).then(response => {
  12 + const res = response.data
  13 + resolve(res)
  14 + }).catch(error => {
  15 + reject(error)
  16 + })
  17 + })
11 18 }
12 19  
13 20 // 查询巡检计划列表
14 21 export function listInspectionPlans(params) {
15   - return request({
16   - url: '/inspectionPlan.listInspectionPlans',
17   - method: 'get',
18   - params: {
19   - communityId: getCommunityId(),
20   - ...params
21   - }
22   - }).then(res => res.data)
  22 + return new Promise((resolve, reject) => {
  23 + request({
  24 + url: '/inspectionPlan.listInspectionPlans',
  25 + method: 'get',
  26 + params: {
  27 + ...params,
  28 + communityId: getCommunityId()
  29 + }
  30 + }).then(response => {
  31 + const res = response.data
  32 + resolve(res)
  33 + }).catch(error => {
  34 + reject(error)
  35 + })
  36 + })
23 37 }
24 38  
25 39 // 更新巡检计划状态
26 40 export function updateInspectionPlanState(data) {
27   - return request({
28   - url: '/inspectionPlan.updateInspectionPlanState',
29   - method: 'post',
30   - data: {
31   - communityId: getCommunityId(),
32   - ...data
33   - }
34   - }).then(res => res.data)
  41 + return new Promise((resolve, reject) => {
  42 + request({
  43 + url: '/inspectionPlan.updateInspectionPlanState',
  44 + method: 'post',
  45 + data: {
  46 + ...data,
  47 + communityId: getCommunityId()
  48 + }
  49 + }).then(response => {
  50 + const res = response.data
  51 + resolve(res)
  52 + }).catch(error => {
  53 + reject(error)
  54 + })
  55 + })
35 56 }
36 57  
37 58 // 删除巡检计划
38 59 export function deleteInspectionPlan(data) {
39   - return request({
40   - url: '/inspectionPlan.deleteInspectionPlan',
41   - method: 'post',
42   - data: {
43   - communityId: getCommunityId(),
44   - ...data
45   - }
46   - }).then(res => res.data)
  60 + return new Promise((resolve, reject) => {
  61 + request({
  62 + url: '/inspectionPlan.deleteInspectionPlan',
  63 + method: 'post',
  64 + data: {
  65 + ...data,
  66 + communityId: getCommunityId()
  67 + }
  68 + }).then(response => {
  69 + const res = response.data
  70 + resolve(res)
  71 + }).catch(error => {
  72 + reject(error)
  73 + })
  74 + })
47 75 }
48 76  
49 77 // 更新巡检计划
50 78 export function updateInspectionPlan(data) {
51   - return request({
52   - url: '/inspectionPlan.updateInspectionPlan',
53   - method: 'post',
54   - data: {
55   - communityId: getCommunityId(),
56   - ...data
57   - }
58   - }).then(res => res.data)
  79 + return new Promise((resolve, reject) => {
  80 + request({
  81 + url: '/inspectionPlan.updateInspectionPlan',
  82 + method: 'post',
  83 + data: {
  84 + ...data,
  85 + communityId: getCommunityId()
  86 + }
  87 + }).then(response => {
  88 + const res = response.data
  89 + resolve(res)
  90 + }).catch(error => {
  91 + reject(error)
  92 + })
  93 + })
59 94 }
60 95  
61 96 // 查询巡检路线列表
62 97 export function listInspectionRoutes(params) {
63   - return request({
64   - url: '/inspectionRoute.listInspectionRoutes',
65   - method: 'get',
66   - params: {
67   - communityId: getCommunityId(),
68   - ...params
69   - }
70   - }).then(res => res.data)
  98 + return new Promise((resolve, reject) => {
  99 + request({
  100 + url: '/inspectionRoute.listInspectionRoutes',
  101 + method: 'get',
  102 + params: {
  103 + ...params,
  104 + communityId: getCommunityId()
  105 + }
  106 + }).then(response => {
  107 + const res = response.data
  108 + resolve(res)
  109 + }).catch(error => {
  110 + reject(error)
  111 + })
  112 + })
71 113 }
72 114  
73 115 // 查询巡检计划员工
74 116 export function listInspectionPlanStaffs(params) {
75   - return request({
76   - url: '/inspection.listInspectionPlanStaffs',
77   - method: 'get',
78   - params: {
79   - communityId: getCommunityId(),
80   - ...params
81   - }
82   - }).then(res => res.data)
  117 + return new Promise((resolve, reject) => {
  118 + request({
  119 + url: '/inspection.listInspectionPlanStaffs',
  120 + method: 'get',
  121 + params: {
  122 + ...params,
  123 + communityId: getCommunityId()
  124 + }
  125 + }).then(response => {
  126 + const res = response.data
  127 + resolve(res)
  128 + }).catch(error => {
  129 + reject(error)
  130 + })
  131 + })
83 132 }
84 133  
85 134 // 查询组织树
86 135 export function listOrgTree() {
87   - return request({
88   - url: '/org.listOrgTree',
89   - method: 'get',
90   - params: { communityId: getCommunityId() }
91   - }).then(res => res.data)
  136 + return new Promise((resolve, reject) => {
  137 + request({
  138 + url: '/org.listOrgTree',
  139 + method: 'get',
  140 + params: {
  141 + communityId: getCommunityId()
  142 + }
  143 + }).then(response => {
  144 + const res = response.data
  145 + resolve(res)
  146 + }).catch(error => {
  147 + reject(error)
  148 + })
  149 + })
92 150 }
93 151  
94 152 // 根据组织ID查询员工
95 153 export function listStaffsByOrgId(params) {
96   - return request({
97   - url: '/query.staff.infos',
98   - method: 'get',
99   - params: {
100   - communityId: getCommunityId(),
101   - ...params
102   - }
103   - }).then(res => res.data)
  154 + return new Promise((resolve, reject) => {
  155 + request({
  156 + url: '/query.staff.infos',
  157 + method: 'get',
  158 + params: {
  159 + ...params,
  160 + communityId: getCommunityId()
  161 + }
  162 + }).then(response => {
  163 + const res = response.data
  164 + resolve(res)
  165 + }).catch(error => {
  166 + reject(error)
  167 + })
  168 + })
104 169 }
105 170 \ No newline at end of file
... ...
src/components/inspection/DeleteInspectionRoutePoint.vue
1 1 <template>
2 2 <el-dialog
3   - :title="$t('common.confirmOperation')"
  3 + :title="$t('common.delete')"
4 4 :visible.sync="visible"
5 5 width="30%"
6 6 @close="handleClose"
... ...
src/components/inspection/InspectionRoutePoint.vue
... ... @@ -132,7 +132,7 @@ export default {
132 132  
133 133 <style lang="scss" scoped>
134 134 .inspection-route-point-container {
135   - padding: 20px;
  135 + padding: 10px;
136 136  
137 137 .margin-bottom {
138 138 margin-bottom: 20px;
... ...
src/components/inspection/RouteTask.vue
... ... @@ -109,7 +109,6 @@ export default {
109 109 li {
110 110 padding: 10px;
111 111 cursor: pointer;
112   - border-bottom: 1px solid #eee;
113 112 transition: all 0.3s;
114 113  
115 114 &:hover {
... ... @@ -122,7 +121,6 @@ export default {
122 121 }
123 122  
124 123 .task-user {
125   - font-weight: bold;
126 124 }
127 125  
128 126 .task-time {
... ...
src/components/inspection/deleteInspectionPlan.vue
... ... @@ -33,12 +33,16 @@ export default {
33 33  
34 34 async confirmDelete() {
35 35 try {
36   - await deleteInspectionPlan({ inspectionPlanId: this.currentPlanId })
  36 + const {code,msg} = await deleteInspectionPlan({ inspectionPlanId: this.currentPlanId })
  37 + if(code != 0){
  38 + this.$message.error(msg)
  39 + return
  40 + }
37 41 this.$message.success(this.$t('common.operationSuccess'))
38 42 this.visible = false
39 43 this.$emit('success')
40 44 } catch (error) {
41   - this.$message.error(this.$t('inspectionPlan.deleteError'))
  45 + this.$message.error(error)
42 46 }
43 47 }
44 48 }
... ...
src/views/inspection/inspectionPlanList.vue
... ... @@ -230,6 +230,6 @@ export default {
230 230 }
231 231  
232 232 .card-content {
233   - padding: 20px;
  233 + padding: 0px;
234 234 }
235 235 </style>
236 236 \ No newline at end of file
... ...
src/views/inspection/inspectionRouteList.vue
... ... @@ -175,7 +175,7 @@ export default {
175 175 this.$refs.deleteInspectionRoute.open(route)
176 176 },
177 177 _queryInspectionRouteMethod() {
178   - this._listInspectionRoutes(1, 10)
  178 + this._listInspectionRoutes(1, 100)
179 179 },
180 180 _switchInspectionRoute(route) {
181 181 this.inspectionRouteInfo.route = route
... ... @@ -190,7 +190,7 @@ export default {
190 190 }, 500)
191 191 },
192 192 handleSuccess() {
193   - this._listInspectionRoutes(1, 10)
  193 + this._listInspectionRoutes(1, 100)
194 194 }
195 195 }
196 196 }
... ...