Commit 71e24d4f authored by 周远喜's avatar 周远喜

ok

parent e80688da
const config={
tenantCode:"",//租户Id
//业务设置
bus:{
orderStartWarning:3,//订单开工预警
orderFinishWarning:3,//订单完工预警
excuteStartWarning:3,//工单开工预警
excuteEndWarning:3,//工单完工预警
storeWarning:true,//库存预警
setHeaderWarning:3,//工艺设置预警
suportingFinishWarning:1,//配套完成预警
excuteHandover:true,//工单交接开关
inenerExcuteHandover:false,//同车间工单交接开关
suportingOverStart:false,//配套完成才能开工
},
//站点设置
common:{
language:"zh-cn",//默认语言
password:"111111",//系统
passwordRule:0,//密码规则
firstLoginEditPassword:true,
loginValidHoure:24,// 登陆有效期设置
loginCode:0,//登陆验证码开启
pageSize:20,//页面分页大小,
windowWidth:1200,//默认页面大小//
windowMove:false,
bug:false,
ExceptionWarning:true,
ExceptionMessage:"",
}
}
export default config;
\ No newline at end of file
......@@ -255,4 +255,44 @@ henq.dirCode = (code, v) => {
}
return items
}
//js对象深度比较 全相等
henq.isEqual = (oldData, newData) => {
compare=this;
function isObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]'
}
// 判断此对象是否是Object类型
function isArray(arr) {
return Object.prototype.toString.call(arr) === '[object Array]'
}
// 类型为基本类型时,如果相同,则返回true
if (oldData === newData) return true
if (compareObj.isObject(oldData) && compareObj.isObject(newData) && Object.keys(oldData).length === Object.keys(newData).length) {
// 类型为对象并且元素个数相同
// 遍历所有对象中所有属性,判断元素是否相同
for (const key in oldData) {
if (oldData.hasOwnProperty(key)) {
if (!compareObj.compare(oldData[key], newData[key])) {
// 对象中具有不相同属性 返回false
return false
}
}
}
} else if (compareObj.isArray(oldData) && compareObj.isArray(oldData) && oldData.length === newData.length) {
// 类型为数组并且数组长度相同
for (let i = 0, length = oldData.length; i < length; i++) {
if (!compareObj.compare(oldData[i], newData[i])) {
// 如果数组元素中具有不相同元素,返回false
return false
}
}
} else {
// 其它类型,均返回false
return false
}
// 走到这里,说明数组或者对象中所有元素都相同,返回true
return true
}
export default henq;
<template>
<div class="config flex ">
<div class="menu">
<Menu theme="light" active-name="1-2" :open-names="site">
<MenuItem name="site" to="#site">站点设置</MenuItem>
<MenuItem name="bus" to="#bus">业务设置</MenuItem>
</Menu>
</div>
<div class="main">
<div class="tool">
<Button type="primary" @click="save">保存更改</Button>
<Button type="text">恢复默认</Button>
</div>
<Form ref="form" :model="config" :rules="rules" :label-width="100">
<div id="site">
<h3>站点设置</h3>
</div>
<div id="bus">
<h3>业务设置</h3>
</div>
</Form>
</div>
</div>
</template>
<script>
export default {
name: "",
data() {
return {
config: null,
rules: {},
};
},
methods: {
save() {},
reset() {},
},
};
</script>
<style lang="less">
</style>
\ No newline at end of file
import createVuexAlong from 'vuex-along'
import Api from '@/plugins/request'
export const state=()=>({
counter:0,
dictionary: new Map(),//所有字典项
userMap:[],//所有用户缓存;
userInfo:{
userId:0,
userName:""
export const state = () => ({
counter: 0,
dictionary: new Map(), //所有字典项
userMap: [], //所有用户缓存;
userInfo: {
userId: 0,
userName: "",
tenantCode: "000001"
},
siteConfig:{},
defaultConfig:{},
siteConfig: {},
defaultConfig: {},
})
export const getters={
export const getters = {
dictionaryByKey: (state) => (key) => {
let result = [];
let items = state.dictionary.get(key);
......@@ -21,7 +22,7 @@ export const getters={
}
return result;
},
getUser:state=>key=>{
getUser: state => key => {
// try{
// if(state.userMap.has(key)){
// return state.userMap.get(key);
......@@ -29,16 +30,18 @@ export const getters={
// }catch(e){
// console.log(e);
// }
let user=state.userMap.filter(u=>{return u.id==key});
if(user.length>0){
let user = state.userMap.filter(u => {
return u.id == key
});
if (user.length > 0) {
return user[0]
}else{
} else {
return null;
}
}
}
export const mutations={
increment(state){
export const mutations = {
increment(state) {
state.counter++
},
setUserInfo(state, userInfo) {
......@@ -46,27 +49,40 @@ export const mutations={
// sessionStorage.setItem("userInfo", JSON.stringify(userInfo));
// sessionStorage.setItem("token", userInfo.token);
},
addUser(state,user){
addUser(state, user) {
state.userMap.push(user);
},
setDictionary(state, dictionary) {
state.dictionary = dictionary;
},
setSiteConfig(state,config){
state.siteConfig=config;
setSiteConfig(state, config) {
state.siteConfig = config;
},
setDefaultConfig(state, config) {
state.defaultConfig = config;
}
}
export const actions={
async loadUser({commit},key){
export const actions = {
async loadUser({
commit
}, key) {
let { result } = await this.$api.get(`${systemUrl}/user/getuser`,{id:key});
console.warn("result",result)
commit("addUser",result);
let {
result
} = await this.$api.get(`${systemUrl}/user/getuser`, {
id: key
});
console.warn("result", result)
commit("addUser", result);
},
async loadDictionary({ commit }) {
async loadDictionary({
commit
}) {
let url = `${systemUrl}/Dictionary/GetAll`
let { result } = await Api.get(url);
let {
result
} = await Api.get(url);
var map = new Map();
......@@ -77,23 +93,38 @@ export const actions={
}
commit("setDictionary", map);
},
loadSiteConfig(){
// let params={
// pageSize:2,
// conditions:[{
// "fieldName":"key",
// "fieldValue":"a,b",
// "conditionalType":"In",
// },]
// }
// let {result} = await Api.post(`${systemUrl}/config/list`,params);
// if(result.length>1){
// conm
// }
async loadSiteConfig({
commit,
state
}) {
let params = {
pageSize: 2,
conditions: [{
"fieldName": "key",
"fieldValue": "defaultConfig,tenant-" + state.userInfo.tenantCode,
"conditionalType": "In",
}, ]
}
let {
result
} = await Api.post(`${systemUrl}/config/list`, params);
if (result[0]) {
commit("setDefaultConfig", result[0])
}
if (result[1]) {
commit("setSiteConfig", result[1])
}else{
if(result[0]){
commit("setSiteConfig", result[0])
}
}
},
async saveConfig({commit},config){
}
}
export const plugins= [
export const plugins = [
createVuexAlong({
// 设置保存的集合名字,避免同站点下的多项目数据冲突
name: "hyhmes",
......@@ -107,6 +138,6 @@ export const plugins= [
list: ["hyhmes.session"],
},
}),
]
//设置 strict 为不严格模式,即可在actions中修改state
export const strict=false;
\ No newline at end of file
]
//设置 strict 为不严格模式,即可在actions中修改state
export const strict = false;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment