| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- import Vue from 'vue';
- import Vuex from 'vuex';
- import axios from 'axios'
- import api from '../api/api'
- import tool from '../utils/tool'
- Vue.use(Vuex);
- export default new Vuex.Store({
- state: {
- pageOnlyRead:false,
- loading:false,
- siteinfo:{
- attinfos:[]
- },
- deplist:[],
- sys_options:[],
- shortcutlist:[],
- active_modules:{},
- checks:[],
- dataToForm:{}
- },
- getters: {
- siteinfo:state => state.siteinfo,
- loading:state => state.loading,
- deplist:state => state.deplist,
- sys_options:state => state.sys_options,
- pageOnlyRead:state => state.pageOnlyRead,
- shortcutlist:state => state.shortcutlist,
- active_modules:state => state.active_modules,
- checks:state => state.checks,
- dataToForm:state => state.dataToForm
- },
- mutations: {
- setSiteInfo(state,res) {
- state.siteinfo = res.data
- },
- setDeplist (state,res) {
- state.deplist = res
- },
- setSelectList (state,res) {
- state.sys_options = res.data
- },
- setUsershortcuts (state,param) {
- state.shortcutlist = [...param]
- },
- pageOnlyRead (state,bool) {
- state.pageOnlyRead = bool
- },
- checkClass (state,id) {
- state.checks.push(id)
- state.checks = [...new Set(state.checks)]
- },
- uncheckClass (state,id) {
- state.checks = state.checks.filter(e=>{
- return e !== id
- })
- },
- sendDataToForm (state,data) {
- state.dataToForm = data
- },
- },
- actions: {
- // 系统选项分类查询
- optiontypeselect ({commit}, param) {
- return new Promise(async (reslove,reject)=>{
- let obj = {
- "classname": "sysmanage.develop.optiontype.optiontype",
- "method": "optiontypeselect",
- "content": {
- "pageNumber": 1,
- "pageSize": 1000,
- "typename": param,
- "parameter": {
- }
- }
- }
- const res = await api.requested(obj)
- commit('setSelectList',res)
-
- reslove(res)
- })
-
- },
- // 查询站点信息
- async querySiteInfo ({commit}, param) {
- const res = await api.requested(param)
- commit('setSiteInfo',res)
- },
- // 创建下载记录
- async createdownlog ({commit}, param) {
- let obj = {
- "classname": "system.attachment.Attachment",
- "method": "createdownlog",
- "content": {
- "linksid": param.linksid,
- "attachmentid":param.attachmentid
- }
- }
- const res = await api.requested(obj)
- },
- // 存储部门列表数据
- setDeplistData ({commit}, param) {
- commit('setDeplist',param)
- },
- // 设置快捷栏
- async setUsershortcuts ({commit}, param) {
- const res = await api.requested({
- "classname": "sysmanage.develop.userauthforweb.userauth",
- "method": "query_usershortcuts",
- "content": {
- }
- })
- let data = JSON.parse(sessionStorage.getItem('module_info'))
- let modules = []
- data.forEach(mod => {
- modules = modules.concat(mod.modules)
- });
- let arr = []
- res.data.forEach(e=>{
- modules.forEach(mod=>{
- if (mod.systemmoduleid === e.systemmoduleid) {
- mod.issystem = e.issystem
- arr.push(mod)
- }
- })
- })
- commit('setUsershortcuts',arr)
- },
- // 查询标签数据
- async queryTagList ({commit}, param) {
- return new Promise(async (reslove,reject)=>{
- let obj = {
- "id": 20220929085401,
- "content": {
- "ownertable":param.table,
- "ownerid":param.id
- }
- }
- const res = await api.requested(obj)
- reslove(res.data)
- })
- },
- // 设置权限状态
- pageOnlyRead ({commit}, bool) {
- commit('pageOnlyRead',bool)
- },
- checkClass ({commit}, id) {
- commit('checkClass',id)
- },
- uncheckClass ({commit}, id) {
- commit('uncheckClass',id)
- },
- // 主文件向Form中的组件传值
- sendDataToForm ({commit}, data) {
- commit('sendDataToForm',data)
- },
- },
- modules: {
- },
- });
|