Pārlūkot izejas kodu

客户分类部分功能

chen 3 gadi atpakaļ
vecāks
revīzija
6d31941ff4

+ 51 - 0
src/api/basic_data/material.js

@@ -227,3 +227,54 @@ export function getRebate(params) {
     params
   })
 }
+
+//产品品类
+
+//产品品类列表
+export function getProductCategoryList(params) {
+  return request({
+    url:'/product-category/list',
+    method: 'get',
+    params
+  })
+}
+//产品品类小类列表
+export function getProductCategorySubList(params) {
+  return request({
+    url:'/product-category/sub-list',
+    method: 'get',
+    params
+  })
+}
+//新增产品品类
+export function getProductCategoryAdd(data) {
+  return request({
+    url:'/product-category/add',
+    method: 'post',
+    data
+  })
+}
+//编辑产品品类
+export function getProductCategoryEdit(data) {
+  return request({
+    url:'/product-category/edit',
+    method: 'post',
+    data
+  })
+}
+//金蝶存货类别列表
+export function getProductCategoryKingDeeCategoryList() {
+  return request({
+    url:'/product-category/king-dee-category-list',
+    method: 'get',
+    
+  })
+}
+//新增产品品类小类
+export function getProductCategoryAddSub(data) {
+  return request({
+    url:'/product-category/add-sub',
+    method: 'post',
+    data
+  })
+}

+ 22 - 19
src/views/basic_data/dealer/dealer_stock.vue

@@ -377,26 +377,29 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-::v-deep .el-popover__reference {
-  margin-left: 10px;
-}
-::v-deep .selectStyle .el-input--suffix {
-  width: 200%;
-}
+// ::v-deep .el-popover__reference {
+//   margin-left: 10px;
+// }
+// ::v-deep .selectStyle .el-input--suffix {
+//   width: 200%;
+// }
 
-::v-deep .el-input--suffix {
-  width: 300px;
-}
-::v-deep .el-dialog__header {
-  background-color: #dddddd;
-}
-::v-deep .dialog-footer {
-  display: flex;
-  justify-content: center;
-}
+// ::v-deep .el-input--suffix {
+//   width: 300px;
+// }
+// ::v-deep .el-dialog__header {
+//   background-color: #dddddd;
+// }
+// ::v-deep .dialog-footer {
+//   display: flex;
+//   justify-content: center;
+// }
 
-.formWidth {
-  width: 70%;
-  margin-right: 20px;
+// .formWidth {
+//   width: 70%;
+//   margin-right: 20px;
+// }
+.selectStyle {
+  width: 100%;
 }
 </style>

+ 443 - 0
src/views/basic_data/material/classify_list.vue

@@ -0,0 +1,443 @@
+<template>
+  <div class="app-container">
+    <div class="main-content">
+      <div class="main-left">
+        <el-button
+          icon="el-icon-plus"
+          type="primary"
+          plain
+          style="width: 100%"
+          @click="openAddGroupForm('add')"
+          >新建分组</el-button
+        >
+        <div class="list">
+          <div
+            class="item"
+            :class="activeGroup === '' ? 'active' : ''"
+            @click="changeGroup('')"
+          >
+            <div class="title">所有分组</div>
+          </div>
+          <div
+            class="item"
+            :class="activeGroup === v.productCategoryId ? 'active' : ''"
+            v-for="v in categoryList"
+            :key="v.productCategoryId"
+            @click="changeGroup(v.productCategoryId, v)"
+          >
+            <div class="title">{{ v.productCategoryName }}</div>
+            <el-dropdown trigger="click" @command="handleCommand">
+              <span class="el-dropdown-link">
+                <i class="el-icon-more icon-more"></i>
+              </span>
+              <el-dropdown-menu slot="dropdown">
+                <el-dropdown-item :command="['edit', v]"
+                  >修改名称</el-dropdown-item
+                >
+                <el-dropdown-item :command="['del', v]"
+                  >删除分组</el-dropdown-item
+                >
+              </el-dropdown-menu>
+            </el-dropdown>
+          </div>
+        </div>
+      </div>
+      <div class="main-right">
+        <!-- 筛选条件 -->
+        <div>
+          <el-form
+            ref="screenForm"
+            label-width="70px"
+            size="small"
+            label-position="left"
+          >
+            <el-row :gutter="20">
+              <el-col :xs="24" :sm="12" :lg="6">
+                <el-form-item label="编码" prop="volume">
+                  <el-input placeholder="请输入"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :xs="24" :sm="12" :lg="6">
+                <el-form-item label="名称" prop="outsideName">
+                  <el-input placeholder="请输入"></el-input>
+                </el-form-item>
+              </el-col>
+
+              <el-col :xs="24" :sm="24" :lg="12" class="tr">
+                <el-form-item label="">
+                  <el-button size="small">清空</el-button>
+                  <el-button size="small" type="primary">搜索</el-button>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </div>
+        <!-- 按钮 -->
+        <div class="btn-group clearfix">
+          <div class="fl">
+            <el-button type="primary" size="small" @click="addCategoryFn"
+              >添加类别</el-button
+            >
+          </div>
+        </div>
+        <div class="mymain-container">
+          <!-- 列表 -->
+          <div class="table">
+            <el-table
+              v-loading="listLoading"
+              :data="dataList"
+              element-loading-text="Loading"
+              border
+              fit
+              highlight-current-row
+              stripe
+            >
+              <el-table-column
+                align="center"
+                label="编码"
+                prop="kingDeeCategoryNumber"
+                min-width="160"
+                show-overflow-tooltip
+              ></el-table-column>
+              <el-table-column
+                align="center"
+                label="品类"
+                prop="kingDeeCategoryName"
+                min-width="160"
+                show-overflow-tooltip
+              ></el-table-column>
+              <el-table-column
+                align="center"
+                label="操作"
+                min-width="160"
+                show-overflow-tooltip
+              >
+                <template slot-scope="scope">
+                  <el-popconfirm
+                    confirm-button-text="好的"
+                    cancel-button-text="不用了"
+                    icon="el-icon-info"
+                    icon-color="red"
+                    title="内容确定删除吗?"
+                    @onConfirm="hanleDelete(scope.row.id)"
+                  >
+                    <el-button
+                      slot="reference"
+                      type="text"
+                      class="textColor el-popover-left"
+                      >删除</el-button
+                    >
+                  </el-popconfirm>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+          <!-- 分页 -->
+          <div class="fr">
+            <el-pagination
+              :current-page="currentPage"
+              :page-sizes="[10, 20, 30, 50]"
+              :page-size="10"
+              layout="total, sizes, prev, pager, next, jumper"
+              :total="listTotal"
+            >
+            </el-pagination>
+          </div>
+        </div>
+      </div>
+    </div>
+    <!-- 新增编辑分组 -->
+    <el-dialog
+      :title="addGroupFormType == 'add' ? '新建分组' : '编辑分组'"
+      :visible.sync="addGroupFormVisible"
+      :show-close="false"
+      width="40%"
+      :close-on-click-modal="false"
+    >
+      <el-form
+        ref="addGroupForm"
+        :model="addGroupForm"
+        label-position="left"
+        label-width="80px"
+      >
+        <el-form-item label="分组名称" prop="">
+          <el-input
+            autocomplete="off"
+            v-model="addGroupForm.productCategoryName"
+            placeholder="请输入分组名称"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="编码" prop="">
+          <el-input
+            autocomplete="off"
+            v-model="addGroupForm.productCategoryNumber"
+            placeholder="请输入"
+          ></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="cancelFn">取 消</el-button>
+        <el-button type="primary" @click="btnOK">确 定</el-button>
+      </div>
+    </el-dialog>
+    <!-- 添加类别弹窗 -->
+    <ClassifyListSmall
+      :dataCategory="dataCategory"
+      :showAddSelect.sync="showAddSelect"
+      :data="dataList"
+      @updateList="updateListFn"
+    />
+  </div>
+</template>
+
+<script>
+import ClassifyListSmall from "./components/classify_list-small";
+import {
+  getProductCategoryList,
+  getProductCategorySubList,
+  getProductCategoryAdd,
+  getProductCategoryEdit,
+} from "@/api/basic_data/material";
+export default {
+  data() {
+    return {
+      addGroupFormVisible: false,
+      activeGroup: "",
+      dataList: null, // 列表数据
+      listLoading: false, // 列表加载loading
+      currentPage: 1, // 当前页码
+      pageSize: 10, // 每页数量
+      listTotal: 0, // 列表总数
+      categoryList: [], //品类列表
+      addGroupForm: {
+        productCategoryName: "",
+        productCategoryNumber: "",
+      },
+      addGroupFormType: "add",
+      showAddSelect: false, //添加分类弹窗
+      dataCategory: null, //当前选中的品类
+    };
+  },
+  components: {
+    ClassifyListSmall,
+  },
+  created() {
+    this.getDataList();
+  },
+  methods: {
+    //更新列表
+    async updateListFn(id) {
+      const res = await getProductCategorySubList({ id });
+      this.dataList = res.data;
+    },
+    //添加类别
+    async addCategoryFn() {
+      this.showAddSelect = true;
+    },
+    //取消
+    cancelFn() {
+      this.addGroupForm = {
+        productCategoryName: "",
+        productCategoryNumber: "",
+      };
+      this.addGroupFormVisible = false;
+    },
+    //确定
+    async btnOK() {
+      if (this.addGroupFormType == "edit") {
+        await getProductCategoryEdit({ ...this.addGroupForm });
+        this.$message.success("编辑成功");
+      } else {
+        await getProductCategoryAdd({ ...this.addGroupForm });
+        this.$message.success("新建成功");
+      }
+      this.addGroupForm = {
+        productCategoryName: "",
+        productCategoryNumber: "",
+      };
+      this.getDataList();
+      this.addGroupFormVisible = false;
+    },
+    //切换分组
+    async changeGroup(id, v) {
+      console.log(v);
+      this.dataCategory = v;
+      this.activeGroup = id;
+      const res = await getProductCategorySubList({ id });
+
+      this.dataList = res.data;
+    },
+    //获取产品品类列表
+    async getDataList(data) {
+      const res = await getProductCategoryList(data);
+
+      this.categoryList = res.data;
+    },
+    //新建分组弹窗
+    openAddGroupForm(type, item) {
+      this.addGroupFormType = type;
+      if (type == "edit") {
+        this.addGroupForm.productCategoryNumber = item.productCategoryNumber;
+        this.addGroupForm.productCategoryName = item.productCategoryName;
+        this.addGroupForm.productCategoryId = item.productCategoryId;
+      }
+      this.addGroupFormVisible = true;
+    },
+    // 操作分组
+    handleCommand(command) {
+      let type = command[0],
+        v = command[1];
+      if (type == "del") {
+        this.$confirm("此操作将删除该分组, 是否继续?", "删除分组", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+          .then(() => {
+            // deleteGroup({ groupId: item.marketingGroupId }).then((res) => {
+            //   this.$successMsg("删除成功");
+            //   this.getGroupList();
+            // });
+          })
+          .catch(() => {});
+      }
+      if (type == "edit") {
+        //修改
+        console.log(1111);
+        this.openAddGroupForm("edit", v);
+      }
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.main-content {
+  display: flex;
+  height: auto;
+  .main-left {
+    margin-right: 20px;
+    padding: 10px;
+    width: 210px;
+    overflow-y: auto;
+    // border: 1px solid #eaeaea;
+    border-radius: 5px;
+    .list {
+      margin-top: 10px;
+      .item {
+        display: flex;
+        padding: 10px;
+        cursor: pointer;
+        color: #333;
+        &.active {
+          color: #377cfd;
+          font-weight: 600;
+          background-color: #f5f7fa;
+        }
+        .title {
+          flex: 1;
+          min-width: 0;
+          padding-right: 10px;
+          font-size: 14px;
+        }
+        .icon-more {
+          transform: rotate(90deg);
+        }
+      }
+    }
+  }
+  .main-right {
+    flex: 1;
+    height: auto;
+    ::v-deep .el-divider--horizontal {
+      margin: 10px 0;
+    }
+    .btn-group {
+      display: flex;
+      justify-content: space-between;
+      .left {
+        display: flex;
+        align-items: center;
+        .tips {
+          font-size: 14px;
+          margin-left: 10px;
+        }
+      }
+    }
+    .list-container {
+      margin-top: 20px;
+      .box-card {
+        ::v-deep .el-card__header {
+          padding: 10px 10px 10px 20px;
+        }
+        .header {
+          display: flex;
+          justify-content: space-between;
+          align-items: center;
+        }
+        .body {
+          .info {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            font-size: 14px;
+            color: #666;
+            margin: 10px 0;
+          }
+          .content {
+            max-width: 100%;
+            height: 168px;
+            overflow-y: hidden;
+            background-color: #fafafa;
+            word-break: break-all;
+            border-radius: 2px;
+            padding: 8px;
+            font-size: 14px;
+            line-height: 19px;
+            .text {
+              overflow: hidden;
+              text-overflow: ellipsis;
+              display: -webkit-box;
+              -webkit-line-clamp: 8;
+              -webkit-box-orient: vertical;
+            }
+          }
+          .img {
+            width: 100%;
+            height: 168px;
+            display: block;
+          }
+          .video {
+            width: 100%;
+            height: 168px;
+            display: block;
+          }
+          .file {
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+            img {
+              width: 40px;
+              height: 40px;
+              display: block;
+            }
+          }
+        }
+      }
+    }
+    .empty {
+      display: flex;
+      flex-direction: column;
+      align-items: center;
+      justify-content: center;
+      padding: 20px 0;
+      img {
+        width: 280px;
+      }
+      div {
+        font-size: 14px;
+        color: #666;
+      }
+    }
+  }
+}
+</style>

+ 118 - 0
src/views/basic_data/material/components/classify_list-small.vue

@@ -0,0 +1,118 @@
+<template>
+  <!-- 添加类别弹窗 -->
+  <el-dialog
+    title="添加分类"
+    :visible.sync="showAddSelect"
+    :show-close="false"
+    width="40%"
+    :close-on-click-modal="false"
+  >
+    <!-- 列表 -->
+    <div class="table">
+      <el-table
+        v-loading="listLoading"
+        :data="dataList"
+        element-loading-text="Loading"
+        border
+        fit
+        highlight-current-row
+        stripe
+        @selection-change="selectionChangeFn"
+      >
+        <el-table-column type="selection" width="55" align="center">
+        </el-table-column>
+        <el-table-column
+          align="center"
+          label="编码"
+          prop="number"
+          min-width="160"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column
+          align="center"
+          label="类别名称"
+          prop="name"
+          min-width="160"
+          show-overflow-tooltip
+        ></el-table-column>
+      </el-table>
+    </div>
+
+    <div slot="footer" class="dialog-footer">
+      <el-button @click="cancelFn">取 消</el-button>
+      <el-button type="primary" @click="btnOK">确 定</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import {
+  getProductCategoryKingDeeCategoryList,
+  getProductCategoryAddSub,
+} from "@/api/basic_data/material";
+export default {
+  props: {
+    showAddSelect: {
+      type: Boolean,
+      required: true,
+    },
+    dataCategory: {
+      type: Object,
+      default: {},
+    },
+    data: {
+      type: Array,
+      default: [],
+    },
+  },
+  data() {
+    return {
+      dataList: null, // 列表数据
+      listLoading: false, // 列表加载loading
+      arr: [],
+    };
+  },
+  created() {
+    this.getDataList();
+  },
+  methods: {
+    //获取选择的数据
+    selectionChangeFn(v) {
+      console.log(v);
+      this.arr = v.map((item) => {
+        return { kingDeeCategoryId: item.id };
+      });
+    },
+    //获取列表数据
+    async getDataList() {
+      const res = await getProductCategoryKingDeeCategoryList();
+      this.dataList = res.data;
+    },
+    //取消
+    cancelFn() {
+      this.$emit("update:showAddSelect", false);
+    },
+    //确定
+    async btnOK() {
+      console.log(this.data);
+      let res = this.data.map((v) => {
+        return { kingDeeCategoryId: v.kingDeeCategoryId };
+      });
+
+      let data = {
+        productCategoryId: this.dataCategory.productCategoryId,
+        productCategoryName: this.dataCategory.productCategoryName,
+        productCategoryNumber: this.dataCategory.productCategoryNumber,
+        items: [...this.arr, ...res],
+      };
+      await getProductCategoryAddSub(data);
+      this.$message.success("新增成功");
+      this.$emit("updateList", this.dataCategory.productCategoryId);
+      this.$emit("update:showAddSelect", false);
+    },
+  },
+};
+</script>
+
+<style>
+</style>

+ 5 - 3
src/views/basic_data/material/relation_list.vue

@@ -17,6 +17,7 @@
                   v-for="item in materialLis"
                   :label="item.name"
                   :value="item.id"
+                  :key="item.id"
                 ></el-option>
               </el-select>
             </el-form-item>
@@ -311,6 +312,7 @@
                   v-for="item in materialLis"
                   :label="item.name"
                   :value="item.id"
+                  :key="item.id"
                 ></el-option>
               </el-select>
             </el-form-item>
@@ -349,7 +351,7 @@
               >
             </el-row>
 
-            <template v-for="(item, index) in diaLogForm.items">
+            <div v-for="(item, index) in diaLogForm.items" :key="index">
               <el-form-item label="编码">
                 <el-select
                   v-model="item.number"
@@ -365,7 +367,7 @@
                   </el-option>
                 </el-select>
               </el-form-item>
-              <el-form-item label="名称">
+              <el-form-item label="名称" prop="">
                 <el-input v-model="item.name" placeholder=""></el-input>
               </el-form-item>
               <el-form-item label="型号">
@@ -374,7 +376,7 @@
               <el-form-item label="体积">
                 <el-input v-model="item.volume" placeholder=""></el-input>
               </el-form-item>
-            </template>
+            </div>
           </el-col>
         </el-row>
       </el-form>