File: /var/www/uileague/cms/js/chunk-06a0257f.9a6330bb.js
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-06a0257f","chunk-d9bb2b7c","chunk-2d212ed7","chunk-2d0c8e45"],{"4a0c2":function(e,t,n){},"578e":function(e,t,n){"use strict";n.r(t),n.d(t,"tableColumn",(function(){return i}));var i=[{prop:"role_name",label:"名稱"},{prop:"role_key",label:"Key"},{prop:"role_desc",label:"簡介"},{prop:"created",label:"添加時間",width:160},{prop:"updated",label:"更新時間",width:160}]},"58df":function(e,t,n){"use strict";var i=n("e9da"),a=n.n(i);a.a},"5def":function(e,t,n){"use strict";n.r(t);var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"tableSample"},[n("div",{staticClass:"header"},[n("div",{staticClass:"header-left"},[n("lin-search",{attrs:{placeholder:"搜索"},on:{query:e.onQueryChange}})],1),n("div",{staticClass:"header-right"},[e.canAdd?n("el-button",{attrs:{type:"primary",round:""},on:{click:e.handAdd}},[e._v("添加角色"),n("i",{staticClass:"el-icon-circle-plus-outline el-icon--right"})]):e._e()],1)]),n("div",{staticClass:"table-main"},[n("el-dialog",{attrs:{top:"5vh",width:"60%",visible:e.dialogTableVisible},on:{"update:visible":function(t){e.dialogTableVisible=t}}},[n("span",[e._v("選擇要展示的列:")]),n("el-checkbox-group",{staticClass:"m-20",on:{change:e.handleChange},model:{value:e.checkList,callback:function(t){e.checkList=t},expression:"checkList"}},e._l(e.tempCheckList,(function(e){return n("el-checkbox",{key:e,attrs:{disabled:"標題"===e||"排名"===e,label:e}})})),1),n("span",[e._v("選擇固定在左側的列:")]),n("el-checkbox-group",{staticClass:"m-20",model:{value:e.fixedLeftList,callback:function(t){e.fixedLeftList=t},expression:"fixedLeftList"}},e._l(e.tempCheckList,(function(t){return n("el-checkbox",{key:t,attrs:{disabled:e.fixedRightList.indexOf(t)>-1||-1===e.checkList.indexOf(t),label:t}})})),1),n("span",[e._v("選擇固定在右側的列:")]),n("el-checkbox-group",{staticClass:"m-20",model:{value:e.fixedRightList,callback:function(t){e.fixedRightList=t},expression:"fixedRightList"}},e._l(e.tempCheckList,(function(t){return n("el-checkbox",{key:t,attrs:{disabled:e.fixedLeftList.indexOf(t)>-1||-1===e.checkList.indexOf(t),label:t}})})),1)],1),n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],attrs:{data:e.tableData,id:"out-table'"},on:{"row-dblclick":e.rowClick}},[e._l(e.filterTableColumn,(function(t){return["排序"===t.label?n("el-table-column",{key:t.label,attrs:{label:"排序"},scopedSlots:e._u([{key:"default",fn:function(t){return[n("input",{directives:[{name:"model",rawName:"v-model",value:t.row.sorting,expression:"props.row.sorting"}],staticClass:"sort-input",attrs:{type:"number"},domProps:{value:t.row.sorting},on:{blur:function(n){return e.handleSort(t.row.sorting,t.row)},input:function(n){n.target.composing||e.$set(t.row,"sorting",n.target.value)}}})]}}],null,!0)}):e._e(),t.noRepeat?e._e():n("el-table-column",{key:t.label,attrs:{prop:t.prop,label:t.label,"show-overflow-tooltip":!0,fixed:!!t.fixed&&t.fixed,width:t.width?t.width:""}})]})),e.canEdit||e.canDelete?n("el-table-column",{attrs:{label:"操作",fixed:"right",width:"170"},scopedSlots:e._u([{key:"default",fn:function(t){return e._l(e.operate,(function(i,a){return n("el-button",{key:a,attrs:{type:i.type,plain:"",size:"mini",disabled:0==t.row.company_id},nativeOn:{click:function(n){return n.preventDefault(),n.stopPropagation(),e.buttonMethods(i.func,t.$index,t.row)}}},[e._v(e._s(i.name))])}))}}],null,!1,288657580)}):e._e()],2),n("el-dialog",{attrs:{title:e.dialogTitle,width:"800px",visible:e.showDialog,"close-on-click-modal":!1,"close-on-press-escape":!1},on:{"update:visible":function(t){e.showDialog=t},close:e.resetForm}},[n("el-form",{directives:[{name:"loading",rawName:"v-loading",value:e.syncLoading,expression:"syncLoading"}],ref:"form",attrs:{model:e.temp,"label-width":"120px",rules:e.rules}},[n("el-form-item",{directives:[{name:"show",rawName:"v-show",value:0!=e.temp.id,expression:"temp.id != 0"}],attrs:{label:"ID",prop:"id"}},[n("el-col",{attrs:{span:11}},[n("el-input",{attrs:{value:this.temp.id,disabled:""}})],1)],1),n("el-form-item",{attrs:{label:"Key",prop:"role_key"}},[n("el-col",{attrs:{span:24}},[n("el-input",{model:{value:e.temp.role_key,callback:function(t){e.$set(e.temp,"role_key",t)},expression:"temp.role_key"}})],1)],1),n("el-form-item",{attrs:{label:"名稱",prop:"role_name"}},[n("el-col",{attrs:{span:24}},[n("el-input",{model:{value:e.temp.role_name,callback:function(t){e.$set(e.temp,"role_name",t)},expression:"temp.role_name"}})],1)],1),n("el-form-item",{attrs:{label:"簡介",prop:"role_desc"}},[n("el-col",{attrs:{span:24}},[n("el-input",{model:{value:e.temp.role_desc,callback:function(t){e.$set(e.temp,"role_desc",t)},expression:"temp.role_desc"}})],1)],1),n("el-form-item",{attrs:{label:"權限",prop:"permissions"}},[n("el-col",{attrs:{span:24}},[n("el-checkbox-group",{model:{value:e.temp.permissions,callback:function(t){e.$set(e.temp,"permissions",t)},expression:"temp.permissions"}},e._l(e.permissionsData,(function(t){return n("el-checkbox",{key:t.id,attrs:{label:t.id}},[e._v(e._s(t.name))])})),1)],1)],1)],1),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{round:""},on:{click:function(t){e.showDialog=!1}}},[e._v("取 消")]),n("el-button",{attrs:{type:"primary",round:""},on:{click:function(t){0==e.temp.id?e.confirmAdd():e.confirmEdit()}}},[e._v("保 存")])],1)],1),e.searchKeyword?e._e():n("div",{staticClass:"pagination"},[n("el-pagination",{attrs:{"current-page":this.currentPage,"page-sizes":[10,20,30,50],"page-size":this.pageCount,layout:"total, sizes, prev, pager, next, jumper",total:this.total_nums},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1)],1)])},a=[],r=n("a34a"),s=n.n(r),o=n("63b8"),l=n("578e"),c=n("ab00");n("f121");function u(e,t,n,i,a,r,s){try{var o=e[r](s),l=o.value}catch(c){return void n(c)}o.done?t(l):Promise.resolve(l).then(i,a)}function d(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var r=e.apply(t,n);function s(e){u(r,i,a,s,o,"next",e)}function o(e){u(r,i,a,s,o,"throw",e)}s(void 0)}))}}var p={components:{LinSearch:o["default"]},data:function(){return{tableData:[],permissionsData:[],loading:!1,Hidden:!0,searchKeyword:"",checkList:[],filterTableColumn:[],refreshPagination:!0,currentPage:1,pageCount:50,total_nums:0,dialogTableVisible:!1,fixedLeftList:[],fixedRightList:[],value:"",editRow:0,showTooltip:!0,syncLoading:!1,catList:[],options:[],optionsValue:[1],status:{0:"下架",1:"展示中",99:"已删除"},presetPermissions:["login_app","login_web","read_dashboard","read_role","read_site","read_nfc","read_chkpt","read_schedule","read_incident"],dialogTitle:"",showDialog:!1,temp:{id:0,role_key:null,role_name:null,role_desc:null,permissions:[]},transfer_data:[],filterMethod:function(e,t){return t.pinyin.indexOf(e)>-1},rules:{role_key:[{required:!0,message:"Key 不能為空",trigger:"blur"}]},showDeleteDialog:!1,showImportDialog:!1}},computed:{canAdd:function(){return-1!=this.$store.state.permissions.indexOf("add_role")},canEdit:function(){return-1!=this.$store.state.permissions.indexOf("edit_role")},canDelete:function(){return-1!=this.$store.state.permissions.indexOf("delete_role")}},created:function(){var e=this;this.getList(this.cat,this.currentPage,this.pageCount),this.getPermissionList(),this.tableColumn=l["tableColumn"],this.operate=[],this.canEdit&&this.operate.push({name:"修改",func:"handleEdit",type:"primary"}),this.canDelete&&this.operate.push({name:"刪除",func:"handleDelete",type:"danger"}),this.tempCheckList=l["tableColumn"].map((function(e){return e.label})).slice(),this.checkList=l["tableColumn"].map((function(e){return e.label})),this.filterTableColumn=l["tableColumn"].filter((function(t){return e.checkList.indexOf(t.label)>-1}))},methods:{getList:function(){var e=d(s.a.mark((function e(t,n,i){var a,r;return s.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.loading=!0,a=this.searchKeyword,e.next=4,c["RoleModel"].getList({cat:t,start:n,count:i,keyword:a});case 4:r=e.sent,this.tableData=r.data,this.currentPage=r.currentPage,this.total_nums=parseInt(r.total),this.loading=!1;case 9:case"end":return e.stop()}}),e,this)})));function t(t,n,i){return e.apply(this,arguments)}return t}(),getPermissionList:function(){var e=d(s.a.mark((function e(){var t;return s.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,c["RoleModel"].getPermisionList();case 2:t=e.sent,this.permissionsData=t.data;case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),rowClick:function(e){console.log(e)},handleChange:function(){var e=this;this.filterTableColumn=l["tableColumn"].filter((function(t){return e.checkList.indexOf(t.label)>-1}))},showRowOperateModal:function(){},handleSort:function(e,t){console.log("rowData",t),this.$message({type:"success",message:"排序已更改为:".concat(e)})},handleRecommend:function(e,t){var n=this;this.loading=!0,console.log(e,t),e?setTimeout((function(){n.loading=!1,n.$message({type:"success",message:"推荐成功"})}),1e3):setTimeout((function(){n.loading=!1,n.$message({type:"success",message:"取消推荐"})}),1e3)},handleCellEdit:function(e){e.editFlag=!0,this.$set(this.filterTableColumn[7],"width",200),this.tempEditRemark=e.remark,this.editRow++},handleCellSave:function(e){var t=this;e.editFlag=!1,setTimeout((function(){t.editRow--,t.$message({type:"success",message:"修改成功"})}),1e3)},handleCellCancel:function(e){e.editFlag=!1,console.log(this.tempEditRemark),e.remark=this.tempEditRemark,this.editRow--},handleSizeChange:function(e){var t=this;console.log("每页 ".concat(e," 条")),this.pageCount=e,this.loading=!0,setTimeout((function(){t.getList(t.cat,t.currentPage,t.pageCount),t.loading=!1}),1e3)},handleCurrentChange:function(){var e=d(s.a.mark((function e(t){var n=this;return s.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:this.currentPage=t,this.loading=!0,setTimeout((function(){n.getList(n.cat,n.currentPage,n.pageCount),n.loading=!1}),1e3);case 3:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}(),buttonMethods:function(e,t,n){var i=this,a=this.$options.methods;a[e](i,t,n)},beforeCloseImportDialog:function(){this.showImportDialog=!1},handleImport:function(){var e=d(s.a.mark((function e(t){var n,i;return s.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(console.log(t),null!=t){e.next=5;break}this.$message.error("文件解析出錯"),e.next=20;break;case 5:if(t=t.map((function(e){var t=new Object;return t.group_name=e.Name,t.remark=e.Remark,t})),0!=t.length){e.next=10;break}this.$message.error("導入失敗,數據表為空"),e.next=20;break;case 10:return n=this.$loading({lock:!0,text:"正在導入,請稍候...",background:"rgba(255,255,255, 0.8)"}),e.next=13,GroupModel.import(this.temp.server_id,t);case 13:i=e.sent,console.log(i),0==i.rc?this.$confirm("其中"+i.data.success.length+"項導入成功,"+i.data.error.length+"項導入失敗,"+i.data.duplicate.length+"項因已存在已被忽略","處理完成",{confirmButtonText:"確定",showCancelButton:!1,type:"success"}):this.$message.error(i.msg),n.close(),this.showImportDialog=!1,this.currentPage=1,this.getList(this.cat,this.currentPage,this.pageCount);case 20:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}(),handleEdit:function(e,t,n,i){e.temp.id=n.id,e.temp.role_desc=n.role_desc,e.temp.role_name=n.role_name,e.temp.role_key=n.role_key,e.temp.permissions=n.permissions,e.dialogTitle="修改角色",e.showDialog=!0},handAdd:function(){var e=this;this.temp.id=0,this.temp.role_key="",this.temp.role_name="",this.temp.role_desc="";var t=this.permissionsData.filter((function(t){return-1!=e.presetPermissions.indexOf(t.value)}));this.temp.permissions=t.map((function(e){return e.id})),this.dialogTitle="添加角色",this.showDialog=!0},confirmAdd:function(){var e=d(s.a.mark((function e(){var t=this;return s.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:this.$refs.form.validate(function(){var e=d(s.a.mark((function e(n){var i;return s.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!n){e.next=14;break}return t.syncLoading=!0,e.next=4,c["RoleModel"].setRole("add",t.temp);case 4:if(i=e.sent,t.syncLoading=!1,0!==i.rc){e.next=13;break}return t.showDialog=!1,t.$message.success(i.msg),e.next=11,t.getList(t.cat,t.currentPage,t.pageCount);case 11:e.next=14;break;case 13:t.$message.error(i.msg);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),handleDelete:function(e,t,n){e.$confirm("此操作將永久刪除該記錄,是否繼續?","提示",{confirmButtonText:"確定",cancelButtonText:"取消",type:"warning"}).then(d(s.a.mark((function t(){var i;return s.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.loading=!0,t.next=3,c["RoleModel"].setRole("delete",n);case 3:if(i=t.sent,0!==i.rc){t.next=11;break}return e.loading=!1,e.$message.success(i.msg),t.next=9,e.getList(e.cat,e.currentPage,e.pageCount);case 9:t.next=13;break;case 11:e.loading=!1,e.$message.error(i.msg);case 13:case"end":return t.stop()}}),t)}))))},confirmEdit:function(){var e=d(s.a.mark((function e(){var t=this;return s.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:this.$refs.form.validate(function(){var e=d(s.a.mark((function e(n){var i;return s.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!n){e.next=14;break}return t.syncLoading=!0,e.next=4,c["RoleModel"].setRole("update",t.temp);case 4:if(i=e.sent,t.syncLoading=!1,0!==i.rc){e.next=13;break}return t.showDialog=!1,t.$message.success(i.msg),e.next=11,t.getList(t.cat,t.currentPage,t.pageCount);case 11:e.next=14;break;case 13:t.$message.error(i.msg);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),onQueryChange:function(e){this.searchKeyword=e.trim(),this.currentPage=1,this.getList(this.cat,this.currentPage,this.pageCount)},handleChangeOptions:function(e){this.optionsValue=e;var t=e[e.length-1];this.cat=t,this.total_nums=0,this.getList(this.cat,this.currentPage,this.pageCount)},_generateOptionsData:function(e){var t=[];return e.forEach((function(e){0!=e.pid||t.push({value:e.id,label:e.title,children:[]})})),t.forEach((function(n,i){var a=[];e.forEach((function(e){e.pid===n.value&&a.push({value:e.id,label:e.title,disabled:!e.status})})),t[i].children=a})),t},resetForm:function(){this.$refs.form.resetFields(),this.optionsValue=[]}},watch:{"temp.file":{handler:function(){this.temp.title=decodeURI(this.temp.file).replace(/%2F/g,"/")}},fixedLeftList:function(){var e=this;this.filterTableColumn.map((function(t,n){return e.fixedLeftList.indexOf(t.label)>-1?e.$set(e.filterTableColumn[n],"fixed","left"):-1===e.fixedRightList.indexOf(t.label)&&e.$set(e.filterTableColumn[n],"fixed",!1),""})),console.log(this.filterTableColumn)},fixedRightList:function(){var e=this;this.filterTableColumn.map((function(t,n){return e.fixedRightList.indexOf(t.label)>-1?e.$set(e.filterTableColumn[n],"fixed","right"):-1===e.fixedLeftList.indexOf(t.label)&&e.$set(e.filterTableColumn[n],"fixed",!1),""})),console.log(this.filterTableColumn)},editRow:function(){return this.filterTableColumn[7]&&0===this.editRow&&this.$set(this.filterTableColumn[7],"width",200),""}}},h=p,f=(n("7095"),n("2877")),m=Object(f["a"])(h,i,a,!1,null,"1426ea52",null);t["default"]=m.exports},"63b8":function(e,t,n){"use strict";n.r(t);var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"lin-search"},[n("el-input",{staticClass:"input-with-select",attrs:{size:"medium",placeholder:e.placeholder,clearable:""},model:{value:e.keyword,callback:function(t){e.keyword=t},expression:"keyword"}},[n("el-button",{attrs:{slot:"append",icon:"el-icon-search"},slot:"append"})],1)],1)},a=[],r=n("0a2a"),s={props:{placeholder:{type:String,default:"请输入内容"}},data:function(){return{keyword:""}},created:function(){var e=this;this.$watch("keyword",r["default"].debounce((function(t){e.$emit("query",t)}),1e3))},methods:{clear:function(){this.keyword=""}}},o=s,l=(n("58df"),n("2877")),c=Object(l["a"])(o,i,a,!1,null,"18aca186",null);t["default"]=c.exports},7095:function(e,t,n){"use strict";var i=n("4a0c2"),a=n.n(i);a.a},ab00:function(e,t,n){"use strict";n.r(t),n.d(t,"RoleModel",(function(){return m}));var i=n("a34a"),a=n.n(i),r=n("ceda"),s=n("4360");function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(n,!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e,t,n,i,a,r,s){try{var o=e[r](s),l=o.value}catch(c){return void n(c)}o.done?t(l):Promise.resolve(l).then(i,a)}function d(e){return function(){var t=this,n=arguments;return new Promise((function(i,a){var r=e.apply(t,n);function s(e){u(r,i,a,s,o,"next",e)}function o(e){u(r,i,a,s,o,"throw",e)}s(void 0)}))}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function f(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),e}var m=function(){function e(){p(this,e)}return f(e,null,[{key:"getList",value:function(){var e=d(a.a.mark((function e(t){var n;return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=new Object,e.prev=1,e.next=4,Object(r["post"])("/api-data",{c:"Role",a:"getList",company_id:s["default"].state.company_id,pageLimit:t.count,cpage:t.start,keyword:t.keyword}).then((function(e){n=e})).catch((function(e){console.log(null==e?"網絡出錯":e),console.log("網絡出錯123")}));case 4:e.sent,e.next=10;break;case 7:e.prev=7,e.t0=e["catch"](1),console.log("網絡出錯");case 10:return e.abrupt("return",n);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setRole",value:function(){var e=d(a.a.mark((function e(t,n){var i;return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return i=new Object,e.prev=1,e.next=4,Object(r["post"])("/api-data",l({c:"Role",a:t},n)).then((function(e){i=e})).catch((function(e){console.log(null==e?"網絡出錯":e)}));case 4:e.sent,e.next=10;break;case 7:e.prev=7,e.t0=e["catch"](1),console.log("網絡出錯");case 10:return e.abrupt("return",i);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));function t(t,n){return e.apply(this,arguments)}return t}()},{key:"getPermisionList",value:function(){var e=d(a.a.mark((function e(){var t;return a.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t=new Object,e.prev=1,e.next=4,Object(r["post"])("/api-data",{c:"Role",a:"getPermissionList",company_id:s["default"].state.company_id}).then((function(e){t=e})).catch((function(e){console.log(null==e?"網絡出錯":e),console.log("網絡出錯123")}));case 4:e.sent,e.next=10;break;case 7:e.prev=7,e.t0=e["catch"](1),console.log("網絡出錯");case 10:return e.abrupt("return",t);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));function t(){return e.apply(this,arguments)}return t}()}]),e}()},e9da:function(e,t,n){}}]);