阿拉蕾 1 year ago
parent
commit
bb5e389659
2 changed files with 50 additions and 8 deletions
  1. 6 1
      src/api/company/company.js
  2. 44 7
      src/views/store/storeOrder/allList.vue

+ 6 - 1
src/api/company/company.js

@@ -21,6 +21,11 @@ export function getCompanySms() {
   })
 }
 
-
+export function getCompanyList() {
+  return request({
+    url: '/company/company/getCompanyList',
+    method: 'get'
+  })
+}
  
 

+ 44 - 7
src/views/store/storeOrder/allList.vue

@@ -2,6 +2,16 @@
   <div class="app-container">
       <!--用户数据-->
         <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+          <el-form-item label="公司名" prop="companyId">
+            <el-select filterable  v-model="queryParams.companyId" placeholder="请选择公司名"  @change="companyChange" clearable size="small">
+                <el-option
+                  v-for="item in companys"
+                  :key="item.companyId"
+                  :label="item.companyName"
+                  :value="item.companyId"
+                />
+            </el-select>
+          </el-form-item>
           <el-form-item label="所属部门" prop="deptId">
               <treeselect style="width:220px" v-model="queryParams.deptId" :options="deptOptions" :show-count="true" placeholder="请选择所属部门" />
           </el-form-item>
@@ -289,6 +299,7 @@ import config from "@/utils/config";
 import QRCode from 'qrcodejs2'
 import { treeselect } from "@/api/company/companyDept";
 import Treeselect from "@riophae/vue-treeselect";
+import { getCompanyList } from "@/api/company/company";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 export default {
   components: { Treeselect,productOrder,productSelect,addUser,addUserAddress },
@@ -297,7 +308,10 @@ export default {
     return {
       customerUserStatusOptions:[],
       // 部门树选项
-      deptOptions: undefined,
+      companys:[],
+      deptOptions:[],
+      companyId:undefined,
+      deptId:undefined,
       // 是否显示弹出层
       open: false,
       // 部门名称
@@ -438,12 +452,19 @@ export default {
   },
   watch: {
     // 根据名称筛选部门树
-    deptName(val) {
-        this.$refs.tree.filter(val);
-      },
+    watch: {
+    // 监听deptId
+    'deptId': 'currDeptChange'
+    }
   },
   created() {
-    this.getTreeselect();
+    getCompanyList().then(response => {
+        this.companys = response.data;
+         if(this.companys!=null&&this.companys.length>0){
+          this.companyId=this.companys[0].companyId;
+          this.getTreeselect();
+        }
+    });
     this.getDicts("crm_customer_user_status").then((response) => {
         this.customerUserStatusOptions = response.data;
     });
@@ -473,10 +494,26 @@ export default {
   },
   methods: {
      /** 查询部门下拉树结构 */
-     getTreeselect() {
-      treeselect().then((response) => {
+    getTreeselect() {
+      var that=this;
+      var param={companyId:this.companyId}
+      treeselect(param).then((response) => {
         this.deptOptions = response.data;
+        console.log(this.deptOptions)
+        if(response.data!=null&&response.data.length>0){
+          //this.queryParams.deptId=response.data[0].id;
+        }
       });
+    },
+     companyChange(val){
+      console.log(val);
+      this.companyId=val;
+      this.getTreeselect();
+    },
+     currDeptChange(val){
+      console.log(val)
+      this.queryParams.deptId=val;
+      this.getList();
     },
     // 筛选节点
     filterNode(value, data) {