Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qr-consistency-vue3
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘怀志
qr-consistency-vue3
Commits
927e2edf
Commit
927e2edf
authored
Apr 19, 2025
by
wangjiancheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor:新增国际关键零部件模板详情管理列表
parent
8c8abb02
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
181 additions
and
112 deletions
+181
-112
baseIntlPartTemplate.js
src/api/BaseIntlPartTemplate/baseIntlPartTemplate.js
+2
-2
baseIntlPartTemplateDetail.js
src/api/BaseIntlPartTemplate/baseIntlPartTemplateDetail.js
+0
-0
index.vue
...baseData/criticalPartsList/BaseIntlPartTemplate/index.vue
+59
-41
index.vue
...ta/criticalPartsList/BaseIntlPartTemplateDetail/index.vue
+120
-69
No files found.
src/api/
control
/baseIntlPartTemplate.js
→
src/api/
BaseIntlPartTemplate
/baseIntlPartTemplate.js
View file @
927e2edf
...
...
@@ -52,9 +52,9 @@ export function delLogicTemplate(id) {
}
// 获取全部事业部
export
function
getAllUnit
()
{
export
function
getAllUnit
(
data
)
{
return
request
({
url
:
'/control/baseIntlPartTemplate/getAllUnit
'
,
url
:
'/control/baseIntlPartTemplate/getAllUnit
/'
+
data
,
method
:
'get'
})
}
src/api/
control
/baseIntlPartTemplateDetail.js
→
src/api/
BaseIntlPartTemplate
/baseIntlPartTemplateDetail.js
View file @
927e2edf
File moved
src/views/baseData/criticalPartsList/
t
emplate/index.vue
→
src/views/baseData/criticalPartsList/
BaseIntlPartT
emplate/index.vue
View file @
927e2edf
...
...
@@ -4,7 +4,7 @@
<el-table-column
label=
"序号"
type=
"index"
align=
"center"
width=
"55"
/>
<el-table-column
label=
"事业部"
prop=
"divisionCn"
align=
"center"
>
<template
#
default=
"scope"
>
{{
Object
.
values
(
JSON
.
parse
(
scope
.
row
.
divisionCn
)
).
join
(
'、'
)
}}
{{
Object
.
values
(
scope
.
row
.
divisionCn
).
join
(
'、'
)
}}
</
template
>
</el-table-column>
<el-table-column
label=
"创建人"
prop=
"createByName"
align=
"center"
/>
...
...
@@ -16,7 +16,7 @@
<
template
#
default=
"scope"
>
<el-button
link
type=
"primary"
@
click=
"handleTemplateDetailView(scope.row)"
>
维护模板内容
</el-button>
<el-button
link
type=
"warning"
@
click=
"handleCopyAdd"
v-show=
"scope.row.isDefault === 1"
>
复制新增
</el-button>
<el-button
link
type=
"primary"
@
click=
"handleAddDivision"
v-show=
"scope.row.isDefault === 1"
>
添加事业部
</el-button>
<el-button
link
type=
"primary"
@
click=
"handleAddDivision
(scope.row)
"
v-show=
"scope.row.isDefault === 1"
>
添加事业部
</el-button>
<el-button
link
type=
"danger"
@
click=
"handleDelete(scope.row)"
v-show=
"scope.row.isDefault === 0"
>
删除
</el-button>
</
template
>
</el-table-column>
...
...
@@ -46,15 +46,15 @@
</el-form>
<
template
#
footer
>
<div
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
</div>
</
template
>
</el-dialog>
<!-- 添加事业部对话框 -->
<el-dialog
:title=
"title"
v-model=
"open2"
width=
"500px"
append-to-body
>
<el-form
ref=
"templateRef"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form
ref=
"templateRef"
:model=
"form"
label-width=
"80px"
>
<el-form-item
label=
"事业部"
prop=
"division"
>
<el-select
v-model=
"form.division"
placeholder=
"请选择"
>
<el-option
...
...
@@ -68,8 +68,8 @@
</el-form>
<
template
#
footer
>
<div
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
</div>
</
template
>
</el-dialog>
...
...
@@ -77,7 +77,7 @@
</template>
<
script
setup
>
import
{
listTemplate
,
addTemplate
,
getAllUnit
}
from
"@/api/control
/baseIntlPartTemplate.js"
;
import
{
listTemplate
,
addTemplate
,
getAllUnit
,
delLogicTemplate
,
updateTemplate
}
from
"@/api/BaseIntlPartTemplate
/baseIntlPartTemplate.js"
;
const
{
proxy
}
=
getCurrentInstance
();
...
...
@@ -91,31 +91,18 @@ const title = ref("");
const
divisionOptions
=
ref
([]);
const
data
=
reactive
({
form
:
{},
form
:
{
id
:
null
,
division
:
[],
divisionCn
:
[]
},
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
},
rules
:
{
division
:
[
// 事业部不能重复 事业部存储为josn
{
validator
:
(
rule
,
value
,
callback
)
=>
{
for
(
let
i
=
0
;
i
<
templateList
.
value
.
length
;
i
++
)
{
if
(
templateList
.
value
[
i
].
division
===
value
)
{
callback
(
new
Error
(
"该事业部已存在"
));
return
;
}
}
callback
();
},
trigger
:
"blur"
}
]
}
});
const
{
queryParams
,
form
,
rules
}
=
toRefs
(
data
);
const
{
queryParams
,
form
}
=
toRefs
(
data
);
/** 查询国际关键零部件模版列表 */
function
getList
()
{
...
...
@@ -128,8 +115,8 @@ function getList() {
}
// 获取事业部下拉框
function
getDivisionList
()
{
getAllUnit
().
then
(
response
=>
{
function
getDivisionList
(
data
)
{
getAllUnit
(
data
).
then
(
response
=>
{
divisionOptions
.
value
=
response
.
data
.
map
(
item
=>
{
return
{
value
:
item
.
id
,
...
...
@@ -147,21 +134,45 @@ function handleTemplateDetailView(row) {
// 复制新增
function
handleCopyAdd
()
{
// 候选值为奇瑞之外且未在主列表单独列出的事业部
getDivisionList
();
let
type
=
0
;
getDivisionList
(
type
);
open
.
value
=
true
;
title
.
value
=
"复制新增"
;
}
let
oldDivisionId
=
[];
let
oldDivisionCn
=
[];
// 添加事业部
function
handleAddDivision
()
{
function
handleAddDivision
(
row
)
{
// 候选值为不在主列表中的事业部
getDivisionList
();
let
type
=
1
;
getDivisionList
(
type
);
oldDivisionId
=
row
.
division
;
oldDivisionCn
=
row
.
divisionCn
;
form
.
value
.
id
=
row
.
id
;
open2
.
value
=
true
;
title
.
value
=
"添加事业部"
;
}
// 处理事业部选择变化
function
handleDivisionChange
(
selectedValue
)
{
const
selectedOption
=
divisionOptions
.
value
.
find
(
option
=>
option
.
value
===
selectedValue
);
form
.
value
.
division
=
form
.
value
.
division
.
split
(
','
);
// 将字符串转换为数组
if
(
selectedOption
)
{
if
(
oldDivisionId
){
form
.
value
.
division
=
oldDivisionId
.
concat
(
selectedValue
);
form
.
value
.
divisionCn
=
oldDivisionCn
.
concat
(
selectedOption
.
label
);
}
else
{
form
.
value
.
division
.
push
(
selectedValue
);
form
.
value
.
divisionCn
.
push
(
selectedOption
.
label
);
}
}
}
// 取消按钮
function
cancel
()
{
open
.
value
=
false
;
open2
.
value
=
false
;
divisionOptions
.
value
=
[];
reset
();
}
...
...
@@ -179,25 +190,32 @@ function reset() {
function
submitForm
()
{
proxy
.
$refs
[
"templateRef"
].
validate
(
valid
=>
{
if
(
valid
)
{
addTemplate
(
form
.
value
).
then
(
response
=>
{
if
(
response
.
code
===
200
){
proxy
.
$modal
.
msgSuccess
(
"新增成功"
);
open
.
value
=
false
;
handleDivisionChange
(
form
.
value
.
division
)
if
(
form
.
value
.
id
!=
null
)
{
// 添加事业部
updateTemplate
(
form
.
value
).
then
(
response
=>
{
proxy
.
$modal
.
msgSuccess
(
"修改成功"
);
open2
.
value
=
false
;
reset
()
getList
();
}
else
{
proxy
.
$modal
.
msgError
(
response
.
msg
)
}
});
});
}
else
{
// 复制新增
addTemplate
(
form
.
value
).
then
(
response
=>
{
proxy
.
$modal
.
msgSuccess
(
"新增成功"
);
open
.
value
=
false
;
reset
()
getList
();
});
}
}
});
}
/** 逻辑删除按钮操作 */
function
handleDelete
(
row
)
{
const
_ids
=
row
.
id
;
proxy
.
$modal
.
confirm
(
'是否确认删除事业部为"'
+
row
.
divisionCn
+
'"的数据项?'
).
then
(
function
()
{
return
delLogicTemplate
(
_ids
);
proxy
.
$modal
.
confirm
(
'是否确认删除事业部为"'
+
Object
.
values
(
row
.
divisionCn
).
join
(
'、'
)
+
'"的数据项?'
).
then
(
function
()
{
return
delLogicTemplate
(
row
.
id
);
}).
then
(()
=>
{
getList
();
proxy
.
$modal
.
msgSuccess
(
"删除成功"
);
...
...
src/views/baseData/criticalPartsList/
t
emplateDetail/index.vue
→
src/views/baseData/criticalPartsList/
BaseIntlPartT
emplateDetail/index.vue
View file @
927e2edf
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment