1404/11/04- first
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
interface State {
|
||||
/* docGroupsData: Array<GroupItem> | undefined
|
||||
docTypeListData: Array<DocItem> | undefined
|
||||
natureListData: Array<Const> | undefined
|
||||
budgetListData: Array<Const> | undefined
|
||||
projectTypeListData: Array<Const> | undefined
|
||||
userTypeListData: Array<Const> | undefined
|
||||
sectionListData: Array<Const> | undefined
|
||||
projectListData: Array<Customer> | undefined
|
||||
processListData: Array<Process> | undefined
|
||||
provincesListData: Array<Province> | undefined
|
||||
cityListData: Array<City> | undefined
|
||||
usersListData: Array<User> | undefined*/
|
||||
//myInfo: User | undefined
|
||||
// treePermissionData: any
|
||||
networkError: boolean
|
||||
}
|
||||
|
||||
export const useStaticApiListsStore = defineStore('staticApiLists', {
|
||||
state: (): State => {
|
||||
return {
|
||||
/* docGroupsData: undefined,
|
||||
docTypeListData: undefined,
|
||||
natureListData: undefined,
|
||||
budgetListData: undefined,
|
||||
projectTypeListData: undefined,
|
||||
userTypeListData: undefined,
|
||||
usersListData: undefined,
|
||||
sectionListData: undefined,
|
||||
treePermissionData: undefined,
|
||||
processListData: undefined,
|
||||
provincesListData: undefined,
|
||||
projectListData: undefined,
|
||||
cityListData: undefined,*/
|
||||
// myInfo: undefined,
|
||||
networkError: false
|
||||
}
|
||||
},
|
||||
// could also be defined as
|
||||
// state: () => ({ count: 0 })
|
||||
actions: {
|
||||
/* async getDocGroupList() {
|
||||
try {
|
||||
this.docGroupsData = await getDocGroupList()
|
||||
return this.docGroupsData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getUsersList() {
|
||||
try {
|
||||
this.usersListData = await getUsersList()
|
||||
return this.usersListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getDocTypeList() {
|
||||
try {
|
||||
this.docTypeListData = await getDocTypeList()
|
||||
return this.docTypeListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getNatureConst() {
|
||||
try {
|
||||
this.natureListData = await getNatureConst()
|
||||
// console.log('hell', this.natureListData)
|
||||
return this.natureListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getBudgetConst() {
|
||||
try {
|
||||
this.budgetListData = await getBudgetConst()
|
||||
return this.budgetListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getProjectTypeConst() {
|
||||
try {
|
||||
this.projectTypeListData = await getProjectConst()
|
||||
return this.projectTypeListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getUserTypeConst() {
|
||||
try {
|
||||
this.userTypeListData = await getUserTypeConst()
|
||||
return this.userTypeListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getSectionConst() {
|
||||
try {
|
||||
this.sectionListData = await getSectionConst()
|
||||
return this.sectionListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getProcessList() {
|
||||
try {
|
||||
this.processListData = await getProcessList()
|
||||
return this.processListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getTreeDataList() {
|
||||
try {
|
||||
this.treePermissionData = await getTreeData()
|
||||
return this.treePermissionData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getProjectList() {
|
||||
try {
|
||||
this.projectListData = await getProjectList()
|
||||
return this.projectListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getProvincesList() {
|
||||
try {
|
||||
this.provincesListData = await getProvinces()
|
||||
return this.provincesListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async getCityList() {
|
||||
try {
|
||||
this.cityListData = await getAllCities()
|
||||
return this.cityListData
|
||||
} catch (e) {
|
||||
this.networkError = true
|
||||
}
|
||||
},
|
||||
async readyDocGroupList() {
|
||||
return this.docGroupsData ?? (await this.getDocGroupList())
|
||||
},
|
||||
async readyDocTypeList() {
|
||||
return this.docTypeListData ?? (await this.getDocTypeList())
|
||||
},
|
||||
async readyNatureConst() {
|
||||
return this.natureListData ?? (await this.getNatureConst())
|
||||
},
|
||||
async readyBudgetConst() {
|
||||
return this.budgetListData ?? (await this.getBudgetConst())
|
||||
},
|
||||
async readyProjectTypeConst() {
|
||||
return this.projectTypeListData ?? (await this.getProjectTypeConst())
|
||||
},
|
||||
async readyUserTypeConst() {
|
||||
return this.userTypeListData ?? (await this.getUserTypeConst())
|
||||
},
|
||||
async readySectionConst() {
|
||||
return this.sectionListData ?? (await this.getSectionConst())
|
||||
},
|
||||
async readyProcessList() {
|
||||
return this.processListData ?? (await this.getProcessList())
|
||||
},
|
||||
async readyTreeDataList() {
|
||||
return this.treePermissionData ?? (await this.getTreeDataList())
|
||||
},
|
||||
async readyProjectList() {
|
||||
return this.projectListData ?? (await this.getProjectList())
|
||||
},
|
||||
async readyProvincesList() {
|
||||
return this.provincesListData ?? (await this.getProvincesList())
|
||||
},
|
||||
async readyCitiesList() {
|
||||
return this.cityListData ?? (await this.getCityList())
|
||||
},
|
||||
async readyUserList() {
|
||||
console.log('sasasasa', this.usersListData)
|
||||
return this.usersListData ?? (await this.getUsersList())
|
||||
}*/
|
||||
/*async getWholeData() {
|
||||
await this.getDocGroupList()
|
||||
await this.getDocTypeList()
|
||||
await this.getNatureConst()
|
||||
await this.getProjectTypeConst()
|
||||
await this.getBudgetConst()
|
||||
await this.getUserTypeConst()
|
||||
await this.getProjectList()
|
||||
await this.getProcessList()
|
||||
await this.getProvincesList()
|
||||
}*/
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user