Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
Support
提交反馈
为 GitLab 提交贡献
登录
切换导航
D
devicesManagement
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
刘英杰
devicesManagement
提交
5a8c5913
提交
5a8c5913
编写于
4月 10, 2025
作者:
刘英杰
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
保存
上级
aa2f1a09
变更
24
显示空白字符变更
内嵌
并排
正在显示
24 个修改的文件
包含
12968 行增加
和
0 行删除
+12968
-0
server.js
openAiToDeepSeek/src/server.js
+37
-0
CEditModal.vue
ynwh-deviceManagement-pc/src/components/CEditModal.vue
+339
-0
CTable.vue
ynwh-deviceManagement-pc/src/components/CTable.vue
+107
-0
SearchCondForm.vue
ynwh-deviceManagement-pc/src/components/SearchCondForm.vue
+111
-0
index.vue
ynwh-deviceManagement-pc/src/pages/alertManagement/index.vue
+988
-0
applyFor.vue
...ages/applicationClaim/consumables/components/applyFor.vue
+553
-0
takeOver.vue
...ages/applicationClaim/consumables/components/takeOver.vue
+553
-0
index.vue
...ement-pc/src/pages/applicationClaim/consumables/index.vue
+462
-0
index.vue
...Management-pc/src/pages/applicationClaim/device/index.vue
+462
-0
index.vue
...-deviceManagement-pc/src/pages/applicationClaim/index.vue
+468
-0
index.vue
...eviceManagement-pc/src/pages/categoryManagement/index.vue
+1896
-0
inbound.vue
...pc/src/pages/consumablesManagement/components/inbound.vue
+553
-0
inventory.vue
.../src/pages/consumablesManagement/components/inventory.vue
+553
-0
outbound.vue
...c/src/pages/consumablesManagement/components/outbound.vue
+553
-0
index.vue
...ceManagement-pc/src/pages/consumablesManagement/index.vue
+466
-0
inbound.vue
...t-pc/src/pages/equipmentManagement/components/inbound.vue
+553
-0
inventory.vue
...pc/src/pages/equipmentManagement/components/inventory.vue
+553
-0
outbound.vue
...-pc/src/pages/equipmentManagement/components/outbound.vue
+553
-0
index.vue
...viceManagement-pc/src/pages/equipmentManagement/index.vue
+466
-0
index.vue
...viceManagement-pc/src/pages/messagePushTemplate/index.vue
+988
-0
index.vue
...agement-pc/src/pages/reviewApproval/consumables/index.vue
+553
-0
index.vue
...ceManagement-pc/src/pages/reviewApproval/device/index.vue
+553
-0
index.vue
ynwh-deviceManagement-pc/src/pages/reviewApproval/index.vue
+385
-0
index.vue
ynwh-deviceManagement-pc/src/pages/statusQuery/index.vue
+263
-0
未找到文件。
openAiToDeepSeek/src/server.js
0 → 100644
浏览文件 @
5a8c5913
// Please install OpenAI SDK first: `npm install openai`
import
OpenAI
from
"
openai
"
;
//express_demo.js 文件
import
express
from
'
express
'
const
openai
=
new
OpenAI
({
baseURL
:
'
https://api.deepseek.com
'
,
apiKey
:
'
sk-6d4008c952ff48509e693df56b9c1520
'
});
var
app
=
express
();
app
.
get
(
'
/openAiApi
'
,
function
(
req
,
res
)
{
async
function
main
()
{
const
completion
=
await
openai
.
chat
.
completions
.
create
({
messages
:
[{
role
:
"
system
"
,
content
:
req
.
query
.
param
},],
model
:
"
deepseek-reasoner
"
,
});
// console.log(completion.choices[0].message.content);
res
.
send
(
JSON
.
stringify
({
code
:
1
,
msg
:
'
成功
'
,
response
:{
content
:
completion
.
choices
[
0
].
message
.
content
}}));
}
main
();
})
var
server
=
app
.
listen
(
9999
,
function
()
{
var
host
=
server
.
address
().
address
var
port
=
server
.
address
().
port
console
.
log
(
"
应用实例,访问地址为 http://%s:%s
"
,
host
,
port
)
})
\ No newline at end of file
ynwh-deviceManagement-pc/src/components/CEditModal.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<!-- 通用新增、编辑Modal -->
<div>
<Modal
v-model=
"show"
:title=
"modalTitle"
:width=
"width"
:mask-closable=
"maskClosable"
:transfer=
"false"
:before-close=
"beforeClose"
>
<template>
<!-- Modal全局loading -->
<Spin
size=
"large"
fix
v-if=
"loading"
></Spin>
<Form
ref=
"form"
label-colon
:model=
"formData"
:rules=
"formRule"
:label-width=
"formLabelWidth"
>
<!-- 新增 / 编辑 -->
<Row
v-if=
"!isDetails"
>
<Col
v-bind=
"grid"
v-for=
"item in formItem.filter(a => a.type != 'file' && (!a.hasOwnProperty('show') || a.show))"
:key=
"item.id"
>
<FormItem
:label=
"item.name"
:prop=
"item.id"
>
<Input
v-if=
"item.type == 'input'"
v-model=
"formData[item.id]"
clearable
:placeholder=
"'请输入'+item.name"
:disabled=
"item.disabled"
/>
<Input
v-if=
"item.type == 'textarea'"
v-model=
"formData[item.id]"
clearable
type=
"textarea"
:placeholder=
"'请输入'+item.name"
:rows=
"item.rows"
:disabled=
"item.disabled"
/>
<Select
@
on-query-change=
"onQueryChange"
v-else-if=
"item.type == 'select'"
v-model=
"formData[item.id]"
clearable
:placeholder=
"'请选择'+item.name"
filterable
:disabled=
"item.disabled"
>
<Option
v-for=
"it in item.optList"
:key=
"it.value"
:value=
"it.value"
>
{{
it
.
label
}}
</Option>
</Select>
<Select
v-else-if=
"item.type == 'multipleselect'"
v-model=
"formData[item.id]"
clearable
multiple
filterable
:placeholder=
"'请选择'+item.name"
:disabled=
"item.disabled"
>
<Option
v-for=
"it in item.optList"
:key=
"it.value"
:value=
"it.value"
>
{{
it
.
label
}}
</Option>
</Select>
<Switch
v-else-if=
"item.type == 'switch'"
v-model=
"formData[item['id']]"
:true-value=
"1"
:false-value=
"0"
/>
<TimePicker
v-else-if=
"item.type == 'timerange'"
v-model=
"formData[item['id']]"
style=
"width: 100%;"
format=
"HH:mm"
type=
"timerange"
placement=
"bottom-end"
:placeholder=
"'请选择'+item.name"
@
on-clear=
"onClearTimerange($event,item['id'])"
/>
</FormItem>
</Col>
<!-- 文件类型 -->
<Col
span=
"12"
v-for=
"(item, index) in formItem.filter(a => a.type == 'file' && (!a.hasOwnProperty('show') || a.show))"
:key=
"item.id"
>
<FormItem
:label=
"item.name"
:prop=
"item.name"
>
<Upload
multiple
action=
"#"
:before-upload=
"(file) => uploadFile(file, item.id, index)"
>
<Button
icon=
"ios-cloud-upload-outline"
:loading=
"uploadBtLoading[index]"
>
选择文件
</Button>
</Upload>
<p
v-for=
"file in formData[item.id]"
:key=
"file.path"
class=
"fileRow"
>
<a
target=
"_blank"
:href=
"file.path"
>
{{
file
.
file_name
}}
</a>
<Icon
class=
"delIcon"
type=
"md-close"
@
click=
"fileDel(file, item.id)"
/>
</p>
</FormItem>
</Col>
</Row>
<!-- 详情 -->
<Row
v-if=
"isDetails"
>
<Col
v-bind=
"grid"
v-for=
"item in formItem.filter(a => a.type != 'file' && (!a.hasOwnProperty('show') || a.show))"
:key=
"item.id"
>
<FormItem
:label=
"item.name"
:prop=
"item.name"
>
<span
v-if=
"item.type == 'input'"
>
{{
formData
[
item
.
id
]
}}
</span>
<!-- 存在问题:性别项,有时返回值为null,select的“不限”值为空字符串,会报错 -->
<span
v-if=
"item.type == 'select'"
>
{{
item
.
optList
[
item
.
optList
.
findIndex
(
a
=>
a
.
value
==
formData
[
item
.
id
])].
label
}}
</span>
<span
v-if=
"item.type == 'switch'"
>
{{
`${formData[item.id] == 1 ? '是' : '否'
}
`
}}
<
/span
>
<
/FormItem
>
<
/Col
>
<
Col
span
=
"
12
"
v
-
for
=
"
item in formItem.filter(a => a.type == 'file' && (!a.hasOwnProperty('show') || a.show))
"
:
key
=
"
item.id
"
>
<
FormItem
:
label
=
"
item.name
"
:
prop
=
"
item.name
"
>
<
p
v
-
for
=
"
file in formData[item.id]
"
:
key
=
"
file.path
"
class
=
"
fileRow
"
>
<
a
target
=
"
_blank
"
:
href
=
"
file.path
"
>
{{
file
.
file_name
}}
<
/a
>
<
Icon
class
=
"
delIcon
"
type
=
"
md-close
"
@
click
=
"
fileDel(file, item.id)
"
/>
<
/p
>
<
/FormItem
>
<
/Col
>
<
/Row
>
<
/Form
>
<
/template
>
<
template
#
footer
>
<!--
新增
/
编辑
-->
<
div
v
-
if
=
"
!isDetails
"
>
<
Button
@
click
=
"
onCancel
"
>
取消
<
/Button
>
<
Button
type
=
"
primary
"
@
click
=
"
onSubmit
"
>
提交
<
/Button
>
<
/div
>
<!--
详情
-->
<
div
v
-
else
>
<
Button
@
click
=
"
onCancel
"
>
关闭
<
/Button
>
<
/div
>
<
/template
>
<
/Modal
>
<
/div
>
<
/template
>
<
script
>
import
{
cloneDeep
}
from
'
lodash
'
export
default
{
props
:
{
// Modal全局loading
loading
:
{
type
:
Boolean
,
default
:
false
}
,
// 表单项、规则、label宽度
formItem
:
{
type
:
Array
,
require
:
true
}
,
formRule
:
{
type
:
Object
,
default
:
()
=>
{
}
}
,
formLabelWidth
:
{
type
:
Number
,
default
:
80
}
,
// Modal显示value
value
:
{
type
:
Boolean
,
require
:
true
}
,
// Modal宽度
width
:
{
default
:
'
520
'
}
,
// 是否允许点击遮罩层关闭
maskClosable
:
{
type
:
Boolean
,
default
:
false
}
,
__PROP_NAMES_MAP
:
{
maskClosable
:
'
mask-closable
'
}
,
}
,
watch
:
{
value
(
newVal
)
{
this
.
show
=
newVal
}
,
}
,
data
()
{
return
{
// Modal显示value
show
:
this
.
value
,
modalTitle
:
'
编辑
'
,
// 表单数据
formData
:
{
}
,
grid
:
{
xl
:
12
,
lg
:
12
,
md
:
24
,
sm
:
24
,
xs
:
24
,
}
,
// 上传按钮loading
uploadBtLoading
:
[],
// 详情显示 true.显示详情 false.新增/编辑
isDetails
:
false
,
peopleKey
:
''
,
//select 搜索文字
}
}
,
computed
:
{
}
,
created
()
{
}
,
mounted
()
{
}
,
methods
:
{
onQueryChange
(
query
){
//select 搜索文字 改变触发
this
.
peopleKey
=
query
this
.
$emit
(
'
getPeopleList
'
,
query
)
}
,
/**
* Modal打开初始化(新增编辑用)
* @param {String
}
addOrEdit add.新增 edit.编辑
*/
modalInit
(
addOrEdit
=
'
add
'
,
row
,
title
=
''
)
{
this
.
isDetails
=
false
this
.
uploadBtLoading
=
[]
if
(
addOrEdit
==
'
add
'
)
{
this
.
$refs
.
form
.
resetFields
()
//重置状态
this
.
modalTitle
=
title
?
title
:
'
新增
'
this
.
formData
=
row
?
cloneDeep
(
row
)
:
{
}
}
else
if
(
addOrEdit
==
'
edit
'
)
{
this
.
modalTitle
=
'
编辑
'
this
.
$refs
.
form
.
resetFields
()
this
.
formData
=
cloneDeep
(
row
)
// 时间范围处理
let
tri
=
this
.
formItem
.
findIndex
(
a
=>
a
.
type
==
'
timerange
'
)
if
(
tri
!=
-
1
)
{
let
id
=
this
.
formItem
[
tri
].
id
this
.
formData
[
id
]
=
this
.
formData
[
id
].
split
(
'
-
'
)
}
}
// 设置上传按钮loading
this
.
formItem
.
forEach
(
a
=>
{
if
(
a
.
type
==
'
file
'
)
{
this
.
uploadBtLoading
.
push
(
false
)
}
}
)
}
,
// 查看详情时初始化
modalDetailsInit
(
row
,
itemName
)
{
this
.
isDetails
=
true
this
.
modalTitle
=
`${row[itemName]
}
- 详情`
this
.
formData
=
cloneDeep
(
row
)
}
,
// 上传文件
uploadFile
(
file
,
id
,
i
)
{
this
.
uploadBtLoading
[
i
]
=
true
this
.
$forceUpdate
()
let
fd
=
new
FormData
()
fd
.
append
(
'
file
'
,
file
)
this
.
asc
.
postApiCommonFileUpload
(
fd
).
then
(
res
=>
{
// console.log('上传后', res)
if
(
res
.
code
==
1
)
{
this
.
formData
[
id
].
push
(
res
.
response
)
this
.
$Message
.
success
(
res
.
msg
)
}
else
{
this
.
$Message
.
error
(
res
.
msg_detail
)
}
}
).
finally
(()
=>
{
this
.
uploadBtLoading
[
i
]
=
false
this
.
$forceUpdate
()
}
)
return
false
}
,
// 删除文件
fileDel
(
file
,
id
)
{
let
i
=
this
.
formData
[
id
].
findIndex
(
a
=>
a
.
id
==
file
.
id
)
this
.
formData
[
id
].
splice
(
i
,
1
)
}
,
onClearTimerange
(
event
,
item
){
//清空时间时触发 清空的时间应该是数组 才能触发 表单检验
this
.
formData
[
item
]
=
[]
}
,
// Modal关闭前回调
beforeClose
()
{
this
.
$emit
(
'
onClose
'
)
}
,
// 取消
onCancel
()
{
this
.
$emit
(
'
onCancel
'
)
this
.
$emit
(
'
onClose
'
)
}
,
// 提交
onSubmit
()
{
this
.
$refs
.
form
.
validate
((
valid
)
=>
{
if
(
valid
)
{
let
obj
=
cloneDeep
(
this
.
formData
)
// 时间范围处理
let
tri
=
this
.
formItem
.
findIndex
(
a
=>
a
.
type
==
'
timerange
'
)
if
(
tri
!=
-
1
)
{
let
id
=
this
.
formItem
[
tri
].
id
obj
[
id
]
=
obj
[
id
].
join
(
'
-
'
)
}
this
.
$emit
(
'
onSubmit
'
,
obj
)
}
else
{
this
.
$Message
.
warning
(
'
请检查输入项
'
)
}
}
)
}
,
}
,
}
<
/script
>
<
style
scoped
lang
=
"
less
"
>
.
ivu
-
form
-
item
{
padding
-
right
:
15
px
;
}
.
fileRow
{
display
:
flex
;
justify
-
content
:
space
-
between
;
align
-
items
:
center
;
.
delIcon
{
color
:
#
ed4014
;
}
.
delIcon
:
hover
{
color
:
#
f16643
;
cursor
:
pointer
;
}
}
<
/style
>
ynwh-deviceManagement-pc/src/components/CTable.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<!-- 通用Table -->
<div>
<Table
:border=
"tableBorder"
class=
"ivu-mt"
:columns=
"tableColumns"
:data=
"tableData"
:loading=
"tableLoading"
:size=
"tableSize"
>
<template
slot-scope=
"
{ row, index }" slot="generalSwitch">
<Switch
v-model=
"row.is_enable"
size=
"large"
:true-value=
"1"
:false-value=
"0"
@
on-change=
"(val) => switchChange(val, row, index)"
>
<span
type=
"md-checkmark"
slot=
"open"
>
启用
</span>
<span
type=
"md-close"
slot=
"close"
>
停用
</span>
</Switch>
</
template
>
<
template
slot-scope=
"{ row }"
slot=
"action"
>
<Button
type=
"info"
size=
"small"
@
click=
"edit(row)"
>
编辑
</Button>
<Poptip
confirm
transfer
title=
"是否确认删除?"
@
on-ok=
"del(row)"
>
<Button
type=
"error"
size=
"small"
style=
"margin-left: 8px"
>
删除
</Button>
</Poptip>
</
template
>
<
template
slot-scope=
"{ row }"
slot=
"actionAndDetails"
>
<a
@
click=
"details(row)"
>
详情
</a>
<Button
type=
"info"
size=
"small"
@
click=
"edit(row)"
style=
"margin-left: 8px"
>
编辑
</Button>
<Poptip
confirm
transfer
title=
"是否确认删除?"
@
on-ok=
"del(row)"
>
<Button
type=
"error"
size=
"small"
style=
"margin-left: 8px"
>
删除
</Button>
</Poptip>
</
template
>
<!-- 自定义插槽 -->
<
template
v-for=
"(_, slot) in $scopedSlots"
v-slot:[slot]=
"scope"
>
<slot
:name=
"slot"
v-bind=
"scope"
>
</slot>
</
template
>
</Table>
<div
class=
"ivu-text-center ivu-mt"
>
<Page
:total=
"dataCount"
:current=
"pageIndex"
:page-size=
"pageSize"
:page-size-opts=
"pageSizeOpts"
show-total
show-sizer
@
on-change=
"handleChangePage"
@
on-page-size-change=
"handleChangePageSize"
/>
</div>
</div>
</template>
<
script
>
export
default
{
props
:
{
tableBorder
:
{
type
:
Boolean
,
default
:
false
},
tableColumns
:
{
type
:
Array
,
require
:
true
},
tableData
:
{
type
:
Array
,
require
:
true
},
tableLoading
:
{
type
:
Boolean
,
default
:
false
},
tableSize
:
{
type
:
String
,
default
:
'
default
'
},
dataCount
:
{
type
:
Number
,
require
:
true
},
pageIndex
:
{
type
:
Number
,
require
:
true
},
pageSize
:
{
type
:
Number
,
require
:
true
},
pageSizeOpts
:
{
type
:
Array
,
default
:
()
=>
[
10
,
20
,
50
,
100
]
},
},
data
()
{
return
{}
},
computed
:
{},
created
()
{},
mounted
()
{},
methods
:
{
// 改变开关
switchChange
(
val
,
row
,
index
)
{
this
.
$emit
(
'
switchChange
'
,
val
,
row
,
index
)
},
// 详情
details
(
row
)
{
this
.
$emit
(
'
rowDetails
'
,
row
)
},
// 编辑行
edit
(
row
)
{
this
.
$emit
(
'
rowEdit
'
,
row
)
},
// 删除行
del
(
row
)
{
this
.
$emit
(
'
rowDelete
'
,
row
)
},
// 翻页
handleChangePage
(
val
)
{
this
.
$emit
(
'
onPageChange
'
,
val
)
},
// 更改每页长度
handleChangePageSize
(
val
)
{
this
.
$emit
(
'
onPageSizeChange
'
,
val
)
},
},
}
</
script
>
<
style
scoped
lang=
"less"
>
</
style
>
ynwh-deviceManagement-pc/src/components/SearchCondForm.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<!-- 通用搜索表单 -->
<div>
<Form
class=
"searchDiv"
:model=
"searchCondObj"
:label-width=
"labelWidth"
:label-colon=
"labelColon"
>
<Row>
<Col
v-bind=
"grid"
v-for=
"item in searchCondList.filter(a => a.show)"
:key=
"item.id"
>
<FormItem
:label=
"item.name"
>
<Input
v-if=
"item.type == 'input'"
style=
"width: 100%;"
v-model=
"searchCondObj[item.id]"
clearable
:placeholder=
"'请输入'+item.name"
></Input>
<Select
v-else-if=
"item.type == 'select'"
style=
"width: 100%;"
v-model=
"searchCondObj[item.id]"
clearable
:placeholder=
"'请选择'+item.name"
>
<Option
v-for=
"it in item.optList"
:key=
"it.value"
:value=
"it.value"
>
{{
it
.
label
}}
</Option>
</Select>
<DatePicker
v-else-if=
"item.type == 'datetime'"
v-model=
"searchCondObj[item['id']]"
type=
"datetime"
format=
"yyyy-MM-dd HH:mm"
:placeholder=
"'请选择'+item.name"
@
on-change=
"(val1, val2) => datetimeChange(val1, val2, item.id)"
/>
</FormItem>
</Col>
<Col
v-bind=
"grid"
class=
"buttonCol"
>
<Button
type=
"primary"
@
click=
"searchBt"
>
查询
</Button>
<Button
@
click=
"resetBt"
>
重置
</Button>
</Col>
</Row>
</Form>
</div>
</
template
>
<
script
>
export
default
{
props
:
{
// 搜索项列表
searchCondList
:
{
type
:
Array
,
require
:
true
},
// label宽度
labelWidth
:
{
type
:
Number
,
default
:
100
},
// label冒号
labelColon
:
{
type
:
Boolean
,
default
:
true
},
},
data
()
{
return
{
// 搜索条件布局
grid
:
{
sm
:
12
,
md
:
12
,
lg
:
8
,
xl
:
6
,
},
// 搜索数据
searchCondObj
:
{},
}
},
computed
:
{},
created
()
{},
mounted
()
{},
methods
:
{
// 搜索
searchBt
()
{
this
.
$emit
(
'
onSubmit
'
,
this
.
searchCondObj
)
},
// 重置
resetBt
()
{
// console.log('重置按钮')
this
.
searchCondObj
=
{}
this
.
$emit
(
'
onReset
'
)
},
// 日期时间改变选择
datetimeChange
(
val1
,
val2
,
id
)
{
// console.log('日期时间改变选择', val1, val2, id)
this
.
searchCondObj
[
id
]
=
val1
},
},
}
</
script
>
<
style
scoped
lang=
"less"
>
.searchDiv{
.ivu-form-item{
margin-bottom: 12px;
}
.buttonCol{
margin-left: auto;
text-align: right;
.ivu-btn{
margin-left: 8px;
}
}
}
</
style
>
ynwh-deviceManagement-pc/src/pages/alertManagement/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div>
<Card
dis-hover
:bordered=
"false"
>
<!-- 搜索区域 -->
<initForm
ref=
"searchFormRef"
:searchCondList=
"searchList"
@
on-submit=
"handleSearch"
@
on-reset=
"handleReset"
>
</initForm>
<!-- 表格工具栏 -->
<div
class=
"operation-bar"
>
<Button
type=
"primary"
@
click=
"handleAdd"
>
添加任务
</Button>
<Button
class=
"ivu-ml-8"
@
click=
"handleImport"
>
导入任务
</Button>
<!--
<Button
class=
"ivu-ml-8"
@
click=
"handleExport"
>
导出任务
</Button>
-->
<Button
class=
"ivu-ml-8"
@
click=
"handleDownloadTemplate"
:loading=
"downloadLoading"
>
下载模板
</Button>
</div>
<!-- 表格 -->
<initTable
ref=
"tableRef"
class=
"ivu-mt"
:tableLoading=
"loading"
:tableColumns=
"columns"
:tableData=
"tableData"
:dataCount=
"total"
:pageIndex=
"pageIndex"
:pageSize=
"pageSize"
@
on-page-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
>
<!-- 状态列 -->
<template
#finish_status
="
{ row }">
<Tag
v-if=
"row.finish_status === 0"
color=
"default"
>
未完成
</Tag>
<Tag
v-else-if=
"row.finish_status === 1"
color=
"success"
>
已完成
</Tag>
<Tag
v-else
color=
"default"
>
{{
row
.
finish_status
||
'
-
'
}}
</Tag>
</
template
>
<
template
#audit_status
="{
row
}"
>
<Tag
v-if=
"row.audit_status === 0"
color=
"default"
>
暂存
</Tag>
<Tag
v-else-if=
"row.audit_status === 1"
color=
"primary"
>
审批中
</Tag>
<Tag
v-else-if=
"row.audit_status === 2"
color=
"success"
>
审批通过
</Tag>
<Tag
v-else-if=
"row.audit_status === -1"
color=
"error"
>
不通过
</Tag>
<Tag
v-else
color=
"default"
>
{{
row
.
audit_status
||
'
-
'
}}
</Tag>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
@
click
.
stop
.
prevent
>
<a
type=
"text"
style=
"color: #2D8cF0"
@
click=
"handleDetail(row)"
>
查看
</a>
<Divider
type=
"vertical"
/>
<a
type=
"text"
style=
"color: #2D8cF0"
@
click=
"handleEdit(row)"
>
编辑
</a>
<Divider
type=
"vertical"
/>
<a
type=
"text"
style=
"color: #ed4014"
@
click=
"handleDelete(row)"
>
删除
</a>
</div>
</
template
>
</initTable>
</Card>
<!-- 任务详情/编辑对话框 -->
<Modal
v-model=
"detailModal.show"
:title=
"detailModal.title"
width=
"1080"
:z-index=
"100"
:mask-closable=
"false"
>
<div
style=
"max-height: 70vh; overflow: hidden; overflow-y: auto; "
>
<Row
:gutter=
"20"
v-if=
"detailModal.isView"
>
<!-- 左侧任务信息 -->
<Col
span=
"14"
>
<Card
dis-hover
>
<
template
#title
>
任务基本信息
</
template
>
<div
class=
"task-detail-info"
>
<Row>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
任务年份:
</span>
<span
class=
"detail-value"
>
{{ typeof detailModal.form.year === 'object' ?
dayjs(detailModal.form.year).format('YYYY') : detailModal.form.year }}
</span>
</Col>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
计划完成时间:
</span>
<span
class=
"detail-value"
>
{{ typeof detailModal.form.plan_finish_time === 'object' ?
dayjs(detailModal.form.plan_finish_time).format('YYYY-MM') :
detailModal.form.plan_finish_time }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
任务名称:
</span>
<span
class=
"detail-value"
>
{{ detailModal.form.name }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
任务目标:
</span>
<span
class=
"detail-value detail-textarea"
>
{{ detailModal.form.detail }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
责任部门:
</span>
<span
class=
"detail-value"
>
{{ getDepartmentName(detailModal.form.duty_dept_id) }}
</span>
</Col>
<Col
span=
"12"
v-if=
"detailModal.form.belong_dept_id"
>
<span
class=
"detail-label"
>
归口部门:
</span>
<span
class=
"detail-value"
>
{{ getDepartmentName(detailModal.form.belong_dept_id) }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
完成状态:
</span>
<span
class=
"detail-value"
>
<Tag
v-if=
"detailModal.form.finish_status === 0"
color=
"default"
>
未完成
</Tag>
<Tag
v-else-if=
"detailModal.form.finish_status === 1"
color=
"success"
>
已完成
</Tag>
</span>
</Col>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
审核状态:
</span>
<span
class=
"detail-value"
>
<Tag
v-if=
"detailModal.form.audit_status === 0"
color=
"default"
>
暂存
</Tag>
<Tag
v-else-if=
"detailModal.form.audit_status === 1"
color=
"primary"
>
审批中
</Tag>
<Tag
v-else-if=
"detailModal.form.audit_status === 2"
color=
"success"
>
审批通过
</Tag>
<Tag
v-else-if=
"detailModal.form.audit_status === -1"
color=
"error"
>
不通过
</Tag>
</span>
</Col>
</Row>
<div
v-if=
"detailModal.form.completion_content"
>
<Divider>
任务完成情况说明
</Divider>
<Row
class=
"detail-row"
v-if=
"detailModal.form.actual_finish_time"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
实际完成时间:
</span>
<span
class=
"detail-value"
>
{{ detailModal.form.actual_finish_time }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
情况说明:
</span>
<span
class=
"detail-value detail-textarea"
>
{{ detailModal.form.completion_content
}}
</span>
</Col>
</Row>
<div
v-if=
"detailModal.completion_files && detailModal.completion_files.length > 0"
>
<Table
border
:columns=
"uploadFileColumns"
:data=
"detailModal.completion_files"
class=
"ivu-mt"
>
<
template
#name
="{
row
}"
>
<div
class=
"file-name"
>
<a
@
click=
"previewFile(row)"
style=
"color: #3399ff; font-weight: 600;"
>
{{
row
.
name
}}
</a>
</div>
</
template
>
<
template
#option
="{
row
}"
>
<a
type=
"text"
@
click=
"downloadFile(row)"
>
下载
</a>
</
template
>
</Table>
</div>
</div>
<Row
class=
"detail-row"
v-if=
"detailModal.form.audit_opinion"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
审核意见:
</span>
<span
class=
"detail-value detail-textarea"
>
{{ detailModal.form.audit_opinion }}
</span>
</Col>
</Row>
</div>
</Card>
</Col>
<!-- 右侧任务轨迹 -->
<Col
span=
"10"
>
<Card
dis-hover
>
<
template
#title
>
任务轨迹
</
template
>
<div
class=
"task-traces"
>
<div
v-if=
"detailModal.traces && detailModal.traces.length > 0"
>
<Timeline>
<TimelineItem
v-for=
"(trace, index) in detailModal.traces"
:key=
"index"
:color=
"getTraceColor(trace)"
>
<p
class=
"time"
>
{{ trace.createtime }}
</p>
<p
class=
"content"
>
<span>
{{ trace.step_name }}
</span>
-
<span>
{{ trace.createby }}
</span>
</p>
<p
class=
"remark"
>
{{ trace.content }}
</p>
</TimelineItem>
</Timeline>
</div>
<div
v-else
class=
"no-traces"
>
<Icon
type=
"md-information-circle"
size=
"24"
/>
<p>
暂无任务轨迹
</p>
</div>
</div>
</Card>
</Col>
</Row>
<!-- 非查看模式下的表单 -->
<Form
ref=
"taskFormRef"
:model=
"detailModal.form"
:rules=
"formRules"
:label-width=
"110"
v-if=
"!detailModal.isView"
>
<FormItem
label=
"任务年份"
prop=
"year"
>
<DatePicker
v-model=
"detailModal.form.year"
transfer
type=
"year"
placeholder=
"请选择任务年份"
></DatePicker>
</FormItem>
<FormItem
label=
"任务名称"
prop=
"name"
>
<Input
v-model=
"detailModal.form.name"
placeholder=
"请输入任务名称"
></Input>
</FormItem>
<FormItem
label=
"任务目标"
prop=
"detail"
>
<Input
v-model=
"detailModal.form.detail"
type=
"textarea"
:rows=
"4"
placeholder=
"请输入任务目标"
></Input>
</FormItem>
<FormItem
label=
"责任部门"
prop=
"duty_dept_id"
>
<Select
v-model=
"detailModal.form.duty_dept_id"
transfer
filterable
placeholder=
"请选择责任部门"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
<FormItem
label=
"归口部门"
prop=
"belong_dept_id"
>
<Select
v-model=
"detailModal.form.belong_dept_id"
transfer
filterable
placeholder=
"请选择归口部门"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
<FormItem
label=
"计划完成时间"
prop=
"plan_finish_time"
>
<DatePicker
v-model=
"detailModal.form.plan_finish_time"
transfer
type=
"month"
placeholder=
"请选择计划完成时间"
></DatePicker>
</FormItem>
<!-- <FormItem label="备注" prop="remark">
<Input v-model="detailModal.form.remark" type="textarea" :rows="2" placeholder="请输入备注"></Input>
</FormItem> -->
</Form>
</div>
<
template
#footer
>
<Button
@
click=
"detailModal.show = false"
>
{{
detailModal
.
isView
?
'
关闭
'
:
'
取消
'
}}
</Button>
<Button
type=
"primary"
@
click=
"handleSaveTask"
v-if=
"!detailModal.isView"
>
保存
</Button>
</
template
>
</Modal>
<!-- 导入任务对话框 -->
<Modal
v-model=
"importModal.show"
title=
"导入任务"
width=
"500"
:mask-closable=
"false"
>
<Form
:label-width=
"80"
>
<FormItem
label=
"任务年份"
>
<DatePicker
v-model=
"importModal.year"
transfer
type=
"year"
placeholder=
"请选择任务年份"
style=
"width: 100%"
>
</DatePicker>
</FormItem>
<FormItem
label=
"导入文件"
>
<Upload
type=
"drag"
action=
""
:before-upload=
"handleBeforeUpload"
>
<div
style=
"padding: 20px 0"
>
<Icon
type=
"ios-cloud-upload"
size=
"52"
style=
"color: #3399ff"
></Icon>
<p>
点击或拖拽文件到此处上传
</p>
</div>
</Upload>
<div
v-if=
"importModal.file"
style=
"margin-top: 8px"
>
已选择文件:{{ importModal.file.name }}
</div>
</FormItem>
</Form>
<
template
#footer
>
<Button
@
click=
"importModal.show = false"
>
取消
</Button>
<Button
type=
"primary"
@
click=
"handleImportSubmit"
:loading=
"importModal.loading"
:disabled=
"!importModal.file || !importModal.year"
>
提交
</Button>
</
template
>
</Modal>
<!-- 文件预览抽屉 -->
<Drawer
v-model=
"filePreviewDrawer.show"
title=
"文件预览"
placement=
"right"
width=
"70"
:mask-closable=
"true"
:styles=
"{ height: '100%' }"
:z-index=
"99999"
>
<div
class=
"file-preview-container"
>
<iframe
v-if=
"filePreviewDrawer.show"
:src=
"filePreviewUrl"
frameborder=
"0"
class=
"file-preview-iframe"
></iframe>
</div>
</Drawer>
</div>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
,
Drawer
}
from
'
view-ui-plus
'
import
{
AddProject
,
ImportProject
,
BaseFileOutPut
,
AdminGetProjectInit
,
AdminGetProject
,
UpdateProject
,
DeleteProject
,
GetDepts
}
from
'
@/api/api
'
import
initForm
from
'
@/components/initForm
'
import
initTable
from
'
@/components/initTable
'
// import ExportExcel from '@/utils/exportExcel'
import
{
useStore
}
from
'
vuex
'
import
dayjs
from
'
dayjs
'
const
store
=
useStore
()
console
.
log
(
"
🚀🚀store🚀
"
,
store
)
const
userRole
=
computed
(()
=>
store
.
state
.
admin
.
user
.
info
.
currentRole
.
role_id
)
// 部门列表
const
departmentOptions
=
ref
([])
// 加载部门数据
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
// 辅助函数:处理年份字符串为日期对象
const
parseYear
=
(
yearStr
)
=>
{
if
(
!
yearStr
)
return
''
;
// 如果是数字字符串,如"2025",转为"2025-01-01"再创建日期
if
(
/^
\d{4}
$/
.
test
(
yearStr
))
{
return
new
Date
(
`
${
yearStr
}
-01-01`
);
}
// 如果已经包含月份,如"2025-01",直接创建日期
return
new
Date
(
yearStr
);
}
// 辅助函数:处理年月字符串为日期对象
const
parseYearMonth
=
(
dateStr
)
=>
{
if
(
!
dateStr
)
return
''
;
// 如果是"YYYY-MM"格式,转为"YYYY-MM-01"再创建日期
if
(
/^
\d{4}
-
\d{2}
$/
.
test
(
dateStr
))
{
return
new
Date
(
`
${
dateStr
}
-01`
);
}
return
new
Date
(
dateStr
);
}
// 搜索条件
const
searchList
=
ref
([])
// 表格数据
const
tableData
=
ref
([])
// 总记录数
const
total
=
ref
(
0
)
// 当前页码
const
pageIndex
=
ref
(
1
)
// 每页条数
const
pageSize
=
ref
(
20
)
// 加载状态
const
loading
=
ref
(
false
)
// 表格列定义
const
columns
=
ref
([])
// 详情/编辑模态框
const
detailModal
=
reactive
({
show
:
false
,
title
:
'
任务详情
'
,
isView
:
true
,
form
:
{
id
:
null
,
year
:
''
,
name
:
''
,
detail
:
''
,
duty_dept_id
:
''
,
belong_dept_id
:
''
,
plan_finish_time
:
''
,
remark
:
''
,
completion_content
:
''
,
finish_status
:
0
,
audit_status
:
0
,
audit_opinion
:
''
,
actual_finish_time
:
''
},
traces
:
[],
completion_files
:
[]
})
// 导入模态框
const
importModal
=
reactive
({
show
:
false
,
year
:
''
,
file
:
null
,
loading
:
false
})
// 加载过滤条件
const
loadTaskFilter
=
async
()
=>
{
try
{
await
AdminGetProjectInit
({
role_id
:
userRole
.
value
}).
then
((
res
)
=>
{
searchList
.
value
=
res
.
response
console
.
log
(
"
🚀 searchList.value🚀🚀,
"
,
searchList
.
value
)
}).
catch
(
error
=>
{
console
.
error
(
error
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取过滤条件失败:
'
,
error
)
Message
.
error
(
'
获取过滤条件失败
'
)
}
}
// 加载任务列表
const
loadTaskList
=
async
()
=>
{
loading
.
value
=
true
try
{
const
params
=
{
page_index
:
pageIndex
.
value
,
page_size
:
pageSize
.
value
,
role_id
:
userRole
.
value
,
...
formValues
.
value
}
await
AdminGetProject
(
params
).
then
((
res
)
=>
{
tableData
.
value
=
res
.
response
.
data
total
.
value
=
res
.
response
.
data_count
if
(
columns
.
value
.
length
==
0
)
{
columns
.
value
=
res
.
response
.
title
.
filter
(
a
=>
a
.
default_hide_flag
===
0
)
// 过滤掉隐藏列
.
map
(
a
=>
{
const
column
=
{
title
:
a
.
show_name
,
key
:
a
.
field_id
,
minWidth
:
a
.
width
||
130
,
show
:
true
,
align
:
'
center
'
,
ellipsis
:
true
,
tooltip
:
true
}
// 为name和detail列设置特殊属性
if
(
a
.
field_id
===
'
name
'
||
a
.
field_id
===
'
detail
'
)
{
column
.
ellipsis
=
true
column
.
tooltip
=
true
column
.
minWidth
=
a
.
width
||
250
}
// 为完成状态和审核状态设置插槽
if
(
a
.
field_id
===
'
finish_status
'
||
a
.
field_id
===
'
audit_status
'
)
{
column
.
slot
=
a
.
field_id
}
return
column
})
//添加操作列
columns
.
value
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
180
,
show
:
true
,
align
:
'
center
'
,
fixed
:
'
right
'
})
console
.
log
(
"
columns.value
"
,
columns
.
value
)
}
}).
catch
(
error
=>
{
console
.
error
(
error
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取任务列表失败:
'
,
error
)
Message
.
error
(
'
获取任务列表失败
'
)
}
finally
{
loading
.
value
=
false
}
}
// 搜索表单值
const
formValues
=
ref
({})
// 搜索
const
handleSearch
=
(
values
)
=>
{
formValues
.
value
=
values
pageIndex
.
value
=
1
loadTaskList
()
}
// 重置
const
handleReset
=
()
=>
{
formValues
.
value
=
{}
pageIndex
.
value
=
1
loadTaskList
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
loadTaskList
()
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
loadTaskList
()
}
// 添加任务
const
handleAdd
=
()
=>
{
detailModal
.
isView
=
false
detailModal
.
title
=
'
添加任务
'
detailModal
.
form
=
{
id
:
null
,
year
:
''
,
name
:
''
,
detail
:
''
,
duty_dept_id
:
''
,
belong_dept_id
:
''
,
plan_finish_time
:
''
,
remark
:
''
}
detailModal
.
traces
=
[]
detailModal
.
show
=
true
// 等待DOM更新后再获取表单引用
setTimeout
(()
=>
{
if
(
taskFormRef
.
value
)
{
taskFormRef
.
value
.
resetFields
()
}
},
100
)
}
// 编辑任务
const
handleEdit
=
async
(
row
)
=>
{
detailModal
.
isView
=
false
detailModal
.
title
=
'
编辑任务
'
try
{
// 预处理日期
const
year
=
parseYear
(
row
.
year
);
const
planFinishTime
=
parseYearMonth
(
row
.
plan_finish_time
);
detailModal
.
form
=
{
id
:
row
.
id
,
year
:
year
,
name
:
row
.
name
,
detail
:
row
.
detail
,
duty_dept_id
:
row
.
duty_dept_id
,
belong_dept_id
:
row
.
belong_dept_id
,
plan_finish_time
:
planFinishTime
,
remark
:
row
.
remark
}
console
.
log
(
"
detailModal.form
"
,
detailModal
.
form
)
detailModal
.
traces
=
row
.
tracks
||
[]
detailModal
.
show
=
true
}
catch
(
error
)
{
console
.
error
(
'
获取任务详情失败:
'
,
error
)
Message
.
error
(
'
获取任务详情失败
'
)
}
}
// 查看任务详情
const
handleDetail
=
async
(
row
)
=>
{
detailModal
.
isView
=
true
detailModal
.
title
=
'
任务详情
'
try
{
// 预处理日期
const
year
=
parseYear
(
row
.
year
);
const
planFinishTime
=
parseYearMonth
(
row
.
plan_finish_time
);
detailModal
.
form
=
{
id
:
row
.
id
,
year
:
year
,
name
:
row
.
name
,
detail
:
row
.
detail
,
duty_dept_id
:
row
.
duty_dept_id
,
belong_dept_id
:
row
.
belong_dept_id
,
plan_finish_time
:
planFinishTime
,
remark
:
row
.
remark
,
completion_content
:
row
.
completion_content
,
finish_status
:
row
.
finish_status
,
audit_status
:
row
.
audit_status
,
audit_opinion
:
row
.
audit_opinion
,
actual_finish_time
:
row
.
actual_finish_time
}
detailModal
.
traces
=
row
.
tracks
||
[]
detailModal
.
completion_files
=
row
.
completion_files
||
[]
detailModal
.
show
=
true
}
catch
(
error
)
{
console
.
error
(
'
获取任务详情失败:
'
,
error
)
Message
.
error
(
'
获取任务详情失败
'
)
}
}
// 删除任务
const
handleDelete
=
(
row
)
=>
{
ModalConfirm
.
confirm
({
title
:
'
确认删除
'
,
content
:
`确定要删除任务"
${
row
.
name
}
"吗?`
,
onOk
:
async
()
=>
{
try
{
await
DeleteProject
({
id
:
row
.
id
}).
then
((
res
)
=>
{
Message
.
success
(
res
)
loadTaskList
()
}).
catch
(
error
=>
{
console
.
error
(
error
)
Message
.
error
(
'
删除任务失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
删除任务失败:
'
,
error
)
Message
.
error
(
'
删除任务失败
'
)
}
}
})
}
// 表单引用
const
taskFormRef
=
ref
(
null
)
// 表单验证规则
const
formRules
=
{
year
:
[
{
required
:
true
,
type
:
'
date
'
,
message
:
'
请选择任务年份
'
,
trigger
:
'
change
'
}
],
name
:
[
{
required
:
true
,
message
:
'
请输入任务名称
'
,
trigger
:
'
blur
'
}
],
detail
:
[
{
required
:
true
,
message
:
'
请输入任务目标
'
,
trigger
:
'
blur
'
}
],
duty_dept_id
:
[
{
required
:
true
,
message
:
'
请选择责任部门
'
,
trigger
:
'
change
'
}
],
belong_dept_id
:
[
{
required
:
false
,
message
:
'
请选择归口部门
'
,
trigger
:
'
change
'
}
],
plan_finish_time
:
[
{
required
:
true
,
type
:
'
date
'
,
message
:
'
请选择计划完成时间
'
,
trigger
:
'
change
'
}
]
}
// 保存任务
const
handleSaveTask
=
async
()
=>
{
if
(
!
taskFormRef
.
value
)
{
console
.
error
(
'
表单实例不存在
'
)
Message
.
error
(
'
系统错误,请稍后重试
'
)
return
}
taskFormRef
.
value
.
validate
(
async
(
valid
)
=>
{
if
(
!
valid
)
{
Message
.
error
(
'
请检查输入内容
'
)
return
}
try
{
// 准备提交数据,确保日期格式正确
const
formData
=
{
...
detailModal
.
form
,
// 如果year是Date对象,转换为字符串"YYYY"
year
:
typeof
detailModal
.
form
.
year
===
'
object
'
?
dayjs
(
detailModal
.
form
.
year
).
format
(
'
YYYY
'
)
:
detailModal
.
form
.
year
,
// 如果plan_finish_time是Date对象,转换为字符串"YYYY-MM"
plan_finish_time
:
typeof
detailModal
.
form
.
plan_finish_time
===
'
object
'
?
dayjs
(
detailModal
.
form
.
plan_finish_time
).
format
(
'
YYYY-MM
'
)
:
detailModal
.
form
.
plan_finish_time
,
audit_status
:
0
// 默认为暂存状态
}
if
(
detailModal
.
form
.
id
)
{
// 更新任务
await
UpdateProject
(
formData
).
then
((
res
)
=>
{
Message
.
success
(
'
更新任务成功
'
)
detailModal
.
show
=
false
loadTaskList
()
}).
catch
(
error
=>
{
console
.
error
(
error
)
Message
.
error
(
'
更新任务失败
'
)
})
}
else
{
// 创建新任务
await
AddProject
(
formData
).
then
((
res
)
=>
{
Message
.
success
(
res
)
detailModal
.
show
=
false
loadTaskList
()
}).
catch
(
error
=>
{
console
.
error
(
error
)
Message
.
error
(
'
创建任务失败
'
)
})
}
}
catch
(
error
)
{
console
.
error
(
'
保存任务失败:
'
,
error
)
Message
.
error
(
'
保存任务失败
'
)
}
})
}
// 导入任务
const
handleImport
=
()
=>
{
importModal
.
show
=
true
}
// 导出任务
const
handleExport
=
async
()
=>
{
try
{
// 模拟导出功能
const
data
=
tableData
.
value
.
map
(
item
=>
({
'
任务标题
'
:
item
.
title
,
'
责任部门
'
:
item
.
department_name
,
'
归口部门
'
:
item
.
entrance_name
,
'
任务目标
'
:
item
.
target
,
'
截止日期
'
:
item
.
deadline
,
'
状态
'
:
item
.
status_text
,
'
备注
'
:
item
.
remark
}))
// 使用ExportExcel工具导出
// ExportExcel(data, '任务列表', `任务列表_${new Date().toISOString().slice(0, 10)}`)
Message
.
success
(
'
导出成功
'
)
}
catch
(
error
)
{
console
.
error
(
'
导出失败:
'
,
error
)
Message
.
error
(
'
导出失败
'
)
}
}
// 在script部分添加下载loading状态变量
const
downloadLoading
=
ref
(
false
)
// 下载模板
const
handleDownloadTemplate
=
()
=>
{
downloadLoading
.
value
=
true
BaseFileOutPut
()
.
then
((
res
)
=>
{
const
a
=
document
.
createElement
(
'
a
'
)
a
.
href
=
res
a
.
click
()
})
.
catch
(
error
=>
{
console
.
error
(
'
模板下载失败:
'
,
error
)
Message
.
error
(
'
模板下载失败
'
)
})
.
finally
(()
=>
{
downloadLoading
.
value
=
false
})
}
// 上传前验证
const
handleBeforeUpload
=
(
file
)
=>
{
const
isExcel
=
file
.
name
.
endsWith
(
'
.xlsx
'
)
||
file
.
name
.
endsWith
(
'
.xls
'
)
if
(
!
isExcel
)
{
Message
.
warning
(
'
只能上传Excel文件
'
)
return
false
}
// 保存文件引用,不立即上传
importModal
.
file
=
file
// 阻止Upload组件默认上传行为
return
false
}
// 提交导入任务
const
handleImportSubmit
=
()
=>
{
if
(
!
importModal
.
file
||
!
importModal
.
year
)
{
Message
.
warning
(
'
请选择任务年份和上传文件
'
)
return
}
importModal
.
loading
=
true
// 创建FormData对象
const
formData
=
new
FormData
()
formData
.
append
(
'
file
'
,
importModal
.
file
)
formData
.
append
(
'
year
'
,
dayjs
(
importModal
.
year
).
format
(
'
YYYY
'
))
// 调用导入接口
ImportProject
(
formData
)
.
then
(
res
=>
{
Message
.
success
(
res
)
importModal
.
show
=
false
loadTaskList
()
})
.
catch
(
error
=>
{
console
.
error
(
'
导入任务失败:
'
,
error
)
})
.
finally
(()
=>
{
importModal
.
loading
=
false
})
}
// 获取任务轨迹颜色
const
getTraceColor
=
(
trace
)
=>
{
if
(
!
trace
||
!
trace
.
step_name
)
return
'
blue
'
;
// 根据步骤ID或步骤名称判断颜色
if
(
trace
.
step_id
===
'
0
'
||
trace
.
step_name
.
includes
(
'
发起人
'
))
return
'
blue
'
;
if
(
trace
.
step_id
===
'
1
'
||
trace
.
step_name
.
includes
(
'
归口部门
'
))
return
'
green
'
;
if
(
trace
.
step_id
===
'
2
'
||
trace
.
step_name
.
includes
(
'
党政办
'
))
return
'
success
'
;
if
(
trace
.
content
&&
trace
.
content
.
includes
(
'
退回
'
))
return
'
red
'
;
return
'
blue
'
;
}
// 根据部门ID获取部门名称
const
getDepartmentName
=
(
deptId
)
=>
{
if
(
!
deptId
)
return
''
;
const
dept
=
departmentOptions
.
value
.
find
(
item
=>
item
.
value
===
deptId
);
return
dept
?
dept
.
label
:
''
;
}
// 上传文件列表表格列定义
const
uploadFileColumns
=
[
{
title
:
'
文件名
'
,
slot
:
'
name
'
,
minWidth
:
150
},
{
title
:
'
大小
'
,
key
:
'
size
'
,
minWidth
:
100
,
render
:
(
h
,
{
row
})
=>
{
return
h
(
'
span
'
,
formatFileSize
(
row
.
size
))
}
},
{
title
:
'
上传时间
'
,
key
:
'
createtime
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
option
'
,
fixed
:
'
right
'
,
width
:
150
,
align
:
'
center
'
}
]
// 格式化文件大小
const
formatFileSize
=
(
size
)
=>
{
if
(
!
size
)
return
'
-
'
const
sizeNum
=
parseInt
(
size
)
if
(
isNaN
(
sizeNum
))
return
size
if
(
sizeNum
<
1024
)
{
return
sizeNum
+
'
B
'
}
else
if
(
sizeNum
<
1024
*
1024
)
{
return
(
sizeNum
/
1024
).
toFixed
(
2
)
+
'
KB
'
}
else
if
(
sizeNum
<
1024
*
1024
*
1024
)
{
return
(
sizeNum
/
1024
/
1024
).
toFixed
(
2
)
+
'
MB
'
}
else
{
return
(
sizeNum
/
1024
/
1024
/
1024
).
toFixed
(
2
)
+
'
GB
'
}
}
// 下载文件
const
downloadFile
=
(
file
)
=>
{
const
link
=
document
.
createElement
(
'
a
'
)
link
.
href
=
file
.
path
link
.
download
=
file
.
name
document
.
body
.
appendChild
(
link
)
link
.
click
()
document
.
body
.
removeChild
(
link
)
}
// 文件预览相关状态
const
filePreviewDrawer
=
reactive
({
show
:
false
,
currentFile
:
null
})
// 原始域名
const
originHost
=
ref
(
''
)
// 获取文件预览URL
const
filePreviewUrl
=
computed
(()
=>
{
if
(
!
filePreviewDrawer
.
currentFile
)
return
''
return
`
${
originHost
.
value
}
/fileReader/?file=
${
filePreviewDrawer
.
currentFile
.
path
}
`
})
// 预览文件
const
previewFile
=
(
file
)
=>
{
filePreviewDrawer
.
currentFile
=
file
filePreviewDrawer
.
show
=
true
}
// 获取当前域名
const
getOriginHost
=
()
=>
{
originHost
.
value
=
window
.
location
.
origin
}
onMounted
(()
=>
{
loadDepartments
()
loadTaskFilter
()
loadTaskList
()
getOriginHost
()
})
</
script
>
<
style
scoped
>
.ivu-mt
{
margin-top
:
16px
;
}
.operation-bar
{
margin
:
16px
0
;
text-align
:
left
;
}
.ivu-ml-8
{
margin-left
:
8px
;
}
/* 轨迹样式 */
.time
{
font-size
:
12px
;
color
:
#999
;
}
.content
{
font-size
:
14px
;
margin
:
5px
0
;
}
.remark
{
font-size
:
13px
;
color
:
#666
;
}
/* 文件上传样式 */
.upload-container
{
position
:
relative
;
margin-bottom
:
16px
;
}
.file-name
{
display
:
flex
;
align-items
:
center
;
word-break
:
break-all
;
}
.demo-spin-icon-load
{
animation
:
ani-demo-spin
1s
linear
infinite
;
}
@keyframes
ani-demo-spin
{
from
{
transform
:
rotate
(
0deg
);
}
to
{
transform
:
rotate
(
360deg
);
}
}
/* 任务轨迹样式 */
.task-traces
{
max-height
:
50vh
;
overflow-y
:
auto
;
padding-right
:
10px
;
}
.no-traces
{
text-align
:
center
;
color
:
#c5c8ce
;
padding
:
30px
0
;
}
.no-traces
p
{
margin-top
:
10px
;
}
/* 任务详情样式 */
.task-detail-info
{
padding
:
8px
0
;
}
.detail-label
{
font-weight
:
bold
;
color
:
#17233d
;
}
.detail-value
{
margin-left
:
8px
;
word-break
:
break-word
;
}
.detail-textarea
{
white-space
:
pre-wrap
;
line-height
:
1.5
;
display
:
block
;
margin-top
:
4px
;
}
.detail-row
{
margin-top
:
16px
;
}
/* 文件预览样式 */
.file-preview-container
{
height
:
100%
;
width
:
100%
;
overflow
:
hidden
;
}
.file-preview-iframe
{
width
:
100%
;
height
:
100%
;
border
:
none
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/applicationClaim/consumables/components/applyFor.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
111
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</div>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/applicationClaim/consumables/components/takeOver.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<Card
dis-hover
:bordered=
"false"
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</Card>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/applicationClaim/consumables/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<Tabs
style=
"width: 100%;"
type=
"card"
@
on-click=
"tabsChange"
>
<TabPane
label=
"申请耗材"
style=
"width: 100%;height: 100%;"
>
</TabPane>
<TabPane
label=
"借用记录"
style=
"height: 100%;width: 100%;"
>
</TabPane>
</Tabs>
<component
v-if=
"init.tabsChange== 0"
:is=
"ApplyFor"
></component>
<component
v-else
:is=
"TakeOver"
></component>
</div>
</div>
</
template
>
<
script
setup
>
const
ApplyFor
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/applicationClaim/consumables/components/applyFor.vue
'
))
const
TakeOver
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/applicationClaim/consumables/components/takeOver.vue
'
))
import
{
ref
,
onMounted
,
reactive
,
computed
,
defineAsyncComponent
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
const
init
=
reactive
({
tabsChange
:
0
})
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
function
tabsChange
(
e
){
console
.
log
(
"
🚀🚀🚀,
"
,
e
)
init
.
tabsChange
=
e
}
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/applicationClaim/device/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<Tabs
style=
"width: 100%;"
type=
"card"
@
on-click=
"tabsChange"
>
<TabPane
label=
"申请设备"
style=
"width: 100%;height: 100%;"
>
</TabPane>
<TabPane
label=
"借用记录"
style=
"height: 100%;width: 100%;"
>
</TabPane>
</Tabs>
<component
v-if=
"init.tabsChange== 0"
:is=
"ApplyFor"
></component>
<component
v-else
:is=
"TakeOver"
></component>
</div>
</div>
</
template
>
<
script
setup
>
const
ApplyFor
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/applicationClaim/device/components/applyFor.vue
'
))
const
TakeOver
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/applicationClaim/device/components/takeOver.vue
'
))
import
{
ref
,
onMounted
,
reactive
,
computed
,
defineAsyncComponent
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
const
init
=
reactive
({
tabsChange
:
0
})
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
function
tabsChange
(
e
){
console
.
log
(
"
🚀🚀🚀,
"
,
e
)
init
.
tabsChange
=
e
}
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/applicationClaim/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
class=
"role-container"
>
<!-- 左侧角色列表 -->
<div
class=
"role-sidebar"
>
<div
class=
"role-title"
>
申请申领
</div>
<div
class=
"role-list"
>
<div
v-for=
"role in roleList"
:key=
"role.role_type"
:class=
"['role-item',
{ active: currentRole.role_type === role.role_type }]"
@click="handleSelectRole(role)"
>
<div
class=
"role-item-icon"
:class=
"getRoleIconClass(role.role_type)"
>
<Icon
:type=
"role.role_type === 0 ? 'ios-desktop' : 'ios-cube'"
/>
</div>
<div
class=
"role-item-info"
>
<div
class=
"role-name"
>
{{
role
.
role_name
}}
</div>
</div>
</div>
</div>
</div>
<Card
dis-hover
:bordered=
"false"
style=
"width: calc(100% - 300px);height: 100%;"
>
<!-- 右侧人员列表 -->
<component
:is=
"currentRole.role_type == 0 ? Devices : Consumables"
></component>
</Card>
</div>
</
template
>
<
script
setup
>
const
Devices
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/applicationClaim/device
'
))
const
Consumables
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/applicationClaim/consumables
'
))
import
{
ref
,
onMounted
,
reactive
,
computed
,
defineAsyncComponent
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({
role_type
:
0
})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
console
.
log
(
"
role🚀🚀🚀,
"
,
role
)
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/categoryManagement/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<!-- 物资管理 -->
<div>
<div
class=
"demo-split"
>
<Split
v-model=
"split"
>
<template
#left
>
<div
class=
"demo-split-pane-L"
>
<!-- loading -->
<Spin
v-if=
"treePanelLoading"
size=
"large"
fix
></Spin>
<!-- 物资树 -->
<Tree
:data=
"materialsTree"
@
on-select-change=
"treeNodeChange"
></Tree>
</div>
</
template
>
<
template
#right
>
<div
class=
"demo-split-pane-R"
>
<Card
ref=
"card"
>
<!-- 搜索条件 -->
<SearchCondForm
:searchCondList=
"searchCondList"
:labelWidth=
"80"
@
onSubmit=
"search"
@
onReset=
"reset"
></SearchCondForm>
<Button
type=
"primary"
class=
"ivu-ml-8"
:disabled=
"Object.keys(currentTreeNode).length == 0"
@
click=
"add"
><Icon
type=
"md-add"
/>
新增
</Button>
<!-- 数据table -->
<CTable
:tableBorder=
"true"
:tableColumns=
"tableColumns.filter(a => a.show)"
:tableData=
"tableData"
:tableLoading=
"tableLoading"
:tableSize=
"tableSize"
:dataCount=
"dataCount"
:pageIndex=
"params.page_index"
:pageSize=
"params.page_size"
@
switchChange=
"switchChange"
@
rowEdit=
"rowEdit"
@
rowDelete=
"rowDelete"
@
onPageChange=
"onPageChange"
@
onPageSizeChange=
"onPageSizeChange"
></CTable>
<!-- 新增修改Modal -->
<CEditModal
ref=
"ceditmodal"
v-model=
"editModalshow"
:formItem=
"formItem"
:loading=
"editModalLoading"
:formLabelWidth=
"100"
:width=
"800"
@
onClose=
"editModalshow = false"
@
onSubmit=
"modalSubmit"
></CEditModal>
</Card>
</div>
</
template
>
</Split>
</div>
</div>
</template>
<
script
>
import
CTable
from
'
@/components/CTable.vue
'
import
CEditModal
from
'
@/components/CEditModal.vue
'
import
SearchCondForm
from
'
@/components/SearchCondForm.vue
'
export
default
{
name
:
'
list
'
,
components
:
{
CTable
,
CEditModal
,
SearchCondForm
,
},
data
(){
return
{
// 分割版面宽度
split
:
'
250px
'
,
// 树形版面loading
treePanelLoading
:
false
,
// 物资树
materialsTree
:
[],
// 选中树形菜单
currentTreeNode
:
{},
// 场地类型下拉框
placeTypeList
:
[],
// 搜索项
searchCondList
:
[
{
id
:
'
parent_id
'
,
name
:
'
父级id
'
,
type
:
'
input
'
,
show
:
false
,
optList
:
[]
},
{
id
:
'
name
'
,
name
:
'
关键字
'
,
type
:
'
input
'
,
show
:
true
,
optList
:
[]
},
],
// 搜索条件
params
:{
page_index
:
1
,
page_size
:
10
,
parent_id
:
'
1
'
,
name
:
''
,
},
tableColumns
:[
{
type
:
'
index
'
,
title
:
'
序号
'
,
align
:
'
center
'
,
width
:
80
,
show
:
true
,
fixed
:
'
left
'
},
{
key
:
'
commodity_name
'
,
title
:
'
物资名称
'
,
align
:
'
center
'
,
minWidth
:
150
,
show
:
true
},
{
key
:
'
parent_id
'
,
title
:
'
父级id
'
,
align
:
'
center
'
,
minWidth
:
300
,
show
:
false
},
{
key
:
'
place_type_id
'
,
title
:
'
场地类型id
'
,
align
:
'
center
'
,
minWidth
:
150
,
show
:
false
},
{
key
:
'
place_type_name
'
,
title
:
'
场地类型
'
,
align
:
'
center
'
,
minWidth
:
150
,
show
:
true
},
{
key
:
'
file_id
'
,
title
:
'
附件id
'
,
align
:
'
center
'
,
minWidth
:
150
,
show
:
false
},
// { key: 'is_enable', title: '启用', align: 'center', minWidth: 80, show: true },
{
slot
:
'
generalSwitch
'
,
title
:
'
启用
'
,
align
:
'
center
'
,
minWidth
:
80
,
show
:
true
},
{
slot
:
'
action
'
,
title
:
'
操作
'
,
align
:
'
center
'
,
minWidth
:
150
,
show
:
true
,
fixed
:
'
right
'
},
],
tableLoading
:
false
,
tableData
:[],
tableSize
:
'
default
'
,
tableFullscreen
:
false
,
dataCount
:
0
,
collapse
:
false
,
editModalshow
:
false
,
editModalLoading
:
false
,
// 是否编辑 true.编辑 false.新增
isEdit
:
false
,
// 新增编辑表单项
formItem
:
[
{
id
:
'
commodity_name
'
,
name
:
'
物资名称
'
,
type
:
'
input
'
,
disabled
:
false
,
require
:
false
,
optList
:
[]
},
{
id
:
'
place_type_id
'
,
name
:
'
场地类型
'
,
type
:
'
select
'
,
disabled
:
false
,
require
:
false
,
optList
:
[]
},
{
id
:
'
parent_label
'
,
name
:
'
父级
'
,
type
:
'
input
'
,
disabled
:
true
,
require
:
false
,
optList
:
[]
},
// { id: 'file_id', name: '附件', type: 'file', disabled: false, require: false, optList: [] },
{
id
:
'
file_list
'
,
name
:
'
附件
'
,
type
:
'
file
'
,
disabled
:
false
,
require
:
false
,
optList
:
[]
},
{
id
:
'
is_enable
'
,
name
:
'
启用
'
,
type
:
'
switch
'
,
disabled
:
false
,
require
:
false
,
optList
:
[]
},
],
defaultFormData
:
{
id
:
""
,
commodity_name
:
""
,
parent_id
:
""
,
place_type_id
:
""
,
place_type_name
:
""
,
is_enable
:
1
,
is_del
:
0
,
createby
:
""
,
createtime
:
""
,
modifyby
:
null
,
modify_time
:
null
,
file_list
:
[]
},
}
},
// 查询条件初始化
created
(){},
mounted
(){
// 获取物资树
this
.
getTreeData
()
this
.
getData
()
},
methods
:
{
// 获取物资树
async
getTreeData
()
{
this
.
treePanelLoading
=
true
this
.
currentTreeNode
=
{}
this
.
materialsTree
=
this
.
treeFormat
([
{
"
id
"
:
"
1
"
,
"
commodity_name
"
:
"
物资
"
,
"
parent_id
"
:
"
0
"
,
"
place_type_id
"
:
null
,
"
place_type_name
"
:
null
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2023-12-26 18:18
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
2
"
,
"
commodity_name
"
:
"
共享厨房物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2023-12-29 17:50
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
21
"
,
"
commodity_name
"
:
"
共享厨房-锅
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
"
584488c0-6f43-40c5-8592-b5b9378d5d63
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2023-12-29 17:51
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-09 10:04
"
,
"
children
"
:
[
{
"
id
"
:
"
2103
"
,
"
commodity_name
"
:
"
共享厨房-铲
"
,
"
parent_id
"
:
"
21
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 14:33
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
210301
"
,
"
commodity_name
"
:
"
共享厨房-九九九
"
,
"
parent_id
"
:
"
2103
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-07-01 09:22
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
]
},
{
"
id
"
:
"
22
"
,
"
commodity_name
"
:
"
共享厨房-碗
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
"
b31f7f4e-d45e-4b74-99d5-848c0c1b55f4
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-04 17:14
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-09 14:30
"
,
"
children
"
:
[
{
"
id
"
:
"
2201
"
,
"
commodity_name
"
:
"
共享厨房-碗筷
"
,
"
parent_id
"
:
"
22
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 15:59
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
23
"
,
"
commodity_name
"
:
"
共享厨房-瓢
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:35
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
24
"
,
"
commodity_name
"
:
"
共享厨房-盆
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:44
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
26
"
,
"
commodity_name
"
:
"
共享厨房-盐
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:53
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-11 14:28
"
,
"
children
"
:
[]
},
{
"
id
"
:
"
25
"
,
"
commodity_name
"
:
"
共享厨房-油
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:53
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
2502
"
,
"
commodity_name
"
:
"
共享厨房-1111
"
,
"
parent_id
"
:
"
25
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-07-01 09:21
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
]
},
{
"
id
"
:
"
3
"
,
"
commodity_name
"
:
"
自习室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
9a1fe943-fbef-4cfe-a15c-ee52f8bfd432
"
,
"
place_type_name
"
:
"
自习室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-02 11:43
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
301
"
,
"
commodity_name
"
:
"
自习室-椅子
"
,
"
parent_id
"
:
"
3
"
,
"
place_type_id
"
:
"
9a1fe943-fbef-4cfe-a15c-ee52f8bfd432
"
,
"
place_type_name
"
:
"
自习室
"
,
"
file_id
"
:
"
1ae63c46-83da-4476-9366-094efd23a51c
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-02 11:44
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-09 14:42
"
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
4
"
,
"
commodity_name
"
:
"
传统文化活动室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
a2187805-0baa-4fea-adf2-de8e953ecd08
"
,
"
place_type_name
"
:
"
传统文化活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-02 11:49
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
401
"
,
"
commodity_name
"
:
"
传统文化活动室-羽毛球
"
,
"
parent_id
"
:
"
4
"
,
"
place_type_id
"
:
"
a2187805-0baa-4fea-adf2-de8e953ecd08
"
,
"
place_type_name
"
:
"
传统文化活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
string
"
,
"
createtime
"
:
"
2024-01-02 03:49
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-02 11:50
"
,
"
children
"
:
[]
},
{
"
id
"
:
"
402
"
,
"
commodity_name
"
:
"
传统文化活动室-棒球棒
"
,
"
parent_id
"
:
"
4
"
,
"
place_type_id
"
:
"
a2187805-0baa-4fea-adf2-de8e953ecd08
"
,
"
place_type_name
"
:
"
传统文化活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
403
"
,
"
commodity_name
"
:
"
传统文化活动室-棒球
"
,
"
parent_id
"
:
"
4
"
,
"
place_type_id
"
:
"
a2187805-0baa-4fea-adf2-de8e953ecd08
"
,
"
place_type_name
"
:
"
传统文化活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
5
"
,
"
commodity_name
"
:
"
活动教室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
74bf1f85-5e22-447d-8a52-50798da5111b
"
,
"
place_type_name
"
:
"
活动教室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:46
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-09 14:47
"
,
"
children
"
:
[
{
"
id
"
:
"
501
"
,
"
commodity_name
"
:
"
活动教室-钢琴
"
,
"
parent_id
"
:
"
5
"
,
"
place_type_id
"
:
"
74bf1f85-5e22-447d-8a52-50798da5111b
"
,
"
place_type_name
"
:
"
活动教室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:47
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
502
"
,
"
commodity_name
"
:
"
活动教室-架子鼓
"
,
"
parent_id
"
:
"
5
"
,
"
place_type_id
"
:
"
74bf1f85-5e22-447d-8a52-50798da5111b
"
,
"
place_type_name
"
:
"
活动教室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:48
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
6
"
,
"
commodity_name
"
:
"
学生成长辅导室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
"
be788232-6e4d-4ebe-90de-0b175c268d2f
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 10:50
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
601
"
,
"
commodity_name
"
:
"
学生成长辅导室-椅子
"
,
"
parent_id
"
:
"
6
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
"
f2f1636a-4633-42bf-9312-49776d5d1dae
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 10:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
60101
"
,
"
commodity_name
"
:
"
学生成长辅导室-椅把
"
,
"
parent_id
"
:
"
601
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 10:54
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
602
"
,
"
commodity_name
"
:
"
学生成长辅导室-板凳
"
,
"
parent_id
"
:
"
6
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 10:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
603
"
,
"
commodity_name
"
:
"
学生成长辅导室-心理老师
"
,
"
parent_id
"
:
"
6
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 14:22
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
60301
"
,
"
commodity_name
"
:
"
学生成长辅导室-心理助理
"
,
"
parent_id
"
:
"
603
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 14:22
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
]
},
{
"
id
"
:
"
8
"
,
"
commodity_name
"
:
"
球类
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
804350dd-39ea-4293-8c09-836c3e97e001
"
,
"
place_type_name
"
:
"
活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:02
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
801
"
,
"
commodity_name
"
:
"
活动室-篮球
"
,
"
parent_id
"
:
"
8
"
,
"
place_type_id
"
:
"
804350dd-39ea-4293-8c09-836c3e97e001
"
,
"
place_type_name
"
:
"
活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:02
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
802
"
,
"
commodity_name
"
:
"
活动室-足球
"
,
"
parent_id
"
:
"
8
"
,
"
place_type_id
"
:
"
804350dd-39ea-4293-8c09-836c3e97e001
"
,
"
place_type_name
"
:
"
活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:02
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
9
"
,
"
commodity_name
"
:
"
体育室
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:44
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
901
"
,
"
commodity_name
"
:
"
体育室-球类
"
,
"
parent_id
"
:
"
9
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:44
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
90101
"
,
"
commodity_name
"
:
"
体育室-篮球
"
,
"
parent_id
"
:
"
901
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:45
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
90102
"
,
"
commodity_name
"
:
"
体育室-足球
"
,
"
parent_id
"
:
"
901
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:45
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
90103
"
,
"
commodity_name
"
:
"
体育室-乒乓球
"
,
"
parent_id
"
:
"
901
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 09:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
]
},
{
"
id
"
:
"
10
"
,
"
commodity_name
"
:
"
图书类
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
3b54c062-6861-4054-a91f-4204bc424ed7
"
,
"
place_type_name
"
:
"
阅读室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 14:16
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
1001
"
,
"
commodity_name
"
:
"
阅读室-三年高考两年难受
"
,
"
parent_id
"
:
"
10
"
,
"
place_type_id
"
:
"
3b54c062-6861-4054-a91f-4204bc424ed7
"
,
"
place_type_name
"
:
"
阅读室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 14:16
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
100101
"
,
"
commodity_name
"
:
"
阅读室-习题
"
,
"
parent_id
"
:
"
1001
"
,
"
place_type_id
"
:
"
3b54c062-6861-4054-a91f-4204bc424ed7
"
,
"
place_type_name
"
:
"
阅读室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 14:17
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
1002
"
,
"
commodity_name
"
:
"
阅读室-水浒传
"
,
"
parent_id
"
:
"
10
"
,
"
place_type_id
"
:
"
3b54c062-6861-4054-a91f-4204bc424ed7
"
,
"
place_type_name
"
:
"
阅读室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 14:16
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
11
"
,
"
commodity_name
"
:
"
预览
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
c9617ca5-0b60-400f-bf64-6f7558bdbea2
"
,
"
place_type_name
"
:
"
预览室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-16 09:06
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
1101
"
,
"
commodity_name
"
:
"
预览室-图书
"
,
"
parent_id
"
:
"
11
"
,
"
place_type_id
"
:
"
c9617ca5-0b60-400f-bf64-6f7558bdbea2
"
,
"
place_type_name
"
:
"
预览室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-16 09:06
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
110101
"
,
"
commodity_name
"
:
"
预览室-童话世界
"
,
"
parent_id
"
:
"
1101
"
,
"
place_type_id
"
:
"
c9617ca5-0b60-400f-bf64-6f7558bdbea2
"
,
"
place_type_name
"
:
"
预览室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-16 09:06
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
1102
"
,
"
commodity_name
"
:
"
预览室-测试
"
,
"
parent_id
"
:
"
11
"
,
"
place_type_id
"
:
"
c9617ca5-0b60-400f-bf64-6f7558bdbea2
"
,
"
place_type_name
"
:
"
预览室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-05-11 15:15
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
12
"
,
"
commodity_name
"
:
"
分支
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-07-01 09:21
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
])
this
.
treePanelLoading
=
false
return
this
.
asc
.
getApiCommodityGetCommodityTreeByPc
().
then
(
res
=>
{
// console.log('物资树', res)
this
.
materialsTree
=
this
.
treeFormat
([
{
"
id
"
:
"
1
"
,
"
commodity_name
"
:
"
物资
"
,
"
parent_id
"
:
"
0
"
,
"
place_type_id
"
:
null
,
"
place_type_name
"
:
null
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2023-12-26 18:18
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
2
"
,
"
commodity_name
"
:
"
共享厨房物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2023-12-29 17:50
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
21
"
,
"
commodity_name
"
:
"
共享厨房-锅
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
"
584488c0-6f43-40c5-8592-b5b9378d5d63
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2023-12-29 17:51
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-09 10:04
"
,
"
children
"
:
[
{
"
id
"
:
"
2103
"
,
"
commodity_name
"
:
"
共享厨房-铲
"
,
"
parent_id
"
:
"
21
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 14:33
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
210301
"
,
"
commodity_name
"
:
"
共享厨房-九九九
"
,
"
parent_id
"
:
"
2103
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-07-01 09:22
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
]
},
{
"
id
"
:
"
22
"
,
"
commodity_name
"
:
"
共享厨房-碗
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
"
b31f7f4e-d45e-4b74-99d5-848c0c1b55f4
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-04 17:14
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-09 14:30
"
,
"
children
"
:
[
{
"
id
"
:
"
2201
"
,
"
commodity_name
"
:
"
共享厨房-碗筷
"
,
"
parent_id
"
:
"
22
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 15:59
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
23
"
,
"
commodity_name
"
:
"
共享厨房-瓢
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:35
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
24
"
,
"
commodity_name
"
:
"
共享厨房-盆
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:44
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
26
"
,
"
commodity_name
"
:
"
共享厨房-盐
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:53
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-11 14:28
"
,
"
children
"
:
[]
},
{
"
id
"
:
"
25
"
,
"
commodity_name
"
:
"
共享厨房-油
"
,
"
parent_id
"
:
"
2
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:53
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
2502
"
,
"
commodity_name
"
:
"
共享厨房-1111
"
,
"
parent_id
"
:
"
25
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-07-01 09:21
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
]
},
{
"
id
"
:
"
3
"
,
"
commodity_name
"
:
"
自习室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
9a1fe943-fbef-4cfe-a15c-ee52f8bfd432
"
,
"
place_type_name
"
:
"
自习室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-02 11:43
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
301
"
,
"
commodity_name
"
:
"
自习室-椅子
"
,
"
parent_id
"
:
"
3
"
,
"
place_type_id
"
:
"
9a1fe943-fbef-4cfe-a15c-ee52f8bfd432
"
,
"
place_type_name
"
:
"
自习室
"
,
"
file_id
"
:
"
1ae63c46-83da-4476-9366-094efd23a51c
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-02 11:44
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-09 14:42
"
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
4
"
,
"
commodity_name
"
:
"
传统文化活动室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
a2187805-0baa-4fea-adf2-de8e953ecd08
"
,
"
place_type_name
"
:
"
传统文化活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-02 11:49
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
401
"
,
"
commodity_name
"
:
"
传统文化活动室-羽毛球
"
,
"
parent_id
"
:
"
4
"
,
"
place_type_id
"
:
"
a2187805-0baa-4fea-adf2-de8e953ecd08
"
,
"
place_type_name
"
:
"
传统文化活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
string
"
,
"
createtime
"
:
"
2024-01-02 03:49
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-02 11:50
"
,
"
children
"
:
[]
},
{
"
id
"
:
"
402
"
,
"
commodity_name
"
:
"
传统文化活动室-棒球棒
"
,
"
parent_id
"
:
"
4
"
,
"
place_type_id
"
:
"
a2187805-0baa-4fea-adf2-de8e953ecd08
"
,
"
place_type_name
"
:
"
传统文化活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
403
"
,
"
commodity_name
"
:
"
传统文化活动室-棒球
"
,
"
parent_id
"
:
"
4
"
,
"
place_type_id
"
:
"
a2187805-0baa-4fea-adf2-de8e953ecd08
"
,
"
place_type_name
"
:
"
传统文化活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
5
"
,
"
commodity_name
"
:
"
活动教室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
74bf1f85-5e22-447d-8a52-50798da5111b
"
,
"
place_type_name
"
:
"
活动教室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:46
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-09 14:47
"
,
"
children
"
:
[
{
"
id
"
:
"
501
"
,
"
commodity_name
"
:
"
活动教室-钢琴
"
,
"
parent_id
"
:
"
5
"
,
"
place_type_id
"
:
"
74bf1f85-5e22-447d-8a52-50798da5111b
"
,
"
place_type_name
"
:
"
活动教室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:47
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
502
"
,
"
commodity_name
"
:
"
活动教室-架子鼓
"
,
"
parent_id
"
:
"
5
"
,
"
place_type_id
"
:
"
74bf1f85-5e22-447d-8a52-50798da5111b
"
,
"
place_type_name
"
:
"
活动教室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:48
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
6
"
,
"
commodity_name
"
:
"
学生成长辅导室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
"
be788232-6e4d-4ebe-90de-0b175c268d2f
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 10:50
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
601
"
,
"
commodity_name
"
:
"
学生成长辅导室-椅子
"
,
"
parent_id
"
:
"
6
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
"
f2f1636a-4633-42bf-9312-49776d5d1dae
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 10:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
60101
"
,
"
commodity_name
"
:
"
学生成长辅导室-椅把
"
,
"
parent_id
"
:
"
601
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 10:54
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
602
"
,
"
commodity_name
"
:
"
学生成长辅导室-板凳
"
,
"
parent_id
"
:
"
6
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 10:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
603
"
,
"
commodity_name
"
:
"
学生成长辅导室-心理老师
"
,
"
parent_id
"
:
"
6
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 14:22
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
60301
"
,
"
commodity_name
"
:
"
学生成长辅导室-心理助理
"
,
"
parent_id
"
:
"
603
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 14:22
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
]
},
{
"
id
"
:
"
8
"
,
"
commodity_name
"
:
"
球类
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
804350dd-39ea-4293-8c09-836c3e97e001
"
,
"
place_type_name
"
:
"
活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:02
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
801
"
,
"
commodity_name
"
:
"
活动室-篮球
"
,
"
parent_id
"
:
"
8
"
,
"
place_type_id
"
:
"
804350dd-39ea-4293-8c09-836c3e97e001
"
,
"
place_type_name
"
:
"
活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:02
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
802
"
,
"
commodity_name
"
:
"
活动室-足球
"
,
"
parent_id
"
:
"
8
"
,
"
place_type_id
"
:
"
804350dd-39ea-4293-8c09-836c3e97e001
"
,
"
place_type_name
"
:
"
活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:02
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
9
"
,
"
commodity_name
"
:
"
体育室
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:44
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
901
"
,
"
commodity_name
"
:
"
体育室-球类
"
,
"
parent_id
"
:
"
9
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:44
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
90101
"
,
"
commodity_name
"
:
"
体育室-篮球
"
,
"
parent_id
"
:
"
901
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:45
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
90102
"
,
"
commodity_name
"
:
"
体育室-足球
"
,
"
parent_id
"
:
"
901
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:45
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
},
{
"
id
"
:
"
90103
"
,
"
commodity_name
"
:
"
体育室-乒乓球
"
,
"
parent_id
"
:
"
901
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 09:52
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
]
},
{
"
id
"
:
"
10
"
,
"
commodity_name
"
:
"
图书类
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
3b54c062-6861-4054-a91f-4204bc424ed7
"
,
"
place_type_name
"
:
"
阅读室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 14:16
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
1001
"
,
"
commodity_name
"
:
"
阅读室-三年高考两年难受
"
,
"
parent_id
"
:
"
10
"
,
"
place_type_id
"
:
"
3b54c062-6861-4054-a91f-4204bc424ed7
"
,
"
place_type_name
"
:
"
阅读室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 14:16
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
100101
"
,
"
commodity_name
"
:
"
阅读室-习题
"
,
"
parent_id
"
:
"
1001
"
,
"
place_type_id
"
:
"
3b54c062-6861-4054-a91f-4204bc424ed7
"
,
"
place_type_name
"
:
"
阅读室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 14:17
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
1002
"
,
"
commodity_name
"
:
"
阅读室-水浒传
"
,
"
parent_id
"
:
"
10
"
,
"
place_type_id
"
:
"
3b54c062-6861-4054-a91f-4204bc424ed7
"
,
"
place_type_name
"
:
"
阅读室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 14:16
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
11
"
,
"
commodity_name
"
:
"
预览
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
c9617ca5-0b60-400f-bf64-6f7558bdbea2
"
,
"
place_type_name
"
:
"
预览室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-16 09:06
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
1101
"
,
"
commodity_name
"
:
"
预览室-图书
"
,
"
parent_id
"
:
"
11
"
,
"
place_type_id
"
:
"
c9617ca5-0b60-400f-bf64-6f7558bdbea2
"
,
"
place_type_name
"
:
"
预览室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-16 09:06
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[
{
"
id
"
:
"
110101
"
,
"
commodity_name
"
:
"
预览室-童话世界
"
,
"
parent_id
"
:
"
1101
"
,
"
place_type_id
"
:
"
c9617ca5-0b60-400f-bf64-6f7558bdbea2
"
,
"
place_type_name
"
:
"
预览室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-16 09:06
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
1102
"
,
"
commodity_name
"
:
"
预览室-测试
"
,
"
parent_id
"
:
"
11
"
,
"
place_type_id
"
:
"
c9617ca5-0b60-400f-bf64-6f7558bdbea2
"
,
"
place_type_name
"
:
"
预览室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-05-11 15:15
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
},
{
"
id
"
:
"
12
"
,
"
commodity_name
"
:
"
分支
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-07-01 09:21
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
[]
}
]
}
])
this
.
treePanelLoading
=
false
})
},
// 树形节点改变
treeNodeChange
(
val1
,
val2
)
{
// console.log('树形节点改变', val1, val2)
// 展开物资树
val2
.
expand
=
true
// 选中 / 取消节点
if
(
!
val2
.
selected
)
{
this
.
currentTreeNode
=
{}
this
.
params
.
parent_id
=
'
1
'
}
else
{
this
.
currentTreeNode
=
val2
this
.
params
.
parent_id
=
val2
.
id
}
this
.
getData
()
},
// 搜索
search
(
val
)
{
Object
.
keys
(
val
).
forEach
(
a
=>
{
if
(
val
[
a
])
{
this
.
params
[
a
]
=
val
[
a
]
}
else
{
this
.
params
[
a
]
=
''
}
})
this
.
onPageChange
(
1
)
},
// 重置
reset
()
{
this
.
searchCondList
.
forEach
(
a
=>
{
if
(
a
.
id
==
'
parent_id
'
)
{
this
.
params
[
a
.
id
]
=
'
1
'
}
else
{
this
.
params
[
a
.
id
]
=
''
}
})
this
.
currentTreeNode
.
selected
=
false
this
.
currentTreeNode
=
{}
this
.
onPageChange
(
1
)
},
// 查询列表
getData
(){
this
.
tableLoading
=
true
this
.
tableData
=
[
{
"
id
"
:
"
2
"
,
"
commodity_name
"
:
"
共享厨房物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2023-12-29 17:50
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
null
},
{
"
id
"
:
"
3
"
,
"
commodity_name
"
:
"
自习室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
9a1fe943-fbef-4cfe-a15c-ee52f8bfd432
"
,
"
place_type_name
"
:
"
自习室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-02 11:43
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
null
},
{
"
id
"
:
"
4
"
,
"
commodity_name
"
:
"
传统文化活动室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
a2187805-0baa-4fea-adf2-de8e953ecd08
"
,
"
place_type_name
"
:
"
传统文化活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-02 11:49
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
null
},
{
"
id
"
:
"
5
"
,
"
commodity_name
"
:
"
活动教室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
74bf1f85-5e22-447d-8a52-50798da5111b
"
,
"
place_type_name
"
:
"
活动教室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-09 14:46
"
,
"
modifyby
"
:
"
asc666
"
,
"
modify_time
"
:
"
2024-01-09 14:47
"
,
"
children
"
:
null
},
{
"
id
"
:
"
6
"
,
"
commodity_name
"
:
"
学生成长辅导室物资
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
94a95d39-ab93-49b5-976b-3186f3be6b46
"
,
"
place_type_name
"
:
"
学生成长辅导室
"
,
"
file_id
"
:
"
be788232-6e4d-4ebe-90de-0b175c268d2f
"
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-11 10:50
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
null
},
{
"
id
"
:
"
8
"
,
"
commodity_name
"
:
"
球类
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
804350dd-39ea-4293-8c09-836c3e97e001
"
,
"
place_type_name
"
:
"
活动室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:02
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
null
},
{
"
id
"
:
"
9
"
,
"
commodity_name
"
:
"
体育室
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
6f2622ca-a8a2-4c2d-b476-1b6ba99a0919
"
,
"
place_type_name
"
:
"
体育室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-12 16:44
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
null
},
{
"
id
"
:
"
10
"
,
"
commodity_name
"
:
"
图书类
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
3b54c062-6861-4054-a91f-4204bc424ed7
"
,
"
place_type_name
"
:
"
阅读室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-15 14:16
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
null
},
{
"
id
"
:
"
11
"
,
"
commodity_name
"
:
"
预览
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
c9617ca5-0b60-400f-bf64-6f7558bdbea2
"
,
"
place_type_name
"
:
"
预览室
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-01-16 09:06
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
null
},
{
"
id
"
:
"
12
"
,
"
commodity_name
"
:
"
分支
"
,
"
parent_id
"
:
"
1
"
,
"
place_type_id
"
:
"
d7d4da8b-8689-4dfa-a1c7-4c0adeb8f0da
"
,
"
place_type_name
"
:
"
共享厨房
"
,
"
file_id
"
:
null
,
"
is_enable
"
:
1
,
"
is_del
"
:
0
,
"
createby
"
:
"
asc666
"
,
"
createtime
"
:
"
2024-07-01 09:21
"
,
"
modifyby
"
:
null
,
"
modify_time
"
:
null
,
"
children
"
:
null
}
]
this
.
dataCount
=
this
.
tableData
.
length
this
.
tableLoading
=
false
return
this
.
asc
.
getApiCommodityGetCommodityList
(
this
.
params
).
then
(
res
=>
{
// console.log('查询数据', res)
this
.
tableData
=
res
.
response
.
data
this
.
dataCount
=
res
.
response
.
data_count
this
.
tableLoading
=
false
})
},
// 改变开关
switchChange
(
val
,
row
,
index
)
{
// console.log('改变开关', val, row, index)
this
.
tableData
[
index
].
is_enable
=
val
this
.
asc
.
getApiCommodityCommodityEnable
({
id
:
row
.
id
,
is_enable
:
val
}).
then
(
res
=>
{
// console.log('改变开关结果', res)
if
(
res
.
code
==
1
)
{
this
.
$Message
.
success
(
res
.
response
)
}
else
{
this
.
tableData
[
index
].
is_enable
=
val
==
0
?
1
:
0
this
.
$Message
.
error
(
res
.
msg_detail
)
}
})
},
// 新增
add
(){
this
.
editModalshow
=
true
this
.
isEdit
=
false
// selectFlag: true.树形选中节点 false.树形没选中节点
let
selectFlag
=
Object
.
keys
(
this
.
currentTreeNode
).
length
!=
0
this
.
defaultFormData
.
parent_label
=
selectFlag
?
this
.
currentTreeNode
.
title
:
"
物资
"
if
(
selectFlag
&&
this
.
currentTreeNode
.
id
==
'
1
'
)
{
// 根节点时,选择场地类型开放选择
this
.
formItem
[
this
.
formItem
.
findIndex
(
a
=>
a
.
id
==
'
place_type_id
'
)].
disabled
=
false
}
else
{
this
.
formItem
[
this
.
formItem
.
findIndex
(
a
=>
a
.
id
==
'
place_type_id
'
)].
disabled
=
true
this
.
defaultFormData
.
place_type_id
=
this
.
currentTreeNode
.
place_type_id
}
this
.
$refs
.
ceditmodal
.
modalInit
(
'
add
'
,
this
.
defaultFormData
,
'
新增物资
'
)
},
// 编辑
rowEdit
(
row
){
// console.log('编辑行', row)
this
.
editModalshow
=
true
this
.
isEdit
=
true
this
.
editModalLoading
=
true
this
.
formItem
[
this
.
formItem
.
findIndex
(
a
=>
a
.
id
==
'
place_type_id
'
)].
disabled
=
true
this
.
asc
.
getApiCommodityGetCommodityInfo
({
id
:
row
.
id
}).
then
(
res
=>
{
// console.log('编辑详情', res)
let
ti
=
res
.
response
.
commodity_name
.
indexOf
(
'
-
'
)
if
(
ti
!=
-
1
)
{
res
.
response
.
commodity_name
=
res
.
response
.
commodity_name
.
slice
(
ti
+
1
)
}
// selectFlag: true.树形选中节点 false.树形没选中节点
let
selectFlag
=
Object
.
keys
(
this
.
currentTreeNode
).
length
!=
0
res
.
response
.
parent_label
=
selectFlag
?
this
.
currentTreeNode
.
title
:
"
物资
"
this
.
$refs
.
ceditmodal
.
modalInit
(
'
edit
'
,
res
.
response
)
this
.
editModalLoading
=
false
})
},
// 新增编辑提交
modalSubmit
(
val
)
{
// console.log('modal提交', val)
// selectFlag: true.树形选中节点 false.树形没选中节点
let
selectFlag
=
Object
.
keys
(
this
.
currentTreeNode
).
length
!=
0
val
.
parent_id
=
selectFlag
?
this
.
currentTreeNode
.
id
:
"
1
"
this
.
$Modal
.
confirm
({
title
:
'
提示
'
,
content
:
'
是否确定提交?
'
,
loading
:
true
,
onOk
:
async
()
=>
{
let
idObj
=
null
// 新增时获取新增id
if
(
!
this
.
isEdit
)
{
idObj
=
await
this
.
asc
.
getApiCommodityGetCommodityIdAndCode
({
parent_id
:
val
.
parent_id
})
if
(
idObj
.
code
!=
1
)
{
this
.
$Message
.
error
(
idObj
.
msg_detail
)
this
.
$Modal
.
remove
()
return
}
val
.
id
=
idObj
.
response
}
const
res
=
this
.
isEdit
?
await
this
.
asc
.
postApiCommodityCommoditySave
(
val
)
:
await
this
.
asc
.
postApiCommodityCommodityIns
(
val
)
// console.log('保存信息', res)
if
(
res
.
code
==
1
)
{
this
.
$Message
.
success
(
res
.
response
)
this
.
editModalshow
=
false
this
.
getData
()
this
.
getTreeData
()
}
else
{
this
.
$Message
.
error
(
res
.
msg_detail
)
}
this
.
$Modal
.
remove
()
}
})
},
// 删除
rowDelete
(
row
)
{
// console.log('删除', row);
this
.
asc
.
getApiCommodityCommodityDel
({
id
:
row
.
id
,
is_del
:
1
}).
then
(
res
=>
{
// console.log('删除行后', res)
if
(
res
.
code
==
1
)
{
this
.
$Message
.
success
(
res
.
msg
)
this
.
getData
()
this
.
getTreeData
()
}
else
{
this
.
$Message
.
error
(
res
.
msg_detail
)
}
})
},
// 更改页码
onPageChange
(
val
)
{
this
.
params
.
page_index
=
val
this
.
getData
()
},
// 更改每页条数
onPageSizeChange
(
val
){
this
.
params
.
page_size
=
val
if
(
this
.
params
.
page_index
==
1
)
{
this
.
onPageChange
(
1
)
}
},
// 物资树格式化
treeFormat
(
arr
)
{
return
arr
.
map
(
a
=>
{
if
(
a
.
children
&&
a
.
children
.
length
!=
0
)
{
a
.
children
=
this
.
treeFormat
(
a
.
children
)
}
return
{
...
a
,
title
:
a
.
commodity_name
,
expand
:
a
.
id
==
'
1
'
?
true
:
false
,
selected
:
false
,
}
})
},
}
}
</
script
>
<
style
scoped
lang=
"less"
>
.demo-split{
height: calc(~"100vh - 112px");
.demo-split-pane-L{
padding: 10px;
height: 100%;
background-color: white;
}
.demo-split-pane-R{
padding-left: 24px;
}
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/consumablesManagement/components/inbound.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</div>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/consumablesManagement/components/inventory.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</div>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/consumablesManagement/components/outbound.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</div>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/consumablesManagement/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
dis
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<Card
class=
"role-content"
>
<Tabs
style=
"width: 100%;"
type=
"card"
@
on-click=
"tabsChange"
>
<TabPane
label=
"耗材库存"
style=
"width: 100%;height: 100%;"
>
</TabPane>
<TabPane
label=
"入库记录"
style=
"height: 100%;width: 100%;"
>
</TabPane>
<TabPane
label=
"出库记录"
style=
"height: 100%;width: 100%;"
>
</TabPane>
</Tabs>
<component
v-if=
"init.tabsChange== 0"
:is=
"Inventory"
></component>
<component
v-else-if=
"init.tabsChange== 1"
:is=
"Inbound"
></component>
<component
v-else
:is=
"Outbound"
></component>
</Card>
</div>
</
template
>
<
script
setup
>
const
Outbound
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/consumablesManagement/components/outbound.vue
'
))
const
Inbound
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/consumablesManagement/components/inbound.vue
'
))
const
Inventory
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/consumablesManagement/components/inventory.vue
'
))
import
{
ref
,
onMounted
,
reactive
,
computed
,
defineAsyncComponent
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
const
init
=
reactive
({
tabsChange
:
0
})
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
function
tabsChange
(
e
){
console
.
log
(
"
🚀🚀🚀,
"
,
e
)
init
.
tabsChange
=
e
}
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/equipmentManagement/components/inbound.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</div>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/equipmentManagement/components/inventory.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</div>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/equipmentManagement/components/outbound.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</div>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/equipmentManagement/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
dis
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<Card
class=
"role-content"
>
<Tabs
style=
"width: 100%;"
type=
"card"
@
on-click=
"tabsChange"
>
<TabPane
label=
"设备库存"
style=
"width: 100%;height: 100%;"
>
</TabPane>
<TabPane
label=
"入库记录"
style=
"height: 100%;width: 100%;"
>
</TabPane>
<TabPane
label=
"出库记录"
style=
"height: 100%;width: 100%;"
>
</TabPane>
</Tabs>
<component
v-if=
"init.tabsChange== 0"
:is=
"Inventory"
></component>
<component
v-else-if=
"init.tabsChange== 1"
:is=
"Inbound"
></component>
<component
v-else
:is=
"Outbound"
></component>
</Card>
</div>
</
template
>
<
script
setup
>
const
Outbound
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/equipmentManagement/components/outbound.vue
'
))
const
Inbound
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/equipmentManagement/components/inbound.vue
'
))
const
Inventory
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/equipmentManagement/components/inventory.vue
'
))
import
{
ref
,
onMounted
,
reactive
,
computed
,
defineAsyncComponent
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
const
init
=
reactive
({
tabsChange
:
0
})
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
function
tabsChange
(
e
){
console
.
log
(
"
🚀🚀🚀,
"
,
e
)
init
.
tabsChange
=
e
}
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/messagePushTemplate/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div>
<Card
dis-hover
:bordered=
"false"
>
<!-- 搜索区域 -->
<initForm
ref=
"searchFormRef"
:searchCondList=
"searchList"
@
on-submit=
"handleSearch"
@
on-reset=
"handleReset"
>
</initForm>
<!-- 表格工具栏 -->
<div
class=
"operation-bar"
>
<Button
type=
"primary"
@
click=
"handleAdd"
>
添加任务
</Button>
<Button
class=
"ivu-ml-8"
@
click=
"handleImport"
>
导入任务
</Button>
<!--
<Button
class=
"ivu-ml-8"
@
click=
"handleExport"
>
导出任务
</Button>
-->
<Button
class=
"ivu-ml-8"
@
click=
"handleDownloadTemplate"
:loading=
"downloadLoading"
>
下载模板
</Button>
</div>
<!-- 表格 -->
<initTable
ref=
"tableRef"
class=
"ivu-mt"
:tableLoading=
"loading"
:tableColumns=
"columns"
:tableData=
"tableData"
:dataCount=
"total"
:pageIndex=
"pageIndex"
:pageSize=
"pageSize"
@
on-page-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
>
<!-- 状态列 -->
<template
#finish_status
="
{ row }">
<Tag
v-if=
"row.finish_status === 0"
color=
"default"
>
未完成
</Tag>
<Tag
v-else-if=
"row.finish_status === 1"
color=
"success"
>
已完成
</Tag>
<Tag
v-else
color=
"default"
>
{{
row
.
finish_status
||
'
-
'
}}
</Tag>
</
template
>
<
template
#audit_status
="{
row
}"
>
<Tag
v-if=
"row.audit_status === 0"
color=
"default"
>
暂存
</Tag>
<Tag
v-else-if=
"row.audit_status === 1"
color=
"primary"
>
审批中
</Tag>
<Tag
v-else-if=
"row.audit_status === 2"
color=
"success"
>
审批通过
</Tag>
<Tag
v-else-if=
"row.audit_status === -1"
color=
"error"
>
不通过
</Tag>
<Tag
v-else
color=
"default"
>
{{
row
.
audit_status
||
'
-
'
}}
</Tag>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
@
click
.
stop
.
prevent
>
<a
type=
"text"
style=
"color: #2D8cF0"
@
click=
"handleDetail(row)"
>
查看
</a>
<Divider
type=
"vertical"
/>
<a
type=
"text"
style=
"color: #2D8cF0"
@
click=
"handleEdit(row)"
>
编辑
</a>
<Divider
type=
"vertical"
/>
<a
type=
"text"
style=
"color: #ed4014"
@
click=
"handleDelete(row)"
>
删除
</a>
</div>
</
template
>
</initTable>
</Card>
<!-- 任务详情/编辑对话框 -->
<Modal
v-model=
"detailModal.show"
:title=
"detailModal.title"
width=
"1080"
:z-index=
"100"
:mask-closable=
"false"
>
<div
style=
"max-height: 70vh; overflow: hidden; overflow-y: auto; "
>
<Row
:gutter=
"20"
v-if=
"detailModal.isView"
>
<!-- 左侧任务信息 -->
<Col
span=
"14"
>
<Card
dis-hover
>
<
template
#title
>
任务基本信息
</
template
>
<div
class=
"task-detail-info"
>
<Row>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
任务年份:
</span>
<span
class=
"detail-value"
>
{{ typeof detailModal.form.year === 'object' ?
dayjs(detailModal.form.year).format('YYYY') : detailModal.form.year }}
</span>
</Col>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
计划完成时间:
</span>
<span
class=
"detail-value"
>
{{ typeof detailModal.form.plan_finish_time === 'object' ?
dayjs(detailModal.form.plan_finish_time).format('YYYY-MM') :
detailModal.form.plan_finish_time }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
任务名称:
</span>
<span
class=
"detail-value"
>
{{ detailModal.form.name }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
任务目标:
</span>
<span
class=
"detail-value detail-textarea"
>
{{ detailModal.form.detail }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
责任部门:
</span>
<span
class=
"detail-value"
>
{{ getDepartmentName(detailModal.form.duty_dept_id) }}
</span>
</Col>
<Col
span=
"12"
v-if=
"detailModal.form.belong_dept_id"
>
<span
class=
"detail-label"
>
归口部门:
</span>
<span
class=
"detail-value"
>
{{ getDepartmentName(detailModal.form.belong_dept_id) }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
完成状态:
</span>
<span
class=
"detail-value"
>
<Tag
v-if=
"detailModal.form.finish_status === 0"
color=
"default"
>
未完成
</Tag>
<Tag
v-else-if=
"detailModal.form.finish_status === 1"
color=
"success"
>
已完成
</Tag>
</span>
</Col>
<Col
span=
"12"
>
<span
class=
"detail-label"
>
审核状态:
</span>
<span
class=
"detail-value"
>
<Tag
v-if=
"detailModal.form.audit_status === 0"
color=
"default"
>
暂存
</Tag>
<Tag
v-else-if=
"detailModal.form.audit_status === 1"
color=
"primary"
>
审批中
</Tag>
<Tag
v-else-if=
"detailModal.form.audit_status === 2"
color=
"success"
>
审批通过
</Tag>
<Tag
v-else-if=
"detailModal.form.audit_status === -1"
color=
"error"
>
不通过
</Tag>
</span>
</Col>
</Row>
<div
v-if=
"detailModal.form.completion_content"
>
<Divider>
任务完成情况说明
</Divider>
<Row
class=
"detail-row"
v-if=
"detailModal.form.actual_finish_time"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
实际完成时间:
</span>
<span
class=
"detail-value"
>
{{ detailModal.form.actual_finish_time }}
</span>
</Col>
</Row>
<Row
class=
"detail-row"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
情况说明:
</span>
<span
class=
"detail-value detail-textarea"
>
{{ detailModal.form.completion_content
}}
</span>
</Col>
</Row>
<div
v-if=
"detailModal.completion_files && detailModal.completion_files.length > 0"
>
<Table
border
:columns=
"uploadFileColumns"
:data=
"detailModal.completion_files"
class=
"ivu-mt"
>
<
template
#name
="{
row
}"
>
<div
class=
"file-name"
>
<a
@
click=
"previewFile(row)"
style=
"color: #3399ff; font-weight: 600;"
>
{{
row
.
name
}}
</a>
</div>
</
template
>
<
template
#option
="{
row
}"
>
<a
type=
"text"
@
click=
"downloadFile(row)"
>
下载
</a>
</
template
>
</Table>
</div>
</div>
<Row
class=
"detail-row"
v-if=
"detailModal.form.audit_opinion"
>
<Col
span=
"24"
>
<span
class=
"detail-label"
>
审核意见:
</span>
<span
class=
"detail-value detail-textarea"
>
{{ detailModal.form.audit_opinion }}
</span>
</Col>
</Row>
</div>
</Card>
</Col>
<!-- 右侧任务轨迹 -->
<Col
span=
"10"
>
<Card
dis-hover
>
<
template
#title
>
任务轨迹
</
template
>
<div
class=
"task-traces"
>
<div
v-if=
"detailModal.traces && detailModal.traces.length > 0"
>
<Timeline>
<TimelineItem
v-for=
"(trace, index) in detailModal.traces"
:key=
"index"
:color=
"getTraceColor(trace)"
>
<p
class=
"time"
>
{{ trace.createtime }}
</p>
<p
class=
"content"
>
<span>
{{ trace.step_name }}
</span>
-
<span>
{{ trace.createby }}
</span>
</p>
<p
class=
"remark"
>
{{ trace.content }}
</p>
</TimelineItem>
</Timeline>
</div>
<div
v-else
class=
"no-traces"
>
<Icon
type=
"md-information-circle"
size=
"24"
/>
<p>
暂无任务轨迹
</p>
</div>
</div>
</Card>
</Col>
</Row>
<!-- 非查看模式下的表单 -->
<Form
ref=
"taskFormRef"
:model=
"detailModal.form"
:rules=
"formRules"
:label-width=
"110"
v-if=
"!detailModal.isView"
>
<FormItem
label=
"任务年份"
prop=
"year"
>
<DatePicker
v-model=
"detailModal.form.year"
transfer
type=
"year"
placeholder=
"请选择任务年份"
></DatePicker>
</FormItem>
<FormItem
label=
"任务名称"
prop=
"name"
>
<Input
v-model=
"detailModal.form.name"
placeholder=
"请输入任务名称"
></Input>
</FormItem>
<FormItem
label=
"任务目标"
prop=
"detail"
>
<Input
v-model=
"detailModal.form.detail"
type=
"textarea"
:rows=
"4"
placeholder=
"请输入任务目标"
></Input>
</FormItem>
<FormItem
label=
"责任部门"
prop=
"duty_dept_id"
>
<Select
v-model=
"detailModal.form.duty_dept_id"
transfer
filterable
placeholder=
"请选择责任部门"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
<FormItem
label=
"归口部门"
prop=
"belong_dept_id"
>
<Select
v-model=
"detailModal.form.belong_dept_id"
transfer
filterable
placeholder=
"请选择归口部门"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
<FormItem
label=
"计划完成时间"
prop=
"plan_finish_time"
>
<DatePicker
v-model=
"detailModal.form.plan_finish_time"
transfer
type=
"month"
placeholder=
"请选择计划完成时间"
></DatePicker>
</FormItem>
<!-- <FormItem label="备注" prop="remark">
<Input v-model="detailModal.form.remark" type="textarea" :rows="2" placeholder="请输入备注"></Input>
</FormItem> -->
</Form>
</div>
<
template
#footer
>
<Button
@
click=
"detailModal.show = false"
>
{{
detailModal
.
isView
?
'
关闭
'
:
'
取消
'
}}
</Button>
<Button
type=
"primary"
@
click=
"handleSaveTask"
v-if=
"!detailModal.isView"
>
保存
</Button>
</
template
>
</Modal>
<!-- 导入任务对话框 -->
<Modal
v-model=
"importModal.show"
title=
"导入任务"
width=
"500"
:mask-closable=
"false"
>
<Form
:label-width=
"80"
>
<FormItem
label=
"任务年份"
>
<DatePicker
v-model=
"importModal.year"
transfer
type=
"year"
placeholder=
"请选择任务年份"
style=
"width: 100%"
>
</DatePicker>
</FormItem>
<FormItem
label=
"导入文件"
>
<Upload
type=
"drag"
action=
""
:before-upload=
"handleBeforeUpload"
>
<div
style=
"padding: 20px 0"
>
<Icon
type=
"ios-cloud-upload"
size=
"52"
style=
"color: #3399ff"
></Icon>
<p>
点击或拖拽文件到此处上传
</p>
</div>
</Upload>
<div
v-if=
"importModal.file"
style=
"margin-top: 8px"
>
已选择文件:{{ importModal.file.name }}
</div>
</FormItem>
</Form>
<
template
#footer
>
<Button
@
click=
"importModal.show = false"
>
取消
</Button>
<Button
type=
"primary"
@
click=
"handleImportSubmit"
:loading=
"importModal.loading"
:disabled=
"!importModal.file || !importModal.year"
>
提交
</Button>
</
template
>
</Modal>
<!-- 文件预览抽屉 -->
<Drawer
v-model=
"filePreviewDrawer.show"
title=
"文件预览"
placement=
"right"
width=
"70"
:mask-closable=
"true"
:styles=
"{ height: '100%' }"
:z-index=
"99999"
>
<div
class=
"file-preview-container"
>
<iframe
v-if=
"filePreviewDrawer.show"
:src=
"filePreviewUrl"
frameborder=
"0"
class=
"file-preview-iframe"
></iframe>
</div>
</Drawer>
</div>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
,
Drawer
}
from
'
view-ui-plus
'
import
{
AddProject
,
ImportProject
,
BaseFileOutPut
,
AdminGetProjectInit
,
AdminGetProject
,
UpdateProject
,
DeleteProject
,
GetDepts
}
from
'
@/api/api
'
import
initForm
from
'
@/components/initForm
'
import
initTable
from
'
@/components/initTable
'
// import ExportExcel from '@/utils/exportExcel'
import
{
useStore
}
from
'
vuex
'
import
dayjs
from
'
dayjs
'
const
store
=
useStore
()
console
.
log
(
"
🚀🚀store🚀
"
,
store
)
const
userRole
=
computed
(()
=>
store
.
state
.
admin
.
user
.
info
.
currentRole
.
role_id
)
// 部门列表
const
departmentOptions
=
ref
([])
// 加载部门数据
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
// 辅助函数:处理年份字符串为日期对象
const
parseYear
=
(
yearStr
)
=>
{
if
(
!
yearStr
)
return
''
;
// 如果是数字字符串,如"2025",转为"2025-01-01"再创建日期
if
(
/^
\d{4}
$/
.
test
(
yearStr
))
{
return
new
Date
(
`
${
yearStr
}
-01-01`
);
}
// 如果已经包含月份,如"2025-01",直接创建日期
return
new
Date
(
yearStr
);
}
// 辅助函数:处理年月字符串为日期对象
const
parseYearMonth
=
(
dateStr
)
=>
{
if
(
!
dateStr
)
return
''
;
// 如果是"YYYY-MM"格式,转为"YYYY-MM-01"再创建日期
if
(
/^
\d{4}
-
\d{2}
$/
.
test
(
dateStr
))
{
return
new
Date
(
`
${
dateStr
}
-01`
);
}
return
new
Date
(
dateStr
);
}
// 搜索条件
const
searchList
=
ref
([])
// 表格数据
const
tableData
=
ref
([])
// 总记录数
const
total
=
ref
(
0
)
// 当前页码
const
pageIndex
=
ref
(
1
)
// 每页条数
const
pageSize
=
ref
(
20
)
// 加载状态
const
loading
=
ref
(
false
)
// 表格列定义
const
columns
=
ref
([])
// 详情/编辑模态框
const
detailModal
=
reactive
({
show
:
false
,
title
:
'
任务详情
'
,
isView
:
true
,
form
:
{
id
:
null
,
year
:
''
,
name
:
''
,
detail
:
''
,
duty_dept_id
:
''
,
belong_dept_id
:
''
,
plan_finish_time
:
''
,
remark
:
''
,
completion_content
:
''
,
finish_status
:
0
,
audit_status
:
0
,
audit_opinion
:
''
,
actual_finish_time
:
''
},
traces
:
[],
completion_files
:
[]
})
// 导入模态框
const
importModal
=
reactive
({
show
:
false
,
year
:
''
,
file
:
null
,
loading
:
false
})
// 加载过滤条件
const
loadTaskFilter
=
async
()
=>
{
try
{
await
AdminGetProjectInit
({
role_id
:
userRole
.
value
}).
then
((
res
)
=>
{
searchList
.
value
=
res
.
response
console
.
log
(
"
🚀 searchList.value🚀🚀,
"
,
searchList
.
value
)
}).
catch
(
error
=>
{
console
.
error
(
error
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取过滤条件失败:
'
,
error
)
Message
.
error
(
'
获取过滤条件失败
'
)
}
}
// 加载任务列表
const
loadTaskList
=
async
()
=>
{
loading
.
value
=
true
try
{
const
params
=
{
page_index
:
pageIndex
.
value
,
page_size
:
pageSize
.
value
,
role_id
:
userRole
.
value
,
...
formValues
.
value
}
await
AdminGetProject
(
params
).
then
((
res
)
=>
{
tableData
.
value
=
res
.
response
.
data
total
.
value
=
res
.
response
.
data_count
if
(
columns
.
value
.
length
==
0
)
{
columns
.
value
=
res
.
response
.
title
.
filter
(
a
=>
a
.
default_hide_flag
===
0
)
// 过滤掉隐藏列
.
map
(
a
=>
{
const
column
=
{
title
:
a
.
show_name
,
key
:
a
.
field_id
,
minWidth
:
a
.
width
||
130
,
show
:
true
,
align
:
'
center
'
,
ellipsis
:
true
,
tooltip
:
true
}
// 为name和detail列设置特殊属性
if
(
a
.
field_id
===
'
name
'
||
a
.
field_id
===
'
detail
'
)
{
column
.
ellipsis
=
true
column
.
tooltip
=
true
column
.
minWidth
=
a
.
width
||
250
}
// 为完成状态和审核状态设置插槽
if
(
a
.
field_id
===
'
finish_status
'
||
a
.
field_id
===
'
audit_status
'
)
{
column
.
slot
=
a
.
field_id
}
return
column
})
//添加操作列
columns
.
value
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
180
,
show
:
true
,
align
:
'
center
'
,
fixed
:
'
right
'
})
console
.
log
(
"
columns.value
"
,
columns
.
value
)
}
}).
catch
(
error
=>
{
console
.
error
(
error
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取任务列表失败:
'
,
error
)
Message
.
error
(
'
获取任务列表失败
'
)
}
finally
{
loading
.
value
=
false
}
}
// 搜索表单值
const
formValues
=
ref
({})
// 搜索
const
handleSearch
=
(
values
)
=>
{
formValues
.
value
=
values
pageIndex
.
value
=
1
loadTaskList
()
}
// 重置
const
handleReset
=
()
=>
{
formValues
.
value
=
{}
pageIndex
.
value
=
1
loadTaskList
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
loadTaskList
()
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
loadTaskList
()
}
// 添加任务
const
handleAdd
=
()
=>
{
detailModal
.
isView
=
false
detailModal
.
title
=
'
添加任务
'
detailModal
.
form
=
{
id
:
null
,
year
:
''
,
name
:
''
,
detail
:
''
,
duty_dept_id
:
''
,
belong_dept_id
:
''
,
plan_finish_time
:
''
,
remark
:
''
}
detailModal
.
traces
=
[]
detailModal
.
show
=
true
// 等待DOM更新后再获取表单引用
setTimeout
(()
=>
{
if
(
taskFormRef
.
value
)
{
taskFormRef
.
value
.
resetFields
()
}
},
100
)
}
// 编辑任务
const
handleEdit
=
async
(
row
)
=>
{
detailModal
.
isView
=
false
detailModal
.
title
=
'
编辑任务
'
try
{
// 预处理日期
const
year
=
parseYear
(
row
.
year
);
const
planFinishTime
=
parseYearMonth
(
row
.
plan_finish_time
);
detailModal
.
form
=
{
id
:
row
.
id
,
year
:
year
,
name
:
row
.
name
,
detail
:
row
.
detail
,
duty_dept_id
:
row
.
duty_dept_id
,
belong_dept_id
:
row
.
belong_dept_id
,
plan_finish_time
:
planFinishTime
,
remark
:
row
.
remark
}
console
.
log
(
"
detailModal.form
"
,
detailModal
.
form
)
detailModal
.
traces
=
row
.
tracks
||
[]
detailModal
.
show
=
true
}
catch
(
error
)
{
console
.
error
(
'
获取任务详情失败:
'
,
error
)
Message
.
error
(
'
获取任务详情失败
'
)
}
}
// 查看任务详情
const
handleDetail
=
async
(
row
)
=>
{
detailModal
.
isView
=
true
detailModal
.
title
=
'
任务详情
'
try
{
// 预处理日期
const
year
=
parseYear
(
row
.
year
);
const
planFinishTime
=
parseYearMonth
(
row
.
plan_finish_time
);
detailModal
.
form
=
{
id
:
row
.
id
,
year
:
year
,
name
:
row
.
name
,
detail
:
row
.
detail
,
duty_dept_id
:
row
.
duty_dept_id
,
belong_dept_id
:
row
.
belong_dept_id
,
plan_finish_time
:
planFinishTime
,
remark
:
row
.
remark
,
completion_content
:
row
.
completion_content
,
finish_status
:
row
.
finish_status
,
audit_status
:
row
.
audit_status
,
audit_opinion
:
row
.
audit_opinion
,
actual_finish_time
:
row
.
actual_finish_time
}
detailModal
.
traces
=
row
.
tracks
||
[]
detailModal
.
completion_files
=
row
.
completion_files
||
[]
detailModal
.
show
=
true
}
catch
(
error
)
{
console
.
error
(
'
获取任务详情失败:
'
,
error
)
Message
.
error
(
'
获取任务详情失败
'
)
}
}
// 删除任务
const
handleDelete
=
(
row
)
=>
{
ModalConfirm
.
confirm
({
title
:
'
确认删除
'
,
content
:
`确定要删除任务"
${
row
.
name
}
"吗?`
,
onOk
:
async
()
=>
{
try
{
await
DeleteProject
({
id
:
row
.
id
}).
then
((
res
)
=>
{
Message
.
success
(
res
)
loadTaskList
()
}).
catch
(
error
=>
{
console
.
error
(
error
)
Message
.
error
(
'
删除任务失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
删除任务失败:
'
,
error
)
Message
.
error
(
'
删除任务失败
'
)
}
}
})
}
// 表单引用
const
taskFormRef
=
ref
(
null
)
// 表单验证规则
const
formRules
=
{
year
:
[
{
required
:
true
,
type
:
'
date
'
,
message
:
'
请选择任务年份
'
,
trigger
:
'
change
'
}
],
name
:
[
{
required
:
true
,
message
:
'
请输入任务名称
'
,
trigger
:
'
blur
'
}
],
detail
:
[
{
required
:
true
,
message
:
'
请输入任务目标
'
,
trigger
:
'
blur
'
}
],
duty_dept_id
:
[
{
required
:
true
,
message
:
'
请选择责任部门
'
,
trigger
:
'
change
'
}
],
belong_dept_id
:
[
{
required
:
false
,
message
:
'
请选择归口部门
'
,
trigger
:
'
change
'
}
],
plan_finish_time
:
[
{
required
:
true
,
type
:
'
date
'
,
message
:
'
请选择计划完成时间
'
,
trigger
:
'
change
'
}
]
}
// 保存任务
const
handleSaveTask
=
async
()
=>
{
if
(
!
taskFormRef
.
value
)
{
console
.
error
(
'
表单实例不存在
'
)
Message
.
error
(
'
系统错误,请稍后重试
'
)
return
}
taskFormRef
.
value
.
validate
(
async
(
valid
)
=>
{
if
(
!
valid
)
{
Message
.
error
(
'
请检查输入内容
'
)
return
}
try
{
// 准备提交数据,确保日期格式正确
const
formData
=
{
...
detailModal
.
form
,
// 如果year是Date对象,转换为字符串"YYYY"
year
:
typeof
detailModal
.
form
.
year
===
'
object
'
?
dayjs
(
detailModal
.
form
.
year
).
format
(
'
YYYY
'
)
:
detailModal
.
form
.
year
,
// 如果plan_finish_time是Date对象,转换为字符串"YYYY-MM"
plan_finish_time
:
typeof
detailModal
.
form
.
plan_finish_time
===
'
object
'
?
dayjs
(
detailModal
.
form
.
plan_finish_time
).
format
(
'
YYYY-MM
'
)
:
detailModal
.
form
.
plan_finish_time
,
audit_status
:
0
// 默认为暂存状态
}
if
(
detailModal
.
form
.
id
)
{
// 更新任务
await
UpdateProject
(
formData
).
then
((
res
)
=>
{
Message
.
success
(
'
更新任务成功
'
)
detailModal
.
show
=
false
loadTaskList
()
}).
catch
(
error
=>
{
console
.
error
(
error
)
Message
.
error
(
'
更新任务失败
'
)
})
}
else
{
// 创建新任务
await
AddProject
(
formData
).
then
((
res
)
=>
{
Message
.
success
(
res
)
detailModal
.
show
=
false
loadTaskList
()
}).
catch
(
error
=>
{
console
.
error
(
error
)
Message
.
error
(
'
创建任务失败
'
)
})
}
}
catch
(
error
)
{
console
.
error
(
'
保存任务失败:
'
,
error
)
Message
.
error
(
'
保存任务失败
'
)
}
})
}
// 导入任务
const
handleImport
=
()
=>
{
importModal
.
show
=
true
}
// 导出任务
const
handleExport
=
async
()
=>
{
try
{
// 模拟导出功能
const
data
=
tableData
.
value
.
map
(
item
=>
({
'
任务标题
'
:
item
.
title
,
'
责任部门
'
:
item
.
department_name
,
'
归口部门
'
:
item
.
entrance_name
,
'
任务目标
'
:
item
.
target
,
'
截止日期
'
:
item
.
deadline
,
'
状态
'
:
item
.
status_text
,
'
备注
'
:
item
.
remark
}))
// 使用ExportExcel工具导出
// ExportExcel(data, '任务列表', `任务列表_${new Date().toISOString().slice(0, 10)}`)
Message
.
success
(
'
导出成功
'
)
}
catch
(
error
)
{
console
.
error
(
'
导出失败:
'
,
error
)
Message
.
error
(
'
导出失败
'
)
}
}
// 在script部分添加下载loading状态变量
const
downloadLoading
=
ref
(
false
)
// 下载模板
const
handleDownloadTemplate
=
()
=>
{
downloadLoading
.
value
=
true
BaseFileOutPut
()
.
then
((
res
)
=>
{
const
a
=
document
.
createElement
(
'
a
'
)
a
.
href
=
res
a
.
click
()
})
.
catch
(
error
=>
{
console
.
error
(
'
模板下载失败:
'
,
error
)
Message
.
error
(
'
模板下载失败
'
)
})
.
finally
(()
=>
{
downloadLoading
.
value
=
false
})
}
// 上传前验证
const
handleBeforeUpload
=
(
file
)
=>
{
const
isExcel
=
file
.
name
.
endsWith
(
'
.xlsx
'
)
||
file
.
name
.
endsWith
(
'
.xls
'
)
if
(
!
isExcel
)
{
Message
.
warning
(
'
只能上传Excel文件
'
)
return
false
}
// 保存文件引用,不立即上传
importModal
.
file
=
file
// 阻止Upload组件默认上传行为
return
false
}
// 提交导入任务
const
handleImportSubmit
=
()
=>
{
if
(
!
importModal
.
file
||
!
importModal
.
year
)
{
Message
.
warning
(
'
请选择任务年份和上传文件
'
)
return
}
importModal
.
loading
=
true
// 创建FormData对象
const
formData
=
new
FormData
()
formData
.
append
(
'
file
'
,
importModal
.
file
)
formData
.
append
(
'
year
'
,
dayjs
(
importModal
.
year
).
format
(
'
YYYY
'
))
// 调用导入接口
ImportProject
(
formData
)
.
then
(
res
=>
{
Message
.
success
(
res
)
importModal
.
show
=
false
loadTaskList
()
})
.
catch
(
error
=>
{
console
.
error
(
'
导入任务失败:
'
,
error
)
})
.
finally
(()
=>
{
importModal
.
loading
=
false
})
}
// 获取任务轨迹颜色
const
getTraceColor
=
(
trace
)
=>
{
if
(
!
trace
||
!
trace
.
step_name
)
return
'
blue
'
;
// 根据步骤ID或步骤名称判断颜色
if
(
trace
.
step_id
===
'
0
'
||
trace
.
step_name
.
includes
(
'
发起人
'
))
return
'
blue
'
;
if
(
trace
.
step_id
===
'
1
'
||
trace
.
step_name
.
includes
(
'
归口部门
'
))
return
'
green
'
;
if
(
trace
.
step_id
===
'
2
'
||
trace
.
step_name
.
includes
(
'
党政办
'
))
return
'
success
'
;
if
(
trace
.
content
&&
trace
.
content
.
includes
(
'
退回
'
))
return
'
red
'
;
return
'
blue
'
;
}
// 根据部门ID获取部门名称
const
getDepartmentName
=
(
deptId
)
=>
{
if
(
!
deptId
)
return
''
;
const
dept
=
departmentOptions
.
value
.
find
(
item
=>
item
.
value
===
deptId
);
return
dept
?
dept
.
label
:
''
;
}
// 上传文件列表表格列定义
const
uploadFileColumns
=
[
{
title
:
'
文件名
'
,
slot
:
'
name
'
,
minWidth
:
150
},
{
title
:
'
大小
'
,
key
:
'
size
'
,
minWidth
:
100
,
render
:
(
h
,
{
row
})
=>
{
return
h
(
'
span
'
,
formatFileSize
(
row
.
size
))
}
},
{
title
:
'
上传时间
'
,
key
:
'
createtime
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
option
'
,
fixed
:
'
right
'
,
width
:
150
,
align
:
'
center
'
}
]
// 格式化文件大小
const
formatFileSize
=
(
size
)
=>
{
if
(
!
size
)
return
'
-
'
const
sizeNum
=
parseInt
(
size
)
if
(
isNaN
(
sizeNum
))
return
size
if
(
sizeNum
<
1024
)
{
return
sizeNum
+
'
B
'
}
else
if
(
sizeNum
<
1024
*
1024
)
{
return
(
sizeNum
/
1024
).
toFixed
(
2
)
+
'
KB
'
}
else
if
(
sizeNum
<
1024
*
1024
*
1024
)
{
return
(
sizeNum
/
1024
/
1024
).
toFixed
(
2
)
+
'
MB
'
}
else
{
return
(
sizeNum
/
1024
/
1024
/
1024
).
toFixed
(
2
)
+
'
GB
'
}
}
// 下载文件
const
downloadFile
=
(
file
)
=>
{
const
link
=
document
.
createElement
(
'
a
'
)
link
.
href
=
file
.
path
link
.
download
=
file
.
name
document
.
body
.
appendChild
(
link
)
link
.
click
()
document
.
body
.
removeChild
(
link
)
}
// 文件预览相关状态
const
filePreviewDrawer
=
reactive
({
show
:
false
,
currentFile
:
null
})
// 原始域名
const
originHost
=
ref
(
''
)
// 获取文件预览URL
const
filePreviewUrl
=
computed
(()
=>
{
if
(
!
filePreviewDrawer
.
currentFile
)
return
''
return
`
${
originHost
.
value
}
/fileReader/?file=
${
filePreviewDrawer
.
currentFile
.
path
}
`
})
// 预览文件
const
previewFile
=
(
file
)
=>
{
filePreviewDrawer
.
currentFile
=
file
filePreviewDrawer
.
show
=
true
}
// 获取当前域名
const
getOriginHost
=
()
=>
{
originHost
.
value
=
window
.
location
.
origin
}
onMounted
(()
=>
{
loadDepartments
()
loadTaskFilter
()
loadTaskList
()
getOriginHost
()
})
</
script
>
<
style
scoped
>
.ivu-mt
{
margin-top
:
16px
;
}
.operation-bar
{
margin
:
16px
0
;
text-align
:
left
;
}
.ivu-ml-8
{
margin-left
:
8px
;
}
/* 轨迹样式 */
.time
{
font-size
:
12px
;
color
:
#999
;
}
.content
{
font-size
:
14px
;
margin
:
5px
0
;
}
.remark
{
font-size
:
13px
;
color
:
#666
;
}
/* 文件上传样式 */
.upload-container
{
position
:
relative
;
margin-bottom
:
16px
;
}
.file-name
{
display
:
flex
;
align-items
:
center
;
word-break
:
break-all
;
}
.demo-spin-icon-load
{
animation
:
ani-demo-spin
1s
linear
infinite
;
}
@keyframes
ani-demo-spin
{
from
{
transform
:
rotate
(
0deg
);
}
to
{
transform
:
rotate
(
360deg
);
}
}
/* 任务轨迹样式 */
.task-traces
{
max-height
:
50vh
;
overflow-y
:
auto
;
padding-right
:
10px
;
}
.no-traces
{
text-align
:
center
;
color
:
#c5c8ce
;
padding
:
30px
0
;
}
.no-traces
p
{
margin-top
:
10px
;
}
/* 任务详情样式 */
.task-detail-info
{
padding
:
8px
0
;
}
.detail-label
{
font-weight
:
bold
;
color
:
#17233d
;
}
.detail-value
{
margin-left
:
8px
;
word-break
:
break-word
;
}
.detail-textarea
{
white-space
:
pre-wrap
;
line-height
:
1.5
;
display
:
block
;
margin-top
:
4px
;
}
.detail-row
{
margin-top
:
16px
;
}
/* 文件预览样式 */
.file-preview-container
{
height
:
100%
;
width
:
100%
;
overflow
:
hidden
;
}
.file-preview-iframe
{
width
:
100%
;
height
:
100%
;
border
:
none
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/reviewApproval/consumables/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</div>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/reviewApproval/device/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
style=
"width: 100%;height: 100%;"
>
<!-- 右侧人员列表 -->
<div
class=
"role-content"
>
<!-- 搜索和工具栏 -->
<div
class=
"role-toolbar"
>
<Button
type=
"primary"
@
click=
"handleAddUser"
>
添加
{{
currentRole
.
role_name
}}
</Button>
<div
class=
"search-box"
>
<Input
v-model=
"searchKeyword"
placeholder=
"输入姓名搜索"
search
enter-button
@
on-search=
"handleSearch"
/>
</div>
</div>
<!-- 人员表格 -->
<Table
:loading=
"loading"
:columns=
"userColumns"
:data=
"userList"
border
>
<!-- 照片列 -->
<template
#avatar
="
{ row }">
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 负责部门列 -->
<
template
#duty_depts
="{
row
}"
>
<div
v-if=
"row.duty_depts && row.duty_depts.length"
>
<Tag
v-for=
"(dept, index) in row.duty_depts"
:key=
"dept.dept_id"
color=
"blue"
style=
"margin: 2px"
>
{{
dept
.
dept_name
}}
</Tag>
</div>
<span
v-else
>
-
</span>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"error"
size=
"small"
@
click=
"handleRemoveUser(row)"
>
删除
</Button>
</div>
</
template
>
</Table>
<!-- 分页 -->
<div
class=
"pagination"
>
<Page
:total=
"total"
:current=
"pageIndex"
:page-size=
"pageSize"
show-elevator
show-sizer
show-total
@
on-change=
"handlePageChange"
@
on-page-size-change=
"handlePageSizeChange"
/>
</div>
</div>
</div>
<!-- 添加用户对话框 -->
<Modal
v-model=
"addUserModal.show"
:title=
"'添加' + currentRole.role_name"
width=
"700"
:mask-closable=
"false"
>
<div
class=
"add-user-search"
>
<Input
v-model=
"addUserModal.keyword"
placeholder=
"输入姓名或工号搜索用户"
search
enter-button
@
on-search=
"searchAvailableUsers"
/>
</div>
<!-- 负责部门选择 - 只在角色为责任部门时显示 -->
<div
class=
"duty-dept-select"
v-if=
"currentRole.role_type === 2"
>
<Form>
<FormItem
label=
"负责部门"
:label-width=
"80"
:rules=
"[{ required: true, type: 'array', min: 1, message: '请至少选择一个负责部门', trigger: 'change' }]"
>
<Select
v-model=
"addUserModal.dutyDepts"
multiple
filterable
placeholder=
"请选择负责部门(可多选)"
style=
"width: 100%"
>
<Option
v-for=
"dept in departmentOptions"
:key=
"dept.value"
:value=
"dept.value"
>
{{ dept.label }}
</Option>
</Select>
</FormItem>
</Form>
</div>
<!-- 可添加用户列表 -->
<Table
:loading=
"addUserModal.loading"
:columns=
"availableUserColumns"
:data=
"addUserModal.userList"
border
>
<!-- 照片列 -->
<
template
#avatar
="{
row
}"
>
<div
class=
"user-avatar"
>
<Avatar
v-if=
"row.photo"
size=
"large"
:src=
"row.photo"
/>
<Avatar
v-else
icon=
"ios-person"
size=
"large"
/>
</div>
</
template
>
<!-- 操作列 -->
<
template
#action
="{
row
}"
>
<div
class=
"action-btns"
>
<Button
type=
"primary"
size=
"small"
@
click=
"confirmAddUser(row)"
>
添加
</Button>
</div>
</
template
>
</Table>
<
template
#footer
>
<Button
@
click=
"addUserModal.show = false"
>
关闭
</Button>
</
template
>
</Modal>
</template>
<
script
setup
>
import
{
ref
,
onMounted
,
reactive
,
computed
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 加载角色列表
const
loadRoleList
=
async
()
=>
{
try
{
await
RoleInit
().
then
(
res
=>
{
// roleList.value = res.response
if
(
res
.
response
.
length
>
0
&&
!
currentRole
.
value
.
role_type
&&
currentRole
.
value
.
role_type
!==
0
)
{
currentRole
.
value
=
res
.
response
[
0
]
loadRoleUsers
()
}
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色列表失败:
'
,
error
)
Message
.
error
(
'
获取角色列表失败
'
)
}
}
// 加载角色用户
const
loadRoleUsers
=
async
()
=>
{
if
(
!
currentRole
.
value
&&
currentRole
.
value
.
role_type
===
undefined
)
return
loading
.
value
=
true
try
{
const
params
=
{
role_type
:
currentRole
.
value
.
role_type
,
query
:
searchKeyword
.
value
}
await
PermissonList
(
params
).
then
(
res
=>
{
userList
.
value
=
res
.
response
||
[]
total
.
value
=
res
.
response
?
res
.
response
.
length
:
0
}).
catch
(
error
=>
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
}).
finally
(()
=>
{
loading
.
value
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
获取角色用户列表失败:
'
,
error
)
Message
.
error
(
'
获取角色用户列表失败
'
)
loading
.
value
=
false
}
}
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
// 搜索可添加的用户
const
searchAvailableUsers
=
async
()
=>
{
addUserModal
.
loading
=
true
try
{
const
params
=
{
query
:
addUserModal
.
keyword
}
await
SelectTeacher
(
params
).
then
(
res
=>
{
addUserModal
.
userList
=
res
.
response
||
[]
}).
catch
(
error
=>
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
}).
finally
(()
=>
{
addUserModal
.
loading
=
false
})
}
catch
(
error
)
{
console
.
error
(
'
搜索用户失败:
'
,
error
)
Message
.
error
(
'
搜索用户失败
'
)
addUserModal
.
loading
=
false
}
}
// 加载部门列表
const
loadDepartments
=
async
()
=>
{
try
{
await
GetDepts
().
then
((
res
)
=>
{
departmentOptions
.
value
=
res
.
response
.
map
(
dept
=>
({
value
:
dept
.
dept_id
,
label
:
dept
.
dept_name
}))
}).
catch
(
error
=>
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
})
}
catch
(
error
)
{
console
.
error
(
'
获取部门数据失败:
'
,
error
)
Message
.
error
(
'
获取部门数据失败
'
)
}
}
onMounted
(()
=>
{
loadRoleList
()
loadDepartments
()
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/reviewApproval/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
class=
"role-container"
>
<!-- 左侧角色列表 -->
<div
class=
"role-sidebar"
>
<div
class=
"role-title"
>
审核审批
</div>
<div
class=
"role-list"
>
<div
v-for=
"role in roleList"
:key=
"role.role_type"
:class=
"['role-item',
{ active: currentRole.role_type === role.role_type }]"
@click="handleSelectRole(role)"
>
<div
class=
"role-item-icon"
:class=
"getRoleIconClass(role.role_type)"
>
<Icon
:type=
"role.role_type === 0 ? 'ios-desktop' : 'ios-cube'"
/>
</div>
<div
class=
"role-item-info"
>
<div
class=
"role-name"
>
{{
role
.
role_name
}}
</div>
</div>
</div>
</div>
</div>
<Card
dis-hover
:bordered=
"false"
style=
"width: calc(100% - 300px);height: 100%;"
>
<!-- 右侧人员列表 -->
<component
:is=
"currentRole.role_type == 0 ? Devices : Consumables"
></component>
</Card>
</div>
</
template
>
<
script
setup
>
const
Devices
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/reviewApproval/device
'
))
const
Consumables
=
defineAsyncComponent
(()
=>
import
(
'
@/pages/reviewApproval/consumables
'
))
import
{
ref
,
onMounted
,
reactive
,
computed
,
defineAsyncComponent
}
from
'
vue
'
import
{
Message
,
Modal
as
ModalConfirm
}
from
'
view-ui-plus
'
import
{
RoleInit
,
PermissonList
,
PermissonAdd
,
PermissonDelete
,
SelectTeacher
,
GetDepts
}
from
'
@/api/api
'
// 角色列表
const
roleList
=
ref
([
{
"
role_type
"
:
0
,
"
role_name
"
:
"
设备审核
"
,
"
count
"
:
14
},
{
"
role_type
"
:
1
,
"
role_name
"
:
"
耗材审核
"
,
"
count
"
:
4
},
])
// 部门列表
const
departmentOptions
=
ref
([])
// 当前选中的角色
const
currentRole
=
ref
({
role_type
:
0
})
// 获取角色图标
const
getRoleIcon
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
md-settings
'
case
1
:
return
'
md-people
'
case
2
:
return
'
md-person
'
case
3
:
return
'
md-briefcase
'
default
:
return
'
md-person
'
}
}
// 获取角色图标样式类
const
getRoleIconClass
=
(
roleType
)
=>
{
switch
(
roleType
)
{
case
0
:
return
'
role-admin
'
case
1
:
return
'
role-party-office
'
case
2
:
return
'
role-responsible-dept
'
case
3
:
return
'
role-entrance-dept
'
default
:
return
'
role-admin
'
}
}
// 用户表格列定义
const
userColumns
=
computed
(()
=>
{
const
columns
=
[
{
title
:
'
#
'
,
type
:
'
index
'
,
width
:
60
},
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
]
// 当角色为部门负责人时(role_type === 2),添加负责部门列
if
(
currentRole
.
value
.
role_type
===
2
)
{
columns
.
push
({
title
:
'
负责部门
'
,
slot
:
'
duty_depts
'
,
minWidth
:
200
})
}
// 添加操作列
columns
.
push
({
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
})
return
columns
})
// 可添加用户表格列定义
const
availableUserColumns
=
ref
([
{
title
:
'
照片
'
,
slot
:
'
avatar
'
,
width
:
80
},
{
title
:
'
工号
'
,
key
:
'
user_id
'
,
width
:
120
},
{
title
:
'
姓名
'
,
key
:
'
name
'
,
minWidth
:
120
},
{
title
:
'
部门
'
,
key
:
'
dept_name
'
,
minWidth
:
150
},
{
title
:
'
操作
'
,
slot
:
'
action
'
,
width
:
80
,
align
:
'
center
'
}
])
// 分页相关变量
const
total
=
ref
(
0
)
const
pageIndex
=
ref
(
1
)
const
pageSize
=
ref
(
20
)
// 搜索关键词
const
searchKeyword
=
ref
(
''
)
// 加载状态
const
loading
=
ref
(
false
)
// 添加用户对话框
const
addUserModal
=
reactive
({
show
:
false
,
loading
:
false
,
keyword
:
''
,
userList
:
[],
dutyDepts
:
[]
})
// 用户列表
const
userList
=
ref
([])
// 选择角色
const
handleSelectRole
=
(
role
)
=>
{
currentRole
.
value
=
role
searchKeyword
.
value
=
''
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 搜索用户
const
handleSearch
=
()
=>
{
pageIndex
.
value
=
1
loadRoleUsers
()
}
// 分页改变
const
handlePageChange
=
(
page
)
=>
{
pageIndex
.
value
=
page
}
// 页大小改变
const
handlePageSizeChange
=
(
size
)
=>
{
pageSize
.
value
=
size
pageIndex
.
value
=
1
}
// 添加用户
const
handleAddUser
=
()
=>
{
addUserModal
.
keyword
=
''
addUserModal
.
userList
=
[]
addUserModal
.
dutyDepts
=
[]
addUserModal
.
show
=
true
searchAvailableUsers
()
}
onMounted
(()
=>
{
})
</
script
>
<
style
scoped
>
.role-container
{
display
:
flex
;
min-height
:
calc
(
100vh
-
150px
);
/* border: 1px solid #e8eaec; */
border-radius
:
4px
;
overflow
:
auto
;
gap
:
16px
;
}
.role-sidebar
{
width
:
300px
;
border-right
:
1px
solid
#e8eaec
;
background-color
:
#fff
;
overflow-y
:
auto
;
height
:
200px
;
}
.role-title
{
padding
:
16px
;
font-size
:
16px
;
font-weight
:
bold
;
border-bottom
:
1px
solid
#e8eaec
;
}
.role-list
{
padding
:
10px
0
;
}
.role-item
{
display
:
flex
;
align-items
:
center
;
padding
:
12px
16px
;
cursor
:
pointer
;
transition
:
background-color
0.3s
;
}
.role-item
:hover
{
background-color
:
#f0f0f0
;
}
.role-item.active
{
background-color
:
#e8f7ff
;
color
:
#2d8cf0
;
}
.role-item-icon
{
width
:
36px
;
height
:
36px
;
border-radius
:
50%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
margin-right
:
12px
;
color
:
#fff
;
}
.role-admin
{
background-color
:
#2d8cf0
;
}
.role-party-office
{
background-color
:
#19be6b
;
}
.role-entrance-dept
{
background-color
:
#ff9900
;
}
.role-responsible-dept
{
background-color
:
#ed4014
;
}
.role-item-info
{
flex
:
1
;
}
.role-name
{
font-size
:
14px
;
margin-bottom
:
4px
;
}
.role-count
{
font-size
:
12px
;
color
:
#808695
;
}
.role-content
{
display
:
flex
;
flex-direction
:
column
;
gap
:
16px
;
flex
:
1
;
}
.role-toolbar
{
height
:
100%
;
display
:
flex
;
justify-content
:
space-between
;
/* margin-bottom: 16px; */
position
:
sticky
;
top
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.search-box
{
width
:
280px
;
}
.pagination
{
/* margin-top: 16px; */
text-align
:
center
;
position
:
sticky
;
bottom
:
0
;
background-color
:
#fff
;
z-index
:
1
;
}
.action-btns
{
display
:
flex
;
justify-content
:
center
;
}
.user-avatar
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
.user-avatar
img
{
width
:
100%
;
height
:
100%
;
object-fit
:
cover
;
}
.add-user-search
{
margin-bottom
:
16px
;
}
.duty-dept-select
{
margin-bottom
:
16px
;
}
</
style
>
\ No newline at end of file
ynwh-deviceManagement-pc/src/pages/statusQuery/index.vue
0 → 100644
浏览文件 @
5a8c5913
<
template
>
<div
class=
"status-monitor"
>
<!-- 设备状态看板 -->
<Card
class=
"status-board"
>
<p
slot=
"title"
>
设备状态看板
</p>
<div
class=
"calendar-view"
>
<Calendar
v-model=
"currentDate"
@
on-change=
"handleDateChange"
>
<template
#month
="
{ date, data }">
<div>
<Badge
status=
"success"
text=
"打印机A: 空闲"
v-if=
"data.day === '2025-04-15'"
/>
<Badge
status=
"success"
text=
"打印机A: 空闲"
v-if=
"data.day === '2025-04-15'"
/>
</div>
</
template
>
</Calendar>
<div
class=
"legend"
>
<Tag
color=
"success"
>
空闲
</Tag>
<Tag
color=
"error"
>
占用
</Tag>
<Tag
color=
"warning"
>
维修中
</Tag>
<Tag
color=
"default"
>
未启用
</Tag>
</div>
</div>
</Card>
</div>
</template>
<
script
>
export
default
{
name
:
'
StatusQuery
'
,
data
()
{
return
{
currentDate
:
new
Date
(),
weekDays
:
[
'
日
'
,
'
一
'
,
'
二
'
,
'
三
'
,
'
四
'
,
'
五
'
,
'
六
'
],
// 设备数据
deviceData
:
[
{
deviceName
:
'
打印机A
'
,
status
:
'
free
'
,
currentUser
:
'
-
'
,
date
:
'
2024-02-15
'
},
{
deviceName
:
'
复印机B
'
,
status
:
'
occupied
'
,
currentUser
:
'
张三
'
,
date
:
'
2024-02-20
'
},
{
deviceName
:
'
扫描仪C
'
,
status
:
'
maintenance
'
,
currentUser
:
'
维修部
'
,
date
:
'
2024-02-21
'
}
],
// 维护计划配置
maintenanceColumns
:
[
{
title
:
'
设备名称
'
,
key
:
'
deviceName
'
},
{
title
:
'
维护类型
'
,
key
:
'
maintenanceType
'
},
{
title
:
'
计划时间
'
,
key
:
'
plannedTime
'
},
{
title
:
'
责任人
'
,
key
:
'
responsible
'
},
{
title
:
'
状态
'
,
key
:
'
status
'
},
{
title
:
'
操作
'
,
slot
:
'
action
'
}
],
maintenanceData
:
[
{
deviceName
:
'
打印机A
'
,
maintenanceType
:
'
校准
'
,
plannedTime
:
'
2024-07-01
'
,
responsible
:
'
李四
'
,
status
:
'
待处理
'
}
]
}
},
computed
:
{
currentMonthText
()
{
return
`
${
this
.
currentDate
.
getFullYear
()}
年
${
this
.
currentDate
.
getMonth
()
+
1
}
月`
},
calendarDays
()
{
const
year
=
this
.
currentDate
.
getFullYear
()
const
month
=
this
.
currentDate
.
getMonth
()
const
firstDay
=
new
Date
(
year
,
month
,
1
)
const
lastDay
=
new
Date
(
year
,
month
+
1
,
0
)
const
days
=
[]
// 填充上个月的日期
const
firstDayWeekday
=
firstDay
.
getDay
()
for
(
let
i
=
firstDayWeekday
-
1
;
i
>=
0
;
i
--
)
{
const
date
=
new
Date
(
year
,
month
,
-
i
)
days
.
push
({
date
:
date
.
toISOString
().
split
(
'
T
'
)[
0
],
dayNumber
:
date
.
getDate
(),
isCurrentMonth
:
false
,
isToday
:
this
.
isToday
(
date
)
})
}
// 当前月的日期
for
(
let
i
=
1
;
i
<=
lastDay
.
getDate
();
i
++
)
{
const
date
=
new
Date
(
year
,
month
,
i
)
days
.
push
({
date
:
date
.
toISOString
().
split
(
'
T
'
)[
0
],
dayNumber
:
i
,
isCurrentMonth
:
true
,
isToday
:
this
.
isToday
(
date
)
})
}
// 填充下个月的日期
const
remainingDays
=
42
-
days
.
length
for
(
let
i
=
1
;
i
<=
remainingDays
;
i
++
)
{
const
date
=
new
Date
(
year
,
month
+
1
,
i
)
days
.
push
({
date
:
date
.
toISOString
().
split
(
'
T
'
)[
0
],
dayNumber
:
i
,
isCurrentMonth
:
false
,
isToday
:
this
.
isToday
(
date
)
})
}
return
days
}
},
methods
:
{
prevMonth
()
{
this
.
currentDate
=
new
Date
(
this
.
currentDate
.
getFullYear
(),
this
.
currentDate
.
getMonth
()
-
1
)
},
nextMonth
()
{
this
.
currentDate
=
new
Date
(
this
.
currentDate
.
getFullYear
(),
this
.
currentDate
.
getMonth
()
+
1
)
},
isToday
(
date
)
{
const
today
=
new
Date
()
return
date
.
getDate
()
===
today
.
getDate
()
&&
date
.
getMonth
()
===
today
.
getMonth
()
&&
date
.
getFullYear
()
===
today
.
getFullYear
()
},
getDayDevices
(
date
)
{
return
this
.
deviceData
.
filter
(
device
=>
device
.
date
===
date
)
},
getStatusColor
(
status
)
{
const
colorMap
=
{
free
:
'
success
'
,
occupied
:
'
error
'
,
maintenance
:
'
warning
'
}
return
colorMap
[
status
]
},
getStatusText
(
status
)
{
const
textMap
=
{
free
:
'
空闲
'
,
occupied
:
'
占用
'
,
maintenance
:
'
维修中
'
}
return
textMap
[
status
]
},
handleMaintenance
(
row
)
{
this
.
$Modal
.
confirm
({
title
:
'
维护处理
'
,
content
:
`确认处理
${
row
.
deviceName
}
的维护计划吗?`
,
onOk
:
()
=>
{
this
.
$Message
.
success
(
'
处理成功
'
)
}
})
}
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.status-monitor {
.status-board, .maintenance-plan {
margin-bottom: 20px;
}
.calendar-view {
.calendar-header {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 20px;
.current-month {
margin: 0 20px;
font-size: 16px;
font-weight: bold;
}
}
.calendar-grid {
border: 1px solid #eee;
.calendar-weekdays {
display: grid;
grid-template-columns: repeat(7, 1fr);
background: #f8f8f8;
.weekday {
padding: 10px;
text-align: center;
font-weight: bold;
}
}
.calendar-days {
display: grid;
grid-template-columns: repeat(7, 1fr);
.day {
min-height: 100px;
padding: 5px;
border: 1px solid #eee;
&.other-month {
background: #fafafa;
color: #999;
}
&.today {
background: #f0f9ff;
}
.day-number {
font-size: 14px;
margin-bottom: 5px;
}
.day-content {
.device-item {
margin-bottom: 3px;
}
}
}
}
}
.legend {
display: flex;
gap: 10px;
margin-top: 10px;
justify-content: center;
}
}
}
</
style
>
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录