Commit 5631a5ce by zhangxw

施工单修改

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