Ver Fonte

出入库策略配置界面

andy há 3 anos atrás
pai
commit
decb0d4de3
1 ficheiros alterados com 265 adições e 233 exclusões
  1. 265 233
      ruoyi-ui/src/views/ams/locationPriority/index.vue

+ 265 - 233
ruoyi-ui/src/views/ams/locationPriority/index.vue

@@ -25,7 +25,8 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['ams:locationPriority:add']"
-        >新增</el-button>
+        >新增
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -36,7 +37,8 @@
           :disabled="single"
           @click="handleUpdate"
           v-hasPermi="['ams:locationPriority:edit']"
-        >修改</el-button>
+        >修改
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -47,23 +49,24 @@
           :disabled="multiple"
           @click="handleDelete"
           v-hasPermi="['ams:locationPriority:remove']"
-        >删除</el-button>
+        >删除
+        </el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
     <el-table v-loading="loading" :data="locationPriorityList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="编号" align="center" prop="id" />
-      <el-table-column label="名称" align="center" prop="flowName" />
-      <el-table-column label="所属区域" align="center" prop="locationZoneName" />
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="编号" align="center" prop="id"/>
+      <el-table-column label="名称" align="center" prop="flowName"/>
+      <el-table-column label="所属区域" align="center" prop="locationZoneName"/>
       <el-table-column label="状态" align="center" prop="status">
         <template slot-scope="scope">
           <div v-if="scope.row.status === 0">启用</div>
           <div v-if="scope.row.status === 1">禁用</div>
         </template>
       </el-table-column>
-      <el-table-column label="备注" align="center" prop="remark" />
+      <el-table-column label="备注" align="center" prop="remark"/>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -72,14 +75,16 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['ams:locationPriority:edit']"
-          >修改</el-button>
+          >修改
+          </el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['ams:locationPriority:remove']"
-          >删除</el-button>
+          >删除
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -98,7 +103,7 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="名称" prop="flowName">
-              <el-input v-model="form.flowName" placeholder="请输入名称" />
+              <el-input v-model="form.flowName" placeholder="请输入名称"/>
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -155,14 +160,15 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="并行数量" prop="parallelCount">
-              <el-input v-model="form.parallelCount" :disabled="form.parallelFlag !== 'Y'" placeholder="请输入并行数量" />
+              <el-input v-model="form.parallelCount" :disabled="form.parallelFlag !== 'Y'" placeholder="请输入并行数量"/>
             </el-form-item>
           </el-col>
         </el-row>
         <el-row>
           <el-col :span="12">
             <el-form-item label="近效期" prop="periodFlag">
-              <el-select v-model="form.periodFlag" placeholder="请选择" clearable size="small" style="width: 100%">
+              <el-select v-model="form.periodFlag" placeholder="请选择" clearable size="small" style="width: 100%"
+                         @change="choseOne($event,'periodFlag')">
                 <el-option
                   v-for="dict in dict.type.sys_yes_no"
                   :key="dict.value"
@@ -174,7 +180,8 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="同属性出库" prop="sameLotattFlag">
-              <el-select v-model="form.sameLotattFlag" placeholder="请选择" clearable size="small" style="width: 100%">
+              <el-select v-model="form.sameLotattFlag" placeholder="请选择" clearable size="small" style="width: 100%"
+                         @change="choseOne($event,'sameLotattFlag')">
                 <el-option
                   v-for="dict in dict.type.sys_yes_no"
                   :key="dict.value"
@@ -188,7 +195,8 @@
         <el-row>
           <el-col :span="12">
             <el-form-item label="外围优先" prop="outerFlag">
-              <el-select v-model="form.outerFlag" placeholder="请选择" clearable size="small" style="width: 100%">
+              <el-select v-model="form.outerFlag" placeholder="请选择" clearable size="small" style="width: 100%"
+                         @change="choseOne($event,'outerFlag')">
                 <el-option
                   v-for="dict in dict.type.sys_yes_no"
                   :key="dict.value"
@@ -200,7 +208,7 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="备注" prop="remark">
-              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
+              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
             </el-form-item>
           </el-col>
         </el-row>
@@ -223,20 +231,23 @@
         <el-divider content-position="center">信息</el-divider>
         <el-row :gutter="10" class="mb8">
           <el-col :span="1.5">
-            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddLocationPriorityDetails">添加</el-button>
+            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddLocationPriorityDetails">添加
+            </el-button>
           </el-col>
           <el-col :span="1.5">
-            <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteLocationPriorityDetails">删除</el-button>
+            <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteLocationPriorityDetails">删除
+            </el-button>
           </el-col>
         </el-row>
-        <el-table :data="locationPriorityDetailsList" :row-class-name="rowLocationPriorityDetailsIndex" @selection-change="handleLocationPriorityDetailsSelectionChange" ref="locationPriorityDetails">
-          <el-table-column type="selection" width="50" align="center" />
+        <el-table :data="locationPriorityDetailsList" :row-class-name="rowLocationPriorityDetailsIndex"
+                  @selection-change="handleLocationPriorityDetailsSelectionChange" ref="locationPriorityDetails">
+          <el-table-column type="selection" width="50" align="center"/>
           <el-table-column label="序号" align="center" prop="index" width="50"/>
           <el-table-column label="批次属性" prop="lotattName"/>
           <el-table-column label="属性值" prop="lotattValue">
             <template slot-scope="scope">
               <div v-if="scope.row.inputType === 'Text'">
-                <el-input v-model="scope.row.lotattValue" placeholder="" />
+                <el-input v-model="scope.row.lotattValue" placeholder=""/>
               </div>
               <div v-if="scope.row.inputType === 'Datebox'">
                 <el-date-picker v-model="scope.row.lotattValue" type="date" placeholder="" style="width: 100%"/>
@@ -264,226 +275,247 @@
 </template>
 
 <script>
-import { listLocationPriority, getLocationPriority, delLocationPriority, addLocationPriority, updateLocationPriority, listLotattConfig } from "@/api/ams/locationPriority";
-import { querySkuDict } from "@/api/base/baseSku";
-import { queryLocationZoneDict } from "@/api/base/locationZone";
+  import {
+    listLocationPriority,
+    getLocationPriority,
+    delLocationPriority,
+    addLocationPriority,
+    updateLocationPriority,
+    listLotattConfig
+  } from "@/api/ams/locationPriority";
+  import {querySkuDict} from "@/api/base/baseSku";
+  import {queryLocationZoneDict} from "@/api/base/locationZone";
 
-export default {
-  name: "LocationPriority",
-  dicts: ['sys_yes_no', 'ams_inv_quality'],
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 子表选中数据
-      checkedLocationPriorityDetails: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 路径规划表格数据
-      locationPriorityList: [],
-      // 路径规划表格数据
-      locationPriorityDetailsList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        flowName: null,
-        locationZone: null,
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-        flowName: [
-          { required: true, message: "名称不能为空", trigger: "blur" }
-        ],
-        locationZone: [
-          { required: true, message: "所属区域不能为空", trigger: "blur" }
-        ],
-        sku: [
-          { required: true, message: "物料不能为空", trigger: "blur" }
-        ]
-      },
-      locationZoneCombo: [],
-      skuCombo: []
-    };
-  },
-  created() {
-    this.init();
-    this.getList();
-  },
-  methods: {
-    init() {
-      // 区域
-      queryLocationZoneDict().then(response => {
-        this.locationZoneCombo = response.data
-      });
-      // 物料
-      querySkuDict().then(response => {
-        this.skuCombo = response.data
-      });
-    },
-    /** 查询列表 */
-    getList() {
-      this.loading = true;
-      listLocationPriority(this.queryParams).then(response => {
-        this.locationPriorityList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        id: null,
-        flowName: null,
-        locationZone: null,
-        mixedFlag: 'N',
-        parallelFlag: 'N',
-        parallelCount: null,
-        outerFlag: 'N',
-        periodFlag: 'N',
-        sameLotattFlag: 'N',
-        status: 0,
-        userdefine1: null,
-        userdefine2: null,
-        userdefine3: null,
-        userdefine4: null,
-        userdefine5: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null,
-        remark: null,
-        sku: null
+  export default {
+    name: "LocationPriority",
+    dicts: ['sys_yes_no', 'ams_inv_quality'],
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 选中数组
+        ids: [],
+        // 子表选中数据
+        checkedLocationPriorityDetails: [],
+        // 非单个禁用
+        single: true,
+        // 非多个禁用
+        multiple: true,
+        // 显示搜索条件
+        showSearch: true,
+        // 总条数
+        total: 0,
+        // 路径规划表格数据
+        locationPriorityList: [],
+        // 路径规划表格数据
+        locationPriorityDetailsList: [],
+        // 弹出层标题
+        title: "",
+        // 是否显示弹出层
+        open: false,
+        // 查询参数
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          flowName: null,
+          locationZone: null,
+        },
+        // 表单参数
+        form: {},
+        // 表单校验
+        rules: {
+          flowName: [
+            {required: true, message: "名称不能为空", trigger: "blur"}
+          ],
+          locationZone: [
+            {required: true, message: "所属区域不能为空", trigger: "blur"}
+          ],
+          sku: [
+            {required: true, message: "物料不能为空", trigger: "blur"}
+          ]
+        },
+        locationZoneCombo: [],
+        skuCombo: []
       };
-      this.locationPriorityDetailsList = [];
-      this.resetForm("form");
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
+    created() {
+      this.init();
       this.getList();
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加出入库策略";
-      // 加载批次属性明细
-      listLotattConfig().then(response => {
-        this.locationPriorityDetailsList = response.data;
-        for(let i=0;i<this.locationPriorityDetailsList.length;i++) {
-          console.log(this.locationPriorityDetailsList[i].defaultValue)
-          this.locationPriorityDetailsList[i].lotattValue = this.locationPriorityDetailsList[i].defaultValue
-        }
-      });
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const id = row.id || this.ids
-      getLocationPriority(id).then(response => {
-        this.form = response.data;
-        this.form.locationZone = parseInt(this.form.locationZone)
-        this.locationPriorityDetailsList = response.data.locationPriorityDetailsList;
+    methods: {
+      init() {
+        // 区域
+        queryLocationZoneDict().then(response => {
+          this.locationZoneCombo = response.data
+        });
+        // 物料
+        querySkuDict().then(response => {
+          this.skuCombo = response.data
+        });
+      },
+      /** 查询列表 */
+      getList() {
+        this.loading = true;
+        listLocationPriority(this.queryParams).then(response => {
+          this.locationPriorityList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      },
+      // 取消按钮
+      cancel() {
+        this.open = false;
+        this.reset();
+      },
+      // 表单重置
+      reset() {
+        this.form = {
+          id: null,
+          flowName: null,
+          locationZone: null,
+          mixedFlag: 'N',
+          parallelFlag: 'N',
+          parallelCount: null,
+          outerFlag: 'N',
+          periodFlag: 'N',
+          sameLotattFlag: 'N',
+          status: 0,
+          userdefine1: null,
+          userdefine2: null,
+          userdefine3: null,
+          userdefine4: null,
+          userdefine5: null,
+          createBy: null,
+          createTime: null,
+          updateBy: null,
+          updateTime: null,
+          remark: null,
+          sku: null
+        };
+        this.locationPriorityDetailsList = [];
+        this.resetForm("form");
+      },
+      /** 搜索按钮操作 */
+      handleQuery() {
+        this.queryParams.pageNum = 1;
+        this.getList();
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      },
+      // 多选框选中数据
+      handleSelectionChange(selection) {
+        this.ids = selection.map(item => item.id)
+        this.single = selection.length !== 1
+        this.multiple = !selection.length
+      },
+      /** 新增按钮操作 */
+      handleAdd() {
+        this.reset();
         this.open = true;
-        this.title = "修改出入库策略";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          this.form.locationPriorityDetailsList = this.locationPriorityDetailsList;
-          if (this.form.id != null) {
-            updateLocationPriority(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addLocationPriority(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
+        this.title = "添加出入库策略";
+        // 加载批次属性明细
+        listLotattConfig().then(response => {
+          this.locationPriorityDetailsList = response.data;
+          for (let i = 0; i < this.locationPriorityDetailsList.length; i++) {
+            console.log(this.locationPriorityDetailsList[i].defaultValue)
+            this.locationPriorityDetailsList[i].lotattValue = this.locationPriorityDetailsList[i].defaultValue
           }
-        }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除出入库策略编号为"' + ids + '"的数据项?').then(function() {
-        return delLocationPriority(ids);
-      }).then(() => {
-        this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
-    },
-	/** 出入库策略序号 */
-    rowLocationPriorityDetailsIndex({ row, rowIndex }) {
-      row.index = rowIndex + 1;
-    },
-    /** 出入库策略添加按钮操作 */
-    handleAddLocationPriorityDetails() {
-      let obj = {};
-      obj.lotattId = "";
-      obj.lotattValue = "";
-      obj.remark = "";
-      this.locationPriorityDetailsList.push(obj);
-    },
-    /** 出入库策略删除按钮操作 */
-    handleDeleteLocationPriorityDetails() {
-      if (this.checkedLocationPriorityDetails.length == 0) {
-        this.$modal.msgError("请先选择要删除的出入库策略数据");
-      } else {
-        const locationPriorityDetailsList = this.locationPriorityDetailsList;
-        const checkedLocationPriorityDetails = this.checkedLocationPriorityDetails;
-        this.locationPriorityDetailsList = locationPriorityDetailsList.filter(function(item) {
-          return checkedLocationPriorityDetails.indexOf(item.index) == -1
         });
+      },
+      /** 修改按钮操作 */
+      handleUpdate(row) {
+        this.reset();
+        const id = row.id || this.ids
+        getLocationPriority(id).then(response => {
+          this.form = response.data;
+          this.form.locationZone = parseInt(this.form.locationZone)
+          this.locationPriorityDetailsList = response.data.locationPriorityDetailsList;
+          this.open = true;
+          this.title = "修改出入库策略";
+        });
+      },
+      /** 提交按钮 */
+      submitForm() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            this.form.locationPriorityDetailsList = this.locationPriorityDetailsList;
+            if (this.form.id != null) {
+              updateLocationPriority(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              addLocationPriority(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
+          }
+        });
+      },
+      /** 删除按钮操作 */
+      handleDelete(row) {
+        const ids = row.id || this.ids;
+        this.$modal.confirm('是否确认删除出入库策略编号为"' + ids + '"的数据项?').then(function () {
+          return delLocationPriority(ids);
+        }).then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        }).catch(() => {
+        });
+      },
+      /** 出入库策略序号 */
+      rowLocationPriorityDetailsIndex({row, rowIndex}) {
+        row.index = rowIndex + 1;
+      },
+      /** 出入库策略添加按钮操作 */
+      handleAddLocationPriorityDetails() {
+        let obj = {};
+        obj.lotattId = "";
+        obj.lotattValue = "";
+        obj.remark = "";
+        this.locationPriorityDetailsList.push(obj);
+      },
+      /** 出入库策略删除按钮操作 */
+      handleDeleteLocationPriorityDetails() {
+        if (this.checkedLocationPriorityDetails.length == 0) {
+          this.$modal.msgError("请先选择要删除的出入库策略数据");
+        } else {
+          const locationPriorityDetailsList = this.locationPriorityDetailsList;
+          const checkedLocationPriorityDetails = this.checkedLocationPriorityDetails;
+          this.locationPriorityDetailsList = locationPriorityDetailsList.filter(function (item) {
+            return checkedLocationPriorityDetails.indexOf(item.index) == -1
+          });
+        }
+      },
+      /** 复选框选中数据 */
+      handleLocationPriorityDetailsSelectionChange(selection) {
+        this.checkedLocationPriorityDetails = selection.map(item => item.index)
+      },
+      /** 导出按钮操作 */
+      handleExport() {
+        this.download('ams/locationPriority/export', {
+          ...this.queryParams
+        }, `locationPriority_${new Date().getTime()}.xlsx`)
+      },
+      choseOne(e, current) {
+        let tag = 'N';
+        if (current === 'periodFlag') {
+          this.form.sameLotattFlag = tag
+          this.form.outerFlag = tag
+        } else if (current === 'sameLotattFlag') {
+          this.form.periodFlag = tag
+          this.form.outerFlag = tag
+        } else if (current === 'outerFlag') {
+          this.form.sameLotattFlag = tag
+          this.form.periodFlag = tag
+        }
       }
-    },
-    /** 复选框选中数据 */
-    handleLocationPriorityDetailsSelectionChange(selection) {
-      this.checkedLocationPriorityDetails = selection.map(item => item.index)
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('ams/locationPriority/export', {
-        ...this.queryParams
-      }, `locationPriority_${new Date().getTime()}.xlsx`)
     }
-  }
-};
+  };
 </script>