| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499 |
- /**
- * 增加或编辑洗涤工单信息
- * */
- $(function() {
- var nowts = helper.DateFormat.getNowDateTime();
- var pro_Id = helper.request.queryString("edit_id");
- //项目名称
- //helper.getDropList.getProlistDrop($('#pro_title'));
- //项目所在地
- //getProLocation($('#pro_province'), $('#pro_city'));
- getProLocations($('#pro_province'), $('#pro_city'), $('#pro_title'));
- //获取科室下拉
- getDepartmentList($('#department'));
- //获取楼层下拉
- getFloorList($('#floor'));
- if(pro_Id) { //修改
- getProject(pro_Id);
- //创建时间
- laydate.render({
- elem: '#createtime',
- type: 'datetime',
- theme: '#249fea',
- });
- //任务时间
- laydate.render({
- elem: '#tasktime',
- type: 'datetime',
- theme: '#249fea',
- });
- } else {
- //创建时间
- laydate.render({
- elem: '#createtime',
- type: 'datetime',
- theme: '#249fea',
- //min: nowts,
- });
- //任务时间
- laydate.render({
- elem: '#tasktime',
- type: 'datetime',
- theme: '#249fea',
- //min: nowts,
- });
- }
- //添加编辑保存按钮点击
- $('#pro_save').on('click', saveProject);
- });
- //获取单个项目
- function getProject(ids) {
- $.getJSON(huayi.config.callcenter_url + "equipmentapi/api/WoWash/getdetails", {
- id: ids,
- }, function(data) {
- if(data.state == "success") {
- var res = data.data;
- $('#pro_province').val(res.provincecode); //项目所在省
- $('#pro_province').trigger('change');
- $('#pro_city').val(res.citycode); //项目所在市
- $('#pro_city').trigger('change');
- $('#pro_title').val(res.projectid); //项目id
- $('#department').val(res.departmentsid); //科室名称id
- $('#department').trigger('change');
- $('#floor').val(res.floorid); //楼层名称id
- $('#floor').trigger('change');
- $('#person').val(res.personid); //负责人id
- $('#person').trigger('change');
- $('#task_type').val(res.tasktype); //任务状态id(0实收,1实发)
- $('#task_type').trigger('change');
- $('#createtime').val(res.createtime); //添加时间
- $('#tasktime').val(res.tasktime); //任务时间
- $('#batchesnumber').val(res.batchesnumber); //关联批次(编号)
- $('#bigsheetonenum').val(res.bigsheetnum); //大单
- $('#quiltcovernum').val(res.quiltcovernum); //被罩
- $('#pillowcasenum').val(res.pillowcasenum); //枕套
- $('#pillownum').val(res.pillownum); //枕芯
- $('#clothesnum').val(res.clothesnum); //条衣
- $('#pantsnum').val(res.pantsnum); //条裤
- $('#whitepatientclothesnum').val(res.whitepatientclothesnum); //白病人衣
- $('#whitepatientpantsnum').val(res.whitepatientpantsnum); //白病人裤
- $('#singlelayer').val(res.singlelayer); //单层中单
- $('#doublelayer').val(res.doublelayer); //双层中单
- $('#quiltnum').val(res.quiltnum); //被子
- $('#matnum').val(res.matnum); //褥子
- $('#coolquiltnum').val(res.coolquiltnum); //凉被子
- $('#bedspreadnum').val(res.bedspreadnum); //床罩
- $('#blindsnum').val(res.blindsnum); //窗帘
- $('#workclothesnum').val(res.workclothesnum); //工作衣
- $('#nurseclothesnum').val(res.nurseclothesnum); //护士衣
- $('#nursepantnum').val(res.nursepantnum); //护士裤
- $('#constraintsnum').val(res.constraintsnum); //约束带
- $('#hatsnum').val(res.hatsnum); //帽子
- }
- });
- }
- //保存项目
- function saveProject() {
- var pro_Id = helper.request.queryString("edit_id");
- var wUrl;
- if(!$.trim($('#pro_province').val())) {
- layer.confirm('项目所在省不能为空', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!$.trim($('#pro_city').val())) {
- layer.confirm('项目所在市不能为空', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!$.trim($('#pro_title').val())) {
- layer.confirm('项目名称不能为空', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!$.trim($('#department').val())) {
- layer.confirm('科室名称不能为空', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!$.trim($('#floor').val())) {
- layer.confirm('楼层名称不能为空', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!$.trim($('#person').val())) {
- layer.confirm('负责人不能为空', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!$.trim($('#task_type').val())) {
- layer.confirm('任务状态不能为空', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#bigsheetonenum').val()))) {
- layer.confirm('大单只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#quiltcovernum').val()))) {
- layer.confirm('被罩只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#pillowcasenum').val()))) {
- layer.confirm('枕套只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#pillownum').val()))) {
- layer.confirm('枕芯只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#clothesnum').val()))) {
- layer.confirm('条衣只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#pantsnum').val()))) {
- layer.confirm('条裤只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#whitepatientclothesnum').val()))) {
- layer.confirm('白病人衣只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#whitepatientpantsnum').val()))) {
- layer.confirm('白病人裤只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#singlelayer').val()))) {
- layer.confirm('单层中单只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#doublelayer').val()))) {
- layer.confirm('双层中单只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#quiltnum').val()))) {
- layer.confirm('被子只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#matnum').val()))) {
- layer.confirm('褥子只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#coolquiltnum').val()))) {
- layer.confirm('凉被子只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#bedspreadnum').val()))) {
- layer.confirm('床罩只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#blindsnum').val()))) {
- layer.confirm('窗帘只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#workclothesnum').val()))) {
- layer.confirm('工作衣只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#nurseclothesnum').val()))) {
- layer.confirm('护士衣只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#nursepantnum').val()))) {
- layer.confirm('护士裤只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#constraintsnum').val()))) {
- layer.confirm('约束带只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(!regexs.nums.test($.trim($('#hatsnum').val()))) {
- layer.confirm('帽子只能输入数字', {
- icon: 2,
- btn: ['确定'] //按钮
- });
- return;
- }
- if(pro_Id) {
- wURL = "equipmentapi/api/WoWash/update";
- } else {
- wURL = "equipmentapi/api/WoWash/add";
- }
- $.post(huayi.config.callcenter_url + wURL, {
- id: pro_Id, //pro_Id为空的时候添加
- //wocode: // //工单编号
- projectid: $('#pro_title').val(), //项目id
- provincecode: $('#pro_province').val(), //项目所在省
- citycode: $('#pro_city').val(), //项目所在市
- departmentsid: $('#department').val(), //科室名称id
- floorid: $('#floor').val(), //楼层名称id
- personid: $('#person').val(), //负责人id
- tasktype: $('#task_type').val(), //任务状态id(0实收,1实发)
- createtime: $('#createtime').val(), //添加时间
- tasktime: $('#tasktime').val(), //任务时间
- batchesnumber: $('#batchesnumber').val(), //关联批次(编号)
- bigsheetnum: $('#bigsheetonenum').val(), //大单
- quiltcovernum: $('#quiltcovernum').val(), //被罩
- pillowcasenum: $('#pillowcasenum').val(), //枕套
- pillownum: $('#pillownum').val(), //枕芯
- clothesnum: $('#clothesnum').val(), //条衣
- pantsnum: $('#pantsnum').val(), //条裤
- whitepatientclothesnum: $('#whitepatientclothesnum').val(), //白病人衣
- whitepatientpantsnum: $('#whitepatientpantsnum').val(), //白病人裤
- singlelayer: $('#singlelayer').val(), //单层中单
- doublelayer: $('#doublelayer').val(), //双层中单
- quiltnum: $('#quiltnum').val(), //被子
- matnum: $('#matnum').val(), //褥子
- coolquiltnum: $('#coolquiltnum').val(), //凉被子
- bedspreadnum: $('#bedspreadnum').val(), //床罩
- blindsnum: $('#blindsnum').val(), //窗帘
- workclothesnum: $('#workclothesnum').val(), //工作衣
- nurseclothesnum: $('#nurseclothesnum').val(), //护士衣
- nursepantnum: $('#nursepantnum').val(), //护士裤
- constraintsnum: $('#constraintsnum').val(), //约束带
- hatsnum: $('#hatsnum').val(), //帽子
- //isdelete: ,//是否删除(0正常,-1删除)
- }, function(data) {
- data = JSON.parse(data);
- if(data.state == "success") {
- var index = parent.layer.getFrameIndex(window.name);
- parent.layer.close(index);
- parent.initTable();
- parent.layer.msg("保存成功");
- }
- });
- }
- //获取科室下拉
- function getDepartmentList(el) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "configurationapi/api/Department/getlistdrop",
- dataType: 'json',
- async: false,
- data: {
- //projectid: ,//string 项目名称id
- //floorid: ,//string 楼层名称id
- },
- success: function(data) {
- var res = data.data;
- for(var i = 0; i < res.length; i++) {
- $('<option value=' + res[i].id + '>' + res[i].departmenname + '</option>').appendTo(el);
- }
- el.selectpicker('refresh');
- }
- });
- }
- //获取楼层下拉
- function getFloorList(el) {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "configurationapi/api/FloorManage/getlistdrop",
- dataType: 'json',
- async: false,
- data: {},
- success: function(data) {
- var res = data.data;
- for(var i = 0; i < res.length; i++) {
- $('<option value=' + res[i].id + '>' + res[i].floorname + '</option>').appendTo(el);
- }
- el.selectpicker('refresh');
- }
- });
- }
- //项目所在地二级联动
- function getProLocation(obj, obj1) {
- obj.empty();
- obj1.empty();
- obj.append('<option selected="selected" value="">请选择所在省</option>');
- obj1.append('<option selected="selected" value="">请选择所在市</option>');
- $.getJSON(huayi.config.callcenter_url + "configurationapi/api/provincesaddress/getaddressjson", {}, function(data) {
- var content = data.data; //省信息
- var cityInfos = []; //市信息
- //初始化省
- $(content).each(function(i, n) {
- if(n.parentcode === null) {
- $("<option value='" + n.code + "'>" + n.name + "</option>").appendTo(obj);
- }
- if(n.entityJson != null) {
- cityInfos.push(n.entityJson);
- }
- });
- //市
- obj.change(function() {
- obj1.empty();
- for(var i = 0; i < cityInfos.length; i++) {
- $(cityInfos[i]).each(function(j, v) {
- if(v.parentcode > 0) {
- if(obj.find("option:selected").val() == v.parentcode) {
- $("<option value='" + v.code + "'>" + v.name + "</option>").appendTo(obj1);
- }
- }
- });
- }
- if(obj.find("option:selected").val() == '') {
- obj1.append('<option selected="selected" value="">请选择所在市</option>');
- }
- if(obj1.val() == null) {
- obj1.append('<option selected="selected" value="">没有数据</option>');
- }
- });
- })
- }
- //省市项目三级联动
- function getProLocations(obj, obj1, obj2) {
- obj.empty();
- obj1.empty();
- obj2.empty();
- obj.append('<option selected="selected" value="">请选择所在省</option>');
- obj1.append('<option selected="selected" value="">请选择所在市</option>');
- obj2.append('<option selected="selected" value="">请选择项目</option>');
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "configurationapi/api/provincesaddress/getaddressandprojson",
- dataType: 'json',
- async: false,
- success: function(data) {
- var content = data.data; //省信息
- var cityInfos = []; //市信息
- var proInfos = []; //项目信息
- //初始化省
- $(content).each(function(i, n) {
- if(n.parentcode === null) {
- $("<option value='" + n.code + "'>" + n.name + "</option>").appendTo(obj);
- if(n.entityJson != null && n.entityJson.length > 0) {
- cityInfos.push(n.entityJson);
- }
- }
- });
- //市
- obj.change(function() {
- obj1.empty();
- for(var i = 0; i < cityInfos.length; i++) {
- $(cityInfos[i]).each(function(j, v) {
- if(v.parentcode > 0) {
- if(obj.find("option:selected").val() == v.parentcode) {
- $("<option value='" + v.code + "'>" + v.name + "</option>").appendTo(obj1);
- if(v.entityJson != null && v.entityJson.length > 0) {
- proInfos.push(v.entityJson);
- }
- }
- }
- });
- }
- if(obj.find("option:selected").val() == '') {
- obj1.append('<option selected="selected" value="">请选择所在市</option>');
- }
- if(obj1.val() == null) {
- obj1.append('<option selected="selected" value="">没有数据</option>');
- }
- obj1.trigger('change');
- });
- //项目
- obj1.change(function() {
- obj2.empty();
- for(var j = 0; j < proInfos.length; j++) {
- $(proInfos[j]).each(function(i, n) {
- if(n.parentcode > 0) {
- if(obj1.find("option:selected").val() == n.parentcode) {
- $("<option value='" + n.code + "'>" + n.name + "</option>").appendTo(obj2);
- }
- }
- });
- }
- obj2.selectpicker('refresh');
- if(obj1.find("option:selected").val() == '') {
- obj2.append('<option selected="selected" value="">请选择项目</option>');
- }
- if(obj2.val() == null || obj1.val() == '') {
- obj2.append('<option selected="selected" value="">没有项目</option>');
- }
- });
- },
- });
- }
|