|
|
@@ -7,47 +7,69 @@ Page({
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
data: {
|
|
|
- showWithInput:false,
|
|
|
- showProgress:false,
|
|
|
- showToWoker:false,
|
|
|
- orderMainData:{},
|
|
|
- list:[],
|
|
|
- templist:[],
|
|
|
- actTemp:null,
|
|
|
- actLeader:null
|
|
|
+ showWithInput: false,
|
|
|
+ showProgress: false,
|
|
|
+ showToWoker: false,
|
|
|
+ orderMainData: {},
|
|
|
+ list: [],
|
|
|
+ templist: [],
|
|
|
+ actTemp: null,
|
|
|
+ actLeader: null
|
|
|
},
|
|
|
- async mainData () {
|
|
|
+ async mainData() {
|
|
|
const res = await api._post({
|
|
|
"id": "20230206091603",
|
|
|
- "version":1,
|
|
|
+ "version": 1,
|
|
|
"content": {
|
|
|
- "sa_serviceorderid":this.data.id
|
|
|
+ "sa_serviceorderid": this.data.id
|
|
|
}
|
|
|
})
|
|
|
+ let tabbarsList = [];
|
|
|
+ if (res.data.status == '新建') {
|
|
|
+ tabbarsList = [{
|
|
|
+ label: "编辑",
|
|
|
+ icon: "icon-dibu-bianji"
|
|
|
+ }, {
|
|
|
+ label: "提交",
|
|
|
+ icon: "icon-tijiao",
|
|
|
+ }, {
|
|
|
+ label: "删除",
|
|
|
+ icon: "icon-guanlian-shanchu"
|
|
|
+ }];
|
|
|
+ } else if (res.data.status == '待指派') {
|
|
|
+ tabbarsList = [{
|
|
|
+ label: "转工单",
|
|
|
+ icon: "icon-shenhe"
|
|
|
+ }, {
|
|
|
+ label: "退回",
|
|
|
+ icon: "icon-a-fanshenhetuihui",
|
|
|
+ }];
|
|
|
+ }
|
|
|
this.setData({
|
|
|
- orderMainData:res.data
|
|
|
+ orderMainData: res.data,
|
|
|
+ tabbarsList
|
|
|
})
|
|
|
this.productmx()
|
|
|
this.fileData()
|
|
|
this.workOrderTemp()
|
|
|
this.workerData()
|
|
|
},
|
|
|
- async fileData () {
|
|
|
+ async fileData() {
|
|
|
const res = await api._post({
|
|
|
"method": "queryFileLink",
|
|
|
"classname": "system.attachment.Attachment",
|
|
|
"content": {
|
|
|
"ownertable": "sa_serviceorder",
|
|
|
"ownerid": this.data.id,
|
|
|
- "usetype":"附件"//传空返回有所
|
|
|
+ "usetype": "附件" //传空返回有所
|
|
|
}
|
|
|
})
|
|
|
this.setData({
|
|
|
- filelist:res.data,
|
|
|
- refresh:true
|
|
|
+ filelist: res.data,
|
|
|
+ refresh: true
|
|
|
})
|
|
|
},
|
|
|
- addProduct () {
|
|
|
+ addProduct() {
|
|
|
wx.navigateTo({
|
|
|
url: '/Eservice/workerLeader/billCanUseProduct/index',
|
|
|
})
|
|
|
@@ -55,14 +77,14 @@ Page({
|
|
|
|
|
|
async getAdd(selection) {
|
|
|
const res = await api._post({
|
|
|
- "id": "20230206161803",
|
|
|
- "version": 1,
|
|
|
+ "id": "20230206161803",
|
|
|
+ "version": 1,
|
|
|
"content": {
|
|
|
"sa_serviceorderid": this.data.id,
|
|
|
- "iteminfos":selection.map(e=>{
|
|
|
+ "iteminfos": selection.map(e => {
|
|
|
return {
|
|
|
- "sa_serviceorderitemsid": 0,
|
|
|
- "itemid": e,
|
|
|
+ "sa_serviceorderitemsid": 0,
|
|
|
+ "itemid": e,
|
|
|
"reason": ""
|
|
|
}
|
|
|
})
|
|
|
@@ -71,19 +93,19 @@ Page({
|
|
|
this.productmx()
|
|
|
},
|
|
|
|
|
|
- async productmx () {
|
|
|
+ async productmx() {
|
|
|
const res = await api._post({
|
|
|
- "id": "20230206161903",
|
|
|
- "version": 1,
|
|
|
+ "id": "20230206161903",
|
|
|
+ "version": 1,
|
|
|
"content": {
|
|
|
"sa_serviceorderid": this.data.id
|
|
|
}
|
|
|
})
|
|
|
this.setData({
|
|
|
- list:res.data
|
|
|
+ list: res.data
|
|
|
})
|
|
|
},
|
|
|
- async onMXDelete (data) {
|
|
|
+ async onMXDelete(data) {
|
|
|
let itemid = data.detail.sa_serviceorderitemsid
|
|
|
const res = await api._post({
|
|
|
"id": "20230206162003",
|
|
|
@@ -93,164 +115,177 @@ Page({
|
|
|
})
|
|
|
this.productmx()
|
|
|
},
|
|
|
- onEdit () {
|
|
|
|
|
|
- getApp().globalData.handelSelect = this
|
|
|
|
|
|
- wx.navigateTo({
|
|
|
- url: '/Eservice/workerLeader/editServiceBill/index',
|
|
|
- })
|
|
|
- },
|
|
|
- onSubmit() {
|
|
|
- let that = this
|
|
|
- const dialogConfig = {
|
|
|
- context: this,
|
|
|
- title: '提示',
|
|
|
- content: '确认提交当前申请单吗',
|
|
|
- confirmBtn: '确定',
|
|
|
- cancelBtn: '取消',
|
|
|
- };
|
|
|
+ /* 底部按钮回调 */
|
|
|
+ tabbarOnClick(e) {
|
|
|
+ let that = this,
|
|
|
+ dialogConfig = null,
|
|
|
+ res = null;
|
|
|
+ switch (e.detail.label) {
|
|
|
+ case "编辑":
|
|
|
+ getApp().globalData.handelSelect = this
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/Eservice/workerLeader/editServiceBill/index',
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ case "提交":
|
|
|
+ dialogConfig = {
|
|
|
+ context: this,
|
|
|
+ title: '提示',
|
|
|
+ content: '确认提交当前申请单吗',
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ };
|
|
|
|
|
|
- Dialog.confirm(dialogConfig)
|
|
|
- .then(async () => {
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230206101403",
|
|
|
- "version":1,
|
|
|
- "content": {
|
|
|
- "sa_serviceorderid":that.data.id,
|
|
|
- "issumbit":1,
|
|
|
- }
|
|
|
+ Dialog.confirm(dialogConfig)
|
|
|
+ .then(async () => {
|
|
|
+ res = await api._post({
|
|
|
+ "id": "20230206101403",
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "sa_serviceorderid": that.data.id,
|
|
|
+ "issumbit": 1,
|
|
|
+ }
|
|
|
+ })
|
|
|
+ that.mainData()
|
|
|
+ })
|
|
|
+ .catch((err) => console.log(err))
|
|
|
+ .finally(() => Dialog.close());
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "删除":
|
|
|
+ dialogConfig = {
|
|
|
+ context: this,
|
|
|
+ title: '提示',
|
|
|
+ content: '确认删除当前申请单吗',
|
|
|
+ confirmBtn: '确定',
|
|
|
+ cancelBtn: '取消',
|
|
|
+ };
|
|
|
+ Dialog.confirm(dialogConfig)
|
|
|
+ .then(async () => {
|
|
|
+ res = await api._post({
|
|
|
+ "id": "20230206091803",
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "sa_serviceorderids": [that.data.id],
|
|
|
+ }
|
|
|
+ })
|
|
|
+ wx.navigateBack()
|
|
|
+
|
|
|
+ })
|
|
|
+ .catch((err) => console.log(err))
|
|
|
+ .finally(() => Dialog.close());
|
|
|
+ break;
|
|
|
+ case "转工单":
|
|
|
+ this.setData({
|
|
|
+ showToWoker: !this.data.showToWoker
|
|
|
})
|
|
|
- that.mainData()
|
|
|
- })
|
|
|
- .catch((err) => console.log(err))
|
|
|
- .finally(() => Dialog.close());
|
|
|
+ break;
|
|
|
+ case "退回":
|
|
|
+ this.setData({
|
|
|
+ showWithInput: !this.data.showWithInput
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
},
|
|
|
- showBackReason () {
|
|
|
+ /* 取消按钮 */
|
|
|
+ showBackReason() {
|
|
|
this.setData({
|
|
|
- showWithInput:!this.data.showWithInput
|
|
|
+ showWithInput: false,
|
|
|
+ showToWoker: false
|
|
|
})
|
|
|
},
|
|
|
- inputReason (data) {
|
|
|
+ inputReason(data) {
|
|
|
console.log(data)
|
|
|
this.data.backreason = data.detail.value
|
|
|
},
|
|
|
async onBack() {
|
|
|
let that = this
|
|
|
+ if (!that.data.backreason) return;
|
|
|
const res = await api._post({
|
|
|
"id": "20230206101403",
|
|
|
- "version":1,
|
|
|
+ "version": 1,
|
|
|
"content": {
|
|
|
- "sa_serviceorderid":that.data.id,
|
|
|
- "issumbit":0,
|
|
|
- "backreason":that.data.backreason
|
|
|
+ "sa_serviceorderid": that.data.id,
|
|
|
+ "issumbit": 0,
|
|
|
+ "backreason": that.data.backreason
|
|
|
}
|
|
|
})
|
|
|
that.mainData()
|
|
|
+ that.showBackReason()
|
|
|
},
|
|
|
- onDelete() {
|
|
|
- let that = this
|
|
|
- const dialogConfig = {
|
|
|
- context: this,
|
|
|
- title: '提示',
|
|
|
- content: '确认删除当前申请单吗',
|
|
|
- confirmBtn: '确定',
|
|
|
- cancelBtn: '取消',
|
|
|
- };
|
|
|
|
|
|
- Dialog.confirm(dialogConfig)
|
|
|
- .then(async () => {
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230206091803",
|
|
|
- "version":1,
|
|
|
- "content": {
|
|
|
- "sa_serviceorderids":[that.data.id],
|
|
|
- }
|
|
|
- })
|
|
|
- wx.navigateBack()
|
|
|
-
|
|
|
- })
|
|
|
- .catch((err) => console.log(err))
|
|
|
- .finally(() => Dialog.close());
|
|
|
- },
|
|
|
-
|
|
|
- async workOrderTemp () {
|
|
|
+ async workOrderTemp() {
|
|
|
const res = await api._post({
|
|
|
"id": "20230206155803",
|
|
|
- "version":1,
|
|
|
- "content": {
|
|
|
- }
|
|
|
+ "version": 1,
|
|
|
+ "content": {}
|
|
|
})
|
|
|
this.setData({
|
|
|
- templist:res.data
|
|
|
+ templist: res.data
|
|
|
})
|
|
|
},
|
|
|
- showWorkerDialog () {
|
|
|
+ selectTemp(data) {
|
|
|
this.setData({
|
|
|
- showToWoker:!this.data.showToWoker
|
|
|
- })
|
|
|
- },
|
|
|
- selectTemp (data) {
|
|
|
- this.setData({
|
|
|
- actTemp:data.currentTarget.dataset.item
|
|
|
+ actTemp: data.currentTarget.dataset.item
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- async workerData () {
|
|
|
+ async workerData() {
|
|
|
const res = await api._post({
|
|
|
"id": "20230213143003",
|
|
|
- "version":1,
|
|
|
+ "version": 1,
|
|
|
"content": {
|
|
|
- "where":{
|
|
|
- "condition":""
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
this.setData({
|
|
|
- workers:res.data
|
|
|
+ workers: res.data
|
|
|
})
|
|
|
},
|
|
|
- selectLeader (data) {
|
|
|
+ selectLeader(data) {
|
|
|
this.setData({
|
|
|
- actLeader:data.currentTarget.dataset.item
|
|
|
+ actLeader: data.currentTarget.dataset.item
|
|
|
})
|
|
|
},
|
|
|
- async toWorker () {
|
|
|
+ async toWorker() {
|
|
|
console.log(this.data.actTemp)
|
|
|
if (!this.data.actTemp && !this.data.actLeader) {
|
|
|
wx.showToast({
|
|
|
title: '未选择工单模板或负责人',
|
|
|
- icon:'none'
|
|
|
+ icon: 'none'
|
|
|
})
|
|
|
} else {
|
|
|
const res = api._post({
|
|
|
"id": "20230207091003",
|
|
|
"content": {
|
|
|
- "type":this.data.actTemp.type,
|
|
|
- "sa_serviceorderid":this.data.id,
|
|
|
- "projectlearders":[this.data.actLeader.userid]
|
|
|
+ "type": this.data.actTemp.type,
|
|
|
+ "sa_serviceorderid": this.data.id,
|
|
|
+ "sa_workorder_templateid": this.data.actTemp.sa_workorder_templateid,
|
|
|
+ "projectlearders": [this.data.actLeader.userid]
|
|
|
}
|
|
|
})
|
|
|
- this.setData({
|
|
|
- showToWoker:false
|
|
|
- })
|
|
|
this.mainData()
|
|
|
+ this.showBackReason()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
async linkWorkOrder() {
|
|
|
const res = await api._post({
|
|
|
"id": "20230207154203",
|
|
|
- "version":1,
|
|
|
+ "version": 1,
|
|
|
"content": {
|
|
|
- "sa_serviceorderid":this.data.id
|
|
|
+ "sa_serviceorderid": this.data.id
|
|
|
}
|
|
|
})
|
|
|
this.setData({
|
|
|
- linkWorkOrders:res.data
|
|
|
+ linkWorkOrders: res.data
|
|
|
})
|
|
|
},
|
|
|
- tolinkWorkOrder (e) {
|
|
|
+ tolinkWorkOrder(e) {
|
|
|
let id = e.currentTarget.dataset.item.sa_workorderid
|
|
|
|
|
|
let app = getApp()
|
|
|
@@ -261,14 +296,14 @@ Page({
|
|
|
url: '/Eservice/workerLeader/editworkOrderDetail/index?id=' + id
|
|
|
})
|
|
|
},
|
|
|
- async showProgressDialog () {
|
|
|
+ async showProgressDialog() {
|
|
|
const res = await api._post({
|
|
|
- id:"20230208140203",
|
|
|
- content:{}
|
|
|
+ id: "20230208140203",
|
|
|
+ content: {}
|
|
|
})
|
|
|
this.setData({
|
|
|
- showProgress:!this.data.showProgress,
|
|
|
- progress:res.data
|
|
|
+ showProgress: !this.data.showProgress,
|
|
|
+ progress: res.data
|
|
|
})
|
|
|
},
|
|
|
/**
|
|
|
@@ -276,7 +311,7 @@ Page({
|
|
|
*/
|
|
|
onLoad(options) {
|
|
|
this.setData({
|
|
|
- id:options.id
|
|
|
+ id: options.id
|
|
|
})
|
|
|
this.linkWorkOrder()
|
|
|
},
|