|
@@ -1,6 +1,6 @@
|
|
|
import consts from '@/consts'
|
|
import consts from '@/consts'
|
|
|
import { LabelStatusColorMap } from '@/pages/Customer/Company/components/PersonLabel/const'
|
|
import { LabelStatusColorMap } from '@/pages/Customer/Company/components/PersonLabel/const'
|
|
|
-import { queryTagList } from '@/services/customer'
|
|
|
|
|
|
|
+import { queryClientSourceList, queryTagList } from '@/services/customer'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
namespace: 'client',
|
|
namespace: 'client',
|
|
@@ -8,7 +8,8 @@ export default {
|
|
|
personTags: [], // 个人标签
|
|
personTags: [], // 个人标签
|
|
|
personTagColorMap: {}, // 个人标签的颜色映射关系
|
|
personTagColorMap: {}, // 个人标签的颜色映射关系
|
|
|
teamTags: [], // 协作标签
|
|
teamTags: [], // 协作标签
|
|
|
- teamTagColorMap: {} // 协作标签的颜色映射关系
|
|
|
|
|
|
|
+ teamTagColorMap: {}, // 协作标签的颜色映射关系
|
|
|
|
|
+ sourceList: [] // 来源列表
|
|
|
},
|
|
},
|
|
|
// 用于处理异步操作和业务逻辑,由action触发,但不能修改state
|
|
// 用于处理异步操作和业务逻辑,由action触发,但不能修改state
|
|
|
effects: {
|
|
effects: {
|
|
@@ -20,14 +21,14 @@ export default {
|
|
|
type: 'changeState',
|
|
type: 'changeState',
|
|
|
payload: {
|
|
payload: {
|
|
|
key: 'personTags',
|
|
key: 'personTags',
|
|
|
- data: response.data || []
|
|
|
|
|
|
|
+ value: response.data || []
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
yield put({
|
|
yield put({
|
|
|
type: 'changeState',
|
|
type: 'changeState',
|
|
|
payload: {
|
|
payload: {
|
|
|
key: 'personTagColorMap',
|
|
key: 'personTagColorMap',
|
|
|
- data:
|
|
|
|
|
|
|
+ value:
|
|
|
response.data?.reduce((curr, prev, idx) => {
|
|
response.data?.reduce((curr, prev, idx) => {
|
|
|
const item = { ...curr, [prev.id]: LabelStatusColorMap[tagType][idx] }
|
|
const item = { ...curr, [prev.id]: LabelStatusColorMap[tagType][idx] }
|
|
|
return item
|
|
return item
|
|
@@ -44,14 +45,14 @@ export default {
|
|
|
type: 'changeState',
|
|
type: 'changeState',
|
|
|
payload: {
|
|
payload: {
|
|
|
key: 'teamTags',
|
|
key: 'teamTags',
|
|
|
- data: response.data || []
|
|
|
|
|
|
|
+ value: response.data || []
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
yield put({
|
|
yield put({
|
|
|
type: 'changeState',
|
|
type: 'changeState',
|
|
|
payload: {
|
|
payload: {
|
|
|
key: 'teamTagColorMap',
|
|
key: 'teamTagColorMap',
|
|
|
- data:
|
|
|
|
|
|
|
+ value:
|
|
|
response.data?.reduce((curr, prev, idx) => {
|
|
response.data?.reduce((curr, prev, idx) => {
|
|
|
const item = { ...curr, [prev.id]: LabelStatusColorMap[tagType][idx] }
|
|
const item = { ...curr, [prev.id]: LabelStatusColorMap[tagType][idx] }
|
|
|
return item
|
|
return item
|
|
@@ -59,6 +60,18 @@ export default {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ *fetchSourceList(_, { call, put }) {
|
|
|
|
|
+ const response = yield call(queryClientSourceList)
|
|
|
|
|
+ if (response?.code === consts.RET_CODE.SUCCESS) {
|
|
|
|
|
+ yield put({
|
|
|
|
|
+ type: 'changeState',
|
|
|
|
|
+ payload: {
|
|
|
|
|
+ key: 'sourceList',
|
|
|
|
|
+ value: response.data.map(item => ({ value: item.id, label: item.name }))
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// reducers:用于处理同步操作,由action触发,可修改state
|
|
// reducers:用于处理同步操作,由action触发,可修改state
|
|
@@ -67,7 +80,7 @@ export default {
|
|
|
changeState(state, action) {
|
|
changeState(state, action) {
|
|
|
return {
|
|
return {
|
|
|
...state,
|
|
...state,
|
|
|
- [action.payload.key]: action.payload.data
|
|
|
|
|
|
|
+ [action.payload.key]: action.payload.value
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|