(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2ef23c62"],{1896:function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("el-button",{attrs:{type:"primary"},on:{click:t.addProductText}},[t._v("新增")]),a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],ref:"productTextTable",attrs:{data:t.productTextData,border:"",stripe:""},on:{select:t.handleSelect,"select-all":t.handleSelect}},[a("el-table-column",{attrs:{type:"selection",width:"55"}}),a("el-table-column",{attrs:{label:"添加日期",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(e.row.pub_date))])]}}])}),a("el-table-column",{attrs:{label:"文本类别",width:"120"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(e.row.p_type))])]}}])}),a("el-table-column",{attrs:{label:"产品类别",width:"200"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",[t._v(t._s(e.row.p_property))])]}}])}),a("el-table-column",{attrs:{label:"内容",width:"600"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-input",{attrs:{type:"textarea",autosize:""},model:{value:e.row.p_content,callback:function(a){t.$set(e.row,"p_content",a)},expression:"scope.row.p_content"}})]}}])}),a("el-table-column",{attrs:{label:"操作",fixed:"right",width:"120",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[0!==e.row.is_edit?a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return t.handleChange(e.row)}}},[t._v("修改 ")]):t._e(),a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(a){return t.handleDel(e.$index,e.row)}}},[t._v("删除 ")])]}}])})],1),a("pagi-nation",{attrs:{getDataTotal:t.dataTotal},on:{pagination:t.pagination}}),t.ProductTextSelectedShow?a("el-button",{attrs:{type:"primary"},on:{click:t.ProductTextSelected}},[t._v("确 定")]):t._e(),a("el-dialog",{attrs:{visible:t.dialogVisible},on:{"update:visible":function(e){t.dialogVisible=e}}},[a("product-text-form",{attrs:{productTextData:t.productTextDataRow,buttonNumber:t.buttonNumber}})],1)],1)},r=[],o=(a("a434"),a("4c79")),i=a("d2c0"),c=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-form",{attrs:{model:t.productTextData,"label-width":"80px"}},[a("el-form-item",{attrs:{label:"文本类别"}},[a("el-select",{attrs:{clearable:""},model:{value:t.productTextData.p_type,callback:function(e){t.$set(t.productTextData,"p_type",e)},expression:"productTextData.p_type"}},t._l(t.options,(function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value}})})),1)],1),a("el-form-item",{attrs:{label:"产品类别"}},[a("el-select",{attrs:{filterable:"",placeholder:"请选择"},on:{"visible-change":t.selectTest},model:{value:t.productTextData.p_property,callback:function(e){t.$set(t.productTextData,"p_property",e)},expression:"productTextData.p_property"}},t._l(t.productTypeData,(function(t){return a("el-option",{key:t.id,attrs:{label:t.parent_category.category+"-"+t.category,value:t.parent_category.category+"-"+t.category}})})),1)],1),a("el-form-item",{attrs:{label:"内容"}},[a("el-input",{attrs:{type:"textarea",autosize:""},model:{value:t.productTextData.p_content,callback:function(e){t.$set(t.productTextData,"p_content",e)},expression:"productTextData.p_content"}})],1),a("el-form-item",[1===t.buttonNumber?a("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.handleSave}},[t._v("创建")]):t._e(),2===t.buttonNumber?a("el-button",{attrs:{type:"primary",size:"mini"},on:{click:t.handleUpdate}},[t._v("保存")]):t._e()],1)],1)},u=[],l=(a("a9e3"),{name:"productTextForm",props:{productTextData:{type:Object,default:null},buttonNumber:Number},data:function(){return{options:[{value:"description",label:"description"},{value:"custom",label:"custom"},{value:"prompt",label:"prompt"},{value:"others",label:"others"}],productTypeData:[]}},methods:{selectTest:function(t){var e=this;!0===t&&Object(o["a"])().then((function(t){e.productTypeData=t.data.results}))},handleSave:function(){var t=this;Object(o["h"])(this.productTextData).then((function(e){t.$message.success({message:"添加成功"})})).catch((function(e){t.$message.error({message:"添加失败"})}))},handleUpdate:function(){var t=this;this.productTextData.hasOwnProperty("id")&&Object(o["e"])(this.productTextData.id,this.productTextData).then((function(e){t.$message.success({message:"修改成功"})})).catch((function(e){t.$message.error({message:"修改失败"})}))}}}),s=l,p=a("2877"),d=Object(p["a"])(s,c,u,!1,null,"479574c6",null),f=d.exports,h={name:"productTextTable",components:{ProductTextForm:f,pagiNation:i["a"]},props:{ProductTextSelectedShow:{type:Boolean,default:!1}},data:function(){return{productTextData:[],productTextDataRow:{},productText:{is_edit:0,pub_date:"",p_type:"",p_content:""},options:[{value:"description",label:"description"},{value:"custom",label:"custom"},{value:"prompt",label:"prompt"},{value:"others",label:"others"}],dataTotal:0,loading:!0,productTypeData:[],selected:[],dialogVisible:!1,buttonNumber:0}},mounted:function(){this.pagination()},methods:{pagination:function(t){var e=this;t||(t={page:1,page_size:10}),Object(o["b"])(t).then((function(t){e.productTextData=t.data.results,e.loading=!1,e.dataTotal=t.data.count}))},addProductText:function(){this.productTextDataRow={},this.buttonNumber=1,this.dialogVisible=!0},handleChange:function(t){this.productTextDataRow=t,this.buttonNumber=2,this.dialogVisible=!0},handleDel:function(t,e){this.productTextData.splice(t,1)},handleSelect:function(t){this.selected=t},ProductTextSelected:function(){this.$emit("ProductTextSelected",this.selected),this.removeSelected()},removeSelected:function(){this.$refs.productTextTable.clearSelection()}}},b=h,m=Object(p["a"])(b,n,r,!1,null,"fd263e3e",null);e["a"]=m.exports},"4c79":function(t,e,a){"use strict";a.d(e,"c",(function(){return i})),a.d(e,"i",(function(){return c})),a.d(e,"a",(function(){return u})),a.d(e,"g",(function(){return l})),a.d(e,"d",(function(){return s})),a.d(e,"j",(function(){return p})),a.d(e,"f",(function(){return d})),a.d(e,"b",(function(){return f})),a.d(e,"h",(function(){return h})),a.d(e,"e",(function(){return b}));var n=a("6128"),r=a("4328"),o=a.n(r);a("2b0e");Object.prototype.hasOwnProperty;function i(t){return Object(n["a"])({url:"product_type/",params:t})}function c(t){return Object(n["a"])({url:"product_type/",method:"post",data:o.a.stringify(t)})}function u(t){return Object(n["a"])({url:"product_sub_type/",params:t})}function l(t){return Object(n["a"])({url:"product_sub_type/",method:"post",data:o.a.stringify(t)})}function s(t){return Object(n["a"])({url:"products/",params:t})}function p(t){return Object(n["a"])({url:"products/",method:"post",data:o.a.stringify(t)})}function d(t,e){return Object(n["a"])({url:"products/".concat(t,"/"),method:"patch",data:o.a.stringify(e)})}function f(t){return Object(n["a"])({url:"product_text/",params:t})}function h(t){return Object(n["a"])({url:"product_text/",method:"post",data:o.a.stringify(t)})}function b(t,e){return Object(n["a"])({url:"product_text/".concat(t,"/"),method:"patch",data:o.a.stringify(e)})}},"525a":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("product-text-table")},r=[],o=a("1896"),i={name:"index",components:{ProductTextTable:o["a"]}},c=i,u=a("2877"),l=Object(u["a"])(c,n,r,!1,null,"3a20a441",null);e["default"]=l.exports},a434:function(t,e,a){"use strict";var n=a("23e7"),r=a("23cb"),o=a("a691"),i=a("50c4"),c=a("7b0b"),u=a("65f0"),l=a("8418"),s=a("1dde"),p=a("ae40"),d=s("splice"),f=p("splice",{ACCESSORS:!0,0:0,1:2}),h=Math.max,b=Math.min,m=9007199254740991,g="Maximum allowed length exceeded";n({target:"Array",proto:!0,forced:!d||!f},{splice:function(t,e){var a,n,s,p,d,f,_=c(this),x=i(_.length),y=r(t,x),v=arguments.length;if(0===v?a=n=0:1===v?(a=0,n=x-y):(a=v-2,n=b(h(o(e),0),x-y)),x+a-n>m)throw TypeError(g);for(s=u(_,n),p=0;p<n;p++)d=y+p,d in _&&l(s,p,_[d]);if(s.length=n,a<n){for(p=y;p<x-n;p++)d=p+n,f=p+a,d in _?_[f]=_[d]:delete _[f];for(p=x;p>x-n+a;p--)delete _[p-1]}else if(a>n)for(p=x-n;p>y;p--)d=p+n-1,f=p+a-1,d in _?_[f]=_[d]:delete _[f];for(p=0;p<a;p++)_[p+y]=arguments[p+2];return _.length=x-n+a,s}})},d2c0:function(t,e,a){"use strict";var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("el-pagination",{attrs:{"current-page":t.currentPage,"page-sizes":[10,50,100,200],"page-size":t.page_size,layout:"total, sizes, prev, pager, next, jumper",total:t.getDataTotal},on:{"size-change":t.handleSizeChange,"current-change":t.handleCurrentChange,"prev-click":t.handleprevious,"next-click":t.handlenext}})],1)},r=[],o=(a("a9e3"),{name:"pagiNation",data:function(){return{page_size:10,currentPage:1}},props:{getDataTotal:{type:Number,default:0}},methods:{handleSizeChange:function(t){this.$emit("pagination",{page:1,page_size:t})},handleCurrentChange:function(t){this.$emit("pagination",{page:t,page_size:this.page_size})},handleprevious:function(t){this.$emit("pagination",{page:t,page_size:this.page_size})},handlenext:function(t){this.$emit("pagination",{page:t,page_size:this.page_size})}}}),i=o,c=a("2877"),u=Object(c["a"])(i,n,r,!1,null,"212aea47",null);e["a"]=u.exports}}]);