工单 预警

This commit is contained in:
2025-08-22 17:27:27 +08:00
parent 2833f7d28b
commit 58cb07d33f
7 changed files with 295 additions and 263 deletions

View File

@@ -38,22 +38,23 @@
</view>
<!-- 底部操作按钮 -->
<view v-if="((!this.isManager&&this.detailStep != 0) || (this.isManager&&this.detailStep == 0))&&this.detailStep!=3" class="btn-group">
<view
v-if="((!this.isManager&&this.detailStep != 0) || (this.isManager&&this.detailStep == 0))&&this.detailStep!=3"
class="btn-group">
<button class="btn ghost"
@click="transfer">{{this.isManager ? '指派':this.detailStep == 1 ? '开始':'完成'}}</button>
<button v-if="this.detailStep == 1" class="btn primary"
@click="complete">转派</button>
@click="transfer(1)">{{this.isManager ? '指派':this.detailStep == 2 ? '完成':'开始'}}</button>
<button v-if="this.detailStep == 1" class="btn primary" @click="transfer(2)">转派</button>
</view>
<SelectUser :visible.sync="showSelect" :list="users" :multiple="false" @confirm="onConfirm" />
</view>
</template>
<script>
<script>
import SelectUser from '@/components/SelectUser.vue'
export default {
components: {
SelectUser
export default {
components: {
SelectUser
},
data() {
return {
@@ -64,22 +65,7 @@
detail: {},
isManager: false,
showSelect: false,
users: [{
id: '1',
name: '秦玉兰',
department: '物业修维部'
},
{
id: '2',
name: '秦桂花',
department: '物业修维部'
},
{
id: '3',
name: '李小明',
department: '物业修维部'
}
]
users: []
};
},
onLoad(options) {
@@ -87,29 +73,39 @@
if (options.item) {
const item = JSON.parse(decodeURIComponent(options.item));
this.detail = item;
this.detail.orderImgUrl =
"https://picsum.photos/80/80?random=3,https://picsum.photos/80/80?random=3,https://picsum.photos/80/80?random=3";
// 现在可以使用item对象了
// 进度映射
if (item.status == 0) {
this.detailStep = 0;
this.detailStatus = '创建工单';
} else if (item.status == 4) {
this.detailStep = 3;
this.detailStatus = '已结束';
} else if (item.status == 3) {
this.detailStep = 2;
this.detailStatus = '处理中';
} else {
this.detailStep = 1;
this.detailStatus = '已接单';
}
this.getStepInfo()
}
if ((this.isManager && this.detailStep == 0) || (!this.isManager && this.detailStep == 1)) {
this.getHandler()
}
},
methods: {
goBack() {
uni.navigateBack();
},
async getHandler() {
let handlers = await this.$u.api.getHandler3({}, this.detail.type);
if (handlers.code === 200) {
this.users = [...this.users, ...handlers.data];
}
},
getStepInfo(){
if (this.detail.status == 0) {
this.detailStep = 0;
this.detailStatus = '创建工单';
} else if (this.detail.status == 4) {
this.detailStep = 3;
this.detailStatus = '已结束';
} else if (this.detail.status == 3) {
this.detailStep = 2;
this.detailStatus = '处理中';
} else {
this.detailStep = 1;
this.detailStatus = '已接单';
}
},
previewImage(urls, index) {
// 使用uView的图片预览组件
this.$u.previewImage({
@@ -117,18 +113,42 @@
current: index
});
},
onConfirm(selected) {
async onConfirm(selected) {
let params = this.detail
params.handler = selected[0].value
params.status = 1
let res = await this.$u.api.updateOrder2(params);
if (res.code == '200') {
// 关闭页面前发送事件通知前页面刷新
uni.$emit('refreshData', '');
this.detail.handler = selected.value
this.detail.status = 1
this.getStepInfo()
}
},
transfer() {
this.showSelect = true
async submit() {
let params = this.detail
if(this.detail.status == 1||this.detail.status == 2){
params.status = 3
}else {
params.status = 4
}
let res = await this.$u.api.updateOrder2(params);
if (res.code == '200') {
// 关闭页面前发送事件通知前页面刷新
uni.$emit('refreshData', '');
this.detail.status = params.status
console.log("t1", params.status)
this.getStepInfo()
}
},
complete() {
uni.showToast({
title: '操作成功',
icon: 'success'
});
transfer(type) {
if (this.isManager || type == 2) {
this.showSelect = true
} else {
this.submit()
}
},
}
};
</script>