Portal/potal_admin/up-portal-admin-1.0.1/js/chunk-65bf9c1f.848ec0c6.js

1 line
7.3 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-65bf9c1f"],{"0bb5":function(e,t,a){"use strict";a("84d3")},"67f5":function(e,t,a){"use strict";a.r(t);var s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("el-card",{directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],attrs:{shadow:"never"}},[a("el-form",{ref:"searchForm",attrs:{model:e.searchForm,inline:""}},[a("el-form-item",[a("el-col",{attrs:{span:6}},[a("div",[e._v("关键字:")])]),a("el-col",{attrs:{span:18}},[a("el-input",{attrs:{clearable:""},model:{value:e.searchForm.key,callback:function(t){e.$set(e.searchForm,"key",t)},expression:"searchForm.key"}})],1)],1),a("el-form-item",{staticStyle:{"margin-left":"50px"}},[a("el-col",{attrs:{span:6}},[a("div",[e._v("状态:")])]),a("el-col",{attrs:{span:18}},[a("el-dropdown",{on:{command:e.handleCommand}},[a("el-input",{model:{value:e.searchForm.status,callback:function(t){e.$set(e.searchForm,"status",t)},expression:"searchForm.status"}}),a("el-dropdown-menu",{attrs:{slot:"dropdown"},slot:"dropdown"},[a("el-dropdown-item",{attrs:{command:"a"}},[e._v("所有")]),a("el-dropdown-item",{attrs:{command:"b"}},[e._v("启用")]),a("el-dropdown-item",{attrs:{command:"c"}},[e._v("禁用")])],1)],1)],1)],1),a("el-form-item",{staticStyle:{"margin-left":"50px"}},[a("el-button",{attrs:{type:"primary"},on:{click:e.getImgs}},[e._v("搜索")]),a("el-button",{on:{click:e.resData}},[e._v("重置")])],1)],1)],1),a("el-card",{attrs:{shadow:"never"}},[a("div",{staticClass:"head"},[a("div",[a("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(t){e.dialogVisible=!0}}},[a("i",{staticClass:"el-icon-plus el-icon--left"}),e._v("\n 新增\n ")]),a("el-button",{attrs:{type:"danger",size:"small",disabled:e.removeDisabled},on:{click:e.removeImgs}},[a("i",{staticClass:"el-icon-close el-icon--left"}),e._v("\n 删除\n ")])],1),a("el-dialog",{attrs:{title:"上传附件",visible:e.dialogVisible,width:"40%","show-close":!1,"close-on-click-modal":!1}},[a("div",{staticStyle:{"text-align":"center"}},[a("el-upload",{staticClass:"upload-demo",attrs:{drag:"",action:"",accept:"image/jpeg,image/gif,image/png","http-request":e.addFormData,multiple:"",limit:1}},[a("i",{staticClass:"el-icon-upload"}),a("div",{staticClass:"el-upload__text"},[e._v("\n 将文件拖到此处,或\n "),a("em",[e._v("点击上传")])])]),a("el-checkbox-group",{staticStyle:{"margin-top":"20px"},attrs:{size:"mini"},model:{value:this.upImg.status,callback:function(t){e.$set(this.upImg,"status",t)},expression:"this.upImg.status"}},[a("el-checkbox-button",[e._v("是否启用")])],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),a("el-button",{attrs:{type:"primary"},on:{click:function(t){e.dialogVisible=!1,e.addEle()}}},[e._v("\n 提交\n ")])],1)]),a("div",[a("el-button-group",[a("el-tooltip",{attrs:{content:(e.showSearch?"隐藏":"显示")+"搜索",placement:"top",enterable:!1}},[a("el-button",{attrs:{icon:"el-icon-search",size:"small"},on:{click:function(t){e.showSearch=!e.showSearch}}})],1),a("el-tooltip",{attrs:{content:"刷新",placement:"top",enterable:!1}},[a("el-button",{attrs:{icon:"el-icon-refresh",size:"small"},on:{click:e.getImgs}})],1),a("el-tooltip",{attrs:{content:"列",placement:"top",enterable:!1}},[a("el-popover",{attrs:{width:"150"}},[a("el-checkbox-group",{model:{value:e.tableHeader,callback:function(t){e.tableHeader=t},expression:"tableHeader"}},[a("el-checkbox",{attrs:{label:"链接",checked:"",disabled:""}}),a("el-checkbox",{attrs:{label:"状态",checked:"",disabled:""}}),a("el-checkbox",{attrs:{label:"缩略图",checked:""}})],1),a("el-button",{attrs:{slot:"reference",icon:"el-icon-s-grid",size:"small"},slot:"reference"})],1)],1)],1)],1)],1)]),a("el-card",[a("div",[a("el-table",{staticStyle:{width:"100%"},attrs:{data:e.imgsAll},on:{"selection-change":e.handleSelect}},[a("el-table-column",{attrs:{type:"selection"}}),e.tableHeader.includes("链接")?a("el-table-column",{attrs:{prop:"url",label:"链接",width:"600"}}):e._e(),e.tableHeader.includes("缩略图")?a("el-table-column",{attrs:{label:"缩略图"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-image",{staticStyle:{width:"100px",height:"40px"},attrs:{src:e.imgsAll[t.$index].url,fit:"contain","preview-src-list":[e.imgsAll[t.$index].url]}})]}}],null,!1,479719888)}):e._e(),e.tableHeader.includes("状态")?a("el-table-column",{attrs:{label:"状态"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("el-switch",{on:{change:e.handleSwitchChange},model:{value:e.imgsAll[t.$index].status,callback:function(a){e.$set(e.imgsAll[t.$index],"status",a)},expression:"imgsAll[scope.$index].status"}})]}}],null,!1,2154148205)}):e._e()],1)],1),a("el-pagination",{attrs:{"current-page":e.searchForm.currentPage,"page-sizes":[5,10,20],"page-size":e.searchForm.pageSize,layout:"total, sizes, prev, pager, next, jumper",total:e.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1)],1)},l=[],n={data:function(){return{dialogVisible:!1,removeDisabled:!0,tableHeader:[],selection:[],showSearch:!0,searchForm:{key:"",status:"所有",currentPage:1,pageSize:10},upImg:{url:"",status:!1},upImgStatus:!1,upImgFile:{},imgsAll:[],total:0}},methods:{getImgs:function(){var e=this;this.$http({url:"/portal/images/read",params:this.searchForm,methods:"get"}).then((function(t){e.imgsAll=t.data.data,e.total=e.imgsAll.length}))},addFormData:function(e){this.upImgFile=e.file},addEle:function(){var e=this,t=new FormData;t.append("file",this.upImgFile),t.append("status",this.upImgStatus),console.log(t),this.$http.post("/portal/images/addImg",t).then((function(t){e.upImg.url=t.data.data,e.$message({type:"success",message:"上传成功"}),e.getImgs()}))},removeImgs:function(){var e=this;this.$confirm("此操作将永久删除该文件, 是否继续?","提示",{showCancelButton:!0,confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){for(var t=[],a=e.selection.length-1;a>=0;a--){var s=e.imgsAll.indexOf(e.selection[a]);e.imgsAll.splice(s,1),t.push(e.selection[a].url)}e.total-=t.length,e.$http.post("/portal/images/removeImgs",t).then((function(t){e.$message({type:"success",message:"删除成功"})}))})).catch((function(){e.$message({type:"info",message:"已取消删除"})}))},handleCommand:function(e){this.searchForm.status="a"===e?"所有":"b"===e?"启用":"禁用"},handleSelect:function(e){this.removeDisabled=0===e.length,this.selection=e},handleSwitchChange:function(){var e=this;this.$confirm("此操作将禁用该文件, 是否继续?","提示",{showCancelButton:!0,confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){e.$http.post("/portal/images/write",e.imgsAll).then((function(){e.$message({type:"success",message:"操作成功"})}))})).catch((function(){e.$message({type:"info",message:"已取消"}),e.getImgs()}))},handleSizeChange:function(e){this.searchForm.pageSize=e,this.getImgs()},handleCurrentChange:function(e){this.searchForm.currentPage=e,this.getImgs()},resData:function(){this.searchForm={key:"",status:"所有",currentPage:1,pageSize:10},this.getImgs()}},created:function(){this.getImgs()}},o=n,i=(a("0bb5"),a("2877")),c=Object(i["a"])(o,s,l,!1,null,"7b7ad508",null);t["default"]=c.exports},"84d3":function(e,t,a){}}]);