123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- 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: "",
- buttonList: [],
- sendType: "",
- sendTarget: "",
- userList: [],
- direction: "",
- allSelect: false
- },
- 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;
- },
- backBtn: () => {
- location.href = "formedit.html?routeid=" + _this.routeid + "&routeinfoid=" + _this.routeinfoid + "&directionid=" + _this.directionid + "&formeditid=" + _this.formeditid + "&docmode=" + _this.docmode + "&dotype=" + _this.dotype + "&type" + _this.type;
- },
- 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));
- let sendButton = [];
- response.data["SW_LDPSCBD.FUNCLIST"].forEach(function (item) {
- if (item.CODE.indexOf("SENDITEM") > -1) {
- sendButton.push(item);
- }
- })
- _this.buttonList = _this.dotype == 0 ? [] : sendButton;
- _this.buttonList.forEach(function (item, index) {
- if (index == 0) {
- _this.sendType = item.CODE;
- _this.sendTarget = item.DIRECTIONIDTARGET
- _this.getOptionList(_this.sendType, _this.sendTarget);
- }
- })
- })
- },
- getOptionList: (code, target) => {
- _this.userList = [];
- _this.direction = "";
- let postData = {
- codefuncbutton: code,
- directionid: _this.directionid,
- directionidtarget: target,
- userid: _this.userId,
- routeinfoid: _this.routeinfoid,
- routeid: _this.routeid
- }
- $http({
- method: 'post',
- baseURL: _this.apiurl,
- url: "g2app/abase/queryDataSendByTarget",
- 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[0].SENDUSERS.USERS.forEach(function (item) {
- item.checked = false;
- })
- _this.direction = response.data[0];
- _this.userList = response.data[0].SENDUSERS.USERS;
- })
- },
- changeType: (index) => {
- _this.sendType = _this.buttonList[index].CODE;
- _this.sendTarget = _this.buttonList[index].DIRECTIONIDTARGET;
- _this.getOptionList(_this.sendType, _this.sendTarget);
- },
- send: () => {
- let sendUser
- if (_this.direction.ENDNODETYPE == 1) {
- sendUser = {
- DIRECTIONID: _this.direction.DIRECTIONID,
- MAINUSERID: "STOP",
- COPYUSERID: ""
- }
- } else if (_this.direction.CODEFUNCBUTTON == "SENDCOPYEND" || _this.direction.CODEFUNCBUTTON == "SENDPERUSAL") {
- sendUser = {
- DIRECTIONID: _this.direction.DIRECTIONID,
- MAINUSERID: "",
- COPYUSERID: ""
- }
- } else {
- let userSend = [];
- _this.userList.forEach(function (item) {
- if (item.checked) {
- userSend.push(item.USERID)
- }
- })
- sendUser = {
- DIRECTIONID: _this.direction.DIRECTIONID,
- MAINUSERID: userSend.join("|"),
- COPYUSERID: ""
- }
- if (userSend.length == 0) {
- $.alert("请先选择转发人员!", "温馨提示");
- return false
- }
- }
- let postData = {
- codefuncbutton: _this.direction.CODEFUNCBUTTON,
- directionid: _this.directionid,
- userid: _this.userId,
- routeinfoid: _this.routeinfoid,
- routeid: _this.routeid,
- data: "[" + JSON.stringify(sendUser) + "]"
- }
- $http({
- method: 'post',
- baseURL: _this.apiurl,
- url: "g2app/abase/saveDataSend",
- 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("转发成功,即将跳转列表!", "温馨提示");
- setTimeout(function () {
- location.href = "../list.html";
- }, 1000);
- } else {
- $.alert("转发失败,请联系管理员!", "温馨提示");
- }
- })
- },
- selectAll: () => {
- _this.userList.forEach(function (item) {
- item.checked = !_this.allSelect;
- })
- },
- selectItem: () => {
- _this.$nextTick(() => {
- setTimeout(function () {
- let selectNum = 0;
- let allNum = _this.userList.length;
- _this.userList.forEach(function (item) {
- if(item.checked){
- selectNum++;
- }
- })
- if(selectNum==allNum){
- _this.allSelect=true;
- }else{
- _this.allSelect=false;
- }
- },0)
- })
- }
- },
- 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.getBtnList();
- }
- })
|