zhangjinxing 3 years ago
parent
commit
d14ba22b95

+ 3 - 3
src/apis/service/purchaseIn/goodsClass/index.js

@@ -3,7 +3,7 @@ import http from "@/apis/axios";
 const api = "admin/";
 export default {
   // 添加
-  add: (data, params) => http(api + "add", data, "post", params),
+  add: (data, params) => http(api + "catcreate", data, "post", params),
   // 删除
   delete: (data, params) => http(api + "delete", data, "post", params),
   // 分页查询
@@ -11,9 +11,9 @@ export default {
   // 详情
   detail: (data, params) => http(api + "detail", data, "post", params),
   // 更新
-  update: (data, params) => http(api + "update", data, "post", params),
+  update: (data, params) => http(api + "catedit", data, "post", params),
   // 修改状态
-  status: (data, params) => http(api + "accountstatus", data, "post", params),
+  status: (data, params) => http(api + "catstatus", data, "post", params),
   // 商品分类列表
   goodsList: (data, params) => http(api + "catlist", data, "post", params),
 

+ 2 - 0
src/components/globalComponents/class-tree/index.js

@@ -0,0 +1,2 @@
+import Main from './main.vue'
+export default Main

+ 108 - 0
src/components/globalComponents/class-tree/main.vue

@@ -0,0 +1,108 @@
+<template>
+  <div class="staff-tree">
+    <div v-if="list && list.length > 0">
+      <div class="staff" v-for="(item, index) in list" :key="'user' + index">
+        <i class="el-icon-s-custom user-box"></i>
+        <span class="staff-name">{{ item.nickname }}</span>
+        <span class="btn-list" @click="(e) => e.stopPropagation()">
+          <el-button
+            v-if="powers.some((item) => item == '005')"
+            :type="item.position === '1' ? 'primary' : 'info'"
+            size="mini"
+            @click="setUpEdit($event, item.id, item.position)"
+          >
+            设为负责人
+          </el-button></span
+        >
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+export default {
+  name: "goodsTree",
+  components: {},
+  props: ["list", "level"],
+  computed: {
+    powers() {
+      let tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "goodsTree"
+        ) || {};
+      if (tran && tran.action && tran.action.length > 0) {
+        return tran.action;
+      } else {
+        return [];
+      }
+    },
+  },
+  data() {
+    return {
+      newlist: "",
+      index: 0, // icon 箭头
+    };
+  },
+  methods: {
+    setUpEdit(e, id, position) {
+      this.$emit("setUpEdit", id, position);
+    },
+  },
+};
+</script>
+<style lang="scss" >
+.staff-tree {
+  margin-left: 18px;
+  cursor: pointer;
+  // border: 1px solid #ccc;
+  // border-radius: 6px;
+  .no-data {
+    text-align: center;
+    line-height: 50px;
+    color: #666;
+    border: 1px solid #ccc;
+    border-radius: 6px;
+  }
+  .el-button--mini {
+    padding: 6px 10px;
+    margin-top: 5px;
+  }
+  .staff-tree-node:nth-of-type(odd) {
+    background: rgba(75, 157, 177, 0.1);
+  }
+  .staff-tree-node:nth-of-type(even) {
+    background: rgba(249, 168, 110, 0.1);
+  }
+
+  .staff {
+    // padding:0 0 0 5px;
+    // background: #eee;
+    .btn-list {
+      display: block;
+      float: right;
+    }
+    .user-box {
+      display: inline-block;
+      vertical-align: top;
+      width: 25px;
+      height: 25px;
+      line-height: 25px;
+      font-size: 15px;
+      text-align: center;
+      border-radius: 50%;
+      overflow: hidden;
+      background: #63cbe7;
+      color: #fff;
+      margin: 6px 5px 0 3px;
+      small {
+        font-size: 8px;
+      }
+    }
+    .staff-name {
+      display: inline-block;
+      height: 38px;
+      line-height: 38px;
+      vertical-align: top;
+    }
+  }
+}
+</style>

+ 0 - 0
src/components/globalComponents/class-tree/商品-item


+ 2 - 0
src/components/globalComponents/goodsClass-tree/index.js

@@ -0,0 +1,2 @@
+import Main from './main.vue'
+export default Main

+ 200 - 0
src/components/globalComponents/goodsClass-tree/main.vue

@@ -0,0 +1,200 @@
+<template>
+  <div class="organize-tree">
+    <div v-if="list && list.length > 0">
+      <div
+        v-for="item in list"
+        :key="item.updatetime"
+        class="organize-tree-node"
+        @click="openChildren($event, item)"
+      >
+        powers:{{ powers }}11{{ item }}
+        <div class="organize-box">
+          <span class="label">
+            {{ item.name }}
+          </span>
+          <i class="el-icon-arrow-right"></i>
+          <span class="btn-list" @click="(e) => e.stopPropagation()">
+            <el-button
+              v-if="powers.some((item) => item == '005')"
+              type="warning"
+              size="mini"
+              @click="
+                addEdit(
+                  $event,
+                  item.id,
+                  level === 3 ? item.menuid : item.pid,
+                  level,
+                  false,
+                  false,
+                  item
+                )
+              "
+            >
+              修改
+            </el-button>
+
+            <el-button
+              v-if="powers.some((item) => item == '004')"
+              :type="item.status === '1' ? 'primary' : 'info'"
+              size="mini"
+              @click="
+                status(
+                  $event,
+                  item.id,
+                  level === 3 ? item.menuid : item.pid,
+                  level,
+                  item.status
+                )
+              "
+            >
+              {{ item.status === "1" ? "禁用" : "启用" }}
+            </el-button>
+
+            <el-button
+              v-if="powers.some((item) => item == '006')"
+              type="danger"
+              size="mini"
+              @click="
+                del(
+                  $event,
+                  item.id,
+                  level === 3 ? item.menuid : item.pid,
+                  level,
+                  item.status
+                )
+              "
+            >
+              删除
+            </el-button>
+          </span>
+        </div>
+      </div>
+    </div>
+    <!--  v-if="page !== false && data && data.length > 0" -->
+    <div class="Pagination" style="text-align: right; margin-top: 10px">
+      <el-pagination
+        :current-page="page.curr"
+        :page-sizes="[15, 50, 100]"
+        :page-size="page.size"
+        :size="searchSize"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="page.total"
+        @size-change="$emit('page-size-change', $event)"
+        @current-change="$emit('page-curr-change', $event)"
+      />
+    </div>
+  </div>
+</template>
+<script>
+export default {
+  name: "goodsClassTree",
+  props: ["list", "level", "page"],
+  computed: {
+    powers() {
+      let tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "goodsClass"
+        ) || {};
+      if (tran && tran.action && tran.action.length > 0) {
+        return tran.action;
+      } else {
+        return [];
+      }
+    },
+  },
+  data() {
+    return {
+      newlist: "",
+      index: 0, // icon 箭头
+      // page: {
+      //   type: [Boolean, Object],
+      //   default: false,
+      // },
+    };
+  },
+  methods: {
+    addEdit(e, id, pid, level, isDetail, isAdd, formData) {
+      e.stopPropagation();
+      this.$emit("addEdit", id, pid, level, isDetail, isAdd, formData);
+    },
+    openChildren(e, item) {
+      e.stopPropagation();
+      this.$emit("openChildren", item);
+    },
+    status(e, id, pid, level, status) {
+      e.stopPropagation();
+      this.$emit("status", id, pid, level, status);
+    },
+    del(e, id, pid, level, status) {
+      e.stopPropagation();
+      this.$emit("del", id, pid, level, status);
+    },
+  },
+};
+</script>
+<style lang="scss" >
+.organize-tree {
+  margin-left: 18px;
+  cursor: pointer;
+  .el-button--mini {
+    padding: 6px 10px;
+    margin-top: 5px;
+  }
+  .organize-tree-node:nth-of-type(odd) {
+    background: rgba(75, 157, 177, 0.1);
+  }
+  .organize-tree-node:nth-of-type(even) {
+    background: rgba(249, 168, 110, 0.1);
+  }
+  .organize-tree-node {
+    display: block;
+    margin: 5px 0 5px 5px;
+    padding: 0 7px 2px 10px;
+    line-height: 35px;
+
+    .btn-list {
+      display: block;
+      float: right;
+    }
+    i.el-icon-arrow-right {
+      font-size: 16px;
+      width: 22px;
+      height: 35px;
+      line-height: 38px;
+      vertical-align: top;
+      margin: auto;
+    }
+    .label {
+      font-size: 16px;
+    }
+
+    .staff {
+      // padding:0 0 0 5px;
+      // background: #eee;
+      .user-box {
+        display: inline-block;
+        vertical-align: top;
+        width: 25px;
+        height: 25px;
+        line-height: 25px;
+        font-size: 15px;
+        text-align: center;
+        border-radius: 50%;
+        overflow: hidden;
+        background: #63cbe7;
+        color: #fff;
+        margin: 6px 5px 0 3px;
+        small {
+          font-size: 8px;
+        }
+      }
+      .staff-name {
+        display: inline-block;
+        height: 38px;
+        line-height: 38px;
+        vertical-align: top;
+      }
+    }
+  }
+}
+</style>

+ 0 - 0
src/components/globalComponents/goodsClass-tree/商品分类-item


+ 3 - 2
src/components/globalComponents/goodsClass/main.vue

@@ -30,7 +30,7 @@ import asyncRequest from "@/apis/components/goods-class";
 import resToken from "@/mixins/resToken";
 import { isArray } from "@/utils/validate";
 export default {
-  name: "goodsClass",
+  name: "goodsClasss",
   mixins: [resToken],
   props: ["size", "value", "placeholder", "isDetail", "disabled"],
   /**
@@ -78,7 +78,7 @@ export default {
     },
     handleChange(value) {
       console.log(value);
-      this.$emit("selectChange", value);
+      this.$emit("handleChange", value);
     },
     async selectChange(e) {
       if (e && e.length > 0) {
@@ -116,6 +116,7 @@ export default {
       if (res && res.code === 0 && res.data) {
         let arr = res.data;
         let list = [];
+
         list = this.delChild(arr);
         this.options = list;
       } else if (res && res.code >= 100 && res.code <= 104) {

+ 0 - 40
src/views/purchaseIn/goodsClass/tableData.js

@@ -1,40 +0,0 @@
-export default [
-    {
-        "id":1,
-        "cat_name":"五金用品",
-        "pid":0,
-        "level":1,
-        "tate":"0.0000",
-        "weight":0,
-        "status":1,
-        "addtime":"2021-11-11 10:27:01",
-        "updatetime":"2020-11-11 10:27:01",
-        "child":[
-            {
-            "id":27,
-            "cat_name":"存储包装",
-            "pid":1,
-            "level":2,
-            "tate":"0.0000",
-            "weight":0,
-            "status":1,
-            "addtime":"2021-10-11 10:27:01",
-            "updatetime":"2021-11-01 10:27:01",
-            "child":[
-                {
-                "id":307,
-                "cat_name":"包装保护材料",
-                "pid":27,
-                "level":3,
-                "tate":"0.0000",
-                "weight":0,
-                "status":1,
-                "addtime":"2021-01-11 10:27:01",
-                "updatetime":"2021-12-01 10:27:01",
-                "child":[],
-                }
-            ],
-            }
-        ]
-    }
-]

+ 240 - 0
src/views/serviceParam/goodsClass/addEdit.vue

@@ -0,0 +1,240 @@
+<template>
+  <el-dialog
+    v-loading="loading"
+    :title="title"
+    :center="true"
+    align="left"
+    top="25vh"
+    width="600px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    append-to-body
+    @close="closeModel"
+  >
+    <el-card style="margin-top: -20px">
+      <el-row>
+        <el-col :span="24">
+          <el-form
+            ref="ruleForm"
+            :model="ruleForm"
+            is_show-icon
+            :rules="rulesThis"
+            label-width="100px"
+            class="demo-ruleForm"
+          >
+            <el-form-item label="分类名称:" prop="name">
+              <el-input
+                v-model="ruleForm.className"
+                :disabled="isDetail"
+                placeholder="请输入分类名称"
+              />
+            </el-form-item>
+          </el-form>
+        </el-col>
+        <el-col :span="24" style="text-align: right">
+          <el-button v-if="!isDetail" type="primary" @click="submitForm">
+            保 存
+          </el-button>
+          <el-button @click="showModelThis = false">{{
+            isDetail ? "关 闭" : "取 消"
+          }}</el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+
+<script>
+import asyncRequest from "@/apis/service/purchaseIn/goodsClass";
+import btnList from "@/assets/js/btnList";
+import resToken from "@/mixins/resToken";
+export default {
+  mixins: [resToken],
+  props: [
+    "showModel",
+    "id",
+    "isDetail",
+    "pid",
+    "level",
+    "isAdd",
+    "type",
+    "formData",
+  ],
+  data() {
+    return {
+      loading: false,
+      showIconModel: false,
+      title: "",
+      btnList,
+      showModelThis: this.showModel,
+      ruleForm: {
+        className: "", //分类名称
+      },
+      rulesThis: this.rules,
+      rules: {
+        name: [
+          {
+            required: true,
+            message: "请输入分类名称",
+            trigger: "blur",
+          },
+          {
+            min: 1,
+            max: 50,
+            message: "长度在 1 到 50 个字符",
+            trigger: "blur",
+          },
+        ],
+      },
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  methods: {
+    closeModel() {
+      console.log("closeModel!!");
+    },
+    async initForm() {
+      if (this.isAdd) {
+        this.title = "添加商品分类";
+        this.loading = false;
+        this.rulesThis = this.rules;
+      } else {
+        if (this.isDetail) {
+          this.title = "商品分类详情";
+          this.rulesThis = {};
+        } else {
+          this.title = "修改商品分类";
+          this.rulesThis = this.rules;
+        }
+      }
+      await this.resetForm();
+    },
+
+    async resetForm() {
+      this.ruleForm = {
+        id: this.id,
+        pid: this.pid,
+        name: this.formData && this.formData.name ? this.formData.name : "", // 名称
+      };
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          // 去掉验证信息
+          this.$refs.ruleForm.clearValidate();
+        }
+      });
+    },
+    async submitForm() {
+      if (this.loading) {
+        return false;
+      }
+      this.loading = true;
+
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          let model = {};
+          let res = {};
+          const { name } = this.ruleForm;
+
+          model = {
+            id: this.id,
+            pid: this.pid,
+            cat_name: name,
+          };
+          console.log(model);
+          if (this.level === 1) {
+            // delete model["pid"];
+            // delete model["menuid"];
+            // delete model["url"];
+            // delete model["action_code"];
+            // delete model["status"];
+          } else if (this.level === 2) {
+            delete model["menuid"];
+            delete model["action_code"];
+            delete model["status"];
+          } else {
+            delete model["pid"];
+            delete model["img"];
+            delete model["is_show"];
+            delete model["weight"];
+            delete model["route"];
+            delete model["is_display"];
+            delete model["url"];
+          }
+          if (this.isAdd) {
+            delete model["id"];
+          }
+          if (this.isAdd) {
+            res = await asyncRequest.add(model);
+          } else {
+            res = await asyncRequest.update(model);
+            // if (this.isAdd) {
+            //   res = await asyncRequest.actionadd(model);
+            // } else {
+            //   res = await asyncRequest.actionedit(model);
+            // }
+          }
+          this.loading = false;
+          if (res && res.code === 0) {
+            this.ruleForm = {};
+            const title = this.isAdd ? "添加成功" : "修改成功";
+            this.$notify.success({
+              title,
+              message: "",
+            });
+            this.showModelThis = false;
+            // 刷新
+            let pids = this.pid;
+            if (this.id === 0) {
+              // 添加组织
+              pids = "0";
+            }
+            this.$emit("refresh", this.id, pids, this.level);
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        } else {
+          this.loading = false;
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.g-block {
+  display: inline-block;
+  padding: 10px 5px;
+  text-align: center;
+  border: 1px #ccc dashed;
+  margin: 1px;
+  font-size: 0px;
+  cursor: pointer;
+  i {
+    font-size: 30px;
+    line-height: 30px;
+    display: block;
+    margin: 0 auto;
+    width: 30px;
+  }
+}
+</style>

+ 462 - 0
src/views/serviceParam/goodsClass/index copy.vue

@@ -0,0 +1,462 @@
+<template>
+  <div class="organize pagePadding">
+    <div
+      v-loading="loading"
+      v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
+    >
+      <el-row>
+        <el-col :span="24">
+          <el-col :span="24" style="padding: 12px 0 15px 0">
+            <div class="my-breadcrumb clear">
+              <div
+                class="my-breadcrumb-item"
+                v-for="(item, index) in titleList"
+                :key="item + index"
+                :class="{ chover: true }"
+                @click="changeBreadcrumb(index)"
+              >
+                <span class="label">{{ item.titleName }}</span
+                ><span class="separator" v-if="index + 1 !== titleList.length"
+                  >/</span
+                >
+              </div>
+            </div>
+          </el-col>
+          <el-col :span="24">
+            <el-row style="padding: 0 0 3px 0">
+              <el-col :span="8">
+                <goods-class
+                  :value="goods_className"
+                  :size="searchSize"
+                  :placeholder="'商品分类'"
+                  :disabled="false"
+                  @selectChange="goodsClassChange"
+                ></goods-class>
+              </el-col>
+
+              <el-col :span="3" style="width: 195px; float: right">
+                <el-button
+                  type="primary"
+                  :size="searchSize"
+                  style="float: right; margin-left: 5px"
+                  @click="searchList"
+                >
+                  刷新
+                </el-button>
+                <el-button
+                  v-if="powers.some((item) => item == '003')"
+                  type="success"
+                  :size="searchSize"
+                  style="float: right"
+                  @click="
+                    addEditFn(
+                      0,
+                      parmValue && parmValue.pid !== '' ? parmValue.pid : '0',
+                      1,
+                      false,
+                      true,
+                      {}
+                    )
+                  "
+                >
+                  添加
+                </el-button>
+              </el-col>
+            </el-row>
+          </el-col>
+        </el-col>
+      </el-row>
+
+      <el-row :gutter="10">
+        <el-col
+          :span="24"
+          v-if="
+            powers && powers.length > 0 && powers.some((item) => item == '001')
+          "
+        >
+          <organize-tree
+            style="margin-left: -5px"
+            :list="depart"
+            :level="1"
+            :pid="0"
+            @addEdit="addEditFn"
+            @openChildren="openChildren"
+            @status="setstatus"
+            @del="del"
+          />
+          <staff-tree
+            style="margin-left: -5px"
+            :list="item"
+            :level="1"
+            :pid="0"
+            @setUpEdit="setUpEdit"
+          />
+        </el-col>
+        <div
+          class="no-data"
+          v-if="item && item.length === 0 && depart && depart.length === 0"
+        >
+          暂无数据
+        </div>
+      </el-row>
+
+      <add-edit
+        :id="modelId"
+        :show-model="showModel"
+        :level="level"
+        :pid="parentIds"
+        :is-add="isAdd"
+        :form-data="formData"
+        :type="parmValue.type"
+        :is-detail="isDetail"
+        @refresh="searchList"
+        @cancel="showModel = false"
+      />
+    </div>
+    <div v-else>
+      <no-auth></no-auth>
+    </div>
+  </div>
+</template>
+<script>
+import mixinPage from "@/mixins/elPaginationHandle";
+// import asyncRequest from "@/apis/service//interest/organize";
+
+import asyncRequest from "@/apis/service/purchaseIn/goodsClass";
+import addEdit from "./addEdit";
+import statusList from "@/assets/js/statusList";
+import { mapGetters } from "vuex";
+import resToken from "@/mixins/resToken";
+export default {
+  name: "organize",
+  components: {
+    addEdit,
+  },
+  mixins: [mixinPage, resToken],
+  computed: {
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    powers() {
+      let tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "organize"
+        ) || {};
+      if (tran && tran.action && tran.action.length > 0) {
+        return tran.action;
+      } else {
+        return [];
+      }
+    },
+  },
+  data() {
+    return {
+      goods_className: "", //分类名称
+      titleList: [],
+      sitem: null,
+      statusList: statusList,
+      loading: true,
+      showModel: false,
+      showInterface: false,
+      isDetail: false,
+      isAdd: true,
+      level: 1,
+      modelId: 0,
+      formData: {},
+      parentIds: "",
+      parmValue: {
+        page: 1,
+        size: 100,
+        // status: "", //
+        // 分类名称字段
+      },
+      depart: [],
+      item: [],
+      passwordModel: false,
+      passwordModelId: 0,
+      // 表格 - 数据
+      // depart: [],
+    };
+  },
+  mounted() {
+    this.searchList();
+  },
+  methods: {
+    restSearch() {
+      this.parmValue = {
+        pid: "", //父级部门ID
+        name: "", // 部门/公司名称
+        nickname: "", // 员工名称
+      };
+      this.searchList();
+    },
+
+    async changeBreadcrumb(index) {
+      if (index + 1 !== this.titleList.length) {
+        this.parmValue.pid = this.titleList[index].id;
+        this.titleList = this.titleList.slice(0, index + 1);
+      } else {
+        this.parmValue.pid = 0;
+        this.titleList = [];
+      }
+      await this.searchList();
+    },
+    async openChildren(item) {
+      console.log(item);
+      this.parmValue.pid = item.pid;
+      let model = {
+        id: item.id,
+        titleName: item.name,
+      };
+      this.titleList.push(model);
+      console.log(this.titleList);
+      await this.searchList();
+    },
+    openModal(id, isDetail, sitem) {
+      this.showModel = true;
+      this.modelId = id;
+      this.isDetail = isDetail;
+      this.sitem = sitem;
+    },
+    openPasswordModal(id, isDetail) {
+      this.passwordModel = true;
+      this.passwordModelId = id;
+      this.isPasswordDetail = isDetail;
+    },
+    async setUpEdit(id, position) {
+      if (position === "1") {
+        const model = {
+          id: id,
+          position: "2",
+        };
+        let res = await asyncRequest.userp(model);
+        if (res && res.code === 0) {
+          this.$notify.success({
+            title: "设置成功!",
+            message: "",
+          });
+          await this.searchList();
+        } else if (res && res.code >= 100 && res.code <= 104) {
+          await this.logout();
+        } else {
+          this.$message.warning(res.message);
+        }
+      } else {
+        this.$message.warning("该账户已是部门负责人!");
+      }
+    },
+    addEditFn(id, pid, level, isDetail, isAdd, formData) {
+      this.showModel = true;
+      this.modelId = id;
+      this.level = level;
+      this.parentIds = pid;
+      this.isDetail = isDetail;
+      this.isAdd = isAdd;
+      this.formData = formData;
+    },
+
+    async setstatus(id, parentIds, level, status) {
+      console.log(
+        `openChildren-id, parentIds, level:${id}-${parentIds}-${level}-${status}`
+      );
+      await this.$confirm(`确定要${status === "0" ? "启用" : "禁用"}?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          let res = await asyncRequest.status(model);
+
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "修改成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+
+    async del(id, parentIds, level, status) {
+      console.log(
+        `openChildren-id, parentIds, level:${id}-${parentIds}-${level}-${status}`
+      );
+      await this.$confirm(`确定要删除?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+          };
+          let res = await asyncRequest.delete(model);
+
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "删除成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+
+    // async concatData(id, parentIds, level) {
+    //   console.log(id, parentIds, level);
+    //   this.loading = true;
+    //   const res = await asyncRequest.list({});
+    //   let depart = [];
+    //   if (res && res.code === 0 && res.data) {
+    //     depart = res.data;
+    //   } else if (res && res.code >= 100 && res.code <= 104) {
+    //     await this.logout();
+    //   } else {
+    //     this.$message.warning(res.message);
+    //   }
+    //   let arr = JSON.parse(JSON.stringify(this.depart));
+    //   // if (level === 1) {
+    //   arr = arr.map((val, index) => {
+    //     if (level === 1 ? id : parentIds === val.id) {
+    //       val.child = depart[index].child;
+    //     }
+    //     return val;
+    //   });
+
+    //   this.depart = arr;
+    //   this.loading = false;
+    // },
+    async deleteById(id, status) {
+      await this.$confirm("确定要删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "删除成功",
+              message: "",
+            });
+            this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    // 商品分类列表
+    async searchList() {
+      this.loading = true;
+      // { id: "1" }this.parmValue
+      const res = await asyncRequest.list(this.parmValue);
+      if (res && res.code === 0 && res.data) {
+        console.log(res.data);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.depart = [];
+        this.item = [];
+      }
+      this.loading = false;
+    },
+    async statusConfirm(id, status) {
+      await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          this.loading = true;
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 0) {
+            this.loading = false;
+            this.$notify.success({
+              title: "状态修改成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    //
+    goodsClassChange(e) {
+      console.log(e);
+    },
+  },
+};
+</script>
+   <style lang="scss" scoped>
+.organize {
+  .no-data {
+    padding: 25px 0;
+    text-align: center;
+    color: #909399;
+    margin: 30px 10px 0 10px;
+    border-radius: 8px;
+    border: 1px solid #dfe6ec;
+    // border-right: 1px solid #dfe6ec;
+    // border-bottom: 1px solid #dfe6ec;
+  }
+  .my-breadcrumb {
+    .my-breadcrumb-item {
+      float: left;
+      span {
+        height: 21px;
+        line-height: 21px;
+      }
+      .label {
+        padding: 0 5px 0 0;
+        color: 010101;
+      }
+      .separator {
+        color: #787878;
+        font-size: 13px;
+        padding: 0 5px 0 0;
+      }
+      &:last-child {
+        .label {
+          color: #787878;
+        }
+      }
+      &.chover {
+        cursor: pointer;
+      }
+    }
+  }
+}
+</style>

+ 518 - 0
src/views/serviceParam/goodsClass/index.vue

@@ -0,0 +1,518 @@
+<template>
+  <div class="goodsClass pagePadding">
+    <div
+      v-loading="loading"
+      v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
+    >
+      powers:{{ powers }}
+      <el-row>
+        <el-col :span="24" style="padding: 12px 0 15px 0">
+          <div class="my-breadcrumb clear">
+            <div
+              class="my-breadcrumb-item"
+              v-for="(item, index) in titleList"
+              :key="item + index"
+              :class="{ chover: true }"
+              @click="changeBreadcrumb(index)"
+            >
+              <span class="label">{{ item.titleName }}</span
+              ><span class="separator" v-if="index + 1 !== titleList.length"
+                >/</span
+              >
+            </div>
+          </div>
+        </el-col>
+        <el-col :span="24">
+          <el-row style="padding: 0 0 3px 0">
+            <el-col :span="8">
+              <!-- -->
+              <goods-classs
+                :value="goods_className"
+                :size="searchSize"
+                :placeholder="'商品分类'"
+                :disabled="false"
+                @handleChange="goodsClassChange"
+              />
+            </el-col>
+
+            <el-col :span="3" style="width: 195px; float: right">
+              <el-button
+                type="primary"
+                :size="searchSize"
+                style="float: right; margin-left: 5px"
+                @click="searchList"
+              >
+                刷新
+              </el-button>
+              <el-button
+                v-if="powers.some((item) => item == '003')"
+                type="success"
+                :size="searchSize"
+                style="float: right"
+                @click="
+                  addEditFn(
+                    0,
+                    parmValue && parmValue.pid !== '' ? parmValue.pid : '0',
+                    1,
+                    false,
+                    true,
+                    {}
+                  )
+                "
+              >
+                添加
+              </el-button>
+            </el-col>
+          </el-row>
+        </el-col>
+      </el-row>
+
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <goods-class-tree
+            style="margin-left: -5px"
+            :list="depart"
+            :level="1"
+            :pid="0"
+            :powers="powers"
+            @addEdit="addEditFn"
+            @openChildren="openChildren"
+            @status="setstatus"
+            :page="pageInfo"
+            @del="del"
+            @page-curr-change="handlePageChange"
+            @page-size-change="handleSizeChange"
+            @screen-reset="
+              pageInfo.curr = 1;
+              parmValue.page = 1;
+              searchList();
+            "
+            @screen-submit="
+              pageInfo.curr = 1;
+              parmValue.page = 1;
+              searchList();
+            "
+          />
+          <goods-tree
+            style="margin-left: -5px"
+            :list="item"
+            :level="1"
+            :pid="0"
+            @setUpEdit="setUpEdit"
+          />
+        </el-col>
+        <div
+          class="no-data"
+          v-if="item && item.length === 0 && depart && depart.length === 0"
+        >
+          暂无数据
+        </div>
+      </el-row>
+
+      <add-edit
+        :id="modelId"
+        :show-model="showModel"
+        :level="level"
+        :pid="parentIds"
+        :is-add="isAdd"
+        :form-data="formData"
+        :type="parmValue.type"
+        :is-detail="isDetail"
+        @refresh="searchList"
+        @cancel="showModel = false"
+      />
+    </div>
+    <div v-else>
+      <no-auth></no-auth>
+    </div>
+  </div>
+</template>
+<script>
+import asyncRequest from "@/apis/service/purchaseIn/goodsClass";
+
+import mixinPage from "@/mixins/elPaginationHandle";
+// import asyncRequest from "@/apis/service/interest/organize";
+import addEdit from "./addEdit";
+import statusList from "@/assets/js/statusList";
+import { mapGetters } from "vuex";
+import resToken from "@/mixins/resToken";
+export default {
+  name: "goodsClass",
+  components: {
+    addEdit,
+  },
+  mixins: [mixinPage, resToken],
+  computed: {
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    powers() {
+      let tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "goodsClass"
+        ) || {};
+      if (tran && tran.action && tran.action.length > 0) {
+        return tran.action;
+      } else {
+        return [];
+      }
+    },
+  },
+  data() {
+    return {
+      goods_className: [],
+      titleList: [],
+      sitem: null,
+      statusList: statusList,
+      loading: true,
+      showModel: false,
+      showInterface: false,
+      isDetail: false,
+      isAdd: true,
+      level: 1,
+      modelId: 0,
+      formData: {},
+      parentIds: "",
+      parmValue: {
+        pid: "", //父级部门ID
+        cat_name: "", //分类名称
+        page: 1,
+        size: 15,
+      },
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      item: [],
+      // 表格 - 数据
+      depart: [],
+    };
+  },
+  mounted() {
+    this.searchList();
+  },
+  methods: {
+    restSearch() {
+      this.parmValue = {
+        pid: "", //父级部门ID
+        cat_name: "", //分类名称
+        page: 1,
+        size: 15,
+      };
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.searchList();
+    },
+
+    async changeBreadcrumb(index) {
+      console.log(index);
+      if (index + 1 !== this.titleList.length) {
+        this.parmValue.pid = this.titleList[index].id;
+        this.titleList = this.titleList.slice(0, index + 1);
+      } else {
+        this.parmValue.pid = 0;
+        this.titleList = [];
+      }
+      await this.searchList();
+    },
+    async openChildren(item) {
+      this.parmValue.pid = item.id;
+      let model = {
+        id: item.id,
+        titleName: item.name,
+      };
+      this.titleList.push(model);
+      await this.searchList();
+    },
+    openModal(id, isDetail, sitem) {
+      this.showModel = true;
+      this.modelId = id;
+      this.isDetail = isDetail;
+      this.sitem = sitem;
+    },
+    openPasswordModal(id, isDetail) {
+      this.passwordModel = true;
+      this.passwordModelId = id;
+      this.isPasswordDetail = isDetail;
+    },
+    async setUpEdit(id, position) {
+      if (position === "1") {
+        const model = {
+          id: id,
+          // position: "2",
+        };
+        let res = await asyncRequest.userp(model);
+        if (res && res.code === 0) {
+          this.$notify.success({
+            title: "设置成功!",
+            message: "",
+          });
+          await this.searchList();
+        } else if (res && res.code >= 100 && res.code <= 104) {
+          await this.logout();
+        } else {
+          this.$message.warning(res.message);
+        }
+      } else {
+        this.$message.warning("该账户已是部门负责人!");
+      }
+    },
+    addEditFn(id, pid, level, isDetail, isAdd, formData) {
+      console.log(
+        "id:",
+        id,
+        "pid",
+        pid,
+        "level:",
+        level,
+        "sDetail:",
+        isDetail,
+        "isAdd:",
+        isAdd,
+        "formData:",
+        formData
+      );
+      this.showModel = true;
+      this.modelId = id;
+      this.level = level;
+      this.parentIds = pid;
+      this.isDetail = isDetail;
+      this.isAdd = isAdd;
+      this.formData = formData;
+    },
+
+    async setstatus(id, parentIds, level, status) {
+      console.log(
+        "id:",
+        id,
+        "pID:",
+        parentIds,
+        "level:",
+        level,
+        "status:",
+        status
+      );
+      await this.$confirm(`确定要${status === "0" ? "启用" : "禁用"}?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          console.log();
+          let res = await asyncRequest.status(model);
+
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "修改成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+
+    async del(id, parentIds, level, status) {
+      console.log(
+        `openChildren-id, parentIds, level:${id}-${parentIds}-${level}-${status}`
+      );
+      await this.$confirm(`确定要删除?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+          };
+          let res = await asyncRequest.delete(model);
+
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "删除成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+
+    async concatData(id, parentIds, level) {
+      console.log(id, parentIds, level);
+      this.loading = true;
+      const res = await asyncRequest.list({});
+      let depart = [];
+      if (res && res.code === 0 && res.data) {
+        depart = res.data;
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+      let arr = JSON.parse(JSON.stringify(this.depart));
+      // if (level === 1) {
+      arr = arr.map((val, index) => {
+        if (level === 1 ? id : parentIds === val.id) {
+          val.child = depart[index].child;
+        }
+        return val;
+      });
+
+      this.depart = arr;
+      this.loading = false;
+    },
+    async deleteById(id, status) {
+      await this.$confirm("确定要删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "删除成功",
+              message: "",
+            });
+            this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    async searchList() {
+      this.loading = true;
+      const res = await asyncRequest.list(this.parmValue);
+      if (res && res.code === 0 && res.data) {
+        console.log(res.data.list);
+        // const { depart, item } = res.data;
+        let arr = [];
+        res.data.list.forEach((element) => {
+          let obj = {
+            name: element.cat_name,
+            id: element.id,
+            pid: element.pid,
+            level: element.level,
+            status: element.status,
+          };
+          // this.depart.push
+          arr.push(obj);
+        });
+        // console.log(arr);
+        this.depart = arr;
+        this.pageInfo.total = Number(res.data.count);
+        console.log(this.pageInfo);
+        // this.item = item;
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.depart = [];
+        // this.item = [];
+        this.pageInfo.total = 0;
+      }
+      this.loading = false;
+    },
+    async statusConfirm(id, status) {
+      await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          this.loading = true;
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 0) {
+            this.loading = false;
+            this.$notify.success({
+              title: "状态修改成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    goodsClassChange(e) {
+      console.log(e);
+      console.log(this.parmValue);
+    },
+  },
+};
+</script>
+   <style lang="scss" scoped>
+.goodsClass {
+  .no-data {
+    padding: 25px 0;
+    text-align: center;
+    color: #909399;
+    margin: 30px 10px 0 10px;
+    border-radius: 8px;
+    border: 1px solid #dfe6ec;
+    // border-right: 1px solid #dfe6ec;
+    // border-bottom: 1px solid #dfe6ec;
+  }
+  .my-breadcrumb {
+    .my-breadcrumb-item {
+      float: left;
+      span {
+        height: 21px;
+        line-height: 21px;
+      }
+      .label {
+        padding: 0 5px 0 0;
+        color: 010101;
+      }
+      .separator {
+        color: #787878;
+        font-size: 13px;
+        padding: 0 5px 0 0;
+      }
+      &:last-child {
+        .label {
+          color: #787878;
+        }
+      }
+      &.chover {
+        cursor: pointer;
+      }
+    }
+  }
+}
+</style>

+ 0 - 0
src/views/serviceParam/goodsClass/商品分类