档案数量

master
lion 10 months ago
parent e1b51fdfee
commit dfa7374765

@ -1,5 +1,27 @@
import request from "@/utils/request"; import request from "@/utils/request";
function customParamsSerializer(params) {
let result = '';
for (let key in params) {
if (params.hasOwnProperty(key)) {
if (Array.isArray(params[key])) {
params[key].forEach((item, index) => {
if (item.key) {
result +=
`${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
} else {
result += `${key}[${index}]=${item}&`
}
});
} else {
result += `${key}=${params[key]}&`;
}
}
}
return result.slice(0, -1);
}
export function home(params) { export function home(params) {
return request({ return request({
method: 'get', method: 'get',
@ -23,3 +45,12 @@ export function fillChart(params){
params params
}) })
} }
export function catalogTotal(params) {
return request({
method: 'get',
url: '/api/admin/other/catalog-total',
params,
paramsSerializer: customParamsSerializer
})
}

@ -195,6 +195,10 @@
index, index,
destroy destroy
} from "@/api/system/baseForm.js" } from "@/api/system/baseForm.js"
import {
catalogTotal
} from "@/api/home/index.js"
import state from '@/store/modules/user.js' import state from '@/store/modules/user.js'
export default { export default {
components: { components: {
@ -490,11 +494,15 @@
clickIn(i) { clickIn(i) {
if (i.children && i.children.length > 0) { if (i.children && i.children.length > 0) {
this.historyList.push(this.showData); this.historyList.push(this.showData);
this.showData = i.children; this.showData = i.children;
this.menuName.push(i.name) this.menuName.push(i.name)
this.select.catalog_name = ' / ' + this.menuName.join(" / ") this.select.catalog_name = ' / ' + this.menuName.join(" / ")
console.log(this.historyList); console.log(this.historyList);
let totalId = []
this.showData.map(item=>{
totalId.push(item.id)
})
this.getCatalogTotal(totalId.join(','))
} else { } else {
this.select.catalog_id = i.id this.select.catalog_id = i.id
this.menuName.push(i.name) this.menuName.push(i.name)
@ -518,6 +526,7 @@
this.select.catalog_name = ' / ' + this.menuName.join(" / ") this.select.catalog_name = ' / ' + this.menuName.join(" / ")
this.hasMenu = true this.hasMenu = true
}, },
async getCatalogList(pid) { async getCatalogList(pid) {
const res = await index({ const res = await index({
page_size: 999, page_size: 999,
@ -534,8 +543,43 @@
console.log("pList", pList) console.log("pList", pList)
this.catalogChildren = pList[0].children this.catalogChildren = pList[0].children
this.showData = this.catalogChildren this.showData = this.catalogChildren
let totalId = []
this.showData.map(item=>{
totalId.push(item.id)
})
this.getCatalogTotal(totalId.join(','))
}
} }
},
async getCatalogTotal(ids){
const res = await catalogTotal({
ids:ids
})
let data = res.list
const updatedB = this.showData.map((item) => {
// a id
const matchedItem = data.find((aItem) => aItem.id == item.id);
// records_total sub_records_total
if (matchedItem) {
return {
...item,
records_total: matchedItem.records_total,
sub_records_total: matchedItem.sub_records_total
};
}else{
return {
...item,
records_total: 0,
sub_records_total: 0
};
} }
//
return item;
});
this.showData = updatedB
console.log("this.showData",this.showData)
}, },
async getAreaList() { async getAreaList() {
const res = await index({ const res = await index({

@ -25,7 +25,7 @@ module.exports = {
* Detail: https://cli.vuejs.org/config/#publicpath * Detail: https://cli.vuejs.org/config/#publicpath
*/ */
publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin', publicPath: process.env.ENV === 'staging' ? '/admin_test' : '/admin',
outputDir: '/Users/mac/Documents/朗业/2024/s-四世同堂-档案/sstt_dangan/public/admin_test', outputDir: '/Users/mac/Documents/朗业/2024/s-四世同堂-档案/sstt_dangan/public/admin',
assetsDir: 'static', assetsDir: 'static',
css: { css: {
loaderOptions: { // 向 CSS 相关的 loader 传递选项 loaderOptions: { // 向 CSS 相关的 loader 传递选项

Loading…
Cancel
Save