Quellcode durchsuchen

增加查看按钮

DESKTOP-2S67K1S\31396 vor 2 Jahren
Ursprung
Commit
8473b158d6

+ 6 - 4
src/views/operation/channel/detail.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <!-- 表单 -->
-    <el-form class="form" label-width="100px">
+    <el-form class="form" label-width="100px" :disabled="isRead">
       <el-row>
         <el-col :span="12">
           <el-form-item label="频道名称:">
@@ -14,7 +14,7 @@
             </el-select>
           </el-form-item>
           <el-form-item label="频道封面:">
-            <Upload listType="picture-card" :url="form.pic" @upload="getUpload" />
+            <Upload listType="picture-card" :url="form.pic" @upload="getUpload" :disabled="isRead" />
           </el-form-item>
         </el-col>
         <el-col :span="12">
@@ -51,7 +51,7 @@
     <!-- 按钮 -->
     <div class="form-btn">
       <el-button @click="cancel">取消</el-button>
-      <el-button type="primary" @click="submit">提交</el-button>
+      <el-button v-if="!isRead" type="primary" @click="submit">提交</el-button>
     </div>
     <!-- 弹窗 -->
     <Dialog :visible="dialogVisible" :data="form.list" :channelType="form.channelType" @close="close" />
@@ -83,7 +83,9 @@ export default {
         { value: 8, label: '专辑' },
         { value: 16, label: '猫王音乐台' },
         { value: 17, label: '猫王精选电台' }
-      ]
+      ],
+      // 只读
+      isRead: Boolean(this.$route.query.boolean)
     }
   },
   mounted() {

+ 24 - 20
src/views/operation/channel/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <!-- 新增 -->
-    <el-button type="primary" icon="el-icon-plus" size="mini" @click="getDialog()"
+    <el-button type="primary" icon="el-icon-plus" size="mini" @click="getDialog('新增')"
       v-hasPermi="['operation:channel:add']">
       新增频道配置
     </el-button>
@@ -13,7 +13,8 @@
       <el-table-column label="设备" prop="deviceIds" align="center" :formatter="devFormatter" show-overflow-tooltip />
       <el-table-column label="操作" align="center">
         <template slot-scope="scope">
-          <el-button type="text" @click="getDialog(scope.row, scope.$index)"
+          <el-button type="text" @click="getDialog('查看', scope.row, scope.$index, true)">查看</el-button>
+          <el-button type="text" @click="getDialog('编辑', scope.row, scope.$index)"
             v-hasPermi="['operation:channel:edit']">编辑</el-button>
           <el-button v-if="scope.$index !== 0" type="delete" @click="getDelete(scope.row)"
             v-hasPermi="['operation:channel:delete']">
@@ -23,18 +24,18 @@
       </el-table-column>
     </el-table>
     <!-- 弹窗 -->
-    <el-dialog :visible.sync="dialogVisible" :title="title" width="950px">
+    <el-dialog :visible.sync="dialogVisible" :title="title" width="950px" :before-close="cancel">
       <el-form label-width="auto">
         <el-form-item v-if="index !== 1" label="频道配置名称:" style="width: 300px">
-          <el-input v-model="dialogForm.name" placeholder="请输入规则名称" />
+          <el-input v-model="dialogForm.name" placeholder="请输入规则名称" :disabled="disabled" />
         </el-form-item>
         <el-form-item v-if="index !== 1" label="关联设备:">
-          <el-select v-model="ids" filterable multiple placeholder="请选择关联设备">
+          <el-select v-model="ids" filterable multiple placeholder="请选择关联设备" :disabled="disabled">
             <el-option v-for="item in devOptions" :key="item.clientTypeId" :value="item.clientTypeId.toString()"
               :label="item.name" />
           </el-select>
         </el-form-item>
-        <el-form-item v-if="title === '编辑'" label="内容列表:" style="height: 500px; overflow-y: auto;">
+        <el-form-item v-if="title !== '新增'" label="内容列表:" style="height: 500px; overflow-y: auto;">
           <el-table :data="list" v-loading="dialog_loading" lazy :default-sort="{ prop: 'sort' }">
             <el-table-column label="序号" prop="sort" align="center" width="100px" />
             <el-table-column label="频道数" prop="channelId" align="center" width="100px" />
@@ -47,11 +48,12 @@
             <el-table-column label="频道简介" prop="description" align="center" show-overflow-tooltip />
             <el-table-column label="操作" align="center">
               <template slot-scope="scope">
-                <el-button type="text" @click="edit(scope)">编辑</el-button>
+                <el-button type="text" @click="edit(scope, true)">查看</el-button>
+                <el-button type="text" @click="edit(scope)" :disabled="disabled">编辑</el-button>
                 <el-button v-if="scope.row.sort > 3" type="text" icon="el-icon-caret-top"
-                  @click="getChange(scope.row.id, scope.row.sort - 1)" />
+                  @click="getChange(scope.row.id, scope.row.sort - 1)" :disabled="disabled" />
                 <el-button v-if="scope.row.sort > 2 && scope.row.sort < 12" type="text" icon="el-icon-caret-bottom"
-                  @click="getChange(scope.row.id, scope.row.sort + 1)" />
+                  @click="getChange(scope.row.id, scope.row.sort + 1)" :disabled="disabled" />
               </template>
             </el-table-column>
           </el-table>
@@ -100,7 +102,9 @@ export default {
       }, {
         value: 1,
         label: '绑定特定设备'
-      }]
+      }],
+      // 只读
+      disabled: false
     };
   },
   watch: {
@@ -140,14 +144,15 @@ export default {
     },
 
     // 编辑
-    edit(e) {
+    edit(e, boolean) {
       this.dialogVisible = false
       this.$router.push({
         path: `/operation/channel/detail`,
         query: {
           channelId: e.row.id,
           audioType: e.row.channelType,
-          index: e.$index
+          index: e.$index,
+          boolean: boolean
         }
       })
     },
@@ -167,31 +172,28 @@ export default {
     },
 
     // 弹窗
-    getDialog(row, index) {
+    getDialog(title, row, index, boolean) {
       this.dialogVisible = true
+      this.title = title
       this.index = index + 1
       this.obj = row
+      this.disabled = boolean
       // 新增 / 编辑时的设备
       devList(0).then(res => {
         if (res.code === 0) {
           this.devOptions = res.data
-          if (this.title === '编辑') {
+          if (this.title !== '新增') {
             this.devOptions.unshift.apply(this.devOptions, row.deviceList)
           }
         }
       })
 
-      if (row) {
-        this.title = '编辑'
+      if (title !== '新增') {
         this.dialogForm = row
         if (this.index !== 1) {
           this.ids = this.dialogForm.deviceIds.split(',')
         }
         this.getPage(row)
-      } else {
-        this.ids = []
-        this.dialogForm = {}
-        this.title = '新增'
       }
     },
 
@@ -246,6 +248,8 @@ export default {
     // 取消
     cancel() {
       this.dialogVisible = false
+      this.ids = []
+      this.dialogForm = {}
       this.getList()
     },
 

+ 6 - 4
src/views/operation/startPage/detail.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="form" :rules="rules" ref="form" label-width="auto">
+    <el-form :model="form" :rules="rules" ref="form" label-width="auto" :disabled="isRead">
       <el-form-item label="启动页名称:" prop="name">
         <el-input v-model="form.name" placeholder="请输入启动页名称" />
       </el-form-item>
@@ -28,12 +28,12 @@
         <el-input v-model="form.forwardUrl" placeholder="请输入跳转地址" />
       </el-form-item>
       <el-form-item label="启动页图片:" prop="pic">
-        <Upload listType="picture-card" measure="375*812" :url="form.pic" @upload="getUpload" />
+        <Upload listType="picture-card" measure="375*812" :url="form.pic" @upload="getUpload" :disabled="isRead" />
       </el-form-item>
     </el-form>
     <div class="form-btn">
       <el-button @click="cancel">取消</el-button>
-      <el-button type="primary" @click="getSubmit">提交</el-button>
+      <el-button v-if="!isRead" type="primary" @click="getSubmit">提交</el-button>
     </div>
   </div>
 </template>
@@ -114,7 +114,9 @@ export default {
       }, {
         value: 1,
         label: '不允许'
-      }]
+      }],
+      // 只读
+      isRead: Boolean(this.$route.query.boolean)
     }
   },
   watch: {

+ 4 - 2
src/views/operation/startPage/index.vue

@@ -36,6 +36,7 @@
       <el-table-column label="当前状态" prop="currentStatus" align="center" :formatter="currentFormatter" />
       <el-table-column label="操作" align="center">
         <template slot-scope="scope">
+          <el-button type="text" @click="getDetail(scope.row, true)">查看</el-button>
           <el-button type="text" @click="getDetail(scope.row)" v-hasPermi="['operation:startPage:edit']">编辑</el-button>
           <el-button type="delete" @click="getDelete(scope.row)"
             v-hasPermi="['operation:startPage:delete']">删除</el-button>
@@ -107,11 +108,12 @@ export default {
     },
 
     // 新增 编辑
-    getDetail(row) {
+    getDetail(row, boolean) {
       this.$router.push({
         path: '/operation/startPage/detail',
         query: {
-          id: row.id
+          id: row.id,
+          boolean: boolean
         }
       })
     },

+ 6 - 4
src/views/operation/waken/detail.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-form :model="form" ref="form" :rules="rules" label-width="110px">
+    <el-form :model="form" ref="form" :rules="rules" label-width="110px" :disabled="disabled">
       <el-form-item label="唤醒音名称:" prop="name">
         <el-input v-model="form.name" placeholder="请输入唤醒音名称" />
       </el-form-item>
@@ -16,7 +16,7 @@
         </el-select>
       </el-form-item>
       <el-form-item label="唤醒音封面:" prop="pic">
-        <Upload listType="picture-card" :url="form.pic" @upload="upload" />
+        <Upload listType="picture-card" :url="form.pic" @upload="upload" :disabled="disabled" />
       </el-form-item>
       <el-form-item label="唤醒音内容:" style="width: 1000px">
         <el-button type="primary" icon="el-icon-plus" :disabled="!form.attributeType" @click="getDialog">
@@ -43,7 +43,7 @@
     </el-form>
     <div style="margin-left: 110px">
       <el-button @click="cancel">取消</el-button>
-      <el-button type="primary" @click="getSubmit">确定</el-button>
+      <el-button v-if="!disabled" type="primary" @click="getSubmit">确定</el-button>
     </div>
 
     <!-- 弹窗 -->
@@ -155,7 +155,9 @@ export default {
         pic: [{
           required: true, message: '请上传封面', trigger: 'change'
         }]
-      }
+      },
+      // 只读
+      disabled: Boolean(this.$route.query.boolean)
     }
   },
   watch: {

+ 5 - 4
src/views/operation/waken/index.vue

@@ -15,6 +15,7 @@
       <el-table-column label="关联内容数" align="center" prop="num" />
       <el-table-column label="操作" align="center">
         <template slot-scope="scope">
+          <el-button type="text" @click="getDetail(scope.row.id, true)">查看</el-button>
           <el-button type="text" @click="getDetail(scope.row.id)" v-hasPermi="['operation:waken:edit']">
             编辑
           </el-button>
@@ -68,11 +69,12 @@ export default {
     },
 
     // 详情
-    getDetail(id) {
+    getDetail(id, boolean) {
       this.$router.push({
         path: `/operation/waken/detail`,
         query: {
-          id: id
+          id: id,
+          boolean: boolean
         }
       })
     },
@@ -99,5 +101,4 @@ export default {
 }
 </script>
 
-<style lang="scss" scoped>
-</style>
+<style lang="scss" scoped></style>