pages-material-warn-config-add-edit.fc9defec.js
11.8 KB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-material-warn-config-add-edit"],{5114:function(e,t,n){"use strict";var i;n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return i}));var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("v-uni-view",[n("v-uni-view",{staticClass:"content-top"},[n("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[n("v-uni-view",{staticClass:"title require u-f1"},[e._v("预警类型")]),n("v-uni-view",{staticClass:"inp u-f2"},[n("v-uni-picker",{attrs:{value:e.typeIndex,"range-key":"remark",range:e.alarmTypeArr},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.typePickerChange.apply(void 0,arguments)}}},[n("v-uni-view",{staticClass:"u-f u-f-jce u-f-aic"},[n("v-uni-view",{staticClass:"uni-input"},[-1==e.typeIndex?n("v-uni-text",{staticClass:"placeholder-color"},[e._v("请选择")]):n("v-uni-text",[e._v(e._s(e.alarmTypeArr[e.typeIndex].remark))])],1)],1)],1)],1)],1),n("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[n("v-uni-view",{staticClass:"title require u-f1"},[e._v("仓库")]),n("v-uni-view",{staticClass:"inp u-f3"},[n("v-uni-picker",{attrs:{value:e.wareIndex,"range-key":"name",range:e.warehouseArr},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.warePickerChange.apply(void 0,arguments)}}},[n("v-uni-view",{staticClass:"u-f u-f-jce u-f-aic"},[n("v-uni-view",{staticClass:"uni-input"},[-1==e.wareIndex?n("v-uni-text",{staticClass:"placeholder-color"},[e._v("请选择")]):n("v-uni-text",[e._v(e._s(e.warehouseArr[e.wareIndex].name))])],1)],1)],1)],1)],1),n("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[n("v-uni-view",{staticClass:"title require u-f1"},[e._v("货主")]),n("v-uni-view",{staticClass:"inp u-f3"},[n("v-uni-picker",{attrs:{value:e.companyIndex,"range-key":"name",range:e.companyArr},on:{change:function(t){arguments[0]=t=e.$handleEvent(t),e.companyPickerChange.apply(void 0,arguments)}}},[n("v-uni-view",{staticClass:"u-f u-f-jce u-f-aic"},[n("v-uni-view",{staticClass:"uni-input"},[-1==e.companyIndex?n("v-uni-text",{staticClass:"placeholder-color"},[e._v("请选择")]):n("v-uni-text",[e._v(e._s(e.companyArr[e.companyIndex].name))])],1)],1)],1)],1)],1),n("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[n("v-uni-view",{staticClass:"title require u-f1"},[e._v("物料编码")]),n("v-uni-view",{staticClass:"inp u-f3"},[n("v-uni-input",{attrs:{disabled:0!=e.flag,placeholder:"请输入"},model:{value:e.form.materialCode,callback:function(t){e.$set(e.form,"materialCode",t)},expression:"form.materialCode"}})],1)],1),n("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[n("v-uni-view",{staticClass:"title require u-f1"},[e._v("最大")]),n("v-uni-view",{staticClass:"inp u-f3"},[n("v-uni-input",{attrs:{onkeypress:"javascript:if(event.keyCode == 32)event.returnValue = false;",placeholder:"请输入"},model:{value:e.form.max,callback:function(t){e.$set(e.form,"max",t)},expression:"form.max"}})],1)],1),n("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[n("v-uni-view",{staticClass:"title require u-f1"},[e._v("最小")]),n("v-uni-view",{staticClass:"inp u-f3"},[n("v-uni-input",{attrs:{onkeypress:"javascript:if(event.keyCode == 32)event.returnValue = false;",placeholder:"请输入"},model:{value:e.form.min,callback:function(t){e.$set(e.form,"min",t)},expression:"form.min"}})],1)],1),n("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[n("v-uni-view",{staticClass:"title require u-f1"},[e._v("上限预警值")]),n("v-uni-view",{staticClass:"inp u-f3"},[n("v-uni-input",{attrs:{onkeypress:"javascript:if(event.keyCode == 32)event.returnValue = false;",placeholder:"请输入"},model:{value:e.form.upper,callback:function(t){e.$set(e.form,"upper",t)},expression:"form.upper"}})],1)],1),n("v-uni-view",{staticClass:"content-item u-f u-f-aic plr-10"},[n("v-uni-view",{staticClass:"title require u-f1"},[e._v("下限预警值")]),n("v-uni-view",{staticClass:"inp u-f2"},[n("v-uni-input",{attrs:{onkeypress:"javascript:if(event.keyCode == 32)event.returnValue = false;",placeholder:"请输入"},model:{value:e.form.lower,callback:function(t){e.$set(e.form,"lower",t)},expression:"form.lower"}})],1)],1)],1),n("v-uni-view",{staticClass:"footer u-f u-f-aic"},[n("v-uni-button",{staticClass:"btn",attrs:{loading:e.loading,type:"warn",disabled:e.disabled},on:{click:function(t){arguments[0]=t=e.$handleEvent(t),e.save()}}},[e._v("保存")])],1)],1)},o=[]},"6a97":function(e,t,n){"use strict";n.r(t);var i=n("e537"),a=n.n(i);for(var o in i)"default"!==o&&function(e){n.d(t,e,(function(){return i[e]}))}(o);t["default"]=a.a},"843c":function(e,t,n){"use strict";n.r(t);var i=n("5114"),a=n("6a97");for(var o in a)"default"!==o&&function(e){n.d(t,e,(function(){return a[e]}))}(o);n("b077");var r,s=n("f0c5"),l=Object(s["a"])(a["default"],i["b"],i["c"],!1,null,"82d6f262",null,!1,i["a"],r);t["default"]=l.exports},b077:function(e,t,n){"use strict";var i=n("bebd"),a=n.n(i);a.a},bebd:function(e,t,n){var i=n("d509");"string"===typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);var a=n("4f06").default;a("2c2b1346",i,!0,{sourceMap:!1,shadowMode:!1})},d509:function(e,t,n){var i=n("24fb");t=i(!1),t.push([e.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-top[data-v-82d6f262]{background-color:#fff}.content-top .content-item[data-v-82d6f262]{height:%?90?%;line-height:%?90?%;border-bottom:%?2?% solid #e5e5e5}.content-top .content-item .title[data-v-82d6f262]{font-size:%?32?%}.content-top .content-item .inp[data-v-82d6f262]{text-align:right;font-size:%?32?%}.content-top .content-item .inp[data-v-82d6f262] uni-radio .uni-radio-input{margin-right:0}.content-top .content-item .inp .picker[data-v-82d6f262]{-webkit-box-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end}.content-top .content-item .require[data-v-82d6f262]{position:relative}.content-top .content-item .require[data-v-82d6f262]::after{position:absolute;content:"*";color:red;font-size:%?48?%;top:%?6?%;left:%?-20?%}.footer[data-v-82d6f262]{position:fixed;bottom:0;width:100%;height:%?140?%;background-color:#fff;border-top:%?2?% solid #e1f3d8}.footer .btn[data-v-82d6f262]{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}',""]),e.exports=t},e537:function(e,t,n){"use strict";n("c740"),n("498a"),Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i={data:function(){return{warehouseArr:[],companyArr:[],alarmTypeArr:[],typeIndex:-1,wareIndex:-1,companyIndex:-1,loading:!1,disabled:!1,form:{alarmType:void 0,warehouseCode:void 0,materialCode:void 0,companyCode:void 0,max:null,min:null,upper:null,lower:null},timer:null,timer2:null,type:"",index:null,page:"",flag:!1}},onLoad:function(e){var t=this;this.type=e.type,this.index=e.index,this.page=e.page,this.$api.material.listAlarmtype().then((function(e){t.alarmTypeArr=e.data.rows}));try{var n=uni.getStorageSync("historyUser").username;n&&this.$api.dict.getWarehouseByUserCode(n).then((function(e){t.warehouseArr=e.data.data}))}catch(i){}this.$api.dict.getCompaniesByToken().then((function(e){t.companyArr=e.data})),"add"==e.type?this.form={alarmType:void 0,warehouseCode:void 0,materialCode:void 0,companyCode:void 0,max:null,min:null,upper:null,lower:null}:(this.flag=!0,this.$api.material.getMaterialWarning(e.id).then((function(e){200==e.data.code&&(t.form=e.data.data,t.typeIndex=t.alarmTypeArr.findIndex((function(e,n){return e.type==t.form.alarmType})),t.wareIndex=t.warehouseArr.findIndex((function(e,n){return e.code==t.form.warehouseCode})),t.companyIndex=t.companyArr.findIndex((function(e,n){return e.code==t.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:{typePickerChange:function(e){this.typeIndex=e.target.value,this.form.alarmType=this.alarmTypeArr[this.typeIndex].type},warePickerChange:function(e){this.wareIndex=e.target.value,this.form.warehouseCode=this.warehouseArr[this.wareIndex].code},companyPickerChange:function(e){this.companyIndex=e.target.value,this.form.companyCode=this.companyArr[this.companyIndex].code},save:function(){var e=this;if(this.loading)return!1;void 0!=this.form.alarmType?void 0!=this.form.warehouseCode?void 0!=this.form.companyCode?this.form.materialCode.trim()?null!=this.form.max?/^[0-9]\d*$/.test(this.form.max)?null!=this.form.min?/^[0-9]\d*$/.test(this.form.min)?this.form.min>=this.form.max?uni.showModal({title:"提示",content:"最小不能大于或等于最大!",showCancel:!1}):null!=this.form.upper?/^[0-9]\d*$/.test(this.form.upper)?null!=this.form.lower?/^[0-9]\d*$/.test(this.form.lower)?this.form.lower>=this.form.upper?uni.showModal({title:"提示",content:"下限预警值不能大于或等于上限预警值!",showCancel:!1}):(this.loading=!0,this.disabled=!0,"add"==this.type?this.$api.material.addMaterialWarning(this.form).then((function(t){200==t.data.code?(e.loading=!1,e.disabled=!1,e.$prePage()._data.queryParams.pageNum=1,e.$prePage().getWarningList(),e.$wx.showToast({title:"保存成功!"}),e.timer=setTimeout((function(){uni.navigateBack()}),400)):(uni.showModal({title:"提示",content:t.data.msg}),e.loading=!1,e.disabled=!1)})).catch((function(t){e.loading=!1,e.disabled=!1})):this.$api.material.updateMaterialWarning(this.form).then((function(t){200==t.data.code?(e.loading=!1,e.disabled=!1,"warn-config"==e.page?e.$prePage().handleEdit(e.index,e.form):e.$prePage().getMaterialWarning(e.form.id),e.$wx.showToast({title:"保存成功!"}),e.timer2=setTimeout((function(){uni.navigateBack()}),400)):(uni.showModal({title:"提示",content:t.data.msg}),e.loading=!1,e.disabled=!1)})).catch((function(t){e.loading=!1,e.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}):uni.showModal({title:"提示",content:"最小只能正数!",showCancel:!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}):uni.showModal({title:"提示",content:"货主不能为空!",showCancel:!1}):uni.showModal({title:"提示",content:"仓库不能为空!",showCancel:!1}):uni.showModal({title:"提示",content:"预警类型不能为空!",showCancel:!1})}}};t.default=i}}]);