Newer
Older
urbanLifeline_YanAn / src / store / modules / order.js
@zhangzhihui zhangzhihui on 8 Nov 869 bytes 1
import { listDept } from '@/api/system/dept'; // 部门
import { listUser } from '@/api/system/user';
import { handleTree } from '@/utils/ruoyi';

const useOrderStore = defineStore('order', {
  state: () => {
    return {
      deptList: [],
      userList: [],
    };
  },
  actions: {
    getDeptList(data = {}) {
      /* 
    {
        deptName: undefined,
        status: undefined,
    }
    */
      listDept(data).then(response => {
        this.deptList = handleTree(response.data, 'deptId');
        console.log('🚀 ~ listDept ~ this.deptList:', this.deptList, response);
      });
    },
    getUserList(data = {}) {
      listUser(data).then(response => {
        this.userList = handleTree(response.data, 'deptId');
        console.log('🚀 ~ listUser ~ this.userList:', this.userList, response);
      });
    },
  },
});
export default useOrderStore;