| 1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-35f03697"],{"37cd":function(e,t,r){},8014:function(e,t,r){"use strict";r.r(t);var a=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"app-list-content"},[r("x-crud",{staticClass:"liu-crud-wrap",on:{load:e.onLoad},scopedSlots:e._u([{key:"slot-tabs",fn:function(){return[r("el-tabs",{staticClass:"liu-tabs",attrs:{type:"border-card"},on:{"tab-click":e.tabClick},model:{value:e.tabIndex,callback:function(t){e.tabIndex=t},expression:"tabIndex"}},e._l(e.tabsData,(function(e,t){return r("el-tab-pane",{key:t,attrs:{label:e.text,name:e.key}})})),1)]},proxy:!0},{key:"table-column-cover",fn:function(e){var t=e.scope;return[r("cl-avatar",{style:{margin:"auto"},attrs:{shape:"square",size:32,src:t.row.cover}})]}},{key:"table-column-goodsName",fn:function(t){var a=t.scope;return[r("span",[e._v(e._s(a.row.goodsName))])]}},{key:"table-column-unit",fn:function(t){var a=t.scope;return[0==a.row.ratioType?r("span",[e._v(e._s(a.row.ratio)+e._s(a.row.smallUnit)+"/"+e._s(a.row.bigUnit))]):r("span",[e._v("若干"+e._s(a.row.smallUnit)+"/"+e._s(a.row.bigUnit))])]}},{key:"table-column-inTurn",fn:function(t){var a=t.scope;return[e.sort.status?r("el-input",{ref:"sort-input",attrs:{focus:"",size:"mini"},on:{blur:function(t){return e.changeSort(a.row)}},model:{value:a.row.inTurn,callback:function(t){e.$set(a.row,"inTurn",t)},expression:"scope.row.inTurn"}}):r("span",[e._v(e._s(a.row.inTurn))])]}},{key:"slot-modify",fn:function(t){var a=t.scope;return[r("el-button",{attrs:{type:"text"},nativeOn:{click:function(t){return t.stopPropagation(),e.replaceBtnFn(a.row.id)}}},[e._v("修改")])]}},{key:"table-header-inTurn",fn:function(){return[r("div",{staticClass:"set-sort"},[r("span",[e._v("排序")]),e.sort.status?r("el-button",{staticClass:"hide",attrs:{size:"mini",type:"primary"},on:{click:e.hideSort}},[e._v("完成")]):r("el-button",{staticClass:"show",attrs:{icon:"el-icon-edit-outline",size:"small",type:"text"},on:{click:e.showSort}})],1)]},proxy:!0},{key:"slot-add-goods-btn",fn:function(){return[r("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(t){return e.replaceBtnFn(0)}}},[e._v("添加")])]},proxy:!0}])}),r("el-dialog",{attrs:{title:(0==e.currentItemId?"添加":"修改")+"花材",visible:e.addDialog,"close-on-click-modal":!1,width:"600px"},on:{"update:visible":function(t){e.addDialog=t}}},[r("div",{staticClass:"ad-modal-content"},[r("el-form",{ref:"replaceForm",staticClass:"demo-form",attrs:{model:e.replaceForm,rules:e.replaceFormRules,"label-width":"100px"}},[r("el-form-item",{attrs:{label:"名称",prop:"name"}},[r("el-input",{attrs:{placeholder:"请输入名称",size:"small"},model:{value:e.replaceForm.name,callback:function(t){e.$set(e.replaceForm,"name",t)},expression:"replaceForm.name"}})],1),r("el-form-item",{attrs:{label:"拼音缩写",prop:"py"}},[r("el-input",{attrs:{placeholder:"拼音缩写",size:"small"},model:{value:e.replaceForm.py,callback:function(t){e.$set(e.replaceForm,"py",t)},expression:"replaceForm.py"}})],1),r("el-form-item",{attrs:{label:"图片",prop:"cover"}},[r("cl-upload",{attrs:{success:e.uploadSuccess},model:{value:e.replaceForm.cover,callback:function(t){e.$set(e.replaceForm,"cover",t)},expression:"replaceForm.cover"}}),r("p",{staticStyle:{"font-size":"14px",color:"#cccccc"}},[e._v("建议上传图片比例 400X400")])],1),r("el-form-item",{attrs:{label:"分类",prop:"classId"}},[r("el-select",{attrs:{size:"small",placeholder:"请选择分类"},on:{change:e.selClassFn},model:{value:e.replaceForm.className,callback:function(t){e.$set(e.replaceForm,"className",t)},expression:"replaceForm.className"}},e._l(e.itemClassList,(function(t,a){return r("el-option",{key:a,attrs:{value:t.name}},[e._v(e._s(t.name))])})),1)],1),r("el-form-item",{attrs:{label:"大单位",prop:"bigUnitId"}},[r("el-select",{attrs:{size:"small",placeholder:"请选择单位"},on:{change:e.selBigUnitFn},model:{value:e.replaceForm.bigUnit,callback:function(t){e.$set(e.replaceForm,"bigUnit",t)},expression:"replaceForm.bigUnit"}},e._l(e.unitList,(function(t,a){return r("el-option",{key:a,attrs:{value:t.name}},[e._v(e._s(t.name))])})),1)],1),r("el-form-item",{attrs:{label:"小单位",prop:"smallUnitId"}},[r("el-select",{attrs:{size:"small",placeholder:"请选择单位"},on:{change:e.selSmallUnitFn},model:{value:e.replaceForm.smallUnit,callback:function(t){e.$set(e.replaceForm,"smallUnit",t)},expression:"replaceForm.smallUnit"}},e._l(e.unitList,(function(t,a){return r("el-option",{key:a,attrs:{value:t.name}},[e._v(e._s(t.name))])})),1)],1),r("el-form-item",{attrs:{label:"单位比类型",prop:"ratioType"}},[r("el-select",{attrs:{size:"small",placeholder:"请选择单位"},on:{change:e.changeRatioTypeFn},model:{value:e.replaceForm.ratioTypeName,callback:function(t){e.$set(e.replaceForm,"ratioTypeName",t)},expression:"replaceForm.ratioTypeName"}},e._l(e.ratioTypeList,(function(t,a){return r("el-option",{key:a,attrs:{value:t.name}},[e._v(e._s(t.name))])})),1)],1),r("el-form-item",{attrs:{label:"单位比",prop:"ratio"}},[r("el-input",{attrs:{placeholder:"1扎=20支,请输入20",size:"small"},model:{value:e.replaceForm.ratio,callback:function(t){e.$set(e.replaceForm,"ratio",t)},expression:"replaceForm.ratio"}})],1),r("el-form-item",{attrs:{label:"库存预警",prop:"stockWarning"}},[r("el-input",{attrs:{placeholder:"请输入数值",size:"small"},model:{value:e.replaceForm.stockWarning,callback:function(t){e.$set(e.replaceForm,"stockWarning",t)},expression:"replaceForm.stockWarning"}})],1),r("el-form-item",{attrs:{label:"每扎重量",prop:"weight"}},[r("el-input",{attrs:{placeholder:"请输入斤数",size:"small"},model:{value:e.replaceForm.weight,callback:function(t){e.$set(e.replaceForm,"weight",t)},expression:"replaceForm.weight"}})],1),r("el-form-item",{attrs:{label:"排序",prop:"inTurn"}},[r("el-input",{attrs:{placeholder:"请输入数值",size:"small"},model:{value:e.replaceForm.inTurn,callback:function(t){e.$set(e.replaceForm,"inTurn",t)},expression:"replaceForm.inTurn"}})],1)],1)],1),r("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{attrs:{size:"small"},on:{click:e.resetForm}},[e._v("取 消")]),r("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.replaceConfirmFn}},[e._v("确认")])],1)])],1)},i=[],s=r("6abc"),n=r("60b5"),l=(r("6a61"),r("47b8"),r("1d43"),r("5880"),{name:"item_list",components:{},data:function(){return{app:null,sortLink:"",operateData:{},tabIndex:"0",tabsData:[{text:"花材列表",key:"0"}],selects:{},sort:{status:!1},classId:0,addDialog:!1,replaceForm:{name:"",py:"",classId:"",className:"",cover:"",bigUnitId:"",bigUnit:"",smallUnitId:"",smallUnit:"",stockWarning:"",weight:"",inTurn:100,ratio:"",ratioType:0,ratioTypeName:""},replaceFormRules:{name:{required:!0,message:"名称不能为空"},cover:{required:!0,message:"图片不能为空"},classId:{required:!0,message:"请选择分类"},bigUnitId:{required:!0,message:"请选择大单位"},smallUnitId:{required:!0,message:"请选择小单位"},ratio:{required:!0,message:"比例不能为空"},stockWarning:{required:!0,message:"最低库存不能为空"},weight:{required:!0,message:"重量不能为空"},inTurn:{required:!0,message:"排序不能为空"}},itemClassList:[],unitList:[],ratioTypeList:[{name:"固定比例",id:0},{name:"模糊比例",id:1}],currentItemId:0}},computed:{},methods:{selClassFn:function(e){var t=this.itemClassList.findIndex((function(t){return t.name==e}));this.replaceForm.classId=this.itemClassList[t].id},selBigUnitFn:function(e){var t=this.unitList.findIndex((function(t){return t.name==e}));this.replaceForm.bigUnitId=this.unitList[t].id},changeRatioTypeFn:function(e){console.log(e);var t=this.ratioTypeList.findIndex((function(t){return t.name==e}));this.replaceForm.ratioType=this.ratioTypeList[t].id},selSmallUnitFn:function(e){var t=this.unitList.findIndex((function(t){return t.name==e}));this.replaceForm.smallUnitId=this.unitList[t].id},getAllClass:function(){var e=this;if(!this.$util.isEmpty(this.itemClassList))return this.itemClassList;this.$service.itemClass.getAllClass().then((function(t){e.itemClassList=t.list}))},getAllUnit:function(){var e=this;if(!this.$util.isEmpty(this.unitList))return this.unitList;this.$service.unit.getAllUnit().then((function(t){e.unitList=t.list}))},uploadSuccess:function(){this.$refs["replaceForm"].validateField("cover")},replaceBtnFn:function(e){var t=this;this.getAllClass(),this.getAllUnit(),this.addDialog=!0,this.currentItemId=e,0==e?(this.replaceFormRules={},this.replaceForm={name:"",classId:"",cover:"",bigUnitId:"",bigUnit:"",smallUnitId:"",smallUnit:"",stockWarning:"",className:"",weight:"",inTurn:100,ratio:"",ratioType:0,py:""}):this.$service.item.getDetail({id:e}).then(function(){var e=Object(n["a"])(regeneratorRuntime.mark((function e(r){var a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.replaceFormRules={name:{required:!0,message:"名称不能为空"},cover:{required:!0,message:"图片不能为空"},classId:{required:!0,message:"请选择分类"},bigUnitId:{required:!0,message:"请选择大单位"},smallUnitId:{required:!0,message:"请选择小单位"},ratio:{required:!0,message:"比例不能为空"},stockWarning:{required:!0,message:"最低库存不能为空"},weight:{required:!0,message:"重量不能为空"},inTurn:{required:!0,message:"排序不能为空"}},a=t.itemClassList.findIndex((function(e){return e.id==r.classId})),t.replaceForm.name=r.name,t.replaceForm.cover=r.cover,t.replaceForm.bigUnitId=r.bigUnitId,t.replaceForm.bigUnit=r.bigUnit,t.replaceForm.smallUnitId=r.smallUnitId,t.replaceForm.smallUnit=r.smallUnit,t.replaceForm.stockWarning=r.stockWarning,t.replaceForm.weight=r.weight,t.replaceForm.inTurn=r.inTurn,t.replaceForm.ratio=r.ratio,t.replaceForm.ratioType=r.ratioType,0==r.ratioType?t.replaceForm.ratioTypeName="固定比例":t.replaceForm.ratioTypeName="模糊比例",t.replaceForm.classId=r.classId,t.replaceForm.py=r.py,t.replaceForm.className=t.itemClassList[a].name,t.$forceUpdate();case 18:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())},tabClick:function(e,t){this.app.refresh({classId:this.classId})},onLoad:function(e){var t=e.ctx,r=e.app;this.app=r,this.$route.query.classId&&(this.classId=this.$route.query.classId,""!=this.$route.query.name&&(this.tabsData[0].text=this.$route.query.tabName,this.$forceUpdate())),t.service(this.$service.item).set("table",{columns:[{prop:"id",label:"ID",align:"center"},{prop:"cover",label:"封面",align:"center","min-width":100},{prop:"name",label:"名称",align:"center","min-width":180},{prop:"className",label:"分类",align:"center","min-width":100},{prop:"stockWarning",label:"库存预警值",align:"center","min-width":100},{prop:"weight",label:"重量(公斤)",align:"center","min-width":100},{prop:"unit",label:"单位",align:"center",minWidth:100},{prop:"inTurn",label:"排序",align:"center",minWidth:100},{prop:"addTime",label:"创建时间",align:"center",minWidth:180}],op:{visible:!0,props:{width:250,align:"center",fixed:"right",label:"操作"},layout:["slot-modify"]}}).set("dict",{search:{keyWord:"name"}}).set("search",{key:{placeholder:"请填写名称,支持拼音字母"}}).set("pagination",{size:50}).set("layout",[["slot-tabs"],["search-key"],["flex1","refresh-btn"],["data-table"],["flex1","pagination"]]).done(),r.refresh({classId:this.classId})},refresh:function(e){this.app.refresh(e)},showSort:function(e){this.sort.status=!0},hideSort:function(e){this.sort.status=!1},changeSort:function(e){var t=this;this.$service.goods.sort({inTurn:e.inTurn,id:e.id}).then((function(){t.$message.success("修改成功"),t.refresh()})).catch((function(e){t.$message.error(e)}))},resetForm:function(){this.goodsData={},this.$refs["replaceForm"].resetFields(),this.addDialog=!1},replaceConfirmFn:function(){var e=this;this.$refs.replaceForm.validate((function(t){if(t){var r=JSON.parse(JSON.stringify(e.replaceForm)),a=null;a=0==e.currentItemId?function(){return e.$service.item.itemAdd(r)}:function(){return e.$service.item.update(Object(s["a"])({id:e.currentItemId},r))},a().then((function(t){e.$message.success("操作成功!"),e.resetForm(),e.app.refresh({classId:e.classId})}))}}))}}}),o=l,c=(r("cb52"),r("5d22")),m=Object(c["a"])(o,a,i,!1,null,"9b4fd31c",null);t["default"]=m.exports},cb52:function(e,t,r){"use strict";r("37cd")}}]);
|