ludc
2025-01-16 5203081b68e3a8dc139d1807b2f8774e4a00a82a
1
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-13a4f1de","chunk-2d0e6678","chunk-2d0e6678","chunk-2d0e6678","chunk-2d0e6678"],{"325c":function(e,t,a){"use strict";a.r(t);a("7f7f");var i=function(){var e=this,t=e._self._c;return t("el-container",[t("el-main",[t("basic-container",[t("avue-crud",{ref:"userCrud",attrs:{data:e.tableData,option:e.option,"table-loading":e.tableLoading},on:{"on-load":e.getTableList,"refresh-change":e.handleRefresh,"search-change":e.handleSearch,"search-reset":e.handleReset,"selection-change":e.selectChange,"row-click":e.rowClickHandler},scopedSlots:e._u([{key:"menuLeft",fn:function(a){return[e.permissionList.addBtn?t("el-button",{attrs:{icon:"el-icon-plus",plain:"",size:"small",type:"primary"},on:{click:e.rowSaveHandlerClick}},[e._v("创建\n          ")]):e._e(),e.permissionList.delBtn?t("el-button",{attrs:{icon:"el-icon-delete",plain:"",size:"small",type:"danger"},on:{click:e.allDelHandler}},[e._v("删除\n          ")]):e._e(),e.permissionList.viewTheScopeBtn?t("el-button",{attrs:{icon:"el-icon-view",plain:"",size:"small",type:"primary"},on:{click:e.chekView}},[e._v("查看使用范围\n          ")]):e._e(),e.permissionList.downloadImportTemplateBtn?t("el-button",{attrs:{icon:"el-icon-download",plain:"",size:"small",type:"primary"},on:{click:e.downloadTemplateHandler}},[e._v("下载导入模板\n          ")]):e._e(),e.permissionList.importBtn?t("el-button",{attrs:{icon:"el-icon-upload2",plain:"",size:"small",type:"primary"},on:{click:e.uploadUser}},[e._v("导入\n          ")]):e._e(),e.permissionList.exportBtn?t("el-button",{attrs:{icon:"el-icon-download",plain:"",size:"small",type:"primary"},on:{click:e.downloadHandler}},[e._v("导出\n          ")]):e._e()]}},{key:"menu",fn:function(a){return[e.permissionList.editBtn?t("el-button",{attrs:{icon:"el-icon-edit",size:"small",type:"text"},on:{click:function(t){return e.editBtnClick(a.row)}}},[e._v("编辑\n          ")]):e._e(),e.permissionList.delBtn?t("el-button",{attrs:{icon:"el-icon-delete",size:"small",type:"text"},on:{click:function(t){return e.rowDeleteHandler(a.row)}}},[e._v("删除\n          ")]):e._e()]}}])}),t("el-dialog",{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"},{name:"loading",rawName:"v-loading",value:e.dialogLoading,expression:"dialogLoading"}],staticClass:"avue-dialog",attrs:{title:"add"===e.dialogType?" 创建":"编辑",visible:e.dialogVisible,"append-to-body":"true",width:"1000px"},on:{"update:visible":function(t){e.dialogVisible=t},close:e.dialogClose}},[t("el-form",{ref:"form",attrs:{model:e.form,rules:e.rules,"label-width":"100px",size:"small"}},[t("el-row",[t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"枚举名称:",prop:"id"}},[t("el-input",{model:{value:e.form.id,callback:function(t){e.$set(e.form,"id",t)},expression:"form.id"}})],1)],1),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"标签:"}},[t("el-input",{model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1)],1),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"类型:"}},[t("el-select",{staticStyle:{width:"376px"},attrs:{placeholder:"请选择类型"},model:{value:e.form.enumValueDataType,callback:function(t){e.$set(e.form,"enumValueDataType",t)},expression:"form.enumValueDataType"}},[t("el-option",{attrs:{label:"String",value:"String"}}),t("el-option",{attrs:{label:"Integer",value:"Integer"}})],1)],1)],1),t("el-col",{attrs:{span:12}},[t("el-form-item",{attrs:{label:"长度:"}},[t("el-input-number",{staticStyle:{width:"376px"},attrs:{max:999,min:1,label:"描述文字"},model:{value:e.form.length,callback:function(t){e.$set(e.form,"length",t)},expression:"form.length"}})],1)],1),t("el-col",{attrs:{span:24}},[t("avue-crud",{ref:"dialogCrud",attrs:{data:e.dialogData,option:e.dialogOption},on:{"row-save":e.rowSaveDialogHandler,"row-update":e.rowUpdateDialogHandler,"row-del":e.rowDeleteDialogHandler}})],1)],1)],1),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{attrs:{type:"primary"},on:{click:e.rowSaveHandler}},[e._v("确 定")]),t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")])],1)],1),t("el-dialog",{directives:[{name:"dialogDrag",rawName:"v-dialogDrag"},{name:"loading",rawName:"v-loading",value:e.checkViewLoading,expression:"checkViewLoading"}],staticClass:"avue-dialog",attrs:{visible:e.checkViewVisible,"append-to-body":"true",title:"查看使用范围",width:"60%"},on:{"update:visible":function(t){e.checkViewVisible=t}}},[t("avue-crud",{ref:"checkViewCrud",attrs:{data:e.checkViewData,option:e.checkViewOption},on:{"search-change":e.checkHandleSearch,"search-reset":e.checkHandleReset}})],1),t("upload-file",{ref:"upload",attrs:{fileType:e.upFileType,fileUrl:e.fileUrl,tipList:e.tipList,title:"导入"},on:{updata:e.getTableList}})],1)],1),t("el-aside",{attrs:{width:"35%"}},[t("basic-container",[t("el-descriptions",{staticStyle:{"margin-bottom":"20px"},attrs:{column:1,labelStyle:{width:"150px"},border:"",size:"medium",title:"枚举信息"}},[t("el-descriptions-item",[t("template",{slot:"label"},[e._v("\n            名称\n          ")]),e._v("\n          "+e._s(this.lastItem.id)+"\n        ")],2),t("el-descriptions-item",[t("template",{slot:"label"},[e._v("\n            标签\n          ")]),e._v("\n          "+e._s(this.lastItem.name)+"\n        ")],2),t("el-descriptions-item",[t("template",{slot:"label"},[e._v("\n            类型\n          ")]),e._v("\n          "+e._s(this.lastItem.enumValueDataType||"String")+"\n        ")],2),t("el-descriptions-item",[t("template",{slot:"label"},[e._v("\n            长度\n          ")]),t("el-tag",[e._v(" "+e._s(this.lastItem.length||50))])],2)],1),t("p",{staticStyle:{"font-weight":"bold"}},[e._v("枚举项")]),t("avue-crud",{attrs:{data:e.asideData,option:e.asideOption}})],1)],1)],1)},n=[],s=(a("8e6e"),a("ac6a"),a("456d"),a("6762"),a("2fdb"),a("c5f6"),a("7cdf"),a("ade3")),l=a("9935"),o=a("e63b"),r=a("d9a3"),c=a("5880");a("9095");function d(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function u(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?d(Object(a),!0).forEach((function(t){Object(s["a"])(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):d(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var h={name:"index",data:function(){return{asideOption:u(u({},l["a"]),{},{addBtn:!1,editBtn:!1,menu:!1,refreshBtn:!1,selection:!1,index:!1,header:!1,calcHeight:-40,column:[{label:"枚举项名称",prop:"name",sortable:!0},{label:"枚举值",prop:"value",sortable:!0},{label:"描述",prop:"description"}]}),tipList:["导入模板中标明红色字体的为必输项","*注意*:第二行开始的数据为示例数据,导入前请将其删除,当导入的枚举下具备多个枚举项时,应按照示例enum2的写法","枚举项名称(当前枚举下有枚举项时必填)","枚举值(当前枚举下有枚举项时必填)","导入一个枚举下的多个枚举项时,请将枚举名、标签、返回类型、等信息填写一致,再填写不同的枚举项"],upFileType:["xls","xlsx"],fileUrl:"api/webEnumController/importEnumTypes",checkViewOption:u(u({},l["a"]),{},{addBtn:!1,menu:!1,searchMenuSpan:8,refreshBtn:!1,selection:!1,column:[{label:"名称",prop:"enumName",sortable:!0},{label:"来源",prop:"source",sortable:!0,search:!0},{label:"说明",prop:"desc"}]}),checkViewData:[],checkViewDataSearch:[],checkViewVisible:!1,checkViewLoading:!1,editRow:{},dialogType:"",dialogData:[],dialogOption:u(u({},l["a"]),{},{calcHeight:50,refreshBtn:!1,selection:!1,dialogWidth:500,column:[{label:"枚举项名",prop:"name",sortable:!0,span:24,rules:[{required:!0,message:"请输入枚举项名",trigger:"blur"}]},{label:"枚举值",prop:"value",sortable:!0,span:24,rules:[{required:!0,message:"请输入枚举值",trigger:"blur"}]},{label:"描述",prop:"description",span:24}]}),rules:{id:[{required:!0,message:"请输入枚举名称",trigger:"blur"},{validator:this.validateEnglishOnly,trigger:"blur"}]},form:{id:"",name:"",enumValueDataType:"String",length:50},dialogLoading:!1,dialogVisible:!1,tableData:[],option:u(u({},l["a"]),{},{calcHeight:-40,searchMenuSpan:8,addBtn:!1,editBtn:!1,delBtn:!1,menuWidth:160,column:[{label:"枚举名称",prop:"id",sortable:!0,search:!0},{label:"标签",prop:"name",sortable:!0},{label:"返回类型",prop:"enumValueDataTypeText",sortable:!0,width:130}]}),tableLoading:!1,selectList:[],searchParams:{},lastIndex:null}},created:function(){console.log(this.$route)},computed:u(u({},Object(c["mapGetters"])(["permission"])),{},{permissionList:function(){return{addBtn:this.vaildData(this.permission[this.$route.query.id].ADD,!1),delBtn:this.vaildData(this.permission[this.$route.query.id].DELETE,!1),editBtn:this.vaildData(this.permission[this.$route.query.id].EDIT,!1),exportBtn:this.vaildData(this.permission[this.$route.query.id].EXPORT,!1),importBtn:this.vaildData(this.permission[this.$route.query.id].IMPORT,!1),downloadImportTemplateBtn:this.vaildData(this.permission[this.$route.query.id].downloadImportTemplate,!1),viewTheScopeBtn:this.vaildData(this.permission[this.$route.query.id].viewTheScope,!1)}},lastItem:function(){return this.selectList.length>0?this.selectList[this.selectList.length-1]:{}},asideData:function(){return this.selectList.length>0?this.selectList[this.selectList.length-1].items:[]}}),methods:{getTableList:function(){var e=this;this.tableLoading=!0,Object(o["getEnumTypeList"])(this.searchParams).then((function(t){var a=t.data.data;e.tableData=a,e.tableLoading=!1})).catch((function(e){}))},handleRefresh:function(){this.getTableList()},handleSearch:function(e,t){this.searchParams={enumName:e.id},this.getTableList(),t()},handleReset:function(){this.searchParams={},this.getTableList()},selectChange:function(e){this.selectList=e},rowClickHandler:function(e){var t=this;r["a"].rowClickHandler(e,this.$refs.userCrud,this.lastIndex,(function(e){t.lastIndex=e}),(function(){t.selectList=[]}))},dialogClose:function(){this.dialogData=[],this.form={id:"",name:"",enumValueDataType:"String",length:50}},rowSaveHandlerClick:function(){this.dialogType="add",this.dialogVisible=!0,this.dialogData=[],this.form={id:"",name:"",enumValueDataType:"String",length:50}},editBtnClick:function(e){this.dialogType="edit";var t=e.id,a=e.name,i=e.length,n=e.enumValueDataType;this.form={id:t,name:a,length:i,enumValueDataType:n},this.dialogData=e.items,this.dialogVisible=!0,this.editRow=e},rowDeleteHandler:function(e){var t=this,a={oid:e.oid,name:e.id,ts:e.ts},i=[a];this.$confirm("您确定要删除当前的数据吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(o["deleteEnumTypes"])(i).then((function(e){200===e.data.code&&(t.$message.success(e.data.obj),t.getTableList())}))})).catch((function(){t.$message({type:"info",message:"已取消删除"})}))},allDelHandler:function(){var e=this,t=this.selectList.map((function(e){return{oid:e.oid,name:e.id,ts:e.ts}}));this.$confirm("您确定要删除所选择的数据吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(o["deleteEnumTypes"])(t).then((function(t){200===t.data.code&&(e.$message.success(t.data.obj),e.getTableList())}))})).catch((function(){e.$message({type:"info",message:"已取消删除"})}))},rowSaveHandler:function(){var e=this,t=this.dialogData.some((function(t){return t.value.length>e.form.length}));this.$refs.form.validate((function(a){if(!a)return!1;if(t)e.$message.error("请检查枚举值是否超过最大长度!");else{if("Integer"===e.form.enumValueDataType){var i=e.dialogData.some((function(e){if(!/^\-?\d+$/.test(e.value))return!0})),n=e.dialogData.some((function(e){var t=parseInt(e.value);if(isNaN(t)||!Number.isInteger(t))return!0}));if(i||n)return void e.$message.error("枚举值必须是Integer类型")}if("add"===e.dialogType){var s=u(u({},e.form),{},{items:e.dialogData});Object(o["addEnumType"])(s).then((function(t){200===t.data.code&&(e.$message.success(t.data.obj),e.dialogVisible=!1,e.getTableList())}))}else if("edit"===e.dialogType){var l=u(u({},e.form),{},{items:e.dialogData,oid:e.editRow.oid,ts:e.editRow.ts});Object(o["updateEnumType"])(l).then((function(t){200===t.data.code&&(e.$message.success(t.data.obj),e.dialogVisible=!1,e.getTableList())}))}}}))},rowSaveDialogHandler:function(e,t,a){var i=this.dialogData.some((function(t){return t.name===e.name}));if(i)this.$message.error("枚举项名称不能重复添加!"),a();else{if("Integer"===this.form.enumValueDataType){var n=parseInt(e.value);if(isNaN(n)||!Number.isInteger(n)||!/^\-?\d+$/.test(e.value))return this.$message.error("枚举值必须是Integer类型"),a()}if(e.value.length>this.form.num)return this.$message.error("枚举值超过最大长度!"),a();this.dialogData.push(e),t()}},rowUpdateDialogHandler:function(e,t,a,i){if("Integer"===this.form.enumValueDataType){var n=parseInt(e.value);if(isNaN(n)||!Number.isInteger(n)||!/^\-?\d+$/.test(e.value))return this.$message.error("枚举值必须是Integer类型"),i()}if(e.value.length>this.form.length)return this.$message.error("枚举值超过最大长度!"),i();this.dialogData.splice(t,1,e),a()},rowDeleteDialogHandler:function(e,t){this.dialogData.splice(t,1)},validateEnglishOnly:function(e,t,a){return t?/^[A-Za-z]+$/.test(t)?void a():a(new Error("只能输入英文字母")):a(new Error("请输入枚举项名"))},chekView:function(){var e=this;this.selectList.length<=0?this.$message.warning("请至少选择一条数据"):this.selectList.length>1?this.$message.warning("只能选择一条数据进行查看"):Object(o["getUsedEnumList"])({enumName:this.selectList[0].id}).then((function(t){200===t.data.code&&(e.checkViewVisible=!0,e.checkViewData=t.data.data,e.checkViewDataSearch=t.data.data)}))},checkHandleSearch:function(e,t){var a=e.source;if(!e.source)return this.checkViewData=this.checkViewDataSearch,t();this.checkViewData=this.checkViewData.filter((function(e){return e.source&&e.source.includes(a)})),t()},checkHandleReset:function(){this.checkViewData=this.checkViewDataSearch},downloadHandler:function(){var e=this;if(this.selectList.length<=0)this.$message.warning("请至少选择一条数据进行导出");else{var t=this.selectList.map((function(e){return e.id})).join(",");Object(o["download"])({enumNames:t}).then((function(t){r["a"].downloadFileByBlobHandler(t),e.$message.success("导出成功")})).catch((function(e){}))}},downloadTemplateHandler:function(){var e=this;Object(o["downloadEnumTemplate"])().then((function(t){r["a"].downloadFileByBlobHandler(t),e.$message.success("下载成功")})).catch((function(e){}))},uploadUser:function(){this.$refs.upload.visible=!0}}},p=h,m=a("2877"),g=Object(m["a"])(p,i,n,!1,null,"0a0600de",null);t["default"]=g.exports},9935:function(e,t,a){"use strict";t["a"]={border:!0,height:"auto",index:!0,indexFixed:!1,dialogDrag:!0,searchShow:!0,searchIcon:!0,selection:!0,selectionFixed:!1,stripe:!0,headerAlign:"center",align:"center",emptyText:"暂无内容",tip:!1}}}]);