Merge branch 'ldeyun' into 'master'

1.修改人力资源统计

See merge request cxcxt/cxc-szcx-uniapp!11
This commit is contained in:
闵 年泽 2025-02-19 12:50:57 +08:00
commit 0f2283a04a
5 changed files with 58 additions and 19 deletions

View File

@ -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

View File

@ -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();
}; };

View File

@ -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();

View File

@ -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">

View File

@ -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">