|
@@ -1,69 +1,62 @@
|
|
|
<template>
|
|
|
- <div class="ota-module-container">
|
|
|
- <el-card shadow="hover">
|
|
|
- <div class="ota-module-search mb15">
|
|
|
- <el-form :model="tableData.param" ref="queryRef" :inline="true" label-width="68px">
|
|
|
- <el-form-item label="模块名称" prop="name">
|
|
|
- <el-input
|
|
|
- v-model="tableData.param.keyWord"
|
|
|
- placeholder="请输入产品名称"
|
|
|
- clearable
|
|
|
- size="default"
|
|
|
- style="width: 200px;"
|
|
|
- @keyup.enter.native="getList"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="所属产品" prop="productId">
|
|
|
- <el-select v-model="tableData.param.productId" filterable placeholder="请选择产品">
|
|
|
- <el-option v-for="item in productData" :key="item.id" :label="item.name" :value="item.id.toString()" value-key="id"> </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <el-button size="default" type="primary" class="ml10" @click="getList">
|
|
|
- <el-icon>
|
|
|
- <ele-Search />
|
|
|
- </el-icon>
|
|
|
- 查询
|
|
|
- </el-button>
|
|
|
- <el-button size="default" @click="resetQuery(queryRef)">
|
|
|
- <el-icon>
|
|
|
- <ele-Refresh />
|
|
|
- </el-icon>
|
|
|
- 重置
|
|
|
- </el-button>
|
|
|
- <el-button type="primary" v-auth="'add'" @click="onOpenAddDic()">
|
|
|
- <el-icon>
|
|
|
- <ele-FolderAdd />
|
|
|
- </el-icon>
|
|
|
- 添加模块
|
|
|
- </el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </div>
|
|
|
+ <div class="ota-module-container">
|
|
|
+ <el-card shadow="hover">
|
|
|
+ <div class="ota-module-search mb15">
|
|
|
+ <el-form :model="tableData.param" ref="queryRef" :inline="true" label-width="68px" @keyup.enter.native="getList(1)">
|
|
|
+ <el-form-item label="模块名称" prop="name">
|
|
|
+ <el-input v-model="tableData.param.keyWord" placeholder="请输入产品名称" clearable size="default" style="width: 200px;" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属产品" prop="productId">
|
|
|
+ <el-select v-model="tableData.param.productId" filterable placeholder="请选择产品">
|
|
|
+ <el-option v-for="item in productData" :key="item.id" :label="item.name" :value="item.id.toString()" value-key="id"> </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button size="default" type="primary" class="ml10" @click="getList(1)">
|
|
|
+ <el-icon>
|
|
|
+ <ele-Search />
|
|
|
+ </el-icon>
|
|
|
+ 查询
|
|
|
+ </el-button>
|
|
|
+ <el-button size="default" @click="resetQuery(queryRef)">
|
|
|
+ <el-icon>
|
|
|
+ <ele-Refresh />
|
|
|
+ </el-icon>
|
|
|
+ 重置
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" v-auth="'add'" @click="onOpenAddDic()">
|
|
|
+ <el-icon>
|
|
|
+ <ele-FolderAdd />
|
|
|
+ </el-icon>
|
|
|
+ 添加模块
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
|
|
|
- <el-table :data="tableData.data" style="width: 100%" v-loading="tableData.loading">
|
|
|
- <el-table-column label="ID" v-col="'id'" align="center" prop="id" width="60" />
|
|
|
- <el-table-column label="模块名称" v-col="'name'" prop="name" :show-overflow-tooltip="true" />
|
|
|
- <el-table-column label="模块别名" v-col="'nameAs'" prop="nameAs" :show-overflow-tooltip="true" />
|
|
|
- <el-table-column label="所属产品" v-col="'ProductName'" prop="ProductName" width="260" />
|
|
|
- <el-table-column label="创建时间" prop="createdAt" align="center" />
|
|
|
- <el-table-column label="操作" width="100" v-col="'handle'" align="center" fixed="right">
|
|
|
+ <el-table :data="tableData.data" style="width: 100%" v-loading="tableData.loading">
|
|
|
+ <el-table-column label="ID" v-col="'id'" align="center" prop="id" width="60" />
|
|
|
+ <el-table-column label="模块名称" v-col="'name'" prop="name" :show-overflow-tooltip="true" />
|
|
|
+ <el-table-column label="模块别名" v-col="'nameAs'" prop="nameAs" :show-overflow-tooltip="true" />
|
|
|
+ <el-table-column label="所属产品" v-col="'ProductName'" prop="ProductName" width="260" />
|
|
|
+ <el-table-column label="创建时间" prop="createdAt" align="center" />
|
|
|
+ <el-table-column label="操作" width="100" v-col="'handle'" align="center" fixed="right">
|
|
|
<template #default="scope">
|
|
|
<el-button size="small" text type="warning" @click="onOpenEditDic(scope.row)" v-auth="'edit'">修改</el-button>
|
|
|
<el-button size="small" text type="info" @click="onRowDel(scope.row)" v-auth="'del'">删除</el-button>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<pagination v-show="tableData.total > 0" :total="tableData.total" v-model:page="tableData.param.pageNum" v-model:limit="tableData.param.pageSize" @pagination="getList" />
|
|
|
- <EditConfig ref="editDicRef" @getList="getList" />
|
|
|
- </el-card>
|
|
|
- </div>
|
|
|
+ <EditConfig ref="editDicRef" @getList="getList(1)" />
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
import { toRefs, reactive, onMounted, ref, defineComponent, getCurrentInstance } from 'vue';
|
|
|
import api from '/@/api/ota'
|
|
|
-import { ElMessageBox, ElMessage, FormInstance} from 'element-plus'
|
|
|
+import { ElMessageBox, ElMessage, FormInstance } from 'element-plus'
|
|
|
// import EditConfig from './edit.vue'
|
|
|
import EditConfig from '/@/views/iot/ota-update/module/component/edit.vue';
|
|
|
|
|
@@ -99,9 +92,9 @@ export default defineComponent({
|
|
|
const addDicRef = ref();
|
|
|
const editDicRef = ref();
|
|
|
const queryRef = ref();
|
|
|
- const tabDataList = ref([{dictLabel: '全部', dictValue: ''}]);
|
|
|
+ const tabDataList = ref([{ dictLabel: '全部', dictValue: '' }]);
|
|
|
const state = reactive<TableDataState>({
|
|
|
- ids: [],
|
|
|
+ ids: [],
|
|
|
tableData: {
|
|
|
data: [],
|
|
|
total: 0,
|
|
@@ -114,7 +107,7 @@ export default defineComponent({
|
|
|
productId: '',
|
|
|
},
|
|
|
},
|
|
|
- productData: [],
|
|
|
+ productData: [],
|
|
|
});
|
|
|
// 页面加载时
|
|
|
onMounted(() => {
|
|
@@ -124,7 +117,8 @@ export default defineComponent({
|
|
|
const initTableData = () => {
|
|
|
moduleList();
|
|
|
};
|
|
|
- const getList = () => {
|
|
|
+ const getList = (pageNum: number) => {
|
|
|
+ typeof pageNum === 'number' && (state.tableData.param.pageNum = pageNum)
|
|
|
state.tableData.loading = true;
|
|
|
api.module
|
|
|
.getList(state.tableData.param)
|
|
@@ -161,11 +155,11 @@ export default defineComponent({
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning',
|
|
|
}).then(() => {
|
|
|
- api.module.del(ids).then(() => {
|
|
|
- ElMessage.success('删除成功');
|
|
|
- getList();
|
|
|
- });
|
|
|
- })
|
|
|
+ api.module.del(ids).then(() => {
|
|
|
+ ElMessage.success('删除成功');
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ })
|
|
|
.catch(() => { });
|
|
|
};
|
|
|
/** 重置按钮操作 */
|