From ab701df859cd79ae036f8cc86268137d2c8da8ee Mon Sep 17 00:00:00 2001
From: guanqb <18720758508@163.com>
Date: Thu, 22 Feb 2024 18:00:56 +0800
Subject: [PATCH] 消防自查导出、消防自查和场所检查增加场所类别字段

---
 src/views/article/components/deitDiscussion.vue |  216 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 204 insertions(+), 12 deletions(-)

diff --git a/src/views/article/components/deitDiscussion.vue b/src/views/article/components/deitDiscussion.vue
index 44369ec..abce4aa 100644
--- a/src/views/article/components/deitDiscussion.vue
+++ b/src/views/article/components/deitDiscussion.vue
@@ -10,11 +10,39 @@
 -->
 <template>
   <div>
+    <el-dialog title="" append-to-body :visible.sync="popupTableShow" width="80%" :before-close="handleClose">
+      <span slot="title" class="dialog-footer">
+        {{ ontitle }}
+      </span>
 
+      <div id="" v-if="editFlag">
+        <avue-form @submit="handleSubmit" :option="optionDiscuss" @reset-change="handleReset" v-model="disCussFrom">
+        </avue-form>
+      </div>
+
+      <div id="" v-if="!editFlag">
+        <avue-crud :table-loading="loading" :option="optionList" :data="data" v-model="form" ref="crud"
+          @row-update="rowUpdate" @row-del="rowDel">
+          <template slot="menuLeft" v-if="!editFlag">
+            <el-button type="primary" size="small" plain icon="el-icon-circle-plus-outline" @click="add()">添加
+            </el-button>
+          </template>
+          <template #icon="scope">
+            <i :class="scope.row.icon" style="font-size:14px"></i>
+          </template>
+          <template #menu="{ row, size }">
+            <el-button v-if="row.level === 1" :size="size" text type="primary" @click="edit(row)">编辑</el-button>
+            <el-button v-if="row.level === 1" :size="size" text type="danger" @click="deletes(row)">删除</el-button>
+            <el-button v-if="row.level === 2" :size="size" text type="primary" @click="openUser(row, 1)">
+              选择此项人数:{{ row.number }} 详情</el-button>
+          </template>
+        </avue-crud>
+      </div>
+    </el-dialog>
 
     <el-dialog title="" append-to-body :visible.sync="popupTableUserShow" width="80%" :before-close="userHandleClose">
-      <avue-crud :data="userData" @search-change="searchChange" @row-del="rowDel" @search-reset="searchReset"
-        :page="userPage" :option="userOption"></avue-crud>
+      <avue-crud :data="userData" :page="userPage" :option="userOption" @search-change="searchChange"
+        @search-reset="searchReset"></avue-crud>
     </el-dialog>
   </div>
 </template>
@@ -29,10 +57,8 @@
   } from "@/api/discuss/publicDiscuss"
 
   import {
-    getPage,
-    remove
+    getPage
   } from "@/api/discuss/userTopics"
-
 
   import website from '@/config/website'
 
@@ -43,6 +69,7 @@
     getDetail,
     add,
     update,
+    remove
   } from "@/api/discuss/topics"
 
   export default {
@@ -50,11 +77,127 @@
       return {
         popupTableShow: false,
         popupTableUserShow: false,
+
         loading: true,
+
+        ontitle: '编辑议题',
+        editFlag: false,
+
+        disCussFrom: {
+          discussContent: '',
+          optionRange: 0,
+          sort: 1,
+          optionContent: '',
+          optionDetail: '',
+          number: '',
+          createTime: '',
+          updateTime: '',
+          deleteFlag: '',
+          articleId: '',
+          parentId: '',
+          level: '',
+          children: [{
+            optionContent: '',
+            optionDetail: '',
+            number: '',
+            createTime: '',
+            updateTime: '',
+            deleteFlag: '',
+            articleId: '',
+            parentId: '',
+            level: '',
+          }]
+        },
+        optionDiscuss: {
+          emptyText: '取消',
+          column: [{
+              label: '议题',
+              prop: 'discussContent',
+              type: 'input',
+              row: true,
+              rules: [{
+                required: true,
+                message: '请输入议题',
+                trigger: 'blur'
+              }],
+            },
+            {
+              label: '选项范围',
+              prop: 'optionRange',
+              type: 'radio',
+              value: 0,
+              button: true,
+              row: true,
+              dicData: [{
+                label: '多选',
+                value: 1
+              }, {
+                label: '单选',
+                value: 0
+              }],
+              rules: [{
+                required: true,
+                message: '请选项范围',
+                trigger: 'blur'
+              }],
+            },
+            // {
+            //   label: '排序',
+            //   prop: 'sort',
+            //   controlsPosition: '',
+            //   type: 'number'
+            // },
+            {
+              label: '选项内容',
+              prop: 'children',
+              type: 'dynamic',
+              span: 24,
+              children: {
+                column: [{
+                  label: '选项标题',
+                  prop: 'optionContent',
+                  type: 'input',
+                  rules: [{
+                    required: true,
+                    message: '请输入选项标题',
+                    trigger: 'blur'
+                  }]
+                }, {
+                  label: '选项说明',
+                  prop: 'optionDetail',
+                  type: 'input',
+                }]
+              }
+            },
+          ]
+        },
+
         // 表单数据
         form: {},
         data: [],
+        optionList: {
+          headerAlign: 'center',
+          align: 'center',
+          border: true,
+          addBtn: false,
+          editBtn: false,
+          delBtn: false,
+          defaultExpandAll: true,
+          rowKey: 'id',
+          rowParentKey: 'parentId',
+          column: [{
+              label: '标题',
+              prop: 'discussContent',
+            },
+            {
+              label: '选项内容',
+              prop: 'optionContent',
+            }
+          ]
+        },
+
         articleId: '',
+
         userData: [],
         userOption: {
           labelWidth: 96,
@@ -62,18 +205,20 @@
           searchShow: true,
           searchMenuSpan: 3,
           // menuWidth: 500,
+          menu: false,
 
           height: "auto",
           calcHeight: 54,
           dialogWidth: 950,
           tip: false,
-          border: false,
+          border: true,
           //stripe:true,
           index: true,
           editBtn: false,
           addBtn: false,
           viewBtn: false,
           selection: true,
+          delBtn: false,
           excelBtn: true,
           dialogClickModal: false,
           column: [{
@@ -83,6 +228,8 @@
             search: true,
           }, {
             label: '头像',
+            type: 'upload',
+            listType: "picture-img",
             prop: 'avatar'
           }, {
             label: '手机',
@@ -112,6 +259,9 @@
           currentPage: 1,
           total: 0
         },
+        query: {},
+        newData: {},
+        articleRange: {},
       }
     },
 
@@ -119,21 +269,28 @@
 
     methods: {
 
-
       userHandleClose() {
 
         this.popupTableUserShow = false
       },
 
       searchReset() {
-        this.query = {}
-        this.getUserPage(this.userPage)
+        if (this.articleRange) {
+          this.query.districtId = this.newData.articleRange
+        }
+        this.query.articleId = this.articleId
+        this.userPage.currentPage = 1
+        this.getUserPage(this.userPage, this.query)
       },
 
       searchChange(params, done) {
+        if (this.articleRange) {
+          this.query.districtId = this.newData.articleRange
+        }
         this.query = params
+        this.query.articleId = this.articleId
         this.userPage.currentPage = 1
-        this.getUserPage(this.userPage, params)
+        this.getUserPage(this.userPage, this.query)
         done()
       },
       initData(newData) {
@@ -142,8 +299,17 @@
         this.articleId = newData.id
         this.query.level = 1
         this.query.articleId = this.articleId
+        this.newData = newData
+        this.query.districtId = newData.articleRange
         this.onLoad(this.userPage, this.query)
       },
+      // initData(newData) {
+      //   this.editFlag = false
+      //   this.popupTableShow = true
+      //   this.articleId = newData.id
+
+      //   this.onLoad()
+      // },
 
       handleClose() {
         this.popupTableShow = false
@@ -218,6 +384,7 @@
           })
           .then(() => {
             this.getUserPage(this.userPage)
+
             this.$message({
               type: "success",
               message: "操作成功!"
@@ -234,17 +401,42 @@
         this.editFlag = true
       },
 
+      deletes(row) {
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(row.id)
+          })
+          .then(() => {
+            this.onLoad()
+
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            })
+          })
+      },
 
       openUser(row, type = 0) {
         this.popupTableUserShow = true
         this.query = {}
+        this.articleId = row.id
+        let districtId
         if (type == 0) {
+          this.newData = row
+          districtId = this.newData.articleRange
           this.userParams = {
-            articleId: row.id
+            articleId: row.id,
+            districtId: districtId
           }
         } else {
+          districtId = this.newData.articleRange
           this.userParams = {
-            topicsId: row.id
+            topicsId: row.id,
+            districtId: districtId
           }
         }
         this.getUserPage(this.userPage, this.userParams)

--
Gitblit v1.9.3