维修工完成工单,服务顾问授权

This commit is contained in:
Vinjor 2024-10-19 18:06:36 +08:00
parent d4d70c01b8
commit a193fc2c5c
7 changed files with 452 additions and 62 deletions

View File

@ -51,9 +51,9 @@
<view @click="receiveOrder(order.id)" v-if="order.ticketsStatus == '05' && order.ticketsWorkStatus=='01' && roleCanJd" class="btn qc">
接单
</view>
<view @click="doOrder(order.id)" v-if="order.ticketsStatus == '05' && order.ticketsWorkStatus=='04' && roleCanSg" class="btn qc">
开始施工
</view>
<!-- <view @click="doOrder(order.id)" v-if="order.ticketsStatus == '05' && order.ticketsWorkStatus=='04' && roleCanSg" class="btn qc">-->
<!-- 开始施工-->
<!-- </view>-->
<view v-if="order.ticketsStatus == '06' && roleCanQc" class="btn qc">
告知取车
</view>
@ -112,15 +112,9 @@ export default {
//
this.roleCanQc = true
}
if(userInfo.roleCodes.includes("repair_staff")){
//
if(userInfo.roleCodes.includes("repair_staff") && this.order.nowRepairId==userInfo.id){
//,
this.roleCanJd = true
console.log(this.order.nowRepairId,"this.order.nowRepairId")
console.log(userInfo.id,"userInfo.id")
if(this.order.nowRepairId==userInfo.id){
//
this.roleCanSg = true
}
}
},
onLoad(){

View File

@ -0,0 +1,224 @@
<template>
<view class="container">
<VNavigationBar background-color="#fff" title="图片授权客户" title-color="#333"></VNavigationBar>
<view class="body">
<!-- <div class="searchBox">-->
<!-- <div class="inputBox">-->
<!-- <input placeholder="请输入人员姓名" type="text">-->
<!-- </div>-->
<!-- <text>搜索</text>-->
<!-- </div>-->
<div class="userList">
<u-checkbox-group
placement="column"
v-model="checked">
<view v-for="(item, index) in list" :key="item.id" class="userItem">
<view class="info">
<image :src="imgUrlPrex + item.image" class="projImgItem" @click="prviewImage(list,index)"></image>
<view>
<text class="trade" v-if="item.isOpen=='1'" style="color:#0174F6 ">已授权</text>
<text class="trade" v-else>未授权</text>
<u-checkbox style="float: right" :name="item.id" iconSize="24" shape="circle" activeColor="#1890ff"></u-checkbox>
</view>
</view>
<!-- <radio :value="item.userId+''" :checked="index === current" />-->
</view>
</u-checkbox-group>
</div>
</view>
<view class="foot">
<view class="submit" @click="submit">保存</view>
</view>
</view>
</template>
<script>
import VNavigationBar from '@/components/VNavigationBar.vue'
import {bus} from "@/utils/eventBus";
import request from '@/utils/request';
import {getDictTextByCodeAndValue} from "@/utils/utils";
import {getJSONData} from "@/utils/auth";
import config from '@/config'
export default {
components: {
VNavigationBar,
},
data() {
return {
list: [],
imgUrlPrex:config.baseImageUrl,
checked:[],
}
},
watch: {
checked: {
handler(newVal, oldVal) {
this.buildList()
console.log('数组发生变化:', newVal);
},
deep: true
},
},
onLoad(data) {
this.list = getJSONData("chooseImg")
this.list.map((item)=>{
if(item.isOpen=='1'){
this.checked.push(item.id)
}
})
},
methods: {
/**
* 预览图片
*/
prviewImage(imgList, index) {
let urls = []
imgList.forEach(i => {
urls.push(this.imgUrlPrex+i.image)
})
uni.previewImage({
urls: urls,
current: index
});
},
/**
* 选中或取消选中重新组装数据
*/
buildList(){
this.list.map((item)=>{
if(this.checked.includes(item.id)){
item.isOpen="1"
}else{
item.isOpen="0"
}
})
},
submit() {
let itemList = []
this.list.map((item)=>{
itemList.push({
id:item.id,
isOpen:item.isOpen
})
})
console.log(itemList)
request({
url: '/admin-api/dl/repair-records/updateItemBatch',
method: 'post',
data:itemList
}).then((res)=>{
uni.showToast({
title: '操作成功!',
icon: 'none'
})
setTimeout(()=>{
uni.navigateBack()
},700)
})
}
}
}
</script>
<style lang="less" scoped>
.container {
height: 100%;
background-color: #F3F5F7;
display: flex;
flex-direction: column;
.body {
flex: 1;
height: 0;
overflow: auto;
padding: 20rpx 0;
.projImgItem {
width: 180rpx;
height: 180rpx;
background-color: #efefef;
}
.searchBox {
margin: 0 32rpx;
background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
padding: 30rpx;
display: flex;
align-items: center;
column-gap: 20rpx;
font-weight: 500;
font-size: 28rpx;
color: #0174F6;
.inputBox {
flex: 1;
width: 0;
color: #000;
}
}
.u-checkbox-group{
display: block !important;
}
.userList {
background-color: #fff;
padding: 0 20rpx;
height: 100%;
.userItem {
margin: 10rpx;
border: 1rpx solid #DDDDDD;
border-radius: 10rpx;
width: 210rpx;
float: left;
display: flex;
align-items: center;
justify-content: space-between;
.info {
display: flex;
flex-direction: column;
row-gap: 20rpx;
margin: auto;
.name {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
.trade {
font-weight: 500;
font-size: 24rpx;
color: #999999;
}
}
}
//.userItem:last-child {
// border-bottom: none;
//}
}
}
.foot {
background-color: #fff;
padding: 30rpx;
.submit {
margin: 0 auto;
width: 510rpx;
height: 76rpx;
background: #0174F6;
border-radius: 38rpx 38rpx 38rpx 38rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
color: #FFFFFF;
}
}
}
</style>

View File

@ -9,17 +9,20 @@
<!-- <text>搜索</text>-->
<!-- </div>-->
<div class="userList">
<u-checkbox-group
placement="column"
v-model="checked">
<view v-for="item in list" :key="item.userId" class="userItem">
<!-- <u-checkbox-group-->
<!-- placement="column"-->
<!-- v-model="checked">-->
<radio-group @change="radioChange">
<label v-for="(item, index) in list" :key="item.userId" class="userItem">
<view class="info">
<text class="name">{{item.userName}}</text>
<text class="trade">{{item.workTypeText}}</text>
</view>
<u-checkbox v-model="item.checked" :name="item.userId" iconSize="24" shape="circle" activeColor="#1890ff"></u-checkbox>
</view>
</u-checkbox-group>
<radio :value="item.userId+''" :checked="index === current" />
<!-- <u-checkbox v-model="item.checked" :name="item.userId" iconSize="24" shape="circle" activeColor="#1890ff"></u-checkbox>-->
</label>
</radio-group>
<!-- </u-checkbox-group>-->
</div>
</view>
@ -41,9 +44,12 @@ export default {
},
data() {
return {
current: 0,
ticketId:'',
list: [],
checked: []
checkedUserId:"",
checkedUserName:"",
ifDetail:false,
}
},
onLoad(data) {
@ -51,8 +57,23 @@ export default {
this.ticketId = data.id
this.workByTicketId()
}
if(data.ifDetail){
//2
this.ifDetail = true
}
},
methods: {
radioChange: function(evt) {
for (let i = 0; i < this.list.length; i++) {
if (this.list[i].userId == evt.detail.value) {
this.current = i;
this.checkedUserId = this.list[i].userId
this.checkedUserName = this.list[i].userName
break;
}
}
console.log(this.checkedUserName)
},
/**
* 通过工单id查询维修工人
*/
@ -69,12 +90,10 @@ export default {
})
},
submit() {
const nowRepairId = this.checked[0]
const nowRepair = this.list.filter(item => nowRepairId===item.userId);
const param = {
id:this.ticketId,
nowRepairId:nowRepairId,
nowRepairName:nowRepair[0].userName,
nowRepairId:this.checkedUserId,
nowRepairName:this.checkedUserName,
}
console.log(param)
request({
@ -87,7 +106,13 @@ export default {
icon: 'none'
})
setTimeout(()=>{
uni.navigateBack()
if(this.ifDetail){
uni.navigateBack({
delta: 2 // 2
})
}else{
uni.navigateBack()
}
},700)
})
//

View File

@ -12,7 +12,7 @@
style="width: 48rpx;height: 48rpx"></image>
<view class="flagBody">
<text>{{ ticketInfo.ticketsStatus == '02' ? '已完成' : ticketInfo.statusStr }}</text>
<text class="flagDesc">当前工单维修项目{{ ticketInfo.flag == '02' ? '已全部完成' : ticketInfo.statusStr }}</text>
<text class="flagDesc" v-if="nowRepair.repairItemId">当前工单维修项目{{ nowRepair.itemName }}</text>
</view>
</template>
</view>
@ -173,11 +173,7 @@
</view>
</view>
<view v-if="ticketInfo.wares && ticketInfo.wares.length > 0" class="card cardInfo projCard">
<view class="projTitle">维修配件 </view>
<view class="infoItem" style="flex: 1">
<view class="label"><text>是否开放给客户</text><switch :checked="ticketInfo.partShow == '1'" style="transform:scale(0.7)" @change="toPartShow" /></view>
</view>
<view class="projTitle">维修配件 <view class="dl-ifcus" v-if="canOpenCus"><text>是否开放给客户</text><switch :checked="ticketInfo.partShow == '1'" style="transform:scale(0.7)" @change="toPartShow" /></view></view>
<view class="projList">
<template>
<view v-for="item in ticketInfo.wares" :key="item.id" class="projEditItem">
@ -216,18 +212,18 @@
{{ item.remark }}
</view>
<view class="projImg">
<image v-for="(img, imgIndex) in item.itemList" :key="imgIndex" :src="imgUrlPrex + img.image"
<image v-for="(img, imgIndex) in item.itemList" @click="prviewImage(item.itemList,imgIndex)" :key="imgIndex" :src="imgUrlPrex + img.image"
class="projImgItem"></image>
</view>
<view class="projSend">
<template v-if="item.isSend">
<image mode="aspectFit" src="/static/icons/sendSuccess.png"
style="width: 28rpx;height: 28rpx"></image>
<text style="color: #858BA0">已发送客户</text>
</template>
<template v-else>
<image mode="aspectFit" src="/static/icons/send.png" style="width: 28rpx;height: 28rpx"></image>
<text style="color: #0174F6">发送给客户</text>
<view class="projSend" v-if="item.itemList.length>0 && canOpenCus">
<!-- <template >-->
<!-- <image mode="aspectFit" src="/static/icons/sendSuccess.png"-->
<!-- style="width: 28rpx;height: 28rpx"></image>-->
<!-- <text style="color: #858BA0">已发送客户</text>-->
<!-- </template>-->
<template >
<image mode="aspectFit" src="/static/icons/send.png" style="width: 28rpx;height: 28rpx"></image>
<text style="color: #0174F6" @click="sendCusImgManage(item.itemList)">发送给客户</text>
</template>
</view>
</template>
@ -242,22 +238,13 @@
</view>
</view>
<!-- 悬浮操作-->
<uni-fab ref="fab" :pattern="pattern" :content="content" :horizontal="horizontal" :vertical="vertical"
<uni-fab v-if="content.length>0" ref="fab" :pattern="pattern" :content="content" :horizontal="horizontal" :vertical="vertical"
:direction="direction" @trigger="trigger" @fabClick="fabClick" />
<!-- 普通弹窗---拍照上传 -->
<uni-popup ref="popup" background-color="#fff">
<view class="popup-content">
<view class="dl-avatar-box">
<uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile" limit="9" title="最多选择9张图片"></uni-file-picker>
<!-- <u-upload-->
<!-- :action="uploadUrl"-->
<!-- :headers="headers"-->
<!-- :file-list="fileList"-->
<!-- :max-count="10"-->
<!-- :show-upload-btn="true"-->
<!-- @after-read="afterRead"-->
<!-- @delete="deleteFile"-->
<!-- ></u-upload>-->
</view>
<button type="primary" @click="saveWorkingItem">保存</button>
</view>
@ -271,7 +258,7 @@ import {bus} from "@/utils/eventBus";
import request from '@/utils/request';
import upload from '@/utils/upload'
import {getOrderStatusText,formatDate,formatTimestamp,getDictTextByCodeAndValue,saveTicketsRecords} from "@/utils/utils";
import {getUserInfo} from '@/utils/auth'
import {getUserInfo,setJSONData} from '@/utils/auth'
import config from '@/config'
export default {
components: {
@ -292,6 +279,7 @@ export default {
},
content: [],
sizeType:['compressed'],
//
fileList: [],
imgUrlPrex:config.baseImageUrl,
//(01)
@ -300,6 +288,15 @@ export default {
ticketId: '',
//
ticketInfo: null,
//
nowRepair:{
repairItemId:"",
itemName:"",
},
//
canOpenCus:false,
//:working-|done_half-|done-
nowChooseOperate:"",
carInfo: {},
userInfo: {},
loginUser:{},
@ -362,9 +359,24 @@ export default {
if (data.isDetail){
this.isDetail = data.isDetail
}
},
onShow(){
this.getOrderDetail()
},
methods: {
/**
* 预览图片
*/
prviewImage(imgList, index) {
let urls = []
imgList.forEach(i => {
urls.push(this.imgUrlPrex+i.image)
})
uni.previewImage({
urls: urls,
current: index
});
},
afterRead(file) {
for (let i = 0; i < file.tempFilePaths.length; i++) {
upload({
@ -382,18 +394,33 @@ export default {
console.log('删除文件');
this.fileList.splice(index, 1);
},
/**
* 保存工作记录信息
*/
async saveWorkingItem(){
try {
let fileStr = this.fileList.map(item=>item.url.replace(config.baseImageUrl,"")).join(",")
const result = await saveTicketsRecords(this.ticketInfo.id,null,null,null,"sgz","施工中拍照记录",fileStr);
if("working"==this.nowChooseOperate){
//
const result = await saveTicketsRecords(this.ticketInfo.id,null,null,null,"sgz","施工中拍照记录",fileStr);
}else if("done_half"==this.nowChooseOperate || "done"==this.nowChooseOperate){
//
const result = await saveTicketsRecords(this.ticketInfo.id, '03',this.nowRepair.repairItemId,"03","sgwczj","阶段完成",fileStr);
}
this.$refs.popup.close()
uni.showToast({
title: '操作成功',
icon: 'none'
})
if("done"==this.nowChooseOperate){
//
setTimeout(()=>{
uni.navigateTo({
url: '/pages-order/choosePeople/choosePeople?id=' + this.ticketInfo.id +'&ifDetail=true'
})
},500)
}
console.error("result",result);
} catch (error) {
console.error(error);
@ -403,21 +430,45 @@ export default {
* 判断工单状态和角色控制显示什么操作按钮
*/
checkRoleOperate(){
this.content = []
if(this.loginUser.roleCodes.includes("service_advisor")){
//
this.canOpenCus = true
}
if(this.loginUser.roleCodes.includes("weixiu")){
//
this.canOpenCus = true
}
if(this.loginUser.roleCodes.includes("general_inspection")){
//
this.canOpenCus = true
}
if(this.loginUser.roleCodes.includes("repair_staff")){
//
if(this.ticketInfo.nowRepairId==this.loginUser.id){
//
if(this.ticketInfo.nowRepairId==this.loginUser.id && "05"==this.ticketInfo.ticketsStatus){
//,
this.content.push({
text: '配件申请', active: false,code:"apply"
})
if("02"==this.ticketInfo.ticketsWorkStatus){
//
//
this.content.push({
text: '拍照上传', active: false,code:"working"
})
this.content.push({
text: '阶段完成', active: false,code:"done_half"
})
this.content.push({
text: '全部完成', active: false,code:"done"
})
//
this.selectNowRepair()
}
if("03"==this.ticketInfo.ticketsWorkStatus || "04"==this.ticketInfo.ticketsWorkStatus) {
//
this.content.push({
text: '开始施工', active: false, code: "start"
})
}
}
}
@ -428,10 +479,14 @@ export default {
trigger(e) {
console.log(e)
this.content[e.index].active = !e.item.active
if("working"==e.item.code){
//
this.nowChooseOperate = e.item.code
if("working"==e.item.code || "done_half"==e.item.code || "done"==e.item.code){
//
this.fileList=[]
this.$refs.popup.open("bottom")
}else if("start" == e.item.code){
//
this.startWork(this.ticketInfo.id)
}
// uni.showModal({
// title: '',
@ -445,6 +500,16 @@ export default {
// }
// })
},
/**
* 维修照片是否授权给客户看管理
*/
sendCusImgManage(itemList){
console.log(itemList)
setJSONData("chooseImg",itemList)
uni.navigateTo({
url: '/pages-order/chooseImg/chooseImg'
})
},
/**
* 点击悬浮操作按钮
*/
@ -452,7 +517,54 @@ export default {
},
/**
* 是否开放给用户
* 开始施工
*/
startWork(id){
let paramsObj = {ticketId:id}
//
request({
url: '/admin-api/repair/titem/listProject',
method: 'get',
params:paramsObj
}).then((res) => {
console.log(res)
if (res.code == 200 && res.data.length>0) {
if(res.data.length==1){
//1
this.startWorkRequest(id,"02",res.data[0].id,"02","kssg","开始施工")
}else{
uni.showActionSheet({
itemList: res.data.map(m => m.itemName),
success: ({
tapIndex
}) => {
this.startWorkRequest(id,"02",res.data[tapIndex].id,"02","kssg","开始施工")
}
})
}
}else{
uni.showToast({
title: '操作失败,请联系管理员',
icon: 'none'
})
}
})
},
/**
* 开始施工请求后台
*/
async startWorkRequest(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark){
try {
const result = await saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark,null);
debugger
//
this.getOrderDetail()
} catch (error) {
console.error(error);
}
},
/**
* 是否开放给用户----配件单
*/
toPartShow(row){
console.log(row.detail.value)
@ -514,7 +626,28 @@ export default {
this.checkRoleOperate()
})
},
/**
* 查当前维修的项目
*/
selectNowRepair(){
request({
url: '/admin-api/dl/repair-records/listByTicketId',
method: 'get',
params:{ticketId:this.ticketInfo.id}
}).then((res)=>{
if(res.code==200){
if(res.data && res.data.hasOwnProperty("repair_item_id")){
this.nowRepair.repairItemId = res.data.repair_item_id
this.nowRepair.itemName = res.data.item_name
}
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
editPeople(type, proj) {
bus.$off('choosePeople')
bus.$on('choosePeople', (data) => {
@ -676,6 +809,11 @@ export default {
color: #333333;
}
.dl-ifcus{
font-size: 14px;
float: right;
}
.carCard {
.orderFlag {
display: flex;

View File

@ -10,7 +10,7 @@
<view class="body">
<view class="tabList">
<view v-for="(item, index) in tabList" :key="index" :class="{actived: item.id === activeKey}" class="tabItem"
@click="changeTabFun(item.id)">
@click.stop="changeTabFun(item.id)">
{{ item.title }}
<view v-if="activeKey === item.id" class="activeLine"></view>
</view>
@ -282,6 +282,7 @@ export default {
.tabItem {
padding: 30rpx;
flex: 1;
z-index: 9999999;
text-align: center;
position: relative;
font-size: 24rpx;

View File

@ -91,6 +91,13 @@
"enablePullDownRefresh": true
}
},
{
"path": "chooseImg/chooseImg",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": true
}
},
{
"path": "reviewList/reviewList",
"style": {

View File

@ -245,7 +245,7 @@
align-items: center;
z-index: 10;
border-radius: 45px;
box-shadow: $uni-shadow-base;
//box-shadow: $uni-shadow-base;
}
.uni-cursor-point {
@ -284,6 +284,7 @@
/* #ifdef H5 */
right: calc(15px + var(--window-right));
bottom: calc(30px + var(--window-bottom));
border: 1px solid #d6dee7;
/* #endif */
// padding: 10px;
}
@ -429,7 +430,7 @@
.uni-fab__content--other-platform {
border-width: 0px;
box-shadow: $uni-shadow-base;
//box-shadow: $uni-shadow-base;
}
.uni-fab__content--left {