import { get, post } from 'http/index' export const useStore = defineStore('myUser', { state: () => { return { currentMenuType: true, currentMenuItem: 'baseInfo', menuList: [ { title: '基础信息', name: 'baseInfo' }, { title: '订单管理', name: 'orderManagement' }, { title: '子账号管理', name: 'subAccount' }, { title: '业务开通', name: 'business' }, { title: '寻源需求', name: 'sourcingNeed' }, ], provinceList: [], // 省份信息 marketList: [], // 市级信息 areaList: [], // 区级信息 idTypeList: [], // 证件类型 companyTypeList: [],//企业类型 companyLtdList: [],//企业所属 deviceTypeList: [], // 设备类型大类 deviceTypeSonList: [], // 设备类型子类 deviceTypeSunList: [], // 设备类型小类 } }, getters: { }, actions: { updateText() { console.log('updateText') }, editCurrentMenuType(val: any) { this.currentMenuType = val }, editcurrentMenuItem(val: any) { this.currentMenuItem = val }, editcurrentMenuList(val: any) { this.menuList = val }, // 获取省份信息 async getprovinceList() { const res: any = await post('/zlpt-system/baseAddress/selectAddress', {}) this.provinceList = res.data }, // 获取市级信息 async getmarketList(val: any) { const res: any = await post('/zlpt-system/baseAddress/selectAddress', { code: val }) console.log(res, '市区信息'); this.marketList = res.data }, // 获取区级信息 async getareaList(val: any) { const res: any = await post('/zlpt-system/baseAddress/selectAddress', { code: val }) this.areaList = res.data }, // 获取证件类型 async getIdTypeList() { const res: any = await post('/zlpt-company/company_type/selectIdCard', {}) console.log(res, '证件类型'); this.idTypeList = res.rows }, // 获取企业类型 async getcompanyTypeList() { const res: any = await post('/zlpt-company/company_type/selectCompanyTypeList', {}) console.log(res, '企业类型'); this.companyTypeList = res.rows }, // 获取企业所属 async getcompanyLtdList() { const res: any = await post('/zlpt-company/company_type/selectCompanyLtd', {}) console.log(res, '企业所属'); this.companyLtdList = res.rows }, // 获取设备类型大类 async getDeviceTypeList() { const res: any = await post('/zlpt-equip/type/list', {}) this.deviceTypeList = res.rows console.log(res, '设备类型大类**---***'); }, // 获取设备类型小类 async getDeviceTypeSonList(val: any) { const res: any = await post('/zlpt-equip/type/list', { typeId: val }) this.deviceTypeSonList = res.rows console.log(res, '设备类型子类**---***'); }, // 获取设备类型大类 async getDeviceTypeSunList(val: any) { const res: any = await post('/zlpt-equip/type/list', { typeId: val }) this.deviceTypeSunList = res.rows console.log(res, '设备类型小类**---***'); }, }, persist: { enabled: true, // 开启数据缓存 strategies: [ { // 自定义存储的 key,默认是 store.$id key: 'myUser', storage: sessionStorage, //缓存模式 可选 localStorage sessionStorage // state 中的字段名,按组打包储存 paths: ['currentMenuType', 'currentMenuItem', 'menuList'] //需要缓存的字段 与 state中相关联 } ] } })