let s4 = new SM4Util(); let detailVue = new Vue({ el: "#detailBox", data: { apiurl: apiurl,//基础的页面请求地址 userId: "", //用户id userName: "", //用户中文名 token: "", nowTab: "tab1", routeid: "", routeinfoid: "", directionid: "", formeditid: "", docmode: "", dotype: "", type: "", routerList: [], fileList: [], isEnd: false, startX: 0, endX: 0, deleteSlider: '',//滑动时的效果 JBSXLY: [], BLJG:[], DBLX: [], FGLDSFTYBJ:[], WLDSFTYBJ:[], readonly: { BH:false, DBSX1: false, PSLD: false, XGLD: false, JBSXLY: false, DBLX: false, JBDW: false, JTGZYQ: false, QTBM: false, XZBM: false, WCSX: false, TBRQ: false, ZBBMCLQK: false, XBBMCLQK: false, BLJG: false, SJBJRQ: false, SQYQRQ: false, ZZYQWCQX: false, SQYQYY: false, FGLDSFTYBJ: false, FGLDYJ: false, WLDSFTYBJ: false, WLDYJ: false }, form: { ID: "", //多一个id BH:"", DBSX1: "", PSLD: "", XGLD: "", JBSXLY: "", JBSXLY_NAME: "", DBLX: "", DBLX_NANE:"", JBDW: "", JTGZYQ: "", QTBM:"", XZBM: "", WCSX: "", TBRQ: "", BLJG: "", BLJG_NANE:"", SJBJRQ: "", SQYQRQ: "", ZZYQWCQX: "", FGLDSFTYBJ: "", FGLDSFTYBJ_NANE:"", WLDSFTYBJ: "", WLDSFTYBJ_NAME:"", }, ZBBMCLQK: [], XBBMCLQK: [], SQYQYY: [], FGLDYJ: [], WLDYJ: [], ZBBMCLQKEDIT: true, XBBMCLQKEDIT: true, SQYQYYEDIT: true, FGLDYJEDIT: true, WLDYJEDIT: true, optionType: "", optionContent: "", showSave: false, buttonList: [], userList:[], departList:[] }, methods: { dateFtt: (fmt, date) => { var o = { "M+": date.getMonth() + 1, //月份 "d+": date.getDate(), //日 "h+": date.getHours(), //小时 "m+": date.getMinutes(), //分 "s+": date.getSeconds(), //秒 "q+": Math.floor((date.getMonth() + 3) / 3), //季度 "S": date.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; }, changeTab: (tabCode) => { _this.nowTab = tabCode; if (_this.nowTab == "tab1") { } else if (_this.nowTab == "tab2") { _this.getFileList(); } else if (_this.nowTab == "tab3") { _this.getRouterList(); } }, getRouterList: () => { _this.routerList = []; let postData = { directionid: _this.directionid, userid: _this.userId, routeid: _this.routeid, routeinfoid: _this.routeinfoid, } $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/abase/queryDataRouteList", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }).then(res => { let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data)); response.data.forEach(function (item) { item.mainUser = []; item.copyUsers = []; item.isNow = false; item.USERS.forEach(function (item2) { if (item2.KIND == 0) { item.mainUser.push(item2.USERNAME); } else { item.copyUsers.push(item2.USERNAME); } }) item.NAME = "【" + item.STARTNODENAME + "】转" + "【" + item.ENDNODENAME + "】" item.mainUser = item.mainUser.join(","); item.copyUsers = item.copyUsers.join(","); }) _this.routerList = response.data; if (_this.routerList[_this.routerList.length - 1].ENDNODENAME == '结束') { _this.isEnd = true; _this.routerList[_this.routerList.length - 1].isNow = false; } else { _this.routerList[_this.routerList.length - 1].isNow = true; _this.isEnd = false; } }) }, getFileList: () => { _this.fileList = []; let postData = { tablename: "FILE_ATTACH", colums: "*", order: "ID desc", sqlwhere: {ROUTEINFOID: _this.routeinfoid}, sqlinwhere: "", sqllikewhere: "" } $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/dataabase/queryDataByCol", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }).then(res => { let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data)); response.data.forEach(function (item) { item.deleteSlider = "transform:translateX(0px)"; }) _this.fileList = response.data; }) }, touchStart(e) { _this.startX = e.touches[0].clientX; }, touchEnd(e) { let index = e.currentTarget.dataset.index; // 当前滑动的父级元素 _this.endX = e.changedTouches[0].clientX; // 左滑 if (_this.startX - _this.endX > 30) { _this.fileList.forEach(function (item) { item.deleteSlider = "transform:translateX(0px)"; }) _this.fileList[index].deleteSlider = "transform:translateX(-120px)"; } // 右滑 if (_this.startX - _this.endX < -30) { _this.fileList.forEach(function (item) { item.deleteSlider = "transform:translateX(0px)"; }) } _this.startX = 0; _this.endX = 0; }, downLoad: (item) => { window.open(_this.apiurl + "g2work/files/" + item.FILEURL.slice(7)); }, deleteFile: (item) => { if (_this.dotype != 0) { _this.$nextTick(() => { $.confirm("您确定要删除当前附件吗?", "确认删除?", function () { let postData = { tablename: "FILE_ATTACH", id: item.ID }; $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/dataabase/delDataById", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }).then(res => { let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data)); if (response.success) { _this.getFileList(); } else { $.alert("删除失败,请联系管理员!", "温馨提示"); } }) }, function () { //取消操作 }); }) } else { _this.$nextTick(() => { $.alert("当前模式下无法删除附件", "温馨提示"); }) } }, sendBtn: () => { if (_this.dotype != 0) { let formData = {}; for (let key in _this.form) { if (key.indexOf("_NAME") == -1) { formData[key] = _this.form[key] } } let arrayData = []; arrayData.push(formData) let postData = { ckey: "DCDB_SXDBD", id: _this.form.ID, routeid: _this.routeid, routeinfoid: _this.routeinfoid, routeinfotitle: _this.form.DBSX1.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT, directionid: _this.directionid, formeditid: _this.formeditid, data: JSON.stringify(arrayData) }; $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/abase/saveData", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }).then(res => { let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data)); if (response.success) { location.href = "sendedit.html?routeid=" + _this.routeid + "&routeinfoid=" + _this.routeinfoid + "&directionid=" + _this.directionid + "&formeditid=" + _this.formeditid + "&docmode=" + _this.docmode + "&dotype=" + _this.dotype + "&type" + _this.type; } else { $.alert("保存表单失败,无法进行转发,请联系管理员!", "温馨提示"); } }) } else { _this.$nextTick(() => { $.alert("当前模式下无法进行转发", "温馨提示"); }) } }, getItemCodeTable: (tablename) => { let postData = { ckey: tablename, routeinfoid: _this.routeinfoid } return $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/abase/queryDataCode", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }) }, getAllCodeTable: () => { $http.all([_this.getItemCodeTable('CODE_DUBAN'), _this.getItemCodeTable('CODE_JBSXLY'), _this.getItemCodeTable('CODE_BLJG'), _this.getItemCodeTable('CODE_SF'), _this.getItemCodeTable('CODE_SF'), _this.getDepartOption()]).then($http.spread((first, second, third,forth,fifth,sixth) => { let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data)); let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data)); let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data)); let response4 = _this.utils.strToJson(s4.decryptData_CBC(forth.data.data)); let response5 = _this.utils.strToJson(s4.decryptData_CBC(fifth.data.data)); let response6 = _this.utils.strToJson(s4.decryptData_CBC(sixth.data.data)); _this.DBLX = response1.data.CODE_DUBAN; _this.JBSXLY = response2.data.CODE_JBSXLY; _this.BLJG = response3.data.CODE_BLJG; _this.FGLDSFTYBJ = response4.data.CODE_SF; _this.WLDSFTYBJ = response5.data.CODE_SF; _this.departList = response6.data; _this.userList=[]; response6.data.forEach(function (item) { item.USER.forEach(function (item2) { _this.userList.push(item2); }) }) _this.getFormDetail(); _this.getAllOption(); })) }, getFormDetail: () => { let postData = { ckey: "DCDB_SXDBD", id: 0, directionid: _this.directionid, formeditid: _this.formeditid, routeid: _this.routeid, routeinfoid: _this.routeinfoid } $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/abase/queryData", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }).then(res => { let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data)); //0表单禁用 if (_this.dotype == '0') { _this.readonly = { BH:true, DBSX1: true, PSLD: true, XGLD: true, JBSXLY: true, DBLX: true, JBDW: true, JTGZYQ: true, QTBM: true, XZBM: true, WCSX: true, TBRQ: true, ZBBMCLQK: true, XBBMCLQK: true, BLJG: true, SJBJRQ: true, SQYQRQ: true, ZZYQWCQX: true, SQYQYY: true, FGLDSFTYBJ: true, FGLDYJ: true, WLDSFTYBJ: true, WLDYJ: true, } } else { _this.readonly = { BH: response.data.DCDB_SXDBD["BH.EREADONLY"] == "true", DBSX1: response.data.DCDB_SXDBD["DBSX1.EREADONLY"] == "true", PSLD: response.data.DCDB_SXDBD["PSLD.EREADONLY"] == "true", XGLD: response.data.DCDB_SXDBD["XGLD.EREADONLY"] == "true", JBSXLY: response.data.DCDB_SXDBD["JBSXLY.EREADONLY"] == "true", DBLX: response.data.DCDB_SXDBD["DBLX.EREADONLY"] == "true", JBDW: response.data.DCDB_SXDBD["JBDW.EREADONLY"] == "true", JTGZYQ: response.data.DCDB_SXDBD["JTGZYQ.EREADONLY"] == "true", QTBM: response.data.DCDB_SXDBD["QTBM.EREADONLY"] == "true", XZBM: response.data.DCDB_SXDBD["XZBM.EREADONLY"] == "true", WCSX: response.data.DCDB_SXDBD["WCSX.EREADONLY"] == "true", TBRQ: response.data.DCDB_SXDBD["TBRQ.EREADONLY"] == "true", ZBBMCLQK: response.data.DCDB_SXDBD["ZBBMCLQK.EREADONLY"] == "true", XBBMCLQK: response.data.DCDB_SXDBD["XBBMCLQK.EREADONLY"] == "true", BLJG: response.data.DCDB_SXDBD["BLJG.EREADONLY"] == "true", SJBJRQ: response.data.DCDB_SXDBD["SJBJRQ.EREADONLY"] == "true", SQYQRQ: response.data.DCDB_SXDBD["SQYQRQ.EREADONLY"] == "true", ZZYQWCQX: response.data.DCDB_SXDBD["ZZYQWCQX.EREADONLY"] == "true", SQYQYY: response.data.DCDB_SXDBD["SQYQYY.EREADONLY"] == "true", FGLDSFTYBJ: response.data.DCDB_SXDBD["FGLDSFTYBJ.EREADONLY"] == "true", FGLDYJ: response.data.DCDB_SXDBD["FGLDYJ.EREADONLY"] == "true", WLDSFTYBJ: response.data.DCDB_SXDBD["WLDSFTYBJ.EREADONLY"] == "true", WLDYJ: response.data.DCDB_SXDBD["WLDYJ.EREADONLY"] == "true", } } _this.form = { ID: response.data.DCDB_SXDBD.ID, DBLX: response.data.DCDB_SXDBD.DBLX == "" ? _this.DBLX[0].CODE : response.data.DCDB_SXDBD.DBLX, JBSXLY: response.data.DCDB_SXDBD.JBSXLY == "" ? _this.JBSXLY[0].CODE : response.data.DCDB_SXDBD.JBSXLY, BLJG: response.data.DCDB_SXDBD.BLJG == "" ? _this.BLJG[0].CODE : response.data.DCDB_SXDBD.BLJG, FGLDSFTYBJ: response.data.DCDB_SXDBD.FGLDSFTYBJ == "" ? _this.FGLDSFTYBJ[0].CODE : response.data.DCDB_SXDBD.FGLDSFTYBJ, WLDSFTYBJ: response.data.DCDB_SXDBD.WLDSFTYBJ == "" ? _this.WLDSFTYBJ[0].CODE : response.data.DCDB_SXDBD.WLDSFTYBJ, WCSX: (response.data.DCDB_SXDBD.WCSX == "" || response.data.DCDB_SXDBD.WCSX == null || response.data.DCDB_SXDBD.WCSX == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.DCDB_SXDBD.WCSX), TBRQ: (response.data.DCDB_SXDBD.TBRQ == "" || response.data.DCDB_SXDBD.TBRQ == null || response.data.DCDB_SXDBD.TBRQ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.DCDB_SXDBD.TBRQ), SJBJRQ: (response.data.DCDB_SXDBD.SJBJRQ == "" || response.data.DCDB_SXDBD.SJBJRQ == null || response.data.DCDB_SXDBD.SJBJRQ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.DCDB_SXDBD.SJBJRQ), SQYQRQ: (response.data.DCDB_SXDBD.SQYQRQ == "" || response.data.DCDB_SXDBD.SQYQRQ == null || response.data.DCDB_SXDBD.SQYQRQ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.DCDB_SXDBD.SQYQRQ), ZZYQWCQX: (response.data.DCDB_SXDBD.ZZYQWCQX == "" || response.data.DCDB_SXDBD.ZZYQWCQX == null || response.data.DCDB_SXDBD.ZZYQWCQX == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.DCDB_SXDBD.ZZYQWCQX), BH: response.data.DCDB_SXDBD.BH, DBSX1: response.data.DCDB_SXDBD.DBSX1, PSLD:response.data.DCDB_SXDBD.PSLD, XGLD:response.data.DCDB_SXDBD.XGLD, JBDW:response.data.DCDB_SXDBD.JBDW, JTGZYQ:response.data.DCDB_SXDBD.JTGZYQ, QTBM:response.data.DCDB_SXDBD.QTBM, XZBM:response.data.DCDB_SXDBD.XZBM, } if (response.data.DCDB_SXDBD.DBLX == "") { _this.form.DBLX_NAME = _this.DBLX[0].CNAME; } else { _this.DBLX.forEach(function (item) { if (item.CODE == response.data.DCDB_SXDBD.DBLX) { _this.form.DBLX_NAME = item.CNAME; } }) } if (response.data.DCDB_SXDBD.JBSXLY == "") { _this.form.JBSXLY_NAME = _this.JBSXLY[0].CNAME; } else { _this.JBSXLY.forEach(function (item) { if (item.CODE == response.data.DCDB_SXDBD.JBSXLY) { _this.form.JBSXLY_NAME = item.CNAME; } }) } if (response.data.DCDB_SXDBD.BLJG == "") { _this.form.BLJG_NAME = _this.BLJG[0].CNAME; } else { _this.BLJG.forEach(function (item) { if (item.CODE == response.data.DCDB_SXDBD.BLJG) { _this.form.BLJG_NAME = item.CNAME; } }) } if (response.data.DCDB_SXDBD.FGLDSFTYBJ == "") { _this.form.FGLDSFTYBJ_NAME = _this.FGLDSFTYBJ[0].CNAME; } else { _this.FGLDSFTYBJ.forEach(function (item) { if (item.CODE == response.data.DCDB_SXDBD.FGLDSFTYBJ) { _this.form.FGLDSFTYBJ_NAME = item.CNAME; } }) } if (response.data.DCDB_SXDBD.WLDSFTYBJ == "") { _this.form.WLDSFTYBJ_NAME = _this.WLDSFTYBJ[0].CNAME; } else { _this.WLDSFTYBJ.forEach(function (item) { if (item.CODE == response.data.DCDB_SXDBD.WLDSFTYBJ) { _this.form.WLDSFTYBJ_NAME = item.CNAME; } }) } _this.$nextTick(() => { _this.initInputPlug(); }) }) }, initInputPlug: () => { $("#WCSX").calendar({ onChange: function (p, values, displayValues) { _this.form.WCSX = values[0]; } }); $("#TBRQ").calendar({ onChange: function (p, values, displayValues) { _this.form.TBRQ = values[0]; } }); $("#SJBJRQ").calendar({ onChange: function (p, values, displayValues) { _this.form.SJBJRQ = values[0]; } }); $("#SQYQRQ").calendar({ onChange: function (p, values, displayValues) { _this.form.SQYQRQ = values[0]; } }); $("#ZZYQWCQX").calendar({ onChange: function (p, values, displayValues) { _this.form.ZZYQWCQX = values[0]; } }); let listDBLX = []; let listJBSXLY = []; let listBLJG = []; let listFGLDSFTYBJ = []; let listWLDSFTYBJ = []; _this.DBLX.forEach(function (item) { listDBLX.push(item.CNAME); }) _this.JBSXLY.forEach(function (item) { listJBSXLY.push(item.CNAME); }) _this.BLJG.forEach(function (item) { listBLJG.push(item.CNAME); }) _this.FGLDSFTYBJ.forEach(function (item) { listFGLDSFTYBJ.push(item.CNAME); }) _this.WLDSFTYBJ.forEach(function (item) { listWLDSFTYBJ.push(item.CNAME); }) $("#DBLX").picker({ title: "请选择督办类型", cols: [ { textAlign: 'center', values: listDBLX } ], onChange: function (p, v, dv) { _this.form.DBLX_NAME = v[0]; _this.DBLX.forEach(function (item) { if (item.CNAME == v[0]) { _this.form.DBLX = item.CODE; } }) }, }); $("#JBSXLY").picker({ title: "请选择交办事项来源", cols: [ { textAlign: 'center', values: listJBSXLY } ], onChange: function (p, v, dv) { _this.form.JBSXLY_NAME = v[0]; _this.JBSXLY.forEach(function (item) { if (item.CNAME == v[0]) { _this.form.JBSXLY = item.CODE; } }) }, }); $("#BLJG").picker({ title: "请选择办理结果", cols: [ { textAlign: 'center', values: listBLJG } ], onChange: function (p, v, dv) { _this.form.BLJG_NAME = v[0]; _this.BLJG.forEach(function (item) { if (item.CNAME == v[0]) { _this.form.BLJG = item.CODE; } }) }, }); $("#FGLDSFTYBJ").picker({ title: "请选择分管领导是否同意", cols: [ { textAlign: 'center', values: listFGLDSFTYBJ } ], onChange: function (p, v, dv) { _this.form.FGLDSFTYBJ_NAME = v[0]; _this.FGLDSFTYBJ.forEach(function (item) { if (item.CNAME == v[0]) { _this.form.FGLDSFTYBJ = item.CODE; } }) }, }); $("#WLDSFTYBJ").picker({ title: "请选择委领导是否同意", cols: [ { textAlign: 'center', values: listWLDSFTYBJ } ], onChange: function (p, v, dv) { _this.form.WLDSFTYBJ_NAME = v[0]; _this.WLDSFTYBJ.forEach(function (item) { if (item.CNAME == v[0]) { _this.form.WLDSFTYBJ = item.CODE; } }) }, }); let optionDepart=[]; _this.departList.forEach(function (item) { optionDepart.push({ title: item.DEP, value: item.DEPCODE, description: item.DEP }) }) $("#QTBM").select({ title: "请选择牵头部门", multi: true, items:optionDepart, onChange: function(d) { }, onClose: function (d) { _this.form.QTBM=d.data.titles; } }); $("#XZBM").select({ title: "请选择协助部门", multi: true, items:optionDepart, onChange: function(d) { }, onClose: function (d) { _this.form.XZBM=d.data.titles; } }); let optionUser=[]; _this.userList.forEach(function (item) { optionUser.push({ title: item.USHOWNAME, value: item.USERID, description: item.SECTION }) }) $("#PSLD").select({ title: "请选择批示领导", multi: true, items:optionUser, onChange: function(d) { }, onClose: function (d) { _this.form.PSLD=d.data.titles; } }); $("#XGLD").select({ title: "请选择相关领导", multi: true, items:optionUser, onChange: function(d) { }, onClose: function (d) { _this.form.XGLD=d.data.titles; } }); }, saveBtn: () => { if (_this.dotype != 0) { let formData = {}; for (let key in _this.form) { if (key.indexOf("_NAME") == -1) { formData[key] = _this.form[key] } } let arrayData = []; arrayData.push(formData) let postData = { ckey: "DCDB_SXDBD", id: _this.form.ID, routeid: _this.routeid, routeinfoid: _this.routeinfoid, routeinfotitle: _this.form.DBSX1.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT, directionid: _this.directionid, formeditid: _this.formeditid, data: JSON.stringify(arrayData) }; $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/abase/saveData", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }).then(res => { let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data)); if (response.success) { $.alert("保存成功!", "温馨提示"); _this.getFormDetail(); } else { $.alert("保存失败,请联系管理员!", "温馨提示"); } }) } else { _this.$nextTick(() => { $.alert("当前模式下无法进行保存", "温馨提示"); }) } }, getItemOption: (code) => { let postData = { cmanid: _this.userId, routeinfoid: _this.routeinfoid, routeid: _this.routeid, tableid: "DCDB_SXDBD", colid: code } return $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/abase/queryDataOpinion", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }) }, getAllOption: () => { _this.ZBBMCLQK = []; _this.XBBMCLQK = []; _this.SQYQYY = []; _this.FGLDYJ = []; _this.WLDYJ = []; $http.all([_this.getItemOption('ZBBMCLQK'), _this.getItemOption('XBBMCLQK'), _this.getItemOption('SQYQYY'), _this.getItemOption('FGLDYJ'), _this.getItemOption('WLDYJ')]).then($http.spread((first, second, third, forth,fifth) => { let response1 = _this.utils.strToJson(s4.decryptData_CBC(first.data.data)); let response2 = _this.utils.strToJson(s4.decryptData_CBC(second.data.data)); let response3 = _this.utils.strToJson(s4.decryptData_CBC(third.data.data)); let response4 = _this.utils.strToJson(s4.decryptData_CBC(forth.data.data)); let response5 = _this.utils.strToJson(s4.decryptData_CBC(fifth.data.data)); _this.ZBBMCLQK = response1.data; _this.XBBMCLQK = response2.data; _this.SQYQYY = response3.data; _this.FGLDYJ = response4.data; _this.WLDYJ = response5.data; _this.dealOption('ZBBMCLQK'); _this.dealOption('XBBMCLQK'); _this.dealOption('SQYQYY'); _this.dealOption('FGLDYJ'); _this.dealOption('WLDYJ'); })) }, deleteOption: (code) => { $.confirm("您确定要删除当前意见吗?", "确认删除?", function () { let postData = { cmanid: _this.userId, routeid: _this.routeid, tableid: "DCDB_SXDBD", colid: code, }; $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/abase/deleteDataOpinion", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }).then(res => { let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data)); if (response.success) { _this.getAllOption(); } else { $.alert("删除失败,请联系管理员!", "温馨提示"); } }) }, function () { //取消操作 }); }, editOption: (type, index) => { _this.optionType = type; let nowEditObj = _this[type][index]; if (_this.optionType == "") { $.alert("初始化失败,请联系管理员!", "温馨提示"); } else { _this.optionContent = nowEditObj.OPINION; $(".open-popup").eq(0).click(); } }, addOption: (type) => { _this.optionType = type; _this.optionContent = ""; if (_this.optionType == "") { $.alert("初始化失败,请联系管理员!", "温馨提示"); } else { $(".open-popup").eq(0).click(); } }, saveOption: () => { $(".close-popup").eq(0).click(); let postData = { cmanid: _this.userId, routeinfoid: _this.routeinfoid, routeid: _this.routeid, tableid: "DCDB_SXDBD", colid: _this.optionType, opiniontype: 0, cresult: "", opinion: _this.optionContent, opinionimage: "" }; $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/abase/saveDataOpinion", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }).then(res => { let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data)); if (response.success) { _this.getAllOption(); } else { $.alert("删除失败,请联系管理员!", "温馨提示"); } }) }, getBtnList: () => { let postData = { ckey: "DCDB_SXDBD", id: 0, directionid: _this.directionid, formeditid: _this.formeditid, routeid: _this.routeid, routeinfoid: _this.routeinfoid } $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/abase/queryData", data: {data: s4.encryptData_CBC(JSON.stringify(postData))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }).then(res => { let response = _this.utils.strToJson(s4.decryptData_CBC(res.data.data)); _this.buttonList = _this.dotype == 0 ? [] : response.data["DCDB_SXDBD.FUNCLIST"]; _this.buttonList.forEach(function (item) { if (item.CODE == "SAVEITEM") { _this.showSave = true; } }) }) }, //增补一个函数 dealOption: (key) => { let num = 0; let keyEdit = key + "EDIT"; _this[key].forEach(function (item) { if (item.ROUTEID == _this.routeid) { num++ } }) if (num > 0) { _this[keyEdit] = true; } else { _this[keyEdit] = false; } }, //拿回主动抄送的部门选项,和加载滚动选项一起执行 getDepartOption: () => { return $http({ method: 'post', baseURL: _this.apiurl, url: "g2app/dataabase/getDpList", data: {data: s4.encryptData_CBC(JSON.stringify(""))}, headers: { 'Content-Type': 'application/json', 'Authorization': "Bearer " + _this.token } }) }, //调用打开永中的嵌入页 openOfficePage: (item, type) => { let postData={ type:type, obj:item } let dataString = s4.encryptData_CBC(JSON.stringify(postData)); let goUrl = "officeedit.html?dataString=" + dataString; location.href = goUrl; } }, created: function () { _this = this; let token = localStorage.getItem("mobile-token", _this.token); let userName = localStorage.getItem("mobile-userName", _this.userName); let userId = localStorage.getItem("mobile-userId", _this.userId); _this.userId = userId; _this.token = token; _this.userName = userName; _this.routeid = _this.utils.getUrlName("routeid"); _this.routeinfoid = _this.utils.getUrlName("routeinfoid"); _this.directionid = _this.utils.getUrlName("directionid"); _this.formeditid = _this.utils.getUrlName("formeditid"); _this.docmode = _this.utils.getUrlName("docmode"); _this.dotype = _this.utils.getUrlName("dotype"); _this.type = _this.utils.getUrlName("type"); }, mounted: function () { _this.getAllCodeTable(); _this.getBtnList(); } })