34.1d62d5e5.js 12 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[34],{"0167":function(e,t,a){"use strict";a.r(t);a("caad");var n=function(){var e=this,t=e._self._c;return t("div",[t("transition",{attrs:{appear:"","enter-active-class":"animated fadeIn"}},[t("q-table",{staticClass:"my-sticky-header-column-table shadow-24",attrs:{data:e.table_list,"row-key":"id",separator:e.separator,loading:e.loading,columns:e.columns,"hide-bottom":"",pagination:e.pagination,"no-data-label":"No data","no-results-label":"No data you want","table-style":{height:e.height},flat:"",bordered:""},on:{"update:pagination":function(t){e.pagination=t}},scopedSlots:e._u([{key:"header-cell",fn:function(a){return[t("q-th",{attrs:{props:a},on:{dblclick:function(t){return e.handleHeaderDblClick(a.col)}}},[["operation_level","operation_result","module_name"].includes(a.col.name)?[t("q-select",{staticStyle:{"min-width":"120px"},attrs:{dense:"",outlined:"",options:e.getFilterOptions(a.col.name),"option-label":"label","option-value":"value","emit-value":"","map-options":"",clearable:""},on:{input:e.handleFilterChange},scopedSlots:e._u([{key:"prepend",fn:function(){return[t("span",{staticClass:"text-caption"},[e._v(e._s(a.col.label))])]},proxy:!0}],null,!0),model:{value:e.filterModels[a.col.name],callback:function(t){e.$set(e.filterModels,a.col.name,t)},expression:"filterModels[props.col.name]"}})]:[e._v("\n "+e._s(a.col.label)+"\n ")]],2)]}},{key:"top",fn:function(){return[t("q-btn-group",{attrs:{push:""}},[t("q-btn",{attrs:{label:e.$t("refresh"),icon:"refresh"},on:{click:function(t){return e.reFresh()}}},[t("q-tooltip",{attrs:{"content-class":"bg-amber text-black shadow-4",offset:[10,10],"content-style":"font-size: 12px"}},[e._v(e._s(e.$t("refreshtip")))])],1)],1),t("q-space"),t("div",{staticClass:"flex items-center"},[t("div",{staticClass:"q-mr-md"},[e._v(e._s(e.$t("download_center.createTime")))]),t("q-input",{attrs:{readonly:"",outlined:"",dense:"",placeholder:e.interval},scopedSlots:e._u([{key:"append",fn:function(){return[t("q-icon",{staticClass:"cursor-pointer",attrs:{name:"event"}},[t("q-popup-proxy",{ref:"qDateProxy",attrs:{"transition-show":"scale","transition-hide":"scale"}},[t("q-date",{attrs:{range:""},model:{value:e.createDate1,callback:function(t){e.createDate1=t},expression:"createDate1"}},[t("div",{staticClass:"row items-center justify-end q-gutter-sm"},[t("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{label:e.$t("index.cancel"),color:"primary",flat:""}}),t("q-btn",{directives:[{name:"close-popup",rawName:"v-close-popup"}],attrs:{label:e.$t("index.clear"),color:"primary"},on:{click:function(t){e.createDate2="",e.createDate1=""}}})],1)])],1)],1)]},proxy:!0}]),model:{value:e.createDate2,callback:function(t){e.createDate2=t},expression:"createDate2"}}),t("q-btn-group",{staticClass:"q-ml-md",attrs:{push:""}}),t("q-input",{attrs:{outlined:"",rounded:"",dense:"",debounce:"300",color:"primary",placeholder:e.$t("search")},on:{input:function(t){return e.getSearchList()},keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.getSearchList()}},scopedSlots:e._u([{key:"append",fn:function(){return[t("q-icon",{attrs:{name:"search"},on:{click:function(t){return e.getSearchList()}}})]},proxy:!0}]),model:{value:e.filter,callback:function(t){e.filter=t},expression:"filter"}})],1)]},proxy:!0},{key:"body",fn:function(a){return[t("q-tr",{class:e.getRowClass(a.row),attrs:{props:a}},e._l(e.columns,(function(n){return t("q-td",{key:n.name,class:e.getCellClass(n.name,a.row),attrs:{props:a}},["operation_level"===n.name?[t("q-badge",{staticClass:"q-pa-sm",attrs:{color:e.getLevelColor(a.row.operation_level),label:a.row.operation_level_display||a.row.operation_level}})]:"operation_result"===n.name?[t("q-badge",{staticClass:"q-pa-sm",attrs:{color:"success"===a.row.operation_result?"green":"red",label:a.row.operation_result_display||("success"===a.row.operation_result?"成功":"失败")}})]:[e._v("\n "+e._s(n.field?a.row[n.field]:a.row[n.name])+"\n ")]],2)})),1)]}}])})],1),[t("div",{directives:[{name:"show",rawName:"v-show",value:0!==e.max,expression:"max !== 0"}],staticClass:"q-pa-lg flex flex-center"},[t("div",[e._v(e._s(e.total))]),t("q-pagination",{attrs:{color:"black",max:e.max,"max-pages":6,"boundary-links":""},on:{click:function(t){e.getSearchList(e.current),e.paginationIpt=e.current}},model:{value:e.current,callback:function(t){e.current=t},expression:"current"}}),t("div",[t("input",{directives:[{name:"model",rawName:"v-model",value:e.paginationIpt,expression:"paginationIpt"}],staticStyle:{width:"60px","text-align":"center"},domProps:{value:e.paginationIpt},on:{blur:e.changePageEnter,keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.changePageEnter.apply(null,arguments)},input:function(t){t.target.composing||(e.paginationIpt=t.target.value)}}})])],1),t("div",{directives:[{name:"show",rawName:"v-show",value:0===e.max,expression:"max === 0"}],staticClass:"q-pa-lg flex flex-center"},[t("q-btn",{attrs:{flat:"",push:"",color:"dark",label:e.$t("no_data")}})],1)]],2)},l=[],i=(a("ddb0"),a("9861"),a("a79d"),a("5319"),a("3004")),r=(a("af87"),a("bd4c")),o=a("18d6"),s={name:"OperationLog",data(){return{createDate1:"",createDate2:"",date_range:"",openid:"",login_name:"",authin:"0",pathname:"operation_log/",pathname_previous:"",pathname_next:"",separator:"cell",loading:!1,height:"",table_list:[],columns:[{name:"id",label:"ID",align:"center",field:"id",sortable:!0},{name:"operator",label:"操作者",align:"center",field:"operator",sortable:!0},{name:"operation_content",label:"操作内容",align:"center",field:"operation_content",sortable:!0},{name:"operation_level",label:"操作级别",align:"center",field:"operation_level",sortable:!0},{name:"operation_result",label:"操作结果",align:"center",field:"operation_result",sortable:!0},{name:"module_name",label:"模块名称",align:"center",field:"module_name",sortable:!0},{name:"ip_address",label:"IP地址",align:"center",field:"ip_address"},{name:"request_method",label:"请求方法",align:"center",field:"request_method"},{name:"operation_time",label:"操作时间",align:"center",field:"operation_time",sortable:!0}],filter:"",pagination:{page:1,rowsPerPage:11},current:1,max:0,total:0,paginationIpt:1,filterModels:{operation_level:null,operation_result:null,module_name:null},filterdata:{},activeSearchField:"",activeSearchLabel:""}},computed:{interval(){return this.$t("download_center.start")+" - "+this.$t("download_center.end")}},methods:{getLevelColor(e){const t={view:"blue",update:"orange",new:"green",delete:"red",download:"purple",login:"teal",logout:"grey",other:"brown"};return t[e]||"grey"},getRowClass(e){const t=e.operation_level,a={view:"bg-blue-1",update:"bg-orange-1",new:"bg-green-1",delete:"bg-red-1",download:"bg-purple-1",login:"bg-teal-1",logout:"bg-grey-1",other:"bg-brown-1"};return a[t]||""},getCellClass(e,t){return""},handleFilterChange(){this.pagination.page=1,this.getSearchList(1)},getFilterOptions(e){switch(e){case"operation_level":return[{label:"查看",value:"view"},{label:"更新",value:"update"},{label:"新增",value:"new"},{label:"删除",value:"delete"},{label:"下载",value:"download"},{label:"登录",value:"login"},{label:"登出",value:"logout"},{label:"其他",value:"other"}];case"operation_result":return[{label:"成功",value:"success"},{label:"失败",value:"failure"}];case"module_name":return[{label:"入库管理",value:"bound"},{label:"容器管理",value:"container"},{label:"仓库管理",value:"warehouse"},{label:"库存管理",value:"stock"},{label:"员工管理",value:"staff"},{label:"库位管理",value:"bin"}];default:return[]}},handleHeaderDblClick(e){["detail","action"].includes(e.name)||(this.activeSearchField=e.field,this.activeSearchLabel=e.label,this.$q.dialog({title:`搜索${e.label}`,message:`请输入${e.label}的搜索条件`,prompt:{model:"",type:"text"},cancel:!0,persistent:!0}).onOk((t=>{this.executeColumnSearch(e.field,t)})).onCancel((()=>{this.activeSearchField="",this.activeSearchLabel=""})))},executeColumnSearch(e,t){if("operation_level"===e||"operation_result"===e||"request_method"===e){const a={[e]:t};this.filter="",this.date_range="",this.getList({...a,page:1}),this.activeSearchField="",this.activeSearchLabel=""}else{const a={[e+"__icontains"]:t};this.filter="",this.date_range="",this.getList({...a,page:1}),this.filterdata=a,this.$q.notify({message:`已搜索 ${this.activeSearchLabel} 含有 "${t}" 的结果`,icon:"search",color:"positive"}),this.activeSearchField="",this.activeSearchLabel=""}},getList(e={}){var t=this;t.loading=!0;const a={page:t.current,page_size:t.pagination.rowsPerPage},n=new URLSearchParams({...a,...e});Array.from(n.entries()).forEach((([e,t])=>{""!==t&&null!==t&&void 0!==t||n.delete(e)})),Object(i["e"])(`${t.pathname}?${n}`).then((e=>{t.table_list=e.results,t.total=e.count,t.max=Math.ceil(e.count/t.pagination.rowsPerPage)||0,t.pathname_previous=e.previous,t.pathname_next=e.next})).catch((e=>{t.$q.notify({message:e.detail||e.message||"获取操作日志失败",icon:"close",color:"negative"})})).finally((()=>{t.loading=!1}))},changePageEnter(){Number(this.paginationIpt)<1?(this.current=1,this.paginationIpt=1):Number(this.paginationIpt)>this.max?(this.current=this.max,this.paginationIpt=this.max):this.current=Number(this.paginationIpt),this.getSearchList(this.current)},getSearchList(e=1){this.current=e,this.paginationIpt=e;const t={};for(const[n,l]of Object.entries(this.filterModels))null!==l&&""!==l&&(t[n]=l);const a={};this.filter&&(a.operation_content__icontains=this.filter),this.date_range&&(a.operation_time__range=this.date_range),this.getList({...a,...t,...this.filterdata})},getListPrevious(){var e=this;o["a"].has("auth")&&Object(i["e"])(e.pathname_previous,{}).then((t=>{e.table_list=t.results,e.pathname_previous=t.previous,e.pathname_next=t.next})).catch((t=>{e.$q.notify({message:t.detail||t.message||"获取数据失败",icon:"close",color:"negative"})}))},getListNext(){var e=this;o["a"].has("auth")&&Object(i["e"])(e.pathname_next,{}).then((t=>{e.table_list=t.results,e.pathname_previous=t.previous,e.pathname_next=t.next})).catch((t=>{e.$q.notify({message:t.detail||t.message||"获取数据失败",icon:"close",color:"negative"})}))},reFresh(){var e=this;this.filterdata={},this.filterModels={operation_level:null,operation_result:null,module_name:null},this.filter="",this.createDate1="",this.createDate2="",this.date_range="",e.getSearchList()}},created(){var e=this;if(o["a"].has("openid")?e.openid=o["a"].getItem("openid"):(e.openid="",o["a"].set("openid","")),o["a"].has("login_name")?e.login_name=o["a"].getItem("login_name"):(e.login_name="",o["a"].set("login_name","")),o["a"].has("auth")){const t=Date.now(),a=r["b"].formatDate(t,"YYYY/MM/DD");e.date=a,e.authin="1",e.getList()}else e.authin="0"},mounted(){var e=this;e.$q.platform.is.electron?e.height=String(e.$q.screen.height-290)+"px":e.height=e.$q.screen.height-290+"px"},updated(){},destroyed(){},watch:{createDate1(e){e?(e.to?(this.createDate2=`${e.from} - ${e.to}`,this.date_range=`${e.from},${e.to} `):(this.createDate2=`${e}`,this.dateArray=e.split("/"),this.searchUrl=this.pathname+"?operation_time__year="+this.dateArray[0]+"&operation_time__month="+this.dateArray[1]+"&operation_time__day="+this.dateArray[2]),this.date_range=this.date_range.replace(/\//g,"-"),this.getSearchList(),this.$refs.qDateProxy.hide()):(this.createDate2="",this.date_range="",this.getSearchList())}}},c=s,p=(a("0dcf"),a("42e1")),u=a("3c83"),d=a("eaac"),h=a("357e"),g=a("ddd8"),m=a("e7a9"),b=a("9c40"),f=a("05c0"),_=a("2c91"),v=a("27f9"),y=a("0016"),x=a("7cbe"),w=a("52ee"),q=a("bd08"),k=a("db86"),S=a("58a81"),$=a("3b16"),C=a("7f67"),L=a("eebe"),D=a.n(L),I=Object(p["a"])(c,n,l,!1,null,"87d5eb70",null);"function"===typeof u["default"]&&Object(u["default"])(I);t["default"]=I.exports;D()(I,"components",{QTable:d["a"],QTh:h["a"],QSelect:g["a"],QBtnGroup:m["a"],QBtn:b["a"],QTooltip:f["a"],QSpace:_["a"],QInput:v["a"],QIcon:y["a"],QPopupProxy:x["a"],QDate:w["a"],QTr:q["a"],QTd:k["a"],QBadge:S["a"],QPagination:$["a"]}),D()(I,"directives",{ClosePopup:C["a"]})},"0dcf":function(e,t,a){"use strict";a("9e23")},"3c83":function(e,t,a){"use strict";var n=a("5cd3"),l=a.n(n);t["default"]=l.a},"5cd3":function(e,t){},"9e23":function(e,t,a){}}]);