Browse Source

no message

DESKTOP-SVI9JE1\muzen 1 year ago
parent
commit
4e82f2bdbc

+ 19 - 14
src/views/business/list/index.vue

@@ -16,7 +16,8 @@
         <el-button type="primary" icon="Search" @click="getSearch">搜索</el-button>
         <el-button icon="Refresh" @click="getRefresh">重置</el-button>
         <el-button type="warning" plain icon="Download" @click="getExport" :disabled="ids === ''">导出</el-button>
-        <el-button type="primary" plain icon="Plus" @click="getDialog()" v-hasPermi="['business:list:add']">新增</el-button>
+        <el-button type="primary" plain icon="Plus" @click="getDialog()"
+          v-hasPermi="['business:list:add']">新增</el-button>
       </el-form-item>
     </el-form>
     <!-- 列表 -->
@@ -37,9 +38,12 @@
       <el-table-column label="创建时间" prop="createTimeStr" align="center"></el-table-column>
       <el-table-column label="操作" align="center">
         <template #default="scope">
-          <el-button type="primary" link @click="getDialog(scope.row.id, '编辑')"  v-hasPermi="['business:list:edit']">编辑</el-button>
-          <el-button type="primary" link @click="getReset(scope.row)" v-hasPermi="['business:list:refresh']">重置密码</el-button>
-          <el-button type="danger" link @click="getDelete(scope.row)" v-hasPermi="['business:list:delete']">删除</el-button>
+          <el-button type="primary" link @click="getDialog(scope.row.id, '编辑')"
+            v-hasPermi="['business:list:edit']">编辑</el-button>
+          <el-button type="primary" link @click="getReset(scope.row)"
+            v-hasPermi="['business:list:refresh']">重置密码</el-button>
+          <el-button type="danger" link @click="getDelete(scope.row)"
+            v-hasPermi="['business:list:delete']">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -76,8 +80,9 @@
           <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand">展开/折叠</el-checkbox>
           <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll">全选/全不选</el-checkbox>
           <el-checkbox v-model="menuCheckStrictly" @change="handleCheckedTreeConnect">父子联动</el-checkbox>
-          <el-tree class="tree-border" :data="data.treeOptions" :props="{ label: 'label', children: 'children' }"
-            show-checkbox ref="menuRef" node-key="id" :check-strictly="!menuCheckStrictly" empty-text="加载中,请稍候" />
+          <el-tree class="tree-border" :data="data.treeOptions" show-checkbox ref="menuRef" node-key="id"
+            :check-strictly="!menuCheckStrictly" empty-text="加载中,请稍候"
+            :props="{ label: 'label', children: 'children' }" />
         </el-form-item>
       </el-form>
       <template #footer>
@@ -152,7 +157,7 @@ const data = reactive({
 
 const menuExpand = ref(false)
 const menuNodeAll = ref(false)
-const menuCheckStrictly = ref(false)
+const menuCheckStrictly = ref(true)
 
 // 总数据
 const total = ref(0)
@@ -221,8 +226,8 @@ const dialogVisible = ref(false)
 const title = ref("新增")
 
 // 打开弹窗
-function getDialog(id, key) {
-  getTree()
+const getDialog = async (id, key) => {
+  await getTree()
   dialogVisible.value = true
   title.value = '新增'
   if (id) {
@@ -247,8 +252,8 @@ function getDetail(id) {
 }
 
 // 新增的菜单权限
-function getTree() {
-  treeselect().then(res => {
+const getTree = async () => {
+  await treeselect().then(res => {
     if (res.code === 0) {
       data.treeOptions = res.data
     }
@@ -264,12 +269,12 @@ function upload(e) {
 function getClose() {
   dialogVisible.value = false
   data.dialogForm = {}
-  menuExpand.value = false
-  menuNodeAll.value = false
-  menuCheckStrictly.value = false
   if (proxy.$refs.menuRef != undefined) {
     proxy.$refs.menuRef.setCheckedKeys([]);
   }
+  menuExpand.value = false
+  menuNodeAll.value = false
+  menuCheckStrictly.value = true
   proxy.$refs.dialogForm.resetFields()
 }
 

+ 8 - 3
src/views/store/devices/index.vue

@@ -82,8 +82,12 @@
             </el-icon>
             <template #dropdown>
               <el-dropdown-menu>
-                <el-dropdown-item @click="getDialog(item.id)" v-hasPermi="['store:devices:edit']">编辑</el-dropdown-item>
-                <el-dropdown-item @click="getDelete(item)" v-hasPermi="['store:devices:delete']">删除</el-dropdown-item>
+                <el-dropdown-item v-if="checkPermi(['store:devices:edit'])" @click="getDialog(item.id)">
+                  编辑
+                </el-dropdown-item>
+                <el-dropdown-item v-if="checkPermi(['store:devices:delete'])" @click="getDelete(item)">
+                  删除
+                </el-dropdown-item>
               </el-dropdown-menu>
             </template>
           </el-dropdown>
@@ -131,6 +135,7 @@
 <script setup>
 import { list, detail, submit, edit, change, remove } from "@/api/store/devices"
 import { useBusinessSelect, useStoreSelect, useDeviceList } from "@/hooks/index"
+import { checkPermi } from "@/utils/permission";
 
 const { businessData, getBusiness, businessRemote } = useBusinessSelect(true)
 getBusiness()
@@ -272,7 +277,7 @@ const getChange = (id, title, status) => {
 const getDelete = (row) => {
   proxy.$modal.confirm(`是否删除设备名称为:${row.deviceName}的数据?`).then(() => {
     remove({ id: row.id }).then(res => {
-      if (res.cdoe === 0) {
+      if (res.code === 0) {
         proxy.$modal.msgSuccess('删除成功!')
         getList()
       }

+ 8 - 6
src/views/store/list/index.vue

@@ -38,15 +38,15 @@
         </el-descriptions-item>
         <el-descriptions-item>
           <el-dropdown class="dropdown" v-hasPermi="['store:list:edit', 'store:list:delete']">
-            <el-icon >
+            <el-icon>
               <MoreFilled />
             </el-icon>
             <template #dropdown>
               <el-dropdown-menu>
-                <el-dropdown-item @click="getDialog(item.id)" v-hasPermi="['store:list:edit']">
+                <el-dropdown-item v-if="checkPermi(['store:list:edit'])" @click="getDialog(item.id)">
                   编辑
                 </el-dropdown-item>
-                <el-dropdown-item @click="getDelete(item)" v-hasPermi="['store:list:delete']">
+                <el-dropdown-item v-if="checkPermi(['store:list:delete'])" @click="getDelete(item)">
                   删除
                 </el-dropdown-item>
               </el-dropdown-menu>
@@ -116,6 +116,8 @@ import { list, detail, remove, submit, edit } from '@/api/store/list'
 
 import { useBusinessSelect, useUserSelect, useGroupSelect, useAreaSelect } from '@/hooks/index'
 
+import { checkPermi } from "@/utils/permission";
+
 const { proxy } = getCurrentInstance()
 
 const { businessData, getBusiness, businessRemote } = useBusinessSelect(true)
@@ -220,9 +222,9 @@ const getDetail = (id) => {
     if (res.code === 0) {
       data.dialogForm = res.data
       data.areaList = [res.data.provinceId, res.data.cityId, res.data.areaId]
-      if(res.data.timeRestList.length < 1) {
+      if (res.data.timeRestList.length < 1) {
         data.timeList = [[]]
-      }else{
+      } else {
         data.timeList = []
       }
       res.data.timeRestList.map(i => {
@@ -268,7 +270,7 @@ const handleChangeTime = (e, index) => {
         endTime: data.timeList[i][1]
       })
     }
-  }else{
+  } else {
     data.dialogForm.timeRestList.splice(index, 1)
   }
 }