mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
2 lines
4.2 KiB
JavaScript
2 lines
4.2 KiB
JavaScript
|
|
"use strict";(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[454],{3454:function(e,t,i){i.r(t),i.d(t,{default:function(){return h}});var n=function(){var e=this,t=e._self._c;return t("div",{staticClass:"pageBox"},[t("el-card",[t("div",{staticClass:"opaBox"},[t("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:e.handleAdd}},[e._v("新增品类")])],1),t("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:e.tableData,border:"","row-key":"id","tree-props":{children:"children",hasChildren:"hasChildren"}}},[t("el-table-column",{attrs:{prop:"name",label:"商品种类"}}),t("el-table-column",{attrs:{prop:"",label:"操作"},scopedSlots:e._u([{key:"default",fn:function(i){return[1==i.row.level?t("el-button",{attrs:{icon:"el-icon-plus"},on:{click:function(t){return e.addSubType(i.row)}}},[e._v("新增品种")]):e._e(),t("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.handleEdit(i.row.id,i.row)}}},[e._v("编辑")]),t("el-button",{attrs:{type:"danger"},on:{click:function(t){return e.handleDel(i.row.id)}}},[e._v("删除")])]}}])})],1)],1),t("el-dialog",{attrs:{title:e.curInfo.id?"编辑":"pinLei"==e.openType?"新增品类":"新增品种",visible:e.dialogVisible,width:"500px"},on:{"update:visible":function(t){e.dialogVisible=t}}},[t("el-form",{attrs:{"label-width":"100px"}},["pinZhong"==e.openType?t("el-form-item",{attrs:{label:"品类:"}},[t("el-select",{attrs:{disabled:""},model:{value:e.curInfo.parent_id,callback:function(t){e.$set(e.curInfo,"parent_id",t)},expression:"curInfo.parent_id"}},e._l(e.tableData,(function(e){return t("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})})),1)],1):e._e(),t("el-form-item",{attrs:{label:"pinZhong"==e.openType?"品种名称:":"品类名称:"}},[t("el-input",{staticStyle:{width:"300px"},attrs:{clearable:""},model:{value:e.curInfo.name,callback:function(t){e.$set(e.curInfo,"name",t)},expression:"curInfo.name"}})],1)],1),t("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),t("el-button",{attrs:{type:"primary",loading:e.btnLoading},on:{click:e.commitType}},[e._v("确 定")])],1)],1)],1)},a=[],o=i(2346),s=i(4301),l=i.n(s),r={components:{Treeselect:l()},data(){return{loading:!0,btnLoading:!1,tableData:[],dialogVisible:!1,curInfo:{parent_id:null,name:"",show:1,id:0},defaultProps:{value:"id",label:"name",children:"children"},treeList:[],openType:""}},mounted(){this.getGoods_types()},methods:{handleAdd(){this.curInfo={id:0,parent_id:null,name:"",show:1},this.openType="pinLei",this.dialogVisible=!0},addSubType(e){this.curInfo={id:0,parent_id:e.id,name:"",show:1},this.openType="pinZhong",this.dialogVisible=!0},handleEdit(e,t){this.id=e,this.curInfo=JSON.parse(JSON.stringify(t)),this.openType="edit",t.parent_id?(this.openType="pinZhong",(0,o.io)(t.parent_id).then((e=>{this.dialogVisible=!0}))):(this.curInfo.parent_id=null,this.dialogVisible=!0)},commitType(){this.btnLoading=!0;let e={...this.curInfo};e.parent_id=e.parent_id||0,this.curInfo.id?(0,o.yH)(this.curInfo.id,e).then((e=>{this.btnLoading=!1,this.$message({type:"success",message:"编辑成功"}),this.getGoods_types(),this.dialogVisible=!1})).catch((()=>{this.btnLoading=!1})):(0,o.At)(e).then((e=>{this.btnLoading=!1,this.$message({type:"success",message:"添加成功"}),this.getGoods_types(),this.dialogVisible=!1})).catch((()=>{this.btnLoading=!1}))},handleDel(e){this.$confirm("确定删除此条商品种类吗?","确认删除",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((()=>{(0,o.ER)(e).then((e=>{this.$message({type:"success",message:"删除成功!"}),this.getGoods_types()}))}))},getGoods_types(){let e={parent_id:0};(0,o.Ci)(e).then((e=>{this.tableData=e.data.data,this.treeList=JSON.parse(JSON.stringify(e.data.data).replace(/name/g,"label")),console.log(this.treeList)})),this.loading=!1},handleNodeClick(e){this.curInfo.parent_name=e.name,this.curInfo.parent_id=e.id},changeSel
|
||
|
|
//# sourceMappingURL=454.4e7d9fc6.js.map
|