Pārlūkot izejas kodu

增加项目管理中的按钮列表权限

yanglzh 3 mēneši atpakaļ
vecāks
revīzija
a3c56d5524

+ 3 - 3
src/views/iot/projects/detail/device.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="tab-content h-full">
-    <div class="subtitle"><span></span> <el-button type="primary" size="small" @click="addDevice()">添加设备</el-button></div>
+    <div class="subtitle"><span></span> <el-button type="primary" v-auth="'add'" size="small" @click="addDevice()">添加设备</el-button></div>
     <el-table :data="tableData" style="width: 100%" v-loading="loading" max-height="calc(100vh - 280px)">
       <el-table-column label="标识" prop="key" min-width="150" show-overflow-tooltip v-col="'key'">
         <template #default="{ row }">
@@ -21,8 +21,8 @@
       <el-table-column prop="desc" label="说明" show-overflow-tooltip v-col="'desc'"></el-table-column>
       <el-table-column label="操作" width="120" align="center">
         <template #default="scope">
-          <el-button size="small" text type="primary" v-auth="'xxx'" @click="$router.push('/iotmanager/device/instance/' + scope.row.key)">设备详情</el-button>
-          <el-button size="small" text type="warning" v-auth="'xxx'" @click="onDel(scope.row)">解绑</el-button>
+          <el-button size="small" text type="primary" v-auth="'detail'" @click="$router.push('/iotmanager/device/instance/' + scope.row.key)">设备详情</el-button>
+          <el-button size="small" text type="warning" v-auth="'del'" @click="onDel(scope.row)">解绑</el-button>
         </template>
       </el-table-column>
     </el-table>

+ 1 - 1
src/views/iot/projects/detail/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="page">
     <el-card shadow="nover" class="small-padding">
-      <el-tabs :model-value="'3'" size="small" class="h-full">
+      <el-tabs :model-value="'0'" size="small" class="h-full">
         <el-tab-pane label="项目概况" name="0" lazy>
           <InfoVue></InfoVue>
         </el-tab-pane>

+ 1 - 1
src/views/iot/projects/detail/info.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="tab-content" v-loading="laoding">
-    <div class="subtitle"><span></span> <el-button type="primary" size="small" @click="edit()">编辑</el-button></div>
+    <div class="subtitle"><span></span> <el-button type="primary" v-auth="'edit'" size="small" @click="edit()">编辑</el-button></div>
     <el-descriptions class="margin-top" :column="2" border>
       <el-descriptions-item label="项目名称">{{ data.name }} </el-descriptions-item>
       <el-descriptions-item label="关键客户">{{ data.customName }} </el-descriptions-item>

+ 3 - 3
src/views/iot/projects/detail/scene.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="tab-content h-full">
-    <div class="subtitle"><span></span> <el-button type="primary" size="small" @click="addDevice()">添加场景</el-button></div>
+    <div class="subtitle"><span></span> <el-button type="primary" v-auth="'add'" size="small" @click="addDevice()">添加场景</el-button></div>
     <el-table :data="tableData" style="width: 100%" v-loading="loading" max-height="calc(100vh - 280px)">
       <el-table-column prop="id" label="ID" min-width="100" show-overflow-tooltip></el-table-column>
       <el-table-column prop="name" label="场景名称" show-overflow-tooltip></el-table-column>
@@ -22,8 +22,8 @@
       <el-table-column prop="createdAt" label="创建时间" width="160" align="center"></el-table-column>
       <el-table-column label="操作" width="120" align="center">
         <template #default="scope">
-          <el-button size="small" text type="primary" v-auth="'xxx'" @click="$router.push('/iotmanager/scene/manage/' + scope.row.id)">场景详情</el-button>
-          <el-button size="small" text type="warning" v-auth="'xxx'" @click="onDel(scope.row)">解绑</el-button>
+          <el-button size="small" text type="primary" v-auth="'detail'" @click="$router.push('/iotmanager/scene/manage/' + scope.row.id)">场景详情</el-button>
+          <el-button size="small" text type="warning" v-auth="'del'" @click="onDel(scope.row)">解绑</el-button>
         </template>
       </el-table-column>
     </el-table>

+ 4 - 4
src/views/iot/projects/detail/topo.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="tab-content h-full">
-    <div class="subtitle"><span></span> <el-button type="primary" size="small" @click="addDevice()">添加组态</el-button></div>
+    <div class="subtitle"><span></span> <el-button type="primary" v-auth="'add'" size="small" @click="addDevice()">添加组态</el-button></div>
     <el-table :data="tableData" style="width: 100%" v-loading="loading" max-height="calc(100vh - 280px)">
       <el-table-column prop="id" label="ID" width="100" show-overflow-tooltip></el-table-column>
       <el-table-column prop="name" label="组态图名称" show-overflow-tooltip></el-table-column>
@@ -8,9 +8,9 @@
       <el-table-column prop="updatedAt" label="更新时间" min-width="100" align="center"></el-table-column>
       <el-table-column label="操作" width="170" align="center">
         <template #default="scope">
-          <el-button size="small" text type="primary" v-if="!scope.row.folderName" @click="view(scope.row)">预览</el-button>
-          <el-button size="small" text type="primary" @click="edit(scope.row)">编辑组态图</el-button>
-          <el-button size="small" text type="warning" v-auth="'xxx'" @click="onDel(scope.row)">解绑</el-button>
+          <el-button size="small" text type="primary" v-auth="'detail'" v-if="!scope.row.folderName" @click="view(scope.row)">预览</el-button>
+          <el-button size="small" text type="primary" v-auth="'edit'" @click="edit(scope.row)">编辑组态图</el-button>
+          <el-button size="small" text type="warning" v-auth="'del'" @click="onDel(scope.row)">解绑</el-button>
         </template>
       </el-table-column>
     </el-table>

+ 3 - 3
src/views/iot/projects/detail/video.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="tab-content h-full">
-    <div class="subtitle"><span></span> <el-button type="primary" size="small" @click="addDevice()">添加监控</el-button></div>
+    <div class="subtitle"><span></span> <el-button type="primary" v-auth="'add'" size="small" @click="addDevice()">添加监控</el-button></div>
     <el-table :data="tableData" style="width: 100%" v-loading="loading" max-height="calc(100vh - 280px)">
       <el-table-column prop="DeviceName" label="设备名称" min-width="130" align="center" show-overflow-tooltip></el-table-column>
       <el-table-column prop="DeviceID" label="设备ID" min-width="210" align="center" show-overflow-tooltip></el-table-column>
@@ -14,8 +14,8 @@
       <el-table-column prop="UpdateTime" label="更新时间" :formatter="formatTime" width="170" align="center" show-overflow-tooltip></el-table-column>
       <el-table-column label="操作" width="120" align="center" fixed="right">
         <template #default="scope">
-          <el-button size="small" text type="primary" v-auth="'xxx'" @click="view(scope.row)">查看监控</el-button>
-          <el-button size="small" text type="warning" v-auth="'xxx'" @click="onDel(scope.row)">解绑</el-button>
+          <el-button size="small" text type="primary" v-auth="'detail'" @click="view(scope.row)">查看监控</el-button>
+          <el-button size="small" text type="warning" v-auth="'del'" @click="onDel(scope.row)">解绑</el-button>
         </template>
       </el-table-column>
     </el-table>

+ 2 - 2
src/views/iot/projects/filter/bindDevice.vue

@@ -7,14 +7,14 @@
       <el-descriptions-item label="更新时间">{{ data.updatedAt }}</el-descriptions-item>
     </el-descriptions>
     <el-divider content-position="left" style="margin-top: 30px;">绑定设备</el-divider>
-    <div class="flex-row"><span></span> <el-button type="primary" size="small" @click="addOrEdit(data.code)">绑定设备</el-button></div>
+    <div class="flex-row"><span></span> <el-button type="primary" size="small" v-auth="'add'" @click="addOrEdit(data.code)">绑定设备</el-button></div>
     <el-table :data="tableData" style="width: 100%;margin-top: 20px;" max-height="50vh" v-loading="loading">
       <el-table-column prop="name" label="设备名称" show-overflow-tooltip></el-table-column>
       <el-table-column prop="key" label="设备编码" align="center" show-overflow-tooltip></el-table-column>
       <el-table-column prop="productName" label="所属产品" align="center"></el-table-column>
       <el-table-column label="操作" width="120" align="center" fixed="right">
         <template #default="{ row }">
-          <el-button size="small" text type="danger" @click="del(row.key)">解绑</el-button>
+          <el-button size="small" text type="danger" v-auth="'del'" @click="del(row.key)">解绑</el-button>
         </template>
       </el-table-column>
     </el-table>

+ 3 - 3
src/views/iot/projects/filter/detail.vue

@@ -7,7 +7,7 @@
       <el-descriptions-item label="更新时间">{{ data.updatedAt }}</el-descriptions-item>
     </el-descriptions>
     <el-divider content-position="left" style="margin-top: 30px;">自定义属性</el-divider>
-    <div class="flex-row"><span></span> <el-button type="primary" size="small" @click="addOrEdit(data.code)">添加自定义属性</el-button></div>
+    <div class="flex-row"><span></span> <el-button type="primary" size="small" v-auth="'add'" @click="addOrEdit(data.code)">添加自定义属性</el-button></div>
     <el-table :data="tableData" style="width: 100%;margin-top: 20px;" v-loading="loading">
       <el-table-column prop="name" label="属性名称" show-overflow-tooltip></el-table-column>
       <el-table-column prop="key" label="属性编码" align="center" show-overflow-tooltip></el-table-column>
@@ -21,8 +21,8 @@
       </el-table-column>
       <el-table-column label="操作" width="120" align="center" fixed="right">
         <template #default="{ row }">
-          <el-button size="small" text type="warning" @click="addOrEdit(data.code, row)">编辑</el-button>
-          <el-button size="small" text type="danger" @click="del(row)">删除</el-button>
+          <el-button size="small" text type="warning" v-auth="'edit'" @click="addOrEdit(data.code, row)">编辑</el-button>
+          <el-button size="small" text type="danger" v-auth="'del'" @click="del(row)">删除</el-button>
         </template>
       </el-table-column>
     </el-table>

+ 22 - 25
src/views/iot/projects/filter/index.vue

@@ -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;

+ 14 - 14
src/views/iot/projects/list/index.vue

@@ -29,13 +29,13 @@
             </el-button>
           </el-form-item>
           <el-form-item>
-            <el-button type="primary" v-auth="'xxx'" @click="addOrEdit()">
+            <el-button type="primary" v-auth="'add'" @click="addOrEdit()">
               <el-icon>
                 <ele-FolderAdd />
               </el-icon>
               新增
             </el-button>
-            <el-button type="danger" v-auth="'xxx'" :disabled="!ids.length" @click="del()">
+            <el-button type="danger" v-auth="'del'" :disabled="!ids.length" @click="del()">
               <el-icon>
                 <ele-Delete />
               </el-icon>
@@ -47,19 +47,19 @@
       <el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange" row-key="id" v-loading="loading">
         <el-table-column type="selection" width="55" align="center" />
         <el-table-column prop="status" label="项目状态" width="100" :formatter="(row: any) => row.status ? '正常' : '禁用'" align="center"></el-table-column>
-        <el-table-column prop="name" label="项目名称" min-width="120" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="address" label="省/市/区/县" :formatter="(row: any) => JSON.parse(row.address)?.name" min-width="200" align="center"></el-table-column>
-        <el-table-column prop="addressDetail" label="详细地址" min-width="100" align="center"></el-table-column>
-        <el-table-column prop="channelMerchants" label="渠道商" min-width="100" align="center"></el-table-column>
-        <el-table-column prop="customName" label="关键客户" min-width="100" align="center"></el-table-column>
-        <el-table-column prop="repairCompany" label="维修公司" min-width="100" align="center"></el-table-column>
-        <el-table-column prop="updatedAt" label="更新时间" width="165" align="center"></el-table-column>
-        <el-table-column label="操作" width="160" align="center" fixed="right">
+        <el-table-column prop="name" v-col="'name'" label="项目名称" min-width="120" show-overflow-tooltip></el-table-column>
+        <el-table-column prop="address" v-col="'address'" label="省/市/区/县" :formatter="(row: any) => JSON.parse(row.address)?.name" min-width="200" align="center"></el-table-column>
+        <el-table-column prop="addressDetail" v-col="'addressDetail'" label="详细地址" min-width="100" align="center"></el-table-column>
+        <el-table-column prop="channelMerchants" v-col="'channelMerchants'" label="渠道商" min-width="100" align="center"></el-table-column>
+        <el-table-column prop="customName" v-col="'customName'" label="关键客户" min-width="100" align="center"></el-table-column>
+        <el-table-column prop="repairCompany" v-col="'repairCompany'" label="维修公司" min-width="100" align="center"></el-table-column>
+        <el-table-column prop="updatedAt" v-col="'updatedAt'" label="更新时间" width="165" align="center"></el-table-column>
+        <el-table-column label="操作" width="160" v-col="'handle'" align="center" fixed="right">
           <template #default="{ row }">
-            <el-button size="small" text style="margin-left: 0;" type="primary" @click="$router.push('/iotmanager/projects/list/' + row.code)">详情</el-button>
-            <el-button size="small" text type="warning" v-auth="'xxx'" @click="addOrEdit(row)">编辑</el-button>
-            <el-button size="small" text type="primary" v-auth="'xxx'" @click="editStatus(row)">{{ row.status ? '禁用' : '启用' }}</el-button>
-            <el-button size="small" text type="danger" v-auth="'xxx'" @click="del(row)">删除</el-button>
+            <el-button size="small" text style="margin-left: 0;" type="primary" v-auth="'detail'" @click="$router.push('/iotmanager/projects/list/' + row.code)">详情</el-button>
+            <el-button size="small" text type="warning" v-auth="'edit'" @click="addOrEdit(row)">编辑</el-button>
+            <el-button size="small" text type="primary" v-auth="'startOrStop'" @click="editStatus(row)">{{ row.status ? '禁用' : '启用' }}</el-button>
+            <el-button size="small" text type="danger" v-auth="'del'" @click="del(row)">删除</el-button>
           </template>
         </el-table-column>
       </el-table>