|
@@ -43,7 +43,7 @@
|
43
|
43
|
<view class="btns">
|
44
|
44
|
<button @click="handler('changeUser', data.id)" type="default" class="primaryButton btn" v-if="data.state.value === 'pending' || data.state.value === 'handler' || (data.state.value === 'reassign' && assignFlag)">换人处理</button>
|
45
|
45
|
<button @click="handler('handler', data.id)" type="default" class="primaryButton btn" v-if="data.state.value === 'handler'">处理</button>
|
46
|
|
- <button @click="handler('receive', data.id)" type="default" class="primaryButton btn" v-if="data.state.value === 'pending'">接单</button>
|
|
46
|
+ <button @click="receive(data)" type="default" class="primaryButton btn" v-if="computedReceive(data)">接单</button>
|
47
|
47
|
</view>
|
48
|
48
|
</view>
|
49
|
49
|
</view>
|
|
@@ -59,9 +59,9 @@
|
59
|
59
|
<script setup>
|
60
|
60
|
import IncidentListFilter from '@/components/IncidentListFilter.vue';
|
61
|
61
|
import IncidentAttachment from '@/components/IncidentAttachment.vue';
|
62
|
|
- import { ref, reactive } from 'vue'
|
|
62
|
+ import { ref, reactive, computed } from 'vue'
|
63
|
63
|
import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
64
|
|
- import { api_getDictionary, api_incident, api_incident_count } from "@/http/api.js"
|
|
64
|
+ import { api_getDictionary, api_incident, api_incident_count, api_incidentTask } from "@/http/api.js"
|
65
|
65
|
import { filterFormatDate } from '@/filters/filterFormatDate.js'
|
66
|
66
|
import { computedPriorityStyle } from '@/filters/computedPriorityStyle.js'
|
67
|
67
|
import { computedStateStyle } from '@/filters/computedStateStyle.js'
|
|
@@ -83,6 +83,21 @@
|
83
|
83
|
const primaryColor = ref(defaultColor)
|
84
|
84
|
|
85
|
85
|
const assignFlag = ref(false);//指派权限
|
|
86
|
+ const qiangdan = ref(false);//接单权限
|
|
87
|
+
|
|
88
|
+ // 判断是否显示接单按钮
|
|
89
|
+ const computedReceive = computed(() => (data) => {
|
|
90
|
+ let inUser = data.currentLog && data.currentLog.workerId == loginUserStore.loginUser.user.id;
|
|
91
|
+ let inGroup = false;
|
|
92
|
+ loginUserStore.loginUser.user.group.forEach(item => {
|
|
93
|
+ if(data.currentLog){
|
|
94
|
+ if (item.id == data.currentLog.groupId) {
|
|
95
|
+ inGroup = true;
|
|
96
|
+ }
|
|
97
|
+ }
|
|
98
|
+ })
|
|
99
|
+ return data.state.value === 'pending' && (inUser || inGroup) && qiangdan.value;
|
|
100
|
+ })
|
86
|
101
|
|
87
|
102
|
// 数据
|
88
|
103
|
const dataInfo = reactive({
|
|
@@ -164,6 +179,49 @@
|
164
|
179
|
})
|
165
|
180
|
}
|
166
|
181
|
|
|
182
|
+ // 接单调用方案
|
|
183
|
+ function receiveFn(incidentData){
|
|
184
|
+ uni.showLoading({
|
|
185
|
+ title: "加载中",
|
|
186
|
+ mask: true,
|
|
187
|
+ });
|
|
188
|
+
|
|
189
|
+ let postData = {
|
|
190
|
+ incident: incidentData,
|
|
191
|
+ }
|
|
192
|
+
|
|
193
|
+ api_incidentTask('receive', postData).then(res => {
|
|
194
|
+ uni.hideLoading();
|
|
195
|
+ if(res.state == 200){
|
|
196
|
+ getList(0);
|
|
197
|
+ uni.showToast({
|
|
198
|
+ icon: 'none',
|
|
199
|
+ title: '接单成功',
|
|
200
|
+ mask: true,
|
|
201
|
+ });
|
|
202
|
+ }else{
|
|
203
|
+ uni.showToast({
|
|
204
|
+ icon: 'none',
|
|
205
|
+ title: res.msg || '请求数据失败!'
|
|
206
|
+ });
|
|
207
|
+ }
|
|
208
|
+ })
|
|
209
|
+ }
|
|
210
|
+ // 接单按钮
|
|
211
|
+ function receive(incidentData){
|
|
212
|
+ uni.showModal({
|
|
213
|
+ title: '提示',
|
|
214
|
+ content: `您确认要接单吗?`,
|
|
215
|
+ confirmColor: defaultColor,
|
|
216
|
+ confirmText: '确认',
|
|
217
|
+ success: function(res) {
|
|
218
|
+ if (res.confirm) {
|
|
219
|
+ receiveFn(incidentData);
|
|
220
|
+ }
|
|
221
|
+ }
|
|
222
|
+ });
|
|
223
|
+ }
|
|
224
|
+
|
167
|
225
|
// 获取列表信息
|
168
|
226
|
function getList(idx){
|
169
|
227
|
uni.showLoading({
|
|
@@ -286,9 +344,12 @@
|
286
|
344
|
|
287
|
345
|
onLoad((option) => {
|
288
|
346
|
for (let i = 0; i < loginUserStore.loginUser.menu.length; i++) {
|
289
|
|
- if (loginUserStore.loginUser.menu[i].link == "shijianliebiao_assign") {
|
290
|
|
- assignFlag.value = true;
|
291
|
|
- }
|
|
347
|
+ if (loginUserStore.loginUser.menu[i].link == "shijianliebiao_assign") {
|
|
348
|
+ assignFlag.value = true;
|
|
349
|
+ }
|
|
350
|
+ if (loginUserStore.loginUser.menu[i].link == "shijianliebiao_qiangdan") {
|
|
351
|
+ qiangdan.value = true
|
|
352
|
+ }
|
292
|
353
|
}
|
293
|
354
|
getTabs();
|
294
|
355
|
})
|