From 1cf8f0474904b8d2066fdff5d8375312dee55450 Mon Sep 17 00:00:00 2001
From: zhang_li <2235006734@qqq.com>
Date: Wed, 5 Mar 2025 10:00:58 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E4=BE=BF=E6=AC=A1?=
=?UTF-8?q?=E5=B9=B4=E6=9C=88=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../supplierManage/supplierDeliMain/index.vue | 107 ++++++++++++++----
.../supplierDeliMain/supplierDeliMain.data.ts | 18 +++
2 files changed, 100 insertions(+), 25 deletions(-)
diff --git a/src/views/wms/supplierManage/supplierDeliMain/index.vue b/src/views/wms/supplierManage/supplierDeliMain/index.vue
index e2cdf87e2..494f9c0be 100644
--- a/src/views/wms/supplierManage/supplierDeliMain/index.vue
+++ b/src/views/wms/supplierManage/supplierDeliMain/index.vue
@@ -1,7 +1,7 @@
-
+
@@ -32,8 +32,15 @@
{{ row.code }}
+
+
+
-
+
@@ -65,6 +72,7 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
+import { formatDate } from '@/utils/formatTime'
defineOptions({ name: 'SupplierDeliMain' })
@@ -94,17 +102,21 @@ const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable(
})
// 获得表格的各种操作
-const { getList:getListHead, setSearchParams:setSearchParamsHead } = tableMethodsHead
-
+const { getList: getListHead, setSearchParams: setSearchParamsHead } = tableMethodsHead
+const search = (mold) => {
+ setSearchParamsHead(mold)
+ setSearchParams(mold)
+}
+const dateColumns = ref([])
watch(()=>tableObjectHead.tableList,()=>{
updateDateTableColumns()
},{deep:true})
const updateDateTableColumns = ()=>{
- console.log('tableObjectHead',tableObjectHead)
- let dateColumns = []
+ console.log('tableObjectHead', tableObjectHead)
+ dateColumns.value = []
if(tableObjectHead.tableList.length>10){
tableObjectHead.tableList.forEach(item=>{
- dateColumns.push({
+ dateColumns.value.push({
width:120,
field: item,
label: item
@@ -112,13 +124,13 @@ const updateDateTableColumns = ()=>{
})
}else{
tableObjectHead.tableList.forEach(item=>{
- dateColumns.push({
+ dateColumns.value.push({
field: item,
label: item
})
})
}
- tableColumns.value = [...orginTableColumns.value,...dateColumns]
+ tableColumns.value = [...orginTableColumns.value,...dateColumns.value]
console.log('tableColumns',tableColumns.value)
}
@@ -150,6 +162,11 @@ const { tableObject, tableMethods } = useTable({
// 获得表格的各种操作
const { getList, setSearchParams } = tableMethods
+const getListExecute = () => {
+ tableObject.params.yearAndMonth=formatDate(new Date(),'YYYY-MM')
+ getList()
+ tableObject.tableList.forEach(item=>item.isOpen = false)
+}
// 列表头部按钮
const HeadButttondata = [
@@ -179,7 +196,7 @@ const buttonBaseClick = (val: string, item: any) => {
handleExport()
} else if (val == 'refresh') { // 刷新
getListHead()
- getList()
+ getListExecute()
} else if (val == 'filtrate') { // 筛选
} else { // 其他按钮
console.log('其他按钮', item)
@@ -187,17 +204,46 @@ const buttonBaseClick = (val: string, item: any) => {
}
// 列表-操作按钮
-const butttondata = [
- defaultButtons.mainListEditBtn({hasPermi:'wms:supplierDeliMain:update'}), // 编辑
- defaultButtons.mainListDeleteBtn({hasPermi:'wms:supplierDeliMain:delete'}), // 删除
-]
+const butttondata = (row) => {
+ const array = []
+ // 如果子数据条数超过6条不展示按钮
+ dateColumns.value.forEach(item => {
+ if (row[item.field]?.length > 6) {
+ array.push(row)
+ }
+ })
+ return [
+ {
+ label: t(`ts.展开更多`).replace('ts.', ''),
+ name: 'open',
+ hide: row.isOpen || array.length==0,
+ type: 'primary',
+ color: '',
+ link: true, // 文本展现按钮
+ hasPermi: ''
+ },
+ {
+ label: t(`ts.收起`).replace('ts.', ''),
+ name: 'retract',
+ hide: !row.isOpen || array.length==0,
+ type: 'primary',
+ color: '',
+ link: true, // 文本展现按钮
+ hasPermi: ''
+ }
+ ]
+}
// 列表-操作按钮事件
-const buttonTableClick = async (val: string, row: { id: number }) => {
- if (val == 'edit') { // 编辑
- openForm('update', row)
- } else if (val == 'delete') { // 删除
- handleDelete(row.id)
+const buttonTableClick = async (val: string, row:any) => {
+ if (val == 'open') { // 展开
+ // openForm('update', row)
+ row.isOpen = true
+ getHeight(row)
+ } else if (val == 'retract') { // 收起
+ row.isOpen = false
+ getHeight(row)
+ // handleDelete(row.id)
}
}
@@ -228,7 +274,7 @@ const formsSuccess = async (formType: string,data: SupplierDeliMainApi.SupplierD
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
- getList()
+ getListExecute()
}
/** 详情操作 */
@@ -246,7 +292,7 @@ const handleDelete = async (id: number) => {
await SupplierDeliMainApi.deleteSupplierDeliMain(id)
message.success(t('common.delSuccess'))
// 刷新列表
- await getList()
+ await getListExecute()
} catch {}
}
@@ -278,7 +324,7 @@ const importTemplateData = reactive({
})
// 导入成功之后
const importSuccess = () => {
- getList()
+ getListExecute()
}
// 筛选提交
@@ -287,14 +333,25 @@ const searchFormClick = (searchData: { filters: any }) => {
isSearch: true,
filters: searchData.filters
}
- getList() // 刷新当前列表
+ getListExecute() // 刷新当前列表
+}
+const getHeight=(row)=> {
+ // 根据条件返回不同的高度值
+ if (row.isOpen === true) { // 例如:特定名字的行改变高度
+ return 'auto'; // 特定高度值
+ }
+ return '140px'; // 默认高度值
}
-
/** 初始化 **/
onMounted(async () => {
getListHead()
- getList()
+ getListExecute()
importTemplateData.templateUrl = await SupplierDeliMainApi.importTemplate()
})
+
diff --git a/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts b/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts
index ec2743cf2..0e34589d2 100644
--- a/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts
+++ b/src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts
@@ -1,4 +1,5 @@
import type { CrudSchema } from '@/hooks/web/useCrudSchemas'
+import { formatDate } from '@/utils/formatTime'
// 表单校验
export const SupplierDeliMainRules = reactive({
@@ -50,5 +51,22 @@ export const SupplierDeliMain = useCrudSchemas(reactive([
sort: 'custom',
isTable: false,
isSearch: true,
+ search: {
+ component: 'DatePicker',
+ value: formatDate(new Date(),'YYYY-MM'),
+ componentProps: {
+ type: 'month',
+ valueFormat: 'YYYY-MM',
+ }
+ }
+ },
+ {
+ label: '操作',
+ field: 'action',
+ isForm: false,
+ table: {
+ width: 150,
+ fixed: 'right'
+ }
}
]))