Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
csbr-daop
/
fe-data-trusted-space
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
f8d477aa
authored
2025-07-11 17:13:02 +0800
by
lihua
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
标准代码表支持自适应列宽
1 parent
ec310739
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
14 deletions
src/views/data_meta/components/dictFileds.vue
src/views/data_meta/standard-codetable.vue
src/views/data_meta/standard.vue
src/views/data_meta/components/dictFileds.vue
View file @
f8d477a
...
...
@@ -10,6 +10,7 @@ import Table from '@/components/Table/index.vue'
// import Dialog from '@/components/Dialog/index.vue'
import
useCatchStore
from
"@/store/modules/catch"
;
import
{
chunk
}
from
'@/utils/common'
import
{
calcColumnWidth
}
from
"@/utils/index"
;
import
{
getStandardCodeDataList
,
getStandardCodeFields
,
saveStandardCodeFieldsData
,
deleteStandardCodeFieldsData
,
exportStandardCodeData
...
...
@@ -120,6 +121,49 @@ const dialogInfo = ref({
},
})
/** otherWidth表示使用标题宽度时添加标题排序图标等宽度 */
const
calcTableColumnWidth
=
(
data
:
any
[],
prop
,
title
,
otherWidth
=
0
)
=>
{
let
d
:
any
[]
=
[];
data
.
forEach
((
dt
)
=>
d
.
push
(
dt
[
prop
]));
return
calcColumnWidth
(
d
,
title
,
{
fontSize
:
14
,
fontFamily
:
"SimSun"
,
},
{
fontSize
:
14
,
fontFamily
:
"SimSun"
,
},
otherWidth
);
};
/** 每列字段对应的列宽计算结果。 */
const
originTableFieldColumn
=
ref
({});
watch
(
()
=>
tableData
.
value
,
(
val
:
any
[],
oldVal
)
=>
{
if
(
!
tableFields
.
value
?.
length
)
{
// originTableFieldColumn.value = {};
return
;
}
//originTableFieldColumn.value = {};
tableFields
.
value
.
forEach
((
field
,
index
)
=>
{
field
.
width
=
calcTableColumnWidth
(
val
?.
slice
(
0
,
30
)
||
[],
field
.
field
,
field
.
label
,
24
);
});
},
{
deep
:
true
,
}
);
const
getFirstPageData
=
()
=>
{
page
.
value
.
curr
=
1
;
...
...
@@ -476,16 +520,6 @@ const setUploadDataInfo = async (info, setField = false) => {
// chunkData()
}
const
chunkData
=
()
=>
{
const
data
=
orginData
.
value
tableChunkData
.
value
=
chunk
(
data
,
page
.
value
.
limit
)
tableData
.
value
=
tableChunkData
.
value
[
page
.
value
.
curr
-
1
]
tableInfo
.
value
.
data
=
tableData
.
value
tableInfo
.
value
.
page
.
limit
=
page
.
value
.
limit
tableInfo
.
value
.
page
.
curr
=
page
.
value
.
curr
tableInfo
.
value
.
page
.
rows
=
orginData
.
value
.
length
}
const
batching
=
(
type
)
=>
{
if
(
type
==
'delete'
)
{
if
(
selectRowData
.
value
.
length
==
0
)
{
...
...
src/views/data_meta/standard-codetable.vue
View file @
f8d477a
...
...
@@ -100,16 +100,16 @@ const tableInfo: any = ref({
fixedSelection
:
true
,
fields
:
[
{
label
:
"序号"
,
type
:
"index"
,
width
:
56
,
align
:
"center"
},
{
label
:
'代码名称'
,
field
:
'codeName'
,
width
:
1
4
0
},
{
label
:
'代码名称'
,
field
:
'codeName'
,
width
:
1
6
0
},
// { label: '代码编码', field: 'code', width: 140 },
{
label
:
'标准号'
,
field
:
'standard'
,
width
:
140
},
{
label
:
'标准名称'
,
field
:
'standardName'
,
width
:
1
4
0
},
{
label
:
'标准名称'
,
field
:
'standardName'
,
width
:
1
6
0
},
// { label: '启用状态', field: 'bizState', type: 'switch', activeText: '启用', inactiveText: '停用', activeValue: 1, inactiveValue: 0, switchWidth: 56, width: 100, align: 'center' },
{
label
:
'启用状态'
,
field
:
'bizState'
,
type
:
'tag'
,
width
:
100
,
align
:
'center'
,
getName
:
(
scope
)
=>
{
let
status
=
scope
.
row
.
bizState
;
return
status
==
'Y'
?
'启用'
:
'停用'
;
}
},
{
label
:
'创建时间'
,
field
:
'createTime'
,
width
:
TableColumnWidth
}
{
label
:
'创建时间'
,
field
:
'createTime'
,
width
:
TableColumnWidth
.
DATETIME
}
],
data
:
[],
page
:
{
...
...
src/views/data_meta/standard.vue
View file @
f8d477a
...
...
@@ -243,6 +243,18 @@ function getTableFields () {
const
data
=
res
.
data
standardFields
.
value
=
data
let
orderFieldIndex
=
null
;
let
columnWidths
=
{
'order_num'
:
80
,
'data_type'
:
100
,
'length'
:
100
,
// 'inside_identifier': 100,
'indicate_format'
:
110
,
'other_data_relationship'
:
150
,
'unit'
:
100
,
'meta_data_type'
:
150
,
'definition'
:
300
,
'explanation'
:
300
}
const
fields
=
data
.
map
((
item
,
index
)
=>
{
if
(
currentObj
.
orderField
&&
currentObj
.
orderField
==
item
.
fileNameCode
)
{
orderFieldIndex
=
index
;
...
...
@@ -250,7 +262,7 @@ function getTableFields () {
return
{
label
:
item
.
fileNameCodeName
,
field
:
item
.
fileNameCode
,
width
:
140
width
:
columnWidths
[
item
.
fileNameCode
]
||
140
}
})
if
(
currentObj
.
orderField
&&
currentObj
.
isDisplay
==
'N'
)
{
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment