|
@@ -4,12 +4,10 @@
|
|
|
<div class="search">
|
|
|
<el-form inline>
|
|
|
<el-form-item>
|
|
|
- <el-input v-model="params.keyWord" style="width: 200px;" placeholder="模板名称搜索" @keyup.enter.native="getList(1)" clearable>
|
|
|
- </el-input>
|
|
|
+ <el-input v-model="params.keyWord" style="width: 200px" placeholder="模板名称搜索" @keyup.enter.native="getList(1)" clearable> </el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-input v-model="params.deviceKey" style="width: 200px;" placeholder="设备key搜索" @keyup.enter.native="getList(1)" clearable>
|
|
|
- </el-input>
|
|
|
+ <el-input v-model="params.deviceKey" style="width: 200px" placeholder="设备key搜索" @keyup.enter.native="getList(1)" clearable> </el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-select v-model="params.status" placeholder="请选择转发格式" style="width: 100px">
|
|
@@ -55,8 +53,7 @@
|
|
|
<el-table-column prop="updatedAt" v-col="'updatedAt'" label="更新时间" align="center"></el-table-column>
|
|
|
<el-table-column prop="status" v-col="'status'" label="状态" align="center">
|
|
|
<template #default="scope">
|
|
|
- <el-switch v-model="scope.row.status" inline-prompt :active-value="1" :inactive-value="0" active-text="启" inactive-text="禁" @change="handleStatusChange(scope.row)">
|
|
|
- </el-switch>
|
|
|
+ <el-switch v-model="scope.row.status" inline-prompt :active-value="1" :inactive-value="0" active-text="启" inactive-text="禁" @change="handleStatusChange(scope.row)"> </el-switch>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="220" align="center" fixed="right" v-col="'handle'">
|
|
@@ -77,20 +74,20 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import api from '/@/api/projects';
|
|
|
-import { useSearch } from '/@/hooks/useCommon';
|
|
|
-import { ElMessageBox, ElMessage } from 'element-plus';
|
|
|
-import EditForm from './edit-dialog.vue';
|
|
|
-import detailVue from './detail.vue';
|
|
|
-import bindDevice from './bindDevice.vue';
|
|
|
-import { ref } from 'vue';
|
|
|
+import api from "/@/api/projects";
|
|
|
+import { useSearch } from "/@/hooks/useCommon";
|
|
|
+import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
+import EditForm from "./edit-dialog.vue";
|
|
|
+import detailVue from "./detail.vue";
|
|
|
+import bindDevice from "./bindDevice.vue";
|
|
|
+import { ref } from "vue";
|
|
|
|
|
|
const editFormRef = ref();
|
|
|
const bindDeviceRef = ref();
|
|
|
const detailRef = ref();
|
|
|
const ids = ref<number[]>([]);
|
|
|
|
|
|
-const { params, tableData, getList, loading, resetQuery } = useSearch<any[]>(api.template.list, 'Data', { keyWord: '', deviceKey: '' });
|
|
|
+const { params, tableData, getList, loading, resetQuery } = useSearch<any[]>(api.template.list, "Data", { keyWord: "", deviceKey: "" });
|
|
|
|
|
|
getList();
|
|
|
|
|
@@ -109,29 +106,29 @@ const handleSelectionChange = (selections: any[]) => {
|
|
|
};
|
|
|
|
|
|
const del = (row?: any) => {
|
|
|
- ElMessageBox.confirm(row ? `此操作将模板:“${row.name}”,是否继续?` : `此操作将${ids.value.length}个模板`, '提示', {
|
|
|
- confirmButtonText: '确认',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
+ ElMessageBox.confirm(row ? `此操作将模板:“${row.name}”,是否继续?` : `此操作将${ids.value.length}个模板`, "提示", {
|
|
|
+ confirmButtonText: "确认",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
}).then(async () => {
|
|
|
await api.template.del(row ? [row.id] : ids.value);
|
|
|
- ElMessage.success('删除成功');
|
|
|
+ ElMessage.success("删除成功");
|
|
|
getList(1);
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const handleStatusChange = (row: any) => {
|
|
|
- let text = row.status === 1 ? '启用' : '停用';
|
|
|
- ElMessageBox.confirm('确认要' + text + '模板:【' + row.name + '】吗?', '警告', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
+ let text = row.status === 1 ? "启用" : "停用";
|
|
|
+ ElMessageBox.confirm("确认要" + text + "模板:【" + row.name + "】吗?", "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
})
|
|
|
.then(function () {
|
|
|
return api.template.editStatus({ id: row.id, status: row.status });
|
|
|
})
|
|
|
.then(() => {
|
|
|
- ElMessage.success(text + '成功');
|
|
|
+ ElMessage.success(text + "成功");
|
|
|
})
|
|
|
.catch(function () {
|
|
|
row.status = row.status === 0 ? 1 : 0;
|