YYC
2023-05-17 0adbc72b09cbc1fd3c0f59cb65c3c476d65adc15
igds-app/js/admin/work-apply.js
@@ -1,4 +1,38 @@
var url = null;
var depotData;
var name = ''
var listPicker2 = [];
var list = [{
   value: 'ywj',
   text: '董事长 叶文洁'
}, {
   value: 'aaa',
   text: '总经理 艾AA'
}, {
   value: 'lj',
   text: '罗辑'
}, {
   value: 'ymt',
   text: '云天明'
}, {
   value: 'shq',
   text: '史强'
}, {
   value: 'zhbh',
   text: '章北海'
}, {
   value: 'zhy',
   text: '庄颜'
}, {
   value: 'gyf',
   text: '关一帆'
}, {
   value: 'zhz',
   text: '智子'
}, {
   value: 'gezh',
   text: '歌者'
}]
//工单申请
var data = {
   "interfaceId": "5701",
@@ -13,12 +47,23 @@
   }
};
//获取库区列表
var data = {
var data1 = {
   "interfaceId": "5002",
   "outId": "10002",
   "reqDateTime": new Date(),
   "tokenAuth": "",
   "data": {}
};
//获取仓库列表
var data2 = {
   "interfaceId": "5102",
   "sign": "10102",
   "outId": "10102",
   "reqDateTime": new Date(),
   "tokenAuth": "",
   "data": {
      "deptId": ""
   }
};
@@ -28,12 +73,16 @@
   var selectDeptId = JSON.parse(localStorage.getItem('selectDeptId'));
   url = user.url + "/api-phone/v35/gateway";
   data.tokenAuth = user.tokenAuth;
   // data.data.deptId = selectDeptId;
   data2.tokenAuth = user.tokenAuth;
   data2.data.deptId = selectDeptId;
   depotList();
}
function chooseDate() {
   var dtpicker = new mui.DtPicker({
      type: "date", //设置日历初始视图模式
      // type: "hour", //设置日历初始视图模式
      type: "datetime",
      // beginDate: new Date(2015, 04, 25), //设置开始日期
      // endDate: new Date(2016, 04, 25), //设置结束日期
@@ -48,7 +97,8 @@
function chooseDate1() {
   var dtpicker = new mui.DtPicker({
      type: "date", //设置日历初始视图模式
      // type: "hour", //设置日历初始视图模式
      type: "datetime",
      // beginDate: new Date(2015, 04, 25), //设置开始日期
      // endDate: new Date(2016, 04, 25), //设置结束日期
@@ -63,6 +113,7 @@
//工单申请
function workApply() {
   console.log(JSON.stringify(data.data))
   //发送请求进行工单申请
   mui.ajax(url, {
      type: "POST",
@@ -74,6 +125,7 @@
         if (result.code == "0000") {
            console.log(JSON.stringify(result))
         } else {
            // console.log(JSON.stringify(result))
            mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
         }
      },
@@ -83,10 +135,47 @@
   })
}
function depotList() {
   //获取仓库列表
   mui.ajax(url, {
      type: "POST",
      dataType: "json",
      crossDomain: true,
      contentType: "application/json;charset=utf-8",
      data: JSON.stringify(data2),
      success: function(result) {
         if (result.code == "0000") {
            depotData = result.data
            conversion(depotData);
            // console.log(JSON.stringify(result))
         } else {
            mui.alert(result.msg, '提示', ["确定"], function() {}, "div");
         }
      },
      error: function() {
         mui.alert('系统繁忙,请重新登录尝试!', '提示', ["确定"], function() {}, "div");
      }
   })
}
function conversion(data) {
   var fenl = {}
   $.each(data, function(index, item) {
      fenl = {
         value: item.name,
         text: item.id,
      }
      listPicker2.push(fenl)
   })
}
//提交
mui(".mui-scroll").on("tap", ".wp form .submit", function() {
   console.log("111")
   workApply();
   window.location.reload();
   // window.setTimeout(function() {
   //    window.location.reload();
   // }, 200)
})
mui('.mui-scroll-wrapper').scroll({
@@ -95,6 +184,8 @@
   bounce: false, //是否启用回弹
   deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
});
(function($, doc) {
   $.init();
   $.ready(function() {
@@ -108,43 +199,14 @@
         return obj[param] || '';
      };
      //普通示例
      var userPicker = new $.PopPicker();
      userPicker.setData([{
         value: 'ywj',
         text: '董事长 叶文洁'
      }, {
         value: 'aaa',
         text: '总经理 艾AA'
      }, {
         value: 'lj',
         text: '罗辑'
      }, {
         value: 'ymt',
         text: '云天明'
      }, {
         value: 'shq',
         text: '史强'
      }, {
         value: 'zhbh',
         text: '章北海'
      }, {
         value: 'zhy',
         text: '庄颜'
      }, {
         value: 'gyf',
         text: '关一帆'
      }, {
         value: 'zhz',
         text: '智子'
      }, {
         value: 'gezh',
         text: '歌者'
      }]);
      var showUserPickerButton = doc.getElementById('ywlx');
      var userResult = doc.getElementById('ywlx-val');
      showUserPickerButton.addEventListener('tap', function(event) {
         var userResult = doc.getElementById('ywlx-val');
         var userPicker = new $.PopPicker();
         userPicker.setData(list);
         userPicker.show(function(items) {
            // userResult.innerText = JSON.stringify(items[0]);
            console.log(JSON.stringify(items))
            userResult.innerText = items[0].text;
            // userResult.previousSibling.style.display="none"
            jQuery(userResult).prev().hide()
@@ -154,41 +216,11 @@
      }, false);
      //-----------------------------------------
      //所属分库:
      var picker1 = new $.PopPicker();
      picker1.setData([{
         value: 'ywj',
         text: '董事长 叶文洁'
      }, {
         value: 'aaa',
         text: '总经理 艾AA'
      }, {
         value: 'lj',
         text: '罗辑'
      }, {
         value: 'ymt',
         text: '云天明'
      }, {
         value: 'shq',
         text: '史强'
      }, {
         value: 'zhbh',
         text: '章北海'
      }, {
         value: 'zhy',
         text: '庄颜'
      }, {
         value: 'gyf',
         text: '关一帆'
      }, {
         value: 'zhz',
         text: '智子'
      }, {
         value: 'gezh',
         text: '歌者'
      }]);
      var showPicker1Button = doc.getElementById('ssfk');
      var picker1Result = doc.getElementById('ssfk-val');
      showPicker1Button.addEventListener('tap', function(event) {
         var picker1Result = doc.getElementById('ssfk-val');
         var picker1 = new $.PopPicker();
         picker1.setData(list);
         picker1.show(function(items) {
            // userResult.innerText = JSON.stringify(items[0]);
            picker1Result.innerText = items[0].text;
@@ -200,50 +232,20 @@
      }, false);
      //-----------------------------------------
      //关联仓库:
      var picker2 = new $.PopPicker();
      picker2.setData([{
         value: 'ywj',
         text: '董事长 叶文洁'
      }, {
         value: 'aaa',
         text: '总经理 艾AA'
      }, {
         value: 'lj',
         text: '罗辑'
      }, {
         value: 'ymt',
         text: '云天明'
      }, {
         value: 'shq',
         text: '史强'
      }, {
         value: 'zhbh',
         text: '章北海'
      }, {
         value: 'zhy',
         text: '庄颜'
      }, {
         value: 'gyf',
         text: '关一帆'
      }, {
         value: 'zhz',
         text: '智子'
      }, {
         value: 'gezh',
         text: '歌者'
      }]);
      var showPicker2Button = doc.getElementById('glck');
      var picker2Result = doc.getElementById('glck-val');
      showPicker2Button.addEventListener('tap', function(event) {
         var picker2Result = doc.getElementById('glck-val');
         var picker2 = new $.PopPicker();
         picker2.setData(listPicker2);
         picker2.show(function(items) {
            // userResult.innerText = JSON.stringify(items[0]);
            picker2Result.innerText = items[0].text;
            data.data.depotId = items[0].value;
            // userResult.previousSibling.style.display="none"
            jQuery(picker2Result).prev().hide()
            //返回 false 可以阻止选择框的关闭
            //return false;
         });
      }, false);
   });
})(mui, document);