123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- /**
- * @description store enum (枚举页面)各种配置枚举
- */
- import {
- getTypeList,
- } from "@/api/common" /* eslint-disable-line */
- const state = {
- evectionTypeList: null, // 出差列表
- moduleList: null, // 模块列表
- degreeList: null, // 缓急程度
- applyTypeList: null, // 采购类型
- applyPayTypeList: null, // 采购支付类型
- offerTypeList: null, // 呈批类型
- leaveTypeList: null, // 请假类型
- maintainTypeList: null, // 维修类型
- contractTypeList: null, // 合同类型
- // 1=待审批,2=审批中,3=审批通过,4=审批拒绝
- // NOTE: 审批信息中的审核流程枚举
- approveFlowPathEnum: [undefined, '待审核', '审核中', '已通过', '已驳回'],
- // :2=审批中,3=审批通过,4=审批驳回,5=审批撤销
- // NOTE: 申请`status`枚举
- approveInfoEnum: [],
- enumIsYesOrNo: [
- {
- id: 0,
- name: '否'
- },
- {
- id: 1,
- name: '是'
- }
- ]
- }
- const getters = {
- // NOTE: 审核流程枚举
- getApproveFlowPathEnum: state => (status) => {
- if (![1, 2, 3, 4].includes(status)) return 'unknow'
- return state.approveFlowPathEnum[status]
- }
- }
- const mutations = {
- // NOTE: 出差类型
- SET_EVECTION_TYPE_LIST(state, paylod) {
- state.evectionTypeList = [...paylod.list]
- },
- // NOTE: 模块列表
- SET_MODULE_LIST(state, paylod) {
- state.moduleList = [...paylod.list]
- },
- // NOTE: 缓急程度
- SET_DEGREE_LIST(state, paylod) {
- state.degreeList = [...paylod.list]
- },
- // NOTE: 采购类型
- SET_APPLY_TYPE_LIST(state, paylod) {
- state.applyTypeList = [...paylod.list]
- },
- // NOTE: 采购支付类型
- SET_APPLY_PAY_TYPE_LIST(state, paylod) {
- state.applyPayTypeList = [...paylod.list]
- },
- // NOTE: 呈批类型
- SET_OFFER_TYPE_LIST(state, paylod) {
- state.offerTypeList = [...paylod.list]
- },
- // NOTE: 请假类型
- SET_LEAVE_TYPE_LIST(state, paylod) {
- state.leaveTypeList = [...paylod.list]
- },
- // NOTE: 维修类型
- SET_MAINTAIN_TYPE_LIST(state, paylod) {
- state.maintainTypeList = [...paylod.list]
- },
- // NOTE: 合同类型
- SET_CONTRACT_TYPE_LIST(state, paylod) {
- state.contractTypeList = [...paylod.list]
- }
- }
- const actions = {
- getTypeList({ commit }) {
- return new Promise((resolve, reject) => {
- getTypeList().then(result => {
- if (result.code === 1) {
- const {
- module_list,
- degree_list,
- pay_type_list,
- data1,
- data2,
- data5,
- data6,
- data8,
- data9
- } = result.data
- commit({
- type: 'SET_EVECTION_TYPE_LIST',
- list: data5
- })
- commit({
- type: 'SET_MODULE_LIST',
- list: module_list
- })
- commit({
- type: 'SET_DEGREE_LIST',
- list: degree_list
- })
- commit({
- type: 'SET_APPLY_PAY_TYPE_LIST',
- list: pay_type_list
- })
- commit({
- type: 'SET_APPLY_TYPE_LIST',
- list: data1
- })
- commit({
- type: 'SET_OFFER_TYPE_LIST',
- list: data2
- })
- commit({
- type: 'SET_LEAVE_TYPE_LIST',
- list: data6
- })
- commit({
- type: 'SET_MAINTAIN_TYPE_LIST',
- list: data8
- })
- commit({
- type: 'SET_CONTRACT_TYPE_LIST',
- list: data9
- })
- resolve()
- }
- }).catch(error => reject(error))
- })
- },
- // 获取出差类型
- // getEvectionTypeList({ commit }) {
- // return new Promise((resolve, reject) => {
- // getAwayType().then(result => {
- // if (result.code === 1) {
- // commit({
- // type: 'SET_EVECTION_TYPE_LIST',
- // list: result.data
- // })
- // resolve(result.data)
- // }
- // }).catch(error => {
- // console.log('getEvectionTypeList error>', error);
- // reject([])
- // })
- // })
- // }
- }
- export default {
- namespaced: true,
- state,
- getters,
- mutations,
- actions
- }
|