|
@@ -2,277 +2,277 @@ const api = require("../api/api")
|
|
|
|
|
|
Page({
|
|
|
|
|
|
- /**
|
|
|
- * 页面的初始数据
|
|
|
- */
|
|
|
- data: {
|
|
|
- timerid: null,
|
|
|
- bindSignNameData: {
|
|
|
- "ownertable": "sa_workorder_confirmation",
|
|
|
- "ownerid": 0,
|
|
|
- "usetype": "signature",
|
|
|
- }
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 页面的初始数据
|
|
|
+ */
|
|
|
+ data: {
|
|
|
+ timerid: null,
|
|
|
+ bindSignNameData: {
|
|
|
+ "ownertable": "sa_workorder_confirmation",
|
|
|
+ "ownerid": 0,
|
|
|
+ "usetype": "signature",
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- async billData() {
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230211105803",
|
|
|
- "content": {
|
|
|
- "sa_workorder_confirmationid": this.data.id
|
|
|
- }
|
|
|
- })
|
|
|
- console.log('详情', res)
|
|
|
- this.setData({
|
|
|
- mainData: res.data,
|
|
|
- sa_serviceorderid: res.data.workorder.sa_serviceorderid,
|
|
|
- sa_orderid: res.data.workorder.sa_orderid||'0',
|
|
|
- stopClick: res.data.status !== '新建' ? 'stopClick' : this.data.stopClick
|
|
|
- })
|
|
|
- this.setInputData()
|
|
|
- },
|
|
|
- setInputData() {
|
|
|
- this.data.mainData.confirmationcontent.forEach(e => {
|
|
|
- Object.keys(e).map((key, index) => {
|
|
|
- if (key.includes('现场培训内容')) {
|
|
|
- this.setData({
|
|
|
- trainerContent: e[key].confirm_value
|
|
|
- })
|
|
|
- } else if (key.includes('现场互动及测试培训效果')) {
|
|
|
+ async billData() {
|
|
|
+ const res = await api._post({
|
|
|
+ "id": "20230211105803",
|
|
|
+ "content": {
|
|
|
+ "sa_workorder_confirmationid": this.data.id
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log('详情', res)
|
|
|
+ this.setData({
|
|
|
+ mainData: res.data,
|
|
|
+ sa_serviceorderid: res.data.workorder.sa_serviceorderid || '0',
|
|
|
+ sa_orderid: res.data.workorder.sa_orderid || '0',
|
|
|
+ stopClick: res.data.status !== '新建' ? 'stopClick' : this.data.stopClick
|
|
|
+ })
|
|
|
+ this.setInputData()
|
|
|
+ },
|
|
|
+ setInputData() {
|
|
|
+ this.data.mainData.confirmationcontent.forEach(e => {
|
|
|
+ Object.keys(e).map((key, index) => {
|
|
|
+ if (key.includes('现场培训内容')) {
|
|
|
+ this.setData({
|
|
|
+ trainerContent: e[key].confirm_value
|
|
|
+ })
|
|
|
+ } else if (key.includes('现场互动及测试培训效果')) {
|
|
|
|
|
|
- this.setData({
|
|
|
- trainerResult: e[key].confirm_value
|
|
|
- })
|
|
|
- } else {
|
|
|
+ this.setData({
|
|
|
+ trainerResult: e[key].confirm_value
|
|
|
+ })
|
|
|
+ } else {
|
|
|
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- async updateBill() {
|
|
|
- if (this.data.mainData.status !== '新建') return wx.showToast({
|
|
|
- title: '非新建状态,修改的数据将不会保存',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230211105703",
|
|
|
- "content": this.data.mainData
|
|
|
- })
|
|
|
- },
|
|
|
- // 跳转到物料添加
|
|
|
- addProduct() {
|
|
|
- /* wx.navigateTo({
|
|
|
- url: '/Eservice/serviceMaterial/index',
|
|
|
- }) */
|
|
|
- wx.navigateTo({
|
|
|
- url: '/Eservice/agent/billCanUseProduct/index?id=' + this.data.mainData.sa_workorderid
|
|
|
- })
|
|
|
- },
|
|
|
- // 跳转到添加人员
|
|
|
- addTrainers() {
|
|
|
- wx.navigateTo({
|
|
|
- url: '/Eservice/addTrainers/index',
|
|
|
- })
|
|
|
- },
|
|
|
- // 添加人员
|
|
|
- async getAddTrainers(data) {
|
|
|
- data.sa_workorder_node_teamid = 0
|
|
|
- this.data.mainData.trainers.push(data)
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230215202103",
|
|
|
- "content": {
|
|
|
- "sa_workorder_confirmationid": this.data.mainData.sa_workorder_confirmationid,
|
|
|
- "sa_workorderid": this.data.mainData.workorder.sa_workorderid,
|
|
|
- "trainers": this.data.mainData.trainers
|
|
|
- }
|
|
|
- })
|
|
|
- this.billData()
|
|
|
- },
|
|
|
- // 删除人员
|
|
|
- async deleteMenber(data) {
|
|
|
- let id = data.detail.sa_workorder_node_teamid
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230215202203",
|
|
|
- "version": 1,
|
|
|
- "content": {
|
|
|
- "sa_workorder_node_teamids": [id]
|
|
|
- }
|
|
|
- })
|
|
|
- this.billData()
|
|
|
- },
|
|
|
- // 添加物料
|
|
|
- async getAdd(selection) {
|
|
|
- console.log(selection)
|
|
|
- let arr = selection.map(e => {
|
|
|
- return {
|
|
|
- "sa_workorder_node_itemsid": 0,
|
|
|
- "itemid": e,
|
|
|
- "qty": 1
|
|
|
- }
|
|
|
- })
|
|
|
- this.data.mainData.trainertitems = this.data.mainData.trainertitems.concat(arr)
|
|
|
- this.updateMaterial(this.data.mainData.trainertitems)
|
|
|
- },
|
|
|
- async updateMaterial(trainertitems) {
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230215201903",
|
|
|
- "content": {
|
|
|
- "sa_workorder_confirmationid": this.data.mainData.sa_workorder_confirmationid,
|
|
|
- "sa_workorderid": this.data.mainData.workorder.sa_workorderid,
|
|
|
- "iteminfos": trainertitems
|
|
|
- }
|
|
|
- })
|
|
|
- this.billData()
|
|
|
- },
|
|
|
- // 修改物料数量
|
|
|
- qtyChange(data) {
|
|
|
- clearTimeout(this.data.timerid)
|
|
|
- this.data.timerid = setTimeout(() => {
|
|
|
- this.data.mainData.trainertitems.forEach(e => {
|
|
|
- if (e.itemid == data.detail.itemid) {
|
|
|
- e.qty = data.detail.qty
|
|
|
- }
|
|
|
- })
|
|
|
- this.updateMaterial(this.data.mainData.trainertitems)
|
|
|
- }, 1000)
|
|
|
- this.setData({
|
|
|
- timerid: this.data.timerid
|
|
|
- })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async updateBill() {
|
|
|
+ if (this.data.mainData.status !== '新建') return wx.showToast({
|
|
|
+ title: '非新建状态,修改的数据将不会保存',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ const res = await api._post({
|
|
|
+ "id": "20230211105703",
|
|
|
+ "content": this.data.mainData
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 跳转到物料添加
|
|
|
+ addProduct() {
|
|
|
+ /* wx.navigateTo({
|
|
|
+ url: '/Eservice/serviceMaterial/index',
|
|
|
+ }) */
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/Eservice/agent/billCanUseProduct/index?id=' + this.data.mainData.sa_workorderid
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 跳转到添加人员
|
|
|
+ addTrainers() {
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/Eservice/addTrainers/index',
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 添加人员
|
|
|
+ async getAddTrainers(data) {
|
|
|
+ data.sa_workorder_node_teamid = 0
|
|
|
+ this.data.mainData.trainers.push(data)
|
|
|
+ const res = await api._post({
|
|
|
+ "id": "20230215202103",
|
|
|
+ "content": {
|
|
|
+ "sa_workorder_confirmationid": this.data.mainData.sa_workorder_confirmationid,
|
|
|
+ "sa_workorderid": this.data.mainData.workorder.sa_workorderid,
|
|
|
+ "trainers": this.data.mainData.trainers
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.billData()
|
|
|
+ },
|
|
|
+ // 删除人员
|
|
|
+ async deleteMenber(data) {
|
|
|
+ let id = data.detail.sa_workorder_node_teamid
|
|
|
+ const res = await api._post({
|
|
|
+ "id": "20230215202203",
|
|
|
+ "version": 1,
|
|
|
+ "content": {
|
|
|
+ "sa_workorder_node_teamids": [id]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.billData()
|
|
|
+ },
|
|
|
+ // 添加物料
|
|
|
+ async getAdd(selection) {
|
|
|
+ console.log(selection)
|
|
|
+ let arr = selection.map(e => {
|
|
|
+ return {
|
|
|
+ "sa_workorder_node_itemsid": 0,
|
|
|
+ "itemid": e,
|
|
|
+ "qty": 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.data.mainData.trainertitems = this.data.mainData.trainertitems.concat(arr)
|
|
|
+ this.updateMaterial(this.data.mainData.trainertitems)
|
|
|
+ },
|
|
|
+ async updateMaterial(trainertitems) {
|
|
|
+ const res = await api._post({
|
|
|
+ "id": "20230215201903",
|
|
|
+ "content": {
|
|
|
+ "sa_workorder_confirmationid": this.data.mainData.sa_workorder_confirmationid,
|
|
|
+ "sa_workorderid": this.data.mainData.workorder.sa_workorderid,
|
|
|
+ "iteminfos": trainertitems
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.billData()
|
|
|
+ },
|
|
|
+ // 修改物料数量
|
|
|
+ qtyChange(data) {
|
|
|
+ clearTimeout(this.data.timerid)
|
|
|
+ this.data.timerid = setTimeout(() => {
|
|
|
+ this.data.mainData.trainertitems.forEach(e => {
|
|
|
+ if (e.itemid == data.detail.itemid) {
|
|
|
+ e.qty = data.detail.qty
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.updateMaterial(this.data.mainData.trainertitems)
|
|
|
+ }, 1000)
|
|
|
+ this.setData({
|
|
|
+ timerid: this.data.timerid
|
|
|
+ })
|
|
|
|
|
|
- },
|
|
|
- // 删除物料
|
|
|
- async deleteMaterial(data) {
|
|
|
- let itemid = data.detail.sa_workorder_node_itemsid
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230215202003",
|
|
|
- "content": {
|
|
|
- "sa_workorder_node_itemsids": [itemid]
|
|
|
- }
|
|
|
- })
|
|
|
- this.billData()
|
|
|
- },
|
|
|
- // 改变评分
|
|
|
- onChange(e) {
|
|
|
- this.data.mainData[e.currentTarget.dataset.name] = e.detail.value
|
|
|
- this.setData({
|
|
|
- mainData: this.data.mainData
|
|
|
- });
|
|
|
- this.updateBill()
|
|
|
- },
|
|
|
+ },
|
|
|
+ // 删除物料
|
|
|
+ async deleteMaterial(data) {
|
|
|
+ let itemid = data.detail.sa_workorder_node_itemsid
|
|
|
+ const res = await api._post({
|
|
|
+ "id": "20230215202003",
|
|
|
+ "content": {
|
|
|
+ "sa_workorder_node_itemsids": [itemid]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.billData()
|
|
|
+ },
|
|
|
+ // 改变评分
|
|
|
+ onChange(e) {
|
|
|
+ this.data.mainData[e.currentTarget.dataset.name] = e.detail.value
|
|
|
+ this.setData({
|
|
|
+ mainData: this.data.mainData
|
|
|
+ });
|
|
|
+ this.updateBill()
|
|
|
+ },
|
|
|
|
|
|
- async submit() {
|
|
|
- this.createImage();
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230211110003",
|
|
|
- "content": {
|
|
|
- "sa_workorder_confirmationid": this.data.mainData.sa_workorder_confirmationid
|
|
|
- }
|
|
|
- })
|
|
|
- if (res.code == 1) {
|
|
|
- wx.showToast({
|
|
|
- title: '提交成功',
|
|
|
- icon: "success"
|
|
|
- })
|
|
|
- this.billData()
|
|
|
- }
|
|
|
+ async submit() {
|
|
|
+ this.createImage();
|
|
|
+ const res = await api._post({
|
|
|
+ "id": "20230211110003",
|
|
|
+ "content": {
|
|
|
+ "sa_workorder_confirmationid": this.data.mainData.sa_workorder_confirmationid
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (res.code == 1) {
|
|
|
+ wx.showToast({
|
|
|
+ title: '提交成功',
|
|
|
+ icon: "success"
|
|
|
+ })
|
|
|
+ this.billData()
|
|
|
+ }
|
|
|
|
|
|
- },
|
|
|
- async delete() {
|
|
|
- const res = await api._post({
|
|
|
- "id": "20230211110103",
|
|
|
- "content": {
|
|
|
- "sa_workorder_confirmationids": [this.data.mainData.sa_workorder_confirmationid]
|
|
|
- }
|
|
|
- })
|
|
|
- if (res.code == 1) {
|
|
|
- wx.navigateBack()
|
|
|
- }
|
|
|
- },
|
|
|
- inputChange(data) {
|
|
|
- let keyValue = data.currentTarget.dataset.name
|
|
|
- this.data.mainData.confirmationcontent.forEach(e => {
|
|
|
- Object.keys(e).map((key, index) => {
|
|
|
- if (key.includes(keyValue)) {
|
|
|
- console.log(e)
|
|
|
- e[key].confirm_value = data.detail.value
|
|
|
+ },
|
|
|
+ async delete() {
|
|
|
+ const res = await api._post({
|
|
|
+ "id": "20230211110103",
|
|
|
+ "content": {
|
|
|
+ "sa_workorder_confirmationids": [this.data.mainData.sa_workorder_confirmationid]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (res.code == 1) {
|
|
|
+ wx.navigateBack()
|
|
|
}
|
|
|
- })
|
|
|
- })
|
|
|
- this.updateBill()
|
|
|
- },
|
|
|
- createImage() {
|
|
|
- let token = wx.getStorageSync('userMsg').token
|
|
|
- let parentid = wx.getStorageSync('siteP').appfolderid
|
|
|
- let url = `${getApp().globalData.http.baseUrl}/yosweb/#/printTable?token=${token}&parentid=${parentid}&ownerid=${this.data.mainData.sa_workorder_confirmationid}`
|
|
|
- this.setData({
|
|
|
- url: url
|
|
|
- })
|
|
|
- wx.navigateTo({
|
|
|
- url: '/Eservice/webView/index',
|
|
|
- })
|
|
|
- },
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- */
|
|
|
- onLoad(options) {
|
|
|
- this.data.bindSignNameData.ownerid = options.id
|
|
|
- this.setData({
|
|
|
- stopClick: options.class,
|
|
|
- id: options.id,
|
|
|
- bindSignNameData: this.data.bindSignNameData
|
|
|
- })
|
|
|
- this.billData()
|
|
|
- },
|
|
|
+ },
|
|
|
+ inputChange(data) {
|
|
|
+ let keyValue = data.currentTarget.dataset.name
|
|
|
+ this.data.mainData.confirmationcontent.forEach(e => {
|
|
|
+ Object.keys(e).map((key, index) => {
|
|
|
+ if (key.includes(keyValue)) {
|
|
|
+ console.log(e)
|
|
|
+ e[key].confirm_value = data.detail.value
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.updateBill()
|
|
|
+ },
|
|
|
+ createImage() {
|
|
|
+ let token = wx.getStorageSync('userMsg').token
|
|
|
+ let parentid = wx.getStorageSync('siteP').appfolderid
|
|
|
+ let url = `${getApp().globalData.http.baseUrl}/yosweb/#/printTable?token=${token}&parentid=${parentid}&ownerid=${this.data.mainData.sa_workorder_confirmationid}`
|
|
|
+ this.setData({
|
|
|
+ url: url
|
|
|
+ })
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/Eservice/webView/index',
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */
|
|
|
+ onLoad(options) {
|
|
|
+ this.data.bindSignNameData.ownerid = options.id
|
|
|
+ this.setData({
|
|
|
+ stopClick: options.class,
|
|
|
+ id: options.id,
|
|
|
+ bindSignNameData: this.data.bindSignNameData
|
|
|
+ })
|
|
|
+ this.billData()
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady() {
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
+ */
|
|
|
+ onReady() {
|
|
|
|
|
|
- },
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
- onShow() {
|
|
|
- this.setData({
|
|
|
- SignName: true
|
|
|
- })
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
+ */
|
|
|
+ onShow() {
|
|
|
+ this.setData({
|
|
|
+ SignName: true
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
- onHide() {
|
|
|
- this.setData({
|
|
|
- SignName: false
|
|
|
- })
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面隐藏
|
|
|
+ */
|
|
|
+ onHide() {
|
|
|
+ this.setData({
|
|
|
+ SignName: false
|
|
|
+ })
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
- */
|
|
|
- onUnload() {
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面卸载
|
|
|
+ */
|
|
|
+ onUnload() {
|
|
|
|
|
|
- },
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh() {
|
|
|
+ /**
|
|
|
+ * 页面相关事件处理函数--监听用户下拉动作
|
|
|
+ */
|
|
|
+ onPullDownRefresh() {
|
|
|
|
|
|
- },
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
- onReachBottom() {
|
|
|
+ /**
|
|
|
+ * 页面上拉触底事件的处理函数
|
|
|
+ */
|
|
|
+ onReachBottom() {
|
|
|
|
|
|
- },
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage() {
|
|
|
+ /**
|
|
|
+ * 用户点击右上角分享
|
|
|
+ */
|
|
|
+ onShareAppMessage() {
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
})
|