2025-03-24 14:59:31 +08:00
< template >
< div class = "p-2" >
<!-- 查询区域 -- >
< div class = "jeecg-basic-table-form-container" >
2025-03-26 15:36:35 +08:00
< a -form ref = "formRef" :model ="searchForm" :label-col ="labelCol" :wrapper-col ="wrapperCol" >
2025-03-24 14:59:31 +08:00
< a -row :gutter ="24" >
< a -col :lg ="6" >
< a -form -item name = "packageName" >
< template # label > < span title = "服务指令包名称" > 服务指令包 < / span > < / template >
2025-03-26 15:36:35 +08:00
< a -input v -model :value ="searchForm.packageName" allow -clear / >
2025-03-24 14:59:31 +08:00
< / a - f o r m - i t e m >
< / a - c o l >
2025-05-13 15:34:20 +08:00
< a -col :lg ="6" :sm ="24" >
2025-03-24 14:59:31 +08:00
< span style = "float: left; overflow: hidden" class = "table-page-search-submitButtons" >
< a -col :lg ="6" >
< a -button type = "primary" preIcon = "ant-design:search-outlined" @click ="searchQuery" > 查询 < / a -button >
< a -button type = "primary" preIcon = "ant-design:reload-outlined" @click ="searchReset"
style = "margin-left: 8px" > 重置 < / a - b u t t o n >
2025-03-26 15:36:35 +08:00
< a -button type = "primary" preIcon = "ant-design:plus-outlined" @click ="handleAdd"
style = "margin-left: 8px" > 新增 < / a - b u t t o n >
2025-03-24 14:59:31 +08:00
< / a - c o l >
< / span >
< / a - c o l >
< / a - r o w >
< / a - f o r m >
< / div >
2025-04-01 09:35:36 +08:00
< a -row >
2025-07-15 08:41:14 +08:00
< a -col v-for ="directive of tableData.records" :key="directive.id" :xs="24" :sm="24" :md="12" :lg="12" :xl="8" :xxl="4" style="padding: 5px 10px 0 0;height: 200px;" >
< a -row class = "cardDivClass" >
< a -col :span ="24" >
< a -row style = "padding: 10px" >
< a -col :span ="12" >
< img src = "/src/assets/images/logo.png" style = "width: 25px;height:25px;" / >
< / a - c o l >
< a -col :span ="12" style = "text-align: right;position:relative;" >
< div class = "iconEditClass" >
< a @click ="packageEdit(directive)" > < img src = "/src/assets/iot/a4.png" style = "width: 15px;height:15px;margin-top:-3px" / > < / a >
< / div >
< span >
< a -switch : checked = "directive.izEnabled == '0'" @change ="handleChangeIzEnabled(directive)" checked -children = " 启 " un -checked -children = " 停 " / >
2025-05-07 14:04:02 +08:00
< / span >
2025-07-15 08:41:14 +08:00
< / a - c o l >
< / a - r o w >
< / a - c o l >
< a -col :span ="24" >
< a -popover :title ="directive.packageName" >
< template # content >
< div style = "min-width: 240px;" >
< div style = "max-width: 400px;line-height:30px;padding:5px;border-radius:5px;margin:5px;background:#f5f5f5;" v-for ="(item,index) in directive.directives" > {{ item.directiveName }} < / div >
< div style = "max-width: 400px;line-height:30px;padding:5px;border-radius:5px;margin:5px;background:#f5f5f5;color:red;" v-if ="directive.directives.length==0" > 未配置 < / div >
< / div >
< / template >
< span class = "titleOne ellipsis-two-lines" > { { directive . packageName } } < / span >
< / a - p o p o v e r >
< / a - c o l >
< a -col :span ="24" >
< a -divider style = "margin: 10px 0 5px 0;" / >
< / a - c o l >
< a -col :span ="12" style = "padding: 0px 10px" >
{ { directive . createBy _dictText } }
< / a - c o l >
< a -col :span ="12" style = "text-align: right;padding: 0px 10px;" >
{ { directive . createTime . substring ( 0 , 10 ) } }
2025-05-07 14:04:02 +08:00
< / a - c o l >
< / a - r o w >
< / a - c o l >
< / a - r o w >
2025-04-03 09:44:14 +08:00
< div
2025-05-14 10:41:21 +08:00
style = "float:right;bottom: 20px;z-index: 999;padding: 8px 16px;border-radius: 4px;display: flex;align-items: center;" >
2025-04-03 09:44:14 +08:00
< span style = "margin-right: 10px;" > 共 { { tableData . total } } 条数据 < / span >
< Pagination showLessItems v -model :current ="pageParams.pageNo" :pageSize ="pageParams.pageSize" size = "small"
show - quick - jumper : total = "tableData.total" @ change = "queryList" / >
< / div >
2025-03-24 14:59:31 +08:00
< / div >
2025-03-26 15:36:35 +08:00
<!-- 表单区域 -- >
< DirectivePackageModal ref = "registerModal" @success ="handleSuccess" > < / DirectivePackageModal >
2025-03-24 14:59:31 +08:00
< / template >
< script lang = "ts" name = "directivePackage-directivePackage" setup >
2025-03-26 15:36:35 +08:00
import { ref , reactive , onMounted } from 'vue' ;
2025-03-24 14:59:31 +08:00
import DirectivePackageModal from './components/DirectivePackageModal.vue'
2025-03-28 16:44:40 +08:00
import { list , queryById , deleteOne } from './DirectivePackage.api'
2025-04-03 09:44:14 +08:00
import { Pagination } from 'ant-design-vue' ;
2025-07-15 08:41:14 +08:00
import { defHttp } from '/@/utils/http/axios' ;
2025-03-24 14:59:31 +08:00
const registerModal = ref ( ) ;
2025-03-26 15:36:35 +08:00
const searchForm = ref ( { } )
const tableData = ref ( { } )
2025-03-24 14:59:31 +08:00
const labelCol = reactive ( {
2025-05-13 15:34:20 +08:00
xs : 24 ,
sm : 6 ,
xl : 6 ,
xxl : 6
} ) ;
const wrapperCol = reactive ( {
xs : 24 ,
sm : 24 ,
} ) ;
2025-07-15 08:41:14 +08:00
const pageParams = ref ( { pageNo : 1 , pageSize : 18 } )
//启用停用
function handleChangeIzEnabled ( record ) {
var izEnabled = record . izEnabled == '0' ? '1' : '0' ;
var params = { id : record . id , izEnabled } ;
defHttp . post ( { url : '/services/directivePackage/directivePackage/edit' , params } ) . then ( ( res ) => {
searchQuery ( )
} ) ;
}
2025-03-24 14:59:31 +08:00
/ * *
2025-03-26 15:36:35 +08:00
* 搜索
2025-03-24 14:59:31 +08:00
* /
2025-03-26 15:36:35 +08:00
function searchQuery ( ) {
2025-05-14 10:41:21 +08:00
pageParams . value . pageNo = 1
queryList ( )
2025-03-24 14:59:31 +08:00
}
/ * *
2025-03-26 15:36:35 +08:00
* 重置
2025-03-24 14:59:31 +08:00
* /
2025-03-26 15:36:35 +08:00
function searchReset ( ) {
searchForm . value = { }
2025-05-14 10:41:21 +08:00
pageParams . value . pageNo = 1
queryList ( )
2025-03-24 14:59:31 +08:00
}
/ * *
2025-03-26 15:36:35 +08:00
* 新增
2025-03-24 14:59:31 +08:00
* /
2025-03-26 15:36:35 +08:00
function handleAdd ( ) {
2025-03-24 14:59:31 +08:00
registerModal . value . disableSubmit = false ;
2025-03-26 15:36:35 +08:00
registerModal . value . add ( ) ;
2025-03-24 14:59:31 +08:00
}
/ * *
* 成功回调
* /
function handleSuccess ( ) {
2025-05-14 10:41:21 +08:00
queryList ( )
2025-03-24 14:59:31 +08:00
}
/ * *
2025-03-26 15:36:35 +08:00
* 数据查询
2025-03-24 14:59:31 +08:00
* /
2025-04-03 09:44:14 +08:00
function queryList ( ) {
list ( { pageNo : pageParams . value . pageNo , pageSize : pageParams . value . pageSize , packageName : searchForm . value . packageName } ) . then ( res => {
2025-03-26 15:36:35 +08:00
tableData . value = res
} )
2025-03-24 14:59:31 +08:00
}
/ * *
2025-03-26 15:36:35 +08:00
* 编辑
* @ param data
2025-03-24 14:59:31 +08:00
* /
2025-03-26 15:36:35 +08:00
function packageEdit ( data ) {
queryById ( { id : data . id } ) . then ( item => {
registerModal . value . edit ( item ) ;
} )
2025-03-24 14:59:31 +08:00
}
/ * *
2025-03-26 15:36:35 +08:00
* 移除
* @ param data
2025-03-24 14:59:31 +08:00
* /
2025-03-26 15:36:35 +08:00
function remove ( data ) {
2025-03-28 16:44:40 +08:00
deleteOne ( { id : data . id } , handleSuccess ( ) )
2025-03-26 15:36:35 +08:00
}
2025-03-24 14:59:31 +08:00
2025-03-26 15:36:35 +08:00
onMounted ( ( ) => {
2025-05-14 10:41:21 +08:00
queryList ( )
2025-03-26 15:36:35 +08:00
} )
2025-03-24 14:59:31 +08:00
< / script >
< style lang = "less" scoped >
. jeecg - basic - table - form - container {
padding : 0 ;
. table - page - search - submitButtons {
display : block ;
margin - bottom : 24 px ;
white - space : nowrap ;
}
. query - group - cust {
min - width : 100 px ! important ;
}
. query - group - split - cust {
width : 30 px ;
display : inline - block ;
text - align : center
}
. ant - form - item : not ( . ant - form - item - with - help ) {
margin - bottom : 16 px ;
height : 32 px ;
}
: deep ( . ant - picker ) ,
: deep ( . ant - input - number ) {
width : 100 % ;
}
}
2025-05-07 14:04:02 +08:00
. bjclass {
text - align : center ;
2025-05-14 10:41:21 +08:00
margin - top : 24 px ;
2025-05-07 14:04:02 +08:00
border - radius : 50 % ;
width : 60 px ;
height : 60 px ;
background : linear - gradient ( to bottom , # fff , # efe9e9 ) ;
2025-05-14 10:41:21 +08:00
margin - left : 9 px ;
2025-05-07 14:04:02 +08:00
}
. titleOne {
2025-07-15 08:41:14 +08:00
text - align : center ;
2025-05-07 14:04:02 +08:00
font - size : 16 px ;
font - weight : 600 ;
}
. ellipsis - two - lines {
display : - webkit - box ;
- webkit - box - orient : vertical ;
2025-07-15 08:41:14 +08:00
- webkit - line - clamp : 1 ; /* 限制文本为2行 */
2025-05-07 14:04:02 +08:00
overflow : hidden ;
text - overflow : ellipsis ;
2025-07-15 08:41:14 +08:00
}
. cardDivClass {
transition : all 0.3 s ease ;
position : relative ;
padding : 5 px ; background - color : white ; border - radius : 8 px ; height : 180 px ;
box - shadow : 4 px 4 px 6 px rgba ( 0 , 0 , 0 , 0.1 ) ;
}
. cardDivClass : hover {
padding : 5 px ; background - color : # f4fcff ; border - radius : 8 px ; height : 180 px ;
box - shadow :
0 0 0 2 px # d3d3d3 , /* 描边 */
0 4 px 8 px rgba ( 0 , 0 , 0 , 0.1 ) ; /* 阴影 */
transform : translate ( - 2 px , - 2 px ) ; /* 轻微上浮效果 */
}
. iconEditClass {
position : absolute ; top : 0 ; right : 54 px ; background : # dfdfdf ; border - radius : 50 % ; width : 25 px ; height : 25 px ; display : flex ; justify - content : center ; align - items : center ; align - items : center ;
2025-05-07 14:04:02 +08:00
}
2025-03-24 14:59:31 +08:00
< / style >