|
@@ -1,4 +1,6 @@
|
|
|
-const api = require("../api/api")
|
|
|
+const api = require("../api/api");
|
|
|
+const _Http = getApp().globalData.http;
|
|
|
+
|
|
|
import Dialog from 'tdesign-miniprogram/dialog/index';
|
|
|
Page({
|
|
|
data: {
|
|
@@ -7,7 +9,7 @@ Page({
|
|
|
// 跳转到物料添加
|
|
|
addProduct() {
|
|
|
wx.navigateTo({
|
|
|
- url: '/Eservice/agent/billCanUseProduct/index',
|
|
|
+ url: '/Eservice/agent/billCanUseProduct/index?id=' + this.data.billData.sa_workorderid
|
|
|
})
|
|
|
},
|
|
|
// 添加物料
|
|
@@ -31,11 +33,39 @@ Page({
|
|
|
[`billData.titems[${index}]`]: detail
|
|
|
})
|
|
|
},
|
|
|
+ /* 移除物料 */
|
|
|
+ deleteMaterial({
|
|
|
+ detail
|
|
|
+ }) {
|
|
|
+ wx.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: `是否确认删除“${detail.itemname}”`,
|
|
|
+ complete: (res) => {
|
|
|
+ if (res.confirm) api._post({
|
|
|
+ "id": "20230215202003",
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "sa_workorder_node_itemsids": [detail.sa_workorder_node_itemsid]
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg == '成功' ? '删除成功' : res.msg,
|
|
|
+ icon: "none",
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ "billData.titems": this.data.billData.titems.filter(v => v.sa_workorder_node_itemsid != detail.sa_workorder_node_itemsid)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
async updateMaterial(titems) {
|
|
|
+ console.log(this.data.confirmBills[0])
|
|
|
const res = await api._post({
|
|
|
"id": "20230215201903",
|
|
|
"content": {
|
|
|
- "sa_workorder_confirmationid": this.data.confirmBills[0].sa_workorder_confirmationid,
|
|
|
+ "sa_workorder_confirmationid": 0,
|
|
|
"sa_workorderid": this.data.billData.sa_workorderid,
|
|
|
"iteminfos": titems
|
|
|
}
|
|
@@ -77,7 +107,12 @@ Page({
|
|
|
|
|
|
},
|
|
|
changeBillStatus(data) {
|
|
|
- let id = data.currentTarget.dataset.id
|
|
|
+ let id = data.currentTarget.dataset.id;
|
|
|
+ if (id == 20230209144903 && this.data.billData.titems.length == 0) return wx.showToast({
|
|
|
+ title: '还未添加产品,不可完结',
|
|
|
+ icon: "none",
|
|
|
+ mask: true
|
|
|
+ })
|
|
|
const dialogConfig = {
|
|
|
context: this,
|
|
|
title: '提示',
|
|
@@ -119,7 +154,12 @@ Page({
|
|
|
"responsescore": 0,
|
|
|
}
|
|
|
})
|
|
|
- if (this.data.billData.type === '安装培训') {
|
|
|
+
|
|
|
+ if (this.data.billData.type === "维修") {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/Eservice/materielConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
|
|
|
+ })
|
|
|
+ } else if (this.data.billData.type === '安装培训') {
|
|
|
wx.navigateTo({
|
|
|
url: '/Eservice/trainConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
|
|
|
})
|
|
@@ -135,7 +175,7 @@ Page({
|
|
|
|
|
|
},
|
|
|
toConfirmBill(data) {
|
|
|
- if (this.data.billData.actiontype === "非工序模板") {
|
|
|
+ if (this.data.billData.type === "维修") {
|
|
|
wx.navigateTo({
|
|
|
url: '/Eservice/materielConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
|
|
|
})
|
|
@@ -152,7 +192,6 @@ Page({
|
|
|
url: '/Eservice/serviceConfirmBill/index?id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid + '&class=' + this.data.stopClick,
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
async confirmBillList() {
|
|
|
const res = await api._post({
|