1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-3fb6f168"],{"270a":function(t,e,a){},"775b":function(t,e,a){"use strict";a.r(e);var r=a("2f62"),o=a("c4c8"),n=a("d708");function s(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,r)}return a}function i(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?s(a,!0).forEach((function(e){l(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):s(a).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function l(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var c={name:"specsAdd",data:function(){var t=this;return{roterPre:n.a.roterPre,grid:{xl:7,lg:7,md:12,sm:24,xs:24},formValidate:{id:0,name:"",sort:0,specs:[]},ruleValidate:{name:[{required:!0,message:"请输入参数模板名称",trigger:"blur"}]},columns:[{title:"参数名称",key:"name",width:150,render:function(e,a){return e("div",[e("Input",{props:{value:a.row.name,placeholder:"请输入参数名称"},on:{"on-change":function(e){a.row.name=e.target.value,t.data[a.index].name=e.target.value}}})])}},{title:"参数值",key:"value",width:300,render:function(e,a){return e("div",[e("Input",{props:{value:a.row.value,placeholder:"请输入参数值"},on:{"on-change":function(e){a.row.value=e.target.value,t.data[a.index].value=e.target.value}}})])}},{title:"排序",key:"sort",width:100,render:function(e,a){return e("div",[e("InputNumber",{props:{value:parseInt(a.row.sort)||0,placeholder:"排序",precision:0},on:{"on-change":function(e){a.row.sort=e,t.data[a.index].sort=e}}})])}},{title:"操作",slot:"action",minWidth:120}],data:[]}},computed:i({},Object(r.e)("admin/layout",["isMobile","menuCollapse"]),{labelWidth:function(){return this.isMobile?void 0:120},labelPosition:function(){return this.isMobile?"top":"right"}}),created:function(){this.add(),this.getInfo()},mounted:function(){this.setCopyrightShow({value:!1})},destroyed:function(){this.setCopyrightShow({value:!0})},methods:i({},Object(r.d)("admin/layout",["setCopyrightShow"]),{getInfo:function(){var t=this;Object(o.ab)(this.$route.params.id).then((function(e){t.formValidate=e.data,t.data=e.data.specs}))},del:function(t){this.data.splice(t,1)},add:function(){this.data.push({name:"",value:"",sort:0})},handleSubmit:function(t){var e=this;this.$refs[t].validate((function(t){if(t){e.formValidate.id=e.$route.params.id,e.formValidate.specs=e.data;for(var a=0;a<e.formValidate.specs.length;a++){var r=e.formValidate.specs[a];if(!r.name.trim())return e.$Message.error("请输入参数名称");if(!r.value.trim())return e.$Message.error("请输入参数值")}Object(o.Z)(e.formValidate).then((function(t){e.$Message.success(t.msg),e.$router.push({path:e.roterPre+"/product/specs"})})).catch((function(t){e.$Message.error(t.msg)}))}else e.$Message.error("请输入参数模板名称")}))}})},u=(a("b8b2"),a("2877")),d=Object(u.a)(c,(function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"form-submit"},[a("div",{staticClass:"i-layout-page-header"},[a("PageHeader",{staticClass:"product_tabs",attrs:{"hidden-breadcrumb":""}},[a("div",{attrs:{slot:"title"},slot:"title"},[a("router-link",{attrs:{to:{path:t.roterPre+"/product/specs"}}},[a("div",{staticClass:"font-sm after-line"},[a("span",{staticClass:"iconfont iconfanhui"}),a("span",{staticClass:"pl10"},[t._v("返回")])])]),a("span",{staticClass:"mr20 ml16",domProps:{textContent:t._s("0"!==t.$route.params.id?"编辑商品参数模板":"添加商品参数模板")}})],1)])],1),a("Card",{staticClass:"ivu-mt",attrs:{bordered:!1,"dis-hover":""}},[a("Form",{ref:"formValidate",staticClass:"formValidate mt20",attrs:{rules:t.ruleValidate,model:t.formValidate,"label-width":t.labelWidth,"label-position":t.labelPosition},nativeOn:{submit:function(t){t.preventDefault()}}},[a("Row",{attrs:{gutter:24,type:"flex"}},[a("Col",{attrs:{span:"24"}},[a("FormItem",{attrs:{label:"参数模板名称:",prop:"name"}},[a("Input",{directives:[{name:"width",rawName:"v-width",value:"400",expression:"'400'"}],attrs:{placeholder:"请输入参数模板名称"},model:{value:t.formValidate.name,callback:function(e){t.$set(t.formValidate,"name",e)},expression:"formValidate.name"}})],1)],1),a("Col",{attrs:{span:"24"}},[a("FormItem",{attrs:{label:"排序:",props:""}},[a("InputNumber",{directives:[{name:"width",rawName:"v-width",value:"200",expression:"'200'"}],attrs:{placeholder:"排序","element-id":"sort",min:1,precision:0},model:{value:t.formValidate.sort,callback:function(e){t.$set(t.formValidate,"sort",e)},expression:"formValidate.sort"}})],1)],1),a("Col",{attrs:{span:"24"}},[a("FormItem",{attrs:{label:"",props:""}},[a("Table",{ref:"table",staticClass:"table",attrs:{border:"",columns:t.columns,data:t.data,width:"700"},scopedSlots:t._u([{key:"action",fn:function(e){e.row;var r=e.index;return[r>0?a("a",{on:{click:function(e){return t.del(r)}}},[t._v("删除")]):t._e()]}}])}),a("Button",{staticClass:"mt20",on:{click:t.add}},[t._v("添加参数")])],1)],1)],1)],1)],1),a("Card",{staticClass:"fixed-card",style:{left:t.menuCollapse?t.isMobile?"0":"80px":"200px"},attrs:{bordered:!1,"dis-hover":""}},[a("Form",[a("FormItem",[a("Button",{staticClass:"submission",attrs:{type:"primary"},on:{click:function(e){return t.handleSubmit("formValidate")}}},[t._v("保存")])],1)],1)],1)],1)}),[],!1,null,"5122af35",null);e.default=d.exports},b8b2:function(t,e,a){"use strict";var r=a("270a");a.n(r).a}}]);
|