123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- const api = require("../../api/api");
- import Dialog from 'tdesign-miniprogram/dialog/index';
- // pages/workOrderDetail/index.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- workLeaderDialog: false
- },
- async mainData() {
- const res = await api._post({
- "id": "20230208140103",
- "content": {
- "sa_workorderid": this.data.id
- }
- })
- this.setData({
- billData: res.data
- })
- this.workerData()
- },
- changeBillStatus(data) {
- let id = data.currentTarget.dataset.id
- const dialogConfig = {
- context: this,
- title: '提示',
- content: '确认执行当前操作吗?',
- confirmBtn: '确定',
- cancelBtn: '取消',
- }
- Dialog.confirm(dialogConfig)
- .then(async () => {
- const res = await api._post({
- "id": id,
- "content": {
- "sa_workorderid": this.data.id
- }
- })
- this.mainData()
- })
- .catch(() => console.log('点击了取消'))
- .finally(() => Dialog.close())
- },
- async addConfirmBill() {
- const res = await api._post({
- "id": "20230211105703",
- "version": 1,
- "content": {
- "sa_workorder_confirmationid": 0,
- "sa_workorderid": this.data.id,
- "attitudescore": 0,
- "responsescore": 0,
- }
- })
- if (this.data.billData.type === '安装培训') {
- wx.navigateTo({
- url: '/Eservice/trainConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
- })
- } else if (this.data.billData.type === '安装调试') {
- wx.navigateTo({
- url: '/Eservice/installConfirmBill/index?id=' + res.data.sa_workorder_confirmationid,
- })
- } else {}
- },
- toConfirmBill(data) {
- if (this.data.billData.type === '安装培训') {
- wx.navigateTo({
- url: '/Eservice/trainConfirmBill/index?class=stopClick&id=' + data.currentTarget.dataset.item.sa_workorder_confirmationid,
- })
- }
- },
- async confirmBillList() {
- const res = await api._post({
- "id": "20230211105903",
- "content": {
- "where": {
- "condition": "",
- "sa_workorderid": this.data.id
- }
- }
- })
- this.setData({
- confirmBills: res.data
- })
- },
- toWorkConfirmInfo() {
- getApp().globalData.handelSelect = this
- wx.navigateTo({
- url: '/Eservice/workBillConfirmInfo/index?class=stopClick'
- })
- },
- async workerData() {
- const res = await api._post({
- "id": "20230213143003",
- "version": 1,
- "content": {
- "where": {
- "condition": ""
- }
- }
- })
- this.setData({
- workers: res.data
- })
- },
- showWorkerDialog() {
- this.setData({
- workLeaderDialog: !this.data.workLeaderDialog
- })
- },
- selectLeader(data) {
- this.setData({
- actLeader: data.currentTarget.dataset.item
- })
- },
- async toWorker() {
- if (!this.data.actLeader) {
- wx.showToast({
- title: '未选择负责人',
- icon: 'none'
- })
- } else {
- this.data.billData.projectlearders = [this.data.actLeader.userid]
- const res = api._post({
- "id": "20230208140003",
- "content": this.data.billData
- })
- this.setData({
- showToWoker: false
- })
- this.mainData()
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- this.setData({
- id: options.id
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- this.mainData()
- this.confirmBillList()
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|