| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- const api = require('../../api/index.js');
- Page({
-
- data: {
- visible:false,
- tabsindex:"1,2",
- workorderName:'',
- datestart:'',
- dateend:'',
- array:['日常','故障','其他'],
- priority:'',
- index:'',
- reviewdata:[],
- examineType:0,
- partnerPosition:{},
- objectArray: [],
-
- },
- onLoad() {
- this.setData({
- partnerPosition:wx.getStorageSync('partnerPosition')
- })
-
- },
- // 查询电站
- getpowestation() {
- api.request(`/syspowerstation/selectpowestation`, 'POST', {})
- .then((res) => {
- if (res.code == 200) {
-
- // this.setData({
- // objectArray: res.data
- // })
-
- }
- })
- .catch((err) => {
- console.error('请求失败:', err);
- // 在这里处理请求失败的情况
- });
- },
- // 选项卡
- onTabsChange(e){
- console.log(e.detail.value);
- this.setData({
- tabsindex:e.detail.value
- })
- this.gitreview()
- },
- // 输入工单名称
- onPeakprice(e){
- console.log(e.detail.value);
- this.setData({
- workorderName:e.detail.value
- })
- },
- // 事件
- bindeventChange(e){
- console.log(e.detail.value);
- this.setData({
- index:e.detail.value
- })
- },
- // 开始事件
- bindstartChange: function(e) {
- console.log('picker发送选择改变,携带值为', e.detail.value)
- this.setData({
- datestart: e.detail.value
- })
- },
- // 结束时间
- bindendChange: function(e) {
- console.log('picker发送选择改变,携带值为', e.detail.value)
- this.setData({
- dateend: e.detail.value
- })
- },
- // 工单优先级
- onradio(e){
- console.log(e.detail.value);
- this.setData({
- priority:e.detail.value
- })
- },
- // 工单审核状态
- onexamineType(e){
- console.log(e.detail.value);
- this.setData({
- examineType:e.detail.value
- })
- },
-
- onworkorder(){
- this.setData({
- visible:false
- })
- this.gitreview()
- },
- onreset(){
- this.setData({
- workorderName:'',
- tabsindex:"1,2",
- datestart:'',
- dateend:'',
- index:'',
- priority:'',
- examineType:0
- })
- this.gitreview()
-
- },
- gitreview(){
-
- let data = {
- workorderName:this.data.workorderName,
- workorderType:this.data.tabsindex==0?'':this.data.tabsindex,
- workorderAddress:'',
- starttime:this.data.datestart,
- endtime:this.data.dateend,
- type:this.data.index==''?'':this.data.index*1+1,
- examineType:this.data.examineType==0?'':this.data.examineType
- }
-
- api.request(`/workoder/selectworkoder`, 'POST',data)
- .then((res) => {
- if (res.data) {
- this.setData({
- reviewdata:res.data
- })
- }else{
- this.setData({
- reviewdata:[]
- })
- }
- })
- .catch((err) => {
- console.error('请求失败:', err);
-
- // 在这里处理请求失败的情况
- });
- },
- onfilter(){
- this.setData({
- visible:true
- })
- },
- onVisibleChange(){
- this.setData({
- visible:false
- })
- },
- ondetails(e){
- console.log(e.currentTarget.dataset);
- wx.navigateTo({
- url: `/pages/workorderdetails/index?id=${e.currentTarget.dataset.id}&workorderId=${e.currentTarget.dataset.workorderid}`,
- })
- },
- onUndo(e){
- let _this = this
- console.log(e.currentTarget.dataset.id);
- wx.showModal({
- title: '提示',
- content: '是否撤消,删除工单?',
- success (res) {
- if (res.confirm) {
- let data ={
- workorderId:e.currentTarget.dataset.id
- }
- api.request(`/workoder/deleteworkorder`, 'POST',data)
- .then((res) => {
- wx.showToast({
- title: '撤消成功',
- icon: 'none'
- });
- _this.gitreview()
-
- })
- .catch((err) => {
- console.error('请求失败:', err);
-
- // 在这里处理请求失败的情况
- });
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- })
- },
- onShow() {
- // this.setData({
- // workorderName:'',
- // tabsindex:"1,2",
- // datestart:'',
- // dateend:'',
- // index:''
- // })
- this.gitreview()
-
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- async onPullDownRefresh() {
- await this.gitreview()
- await wx.stopPullDownRefresh();
-
- }
- });
|