lion 1 week ago
parent 4c31aa31a7
commit 67a6617046

@ -230,6 +230,17 @@
},
//
// http://sstt-dangan.ali251.langye.net/api/fill-datas-chart?business_id=20&year=2025&business_type_id=88&area_id=13
findLastNonZeroTotal(list) {
const sortedKeys = Object.keys(list).sort((a, b) => Number(a) - Number(b));
for (let i = sortedKeys.length - 1; i >= 0; i--) {
const currentArray = list[sortedKeys[i]];
const totalItem = currentArray.find(item => item.name === '总人数');
if (totalItem && totalItem.total > 0) {
return currentArray; //
}
}
return null; // null
},
async getPerson(){
const res = await fillChart({
business_id: 20,
@ -239,21 +250,27 @@
})
const monthNum = (new Date()).getMonth()
const currentMonth = monthNum===0?'01':String(new Date().getMonth()).padStart(2, '0');
// const currentMonth = monthNum<10?'0'+monthNum:monthNum
console.log("currentMonth",currentMonth)
const currentMonthData = this.findLastNonZeroTotal(res.list);
console.log("currentMonthData",currentMonthData)
if(currentMonthData){
currentMonthData.forEach(item => {
switch (item.name) {
case "总人数":
this.list.person.total = item.total; //
break;
case "管理人员人数":
this.list.person.manage = item.total; //
break;
case "服务人员人数":
this.list.person.serve = item.total; //
break;
}
});
}
const currentMonthData = res.list[currentMonth] || [];
currentMonthData.forEach(item => {
switch (item.name) {
case "总人数":
this.list.person.total = item.total; //
break;
case "管理人员人数":
this.list.person.manage = item.total; //
break;
case "服务人员人数":
this.list.person.serve = item.total; //
break;
}
});
},
//
// http://sstt-dangan.ali251.langye.net/api/admin/base-form/show?id=15&table_name=businesses&json_data_fields[]=area_ids

@ -71,7 +71,7 @@
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>标签
</div>
<div class="xy-table-item-content">
<el-select :disabled="is_search" style="width:100%" v-model="form.tag_ids" multiple placeholder="请选择">
<el-select :disabled="is_search" filterable style="width:100%" v-model="form.tag_ids" multiple placeholder="请选择">
<el-option v-for="item in tagList" :key="item.id" :label="item.name" :value="item.id">
</el-option>
</el-select>

Loading…
Cancel
Save