Merge branch 'ldeyun' into 'master'
1.修改人力资源统计 See merge request cxcxt/cxc-szcx-uniapp!11
This commit is contained in:
commit
0f2283a04a
@ -1,4 +1,4 @@
|
|||||||
# 开发环境
|
# 开发环境
|
||||||
# 请求接口地址
|
# 请求接口地址
|
||||||
VITE_REQUEST_BASE_URL = https://36.112.48.190
|
VITE_REQUEST_BASE_URL = https://36.112.48.190
|
||||||
#VITE_REQUEST_BASE_URL = http://10.75.166.6:8080
|
#VITE_REQUEST_BASE_URL = http://10.75.15.247:8080
|
||||||
|
@ -178,6 +178,7 @@
|
|||||||
const fieldValues = ref([]); //字段值
|
const fieldValues = ref([]); //字段值
|
||||||
const fieldTexts = ref([]); //字段值
|
const fieldTexts = ref([]); //字段值
|
||||||
const chartOption = ref({});
|
const chartOption = ref({});
|
||||||
|
const orgType = ref(''); //记录单位层级 by 闵
|
||||||
|
|
||||||
const chartTitle = computed(() => {
|
const chartTitle = computed(() => {
|
||||||
return selectedOrgCodeLabel.value + '人员(' + selectedFieldLabel.value + ')分组统计';
|
return selectedOrgCodeLabel.value + '人员(' + selectedFieldLabel.value + ')分组统计';
|
||||||
@ -594,6 +595,8 @@
|
|||||||
|
|
||||||
// 递归计算每个根节点的data
|
// 递归计算每个根节点的data
|
||||||
rootNodes.forEach((root) => computeData(root));
|
rootNodes.forEach((root) => computeData(root));
|
||||||
|
|
||||||
|
console.log(rootNodes)
|
||||||
return rootNodes;
|
return rootNodes;
|
||||||
// console.log('rootNodes', rootNodes);
|
// console.log('rootNodes', rootNodes);
|
||||||
// // 转换为目标格式
|
// // 转换为目标格式
|
||||||
@ -703,16 +706,24 @@
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('全部', result);
|
console.log('全部', result);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
// 获取统计数据 then filter
|
// 获取统计数据 then filter
|
||||||
const fetchStatisticsData = async () => {
|
const fetchStatisticsData = async () => {
|
||||||
|
console.log(selectedOrgCode)
|
||||||
if (!selectedOrgCode.value || !selectedField.value) return;
|
if (!selectedOrgCode.value || !selectedField.value) return;
|
||||||
let res = [];
|
let res = [];
|
||||||
chartData.value = [];
|
chartData.value = [];
|
||||||
try {
|
try {
|
||||||
|
//这里添加一个层级字段,并避免 厂机关A01A01A01 orgType by 闵
|
||||||
|
var tempOrgType = '1';
|
||||||
|
if(selectedOrgCode.value.includes('A01A01A01')){
|
||||||
|
tempOrgType = '1';
|
||||||
|
}else{
|
||||||
|
tempOrgType = orgType
|
||||||
|
}
|
||||||
if (selectedField.value === 'zjmc') {
|
if (selectedField.value === 'zjmc') {
|
||||||
console.log(dictCode.value);
|
console.log(dictCode.value);
|
||||||
console.log(dictData.value);
|
console.log(dictData.value);
|
||||||
@ -721,14 +732,16 @@
|
|||||||
field: selectedField.value,
|
field: selectedField.value,
|
||||||
dictCode: dictCode.value,
|
dictCode: dictCode.value,
|
||||||
fieldisDict: fieldisDict.value,
|
fieldisDict: fieldisDict.value,
|
||||||
typeOfWorkList: dictData.value
|
typeOfWorkList: dictData.value,
|
||||||
|
orgType: tempOrgType.value
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res = await cxcRyDatAstatistics({
|
res = await cxcRyDatAstatistics({
|
||||||
orgCode: selectedOrgCode.value,
|
orgCode: selectedOrgCode.value,
|
||||||
field: selectedField.value,
|
field: selectedField.value,
|
||||||
dictCode: dictCode.value,
|
dictCode: dictCode.value,
|
||||||
fieldisDict: fieldisDict.value
|
fieldisDict: fieldisDict.value,
|
||||||
|
orgType: tempOrgType.value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -743,7 +756,7 @@
|
|||||||
}
|
}
|
||||||
//按单位进行分组
|
//按单位进行分组
|
||||||
orgCodeGroupData.value = groupByOrgCode(selectedOrgCode.value, res.result);
|
orgCodeGroupData.value = groupByOrgCode(selectedOrgCode.value, res.result);
|
||||||
// console.log(orgCodeGroupData.value);
|
console.log(orgCodeGroupData.value);
|
||||||
//将数据转换成echart格式
|
//将数据转换成echart格式
|
||||||
const temp = transformData(selectedOrgCode.value, res.result);
|
const temp = transformData(selectedOrgCode.value, res.result);
|
||||||
|
|
||||||
@ -752,10 +765,13 @@
|
|||||||
|
|
||||||
chartDataCount.value = chartData.value.length;
|
chartDataCount.value = chartData.value.length;
|
||||||
console.log(chartData.value);
|
console.log(chartData.value);
|
||||||
updateChart(chartData.value);
|
// updateChart(chartData.value);
|
||||||
} else {
|
} else {
|
||||||
// chartData.value = temp[0];
|
var tempArr = [];
|
||||||
|
tempArr.push(temp[0])
|
||||||
|
chartData.value =tempArr;
|
||||||
}
|
}
|
||||||
|
updateChart(chartData.value);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取统计数据失败:', error);
|
console.error('获取统计数据失败:', error);
|
||||||
@ -782,7 +798,9 @@
|
|||||||
const onOrgCodeChange = (e, data) => {
|
const onOrgCodeChange = (e, data) => {
|
||||||
personnelList.value = [];
|
personnelList.value = [];
|
||||||
selectedOrgCode.value = e;
|
selectedOrgCode.value = e;
|
||||||
// console.log(data.value.title);
|
console.log(e)
|
||||||
|
console.log(data);
|
||||||
|
orgType.value = data.value.orgType; //赋值层级 by 闵
|
||||||
selectedOrgCodeLabel.value = data.value.title;
|
selectedOrgCodeLabel.value = data.value.title;
|
||||||
fetchStatisticsData();
|
fetchStatisticsData();
|
||||||
};
|
};
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
<view v-if="returnCodeOrID === 'orgCode'">
|
<view v-if="returnCodeOrID === 'orgCode'">
|
||||||
<uni-data-picker v-model="selectDepartID" ref="depart" :openSearch="true" :ellipsis="true"
|
<uni-data-picker v-model="selectDepartID" ref="depart" :openSearch="true" :ellipsis="true"
|
||||||
placeholder="请选择单位code" popup-title="请选择单位" :localdata="departList" @nodeclick="onnodeclick"
|
placeholder="请选择单位code" popup-title="请选择单位" :localdata="departList" @nodeclick="onnodeclick"
|
||||||
@popupclosed="onpopupclosed" @change="onchange" :map="{'text':'title','value':'orgCode'}"
|
@popupclosed="onpopupclosed" :map="{'text':'title','value':'orgCode'}"
|
||||||
class="no-wrap-picker"></uni-data-picker>
|
class="no-wrap-picker"></uni-data-picker>
|
||||||
</view>
|
</view>
|
||||||
<view v-else>
|
<view v-else>
|
||||||
<uni-data-picker v-model="selectDepartID" ref="depart" :openSearch="true" :ellipsis="true" placeholder="请选择单位id"
|
<uni-data-picker v-model="selectDepartID" ref="depart" :openSearch="true" :ellipsis="true" placeholder="请选择单位id"
|
||||||
popup-title="请选择单位" :localdata="departList" @nodeclick="onnodeclick" @popupclosed="onpopupclosed"
|
popup-title="请选择单位" :localdata="departList" @nodeclick="onnodeclick" @popupclosed="onpopupclosed"
|
||||||
@change="onchange" :map="{'text':'title','value':'id'}" class="no-wrap-picker"></uni-data-picker>
|
:map="{'text':'title','value':'id'}" class="no-wrap-picker"></uni-data-picker>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@ -30,6 +30,7 @@
|
|||||||
import {
|
import {
|
||||||
reactive,
|
reactive,
|
||||||
ref,
|
ref,
|
||||||
|
watch,
|
||||||
defineEmits,
|
defineEmits,
|
||||||
defineProps
|
defineProps
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
@ -46,15 +47,29 @@
|
|||||||
let selectDepartID = ref("") //当前选中的单位ID
|
let selectDepartID = ref("") //当前选中的单位ID
|
||||||
let selectDepartIDS = ref([]) //选中的级联单位ID数组
|
let selectDepartIDS = ref([]) //选中的级联单位ID数组
|
||||||
let tempSelectDepartID = ref("") //临时选择的单位ID
|
let tempSelectDepartID = ref("") //临时选择的单位ID
|
||||||
|
let depart = ref(null);
|
||||||
|
|
||||||
let departInfo = ref({}) //"单位的全部信息"
|
let departInfo = ref({}) //"单位的全部信息"
|
||||||
|
|
||||||
let $emit = defineEmits(['change']);
|
let $emit = defineEmits(['change']);
|
||||||
|
|
||||||
|
|
||||||
|
watch(
|
||||||
|
tempSelectDepartID,
|
||||||
|
(newVal,oldVal)=>{ //通过监听触发change by 闵
|
||||||
|
console.log(newVal)
|
||||||
|
$emit('change', newVal, departInfo)
|
||||||
|
},{
|
||||||
|
immediate:true,
|
||||||
|
deep:true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
const getDepartList = () => {
|
const getDepartList = () => {
|
||||||
queryMyDeptTreeListApi().then((res) => {
|
queryMyDeptTreeListApi().then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
// console.log(res)
|
console.log(res)
|
||||||
departList.value = res.result
|
departList.value = res.result
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
@ -62,22 +77,28 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const onnodeclick = ((e) => {
|
const onnodeclick = ((e) => {
|
||||||
|
console.log(e)
|
||||||
departInfo.value = e;
|
departInfo.value = e;
|
||||||
if (props.returnCodeOrID = "orgCode") {
|
if (props.returnCodeOrID == "orgCode") {
|
||||||
tempSelectDepartID.value = e.orgCode
|
tempSelectDepartID.value = e.orgCode
|
||||||
} else {
|
} else {
|
||||||
tempSelectDepartID.value = e.value
|
tempSelectDepartID.value = e.value
|
||||||
}
|
}
|
||||||
|
// if(!depart.value.isOpened){//如果页面已经关闭 就触发change方法 by 闵
|
||||||
|
// $emit('change', selectDepartID.value, departInfo)
|
||||||
|
// }
|
||||||
})
|
})
|
||||||
|
|
||||||
const onchange = ((e) => {
|
const onchange = ((e) => {
|
||||||
$emit('change', e.detail.value[e.detail.value.length - 1].value, {})
|
console.log(e)
|
||||||
|
selectDepartID.value = e.detail.value[e.detail.value.length - 1].value
|
||||||
|
// $emit('change', e.detail.value[e.detail.value.length - 1].value, {})
|
||||||
})
|
})
|
||||||
|
|
||||||
const onpopupclosed = ((e) => {
|
const onpopupclosed = ((e) => {
|
||||||
|
console.log(e)
|
||||||
selectDepartID.value = tempSelectDepartID.value
|
selectDepartID.value = tempSelectDepartID.value
|
||||||
$emit('change', selectDepartID.value, departInfo)
|
// $emit('change', selectDepartID.value, departInfo)
|
||||||
})
|
})
|
||||||
onLoad((e) => {
|
onLoad((e) => {
|
||||||
getDepartList();
|
getDepartList();
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
<slot name="picker-loading" :loading="loading"></slot>
|
<slot name="picker-loading" :loading="loading"></slot>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-data-tree-cover" v-if="isOpened" @click="handleClose"></view>
|
<view class="uni-data-tree-cover" v-show="isOpened" @click="handleClose"></view>
|
||||||
<view class="uni-data-tree-dialog" v-if="isOpened">
|
<view class="uni-data-tree-dialog" v-show="isOpened">
|
||||||
<view class="uni-popper__arrow"></view>
|
<view class="uni-popper__arrow"></view>
|
||||||
<view class="dialog-caption">
|
<view class="dialog-caption">
|
||||||
<view class="dialog-title-view">
|
<view class="dialog-title-view">
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</slot>
|
</slot>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-data-tree-cover" v-if="isOpened" @click="handleClose"></view>
|
<view class="uni-data-tree-cover" v-show="isOpened" @click="handleClose"></view>
|
||||||
<view class="uni-data-tree-dialog" v-if="isOpened">
|
<view class="uni-data-tree-dialog" v-show="isOpened">
|
||||||
<view class="uni-popper__arrow"></view>
|
<view class="uni-popper__arrow"></view>
|
||||||
<view class="dialog-caption">
|
<view class="dialog-caption">
|
||||||
<view class="title-area">
|
<view class="title-area">
|
||||||
|
Loading…
Reference in New Issue
Block a user