chencc 1 rok temu
rodzic
commit
9810bf1867

+ 8 - 1
src/api/ruleManagement/earlyWarning.js

@@ -35,13 +35,20 @@ export async function listAllRulesObj(params) {
 }
 
 // 更新或保存
-export async function saveOrUpdate(data) {
+export async function rulesSave(data) {
   const res = await request.post('/main/alertrules/save', data);
   if (res.data.code == 0) {
     return res.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
+export async function rulesUpdate(data) {
+  const res = await request.put('/main/alertrules/update', data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 
 // 生成编码
 export async function getCode(code) {

+ 18 - 3
src/main.js

@@ -5,7 +5,10 @@ import App from './App.vue';
 import store from './store';
 import router from './router';
 import permission from './utils/permission';
-import { MAP_KEY, LICENSE_CODE } from '@/config/setting';
+import {
+  MAP_KEY,
+  LICENSE_CODE
+} from '@/config/setting';
 import EleAdmin from 'ele-admin';
 import VueClipboard from 'vue-clipboard2';
 import i18n from './i18n';
@@ -40,6 +43,15 @@ import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';
 import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-codes.css';
 import 'bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css';
 
+// 引入公共方法
+import {
+  handleInputPublicHasPoint,
+  handleInputPublic
+} from './utils/inputHandler';
+
+Vue.prototype.$handleInputPublicHasPoint = handleInputPublicHasPoint;
+Vue.prototype.$handleInputPublic = handleInputPublic;
+
 Vue.component('DictSelection', DictSelection);
 Vue.config.productionTip = false;
 
@@ -70,7 +82,10 @@ Vue.use(VueClipboard);
 let instance = null;
 
 function render(props = {}) {
-  const { container, routerBase } = props;
+  const {
+    container,
+    routerBase
+  } = props;
   // const router = new VueRouter({
   //   base: window.__POWERED_BY_QIANKUN__ ? routerBase : process.env.BASE_URL,
   //   mode: 'history',
@@ -97,7 +112,7 @@ export async function bootstrap() {
 export async function mount(props) {
   console.log('[vue] props from main framework', props);
   Vue.prototype.$portalStore = props.store;
-  initParentStore(props.store?.state);
+  initParentStore(props.store ?.state);
   props.onGlobalStateChange((state, prev) => {
     // state: 变更后的状态; prev 变更前的状态
     initParentStore(state);

+ 28 - 0
src/utils/inputHandler.js

@@ -0,0 +1,28 @@
+/**
+ * 处理输入值,使其只包含数字和最多一个小数点,并且小数点后最多保留两位
+ * @param {string} value - 输入的值
+ * @returns {string} - 处理后的值
+ */
+
+//小数点后两位处理
+export const handleInputPublicHasPoint = (value) => {
+  // 过滤掉非数字和小数点的字符
+  const filteredValue = value.replace(/[^0-9.]/g, '');
+  // 限制只能有一个小数点
+  const singleDotValue = filteredValue.replace(/(\..*)\./g, '$1');
+
+  let finalValue = '';
+  const dotIndex = singleDotValue.indexOf('.');
+  if (dotIndex !== -1) {
+    // 截取小数点后最多两位
+    finalValue = singleDotValue.slice(0, dotIndex + 3);
+  } else {
+    finalValue = singleDotValue;
+  }
+  return finalValue;
+};
+//整数
+export const handleInputPublic = (value) => {
+  // 只能输入数字
+  return value.replace(/[^0-9]/g, '');
+};

+ 62 - 55
src/views/material/product/components/BoatInfo.vue

@@ -1,48 +1,48 @@
 <template>
   <div class="other">
-      <el-form label-width="120px"  ref="form" :model="form">
-         <div class="divider">
-           <div class="title">
-             <div class="ele-bg-primary"></div>
-             <span>舟皿信息</span>
-           </div>
-           <div class="ele-bg-primary ele-width"></div>
-         </div>
-         <el-row :gutter="24">
-           <el-col :span="8">
-             <el-form-item label="槽数" prop="slotNum">
-                <el-input  v-model="form.slotNum"/>
-             </el-form-item>
-           </el-col>
-           <el-col :span="8">
-             <el-form-item label="角度" prop="angle">
-                <DictSelection dictName="角度" clearable v-model="form.angle">
-                </DictSelection>
-             </el-form-item>
-           </el-col>
-           <el-col :span="8">
-             <el-form-item label="长" prop="palletLen">
-                <el-input v-model="form.palletLen">
-                    <template slot="append">mm</template>
-                </el-input>
-             </el-form-item>
-           </el-col>
-           <el-col :span="8">
-             <el-form-item label="宽" prop="wilde">
-                <el-input v-model="form.wilde">
-                    <template slot="append">mm</template>
-                </el-input>
-             </el-form-item>
-           </el-col>
-           <el-col :span="8">
-             <el-form-item label="高" prop="hight">
-                <el-input v-model="form.hight">
-                    <template slot="append">mm</template>
-                </el-input>
-             </el-form-item>
-           </el-col>
-         </el-row>
-      </el-form>
+    <el-form label-width="100px" ref="form" :model="form">
+      <div class="divider">
+        <div class="title">
+          <div class="ele-bg-primary"></div>
+          <span>舟皿信息</span>
+        </div>
+        <div class="ele-bg-primary ele-width"></div>
+      </div>
+      <el-row :gutter="24">
+        <el-col :span="8">
+          <el-form-item label="槽数" prop="slotNum">
+            <el-input v-model="form.slotNum" @input="handleInput1" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="角度" prop="angle">
+            <DictSelection dictName="角度" clearable v-model="form.angle">
+            </DictSelection>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="长" prop="palletLen">
+            <el-input v-model="form.palletLen" @input="handleInput2">
+              <template slot="append">mm</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="宽" prop="wilde">
+            <el-input v-model="form.wilde" @input="handleInput3">
+              <template slot="append">mm</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="高" prop="hight">
+            <el-input v-model="form.hight" @input="handleInput4">
+              <template slot="append">mm</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
   </div>
 </template>
 
@@ -54,23 +54,30 @@
         default: {}
       }
     },
-    components: { },
+    components: {},
     data() {
-      return {
-
-
-      };
+      return {};
     },
 
     methods: {
-
-
+      handleInput1(val) {
+        this.form.slotNum = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput2(val) {
+        this.form.palletLen = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput3(val) {
+        this.form.wilde = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput4(val) {
+        this.form.hight = this.$handleInputPublicHasPoint(val);
+      }
     }
   };
 </script>
 
 <style lang="scss" scoped>
-  .other{
+  .other {
     background: #fff;
     padding: 1px 17px;
   }
@@ -89,17 +96,17 @@
         font-size: 20px;
       }
     }
-    .ele-width{
+    .ele-width {
       width: 100%;
       height: 2px;
     }
   }
-  .form-line{
+  .form-line {
     display: flex;
     align-items: center;
     justify-content: space-between;
-    .line-select{
-      margin-left:15px;
+    .line-select {
+      margin-left: 15px;
     }
   }
 </style>

+ 120 - 92
src/views/material/product/components/MoldInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-    <el-form label-width="120px" ref="form" :model="form">
+    <el-form label-width="100px" ref="form" :model="form">
       <div class="divider">
         <div class="title">
           <div class="ele-bg-primary"></div>
@@ -11,154 +11,182 @@
       <el-row :gutter="24">
         <el-col :span="8">
           <el-form-item label="收缩系数" prop="shrinkEffictive">
-
-            <el-input-number style="width: 85%" type="number" v-model.number="form.shrinkEffictive" :min="0" :max="100"
-              placeholder="请输入"></el-input-number>
-            <span class="spanbox">%</span>
+            <el-input
+              v-model="form.shrinkEffictive"
+              @input="handleInput1"
+              placeholder="请输入"
+            >
+              <template #append>%</template>
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="芯杆数量" prop="coreBarNum">
-            <el-input v-model="form.coreBarNum" />
+            <el-input v-model="form.coreBarNum" @input="handleInput2" />
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="模孔数量" prop="dieHoleNum">
-            <el-input v-model="form.dieHoleNum">
+            <el-input v-model="form.dieHoleNum" @input="handleInput3">
             </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="上冲头数量" prop="upperPunchNum">
-            <el-input v-model="form.upperPunchNum">
+            <el-input v-model="form.upperPunchNum" @input="handleInput4">
             </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="下冲头数量" prop="downPunchNum">
-            <el-input v-model="form.downPunchNum">
+            <el-input v-model="form.downPunchNum" @input="handleInput5">
             </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="最大冲压次数" prop="maxCyTimes">
-            <el-input v-model="form.maxCyTimes">
+            <el-input v-model="form.maxCyTimes" @input="handleInput6">
             </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="大模体型号" prop="maxMoldType">
-            <el-input v-model="form.maxMoldType">
-            </el-input>
+            <el-input v-model="form.maxMoldType"> </el-input>
           </el-form-item>
         </el-col>
 
-        <el-col :span="8" class="rx-sc">
+        <el-col :span="8">
           <el-form-item label="芯棒直径" prop="mandrelDiameter">
-            <el-input v-model="form.mandrelDiameter">
+            <el-input v-model="form.mandrelDiameter" @input="handleInput7">
             </el-input>
           </el-form-item>
         </el-col>
 
         <el-col :span="24">
-         <div class="rx-sc">
-          <el-form-item label="长" prop="length">
-            <el-input v-model="form.length">
-              <template slot="append">mm</template>
-            </el-input>
-          </el-form-item>
-
-          <el-form-item label="宽" prop="breadth">
-            <el-input v-model="form.breadth">
-              <template slot="append">mm</template>
-            </el-input>
-          </el-form-item>
-
-          <el-form-item label="高" prop="altitude">
-            <el-input v-model="form.altitude">
-              <template slot="append">mm</template>
-            </el-input>
-          </el-form-item>
-          <el-form-item label="直径" prop="diameter">
-            <el-input v-model="form.diameter">
-              <template slot="append">mm</template>
-            </el-input>
-          </el-form-item>
-         </div>
+          <div class="rx-sc">
+            <el-form-item label="长" prop="length">
+              <el-input v-model="form.length" @input="handleInput8">
+                <template slot="append">mm</template>
+              </el-input>
+            </el-form-item>
+
+            <el-form-item label="宽" prop="breadth">
+              <el-input v-model="form.breadth" @input="handleInput9">
+                <template slot="append">mm</template>
+              </el-input>
+            </el-form-item>
+
+            <el-form-item label="高" prop="altitude">
+              <el-input v-model="form.altitude" @input="handleInput10">
+                <template slot="append">mm</template>
+              </el-input>
+            </el-form-item>
+            <el-form-item label="直径" prop="diameter">
+              <el-input v-model="form.diameter" @input="handleInput11">
+                <template slot="append">mm</template>
+              </el-input>
+            </el-form-item>
+          </div>
         </el-col>
-
       </el-row>
     </el-form>
   </div>
 </template>
 
 <script>
-export default {
-  props: {
-    form: {
-      type: Object,
-      default: {}
+  export default {
+    props: {
+      form: {
+        type: Object,
+        default: {}
+      }
+    },
+    components: {},
+    data() {
+      return {};
+    },
+
+    methods: {
+      handleInput1(val) {
+        this.form.shrinkEffictive = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput2(val) {
+        this.form.coreBarNum = this.$handleInputPublic(val);
+      },
+      handleInput3(val) {
+        this.form.dieHoleNum = this.$handleInputPublic(val);
+      },
+      handleInput4(val) {
+        this.form.upperPunchNum = this.$handleInputPublic(val);
+      },
+      handleInput5(val) {
+        this.form.downPunchNum = this.$handleInputPublic(val);
+      },
+      handleInput6(val) {
+        this.form.maxCyTimes = this.$handleInputPublic(val);
+      },
+      handleInput7(val) {
+        this.form.mandrelDiameter = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput8(val) {
+        this.form.length = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput9(val) {
+        this.form.breadth = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput10(val) {
+        this.form.altitude = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput11(val) {
+        this.form.diameter = this.$handleInputPublicHasPoint(val);
+      }
     }
-  },
-  components: {},
-  data() {
-    return {
-
-
-    };
-  },
-
-  methods: {
-
-
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.other {
-  background: #fff;
-  padding: 1px 17px;
-}
+  .other {
+    background: #fff;
+    padding: 1px 17px;
+  }
 
-.divider {
-  margin: 0px 0 20px;
+  .divider {
+    margin: 0px 0 20px;
 
-  .title {
-    display: flex;
-    align-items: center;
-    margin-bottom: 10px;
+    .title {
+      display: flex;
+      align-items: center;
+      margin-bottom: 10px;
 
-    div {
-      width: 8px;
-      height: 20px;
-      margin-right: 10px;
-    }
+      div {
+        width: 8px;
+        height: 20px;
+        margin-right: 10px;
+      }
 
-    span {
-      font-size: 20px;
+      span {
+        font-size: 20px;
+      }
     }
-  }
 
-  .ele-width {
-    width: 100%;
-    height: 2px;
+    .ele-width {
+      width: 100%;
+      height: 2px;
+    }
   }
-}
 
-.form-line {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
+  .form-line {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
 
-  .line-select {
-    margin-left: 15px;
+    .line-select {
+      margin-left: 15px;
+    }
   }
-}
 
-            
-.spanbox {
-        display: inline-block;
-        margin-left: 10px;
-      }
+  .spanbox {
+    display: inline-block;
+    margin-left: 10px;
+  }
 </style>

+ 88 - 71
src/views/material/product/components/PlanInfo.vue

@@ -1,51 +1,59 @@
 <template>
   <div class="other">
-      <el-form label-width="120px"  ref="form" :model="form">
-         <div class="divider">
-           <div class="title">
-             <div class="ele-bg-primary"></div>
-             <span>计划</span>
-           </div>
-           <div class="ele-bg-primary ele-width"></div>
-         </div>
-         <el-row :gutter="24">
-           <el-col :span="8">
-             <el-form-item label="固定提前期" prop="fixLeadTime">
-                <el-input  v-model="form.fixLeadTime" @input="inputFix"/>
-             </el-form-item>
-           </el-col>
-           <el-col :span="8">
-             <el-form-item label="变动提前期" prop="changeLeadTime">
-                <el-input  v-model="form.changeLeadTime" @input="inputChange"/>
-             </el-form-item>
-           </el-col>
-           <el-col :span="8">
-             <el-form-item label="检验提前期" prop="checkLeadTime">
-                <el-input  v-model="form.checkLeadTime" @input="inputCheck"/>
-             </el-form-item>
-           </el-col>
-           <el-col :span="8">
-             <el-form-item label="累计提前期" prop="cumLeadTime">
-                <el-input  v-model="form.cumLeadTime" readonly/>
-             </el-form-item>
-           </el-col>
-           <el-col :span="8">
-             <el-form-item label="提前期单位" prop="unit">
-                <DictSelection dictName="提前期单位" clearable v-model="form.unit">
-                </DictSelection>
-             </el-form-item>
-           </el-col>
-           <el-col :span="8">
-             <el-form-item label="订货间隔期" prop="scheduleType">
-                <div class="form-line">
-                  <el-input  v-model="form.orderIntervalTime"/>
-                  <DictSelection class="line-select" dictName="提前期单位" clearable v-model="form.orderIntervalUnit">
-                  </DictSelection>
-                </div>
-             </el-form-item>
-           </el-col>
-         </el-row>
-      </el-form>
+    <el-form label-width="100px" ref="form" :model="form">
+      <div class="divider">
+        <div class="title">
+          <div class="ele-bg-primary"></div>
+          <span>计划</span>
+        </div>
+        <div class="ele-bg-primary ele-width"></div>
+      </div>
+      <el-row :gutter="24">
+        <el-col :span="8">
+          <el-form-item label="固定提前期" prop="fixLeadTime">
+            <el-input v-model="form.fixLeadTime" @input="inputFix" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="变动提前期" prop="changeLeadTime">
+            <el-input v-model="form.changeLeadTime" @input="inputChange" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="检验提前期" prop="checkLeadTime">
+            <el-input v-model="form.checkLeadTime" @input="inputCheck" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="累计提前期" prop="cumLeadTime">
+            <el-input v-model="form.cumLeadTime" readonly />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="提前期单位" prop="unit">
+            <DictSelection dictName="提前期单位" clearable v-model="form.unit">
+            </DictSelection>
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="订货间隔期" prop="scheduleType">
+            <div class="form-line">
+              <el-input
+                v-model="form.orderIntervalTime"
+                style="width: calc(100% - 100px)"
+              />
+              <DictSelection
+                dictName="提前期单位"
+                clearable
+                v-model="form.orderIntervalUnit"
+                style="width: 100px"
+              >
+              </DictSelection>
+            </div>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
   </div>
 </template>
 
@@ -57,39 +65,48 @@
         default: {}
       }
     },
-    components: { },
+    components: {},
     data() {
-      return {
-
-
-      };
+      return {};
     },
 
     methods: {
-      inputFix(val){
-         const  changeLeadTime = this.form.changeLeadTime?Number(this.form.changeLeadTime):0
-         const  checkLeadTime = this.form.checkLeadTime?Number(this.form.checkLeadTime):0
-         val = val?Number(val):0
-         this.form.cumLeadTime = val + changeLeadTime  + checkLeadTime
+      inputFix(val) {
+        const changeLeadTime = this.form.changeLeadTime
+          ? Number(this.form.changeLeadTime)
+          : 0;
+        const checkLeadTime = this.form.checkLeadTime
+          ? Number(this.form.checkLeadTime)
+          : 0;
+        val = val ? Number(val) : 0;
+        this.form.cumLeadTime = val + changeLeadTime + checkLeadTime;
       },
-      inputChange(val){
-        const  fixLeadTime = this.form.fixLeadTime?Number(this.form.fixLeadTime):0
-        const  checkLeadTime = this.form.checkLeadTime?Number(this.form.checkLeadTime):0
-        val = val?Number(val):0
-         this.form.cumLeadTime = val + fixLeadTime  + checkLeadTime
+      inputChange(val) {
+        const fixLeadTime = this.form.fixLeadTime
+          ? Number(this.form.fixLeadTime)
+          : 0;
+        const checkLeadTime = this.form.checkLeadTime
+          ? Number(this.form.checkLeadTime)
+          : 0;
+        val = val ? Number(val) : 0;
+        this.form.cumLeadTime = val + fixLeadTime + checkLeadTime;
       },
-      inputCheck(val){
-          const  fixLeadTime = this.form.fixLeadTime?Number(this.form.fixLeadTime):0
-          const  changeLeadTime = this.form.changeLeadTime?Number(this.form.changeLeadTime):0
-          val = val?Number(val):0
-         this.form.cumLeadTime = val + fixLeadTime  + changeLeadTime
+      inputCheck(val) {
+        const fixLeadTime = this.form.fixLeadTime
+          ? Number(this.form.fixLeadTime)
+          : 0;
+        const changeLeadTime = this.form.changeLeadTime
+          ? Number(this.form.changeLeadTime)
+          : 0;
+        val = val ? Number(val) : 0;
+        this.form.cumLeadTime = val + fixLeadTime + changeLeadTime;
       }
     }
   };
 </script>
 
 <style lang="scss" scoped>
-  .other{
+  .other {
     background: #fff;
     padding: 1px 17px;
   }
@@ -108,17 +125,17 @@
         font-size: 20px;
       }
     }
-    .ele-width{
+    .ele-width {
       width: 100%;
       height: 2px;
     }
   }
-  .form-line{
+  .form-line {
     display: flex;
     align-items: center;
     justify-content: space-between;
-    .line-select{
-      margin-left:15px;
+    .line-select {
+      margin-left: 15px;
     }
   }
 </style>

+ 1 - 1
src/views/material/product/components/ProcureInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-      <el-form label-width="120px"  ref="form" :model="form">
+      <el-form label-width="100px"  ref="form" :model="form">
          <div class="divider">
            <div class="title">
              <div class="ele-bg-primary"></div>

+ 99 - 77
src/views/material/product/components/ProductionInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-    <el-form label-width="120px" ref="form" :rules="rules" :model="form">
+    <el-form label-width="100px" ref="form" :rules="rules" :model="form">
       <div class="divider">
         <div class="title">
           <div class="ele-bg-primary"></div>
@@ -17,21 +17,21 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="消耗波动" prop="consumWave">
-            <el-input v-model="form.consumWave">
+            <el-input v-model="form.consumWave" @input="handleInput1">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="变动损耗率" prop="changeLossRate">
-            <el-input v-model="form.changeLossRate">
+            <el-input v-model="form.changeLossRate" @input="handleInput2">
               <template slot="append">%</template>
             </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="固定损耗数" prop="fixLossNum">
-            <el-input v-model="form.fixLossNum"/>
+            <el-input v-model="form.fixLossNum" @input="handleInput3" />
           </el-form-item>
         </el-col>
         <el-col :span="8">
@@ -41,8 +41,12 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="生产周期">
-            <el-input style="width: 100%" type="number" v-model="form.productionDays">
+          <el-form-item label="生产周期" prop="productionDays">
+            <el-input
+              v-model="form.productionDays"
+              @input="handleInput4"
+              style="width: 100%"
+            >
               <span slot="append">天</span>
             </el-input>
           </el-form-item>
@@ -89,92 +93,110 @@
 </template>
 
 <script>
-import deptSelect from '@/components/CommomSelect/dept-select.vue'
-import personSelect from '@/components/CommomSelect/person-select.vue';
-import {positiveIntegerReg} from "ele-admin";
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import personSelect from '@/components/CommomSelect/person-select.vue';
+  import { positiveIntegerReg } from 'ele-admin';
 
-export default {
-  props: {
-    form: {
-      type: Object,
-      default: {}
-    }
-  },
-  components: {deptSelect, personSelect},
-
-  data() {
-    return {
-      rules: {
-        productionDays: [
-          {required: true, message: '请输入生产周期', trigger: ['blur', 'change']},
-          { pattern: positiveIntegerReg, message: '请输入正确的生产周期', trigger: ['blur', 'change']}
-        ],
-      },
-    };
-  },
-
-  methods: {
-    // 选择所属部门
-    searchDeptNodeClick(id, info) {
-      // 根据部门获取人员
-      const params = {executeGroupId: id};
-      this.$nextTick(() => {
-        this.$refs.directorRef.getList(params);
-      });
+  export default {
+    props: {
+      form: {
+        type: Object,
+        default: {}
+      }
     },
-    //选择负责人
-    handleDirectorChange(id, info) {
-    },
-    getFormValid() {
-      return new Promise((resolve, reject) => {
-        this.$refs.form.validate( async (valid) => {
-          resolve(await valid)
-        });
-      })
+    components: { deptSelect, personSelect },
+
+    data() {
+      return {
+        rules: {
+          productionDays: [
+            {
+              required: true,
+              message: '请输入生产周期',
+              trigger: ['blur', 'change']
+            },
+            {
+              pattern: positiveIntegerReg,
+              message: '请输入正确的生产周期',
+              trigger: ['blur', 'change']
+            }
+          ]
+        }
+      };
     },
 
-  }
-};
+    methods: {
+      // 选择所属部门
+      searchDeptNodeClick(id, info) {
+        // 根据部门获取人员
+        const params = { executeGroupId: id };
+        this.$nextTick(() => {
+          this.$refs.directorRef.getList(params);
+        });
+      },
+      //选择负责人
+      handleDirectorChange(id, info) {},
+      getFormValid() {
+        return new Promise((resolve, reject) => {
+          this.$refs.form.validate(async (valid) => {
+            resolve(await valid);
+          });
+        });
+      },
+      handleInput1(val) {
+        this.form.consumWave = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput2(val) {
+        this.form.changeLossRate = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput3(val) {
+        this.form.fixLossNum = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput4(val) {
+        this.form.productionDays = this.$handleInputPublicHasPoint(val);
+      }
+    }
+  };
 </script>
 
 <style lang="scss" scoped>
-.other {
-  background: #fff;
-  padding: 1px 17px;
-}
+  .other {
+    background: #fff;
+    padding: 1px 17px;
+  }
 
-.divider {
-  margin: 0px 0 20px;
+  .divider {
+    margin: 0px 0 20px;
 
-  .title {
-    display: flex;
-    align-items: center;
-    margin-bottom: 10px;
+    .title {
+      display: flex;
+      align-items: center;
+      margin-bottom: 10px;
 
-    div {
-      width: 8px;
-      height: 20px;
-      margin-right: 10px;
-    }
+      div {
+        width: 8px;
+        height: 20px;
+        margin-right: 10px;
+      }
 
-    span {
-      font-size: 20px;
+      span {
+        font-size: 20px;
+      }
     }
-  }
 
-  .ele-width {
-    width: 100%;
-    height: 2px;
+    .ele-width {
+      width: 100%;
+      height: 2px;
+    }
   }
-}
 
-.form-line {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
+  .form-line {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
 
-  .line-select {
-    margin-left: 15px;
+    .line-select {
+      margin-left: 15px;
+    }
   }
-}
 </style>

+ 20 - 15
src/views/material/product/components/PurchasingInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-    <el-form label-width="120px" ref="form" :model="form">
+    <el-form label-width="100px" ref="form" :model="form">
       <div class="divider">
         <div class="title">
           <div class="ele-bg-primary"></div>
@@ -11,11 +11,10 @@
       <el-row :gutter="24">
         <el-col :span="8">
           <el-form-item label="周期" prop="purchasingCycle">
-            <el-input-number
+            <el-input
               v-model="form.purchasingCycle"
               placeholder="请输入"
-              :min="0"
-              :controls="false"
+              @input="handleInput1"
               style="width: calc(100% - 100px)"
             />
             <DictSelection
@@ -29,22 +28,20 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="倍数" prop="purchaseMultiplier">
-            <el-input-number
-              style="width: 100%"
+            <el-input
               v-model="form.purchaseMultiplier"
               placeholder="请输入"
-              :min="0"
-              :controls="false"
+              @input="handleInput2"
+              style="width: 100%"
             />
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="最低订购量" prop="minimumOrderQuantity">
-            <el-input-number
+            <el-input
               v-model="form.minimumOrderQuantity"
               placeholder="请输入"
-              :min="0"
-              :controls="false"
+              @input="handleInput3"
               style="width: calc(100% - 100px)"
             />
             <DictSelection
@@ -98,7 +95,7 @@
 <script>
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
   import personSelect from '@/components/CommomSelect/person-select.vue';
-  import {getByCode} from "@/api/system/dictionary-data";
+  import { getByCode } from '@/api/system/dictionary-data';
   export default {
     props: {
       form: {
@@ -109,12 +106,11 @@
     components: { deptSelect, personSelect },
     data() {
       return {
-        dictList:[]
+        dictList: []
       };
     },
     watch: {
       form(data) {
-        console.log(data, 'data');
         if (data.checkDepart) {
           const params = { executeGroupId: data.checkDepart };
           this.$nextTick(() => {
@@ -123,7 +119,7 @@
         }
       }
     },
-    activated(){
+    activated() {
       this.getDictList('purchase_origin');
     },
     methods: {
@@ -144,6 +140,15 @@
         this.$nextTick(() => {
           this.$refs.directorRef.getList(params);
         });
+      },
+      handleInput1(val) {
+        this.form.purchasingCycle = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput2(val) {
+        this.form.purchaseMultiplier = this.$handleInputPublicHasPoint(val);
+      },
+      handleInput3(val) {
+        this.form.minimumOrderQuantity = this.$handleInputPublicHasPoint(val);
       }
     }
   };

+ 23 - 15
src/views/material/product/components/QualityInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-    <el-form label-width="120px" ref="form" :model="form">
+    <el-form label-width="100px" ref="form" :model="form">
       <div class="divider">
         <div class="title">
           <div class="ele-bg-primary"></div>
@@ -15,7 +15,12 @@
             <el-radio v-model="form.isComeCheck" :label="0">否</el-radio>
           </el-form-item>
         </el-col>
-        <el-col :span="6" v-if="form.isComeCheck ==1 ">
+        <el-col :span="4">
+          <el-form-item label="检验标准" prop="">
+            <!-- 计量 计重 -->
+          </el-form-item>
+        </el-col>
+        <el-col :span="6" v-if="form.isComeCheck == 1">
           <el-form-item label="物料级别" prop="checkFormula">
             <el-select
               style="width: 100%"
@@ -32,7 +37,7 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="6" v-if="form.isComeCheck ==1 ">
+        <el-col :span="6" v-if="form.isComeCheck == 1">
           <el-form-item label="检验方式" prop="checkFormula">
             <DictSelection
               dictName="检验方案"
@@ -42,22 +47,25 @@
             </DictSelection>
           </el-form-item>
         </el-col>
-        <el-col :span="6" v-if="form.isComeCheck ==1 && form.checkFormula == 1">
+        <el-col
+          :span="6"
+          v-if="form.isComeCheck == 1 && form.checkFormula == 1"
+        >
           <el-form-item label="抽检比例" prop="checkProportion">
             <el-input
               type="number"
-              :min="0.00"
+              :min="0.0"
               v-model="form.checkProportion"
               placeholder="请输入"
               clearable
             >
-            <template slot="append">%</template>
+              <template slot="append">%</template>
             </el-input>
           </el-form-item>
         </el-col>
       </el-row>
       <el-row>
-        <el-col :span="8" v-if="form.isComeCheck ==1 ">
+        <el-col :span="8" v-if="form.isComeCheck == 1">
           <el-form-item label="质检方案" prop="">
             <el-select
               style="width: 100%"
@@ -80,8 +88,8 @@
 </template>
 
 <script>
-import { getQualityTemplate } from '@/api/material/list.js';
-import {getByCode} from "@/api/system/dictionary-data";
+  import { getQualityTemplate } from '@/api/material/list.js';
+  import { getByCode } from '@/api/system/dictionary-data';
   export default {
     props: {
       form: {
@@ -92,8 +100,8 @@ import {getByCode} from "@/api/system/dictionary-data";
     components: {},
     data() {
       return {
-        qualityTemplateList:[],
-        levelOptions:[],
+        qualityTemplateList: [],
+        levelOptions: []
       };
     },
     watch: {},
@@ -103,7 +111,7 @@ import {getByCode} from "@/api/system/dictionary-data";
     },
     methods: {
       async getDictList(code) {
-        debugger
+        debugger;
         let { data: res } = await getByCode(code);
         this.levelOptions = res.map((item) => {
           let values = Object.keys(item);
@@ -114,9 +122,9 @@ import {getByCode} from "@/api/system/dictionary-data";
         });
       },
       getQualityTemplateList() {
-        getQualityTemplate().then(res => {
-          this.qualityTemplateList = res
-        })
+        getQualityTemplate().then((res) => {
+          this.qualityTemplateList = res;
+        });
       }
     }
   };

+ 1 - 1
src/views/material/product/components/RemarkInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-    <el-form label-width="120px"  ref="form" :model="form">
+    <el-form label-width="100px"  ref="form" :model="form">
          <div class="divider">
            <div class="title">
              <div class="ele-bg-primary"></div>

+ 1 - 1
src/views/material/product/components/SalesInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-      <el-form label-width="120px"  ref="form" :model="form">
+      <el-form label-width="100px"  ref="form" :model="form">
          <div class="divider">
            <div class="title">
              <div class="ele-bg-primary"></div>

+ 3 - 3
src/views/material/product/components/SalesInfos.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-    <el-form label-width="120px" ref="form" :model="form">
+    <el-form label-width="100px" ref="form" :model="form">
       <div class="divider">
         <div class="title">
           <div class="ele-bg-primary"></div>
@@ -43,8 +43,8 @@
       return {
         // 计价方式
         pricingWayList: [
-          { id: 1, name: '按数量计价' },
-          { id: 2, name: '按重量计价' }
+          { id: '1', name: '按数量计价' },
+          { id: '2', name: '按重量计价' }
         ]
       };
     },

+ 1 - 1
src/views/material/product/components/TurnoverInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-    <el-form label-width="120px" ref="form" :model="form">
+    <el-form label-width="100px" ref="form" :model="form">
       <div class="divider">
         <div class="title">
           <div class="ele-bg-primary"></div>

+ 90 - 26
src/views/material/product/components/WarehouseInfo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="other">
-    <el-form label-width="120px" ref="form" :model="form">
+    <el-form label-width="100px" ref="form1" :model="form">
       <div class="divider">
         <div class="title">
           <div class="ele-bg-primary"></div>
@@ -10,19 +10,16 @@
       </div>
       <el-row :gutter="24">
         <el-col :span="8">
-          <el-form-item label="启用库存预警">
+          <el-form-item label="启用库存预警" prop="isWarn">
             <el-radio v-model="form.isWarn" :label="1">是</el-radio>
             <el-radio v-model="form.isWarn" :label="0">否</el-radio>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="盘点模式" prop="inventoryMode">
-            <el-radio-group
-              v-model="form.inventoryMode"
-              @input="inventoryModeChange"
-            >
-              <el-radio :label="1">逐个盘点</el-radio>
-              <el-radio :label="2">批量盘点</el-radio>
+            <el-radio-group v-model="form.inventoryMode">
+              <el-radio :label="1">批量盘点</el-radio>
+              <el-radio :label="0">逐个盘点</el-radio>
             </el-radio-group>
           </el-form-item>
         </el-col>
@@ -37,18 +34,54 @@
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="安全库存" prop="secureInventory">
-            <el-input v-model="form.secureInventory" />
+          <el-form-item
+            label="安全库存"
+            prop="secureInventory"
+            :rules="{
+              required: this.form.isWarn == 1 ? true : false,
+              message: '请输入安全库存',
+              trigger: 'blur'
+            }"
+          >
+            <el-input v-model="form.secureInventory" @input="handleInput1">
+              <template #append>
+                {{ packingUnit }}
+              </template>
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="最小库存" prop="minInventory">
-            <el-input v-model="form.minInventory" />
+          <el-form-item
+            label="最小库存"
+            prop="minInventory"
+            :rules="{
+              required: this.form.isWarn == 1 ? true : false,
+              message: '请输入最小库存',
+              trigger: 'blur'
+            }"
+          >
+            <el-input v-model="form.minInventory" @input="handleInput2">
+              <template #append>
+                {{ packingUnit }}
+              </template>
+            </el-input>
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="最大库存" prop="maxInventory">
-            <el-input v-model="form.maxInventory" />
+          <el-form-item
+            label="最大库存"
+            prop="maxInventory"
+            :rules="{
+              required: this.form.isWarn == 1 ? true : false,
+              message: '请输入最大库存',
+              trigger: 'blur'
+            }"
+          >
+            <el-input v-model="form.maxInventory" @input="handleInput3">
+              <template #append>
+                {{ packingUnit }}
+              </template>
+            </el-input>
           </el-form-item>
         </el-col>
 
@@ -65,12 +98,16 @@
         <el-col :span="8">
           <el-form-item label="保质期">
             <div class="form-line">
-              <el-input v-model="form.warrantyPeriod" />
+              <el-input
+                v-model="form.warrantyPeriod"
+                @input="handleInput4"
+                style="width: calc(100% - 100px)"
+              />
               <DictSelection
-                class="line-select"
                 dictName="保质期单位"
                 clearable
                 v-model="form.warrantyPeriodUnit"
+                style="width: 100px"
               >
               </DictSelection>
             </div>
@@ -202,7 +239,7 @@
       </div>
     </el-form>
     <el-dialog title="添加包装组" :visible.sync="dialogVisible" width="50%">
-      <el-form label-width="120px" ref="form" :model="ruleItem">
+      <el-form label-width="100px" ref="form" :model="ruleItem">
         <el-row :gutter="24">
           <el-col :span="12">
             <el-form-item label="包装名称">
@@ -261,6 +298,13 @@
           }
         );
       },
+      packingUnit(val) {
+        this.packagingSpecification = this.packagingSpecification.map(
+          (item) => {
+            return { ...item, minConversionUnit: val };
+          }
+        );
+      },
       packagingSpecification: {
         handler(val) {
           this.$emit('change', val);
@@ -359,6 +403,19 @@
       console.log(this.packingRules, 'packingRules');
     },
     methods: {
+      handleInput1(value) {
+        this.form.secureInventory = this.$handleInputPublic(value);
+      },
+      handleInput2(value) {
+        this.form.minInventory = this.$handleInputPublic(value);
+      },
+      handleInput3(value) {
+        this.form.maxInventory = this.$handleInputPublic(value);
+      },
+      handleInput4(value) {
+        this.form.warrantyPeriod = this.$handleInputPublicHasPoint(value);
+      },
+
       async defaultBuild(val) {
         if (!this.hasPushed) {
           let code = await getCode('package_disposition');
@@ -459,13 +516,13 @@
           }
         }
       },
-      inventoryModeChange(value) {
-        if (value == 1) {
-          this.form.isUnpack = 1;
-        } else {
-          this.form.isUnpack = 0;
-        }
-      },
+      // inventoryModeChange(value) {
+      //   if (value == 1) {
+      //     this.form.isUnpack = 1;
+      //   } else {
+      //     this.form.isUnpack = 0;
+      //   }
+      // },
       // 选择所属部门
       searchDeptNodeClick(id, info) {
         // 根据部门获取人员
@@ -475,7 +532,14 @@
         });
       },
       //选择负责人
-      handleDirectorChange(id, info) {}
+      handleDirectorChange(id, info) {},
+      getFormValid() {
+        return new Promise((resolve, reject) => {
+          this.$refs.form1.validate(async (valid) => {
+            resolve(await valid);
+          });
+        });
+      }
     }
   };
 </script>
@@ -514,7 +578,7 @@
     }
   }
   .rules_box {
-    margin: 0px 20px 20px 20px;
+    margin: 0px 20px 20px 0;
     .rules_box_tabs {
       margin: 20px 0;
       :deep(.el-form-item__content) {

+ 1 - 1
src/views/material/product/components/mouldDialog.vue

@@ -3,7 +3,7 @@
     <ele-modal width="1160px" :visible="visible" v-if="visible" :append-to-body="true" :close-on-click-modal="false"
         custom-class="ele-dialog-form" title="选择物料" @update:visible="updateVisible" :maxable="true">
         <header-title title="基本信息"></header-title>
-        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
+        <el-form ref="form" :model="form" :rules="rules" label-width="100px">
             <el-row>
                 <el-col :span="8">
                     <el-form-item label="产品名称:" prop="name">

+ 646 - 644
src/views/material/product/detail.vue

@@ -1,24 +1,38 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never">
-      <el-form label-width="120px" ref="manageForm" :model="form" :rules="rules">
+      <el-form
+        label-width="100px"
+        ref="manageForm"
+        :model="form"
+        :rules="rules"
+      >
         <headerTitle title="基本信息">
           <el-button @click="cancel">返回</el-button>
-          <el-button type="primary" @click="submit" :loading="loading">保存
+          <el-button type="primary" @click="submit" :loading="loading"
+            >保存
           </el-button>
         </headerTitle>
 
         <el-row :gutter="24">
           <el-col :span="8">
             <el-form-item label="分类" prop="categoryLevelName">
-              <el-input v-model="form.categoryLevelName" @click.native="openCategory" />
+              <el-input
+                v-model="form.categoryLevelName"
+                @click.native="openCategory"
+              />
             </el-form-item>
           </el-col>
 
           <el-col :span="8">
             <el-form-item label="编码" prop="code">
-              <el-input v-if="ruleCode == '自定义'" v-model="form.code" readonly @click.native="openCode"
-                :disabled="status == 0" />
+              <el-input
+                v-if="ruleCode == '自定义'"
+                v-model="form.code"
+                readonly
+                @click.native="openCode"
+                :disabled="status == 0"
+              />
               <el-input v-else v-model="form.code" :disabled="status == 0" />
             </el-form-item>
           </el-col>
@@ -37,20 +51,37 @@
 
           <el-col :span="8">
             <el-form-item label="生产类型" prop="produceType">
-              <el-select style="width: 100%" v-model="form.produceType" filterable multiple>
-                <el-option v-for="item in dictList" :key="item.value" :value="item.value"
-                  :label="item.label"></el-option>
+              <el-select
+                style="width: 100%"
+                v-model="form.produceType"
+                filterable
+                multiple
+              >
+                <el-option
+                  v-for="item in dictList"
+                  :key="item.value"
+                  :value="item.value"
+                  :label="item.label"
+                ></el-option>
               </el-select>
             </el-form-item>
           </el-col>
 
-          <el-col :span="8" v-if="
-            [1, 23, 9, 28].includes(
-              Number(categoryLevelPathId || $route.query.rootTreeId)
-            )
-          ">
+          <el-col
+            :span="8"
+            v-if="
+              [1, 23, 9, 28].includes(
+                Number(categoryLevelPathId || $route.query.rootTreeId)
+              )
+            "
+          >
             <el-form-item label="加工类型" prop="isConsumable">
-              <el-select v-model="form.isConsumable" size="small" style="width: 100%">
+              <el-select
+                v-model="form.isConsumable"
+                size="small"
+                style="width: 100%"
+                @change="changeConsumable"
+              >
                 <el-option :value="1" label="批量"></el-option>
                 <el-option :value="0" label="单件"></el-option>
               </el-select>
@@ -72,28 +103,39 @@
             <el-form-item label="规格" prop="specification">
               <el-input v-model="form.specification" />
             </el-form-item>
-            
           </el-col>
 
-          
-
           <el-col :span="8">
             <el-form-item label="计量单位" prop="measuringUnit">
-              <DictSelection dictName="计量单位" clearable v-model="form.measuringUnit" @change="changeUnit">
+              <DictSelection
+                dictName="计量单位"
+                clearable
+                v-model="form.measuringUnit"
+                @change="changeUnit"
+              >
               </DictSelection>
             </el-form-item>
           </el-col>
 
           <el-col :span="8">
             <el-form-item label="重量单位" prop="weightUnit">
-              <DictSelection dictName="重量单位" clearable v-model="form.weightUnit">
+              <DictSelection
+                dictName="重量单位"
+                clearable
+                v-model="form.weightUnit"
+              >
               </DictSelection>
             </el-form-item>
           </el-col>
 
           <el-col :span="8">
             <el-form-item label="包装单位" prop="packingUnit">
-              <DictSelection dictName="包装单位" clearable v-model="form.packingUnit" @change="changeUnit">
+              <DictSelection
+                dictName="包装单位"
+                clearable
+                v-model="form.packingUnit"
+                @change="changeUnit"
+              >
               </DictSelection>
             </el-form-item>
           </el-col>
@@ -101,8 +143,17 @@
           <el-col :span="8">
             <el-form-item label="体积">
               <div class="form-line">
-                <el-input v-model="form.volume" />
-                <DictSelection class="line-select" dictName="体积单位" clearable v-model="form.volumeUnit">
+                <el-input
+                  v-model="form.volume"
+                  style="width: calc(100% - 100px)"
+                  @input="handleInput1"
+                />
+                <DictSelection
+                  dictName="体积单位"
+                  clearable
+                  v-model="form.volumeUnit"
+                  style="width: 100px"
+                >
                 </DictSelection>
               </div>
             </el-form-item>
@@ -111,7 +162,7 @@
           <el-col :span="8">
             <el-form-item label="毛重">
               <div class="form-line">
-                <el-input v-model="form.roughWeight" />
+                <el-input v-model="form.roughWeight" @input="handleInput2" />
               </div>
             </el-form-item>
           </el-col>
@@ -119,7 +170,7 @@
           <el-col :span="8">
             <el-form-item label="净重">
               <div class="form-line">
-                <el-input v-model="form.netWeight" />
+                <el-input v-model="form.netWeight" @input="handleInput3" />
               </div>
             </el-form-item>
           </el-col>
@@ -127,8 +178,17 @@
           <el-col :span="8">
             <el-form-item label="级别">
               <template>
-                <el-select style="width: 100%" v-model="form.level" placeholder="请选择">
-                  <el-option v-for="item in levelOptions" :label="item.label" :value="item.value" :key="item.value">
+                <el-select
+                  style="width: 100%"
+                  v-model="form.level"
+                  placeholder="请选择"
+                >
+                  <el-option
+                    v-for="item in levelOptions"
+                    :label="item.label"
+                    :value="item.value"
+                    :key="item.value"
+                  >
                   </el-option>
                 </el-select>
               </template>
@@ -139,42 +199,43 @@
             <el-form-item :label="f.label">
               <template>
                 <div class="form-line">
-                  <component :is="f.tagType" v-model="form.extField[f.prop]" :disabled="f.extAttribute?.disabled"
-                    clearable :isProhibit="f.modelType == 'dict' ? f.extAttribute?.disabled : false
-                      " :dictName="f.modelType == 'dict' ? f.label : ''"></component>
+                  <component
+                    :is="f.tagType"
+                    v-model="form.extField[f.prop]"
+                    :disabled="f.extAttribute?.disabled"
+                    clearable
+                    :isProhibit="
+                      f.modelType == 'dict' ? f.extAttribute?.disabled : false
+                    "
+                    :dictName="f.modelType == 'dict' ? f.label : ''"
+                  ></component>
                 </div>
               </template>
             </el-form-item>
           </el-col>
-
-          <el-col :span="8">
-            <el-form-item label="属性类型:" prop="attributeType">
-            <el-select
-              v-model="form.attributeType"
-              filterable
-              class="ele-block"
-            >
-              <el-option
-                v-for="item in attributeList"
-                :key="item.value"
-                :value="item.value"
-                :label="item.label"
-              ></el-option>
-            </el-select>
-          </el-form-item>
-          </el-col>
         </el-row>
       </el-form>
     </el-card>
 
     <!--  自定义编码 -->
-    <CodeDialog ref="codeRefs" v-if="codeShow" @close="codeShow = false" @chooseCode="chooseCode" />
+    <CodeDialog
+      ref="codeRefs"
+      v-if="codeShow"
+      @close="codeShow = false"
+      @chooseCode="chooseCode"
+    />
     <!-- 分类选择弹窗 -->
     <CategoryDialog ref="categoryRefs" @chooseCategory="confirmCategory" />
     <!-- 仓储配置 -->
-    <WarehouseInfo ref="warehouseRefs" :form="categoryWms" :measuringUnit="form.measuringUnit"
-      :packingUnit="form.packingUnit" :packageDispositionVOList="packageDispositionVOList"
-      @change="changePackagingSpecification" />
+    <WarehouseInfo
+      ref="warehouseRefs"
+      v-if="isShow"
+      :form="categoryWms"
+      :measuringUnit="form.measuringUnit"
+      :packingUnit="form.packingUnit"
+      :packageDispositionVOList="packageDispositionVOList"
+      @change="changePackagingSpecification"
+    />
     <!-- 销售配置 -->
     <SalesInfos ref="salesRefs" :form="categorySales" />
     <!-- 采购信息 -->
@@ -194,226 +255,202 @@
     <!-- 备注信息 -->
     <RemarkInfo ref="remarkRefs" :form="remarkform" />
     <!-- 关联信息 -->
-    <linkMsg ref="linkMsgRef" :id="$route.query.id" :categoryLevelId="form.categoryLevelId"
-      :categoryLevelGroupId="form.categoryLevelGroupId" />
+    <linkMsg
+      ref="linkMsgRef"
+      :id="$route.query.id"
+      :categoryLevelId="form.categoryLevelId"
+      :categoryLevelGroupId="form.categoryLevelGroupId"
+    />
   </div>
 </template>
 
 <script>
-import SalesInfos from './components/SalesInfos.vue';
-import PurchasingInfo from './components/PurchasingInfo.vue';
-import GroupDialog from './components/GroupDialog.vue';
-import CodeDialog from './components/codeDialog.vue';
-import CategoryDialog from './components/CategoryDialog.vue';
-import WarehouseInfo from './components/WarehouseInfo.vue';
-import ProcureInfo from './components/ProcureInfo.vue';
-import ProductionInfo from './components/ProductionInfo.vue';
-import PlanInfo from './components/PlanInfo.vue';
-import SalesInfo from './components/SalesInfo.vue';
-import QualityInfo from './components/QualityInfo.vue';
-import BoatInfo from './components/BoatInfo.vue';
-import TurnoverInfo from './components/TurnoverInfo.vue';
-import MoldInfo from './components/MoldInfo.vue';
-import RemarkInfo from './components/RemarkInfo.vue';
-import deptSelect from '@/components/CommomSelect/dept-select.vue';
-import personSelect from '@/components/CommomSelect/person-select.vue';
-import linkMsg from './components/link-msg.vue';
-import { getDetails } from '@/api/classifyManage/itemInformation';
-import { getByCode } from '@/api/system/dictionary-data';
-import { getCode, rootCategoryCode, fieldModel } from '@/api/codeManagement';
-
-import { addMaterial } from '@/api/material/list.js';
-import { deepClone } from '@/utils/index';
-import { finishPageTab, reloadPageTab } from '@/utils/page-tab-util';
-
-export default {
-  name: 'product',
-  components: {
-    SalesInfos,
-    PurchasingInfo,
-    linkMsg,
-    GroupDialog,
-    deptSelect,
-    personSelect,
-    WarehouseInfo,
-    ProcureInfo,
-    ProductionInfo,
-    PlanInfo,
-    SalesInfo,
-    QualityInfo,
-    BoatInfo,
-    TurnoverInfo,
-    MoldInfo,
-    RemarkInfo,
-    CategoryDialog,
-    CodeDialog
-  },
-  data() {
-    return {
-      packagingSpecificationList: [],
-      loading: false,
-      levelOptions: [
-        {
-          label: '特级',
-          value: '特级'
-        },
-        {
-          label: '一级',
-          value: '一级'
-        },
-        {
-          label: '二级',
-          value: '二级'
-        },
-        {
-          label: '三级',
-          value: '三级'
-        }
-      ],
-      attributeList: [
-        {
-            label: '总装',
-            value: 1
+  import SalesInfos from './components/SalesInfos.vue';
+  import PurchasingInfo from './components/PurchasingInfo.vue';
+  import GroupDialog from './components/GroupDialog.vue';
+  import CodeDialog from './components/codeDialog.vue';
+  import CategoryDialog from './components/CategoryDialog.vue';
+  import WarehouseInfo from './components/WarehouseInfo.vue';
+  import ProcureInfo from './components/ProcureInfo.vue';
+  import ProductionInfo from './components/ProductionInfo.vue';
+  import PlanInfo from './components/PlanInfo.vue';
+  import SalesInfo from './components/SalesInfo.vue';
+  import QualityInfo from './components/QualityInfo.vue';
+  import BoatInfo from './components/BoatInfo.vue';
+  import TurnoverInfo from './components/TurnoverInfo.vue';
+  import MoldInfo from './components/MoldInfo.vue';
+  import RemarkInfo from './components/RemarkInfo.vue';
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import personSelect from '@/components/CommomSelect/person-select.vue';
+  import linkMsg from './components/link-msg.vue';
+  import { getDetails } from '@/api/classifyManage/itemInformation';
+  import { getByCode } from '@/api/system/dictionary-data';
+  import { getCode, rootCategoryCode, fieldModel } from '@/api/codeManagement';
+
+  import { addMaterial } from '@/api/material/list.js';
+  import { deepClone } from '@/utils/index';
+  import { finishPageTab, reloadPageTab } from '@/utils/page-tab-util';
+
+  export default {
+    name: 'product',
+    components: {
+      SalesInfos,
+      PurchasingInfo,
+      linkMsg,
+      GroupDialog,
+      deptSelect,
+      personSelect,
+      WarehouseInfo,
+      ProcureInfo,
+      ProductionInfo,
+      PlanInfo,
+      SalesInfo,
+      QualityInfo,
+      BoatInfo,
+      TurnoverInfo,
+      MoldInfo,
+      RemarkInfo,
+      CategoryDialog,
+      CodeDialog
+    },
+    data() {
+      return {
+        isShow: true,
+        packagingSpecificationList: [],
+        loading: false,
+        levelOptions: [
+          {
+            label: '特级',
+            value: '特级'
+          },
+          {
+            label: '一级',
+            value: '一级'
           },
           {
-            label: '部件',
-            value: 2
+            label: '二级',
+            value: '二级'
           },
           {
-            label: '零',
-            value: 3
-          },{
-            label: '原材料',
-            value: 4
+            label: '三级',
+            value: '三级'
           }
         ],
-      form: {
-        categoryLevelGroupName: '',
-        categoryLevelName: '',
-        isConsumable: 1,
-        measuringUnit: '',
-        weightUnit: '',
-        packingUnit: '',
-        attributeType:'',
-        extField: {}
-      },
-
-      remarkform: {
-        remarkAttach: []
-      },
-      categorySales: {},
-      categoryPurchase: { purchaseMultiplier: 1 },
-      categoryAps: {},
-      categoryMes: {},
-      categoryMold: {},
-      categoryPallet: {},
-      categoryQms: {},
-      categoryVehicle: {},
-      categoryWms: {
-        isUnpack: 1
-      },
-      packageDispositionVOList: [],
-      categoryLevelPathId: null,
+        form: {
+          categoryLevelGroupName: '',
+          categoryLevelName: '',
+          isConsumable: 1,
+          measuringUnit: '',
+          weightUnit: '',
+          packingUnit: '',
+
+          extField: {}
+        },
 
         remarkform: {
           remarkAttach: []
         },
         categorySales: {},
-        categoryPurchase: { purchaseMultiplier: 1 },
+        categoryPurchase: { purchaseMultiplier: 1, measuringUnit: '' },
         categoryAps: {},
         categoryMes: {},
         categoryMold: {},
         categoryPallet: {},
         categoryQms: {
-          isComeCheck: "1"
+          isComeCheck: '1'
         },
         categoryVehicle: {},
         categoryWms: {
-          isUnpack: 1
+          isUnpack: 1,
+          isWarn: 1,
+          inventoryMode: ''
         },
         packageDispositionVOList: [],
         categoryLevelPathId: null,
 
-      fileList: [],
-      // 表单验证规则
-      rules: {
-        categoryLevelGroupName: [
-          { required: true, message: '请选择所属物料组', trigger: 'change' }
-        ],
-        code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
-        name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
-        produceType: [
-          { required: true, message: '请选择生产类型', trigger: 'change' }
-        ],
-        categoryLevelName: [
-          { required: true, message: '请选择所属分类', trigger: 'change' }
-        ],
-        measuringUnit: [
-          { required: true, message: '请选择计量单位', trigger: 'change' }
-        ],
-
-        weightUnit: [
-          { required: true, message: '请选择重量单位', trigger: 'change' }
-        ],
-
-        packingUnit: [
-          { required: true, message: '请选择包装单位', trigger: 'change' }
-        ],
+        dictList: [],
+
+        fileList: [],
+        // 表单验证规则
+        rules: {
+          categoryLevelGroupName: [
+            { required: true, message: '请选择所属物料组', trigger: 'change' }
+          ],
+          code: [{ required: true, message: '请输入编码', trigger: 'blur' }],
+          name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
+          produceType: [
+            { required: true, message: '请选择生产类型', trigger: 'change' }
+          ],
+          categoryLevelName: [
+            { required: true, message: '请选择所属分类', trigger: 'change' }
+          ],
+          measuringUnit: [
+            { required: true, message: '请选择计量单位', trigger: 'change' }
+          ],
+
+          weightUnit: [
+            { required: true, message: '请选择重量单位', trigger: 'change' }
+          ],
+
+          packingUnit: [
+            { required: true, message: '请选择包装单位', trigger: 'change' }
+          ],
+
+          netWeight: [
+            { required: true, message: '请输入净重', trigger: 'blur' }
+          ]
+        },
+        PathInfo: {},
+        id: null,
 
-        netWeight: [
-          { required: true, message: '请输入净重', trigger: 'blur' }
-        ]
-      },
-      PathInfo: {},
-      id: null,
-
-      ruleCode: null,
-      codeShow: false,
-
-      status: null
-    };
-  },
-  watch: {
-    '$route.query.id': {
-      handler(id) {
-        if (id) {
-          this._getDetails();
-        } else {
-          this.form = {
-            categoryLevelGroupName: '',
-            // categoryLevelName: '',
-            isConsumable: 1,
-            measuringUnit: '',
-            weightUnit: '',
-            packingUnit: '',
-            extField: {}
-          };
-          this.purchaseInfo = {};
-          this.remarkform = {
-            remarkAttach: []
-          };
-          this.categoryAps = {};
-          this.categoryMes = {};
-          this.categoryMold = {};
-          this.categoryPallet = {};
-          this.categoryQms = {};
-          this.categoryVehicle = {};
-          this.categoryWms = {
-            isUnpack: 1
-          };
-          this.packageDispositionVOList = [];
-          this.categoryLevelPathId = null;
+        ruleCode: null,
+        codeShow: false,
 
-          this.dictList = [];
+        status: null
+      };
+    },
+    watch: {
+      '$route.query.id': {
+        handler(id) {
+          if (id) {
+            this._getDetails();
+          } else {
+            this.form = {
+              categoryLevelGroupName: '',
+              // categoryLevelName: '',
+              isConsumable: 1,
+              measuringUnit: '',
+              weightUnit: '',
+              packingUnit: '',
+              extField: {}
+            };
+            this.categorySales = {};
+            this.purchaseInfo = {};
+            this.remarkform = {
+              remarkAttach: []
+            };
+            this.categoryAps = {};
+            this.categoryMes = {};
+            this.categoryMold = {};
+            this.categoryPallet = {};
+            this.categoryQms = {};
+            this.categoryVehicle = {};
+            this.categoryWms = {
+              isUnpack: 1,
+              isWarn: 1,
+              inventoryMode: this.form.isConsumable
+            };
+            this.packageDispositionVOList = [];
+            this.categoryLevelPathId = null;
 
             this.dictList = [];
 
             this.fileList = [];
           }
-      },
+        },
         deep: true,
         immediate: true
-      
+      }
     },
     async activated() {
       this.status = this.$route.query.status;
@@ -464,466 +501,431 @@ export default {
 
       this.getFieldModel();
 
-      // if (this.$route.query.id) {
-      //   this._getDetails();
-      // }
       this.getDictList('productionType');
     },
     methods: {
+      handleInput(value) {
+        this.form.volume = this.$handleInputPublicHasPoint(value);
+      },
+      handleInput2(value) {
+        this.form.roughWeight = this.$handleInputPublicHasPoint(value);
+      },
+      handleInput3(value) {
+        this.form.netWeight = this.$handleInputPublicHasPoint(value);
+      },
+      changeConsumable() {
+        this.categoryWms.inventoryMode = this.form.isConsumable;
+      },
       changeUnit() {
-        if (this.form.measuringUnit) {
-          this.categoryPurchase.measuringUnit = this.form.measuringUnit;
-          if (this.form.packingUnit) {
-            this.$refs.warehouseRefs.defaultBuild(this.form.packingUnit);
+        if (this.$route.query.id == '' || this.$route.query.id == null) {
+          if (this.form.measuringUnit) {
+            this.categoryPurchase.measuringUnit = this.form.measuringUnit;
+            console.log(this.categoryPurchase.measuringUnit, '采购信息');
+            // 如果有计量单位和包装单位 默认添加包装组
+            if (this.form.packingUnit) {
+              this.$refs.warehouseRefs.defaultBuild(this.form.packingUnit);
+            }
+          }
+        } else {
+          this.isShow = false;
+          if (this.form.measuringUnit) {
+            this.categoryPurchase.measuringUnit = this.form.measuringUnit;
+
+            if (this.form.packingUnit) {
+              console.log(this.form.measuringUnit, 'this.form.measuringUnit');
+              console.log(this.form.packingUnit, 'this.form.packingUnit');
+            }
           }
+          this.isShow = true;
         }
       },
-      deep: true,
-      immediate: true
-    }
-  },
-  async activated() {
-    this.status = this.$route.query.status;
-    this.form.categoryLevelId = this.$route.query.categoryLevelId;
-    this.form.categoryLevelName = this.$route.query.categoryLevelName;
-    this.form.categoryLevelPath = this.$route.query.categoryLevelPath;
-    this.form.categoryLevelPathId = this.$route.query.categoryLevelPathId;
-
-    this.ruleCode = this.$route.query.ruleCode;
-    if (this.ruleCode && this.ruleCode != '自定义' && this.status != 0) {
-      const code = await getCode(this.ruleCode);
-      this.$set(this.form, 'code', code);
-    }
-
-    this.getFieldModel();
-
-    this.getDictList('productionType');
-  },
-  async created() {
-    //新增
-
-    this.$set(
-      this.form,
-      'categoryLevelId',
-      this.$route.query.categoryLevelId
-    );
-    this.$set(
-      this.form,
-      'categoryLevelName',
-      this.$route.query.categoryLevelName
-    );
-    this.$set(
-      this.form,
-      'categoryLevelPath',
-      this.$route.query.categoryLevelPath
-    );
-    this.$set(
-      this.form,
-      'categoryLevelPathId',
-      this.$route.query.categoryLevelPathId
-    );
-    this.status = this.$route.query.status;
-    this.ruleCode = this.$route.query.ruleCode;
-    if (this.ruleCode && this.ruleCode != '自定义' && this.status != 0) {
-      const code = await getCode(this.ruleCode);
-      this.$set(this.form, 'code', code);
-    }
+      changePackagingSpecification(val) {
+        console.log('changePackagingSpecification---', val);
+        this.packagingSpecificationList = val;
+      },
+      async _getDetails() {
+        const data = await getDetails(this.$route.query.id);
+        const info = deepClone(data);
 
-    this.getFieldModel();
-
-    // if (this.$route.query.id) {
-    //   this._getDetails();
-    // }
-    this.getDictList('productionType');
-  },
-  methods: {
-    changeUnit() {
-      if (this.form.measuringUnit && this.form.packingUnit) {
-        this.$refs.warehouseRefs.defaultBuild(this.form.packingUnit);
-      }
-    },
-    changePackagingSpecification(val) {
-      console.log('changePackagingSpecification---', val);
-      this.packagingSpecificationList = val;
-    },
-    async _getDetails() {
-      const data = await getDetails(this.$route.query.id);
-      const info = deepClone(data);
+        this.form = {
+          ...info.category
+        };
 
-      this.form = {
-        ...info.category
-      };
+        // if (this.form.measuringUnit && this.form.packingUnit) {
+        //   this.$refs.warehouseRefs.defaultBuild(this.form.packingUnit);
+        // }
+        this.categoryLevelPathId = info.category.categoryLevelPathIdParent;
+        this.judgeSet(info);
 
-      this.categoryLevelPathId = info.category.categoryLevelPathIdParent;
-      this.judgeSet(info);
+        if (this.status == 1) {
+          rootCategoryCode(this.categoryLevelPathId).then((res) => {
+            this.$set(this.form, 'code', res);
+          });
 
-      if (this.status == 1) {
-        rootCategoryCode(this.categoryLevelPathId).then((res) => {
-          this.$set(this.form, 'code', res);
-        });
+          this.form.createTime = null;
+        }
 
-        this.form.createTime = null;
-      }
+        this.$forceUpdate();
+      },
+      // 判断字段类型并赋值
+      judgeSet(info) {
+        console.log('info-------', info);
 
-      this.$forceUpdate();
-    },
-    // 判断字段类型并赋值
-    judgeSet(info) {
-      console.log('info-------', info);
-      if (typeof info.categoryAps == 'string') {
-        this.categoryAps = {};
-      } else {
-        this.categoryAps = info.categoryAps;
-      }
-      if (typeof info.categoryMes == 'string') {
-        this.categoryMes = {};
-      } else {
-        this.categoryMes = info.categoryMes;
-      }
-      if (typeof info.categoryMold == 'string') {
-        this.categoryMold = {};
-      } else {
-        this.categoryMold = info.categoryMold;
-      }
-      if (typeof info.categoryPallet == 'string') {
-        this.categoryPallet = {};
-      } else {
-        this.categoryPallet = info.categoryPallet;
-      }
-      if (typeof info.categorySales == 'string') {
-        this.categorySales = {};
-      } else {
-        this.categorySales = info.categorySales;
-      }
+        if (typeof info.categoryAps == 'string') {
+          this.categoryAps = {};
+        } else {
+          this.categoryAps = info.categoryAps;
+        }
+        if (typeof info.categoryMes == 'string') {
+          this.categoryMes = {};
+        } else {
+          this.categoryMes = info.categoryMes;
+        }
+        if (typeof info.categoryMold == 'string') {
+          this.categoryMold = {};
+        } else {
+          this.categoryMold = info.categoryMold;
+        }
+        if (typeof info.categoryPallet == 'string') {
+          this.categoryPallet = {};
+        } else {
+          this.categoryPallet = info.categoryPallet;
+        }
+        if (typeof info.categorySales == 'string') {
+          this.categorySales = {};
+        } else {
+          this.categorySales = info.categorySales;
+        }
 
-      if (typeof info.categoryPurchase == 'string') {
-        this.categoryPurchase = {};
-      } else {
-        this.categoryPurchase = info.categoryPurchase;
-      }
-      if (typeof info.categoryQms == 'string') {
-        this.categoryQms = {};
-      } else {
-        this.categoryQms = info.categoryQms;
-      }
-      if (typeof info.categoryVehicle == 'string') {
-        this.categoryVehicle = {};
-      } else {
-        this.categoryVehicle = info.categoryVehicle;
-      }
-      if (typeof info.categoryWms == 'string') {
-        this.categoryWms = {};
-      } else {
-        this.categoryWms = info.categoryWms;
-      }
-      if (typeof info.packageDispositionVOList == 'string') {
-        this.packageDispositionVOList = [];
-      } else {
-        this.packageDispositionVOList = info.packageDispositionVOList;
-        console.log(
-          'this.packageDispositionVOList---!!!----',
-          this.packageDispositionVOList
-        );
-      }
-    },
+        if (typeof info.categoryPurchase == 'string') {
+          this.categoryPurchase = {};
+        } else {
+          this.categoryPurchase = info.categoryPurchase;
+        }
+        if (typeof info.categoryQms == 'string') {
+          this.categoryQms = {};
+        } else {
+          this.categoryQms = info.categoryQms;
+        }
+        if (typeof info.categoryVehicle == 'string') {
+          this.categoryVehicle = {};
+        } else {
+          this.categoryVehicle = info.categoryVehicle;
+        }
+        if (typeof info.categoryWms == 'string') {
+          this.categoryWms = {};
+        } else {
+          this.categoryWms = info.categoryWms;
+        }
+        if (typeof info.packageDispositionVOList == 'string') {
+          this.packageDispositionVOList = [];
+        } else {
+          this.packageDispositionVOList = info.packageDispositionVOList;
+          console.log(
+            'this.packageDispositionVOList---!!!----',
+            this.packageDispositionVOList
+          );
+        }
+      },
 
-    getFieldModel() {
-      fieldModel({ relevance: 't_main_category' }).then((res) => {
-        this.fileList = res;
+      getFieldModel() {
+        fieldModel({ relevance: 't_main_category' }).then((res) => {
+          this.fileList = res;
 
-        this.fileList.forEach((f) => {
-          this.$set(this.form.extField, f.prop, ''); // 初始化动态模型属性
+          this.fileList.forEach((f) => {
+            this.$set(this.form.extField, f.prop, ''); // 初始化动态模型属性
+          });
         });
-      });
-    },
+      },
 
-    // 确定分类
-    async confirmCategory(node, title, PathInfo, ruleCode) {
-      if (this.status != 0) {
-        this.$set(this.form, 'code', null);
-      }
-      this.categoryLevelPathId = PathInfo.categoryLevelPathId.split(',')[0];
-
-      if (title == '选择产品分类') {
-        this.$set(this.form, 'productCategoryLevelName', node.name);
-        this.$set(this.form, 'productCategoryLevelId', node.id);
-      } else {
-        this.$set(this.form, 'categoryLevelName', node.name);
-        this.$set(this.form, 'categoryLevelId', node.id);
-        this.$set(this.form, 'categoryLevelPath', node.name);
-        this.$set(this.form, 'categoryLevelPathId', node.id);
-        this.PathInfo = PathInfo;
-
-        this.ruleCode = ruleCode;
-
-        if (ruleCode && ruleCode != '自定义' && this.status != 0) {
-          const code = await getCode(ruleCode);
-          this.$set(this.form, 'code', code);
+      // 确定分类
+      async confirmCategory(node, title, PathInfo, ruleCode) {
+        if (this.status != 0) {
+          this.$set(this.form, 'code', null);
         }
-      }
+        this.categoryLevelPathId = PathInfo.categoryLevelPathId.split(',')[0];
 
-      this.$forceUpdate();
-    },
+        if (title == '选择产品分类') {
+          this.$set(this.form, 'productCategoryLevelName', node.name);
+          this.$set(this.form, 'productCategoryLevelId', node.id);
+        } else {
+          this.$set(this.form, 'categoryLevelName', node.name);
+          this.$set(this.form, 'categoryLevelId', node.id);
+          this.$set(this.form, 'categoryLevelPath', node.name);
+          this.$set(this.form, 'categoryLevelPathId', node.id);
+          this.PathInfo = PathInfo;
 
-    async getDictList(code) {
-      let { data: res } = await getByCode(code);
-      this.dictList = res.map((item) => {
-        let values = Object.keys(item);
-        return {
-          value: Number(values[0]),
-          label: item[values[0]]
-        };
-      });
-    },
+          this.ruleCode = ruleCode;
 
-    openCategory() {
-      this.$refs.categoryRefs.open();
-    },
-
-    openCode() {
-      this.codeShow = true;
-    },
+          if (ruleCode && ruleCode != '自定义' && this.status != 0) {
+            const code = await getCode(ruleCode);
+            this.$set(this.form, 'code', code);
+          }
+        }
 
-    chooseCode(code) {
-      this.$set(this.form, 'code', code);
-      this.codeShow = false;
-      this.$forceUpdate();
-    },
+        this.$forceUpdate();
+      },
 
-    cancel() {
-      // finishPageTab();
-      // this.$router.go(-1);
-      if (this.$route.query.rootTreeId == 9) {
-        this.$router.push({
-          path: '/product/oneProduct',
-          query: {
-            categoryLevelId: this.form.categoryLevelId
-          }
-        });
-      } else {
-        this.$router.push({
-          path: '/material/product',
-          query: {
-            categoryLevelId: this.form.categoryLevelId
-          }
+      async getDictList(code) {
+        let { data: res } = await getByCode(code);
+        this.dictList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
         });
-      }
-    },
+      },
 
-    // 保存
-    submit() {
-      this.$refs.manageForm.validate(async (valid) => {
-        let productionValid = await this.$refs.productionRefs.getFormValid();
+      openCategory() {
+        this.$refs.categoryRefs.open();
+      },
 
-        if (!valid || !productionValid) {
-          return false;
-        }
-        
-        let packageDispositionVOList = [];
-        if (this.packagingSpecificationList.length > 0) {
-          packageDispositionVOList = this.packagingSpecificationList.map(
-            (item) => {
-              let obj = {
-                code: item.code,
-                name: item.name
-              };
-              return [
-                {
-                  ...obj,
-                  id: item.id0,
-                  sort: 0,
-                  status: item.status,
-                  packageCell: 1,
-                  packageUnit: item.packageUnit,
-                  conversionUnit: item.packageUnit
-                },
-                {
-                  ...obj,
-                  id: item.id1,
-                  sort: 1,
-                  packageCell: item.minPackageCell,
-                  packageUnit: item.packageUnit,
-                  conversionUnit: item.minConversionUnit,
-                  status: item.status
-                },
-                {
-                  ...obj,
-                  id: item.id2,
-                  sort: 2,
-                  packageCell: item.inPackageCell,
-                  packageUnit: item.minConversionUnit,
-                  conversionUnit: item.inConversionUnit,
-                  status: item.status
-                },
-                {
-                  ...obj,
-                  id: item.id3,
-                  sort: 3,
-                  packageCell: item.outPackageCell,
-                  packageUnit: item.inConversionUnit,
-                  conversionUnit: item.outConversionUnit,
-                  status: item.status
-                }
-              ];
+      openCode() {
+        this.codeShow = true;
+      },
+
+      chooseCode(code) {
+        this.$set(this.form, 'code', code);
+        this.codeShow = false;
+        this.$forceUpdate();
+      },
+
+      cancel() {
+        // finishPageTab();
+        // this.$router.go(-1);
+        if (this.$route.query.rootTreeId == 9) {
+          this.$router.push({
+            path: '/product/oneProduct',
+            query: {
+              categoryLevelId: this.form.categoryLevelId
             }
-          );
-          let packagingSpecificationList =
-            this.packagingSpecificationList.filter(
-              (item) => item.status == 1
-            );
-          this.form.extField.packingSpecification = packagingSpecificationList
-            .map((item) => {
-              return [
-                `${item.minPackageCell}${item.packageUnit}/${item.minConversionUnit}`,
-                `${item.inPackageCell}${item.minConversionUnit}/${item.inConversionUnit}`,
-                `${item.outPackageCell}${item.inConversionUnit}/${item.outConversionUnit}`
-              ];
-            })
-            .flat()
-            .join(',');
+          });
         } else {
-          this.form.extField.packingSpecification = '';
+          this.$router.push({
+            path: '/material/product',
+            query: {
+              categoryLevelId: this.form.categoryLevelId
+            }
+          });
         }
+      },
 
-        this.loading = true;
-        // const imgList = this.remarkform.imgList;
-        // const arr = [];
-        // if (imgList.length) {
-        //   imgList.map((item) => {
-        //     arr.push(item.storePath);
-        //   });
-        //   this.form.remarkAttach = arr.join(',');
-        // }
-        // this.form.remark = this.remarkform.remark
-        //   ? this.remarkform.remark
-        //   : '';
-
-        const data = {
-          categorySales: this.categorySales,
-          categoryPurchase: this.categoryPurchase,
-          categoryWms: this.categoryWms,
-          categoryAps: this.categoryAps,
-          categoryMes: this.categoryMes,
-          categoryMold: this.categoryMold,
-          categoryPallet: this.categoryPallet,
-          categoryQms: this.categoryQms,
-          categoryVehicle: this.categoryVehicle,
-          category: {
-            ...this.form,
-            ...this.remarkform,
-            ...this.PathInfo
-          },
-          packageDispositionVOList: packageDispositionVOList.flat()
-        };
+      // 保存
+      submit() {
+        this.$refs.manageForm.validate(async (valid) => {
+          let productionValid = await this.$refs.productionRefs.getFormValid();
+          let warehouseValid = await this.$refs.warehouseRefs.getFormValid();
 
-        if (this.$route.query.status == 1) {
-          data.categorySales.id = null;
-          data.categoryPurchase.id = null;
-          data.category.id = null;
-          data.categoryWms.id = null;
-          data.categoryAps.id = null;
-          data.categoryMes.id = null;
-          data.categoryMold.id = null;
-          data.categoryPallet.id = null;
-          data.categoryQms.id = null;
-          data.categoryVehicle.id = null;
-          data.packageDispositionVOList = data.packageDispositionVOList.map(
-            (item) => {
-              return {
-                ...item,
-                id: null
-              };
-            }
-          );
-        }
-        console.log('保存', data);
-        addMaterial(data)
-          .then((msg) => {
-            this.loading = false;
-            this.$message.success(msg);
-            // reloadPageTab({ fullPath: '/material/product' });
-            // this.$router.go(-1);
-            this.cancel();
-            // if (this.$route.query.rootTreeId == 9) {
-            //   this.$router.push({
-            //     path: '/product/oneProduct',
-            //     query: {
-            //       categoryLevelId: this.form.categoryLevelId
-            //     }
-            //   });
-            // } else {
-            //   this.$router.push({
-            //     path: '/material/product',
-            //     query: {
-            //       categoryLevelId: this.form.categoryLevelId
-            //     }
-            //   });
-            // }
-          })
-          .catch((e) => {
-            this.loading = false;
-          });
-      });
+          if (!valid || !productionValid || !warehouseValid) {
+            return false;
+          }
+
+          let packageDispositionVOList = [];
+          if (this.packagingSpecificationList.length > 0) {
+            packageDispositionVOList = this.packagingSpecificationList.map(
+              (item) => {
+                let obj = {
+                  code: item.code,
+                  name: item.name
+                };
+                return [
+                  {
+                    ...obj,
+                    id: item.id0,
+                    sort: 0,
+                    status: item.status,
+                    packageCell: 1,
+                    packageUnit: item.packageUnit,
+                    conversionUnit: item.packageUnit
+                  },
+                  {
+                    ...obj,
+                    id: item.id1,
+                    sort: 1,
+                    packageCell: item.minPackageCell,
+                    packageUnit: item.packageUnit,
+                    conversionUnit: item.minConversionUnit,
+                    status: item.status
+                  },
+                  {
+                    ...obj,
+                    id: item.id2,
+                    sort: 2,
+                    packageCell: item.inPackageCell,
+                    packageUnit: item.minConversionUnit,
+                    conversionUnit: item.inConversionUnit,
+                    status: item.status
+                  },
+                  {
+                    ...obj,
+                    id: item.id3,
+                    sort: 3,
+                    packageCell: item.outPackageCell,
+                    packageUnit: item.inConversionUnit,
+                    conversionUnit: item.outConversionUnit,
+                    status: item.status
+                  }
+                ];
+              }
+            );
+            let packagingSpecificationList =
+              this.packagingSpecificationList.filter(
+                (item) => item.status == 1
+              );
+            this.form.extField.packingSpecification = packagingSpecificationList
+              .map((item) => {
+                return [
+                  `${item.minPackageCell}${item.packageUnit}/${item.minConversionUnit}`,
+                  `${item.inPackageCell}${item.minConversionUnit}/${item.inConversionUnit}`,
+                  `${item.outPackageCell}${item.inConversionUnit}/${item.outConversionUnit}`
+                ];
+              })
+              .flat()
+              .join(',');
+          } else {
+            this.form.extField.packingSpecification = '';
+          }
+
+          this.loading = true;
+          // const imgList = this.remarkform.imgList;
+          // const arr = [];
+          // if (imgList.length) {
+          //   imgList.map((item) => {
+          //     arr.push(item.storePath);
+          //   });
+          //   this.form.remarkAttach = arr.join(',');
+          // }
+          // this.form.remark = this.remarkform.remark
+          //   ? this.remarkform.remark
+          //   : '';
+
+          const data = {
+            categorySales: this.categorySales,
+            categoryPurchase: this.categoryPurchase,
+            categoryWms: this.categoryWms,
+            categoryAps: this.categoryAps,
+            categoryMes: this.categoryMes,
+            categoryMold: this.categoryMold,
+            categoryPallet: this.categoryPallet,
+            categoryQms: this.categoryQms,
+            categoryVehicle: this.categoryVehicle,
+            category: {
+              ...this.form,
+              ...this.remarkform,
+              ...this.PathInfo
+            },
+            packageDispositionVOList: packageDispositionVOList.flat()
+          };
+
+          if (this.$route.query.status == 1) {
+            data.categorySales.id = null;
+            data.categoryPurchase.id = null;
+            data.category.id = null;
+            data.categoryWms.id = null;
+            data.categoryAps.id = null;
+            data.categoryMes.id = null;
+            data.categoryMold.id = null;
+            data.categoryPallet.id = null;
+            data.categoryQms.id = null;
+            data.categoryVehicle.id = null;
+            data.packageDispositionVOList = data.packageDispositionVOList.map(
+              (item) => {
+                return {
+                  ...item,
+                  id: null
+                };
+              }
+            );
+          }
+          console.log('保存', data);
+          addMaterial(data)
+            .then((msg) => {
+              this.loading = false;
+              this.$message.success(msg);
+              // reloadPageTab({ fullPath: '/material/product' });
+              // this.$router.go(-1);
+              this.cancel();
+              // if (this.$route.query.rootTreeId == 9) {
+              //   this.$router.push({
+              //     path: '/product/oneProduct',
+              //     query: {
+              //       categoryLevelId: this.form.categoryLevelId
+              //     }
+              //   });
+              // } else {
+              //   this.$router.push({
+              //     path: '/material/product',
+              //     query: {
+              //       categoryLevelId: this.form.categoryLevelId
+              //     }
+              //   });
+              // }
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped>
-.ele-page-header {
-  border: none;
-}
-
-.body-top {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
-  background: #fff;
+  .ele-page-header {
+    border: none;
+  }
 
-  .top-left {
+  .body-top {
     display: flex;
     align-items: center;
-    justify-content: flex-start;
-    margin-left: -25px;
+    justify-content: space-between;
+    background: #fff;
+
+    .top-left {
+      display: flex;
+      align-items: center;
+      justify-content: flex-start;
+      margin-left: -25px;
 
-    .el-form-item {
-      margin-bottom: 0;
+      .el-form-item {
+        margin-bottom: 0;
+      }
     }
   }
-}
 
-.divider {
-  margin: 20px 0;
+  .divider {
+    margin: 20px 0;
 
-  .title {
-    display: flex;
-    align-items: center;
-    margin-bottom: 10px;
+    .title {
+      display: flex;
+      align-items: center;
+      margin-bottom: 10px;
 
-    div {
-      width: 8px;
-      height: 20px;
-      margin-right: 10px;
-    }
+      div {
+        width: 8px;
+        height: 20px;
+        margin-right: 10px;
+      }
 
-    span {
-      font-size: 20px;
+      span {
+        font-size: 20px;
+      }
     }
-  }
 
-  .ele-width {
-    width: 100%;
-    height: 2px;
+    .ele-width {
+      width: 100%;
+      height: 2px;
+    }
   }
-}
 
-.form-line {
-  display: flex;
-  align-items: center;
-  justify-content: space-between;
+  .form-line {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
 
-  .line-select {
-    margin-left: 15px;
+    .line-select {
+      margin-left: 15px;
+    }
   }
-}
 </style>

+ 18 - 23
src/views/rulesManagement/earlyWarningRules/components/matter-add.vue

@@ -248,7 +248,8 @@
 <script>
   import { deepClone } from '@/utils/index';
   import {
-    saveOrUpdate,
+    rulesSave,
+    rulesUpdate,
     getCode,
     getDetail
   } from '@/api/ruleManagement/earlyWarning';
@@ -360,18 +361,7 @@
     },
     methods: {
       handleInput(value) {
-        //表单输入框 只保留数字和小数点
-        // const filteredValue = value.replace(/[^0-9.]/g, '');
-        // let finalValue = '';
-        // const dotIndex = filteredValue.indexOf('.');
-        // if (dotIndex !== -1) {
-        //   finalValue = filteredValue.slice(0, dotIndex + 3);
-        // } else {
-        //   finalValue = filteredValue;
-        // }
-
-        // 只能输入数字
-        this.formData.alertCycleValue = value.replace(/[^0-9]/g, '');
+        this.formData.alertCycleValue = this.$handleInputPublic(value);
       },
       handleInputByTable(value, index) {
         // 表内限制输入框 只保留数字和小数点
@@ -387,6 +377,7 @@
       },
 
       handleAddInfo(row, index) {
+        this.NumberOfPeople = '';
         this.formData.actionList[index].targetAddress = '';
         this.formData.actionList[index].targetAddressName = '';
         this.$refs.selectPersonDialogRef.open(row, index);
@@ -436,17 +427,14 @@
       },
       async openDialog(row, type) {
         this.isBindPlan = type;
-        // await this.getAllData();
-        if (type != 'add') {
+        if (type == 'edit' || type == 'clone') {
           this.getRuleInfo(row.id, type);
-        } else {
-          this.$set(this.formData, 'enabled', 1);
-          this.$refs.contentConfigForm &&
-            this.$refs.contentConfigForm.resetFields();
         }
-        if (type != 'edit') {
+        if (type == 'add') {
+          console.log('add');
           this.getOrderCode();
         }
+
         this.addMatterDialog = true;
       },
 
@@ -481,10 +469,15 @@
       },
 
       handleClose() {
-        this.formData = {};
+        this.NumberOfPeople = '';
+        this.formData = {
+          ruleCode: '',
+          ruleName: '',
+          ruleObjCode: '',
+          alertCycleUnit: ''
+        };
         this.formData.actionList = [];
         this.addMatterDialog = false;
-        this.$emit('handleClose');
       },
       addItem() {
         if (this.formData.actionList) {
@@ -525,7 +518,9 @@
         }
         this.$refs.contentConfigForm.validate(async (valid) => {
           if (valid) {
-            let res = await saveOrUpdate(form);
+            let request = this.isBindPlan != 'add' ? rulesUpdate : rulesSave;
+
+            let res = await request(form);
             if (res) {
               this.$message.success('操作成功!');
               this.handleClose();

+ 15 - 9
src/views/rulesManagement/earlyWarningRules/components/matter-search.vue

@@ -9,12 +9,20 @@
     <el-row :gutter="24">
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="规则名称:">
-          <el-input clearable v-model.trim="where.name" placeholder="请输入" />
+          <el-input
+            clearable
+            v-model.trim="where.ruleName"
+            placeholder="请输入"
+          />
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="规则编码:">
-          <el-input clearable v-model.trim="where.code" placeholder="请输入" />
+          <el-input
+            clearable
+            v-model.trim="where.ruleCode"
+            placeholder="请输入"
+          />
         </el-form-item>
       </el-col>
       <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
@@ -37,7 +45,7 @@
           <DictSelection
             dictName="规则状态"
             clearable
-            v-model.trim="where.status"
+            v-model.trim="where.enabled"
           >
           </DictSelection>
         </el-form-item>
@@ -72,13 +80,11 @@
     data() {
       // 默认表单数据
       const defaultWhere = {
-        name: '',
-        code: '',
-        userName: '',
-        type: '',
-        status: '',
+        ruleCode: '',
+        ruleName: '',
         startTime: '',
-        endTime: ''
+        endTime: '',
+        enabled: ''
       };
       return {
         // 表单数据

+ 6 - 2
src/views/rulesManagement/earlyWarningRules/details.vue

@@ -88,7 +88,7 @@
             />
             <el-table-column
               align="center"
-              prop="alertLevel"
+              prop="alertLevelName"
               label="预警级别"
               width="120"
             />
@@ -182,7 +182,11 @@
               ele.actionTypeName = this.operationTypeData[key];
             }
           }
-
+          for (const key in this.allAlertLevelData) {
+            if (key == ele.alertLevel) {
+              ele.alertLevelName = this.allAlertLevelData[key];
+            }
+          }
           this.templateData.forEach((item) => {
             if (item.code == ele.alertMessageTempateCode) {
               ele.alertMessageTempateCodeName = item.name + '-' + item.code;