| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- mui.init({
- swipeBack: false,
- })
- mui.ready(function() {
- var urlParams = new URLSearchParams(window.location.search);
- var param1 = urlParams.get('name');
- var param2 = urlParams.get('classImport');
- var wv = {
- name: param1,
- classImport: classImport,
- }//plus.webview.currentWebview();
- var token = localStorage.getItem("token");
- var classImport = wv.classImport;
- var isdeals = wv.name;
- //交办单位
- var dwList = [];
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Department/GetCusAreaList',
- async: false,
- data: {
- pid:1,
- F_Layer: 1,
- token: token
- },
- dataType: 'json',
- success: function(data) {
- res = data.data;
- if(res && res.length > -1) {
- res.forEach(function(v, i) {
- var obj = {};
- obj.value = v.F_DeptId;
- obj.text = v.F_DeptName;
- dwList.push(obj);
- });
- }
- }
- });
- //接收人员
- function getReceiveUser() {
- renyuan = []
- if ($("#DWResult").val()!="") {
- $.ajax({
- url: huayi.config.callcenter_url + 'UserAccount/GetList',
- type: 'get',
- data: {
- dptid: $('#DWResult').attr('data-index'),
- type: 1,
- token: token
- },
- dataType: "json",
- async: true,
- success: function(res) {
- res = res.rows;
- if(res && res.length > -1) {
- res.forEach(function(v, i) {
- var obj = {};
- obj.value = v.F_UserId;
- obj.text = v.F_RoleName+"-"+v.F_UserName;
- renyuan.push(obj);
- //$('<option value="' + v.F_UserId + '">' + v.F_UserName + '</option>').appendTo('#order_recive');
- });
- cityPicker5.setData(renyuan);
- }
- },
- });
- }else{
- cityPicker5.setData(renyuan);
- }
-
-
- }
-
- (function($, doc) {
- $.ready(function() {
- //交办单位
- var ZTiPickers = new $.PopPicker({
- layer: 1
- });
- ZTiPickers.setData(dwList);
- var ZXs = doc.getElementById('DW');
- var ZXResults = doc.getElementById('DWResult');
- ZXs.addEventListener('tap', function(event) {
- ZTiPickers.show(function(items) {
- ZXResults.value = items[0].text;
- ZXResults.setAttribute("data-index", items[0].value);
- });
- }, false);
- // 接收人员
- cityPicker5 = new $.PopPicker();
- var showCityPickerButton5 = doc.getElementById('showCityPicker5');
- var cityResult5 = doc.getElementById('ower_recive');
- showCityPickerButton5.addEventListener('tap', function(event) {
- getReceiveUser();
- cityPicker5.show(function(items) {
- if (items[0].text!=undefined) {
- cityResult5.value = items[0].text;
- cityResult5.setAttribute("data-index", items[0].value);
- }
-
- //返回 false 可以阻止选择框的关闭
- //return false;
- });
- }, false);
- })
- })(mui, document);
- //提交按钮
- $('.submit').on('tap', function() {
- var DWResult = $("#DWResult").val();
- var ower_recive = $("#ower_recive").val();
- if(!DWResult) {
- plus.nativeUI.toast('请选择部门');
- } else if(!ower_recive) {
- plus.nativeUI.toast('请选择提交人');
- } else {
- var btnArray = ['取消', '确定'];
- mui.confirm('是否提交工单', '提示', btnArray, function(e) {
- if(e.index == 1) {
- mui.ajax(huayi.config.callcenter_url + 'WorkorderApp/Submission', {
- data: {
- id: isdeals,
- clid: $("#ower_recive").attr('data-index'), //单位
- cont:"",
- type:1,
- token: token
- },
- dataType: 'json', //服务器返回json格式数据
- type: 'post', //HTTP请求类型
- timeout: 10000, //超时时间设置为10秒;
- success: function(data) {
- plus.nativeUI.toast('成功');
- $("#ower_recive").val('');
- $("#DWResult").val('');
- if (classImport) {
- if (classImport==2) {
- var wobj = plus.webview.getWebviewById("Work-listCJ");
- }else{
- var wobj = plus.webview.getWebviewById("Work-listClass");
- }
- }else{
- var wobj = plus.webview.getWebviewById("Work-list");
- }
- wobj.reload(true);
- },
- error: function(xhr, type, errorThrown) {
- plus.nativeUI.toast('失败');
- }
- });
- } else {
- plus.nativeUI.toast('取消申请');
- }
- })
- }
- })
- });
|