Browse Source

库区管理模块

Qukatie 1 week ago
parent
commit
99ee6076ce

+ 38 - 0
src/api/tirePartsMall/basicData/reservoirArea/index.js

@@ -0,0 +1,38 @@
+import request from '@/router/axios';
+//查询列表
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/blade-sales-part/reservoirarea/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+//删除
+export const remove = (ids) => {
+  return request({
+    url: '/api/blade-sales-part/reservoirarea/remove',
+    method: 'post',
+    params: {
+      ids
+    }
+  })
+}
+
+export const submit = (data) => {
+  return request({
+    url: '/api/blade-sales-part/reservoirarea/submit',
+    method: 'POST',
+    data: data
+  })
+}
+export const getDetails = (data) => {
+  return request({
+    url: '/api/blade-sales-part/reservoirarea/detail',
+    method: 'get',
+    params: data
+  })
+}

+ 3 - 0
src/enums/column-name.js

@@ -2087,6 +2087,9 @@ const columnName = [{
 },{
   code: 478,
   name: '中心仓库-入库管理-费用明细'
+},{
+  code: 479,
+  name: '基础资料L-库区管理-列表页'
 }
 ]
 export const getColumnName = (key) => {

+ 14 - 1
src/router/views/index.js

@@ -2530,7 +2530,7 @@ export default [{
   hidden: true,
   children: [{
     path: '/tirePartsMall/basicData/warehouse/index',
-    name: '仓库',
+    name: '仓库管理',
     meta: {
       i18n: '/tirePartsMall/basicData/warehouse/index',
       keepAlive: true,
@@ -2538,6 +2538,19 @@ export default [{
     component: () => import( /* webpackChunkName: "views" */ '@/views/tirePartsMall/basicData/warehouse/index')
   }]
 }, {
+  path: '/tirePartsMall/basicData/reservoirArea/index',
+  component: Layout,
+  hidden: true,
+  children: [{
+    path: '/tirePartsMall/basicData/reservoirArea/index',
+    name: '库区管理',
+    meta: {
+      i18n: '/tirePartsMall/basicData/reservoirArea/index',
+      keepAlive: true,
+    },
+    component: () => import( /* webpackChunkName: "views" */ '@/views/tirePartsMall/basicData/reservoirArea/index')
+  }]
+}, {
   path: '/tirePartsMall/basicData/brandPage/index',
   component: Layout,
   hidden: true,

+ 1 - 3
src/views/system/user.vue

@@ -91,11 +91,9 @@
                 v-model="form.storageName"
                 placeholder="仓库"
                 label="cname"
-                res="records"
                 :disabled="disabled"
-                url="/blade-sales-part/storageDesc/list?current=1&size=5"
+                url="/blade-sales-part/storageDesc/listAll"
                 :filterable="true"
-                :remote="true"
                 dataName="cname"
                 :multiple="true"
                 :collapseTags="true"

+ 308 - 0
src/views/tirePartsMall/basicData/reservoirArea/index.vue

@@ -0,0 +1,308 @@
+<template>
+  <div>
+    <basic-container class="page-crad">
+      <el-row>
+        <el-col :span="4">
+          <avue-tree ref="tree" :option="treeOption" :data="treeData" @node-click="nodeClick" style="height:73vh;"> </avue-tree>
+        </el-col>
+        <el-col :span="20">
+          <avue-crud
+            :option="option"
+            :table-loading="loading"
+            :data="data"
+            :page.sync="page"
+            :permission="permissionList"
+            :before-open="beforeOpen"
+            v-model="form"
+            ref="crud"
+            @row-update="rowUpdate"
+            @row-save="rowSave"
+            @row-del="rowDel"
+            @search-change="searchChange"
+            @search-reset="searchReset"
+            @selection-change="selectionChange"
+            @current-change="currentChange"
+            @size-change="sizeChange"
+            @refresh-change="refreshChange"
+            @on-load="onLoad"
+            @resetColumn="resetColumn('crud', 'option', 'optionList', 479)"
+            @saveColumn="saveColumn('crud', 'option', 'optionList', 479)"
+          >
+            <template slot-scope="{ type, size, row, $index }" slot="menuLeft">
+              <el-button icon="el-icon-plus" type="primary" :size="size" @click="addRow">新增</el-button>
+            </template>
+          </avue-crud>
+          <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
+            <el-button type="text" size="small" icon="el-icon-delete" @click="rowDel(row)">删 除 </el-button>
+          </template>
+          <template slot-scope="{ row, index }" slot="code">
+            <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row)">{{ row.code }} </span>
+          </template>
+          <template slot="status" slot-scope="{ row, size }">
+            <span v-if="row.status === 1">提交</span>
+            <span v-if="row.status === 0">保存</span>
+          </template>
+        </el-col>
+      </el-row>
+    </basic-container>
+  </div>
+</template>
+
+<script>
+import { getList, getDetails, submit, remove } from "@/api/tirePartsMall/basicData/reservoirArea/index.js";
+import { customerListAll } from "@/api/tirePartsMall/basicData/warehouse";
+export default {
+  data() {
+    return {
+      treeOption: {
+        addBtn: false,
+        menu: false,
+        size: "small",
+        props: {
+          labelText: "标题",
+          label: "cname",
+          value: "id"
+        }
+      },
+      treeData: [],
+      form: {
+        status: 1
+      },
+      query: {},
+      loading: true,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0
+      },
+      selectionList: [],
+      option: {
+        height: "auto",
+        calcHeight: 30,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 12,
+        border: true,
+        index: true,
+        viewBtn: true,
+        selection: true,
+        dialogClickModal: false,
+        addBtn: false,
+        align: "center",
+        column: [
+          {
+            label: "库区编码",
+            prop: "code",
+            search: true
+          },
+          {
+            label: "库区名称",
+            prop: "cname",
+            search: true
+          },
+          {
+            label: "备注",
+            prop: "remarks"
+          }
+        ]
+      },
+      optionList: {
+        height: "auto",
+        calcHeight: 30,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 12,
+        border: true,
+        index: true,
+        viewBtn: true,
+        selection: true,
+        dialogClickModal: false,
+        addBtn: false,
+        align: "center",
+        column: [
+          {
+            label: "库区编码",
+            prop: "code",
+            search: true
+          },
+          {
+            label: "库区名称",
+            prop: "cname",
+            search: true
+          },
+          {
+            label: "备注",
+            prop: "remarks"
+          }
+        ]
+      },
+      data: []
+    };
+  },
+  async created() {
+    this.option = await this.getColumnData(this.getColumnName(479), this.optionList);
+    this.getStorageTree();
+  },
+  computed: {
+    ids() {
+      let ids = [];
+      this.selectionList.forEach(ele => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
+    }
+  },
+  methods: {
+    getStorageTree() {
+      customerListAll().then(res => {
+        this.treeData = res.data.data;
+      });
+    },
+    addRow() {
+      if (!this.query.storageId) {
+        this.$message({
+          type: "error",
+          message: "请先选择左侧仓库!"
+        });
+        return;
+      }
+      this.form.storageId = this.query.storageId;
+      this.form.storageName = this.query.storageName;
+      this.$refs.crud.rowAdd();
+    },
+
+    rowSave(row, done, loading) {
+      submit(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        },
+        error => {
+          loading();
+          window.console.log(error);
+        }
+      );
+    },
+    rowUpdate(row, index, done, loading) {
+      submit(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        },
+        error => {
+          loading();
+          console.log(error);
+        }
+      );
+    },
+    nodeClick(data) {
+      console.info("data---", data);
+      this.query.storageId = data.id;
+      this.query.storageName = data.cname;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    },
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+        });
+    },
+    beforeOpen(done, type) {
+      if (["edit", "view"].includes(type)) {
+        getDetails({ id: this.form.id }).then(res => {
+          this.form = res.data.data;
+        });
+      }
+      done();
+    },
+    searchReset() {
+      this.$refs.tree.setCurrentKey(null);
+      this.query = {};
+      this.onLoad(this.page);
+    },
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done();
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    selectionClear() {
+      this.selectionList = [];
+      this.$refs.crud.toggleSelection();
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    onLoad(page, params = {}) {
+      this.loading = true;
+      getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.data = data.records;
+        this.loading = false;
+        this.selectionClear();
+      });
+    },
+    //自定义列保存
+    async saveColumn(ref, option, optionBack, code) {
+      /**
+       * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
+       * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
+       * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
+       */
+      const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout();
+        });
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    },
+    //自定义列重置
+    async resetColumn(ref, option, optionBack, code) {
+      this[option] = this[optionBack];
+      const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
+      if (inSave) {
+        this.$message.success("重置成功");
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+        this.$nextTick(() => {
+          this.$refs.crud.doLayout();
+        });
+      }
+    }
+  }
+};
+</script>
+
+<style></style>

+ 1 - 0
src/views/tirePartsMall/salesManagement/outboundWorkOrderL/dialogAssembly.vue

@@ -24,6 +24,7 @@
         <el-col :span="19">
           <basic-container>
             <avue-crud
+              v-if="dialogVisible"
               :option="optionTwo"
               :table-loading="loading"
               :data="goodsListShow"