1
This commit is contained in:
parent
4346afe5ab
commit
05bf3832ab
@ -303,6 +303,7 @@ export default {
|
|||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
|
bus.$emit('choosePeople')
|
||||||
}, 700)
|
}, 700)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -332,6 +333,7 @@ export default {
|
|||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
|
bus.$emit('choosePeople')
|
||||||
}, 700)
|
}, 700)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="isDetail == '0'" class="foot">
|
<view v-if="isDetail == '0' && null!=ticketInfo" class="foot">
|
||||||
<view class="submit" @click="submit">保存工单</view>
|
<view class="submit" @click="submit">保存工单</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -334,7 +334,7 @@ import {bus} from "@/utils/eventBus";
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import upload from '@/utils/upload'
|
import upload from '@/utils/upload'
|
||||||
import {getOrderStatusText,formatDate,formatTimestamp,getDictTextByCodeAndValue,saveTicketsRecords} from "@/utils/utils";
|
import {getOrderStatusText,formatDate,formatTimestamp,getDictTextByCodeAndValue,saveTicketsRecords} from "@/utils/utils";
|
||||||
import {getUserInfo,setJSONData,getJSONData,setStorageWithExpiry,getStorageWithExpiry} from '@/utils/auth'
|
import {getToken,getUserInfo,setJSONData,getJSONData,setStorageWithExpiry,getStorageWithExpiry} from '@/utils/auth'
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -403,37 +403,47 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
// demo 是要深度监听的值
|
// ticketInfo: {
|
||||||
ticketInfo: {
|
// handler(newVal, oldVal) {
|
||||||
handler(newVal, oldVal) {
|
// console.log(newVal, "有变化");
|
||||||
console.log(newVal, "有变化");
|
// setJSONData("projects",newVal.projects)
|
||||||
setJSONData("projects",newVal.projects)
|
// },
|
||||||
},
|
// // 开启深度监听
|
||||||
// 开启深度监听
|
// deep: true
|
||||||
deep: true
|
// }
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onLoad(data) {
|
onLoad(data) {
|
||||||
this.loginUser = getUserInfo()
|
if(!getToken()){
|
||||||
this.canSeeMoney = !this.loginUser.roleCodes.includes('repair_staff');
|
uni.reLaunch({
|
||||||
console.log(this.loginUser,294)
|
url: '/pages/login/login'
|
||||||
console.log(data)
|
})
|
||||||
if (data.id) {
|
}else {
|
||||||
this.ticketId = data.id
|
this.loginUser = getUserInfo()
|
||||||
}
|
this.canSeeMoney = !this.loginUser.roleCodes.includes('repair_staff');
|
||||||
if (data.isDetail){
|
console.log(this.loginUser, 294)
|
||||||
this.isDetail = data.isDetail
|
console.log(data)
|
||||||
|
if (data.id) {
|
||||||
|
this.ticketId = data.id
|
||||||
|
}
|
||||||
|
if (data.isDetail) {
|
||||||
|
this.isDetail = data.isDetail
|
||||||
|
}
|
||||||
|
this.refreshData(false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onShow(){
|
|
||||||
//获取订单详情
|
|
||||||
this.getOrderDetail()
|
|
||||||
//查维修进度记录
|
|
||||||
this.getProjItem()
|
|
||||||
//获取当前订单是否有审批的配件
|
|
||||||
this.waresByTicket()
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 刷新数据通用方法
|
||||||
|
*/
|
||||||
|
refreshData(cache){
|
||||||
|
//获取订单详情
|
||||||
|
this.getOrderDetail(cache)
|
||||||
|
//查维修进度记录
|
||||||
|
this.getProjItem()
|
||||||
|
//获取当前订单是否有审批的配件
|
||||||
|
this.waresByTicket()
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 删除项目
|
* 删除项目
|
||||||
*/
|
*/
|
||||||
@ -516,28 +526,30 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
//修改配件的信息
|
//修改配件的信息
|
||||||
if(this.ticketInfo.wares && this.ticketInfo.wares.length>0){
|
if(this.ticketInfo.waresGroupList && this.ticketInfo.waresGroupList.length>0){
|
||||||
this.ticketInfo.wares.map((item)=>{
|
this.ticketInfo.waresGroupList.map((groupItem)=>{
|
||||||
//不校验项目金额、折扣、数量必填,但是为null的设置为0
|
groupItem.wares.map((item)=>{
|
||||||
if(!item.itemPrice){
|
//不校验项目金额、折扣、数量必填,但是为null的设置为0
|
||||||
item.itemPrice = 0
|
if(!item.itemPrice){
|
||||||
}
|
item.itemPrice = 0
|
||||||
if(!item.itemCount){
|
}
|
||||||
item.itemCount = 0
|
if(!item.itemCount){
|
||||||
}
|
item.itemCount = 0
|
||||||
if(!item.itemDiscount){
|
}
|
||||||
item.itemDiscount = 1
|
if(!item.itemDiscount){
|
||||||
}
|
item.itemDiscount = 1
|
||||||
item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
|
}
|
||||||
let itemObj = {
|
item.itemMoney = item.itemPrice*item.itemCount*item.itemDiscount
|
||||||
id:item.id,
|
let itemObj = {
|
||||||
ticketId:item.ticketId,
|
id:item.id,
|
||||||
itemPrice:item.itemPrice,
|
ticketId:item.ticketId,
|
||||||
itemCount:item.itemCount,
|
itemPrice:item.itemPrice,
|
||||||
itemDiscount:item.itemDiscount,
|
itemCount:item.itemCount,
|
||||||
itemMoney:item.itemMoney,
|
itemDiscount:item.itemDiscount,
|
||||||
}
|
itemMoney:item.itemMoney,
|
||||||
itemList.push(itemObj)
|
}
|
||||||
|
itemList.push(itemObj)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,14 +709,16 @@ export default {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
},500)
|
},500)
|
||||||
}
|
}else if("other"==this.nowChooseOperate){
|
||||||
if("other"==this.nowChooseOperate){
|
|
||||||
//移交下一班组维修,需要指派下一个维修人
|
//移交下一班组维修,需要指派下一个维修人
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages-order/choosePeople/choosePeople?id=' + this.ticketInfo.id+'&itemId='+this.nowRepair.repairItemId +'&ifDetail=true'
|
url: '/pages-order/choosePeople/choosePeople?id=' + this.ticketInfo.id+'&itemId='+this.nowRepair.repairItemId +'&ifDetail=true'
|
||||||
})
|
})
|
||||||
},500)
|
},500)
|
||||||
|
}else{
|
||||||
|
//停留当前页面,刷新数据
|
||||||
|
this.refreshData(false)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -899,7 +913,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const result = await saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark,null);
|
const result = await saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark,null);
|
||||||
//刷新数据
|
//刷新数据
|
||||||
this.getOrderDetail()
|
this.refreshData(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
@ -955,7 +969,7 @@ export default {
|
|||||||
/**
|
/**
|
||||||
* 查看订单详情
|
* 查看订单详情
|
||||||
*/
|
*/
|
||||||
getOrderDetail(){
|
getOrderDetail(cache){
|
||||||
request({
|
request({
|
||||||
url: '/admin-api/repair/tickets/get',
|
url: '/admin-api/repair/tickets/get',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@ -994,25 +1008,27 @@ export default {
|
|||||||
item.createTime = formatTimestamp(item.createTime)
|
item.createTime = formatTimestamp(item.createTime)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//从缓存中获取项目的信息替换掉
|
if(cache){
|
||||||
let projects = getJSONData("projects")
|
//从缓存中获取项目的信息替换掉
|
||||||
let projectMap = new Map();
|
let projects = getJSONData("projects")
|
||||||
if(projects){
|
let projectMap = new Map();
|
||||||
//转key value形式
|
if(projects){
|
||||||
projects.map((item)=>{
|
//转key value形式
|
||||||
projectMap.set(item.id,item)
|
projects.map((item)=>{
|
||||||
})
|
projectMap.set(item.id,item)
|
||||||
resultObj.projects = resultObj.projects.map((item)=>{
|
})
|
||||||
if(projectMap.has(item.id)){
|
resultObj.projects = resultObj.projects.map((item)=>{
|
||||||
console.log(projectMap.get(item.id))
|
if(projectMap.has(item.id)){
|
||||||
let localObj = projectMap.get(item.id)
|
console.log(projectMap.get(item.id))
|
||||||
item.itemPrice = localObj.itemPrice
|
let localObj = projectMap.get(item.id)
|
||||||
item.itemCount = localObj.itemCount
|
item.itemPrice = localObj.itemPrice
|
||||||
item.itemDiscount = localObj.itemDiscount
|
item.itemCount = localObj.itemCount
|
||||||
item.itemMoney = localObj.itemMoney
|
item.itemDiscount = localObj.itemDiscount
|
||||||
}
|
item.itemMoney = localObj.itemMoney
|
||||||
return item
|
}
|
||||||
})
|
return item
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.$nextTick(()=>{
|
this.$nextTick(()=>{
|
||||||
this.ticketInfo = resultObj
|
this.ticketInfo = resultObj
|
||||||
@ -1060,16 +1076,13 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
editPeople(type, proj) {
|
editPeople(type, proj) {
|
||||||
|
//需要选施工人员,记录缓存
|
||||||
|
setJSONData("projects",this.ticketInfo.projects)
|
||||||
bus.$off('choosePeople')
|
bus.$off('choosePeople')
|
||||||
bus.$on('choosePeople', (data) => {
|
bus.$on('choosePeople', (data) => {
|
||||||
console.log('choosePeople', data)
|
console.log('choosePeople', data)
|
||||||
console.log('type', type)
|
//需要将缓存中的值取出来
|
||||||
if (type === 'xs') {
|
this.refreshData(true)
|
||||||
proj.salesman = data
|
|
||||||
} else if (type === 'sg') {
|
|
||||||
proj.constructor = data
|
|
||||||
}
|
|
||||||
console.log('proj', proj)
|
|
||||||
})
|
})
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages-order/choosePeople/choosePeople?type=${type}&ticketId=${this.ticketId}&projectId=${proj.projectId}`
|
url: `/pages-order/choosePeople/choosePeople?type=${type}&ticketId=${this.ticketId}&projectId=${proj.projectId}`
|
||||||
|
Loading…
Reference in New Issue
Block a user