Kaynağa Gözat

table新增查看

zhaoke 1 yıl önce
ebeveyn
işleme
30a15b16a7

+ 1 - 1
src/components/AuthButton/index.vue

@@ -29,7 +29,7 @@ export default {
       if (servicetype == 0) {
         func = () => context.parent.handleQuery()
       } else if (servicetype == 1) {
-        func = () => context.parent.handleDetail()
+        func = () => context.parent.handleDetail(row)
       } else if (servicetype == 2) {
         func = () => context.parent.handleAdd()
       } else if (servicetype == 3) {

+ 9 - 3
src/components/PublicPageDialog/index.vue

@@ -7,9 +7,11 @@
         </el-scrollbar>
       </div>
       <div class="PublicPageDialog-foot">
-        <el-button @click="handleClose" size="small">取消</el-button>
-        <slot name="d_foot" />
-        <el-button @click="handleSubmit" type="primary" size="small">确定</el-button>
+        <template v-if="formAuth">
+          <el-button @click="handleClose" size="small">取消</el-button>
+          <slot name="d_foot" />
+          <el-button @click="handleSubmit" type="primary" size="small">确定</el-button>
+        </template>
       </div>
     </el-drawer>
   </div>
@@ -27,6 +29,10 @@ export default {
       type: Boolean,
       default: false
     },
+    formAuth: {
+      type: Boolean,
+      default: true
+    },
     dialogDirection: {
       type: String,
       default: 'rtl'

+ 4 - 0
src/components/SimpleTable/index.vue

@@ -289,6 +289,10 @@ export default {
       })
       setTableFilters(this.tableData, this.tableDataFilters)
     },
+    //表格-查看
+    handleDetail (row) {
+      this.$emit('handleDetail', row)
+    },
     //表格-编辑
     handleEdit (row) {
       this.$emit('handleEdit', row)

+ 18 - 2
src/views/tablePage/index.vue

@@ -11,12 +11,12 @@
         </div>
       </template>
       <div :class="dataFlag ? 'tableAuto' : treeData.length ? 'tableSacle' : 'tableAuto'" class="TablePage_content_right">
-        <PublicPageTable :loading="loading" :table-cols="tableCols" :table-btns="authBtns" :data="tableData" :header-cell-class-name="headerCellClass" :row-class-name="rowClass" :cell-class-name="cellClass" :formatter="tableFormatter" show-summary @mounted="tableMountedHandler" @load="load" @cell-click="cellClickHandler" @handleEdit="handleEdit" @handleOther="handleOther" @handleRemove="handleRemove" />
+        <PublicPageTable :loading="loading" :table-cols="tableCols" :table-btns="authBtns" :data="tableData" :header-cell-class-name="headerCellClass" :row-class-name="rowClass" :cell-class-name="cellClass" :formatter="tableFormatter" show-summary @mounted="tableMountedHandler" @load="load" @cell-click="cellClickHandler" @handleDetail="handleDetail" @handleEdit="handleEdit" @handleOther="handleOther" @handleRemove="handleRemove" />
       </div>
     </div>
     <div class="TablePage_dialog">
       <!--新增/编辑-->
-      <PublicPageDialog :dialog-title="tableTitle" dialogSize="630px" :dialog-drawer="flag" @handleClose="submitClickClose('ruleForm')" @handleSubmit="submitClickHandler">
+      <PublicPageDialog :dialog-title="tableTitle" dialogSize="630px" :form-auth="formAuth" :dialog-drawer="flag" @handleClose="submitClickClose('ruleForm')" @handleSubmit="submitClickHandler">
         <PublicPageForm ref="ruleForm" :label-width="labelWidth" :form-type="tableType" :form-item="formItem" :form-data="tableForm" />
       </PublicPageDialog>
       <!--高级查询-->
@@ -82,6 +82,7 @@ export default {
       pageServiceId: null, //表格serviceid
       formItem: [], //弹框表单渲染数据
       flag: false, //弹框表单开关
+      formAuth: true, //弹框表单按钮开关
       tableType: "add", //弹框表单弹框类型
       tableTitle: "新增", //弹框表单标题
       tableForm: {}, //弹框表单数据
@@ -106,6 +107,9 @@ export default {
       return ''
     },
     pageAuthBtnQuery () {
+      return this.tableBtns.filter(item => item.servicetype == 0)[0]
+    },
+    pageAuthBtnDetail () {
       return this.tableBtns.filter(item => item.servicetype == 1)[0]
     },
     pageAuthBtnAdd () {
@@ -239,6 +243,17 @@ export default {
     findBtntoForm (pageroute) {
       return this.tableBtnForms.filter(item => item.pagecode == pageroute)
     },
+    //表单-查看
+    handleDetail (row) {
+      const { openmode, pageroute } = this.pageAuthBtnDetail
+      if (!openmode) return
+      if (openmode != 2) this.autoBtnClick(openmode, pageroute)
+      this.flag = true
+      this.formAuth = false
+      this.tableType = "detail"
+      this.tableTitle = "查看"
+      this.tableForm = _.cloneDeep(row)
+    },
     //表单-新增
     handleAdd () {
       const { openmode, pageroute } = this.pageAuthBtnAdd
@@ -297,6 +312,7 @@ export default {
     },
     // 新增/编辑-取消
     submitClickClose (formName) {
+      this.formAuth = true
       this.flag = false
       this.$refs[formName].restForm()
     },