You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
8.4 KiB
1 lines
8.4 KiB
webpackJsonp([72],{bFcC:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var a=r("mvHQ"),i=r.n(a),s=r("Xxa5"),o=r.n(s),n=r("exGp"),l=r.n(n),u=r("PJh5"),c=r.n(u),m={components:{},data:function(){return{pagePermission:[],fieldType:["姓名","手机号","其他"],requiredType:["非必填","必填"],loading:!1,storeList:[],searchForm:{page:1,limit:10},tableData:[],total:0,showDialog:!1,subForm:{id:0,title:"",field_type:1,is_required:0,top:0},subFormRules:{title:{required:!0,validator:this.$reg.isNotNull,text:"字段名称",reg_type:2,trigger:"blur"},field_type:{required:!0,type:"number",message:"请选择字段类型",trigger:"blur"},is_required:{required:!0,type:"number",message:"请选择是否必填",trigger:"blur"},top:{required:!0,type:"number",message:"请输入排序值",trigger:"blur"}}}},created:function(){var e=this;this.pagePermission=this.$route.meta.pagePermission.filter(function(t){return t.title===e.$route.name})[0].auth,this.getTableDataList()},methods:{handleSizeChange:function(e){this.searchForm.limit=e,this.handleCurrentChange(1)},handleCurrentChange:function(e){this.searchForm.page=e,this.getTableDataList()},getTableDataList:function(e){var t=this;return l()(o.a.mark(function r(){var a,i,s;return o.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return e&&(t.searchForm.page=1),t.tableData=[],t.loading=!0,r.next=5,t.$api.market.fieldList(t.searchForm);case 5:if(a=r.sent,i=a.code,s=a.data,t.loading=!1,200===i){r.next=11;break}return r.abrupt("return");case 11:t.tableData=s.data,t.total=s.total;case 13:case"end":return r.stop()}},r,t)}))()},confirmDel:function(e){var t=this;this.$confirm(this.$t("tips.confirmDelete"),this.$t("tips.reminder"),{confirmButtonText:this.$t("action.comfirm"),cancelButtonText:this.$t("action.cancel"),type:"warning"}).then(function(){t.updateItem(e,-1)})},updateItem:function(e,t){var r=this;return l()(o.a.mark(function a(){return o.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:r.$api.market.fieldUpdate({id:e,status:t}).then(function(e){if(200===e.code){if(r.$message.success(r.$t(-1===t?"tips.successDel":"tips.successOper")),-1!==t)return;r.searchForm.page=r.searchForm.page<Math.ceil((r.total-1)/r.searchForm.limit)?r.searchForm.page:Math.ceil((r.total-1)/r.searchForm.limit),r.getTableDataList()}else{if(-1===t)return;r.getTableDataList()}});case 1:case"end":return a.stop()}},a,r)}))()},toShowDialog:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{id:0,title:"",field_type:1,top:0};return l()(o.a.mark(function r(){var a;return o.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:for(a in t=JSON.parse(i()(t)),e.subForm)e.subForm[a]=t[a];e.showDialog=!e.showDialog;case 3:case"end":return r.stop()}},r,e)}))()},toAddItem:function(e,t){var r=this;return l()(o.a.mark(function a(){return o.a.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:1===e?r.subForm.select.splice(t,1):r.subForm.select.push({title:""});case 1:case"end":return a.stop()}},a,r)}))()},submitFormInfo:function(){var e=this;return l()(o.a.mark(function t(){var r,a,s,n;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=!0,e.$refs.subForm.validate(function(e){e||(r=!1)}),!r){t.next=14;break}return a=JSON.parse(i()(e.subForm)),s=a.id?"fieldUpdate":"fieldAdd",t.next=7,e.$api.market[s](a);case 7:if(n=t.sent,200===n.code){t.next=11;break}return t.abrupt("return");case 11:e.$message.success(e.$t(e.subForm.id?"tips.successRev":"tips.successSub")),e.showDialog=!1,e.getTableDataList();case 14:case"end":return t.stop()}},t,e)}))()}},filters:{handleTime:function(e,t){return 1===t?c()(1e3*e).format("YYYY-MM-DD"):2===t?c()(1e3*e).format("HH:mm:ss"):c()(1e3*e).format("YYYY-MM-DD HH:mm:ss")}}},p={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"lb-appclass-classroom-list"},[r("top-nav"),e._v(" "),r("div",{staticClass:"page-main"},[r("el-row",{staticClass:"page-top-operate"},[r("lb-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-add",expression:"`${$route.name}-add`"}],attrs:{size:"medium",type:"primary",icon:"el-icon-plus"},on:{click:e.toShowDialog}},[e._v(e._s(e.$t("menu.MarketArticleEnrollAdd")))])],1),e._v(" "),r("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:e.tableData,"header-cell-style":{background:"#f5f7fa",color:"#606266"},"tooltip-effect":"dark"}},[r("el-table-column",{attrs:{prop:"id",label:"ID"}}),e._v(" "),r("el-table-column",{attrs:{prop:"title",label:"字段名称"}}),e._v(" "),r("el-table-column",{attrs:{prop:"type",label:"字段类型"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(e.fieldType[1*t.row.field_type-1])+"\n ")]}}])}),e._v(" "),r("el-table-column",{attrs:{prop:"type",label:"是否必填"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(e.requiredType[t.row.is_required])+"\n ")]}}])}),e._v(" "),r("el-table-column",{attrs:{prop:"top",label:"排序值"}}),e._v(" "),r("el-table-column",{attrs:{prop:"status",label:"是否上架"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("el-switch",{attrs:{disabled:!e.pagePermission.includes("edit"),"active-value":1,"inactive-value":0},on:{change:function(r){return e.updateItem(t.row.id,t.row.status)}},model:{value:t.row.status,callback:function(r){e.$set(t.row,"status",r)},expression:"scope.row.status"}})]}}])}),e._v(" "),r("el-table-column",{attrs:{label:"操作","min-width":"120"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("div",{staticClass:"table-operate"},[r("lb-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-edit",expression:"`${$route.name}-edit`"}],attrs:{size:"mini",plain:"",type:"primary"},on:{click:function(r){return e.toShowDialog(t.row)}}},[e._v(e._s(e.$t("action.edit")))]),e._v(" "),r("lb-button",{directives:[{name:"hasPermi",rawName:"v-hasPermi",value:e.$route.name+"-delete",expression:"`${$route.name}-delete`"}],attrs:{size:"mini",plain:"",type:"danger"},on:{click:function(r){return e.confirmDel(t.row.id)}}},[e._v(e._s(e.$t("action.delete")))])],1)]}}])})],1),e._v(" "),r("lb-page",{attrs:{batch:!1,page:e.searchForm.page,pageSize:e.searchForm.limit,total:e.total},on:{handleSizeChange:e.handleSizeChange,handleCurrentChange:e.handleCurrentChange}}),e._v(" "),r("el-dialog",{attrs:{title:e.$t(e.subForm.id?"menu.MarketArticleEnrollEdit":"menu.MarketArticleEnrollAdd"),visible:e.showDialog,width:"500px",center:""},on:{"update:visible":function(t){e.showDialog=t}}},[r("el-form",{ref:"subForm",staticClass:"dialog-form",attrs:{model:e.subForm,rules:e.subFormRules,"label-width":"100px"}},[r("el-form-item",{attrs:{label:"字段名称",prop:"title"}},[r("el-input",{attrs:{maxlength:"10","show-word-limit":"",placeholder:"请输入字段名称"},model:{value:e.subForm.title,callback:function(t){e.$set(e.subForm,"title",t)},expression:"subForm.title"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"字段类型",prop:"field_type"}},[r("el-radio-group",{attrs:{disabled:e.subForm.id},model:{value:e.subForm.field_type,callback:function(t){e.$set(e.subForm,"field_type",t)},expression:"subForm.field_type"}},[r("el-radio",{attrs:{label:1}},[e._v("姓名")]),e._v(" "),r("el-radio",{attrs:{label:2}},[e._v("手机号")]),e._v(" "),r("el-radio",{attrs:{label:3}},[e._v("其他")])],1)],1),e._v(" "),r("el-form-item",{attrs:{label:"是否必填",prop:"is_required"}},[r("el-radio-group",{model:{value:e.subForm.is_required,callback:function(t){e.$set(e.subForm,"is_required",t)},expression:"subForm.is_required"}},[r("el-radio",{attrs:{label:0}},[e._v("非必填")]),e._v(" "),r("el-radio",{attrs:{label:1}},[e._v("必填")])],1)],1),e._v(" "),r("el-form-item",{attrs:{label:"排序值",prop:"top"}},[r("el-input-number",{staticClass:"lb-input-number",attrs:{controls:!1,precision:0,min:0,placeholder:"请输入排序值"},model:{value:e.subForm.top,callback:function(t){e.$set(e.subForm,"top",t)},expression:"subForm.top"}}),e._v(" "),r("lb-tool-tips",[e._v("值越大, 排序越靠前")])],1)],1),e._v(" "),r("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{on:{click:function(t){e.showDialog=!1}}},[e._v("取 消")]),e._v(" "),r("el-button",{directives:[{name:"preventReClick",rawName:"v-preventReClick"}],attrs:{type:"primary"},on:{click:e.submitFormInfo}},[e._v("确 定")])],1)],1)],1)],1)},staticRenderFns:[]};var d=r("VU/8")(m,p,!1,function(e){r("oip0")},"data-v-4564fbd0",null);t.default=d.exports},oip0:function(e,t){}}); |