|
|
@@ -262,25 +262,45 @@ Page({
|
|
|
},
|
|
|
// 跳转到物料添加
|
|
|
addProduct() {
|
|
|
+ let itemtype = this.data.mainData.workpresetjson.itemtype;
|
|
|
+
|
|
|
+ // ①若itemtype是"服务商品",则type=2:查询申请单商品
|
|
|
+ // ②若itemtype是"培训物料",则type=1:查询档案商品
|
|
|
+ let type = itemtype === '服务商品' ? 2 : 1;
|
|
|
+
|
|
|
wx.navigateTo({
|
|
|
- url: '/Eservice/serviceMaterial/index',
|
|
|
- })
|
|
|
+ url: `/E-service/serviceBillList/product/select?params=${JSON.stringify({
|
|
|
+ "content": {
|
|
|
+ "sa_workorderid": this.data.sa_workorderid,
|
|
|
+ "type": type, // 1档案, 2:申请单
|
|
|
+ "pageNumber": 1,
|
|
|
+ "pageSize": 20,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "id": "2026022710102502",
|
|
|
+ })}`
|
|
|
+ });
|
|
|
+ getApp().globalData.handleSelect = this.handleSelect.bind(this)
|
|
|
},
|
|
|
- // 添加物料
|
|
|
- getAdd(selection) {
|
|
|
- this.data.form.traintitem = selection.map(e => {
|
|
|
+ /* 处理新增产品 */
|
|
|
+ handleSelect(detail) {
|
|
|
+ let newItems = detail.list.map(v => {
|
|
|
return {
|
|
|
- "itemname": e.itemname,
|
|
|
- "itemid": e.itemid,
|
|
|
- "model": e.model,
|
|
|
- "spec": e.spec,
|
|
|
- "qty": 1
|
|
|
+ "itemname": v.itemname,
|
|
|
+ "itemid": v.itemid,
|
|
|
+ "model": v.model,
|
|
|
+ "spec": v.spec
|
|
|
}
|
|
|
})
|
|
|
+ let existingItems = this.data.titems || []
|
|
|
+ let allItems = [...existingItems, ...newItems]
|
|
|
this.setData({
|
|
|
- titems: this.data.form.traintitem
|
|
|
+ titems: allItems
|
|
|
})
|
|
|
this.updateNode()
|
|
|
+ wx.navigateBack();
|
|
|
},
|
|
|
// 修改物料数量
|
|
|
qtyChange(data) {
|