diff --git a/src/components/BulletWithSort.jsx b/src/components/BulletWithSort.jsx index a2d7c73..fc3159d 100644 --- a/src/components/BulletWithSort.jsx +++ b/src/components/BulletWithSort.jsx @@ -30,7 +30,7 @@ export default observer((props) => { const config = merge({ color: { - range: [ '#FFF3E1', '#FFe0b0', '#bfeec8'], // '#FFbcb8', '#FFe0b0', + range: [ '#FFF3E1', '#FFF3E1', '#FFe0b0', '#bfeec8'], // '#FFbcb8', '#FFe0b0', measure: '#5B8FF9', target: '#FF9845', }, diff --git a/src/libs/ht.js b/src/libs/ht.js index 8c8d152..f5a70be 100644 --- a/src/libs/ht.js +++ b/src/libs/ht.js @@ -117,7 +117,7 @@ export const dataFieldAlias = dataFieldOptions.reduce( */ export const KPIObjects = [ { key: 'overview', value: 'overview', label: '海纳' }, - { key: 'bu', value: 'bu', label: '事业部', data: bu }, + { key: 'bu', value: 'bu', label: 'HT事业部', data: bu }, { key: 'dept', value: 'dept', label: '小组', data: leafGroup }, { key: 'du', value: 'du', label: '销售小组', data: deptUnits }, { key: 'operator', value: 'operator', label: '顾问' }, diff --git a/src/stores/KPI.js b/src/stores/KPI.js index d8fd36e..dd76555 100644 --- a/src/stores/KPI.js +++ b/src/stores/KPI.js @@ -22,13 +22,14 @@ class KPI { } async onSubmit(tableData, { delQueue }) { + this.listLoading = true; const flushData = tableData.filter(row => !isEmpty(row.value) || !isEmpty(row?.kpi_id)); const postRes = isEmpty(flushData) ? true : await this.saveOrUpdate(flushData); const delRes = isEmpty(flush(delQueue)) ? true : await this.delByID(delQueue); return postRes && delRes; } - getList(param = {}) { + async getList(param = {}) { const _param = { date_type: 'applyDate', start_date: '2020-01-01', @@ -38,18 +39,17 @@ class KPI { }; this.listLoading = true; this.pageData = []; - return req.fetchJSON('/service-Analyse2/getkpi', _param).then((json) => { - if (json.errcode === 0) { - runInAction(() => { - this.listLoading = false; - this.originData = json.result; - const yearData = parseKPI(json.result, ['subject', 'object_id']); - // console.log(111, yearData, yearData[this.settingYear]); - this.pageData = yearData?.[this.settingYear]?.[this.settingSubject] || []; - }); - } - return this.pageData; - }); + const json = await req.fetchJSON('/service-Analyse2/getkpi', _param); + if (json.errcode === 0) { + runInAction(() => { + this.listLoading = false; + this.originData = json.result; + const yearData = parseKPI(json.result, ['subject', 'object_id']); + // console.log(111, yearData, yearData[this.settingYear]); + this.pageData = yearData?.[this.settingYear]?.[this.settingSubject] || []; + }); + } + return this.pageData; } settingYear = moment().year(); diff --git a/src/views/KPI.jsx b/src/views/KPI.jsx index 5c04c3a..524e364 100644 --- a/src/views/KPI.jsx +++ b/src/views/KPI.jsx @@ -58,6 +58,7 @@ export default observer((props) => { KPIStore.setSettingYear(formVal?.year?.year() || KPIStore.settingYear); // console.log('invoke on search', obj, formVal, getkpiParam); if (curObject === 'operator') { + KPIStore.setListLoading(true); const searchOperator = await DictDataStore.fetchDictData('operator', { is_assign: 1, dept_id: (obj?.DepartmentList || '').replace('ALL', ''), @@ -71,11 +72,12 @@ export default observer((props) => { delete getkpiParam.dept_id; } } - getKPIList(getkpiParam); + await getKPIList(getkpiParam); }; - const getKPIList = (getkpiParam) => { - KPIStore.getList(getkpiParam).then((data) => { - // setDataSource(data); + const getKPIList = async (getkpiParam) => { + const _data = await KPIStore.getList(getkpiParam); + // KPIStore.getList(getkpiParam).then((data) => { + // // setDataSource(data); if (objectFilterKey?.[curObject]) { const selectItem = searchFormStore.formValues[objectFilterKey[curObject]]; if (selectItem) { @@ -83,7 +85,7 @@ export default observer((props) => { } setRetObjects(flush([selectItem])); } - }); + // }); }; return ( <>