pages-material-add-edit.6ad04030.js
12 KB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-material-add-edit"],{"11e3":function(t,e,i){"use strict";var n;i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return o})),i.d(e,"a",(function(){return n}));var a=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("v-uni-view",[i("v-uni-view",{staticClass:"content"},[i("v-uni-view",{staticClass:"top"},[i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title require u-f1"},[t._v("物料名称")]),i("v-uni-view",{staticClass:"inp u-f3"},[i("v-uni-input",{attrs:{placeholder:"请输入"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1)],1),i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title require u-f1"},[t._v("物料编码")]),i("v-uni-view",{staticClass:"inp u-f3"},[i("v-uni-input",{attrs:{placeholder:"请输入"},model:{value:t.form.code,callback:function(e){t.$set(t.form,"code",e)},expression:"form.code"}})],1)],1),i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title require u-f1"},[t._v("物料类型")]),i("v-uni-view",{staticClass:"inp u-f3"},[i("v-uni-picker",{attrs:{value:t.typeIndex,"range-key":"name",range:t.materialTypeArr},on:{change:function(e){arguments[0]=e=t.$handleEvent(e),t.materialPickerChange.apply(void 0,arguments)}}},[i("v-uni-view",{staticClass:"u-f u-f-jce u-f-aic"},[i("v-uni-view",{staticClass:"uni-input"},[-1==t.typeIndex?i("v-uni-text",{staticClass:"placeholder-color"},[t._v("请选择")]):i("v-uni-text",[t._v(t._s(t.materialTypeArr[t.typeIndex].name))])],1)],1)],1)],1)],1),i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title require u-f1"},[t._v("货主")]),i("v-uni-view",{staticClass:"inp u-f3"},[i("v-uni-picker",{attrs:{value:t.companyIndex,"range-key":"name",range:t.companyArr},on:{change:function(e){arguments[0]=e=t.$handleEvent(e),t.companyPickerChange.apply(void 0,arguments)}}},[i("v-uni-view",{staticClass:"u-f u-f-jce u-f-aic"},[i("v-uni-view",{staticClass:"uni-input"},[-1==t.companyIndex?i("v-uni-text",{staticClass:"placeholder-color"},[t._v("请选择")]):i("v-uni-text",[t._v(t._s(t.companyArr[t.companyIndex].name))])],1)],1)],1)],1)],1),i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title u-f1"},[t._v("规格型号")]),i("v-uni-view",{staticClass:"inp u-f3"},[i("v-uni-input",{attrs:{placeholder:"请输入"},model:{value:t.form.spec,callback:function(e){t.$set(t.form,"spec",e)},expression:"form.spec"}})],1)],1),i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title u-f1"},[t._v("单位")]),i("v-uni-view",{staticClass:"inp u-f3"},[i("v-uni-input",{attrs:{placeholder:"请输入"},model:{value:t.form.unit,callback:function(e){t.$set(t.form,"unit",e)},expression:"form.unit"}})],1)],1)],1),i("v-uni-view",{staticClass:"bottom"},[i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title u-f1"},[t._v("保质期")]),i("v-uni-view",{staticClass:"inp u-f3"},[i("v-uni-input",{attrs:{placeholder:"请输入"},model:{value:t.form.daysToExpire,callback:function(e){t.$set(t.form,"daysToExpire",e)},expression:"form.daysToExpire"}})],1)],1),i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title u-f1"},[t._v("收货预警天数")]),i("v-uni-view",{staticClass:"inp u-f2"},[i("v-uni-input",{attrs:{placeholder:"请输入"},model:{value:t.form.minShelfLifeDays,callback:function(e){t.$set(t.form,"minShelfLifeDays",e)},expression:"form.minShelfLifeDays"}})],1)],1),i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title u-f1"},[t._v("记录序列号")]),i("v-uni-view",{staticClass:"inp u-f2"},[i("v-uni-input",{attrs:{placeholder:"请输入"},model:{value:t.form.trackSerialNum,callback:function(e){t.$set(t.form,"trackSerialNum",e)},expression:"form.trackSerialNum"}})],1)],1),i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title u-f1"},[t._v("自动生成序列号")]),i("v-uni-view",{staticClass:"inp u-f2 u-radio"},[0==t.form.autoGenSerialNum?i("v-uni-radio",{attrs:{checked:!1},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.genSerialClick(0)}}}):i("v-uni-radio",{attrs:{checked:!0},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.genSerialClick(1)}}})],1)],1),i("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[i("v-uni-view",{staticClass:"title u-f1"},[t._v("停用")]),i("v-uni-view",{staticClass:"inp u-f3 u-radio"},[0==t.form.enable?i("v-uni-radio",{attrs:{checked:!1},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.enableClick(0)}}}):i("v-uni-radio",{attrs:{checked:!0},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.enableClick(1)}}})],1)],1)],1)],1),i("v-uni-view",{staticClass:"footer u-f u-f-aic"},[i("v-uni-button",{staticClass:"btn",attrs:{loading:t.loading,type:"warn",disabled:t.disabled},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.save.apply(void 0,arguments)}}},[t._v("保存")])],1)],1)},o=[]},"1d35":function(t,e,i){"use strict";var n=i("5651"),a=i.n(n);a.a},5651:function(t,e,i){var n=i("7202");"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var a=i("4f06").default;a("58dfca06",n,!0,{sourceMap:!1,shadowMode:!1})},7202:function(t,e,i){var n=i("24fb");e=n(!1),e.push([t.i,'@charset "UTF-8";\r\n/**\r\n * 这里是uni-app内置的常用样式变量\r\n *\r\n * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量\r\n * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App\r\n *\r\n */\r\n/**\r\n * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能\r\n *\r\n * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\r\n */\r\n/* 颜色变量 */\r\n/* 行为相关颜色 */\r\n/* 文字基本颜色 */\r\n/* 背景颜色 */\r\n/* 边框颜色 */\r\n/* 尺寸变量 */\r\n/* 文字尺寸 */\r\n/* 图片尺寸 */\r\n/* Border Radius */\r\n/* 水平间距 */\r\n/* 垂直间距 */\r\n/* 透明度 */\r\n/* 文章场景相关 */.content[data-v-71491874]{overflow-y:auto;padding-bottom:%?100?%}.content .top[data-v-71491874],\r\n.content .bottom[data-v-71491874]{background-color:#fff}.content .top .content-item[data-v-71491874],\r\n.content .bottom .content-item[data-v-71491874]{height:%?90?%;line-height:%?90?%;border-bottom:%?2?% solid #e5e5e5}.content .top .content-item .title[data-v-71491874],\r\n.content .bottom .content-item .title[data-v-71491874]{font-size:%?32?%}.content .top .content-item .inp[data-v-71491874],\r\n.content .bottom .content-item .inp[data-v-71491874]{text-align:right;font-size:%?32?%}.content .top .content-item .inp[data-v-71491874] uni-radio .uni-radio-input,\r\n.content .bottom .content-item .inp[data-v-71491874] uni-radio .uni-radio-input{margin-right:0}.content .top .content-item .inp .picker[data-v-71491874],\r\n.content .bottom .content-item .inp .picker[data-v-71491874]{-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}.content .top .content-item .require[data-v-71491874],\r\n.content .bottom .content-item .require[data-v-71491874]{position:relative}.content .top .content-item .require[data-v-71491874]::after,\r\n.content .bottom .content-item .require[data-v-71491874]::after{position:absolute;content:"*";color:red;font-size:%?48?%;top:%?6?%;left:%?-20?%}.content .bottom[data-v-71491874]{margin-top:%?20?%}.footer[data-v-71491874]{position:fixed;bottom:0;width:100%;height:%?140?%;background-color:#fff;border-top:%?2?% solid #e1f3d8}.footer .btn[data-v-71491874]{width:100%;height:%?80?%;line-height:%?80?%;color:#fff;text-align:center;font-size:%?32?%;-webkit-border-radius:%?50?%;border-radius:%?50?%;margin:0 %?30?%;background-color:#007aff}',""]),t.exports=e},7674:function(t,e,i){"use strict";i("c740"),i("498a"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n={data:function(){return{materialTypeArr:[],companyArr:[],typeIndex:-1,companyIndex:-1,loading:!1,disabled:!1,form:{code:void 0,name:void 0,spec:void 0,unit:void 0,type:void 0,daysToExpire:void 0,minShelfLifeDays:void 0,trackSerialNum:void 0,companyCode:void 0,autoGenSerialNum:0,enable:0},timer:null,timer2:null,type:"",page:"",index:null}},onLoad:function(t){var e=this;this.page=t.page,this.index=t.index,this.getMaterialType(),this.getCompanies(),this.type=t.type,"add"==t.type?(this.form={code:"",name:"",spec:void 0,unit:void 0,type:void 0,daysToExpire:void 0,minShelfLifeDays:void 0,trackSerialNum:void 0,companyCode:void 0,autoGenSerialNum:0,enable:0},this.getMaterialCode()):this.$api.material.getCurrMaterial(t.id).then((function(t){200==t.data.code&&(e.form=t.data.data,e.typeIndex=e.materialTypeArr.findIndex((function(t,i){return t.code==e.form.type})),e.companyIndex=e.companyArr.findIndex((function(t,i){return t.code==e.form.companyCode})))}))},onReady:function(){"add"==this.type?uni.setNavigationBarTitle({title:"新增物料"}):uni.setNavigationBarTitle({title:"修改物料"})},onUnload:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer2&&(clearTimeout(this.timer2),this.timer2=null)},methods:{getMaterialCode:function(){var t=this;this.$api.material.createMaterialCode().then((function(e){t.form.code=e.data.data}))},getMaterialType:function(){var t=this;this.$api.material.getMaterialType().then((function(e){t.materialTypeArr=e.data.data}))},getCompanies:function(){var t=this;this.$api.dict.getCompaniesByToken().then((function(e){t.companyArr=e.data}))},materialPickerChange:function(t){this.typeIndex=t.target.value,this.form.type=this.materialTypeArr[this.typeIndex].code},companyPickerChange:function(t){this.companyIndex=t.target.value,this.form.companyCode=this.companyArr[this.companyIndex].code},genSerialClick:function(t){this.form.autoGenSerialNum=0==t?1:0},enableClick:function(t){this.form.enable=0==t?1:0},save:function(){var t=this;if(this.loading)return!1;this.form.name.trim()?this.form.code.trim()?void 0!=this.form.type?void 0!=this.form.companyCode?(this.loading=!0,this.disabled=!0,"add"==this.type?this.$api.material.addMaterial(this.form).then((function(e){200==e.data.code?(t.loading=!1,t.disabled=!1,t.$prePage()._data.queryParams.pageNum=1,t.$prePage().getMaterial(),t.$wx.showToast({title:"保存成功!"}),t.timer=setTimeout((function(){uni.navigateBack()}),400)):(uni.showModal({title:"提示",content:e.data.msg}),t.loading=!1,t.disabled=!1)})).catch((function(e){t.loading=!1,t.disabled=!1})):this.$api.material.updateMaterial(this.form).then((function(e){200==e.data.code?(t.loading=!1,t.disabled=!1,"material"==t.page||"select"==t.page?t.$prePage().handleEdit(t.index,t.form):t.$prePage().getMaterial(t.form.id),t.$wx.showToast({title:"保存成功!"}),t.timer2=setTimeout((function(){uni.navigateBack()}),400)):(uni.showModal({title:"提示",content:e.data.msg}),t.loading=!1,t.disabled=!1)})).catch((function(e){t.loading=!1,t.disabled=!1}))):uni.showModal({title:"提示",content:"货主不能为空!",showCancel:!1}):uni.showModal({title:"提示",content:"物料类型不能为空!",showCancel:!1}):uni.showModal({title:"提示",content:"请输入物料编码!",showCancel:!1}):uni.showModal({title:"提示",content:"请输入物料名称!",showCancel:!1})}}};e.default=n},b4a7:function(t,e,i){"use strict";i.r(e);var n=i("11e3"),a=i("e091");for(var o in a)"default"!==o&&function(t){i.d(e,t,(function(){return a[t]}))}(o);i("1d35");var r,c=i("f0c5"),s=Object(c["a"])(a["default"],n["b"],n["c"],!1,null,"71491874",null,!1,n["a"],r);e["default"]=s.exports},e091:function(t,e,i){"use strict";i.r(e);var n=i("7674"),a=i.n(n);for(var o in n)"default"!==o&&function(t){i.d(e,t,(function(){return n[t]}))}(o);e["default"]=a.a}}]);