| | |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).extend({ |
| | | notice: 'notice/notice', |
| | | }).use(['table','laydate', 'form', 'admin', 'notice'], function() { |
| | | }).use(['table','laydate', 'form', 'admin', 'notice', 'xmSelect'], function() { |
| | | var table = layui.table; |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | |
| | | var notice = layui.notice; |
| | | var layDate = layui.laydate; |
| | | var admin = layui.admin; |
| | | var xmSelect = layui.xmSelect; |
| | | |
| | | tableIns = table.render({ |
| | | elem: '#chooseData', |
| | |
| | | |
| | | // 客户 |
| | | var cstmrData; |
| | | // $.ajax({ |
| | | // url: baseUrl+"/work/cstmr/all/get", |
| | | // headers: {'token': localStorage.getItem('token')}, |
| | | // method: 'POST', |
| | | // async: false, |
| | | // success: function (res) { |
| | | // if (res.code === 200){ |
| | | // cstmrData = res; |
| | | // } else { |
| | | // layer.msg(res.msg, {icon: 2}) |
| | | // } |
| | | // } |
| | | // }); |
| | | // var tpl2 = $('#cstmrSelectTpl').html(); |
| | | // var template2 = Handlebars.compile(tpl2); |
| | | // var html2 = template2(cstmrData); |
| | | // $("#cstmr").html(html2); |
| | | // 单选 |
| | | $.ajax({ |
| | | url: baseUrl+"/work/cstmr/all/get", |
| | | url: baseUrl+"/work/cstmr/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | cstmrData = res; |
| | | cstmrData = res.data; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | } |
| | | } |
| | | }); |
| | | var tpl2 = $('#cstmrSelectTpl').html(); |
| | | var template2 = Handlebars.compile(tpl2); |
| | | var html2 = template2(cstmrData); |
| | | $("#cstmr").html(html2); |
| | | xmSelect.render({ |
| | | el: '#cstmr', |
| | | radio: true, |
| | | clickClose: true, |
| | | filterable: true, |
| | | create: function(val, arr){ |
| | | if(arr.length === 0){ |
| | | return { |
| | | name: val, |
| | | value: val |
| | | } |
| | | } |
| | | }, |
| | | model: { |
| | | icon: 'hidden', |
| | | label: { |
| | | type: 'text', |
| | | } |
| | | }, |
| | | data: cstmrData |
| | | }) |
| | | |
| | | // 项目 |
| | | var itemData; |
| | | // $.ajax({ |
| | | // url: baseUrl+"/work/item/all/get", |
| | | // headers: {'token': localStorage.getItem('token')}, |
| | | // method: 'POST', |
| | | // async: false, |
| | | // success: function (res) { |
| | | // if (res.code === 200){ |
| | | // itemData = res; |
| | | // } else { |
| | | // layer.msg(res.msg, {icon: 2}); |
| | | // } |
| | | // } |
| | | // }); |
| | | // var tpl3 = $('#itemSelectTpl').html(); |
| | | // var template3 = Handlebars.compile(tpl3); |
| | | // var html3 = template3(itemData); |
| | | // $("#item").html(html3); |
| | | $.ajax({ |
| | | url: baseUrl+"/work/item/all/get", |
| | | url: baseUrl+"/work/item/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | method: 'POST', |
| | | async: false, |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | itemData = res; |
| | | itemData = res.data; |
| | | } else { |
| | | layer.msg(res.msg, {icon: 2}) |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | var tpl3 = $('#itemSelectTpl').html(); |
| | | var template3 = Handlebars.compile(tpl3); |
| | | var html3 = template3(itemData); |
| | | $("#item").html(html3); |
| | | xmSelect.render({ |
| | | el: '#item', |
| | | radio: true, |
| | | clickClose: true, |
| | | filterable: true, |
| | | create: function(val, arr){ |
| | | if(arr.length === 0){ |
| | | return { |
| | | name: val, |
| | | value: val |
| | | } |
| | | } |
| | | }, |
| | | model: { |
| | | icon: 'hidden', |
| | | label: { |
| | | type: 'text', |
| | | } |
| | | }, |
| | | data: itemData |
| | | }) |
| | | |
| | | // 弹窗 |
| | | layer.close(index); |
| | | if (success) { |
| | | admin.open({ |
| | |
| | | } |
| | | }); |
| | | |
| | | |
| | | // // 多选 |
| | | // var demo1 = xmSelect.render({ |
| | | // el: '#demo1', |
| | | // filterable: true, |
| | | // create: function(val, arr){ |
| | | // if(arr.length === 0){ |
| | | // return { |
| | | // name: val, |
| | | // value: val |
| | | // } |
| | | // } |
| | | // }, |
| | | // data: [ |
| | | // {name: '张三', value: 1, selected: true}, |
| | | // {name: '李四', value: 2}, |
| | | // {name: '王五', value: 3, disabled: true}, |
| | | // ] |
| | | // }) |
| | | |
| | | // 监听行工具事件 |
| | | table.on('tool(chooseData)', function(obj){ |
| | | var data = obj.data; |