243 lines
7.2 KiB
Vue
243 lines
7.2 KiB
Vue
<template>
|
|
<div class="p-2">
|
|
<!--查询区域-->
|
|
<div class="jeecg-basic-table-form-container">
|
|
<a-form ref="formRef" :model="searchForm" :label-col="labelCol" :wrapper-col="wrapperCol">
|
|
<a-row :gutter="24">
|
|
<a-col :lg="6">
|
|
<a-form-item name="packageName">
|
|
<template #label><span title="服务指令包名称">服务指令包</span></template>
|
|
<a-input v-model:value="searchForm.packageName" allow-clear />
|
|
</a-form-item>
|
|
</a-col>
|
|
<a-col :lg="6" :sm="24">
|
|
<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-button>
|
|
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd"
|
|
style="margin-left: 8px">新增</a-button>
|
|
</a-col>
|
|
</span>
|
|
</a-col>
|
|
</a-row>
|
|
</a-form>
|
|
</div>
|
|
<a-row>
|
|
<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-col>
|
|
<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="停" />
|
|
</span>
|
|
</a-col>
|
|
</a-row>
|
|
</a-col>
|
|
<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-popover>
|
|
</a-col>
|
|
<a-col :span="24">
|
|
<a-divider style="margin: 10px 0 5px 0;"/>
|
|
</a-col>
|
|
<a-col :span="12" style="padding: 0px 10px">
|
|
{{ directive.createBy_dictText }}
|
|
</a-col>
|
|
<a-col :span="12" style="text-align: right;padding: 0px 10px;">
|
|
{{ directive.createTime.substring(0,10) }}
|
|
</a-col>
|
|
</a-row>
|
|
</a-col>
|
|
</a-row>
|
|
<div
|
|
style="float:right;bottom: 20px;z-index: 999;padding: 8px 16px;border-radius: 4px;display: flex;align-items: center;">
|
|
<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>
|
|
</div>
|
|
<!-- 表单区域 -->
|
|
<DirectivePackageModal ref="registerModal" @success="handleSuccess"></DirectivePackageModal>
|
|
</template>
|
|
|
|
<script lang="ts" name="directivePackage-directivePackage" setup>
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
import DirectivePackageModal from './components/DirectivePackageModal.vue'
|
|
import { list, queryById, deleteOne } from './DirectivePackage.api'
|
|
import { Pagination } from 'ant-design-vue';
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
|
const registerModal = ref();
|
|
const searchForm = ref({})
|
|
const tableData = ref({})
|
|
const labelCol = reactive({
|
|
xs:24,
|
|
sm:6,
|
|
xl:6,
|
|
xxl:6
|
|
});
|
|
const wrapperCol = reactive({
|
|
xs: 24,
|
|
sm: 24,
|
|
});
|
|
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()
|
|
});
|
|
}
|
|
/**
|
|
* 搜索
|
|
*/
|
|
function searchQuery() {
|
|
pageParams.value.pageNo = 1
|
|
queryList()
|
|
}
|
|
|
|
/**
|
|
* 重置
|
|
*/
|
|
function searchReset() {
|
|
searchForm.value = {}
|
|
pageParams.value.pageNo = 1
|
|
queryList()
|
|
}
|
|
|
|
/**
|
|
* 新增
|
|
*/
|
|
function handleAdd() {
|
|
registerModal.value.disableSubmit = false;
|
|
registerModal.value.add();
|
|
}
|
|
/**
|
|
* 成功回调
|
|
*/
|
|
function handleSuccess() {
|
|
queryList()
|
|
}
|
|
|
|
/**
|
|
* 数据查询
|
|
*/
|
|
function queryList() {
|
|
list({ pageNo: pageParams.value.pageNo, pageSize: pageParams.value.pageSize, packageName: searchForm.value.packageName }).then(res => {
|
|
tableData.value = res
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 编辑
|
|
* @param data
|
|
*/
|
|
function packageEdit(data) {
|
|
queryById({ id: data.id }).then(item => {
|
|
registerModal.value.edit(item);
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 移除
|
|
* @param data
|
|
*/
|
|
function remove(data) {
|
|
deleteOne({ id: data.id }, handleSuccess())
|
|
}
|
|
|
|
onMounted(() => {
|
|
queryList()
|
|
})
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.jeecg-basic-table-form-container {
|
|
padding: 0;
|
|
|
|
.table-page-search-submitButtons {
|
|
display: block;
|
|
margin-bottom: 24px;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.query-group-cust {
|
|
min-width: 100px !important;
|
|
}
|
|
|
|
.query-group-split-cust {
|
|
width: 30px;
|
|
display: inline-block;
|
|
text-align: center
|
|
}
|
|
|
|
.ant-form-item:not(.ant-form-item-with-help) {
|
|
margin-bottom: 16px;
|
|
height: 32px;
|
|
}
|
|
|
|
:deep(.ant-picker),
|
|
:deep(.ant-input-number) {
|
|
width: 100%;
|
|
}
|
|
}
|
|
.bjclass{
|
|
text-align: center;
|
|
margin-top: 24px;
|
|
border-radius: 50%;
|
|
width: 60px;
|
|
height: 60px;
|
|
background: linear-gradient(to bottom, #fff, #efe9e9);
|
|
margin-left: 9px;
|
|
}
|
|
.titleOne {
|
|
text-align: center;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
}
|
|
.ellipsis-two-lines {
|
|
display: -webkit-box;
|
|
-webkit-box-orient: vertical;
|
|
-webkit-line-clamp: 1; /* 限制文本为2行 */
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
.cardDivClass{
|
|
transition: all 0.3s ease;
|
|
position: relative;
|
|
padding: 5px;background-color: white;border-radius: 8px;height: 180px;
|
|
box-shadow: 4px 4px 6px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.cardDivClass:hover{
|
|
padding: 5px;background-color: #f4fcff;border-radius: 8px;height: 180px;
|
|
box-shadow:
|
|
0 0 0 2px #d3d3d3, /* 描边 */
|
|
0 4px 8px rgba(0, 0, 0, 0.1); /* 阴影 */
|
|
transform: translate(-2px , -2px); /* 轻微上浮效果 */
|
|
}
|
|
|
|
.iconEditClass{
|
|
position:absolute;top:0;right:54px;background: #dfdfdf;border-radius:50%;width: 25px;height: 25px;display:flex;justify-content: center;align-items: center;align-items: center;
|
|
}
|
|
</style>
|