|
|
@ -16,7 +16,7 @@ |
|
|
|
<el-table |
|
|
|
:data="tableData" |
|
|
|
style="width: 100%" |
|
|
|
row-key="id" |
|
|
|
row-key="uid" |
|
|
|
border |
|
|
|
lazy |
|
|
|
:load="load" |
|
|
@ -39,72 +39,96 @@ const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(BalanceSummary.allSchemas.tableColumns) |
|
|
|
console.log('tableColumns',tableColumns) |
|
|
|
const tableData= ref([ |
|
|
|
{ |
|
|
|
id: 1, |
|
|
|
date: '2016-05-02', |
|
|
|
name: 'wangxiaohu', |
|
|
|
num: 1, |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 2, |
|
|
|
date: '2016-05-04', |
|
|
|
name: 'wangxiaohu', |
|
|
|
num: 2, |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 3, |
|
|
|
date: '2016-05-01', |
|
|
|
name: 'wangxiaohu', |
|
|
|
hasChildren: true, |
|
|
|
num: 3, |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: 4, |
|
|
|
date: '2016-05-03', |
|
|
|
name: 'wangxiaohu', |
|
|
|
num: 4, |
|
|
|
}, |
|
|
|
]) |
|
|
|
// const tableData= ref([ |
|
|
|
// { |
|
|
|
// id: 1, |
|
|
|
// date: '2016-05-02', |
|
|
|
// name: '孙小虎', |
|
|
|
// num: 1, |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// id: 2, |
|
|
|
// date: '2016-05-04', |
|
|
|
// name: '孙小虎', |
|
|
|
// num: 2, |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// id: 3, |
|
|
|
// date: '2016-05-01', |
|
|
|
// name: '孙小虎', |
|
|
|
// hasChildren: true, |
|
|
|
// num: 3, |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// id: 4, |
|
|
|
// date: '2016-05-03', |
|
|
|
// name: '孙小虎', |
|
|
|
// num: 4, |
|
|
|
// }, |
|
|
|
// ]) |
|
|
|
const tableData= ref([]) |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: BalanceApi.getBalanceSummaryPageAll // 分页接口 |
|
|
|
}) |
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
|
const { getList, setSearchParams } = tableMethods |
|
|
|
getList() |
|
|
|
const itemCode = ref('253.504-00') |
|
|
|
|
|
|
|
let defaultParams = { |
|
|
|
level:0, |
|
|
|
path:'', |
|
|
|
itemCode:itemCode.value |
|
|
|
} |
|
|
|
const getList = async (params)=>{ |
|
|
|
let res = await BalanceApi.getBalanceSummaryPageAll(params) |
|
|
|
tableData.value = res |
|
|
|
console.log('库存汇总list',res) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|
onMounted(() => { |
|
|
|
getList(defaultParams) |
|
|
|
}) |
|
|
|
|
|
|
|
const load = ( row, treeNode,resolve) => { |
|
|
|
const load = async ( row, treeNode,resolve) => { |
|
|
|
console.log('load',row, treeNode,resolve) |
|
|
|
console.log('tableData',tableData.value) |
|
|
|
setTimeout(() => { |
|
|
|
resolve([ |
|
|
|
{ |
|
|
|
id: Math.random(), |
|
|
|
date: '2016-05-01', |
|
|
|
name: 'wangxiaohu', |
|
|
|
num: 5, |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: Math.random(), |
|
|
|
date: '2016-05-01', |
|
|
|
name: 'wangxiaohu', |
|
|
|
num: 6, |
|
|
|
hasChildren: true, |
|
|
|
}, |
|
|
|
]) |
|
|
|
}, 1000) |
|
|
|
let res = await BalanceApi.getBalanceSummaryPageAll({ |
|
|
|
level: row['level'], |
|
|
|
path: row['path'], |
|
|
|
itemCode:itemCode.value |
|
|
|
}) |
|
|
|
if(res&&res.length>0){ |
|
|
|
resolve(res) |
|
|
|
} |
|
|
|
console.log('加载',res) |
|
|
|
// setTimeout(() => { |
|
|
|
// resolve([ |
|
|
|
// { |
|
|
|
// id: Math.random(), |
|
|
|
// date: '2016-05-01', |
|
|
|
// name: '孙小虎', |
|
|
|
// num: 5, |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// id: Math.random(), |
|
|
|
// date: '2016-05-01', |
|
|
|
// name: '孙小虎', |
|
|
|
// num: 6, |
|
|
|
// hasChildren: true, |
|
|
|
// }, |
|
|
|
// ]) |
|
|
|
// }, 1000) |
|
|
|
} |
|
|
|
|
|
|
|
const searchList = (model)=>{ |
|
|
|
console.log('searchList',model) |
|
|
|
setSearchParams(model) |
|
|
|
if(model['itemCode']){ |
|
|
|
itemCode.value = model['itemCode'] |
|
|
|
defaultParams = { |
|
|
|
level:0, |
|
|
|
path:'', |
|
|
|
itemCode:itemCode.value |
|
|
|
} |
|
|
|
} |
|
|
|
getList(defaultParams) |
|
|
|
} |
|
|
|
|
|
|
|
const searchQueryTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
@ -128,7 +152,7 @@ const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'export') { // 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
getList() |
|
|
|
getList(defaultParams) |
|
|
|
} |
|
|
|
} |
|
|
|
/** 导出按钮操作 */ |
|
|
@ -139,7 +163,9 @@ const handleExport = async () => { |
|
|
|
// 发起导出 |
|
|
|
loadStart() |
|
|
|
const excelTitle = ref(route.meta.title) |
|
|
|
const data = await BalanceApi.exportBalanceSummary(tableObject.params) |
|
|
|
const data = await BalanceApi.exportTotalBalanceTree({ |
|
|
|
itemCode:itemCode.value |
|
|
|
}) |
|
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
|
} catch { |
|
|
|
} finally { |
|
|
|