Commit 5631a5ce by zhangxw

施工单修改

1 parent 39c367f7
......@@ -385,4 +385,8 @@ module.exports = {
getQYTechnicianList(data) {
return api.post('dj.api.smartcarlife.roleTechnician.list', data)
},
/**人员权限 */
staffPermissions(data) {
return api.post('dj.api.smartcarlife.qdhc.staff.permissions', data)
}
}
......@@ -10,7 +10,7 @@ Component({
type: Boolean,
observer: function (n) {
if (n) {
let { copyArtificerList, artificerSelectObj, disabledSelectObj } =
let { copyArtificerList, artificerSelectObj, disabledSelectObj, deputyFlag } =
this.data
const selectArr = Array.isArray(artificerSelectObj)
? artificerSelectObj?.map(val => {
......@@ -28,6 +28,12 @@ Component({
}
return i
})
// 是副手技师选中两个后其余置灰
if (selectArr.length == 2 && deputyFlag) {
copyArtificerList.forEach(i => {
if (!selectArr.includes(i.id)) i.disabled = true
})
}
this.setData({
artificerList: wx.$util.deepClone(copyArtificerList),
selectedTechnicianId: selectArr,
......
......@@ -32,7 +32,8 @@ Component({
})
}
}
}
},
userPermissions: Array
},
/**
......
......@@ -52,7 +52,7 @@
</scroll-view>
</view>
</view>
<view class="popup-footer {{ isFullSucreen?'isFullSucreen':'' }}">
<view class="popup-footer {{ isFullSucreen?'isFullSucreen':'' }}" wx:if="{{filter.btnPermissions(userPermissions, 'WULIAOCHUKU')}}">
<view class="cancel btn text-center" bind:tap="cancel">取消</view>
<view class="confirm btn text-center" bind:tap="confirm">确认核销出库</view>
</view>
......
......@@ -36,11 +36,21 @@ var activeNum = function (array, subKey) {
return count
}
var btnPermissions = function (permissionsArr, key) {
for (var i = 0; i < permissionsArr.length; i++) {
if (permissionsArr[i] && permissionsArr[i].code == key) {
return true
}
}
return false
}
/*
* 导出
*/
module.exports = {
replaceItemText: replaceItemText,
techicianName: techicianName,
activeNum: activeNum
activeNum: activeNum,
btnPermissions: btnPermissions
}
......@@ -24,7 +24,8 @@ Page({
mainSelected: [], // 主技师已选
deputySelected: [], // 副手技师已选
servicesList: [], // 所有服务项目列表
editServicesList: [] // 编辑时显示的服务项目数据
editServicesList: [], // 编辑时显示的服务项目数据
userPermissions: [] // 权限数组
},
onRoute(options) {
......@@ -40,6 +41,7 @@ Page({
this.setData({
baseConfigData
})
this.getStaffPermissions()
})
},
......@@ -62,6 +64,37 @@ Page({
onShow() {
},
// 获取人员权限
getStaffPermissions() {
// 假数据开始
const res = {
code: 0,
data: [{
name: '施工确认',
code: 'SHIGONGQUEREN'
}, {
name: '完成施工',
code: 'WANCHENGSHIGONG'
}]
}
this.setData({
userPermissions: res.data
})
return
let { userInfo } = this.data
commonApi.staffPermissions({phone: userInfo?.phone}).then(res => {
console.log(res)
let { code, data, message } = res
if (code == 0) {
this.setData({
userPermissions: data || []
})
} else {
wx.$util.showToast(message)
}
})
},
// 获取详情数据
getDetail(data) {
api.getConstructionDetail({
......@@ -332,9 +365,7 @@ Page({
api.confirmConstruction(params).then(res => {
let { code, message } = res
if (code == 0) {
setTimeout(() => {
wx.$router.redirectTo('repairOrderDetail', {id: confirmInfo.id, constructionCode: confirmInfo.constructionCode, orderCode: confirmInfo.orderCode})
}, 200)
wx.$router.redirectTo('repairOrderDetail', {id: confirmInfo.id, constructionCode: confirmInfo.constructionCode, orderCode: confirmInfo.orderCode})
} else {
wx.$util.showToast(message)
}
......
......@@ -118,7 +118,7 @@
</view>
</view>
</view>
<view class="btns {{ isFullSucreen?'isFullSucreen-btn':'' }}">
<view class="btns {{ isFullSucreen?'isFullSucreen-btn':'' }}" wx:if="{{filter.btnPermissions(userPermissions, 'SHIGONGQUEREN')}}">
<view class="btns-con">
<view class="confirm text-center" bindtap="submit">提交电子施工单</view>
</view>
......
......@@ -120,34 +120,30 @@ Page({
text: '已出库',
color: '#35C376'
}
}
},
userPermissions: [], // 人员权限
},
onRoute(options) {
this.setData(
{
queryOptions: options
},
() => {
this.getDetail()
}
)
this.setData({
queryOptions: options
}, () => {
this.getDetail()
this.getStaffPermissions()
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options, 'options')
if (options.id) {
this.setData(
{
queryOptions: options
},
() => {
this.getDetail()
}
)
this.setData({
queryOptions: options
}, () => {
this.getDetail()
this.getStaffPermissions()
})
}
if (options?.scene) {
this.setSceneData(options.scene)
......@@ -162,7 +158,42 @@ Page({
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
onShow() {
},
// 人员权限
getStaffPermissions() {
// 假数据开始
const res = {
code: 0,
data: [{
name: '施工确认',
code: 'SHIGONGQUEREN'
}, {
name: '完成施工',
code: 'WANCHENGSHIGONG'
}, {
name: '物料出库',
code: 'WULIAOCHUKU'
}]
}
this.setData({
userPermissions: res.data
})
return
let { userInfo } = this.data
staffPermissions({phone: userInfo?.phone}).then(res => {
console.log(res)
let { code, data, message } = res
if (code == 0) {
this.setData({
userPermissions: data || []
})
} else {
wx.$util.showToast(message)
}
})
},
// 处理扫码进入详情页面解析参数
setSceneData(sceneId) {
let userInfo = wx.$util.getUserInfo()
......@@ -345,7 +376,10 @@ Page({
api.outboundAPI(params).then(res => {
let { code, message } = res
if (code == 0) {
wx.$util.showToast('出库成功')
wx.showToast({
title: '出库成功',
icon: 'success'
})
this.handleOutboundCancel()
this.getDetail()
} else {
......@@ -606,13 +640,15 @@ Page({
submitFlag: false
})
if (code == 0) {
wx.$util.showToast('完成施工')
wx.showToast({
title: '完成施工',
icon: 'success'
})
this.getDetail(true)
} else {
wx.$util.showToast(message)
}
})
.catch(() => {
}).catch(() => {
this.setData({
submitFlag: false
})
......@@ -629,23 +665,25 @@ Page({
confirmText: '审核通过',
cancelText: '不通过',
success(res) {
api
.approvalRepairOrder({
id: detailInfo.id,
constructionCode: detailInfo.constructionCode,
approvalStatus: res.confirm ? 1 : res.cancel ? 2 : ''
})
.then(result => {
let { code, message } = result
if (code == 0) {
wx.$util.showToast('操作成功')
setTimeout(() => {
wx.$router.back()
}, 200)
} else {
wx.$util.showToast(message)
}
})
api.approvalRepairOrder({
id: detailInfo.id,
constructionCode: detailInfo.constructionCode,
approvalStatus: res.confirm ? 1 : res.cancel ? 2 : ''
}).then(result => {
let { code, message } = result
if (code == 0) {
wx.$util.showToast('')
wx.showToast({
title: '操作成功',
icon: 'success'
})
setTimeout(() => {
wx.$router.back()
}, 200)
} else {
wx.$util.showToast(message)
}
})
}
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!