123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841 |
- 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: '',//滑动时的效果
- JJCD: [],
- ZDDB: [],
- SFBJ: [],
- FGLDBJQR: [],
- readonly: {
- JJCD:false,
- SWBH:false,
- LWDW:false,
- LWWH:false,
- LWRQ:false,
- PSLD:false,
- BT:false,
- SZFNBYJ:false,
- SLDPS:false,
- BFSNBYJ:false,
- WLDPS:false,
- CBCSCLQK:false,
- ZDDB:false,
- CDCS:false,
- DBSX:false,
- ZBCS:false,
- SFBJ:false,
- BJQK:false,
- FGLDBJQR:false,
- BZ:false,
- NGR:false,
- ZBRQ:false
- },
- form: {
- ID: "", //多一个id
- JJCD:"",
- JJCD_NAME:"",
- SWBH:"",
- LWDW:"",
- LWWH:"",
- LWRQ:"",
- PSLD:"",
- BT:"",
- SZFNBYJ:"",
- SLDPS:"",
- ZDDB:"",
- ZDDB_NAME:"",
- CDCS:"",
- DBSX:"",
- ZBCS:"",
- SFBJ:"",
- SFBJ_NAME:"",
- BJQK:"",
- FGLDBJQR:"",
- FGLDBJQR_NAME:"",
- BZ:"",
- NGR:"",
- ZBRQ:""
- },
- BFSNBYJ: [],
- WLDPS: [],
- CBCSCLQK: [],
- BFSNBYJEDIT: true,
- WLDPSEDIT: true,
- CBCSCLQKEDIT: true,
- optionType: "",
- optionContent: "",
- showSave: false,
- buttonList: []
- },
- 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;
- console.log(_this.fileList);
- })
- },
- 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: "SW_LDPSCBD",
- id: _this.form.ID,
- routeid: _this.routeid,
- routeinfoid: _this.routeinfoid,
- routeinfotitle: _this.form.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.BT,
- directionid: _this.directionid,
- formeditid: _this.formeditid,
- data: JSON.stringify(arrayData)
- };
- console.log({data: s4.encryptData_CBC(JSON.stringify(postData))})
- $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));
- console.log(response);
- 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_EMERGENCY'),
- _this.getItemCodeTable('CODE_OVERSEE'),
- _this.getItemCodeTable('CODE_OPTION'),
- _this.getItemCodeTable('CODE_SFBJ'),
- _this.getDepartOption()]).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.JJCD = response1.data.CODE_EMERGENCY;
- _this.ZDDB = response2.data.CODE_OVERSEE;
- _this.FGLDBJQR = response3.data.CODE_OPTION;
- _this.SFBJ = response4.data.CODE_SFBJ;
- _this.departList = response5.data;
- _this.getFormDetail();
- }))
- },
- getFormDetail: () => {
- let postData = {
- ckey: "SW_LDPSCBD",
- 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 = {
- JJCD:true,
- SWBH:true,
- LWDW:true,
- LWWH:true,
- LWRQ:true,
- PSLD:true,
- BT:true,
- SZFNBYJ:true,
- SLDPS:true,
- BFSNBYJ:true,
- WLDPS:true,
- CBCSCLQK:true,
- ZDDB:true,
- CDCS:true,
- DBSX:true,
- ZBCS:true,
- SFBJ:true,
- BJQK:true,
- FGLDBJQR:true,
- BZ:true,
- NGR:true,
- ZBRQ:true
- }
- } else {
- _this.readonly = {
- JJCD: response.data.SW_LDPSCBD["JJCD.EREADONLY"] == "true",
- SWBH:response.data.SW_LDPSCBD["SWBH.EREADONLY"] == "true",
- LWDW:response.data.SW_LDPSCBD["LWDW.EREADONLY"] == "true",
- LWWH:response.data.SW_LDPSCBD["LWWH.EREADONLY"] == "true",
- LWRQ:response.data.SW_LDPSCBD["LWRQ.EREADONLY"] == "true",
- PSLD:response.data.SW_LDPSCBD["PSLD.EREADONLY"] == "true",
- BT:response.data.SW_LDPSCBD["BT.EREADONLY"] == "true",
- SZFNBYJ:response.data.SW_LDPSCBD["SZFNBYJ.EREADONLY"] == "true",
- SLDPS:response.data.SW_LDPSCBD["SLDPS.EREADONLY"] == "true",
- BFSNBYJ:response.data.SW_LDPSCBD["BFSNBYJ.EREADONLY"] == "true",
- WLDPS:response.data.SW_LDPSCBD["WLDPS.EREADONLY"] == "true",
- CBCSCLQK:response.data.SW_LDPSCBD["CBCSCLQK.EREADONLY"] == "true",
- ZDDB:response.data.SW_LDPSCBD["ZDDB.EREADONLY"] == "true",
- CDCS:response.data.SW_LDPSCBD["CDCS.EREADONLY"] == "true",
- DBSX:response.data.SW_LDPSCBD["DBSX.EREADONLY"] == "true",
- ZBCS:response.data.SW_LDPSCBD["ZBCS.EREADONLY"] == "true",
- SFBJ:response.data.SW_LDPSCBD["SFBJ.EREADONLY"] == "true",
- BJQK:response.data.SW_LDPSCBD["BJQK.EREADONLY"] == "true",
- FGLDBJQR:response.data.SW_LDPSCBD["FGLDBJQR.EREADONLY"] == "true",
- BZ:response.data.SW_LDPSCBD["BZ.EREADONLY"] == "true",
- NGR:response.data.SW_LDPSCBD["NGR.EREADONLY"] == "true",
- ZBRQ:response.data.SW_LDPSCBD["ZBRQ.EREADONLY"] == "true"
- }
- }
- _this.form = {
- ID: response.data.SW_LDPSCBD.ID,
- JJCD: response.data.SW_LDPSCBD.JJCD == "" ? _this.JJCD[0].CODE : response.data.SW_LDPSCBD.JJCD,
- ZDDB: response.data.SW_LDPSCBD.ZDDB == "" ? _this.ZDDB[0].CODE : response.data.SW_LDPSCBD.ZDDB,
- FGLDBJQR: response.data.SW_LDPSCBD.FGLDBJQR == "" ? _this.FGLDBJQR[0].CODE : response.data.SW_LDPSCBD.FGLDBJQR,
- SFBJ: response.data.SW_LDPSCBD.SFBJ == "" ? _this.SFBJ[0].CODE : response.data.SW_LDPSCBD.SFBJ,
- LWRQ: (response.data.SW_LDPSCBD.LWRQ == "" || response.data.SW_LDPSCBD.LWRQ == null || response.data.SW_LDPSCBD.LWRQ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.SW_LDPSCBD.LWRQ),
- DBSX: (response.data.SW_LDPSCBD.DBSX == "" || response.data.SW_LDPSCBD.DBSX == null || response.data.SW_LDPSCBD.DBSX == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.SW_LDPSCBD.DBSX),
- ZBRQ: (response.data.SW_LDPSCBD.ZBRQ == "" || response.data.SW_LDPSCBD.ZBRQ == null || response.data.SW_LDPSCBD.ZBRQ == undefined) ? _this.utils.datefmt("yyyy-MM-dd", _this.utils.getLocalDate1()) : _this.utils.datefmt("yyyy-MM-dd", response.data.SW_LDPSCBD.ZBRQ),
- SWBH: response.data.SW_LDPSCBD.SWBH,
- LWDW: response.data.SW_LDPSCBD.LWDW,
- LWWH: response.data.SW_LDPSCBD.LWWH,
- PSLD: response.data.SW_LDPSCBD.PSLD,
- BT: response.data.SW_LDPSCBD.BT,
- SZFNBYJ: response.data.SW_LDPSCBD.SZFNBYJ,
- SLDPS: response.data.SW_LDPSCBD.SLDPS,
- CDCS: response.data.SW_LDPSCBD.CDCS,
- ZBCS: response.data.SW_LDPSCBD.ZBCS,
- BJQK: response.data.SW_LDPSCBD.BJQK,
- BZ: response.data.SW_LDPSCBD.BZ,
- NGR: response.data.SW_LDPSCBD.NGR,
- }
- if (response.data.SW_LDPSCBD.JJCD == "") {
- _this.form.JJCD_NAME = _this.JJCD[0].CNAME;
- } else {
- _this.JJCD.forEach(function (item) {
- if (item.CODE == response.data.SW_LDPSCBD.JJCD) {
- _this.form.JJCD_NAME = item.CNAME;
- }
- })
- }
- if (response.data.SW_LDPSCBD.ZDDB == "") {
- _this.form.ZDDB_NAME = _this.ZDDB[0].CNAME;
- } else {
- _this.ZDDB.forEach(function (item) {
- if (item.CODE == response.data.SW_LDPSCBD.ZDDB) {
- _this.form.ZDDB_NAME = item.CNAME;
- }
- })
- }
- if (response.data.SW_LDPSCBD.FGLDBJQR == "") {
- _this.form.FGLDBJQR_NAME = _this.FGLDBJQR[0].CNAME;
- } else {
- _this.FGLDBJQR.forEach(function (item) {
- if (item.CODE == response.data.SW_LDPSCBD.FGLDBJQR) {
- _this.form.FGLDBJQR_NAME = item.CNAME;
- }
- })
- }
- if (response.data.SW_LDPSCBD.SFBJ == "") {
- _this.form.SFBJ_NAME = _this.SFBJ[0].CNAME;
- } else {
- _this.SFBJ.forEach(function (item) {
- if (item.CODE == response.data.SW_LDPSCBD.SFBJ) {
- _this.form.SFBJ_NAME = item.CNAME;
- }
- })
- }
- _this.getAllOption();
- _this.$nextTick(() => {
- _this.initInputPlug();
- })
- })
- },
- initInputPlug: () => {
- $("#LWRQ").calendar({
- onChange: function (p, values, displayValues) {
- _this.form.LWRQ = values[0];
- }
- });
- $("#DBSX").calendar({
- onChange: function (p, values, displayValues) {
- _this.form.DBSX = values[0];
- }
- });
- $("#ZBRQ").calendar({
- onChange: function (p, values, displayValues) {
- _this.form.ZBRQ = values[0];
- }
- });
- let listJJCD= [];
- let listZDDB = [];
- let listSFBJ = [];
- let listFGLDBJQR = [];
- _this.JJCD.forEach(function (item) {
- listJJCD.push(item.CNAME);
- })
- _this.ZDDB.forEach(function (item) {
- listZDDB.push(item.CNAME);
- })
- _this.SFBJ.forEach(function (item) {
- listSFBJ.push(item.CNAME);
- })
- _this.FGLDBJQR.forEach(function (item) {
- listFGLDBJQR.push(item.CNAME);
- })
- $("#JJCD").picker({
- title: "请选择紧急程度",
- cols: [
- {
- textAlign: 'center',
- values: listJJCD
- }
- ],
- onChange: function (p, v, dv) {
- _this.form.JJCD_NAME = v[0];
- _this.JJCD.forEach(function (item) {
- if (item.CNAME == v[0]) {
- _this.form.JJCD = item.CODE;
- }
- })
- },
- });
- $("#ZDDB").picker({
- title: "请选择重点督办",
- cols: [
- {
- textAlign: 'center',
- values: listZDDB
- }
- ],
- onChange: function (p, v, dv) {
- _this.form.ZDDB_NAME = v[0];
- _this.ZDDB.forEach(function (item) {
- if (item.CNAME == v[0]) {
- _this.form.ZDDB = item.CODE;
- }
- })
- },
- });
- $("#SFBJ").picker({
- title: "请选择是否办结",
- cols: [
- {
- textAlign: 'center',
- values: listSFBJ
- }
- ],
- onChange: function (p, v, dv) {
- _this.form.SFBJ_NAME = v[0];
- _this.SFBJ.forEach(function (item) {
- if (item.CNAME == v[0]) {
- _this.form.SFBJ = item.CODE;
- }
- })
- },
- });
- $("#FGLDBJQR").picker({
- title: "请选择分管领导办结确认",
- cols: [
- {
- textAlign: 'center',
- values: listFGLDBJQR
- }
- ],
- onChange: function (p, v, dv) {
- _this.form.FGLDBJQR_NAME = v[0];
- _this.FGLDBJQR.forEach(function (item) {
- if (item.CNAME == v[0]) {
- _this.form.FGLDBJQR = item.CODE;
- }
- })
- },
- });
- let optionDepart=[];
- _this.departList.forEach(function (item) {
- optionDepart.push({
- title: item.DEP,
- value: item.DEPCODE,
- description: item.DEP
- })
- })
- $("#ZBCS").select({
- title: "请选择主办处室",
- multi: true,
- items:optionDepart,
- onChange: function(d) {
- },
- onClose: function (d) {
- _this.form.ZBCS=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: "SW_LDPSCBD",
- id: _this.form.ID,
- routeid: _this.routeid,
- routeinfoid: _this.routeinfoid,
- routeinfotitle: _this.form.BT.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 = data = {
- cmanid: _this.userId,
- routeinfoid: _this.routeinfoid,
- routeid: _this.routeid,
- tableid: "SW_LDPSCBD",
- 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.BFSNBYJ = [];
- _this.WLDPS = [];
- _this.CBCSCLQK = [];
- $http.all([_this.getItemOption('BFSNBYJ'), _this.getItemOption('WLDPS'),_this.getItemOption('CBCSCLQK')]).then($http.spread((first, second, third) => {
- 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));
- console.log(response1);
- _this.BFSNBYJ = response1.data;
- _this.WLDPS = response2.data;
- _this.CBCSCLQK = response3.data;
- _this.dealOption('BFSNBYJ');
- _this.dealOption('WLDPS');
- _this.dealOption('CBCSCLQK');
- }))
- },
- deleteOption: (code) => {
- $.confirm("您确定要删除当前意见吗?", "确认删除?", function () {
- let postData = {
- cmanid: _this.userId,
- routeid: _this.routeid,
- tableid: "SW_LDPSCBD",
- 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: "SW_LDPSCBD",
- 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: "SW_LDPSCBD",
- 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["SW_LDPSCBD.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
- }
- })
- },
- },
- 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();
- }
- })
|