| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- mui.init({
- beforeback: function() {
- var list = plus.webview.currentWebview().opener();
- //refresh是A页面自定义事件
- mui.fire(list, 'refresh');
- //返回true,继续页面关闭逻辑
- return true;
- }
- });
- //初始化单页的区域滚动
- mui('.mui-scroll-wrapper').scroll();
- mui.plusReady(function() {
- // 产品代码
- var Product = [];
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Department/GetDeptList',
- async: false,
- data: {
- flag: "CPDM",
- token: localStorage.getItem("token")
- },
- dataType: 'json',
- success: function(res) {
- if (res.state.toLowerCase() === "success") {
- res = res.data;
- if (res && res.length > 0) {
- res.forEach(function(v, i) {
- var obj = {};
- obj.id = v.id;
- obj.text = v.text;
- obj.children = v.children;
- Product.push(obj);
- });
- }
- }
- }
- });
- // 角色
- var roleList = []
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'RoleInfo/GetRoleList',
- async: false,
- data: {
- code: '',
- name: '',
- pageindex: 1,
- pagesize: 100,
- token: localStorage.getItem("token")
- },
- dataType: 'json',
- success: function(res) {
- res = res.rows;
- if (res && res.length > 0) {
- res.forEach(function(v, i) {
- var obj = {};
- obj.id = v.F_RoleId;
- obj.text = v.F_RoleName;
- roleList.push(obj);
- });
- }
- }
- });
- (function($, doc) {
- $.init();
- $.ready(function() {
- //产品代码
- var userPicker2 = new $.PopPicker({
- layer: 3
- });
- userPicker2.setData(Product);
- var showUserPickerButton2 = doc.getElementById('showUserPickerProduct');
- var F_Product = doc.getElementById('F_ProductType');
- showUserPickerButton2.addEventListener('tap', function(event) {
- userPicker2.show(function(items) {
- if (items[2].text == undefined) {
- if (items[1].text == undefined) {
- F_Product.value = items[0].text;
- F_Product.setAttribute("data-index", items[0].id);
- } else {
- F_Product.value = items[1].text;
- F_Product.setAttribute("data-index", items[1].id);
- }
- } else {
- F_Product.value = items[2].text;
- F_Product.setAttribute("data-index", items[2].id);
- }
- });
- }, false);
- var rolePicker = new $.PopPicker({
- layer: 1
- });
- rolePicker.setData(roleList)
- var showRolePickerButton = doc.getElementById('showRolePickerProduct');
- var role = doc.getElementById('role');
- showRolePickerButton.addEventListener('tap', function(event) {
- rolePicker.show(function(items) {
- role.value = items[0].text
- role.setAttribute("data-index", items[0].id);
- });
- }, false);
- })
- })(mui, document);
- })
- $('#xgPassword').on('tap', function() {
- // alert($('.F_UserName').val());
- // alert($('.password').val());
- // alert($("#F_ProductType").attr("data-index"));
- // alert($(".F_Mobile").val());
- if ($('.F_UserName').val() == '') {
- mui.alert('请输入用户名!')
- } else if ($('.password').val() == '') {
- mui.alert('请输入密码!')
- } else if ($("#F_ProductType").val() == '') {
- mui.alert('请选择部门!')
- } else if ($("#role").val() == '') {
- mui.alert('请选择角色!')
- } else {
- $.ajax({
- type: "post",
- dataType: 'json',
- url: huayi.config.callcenter_url + '/UserAccount/AddUsers',
- async: true,
- data: {
- username: $('.F_UserName').val(), //用户名
- password: $('.password').val(), //密码
- deptid: $("#F_ProductType").attr("data-index"), //部门
- roleid: $("#role").attr("data-index"),
- mobile: $(".F_Mobile").val(),
- token: localStorage.getItem("token")
- },
- success: function(data) {
- if (data.state == "success") {
- mui.alert('账号' + data.data.F_UserCode + '--密码' + data.data.F_Password, '添加成功',
- function() {
- var wobj = plus.webview.getWebviewById("Setting_manage");
- wobj.reload(true);
- });
- } else {
- mui.toast(data.message);
- }
- }
- });
- }
- })
|