From 7f89d0b6ce12fd9ad39e501f63e2894b568aad02 Mon Sep 17 00:00:00 2001
From: children117cl <278950112@qq.com>
Date: 星期三, 26 五月 2021 20:16:17 +0800
Subject: [PATCH] demo预留返回按钮、权限判断、objectName、富文本方法、部分注释

---
 src/pages/demo/list.vue |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/pages/demo/list.vue b/src/pages/demo/list.vue
index 5da8489..1e93e40 100644
--- a/src/pages/demo/list.vue
+++ b/src/pages/demo/list.vue
@@ -1,5 +1,8 @@
 <template>
   <div class="app-container">
+    <!-- 杩斿洖鎸夐挳鍜屾爣棰� -->
+    <!-- <el-page-header class="mb20" content="xx" @back="$router.go(-1)" /> -->
+
     <!-- 鎼滅储鍖� 鈫撯啌鈫撯啌鈫撯啌鈫撯啌鈫撯啌 -->
     <el-form v-show="showSearch" ref="searchForm" :inline="true">
       <el-form-item label="瑙掕壊鍚嶇О">
@@ -22,6 +25,7 @@
 
     <!-- 鎿嶄綔鍖� 鈫撯啌鈫撯啌鈫撯啌鈫撯啌鈫撯啌 -->
     <el-row :gutter="10" class="mb8">
+      <!-- 鏉冮檺鍒ゆ柇 v-if="getAuthValueFN('xxx_add')" -->
       <el-col :span="1.5">
         <el-button
           type="primary"
@@ -48,6 +52,7 @@
       <el-table-column label="瑙掕壊鍚嶇О" prop="name" align="center" min-width="120" />
       <el-table-column label="鏄惁涓婃灦" prop="isUp" align="center" min-width="100">
         <template slot-scope="scope">
+          <!-- 鏉冮檺鍒ゆ柇 v-if="getAuthValueFN('xxx_edit')" -->
           <el-switch
             v-model="scope.row.isUp"
             :active-value="1"
@@ -59,12 +64,14 @@
       <el-table-column label="鍒涘缓鏃堕棿" prop="createTime" align="center" min-width="160" />
       <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" width="120" fixed="right">
         <template slot-scope="scope">
+          <!-- 鏉冮檺鍒ゆ柇 v-if="getAuthValueFN('xxx_edit')" -->
           <el-button
             size="mini"
             type="text"
             icon="el-icon-edit"
             @click="showEditDialog(scope.row)"
           >缂栬緫</el-button>
+          <!-- 鏉冮檺鍒ゆ柇 v-if="getAuthValueFN('xxx_del')" -->
           <el-button
             size="mini"
             type="text warn"
@@ -76,7 +83,7 @@
     </el-table>
 
     <!-- 鏂板&缂栬緫 -->
-    <el-dialog v-el-drag-dialog :title="dialogData.type=='add'?'鏂板鍖婚櫌绉戝':'缂栬緫鍖婚櫌绉戝'" width="500px" :visible.sync="dialogVisible" append-to-body :before-close="hideDialog" :close-on-click-modal="false">
+    <el-dialog v-el-drag-dialog :title="(dialogData.type=='add'?'鏂板':'缂栬緫') + objectName" width="500px" :visible.sync="dialogVisible" append-to-body :before-close="hideDialog" :close-on-click-modal="false">
       <el-form ref="refDialog" :model="dialogData" label-width="110px" :rules="rules" size="small">
         <el-form-item label="鍚嶇О" prop="name">
           <el-input v-model="dialogData.name" placeholder="璇疯緭鍏ュ悕绉�" maxlength="50" />
@@ -112,13 +119,20 @@
   data() {
     return {
       showSearch: true, // 鏄惁鏄剧ず鎼滅储鍖�
-      keyWord: '',
+      keyWord: '', // 鎼滅储鍖哄瓧娈碉紝鍙嚜琛屾墿灞曞叾浣欏瓧娈�
 
+      // TODO
+      objectName: 'xx', // 瀵硅薄鍚嶇О锛岀敤浜庡垹闄ゆ彁绀恒�佸惎鐢ㄦ彁绀恒�佸脊绐楁爣棰樼瓑
+
+      // 鏁版嵁鍒楄〃
       list: [],
 
       // 寮圭獥鏁版嵁
       dialogVisible: false,
       dialogData: {},
+
+      // 瀵屾枃鏈紪杈戝櫒
+      // rangenum: null,
 
       // 鍒嗛〉 鈫撯啌鈫撯啌鈫撯啌鈫撯啌鈫撯啌
       total: 0,
@@ -146,10 +160,26 @@
       this.getList()
     },
 
+    // ========== 瀵屾枃鏈浉鍏�
+    // 瀵屾枃鏈紪杈戝櫒鐨勫唴瀹硅祴鍊�
+    // catchData(content) {
+    //   if (content === '<p><br></p>') content = ''
+    //   try {
+    //     const currentRange = window.getSelection().getRangeAt(0)
+    //     this.rangenum = currentRange
+    //   } catch (e) {
+    //
+    //   }
+    //   this.$set(this.dialogData, 'content', content)
+    //   this.$refs[this.formName].validateField('content')
+    // },
+    // ========== 瀵屾枃鏈浉鍏�
+
     // 鑾峰彇鍒楄〃
     getList() {
       var { pageNum, pageSize, keyWord } = this
       this.postFN({
+        // TODO url
         url: 'xxx',
         params: {
           pageNum: pageNum,
@@ -170,6 +200,7 @@
           }
         }
       }, (inf) => {
+        // 娴嬭瘯鐢�
         for (var i = 0; i < 19; i++) {
           inf.list.push({
             id: 'xxx',
@@ -201,6 +232,7 @@
         type: 'warning'
       }).then(() => {
         // 纭畾鍥炶皟
+        // TODO url
         this.postFN({
           url: 'xxx',
           params: {
@@ -227,6 +259,7 @@
       }).then(() => {
         this.postFN({
           url: 'xxx',
+          // TODO url
           params: {
             id: item.id
           },
@@ -275,6 +308,8 @@
     hideDialog() {
       this.dialogData = {}
       this.dialogVisible = false
+      // 娓呯┖瀵屾枃鏈�
+      // this.rangenum = null
     },
     // 鎻愪氦鏂板&缂栬緫
     submitHandle() {
@@ -295,7 +330,8 @@
       if (dialogData.password) params.password = dialogData.password
 
       var isAdd = dialogData.type === 'add'
-      var url = isAdd ? 'admin/hospital/department/add' : 'admin/hospital/department/edit'
+      // TODO url
+      var url = isAdd ? 'xxx/add' : 'xxx/edit'
 
       !isAdd && (params.id = dialogData.id)
 

--
Gitblit v1.8.0