LiuJ 1 周之前
父节点
当前提交
03a5392ccb

+ 54 - 62
src/views/news/addNcomplaint.vue

@@ -13,13 +13,13 @@
 
           <el-form-item label="发布范围:" prop="city_arr_id" class="custom-align-right">
             <el-cascader :key="cascaderKey" v-model="form.city_arr_id" placeholder="请选择发布范围" :props="cityData"
-              filterable clearable></el-cascader>
+              filterable clearable @change="changeData"></el-cascader>
           </el-form-item>
           <el-form-item label="行政职能:" prop="department_arr_id" class="custom-align-right">
             <el-cascader :key="searchDepartmentKey" v-model="form.department_arr_id" placeholder="请选择行政职能"
-              popper-class="my_cascader" :props="searchDepartmentData" filterable clearable></el-cascader>
+              popper-class="my_cascader" :props="searchDepartmentData" filterable clearable
+              @change="changeData"></el-cascader>
           </el-form-item>
-
           <el-form-item label="行政人员:" prop="re_user_ids" class="custom-align-right">
             <el-select v-model="form.re_user_ids" placeholder="请选择行政人员" multiple filterable clearable
               @visible-change="getDUser">
@@ -148,6 +148,7 @@ export default {
       searchCascaderKey: 0, //列表缓存key
       website_id: 2,
       file: '',
+      re_user_ids: [],
       userType: 1, //用户类型 1:普通用户,
       pickerOptions: {
         selectableRange: '1900-01-01 to 2100-12-31', // 允许选择的日期范围
@@ -155,7 +156,7 @@ export default {
         //   return time.getTime() < Date.now() - 86400000; // 禁用今天之前的日期
         // },
       },
-
+      searchDepartmentKey: 0, //列表缓存key
       //提交表单
       form: {
         //1.1使用了外链
@@ -180,7 +181,7 @@ export default {
         city_arr_id: [{ required: true, trigger: 'blur', validator: validateArray }],
         department_arr_id: [{ required: true, trigger: 'blur', validator: validateArray }],
         re_user_ids: [{ required: true, trigger: 'blur', validator: validateArray }],
-
+        start: [{ required: true, trigger: 'blur', validator: validateNull }],
         level: [{ required: true, trigger: 'blur', validator: validateEmpty }],
         content: [{ required: true, trigger: 'blur', validator: validateEmpty }],
         address: [{ required: true, trigger: 'blur', validator: validateEmpty }],
@@ -319,9 +320,13 @@ export default {
     };
   },
   methods: {
+    changeData() {
+      this.form.re_user_ids = [];
+      this.getDUser();
+    },
     //获取行政人员
     getDUser() {
-      this.$forceUpdate();
+      // this.form.re_user_ids = [];
       let department_id = this.form.department_arr_id;
       let city_id = this.form.city_arr_id;
       if (department_id.length == 0) {
@@ -338,24 +343,7 @@ export default {
         'department_id': department_id,
         'city_id': city_id,
       }
-      //如果是编辑,就返回数据
-      // if (this.$route.query.id != undefined) {
-      //   let ids = Array.isArray(this.form.re_user_ids) ? this.form.re_user_ids : JSON.parse(this.form.re_user_ids)
-      //   if (ids.length > 0) {
-      //     parames = {
-      //       'ids': ids,
-      //     }
-      //   } else {
-      //     this.$message({
-      //       type: 'info',
-      //       message: '用户数据为空'
-      //     });
-      //     return;
-      //   }
-
-      // }
       this.$store.dispatch('news/getDUser', parames).then(res => {
-        // this.form.re_user_ids = res.data;
         this.re_user_ids = res.data;
         this.$forceUpdate();
       }).catch(() => {
@@ -572,6 +560,7 @@ export default {
         this.form.want = res.data.want;
         this.form.start = res.data.start ? new Date(res.data.start) : null; // 处理时间格式
         this.form.re_user_ids = Array.isArray(res.data.re_user_ids) ? res.data.re_user_ids : JSON.parse(res.data.re_user_ids);
+        this.getDUser();
       })
     },
     async loadCascaderPath(path) {
@@ -608,48 +597,49 @@ export default {
       //添加要修改的id
       this.form.id = this.editId;
       //先进行验证
-
       this.$refs.form.validate(valid => {
-
         if (valid) {
-          if (this.form.start) {
-            this.form.start = formatLocalDate(this.form.start);
+          // 拷贝对象form,处理另外的,并提交
+          const formData = { ...this.form };
+          if (formData.start) {
+            formData.start = formatLocalDate(formData.start);
           }
-          if (this.form.department_arr_id.length == 0) {
-            this.form.department_id = 0;
+          if (formData.department_arr_id.length == 0) {
+            formData.department_id = 0;
           }
-          if (this.form.city_arr_id.length == 0) {
-            this.form.city_id = 0;
+          if (formData.city_arr_id.length == 0) {
+            formData.city_id = 0;
           }
-          console.log(typeof this.form.city_arr_id, '---=-==-=')
-          if (typeof this.form.city_arr_id == 'object') {
-            this.form.city_id = this.form.city_arr_id.at(-1) || 0;
-            this.form.city_arr_id = JSON.stringify(this.form.city_arr_id);
+          console.log(typeof formData.city_arr_id, '---=-==-=')
+          if (typeof formData.city_arr_id == 'object') {
+            formData.city_id = formData.city_arr_id.at(-1) || 0;
+            formData.city_arr_id = JSON.stringify(formData.city_arr_id);
           }
-          if (typeof this.form.department_arr_id == 'object') {
-            this.form.department_id = this.form.department_arr_id.at(-1) || 0;
-            this.form.department_arr_id = JSON.stringify(this.form.department_arr_id);
+          if (typeof formData.department_arr_id == 'object') {
+            formData.department_id = formData.department_arr_id.at(-1) || 0;
+            formData.department_arr_id = JSON.stringify(formData.department_arr_id);
           }
           //re_user_ids
-          if (typeof this.form.re_user_ids == 'object') {
-            this.form.re_user_ids = JSON.stringify(this.form.re_user_ids);
+          if (typeof formData.re_user_ids == 'object') {
+            formData.re_user_ids = JSON.stringify(formData.re_user_ids);
           }
 
-          delete this.form.cat_arr_id;
-          delete this.form.time;
-          delete this.form.catid;
-          this.form.file = this.file;
-          console.log(this.form, 'this.form-----------------')
+          delete formData.cat_arr_id;
+          delete formData.time;
+          delete formData.catid;
+          formData.file = this.file;
+          console.log(formData, 'formData-----------------')
 
           if (this.userType == 10000) {
-            this.form.status = 2
+            formData.status = 2
           } else {
-            this.form.status = 1
+            formData.status = 1
           }
 
-          this.$store.dispatch('news/updateComplaint', this.form).then(res => {
+          this.$store.dispatch('news/updateComplaint', formData).then(res => {
             if (res.code != 200) {
               this.$message.error("修改失败,请稍后再试!");
+              this.getMainData();
             } else {
               //汇报结果
               this.$message({
@@ -683,19 +673,19 @@ export default {
 
   },
   watch: {
-    //监听发布范围和行政职能的变化,获取行政人员
-    'form.city_arr_id': function (newVal, oldVal) {
-      console.log(newVal, oldVal, 'newVal, oldVal')
-      if (newVal.length > 0) {
-        this.getDUser();
-      }
-    },
-    'form.department_arr_id': function (newVal, oldVal) {
-      console.log(newVal, oldVal, 'newVal, oldVal')
-      if (newVal.length > 0) {
-        this.getDUser();
-      }
-    },
+    //监听发布范围和行政职能的变化,获取行政人员 ,
+    // 'form.city_arr_id': function (newVal, oldVal) {
+    //   console.log(newVal, oldVal, 'newVal, oldVal', '到这里了-0---------1------------------')
+    //   if (newVal.length > 0) {
+    //     this.getDUser();
+    //   }
+    // },
+    // 'form.department_arr_id': function (newVal, oldVal) {
+    //   console.log(newVal, oldVal, 'newVal, oldVal', '到这里了-0----------2-----------------')
+    //   if (newVal.length > 0) {
+    //     this.getDUser();
+    //   }
+    // },
     '$route'(to, from) {
       console.log(from, '---------------------------------------');
       // 监听路由参数中的 id 变化,若变化则更新页面状态并获取数据
@@ -712,7 +702,8 @@ export default {
       this.editStatus = true;
       this.tableDivTitle = "编辑投诉举报";
       console.log("编辑投诉举报")
-      this.getMainData();
+      this.getMainData()
+
     } else {
       this.editStatus = false;
       console.log("添加投诉举报!")
@@ -724,6 +715,7 @@ export default {
     }
     this.fetchWebsiteOptions();
     this.getUserInfo();
+    console.log(this.isInitialized, '到了这里--------------')
     // this.getDUser();
     //复制内容到富文本 start ------------------------------------------------------------>
     //复制富文本 end ------------------------------------------------------------>

+ 6 - 2
src/views/news/addNotice.vue

@@ -114,14 +114,15 @@ export default {
       }
     }
     const validateEmpty = (rule, value, callback) => {
-      console.log(value, '-------------------------------')
-      if (value.length == 0) {
+
+      if (value.length == '') {
         callback(new Error('该项不能为空!'))
       } else {
         callback()
       }
     }
     const validateArray = (rule, value, callback) => {
+      console.log(value, '----------1---------------------')
       if (value.length == 0) {
         callback(new Error('该项不能为空!'))
       } else {
@@ -160,6 +161,7 @@ export default {
         department_id: '',//部门id
         is_group: 0,//是否创建群聊:1:是,0:否
         group_name: '',//群聊名称
+        time: [],//发布日期
       },
       //1.2 表单验证规则
       formRules: {
@@ -604,6 +606,8 @@ export default {
 
   },
   watch: {
+
+
     '$route'(to, from) {
       console.log(from, '---------------------------------------');
       // 监听路由参数中的 id 变化,若变化则更新页面状态并获取数据

+ 30 - 8
src/views/news/ncomplaintList.vue

@@ -13,8 +13,12 @@
           </el-col>
           <el-col :span="6">
             <div class="searchBox">
-              <div class="searchTitle">投诉类型:</div>
-              <el-input placeholder="请输入投诉类型" autocomplete="off" v-model="getApiData.title" />
+              <div class="searchTitle">行政职能:</div>
+              <el-select v-model="getApiData.department_id" placeholder="请选择..">
+                <el-option v-for="department in department" :key="department.id" :label="department.name"
+                  :value="department.id"></el-option>
+
+              </el-select>
             </div>
           </el-col>
 
@@ -54,7 +58,7 @@
             <el-table-column fixed prop="id" label="编号" width="50"></el-table-column>
             <el-table-column prop="title" label="投诉主题" width="">
             </el-table-column>
-            <el-table-column prop="department_name" label="投诉类型" width="">
+            <el-table-column prop="department_name" label="行政职能" width="">
             </el-table-column>
             <el-table-column prop="cityname" label="接收人" width="">
             </el-table-column>
@@ -74,21 +78,21 @@
             </el-table-column>
             <el-table-column prop="deal" label="处理状态" width="">
               <template slot-scope="scope">
-                <span v-if="scope.row.deal == 1">
+                <span class="  listUpBtn" v-if="scope.row.deal == 1">
                   未处理
                 </span>
-                <span v-if="scope.row.deal == 2">
+                <span class="listDeleteBtn" v-if="scope.row.deal == 2">
                   处理中
                 </span>
-                <span v-if="scope.row.deal == 3">
+                <span class="listEditBtn" v-if="scope.row.deal == 3">
                   已完结
                 </span>
-                <span v-if="scope.row.deal == 4">
+                <span class="listDeleteBtn" v-if="scope.row.deal == 4">
                   不予处理
                 </span>
               </template>
             </el-table-column>
-            <el-table-column prop="start" label="投诉时间" width="">
+            <el-table-column prop="start" label="发生日期" width="">
 
             </el-table-column>
             <el-table-column prop="created_at" label="创建时间" width=""></el-table-column>
@@ -145,12 +149,14 @@ export default {
       tableDivTitle: "投诉列表",
       tableData: [],//内容
       editId: 0,//要修改的网站id
+      department: [],//部门
       getApiData: {
         name: "",//标题
         category_name: "",//导航池id
         website_name: "",//网站名称
         type_id: "",//发布类型
         status: 2,//发布状态
+        department_id: "",//部门id
 
         page: 1,//当前是第几页
         page_size: 10,//一共多少条
@@ -255,6 +261,8 @@ export default {
       this.tableData = [];
       this.getApiData.title = "";
       this.getApiData.level = "";
+      this.getApiData.department_id = "";
+      this.getApiData.deal = "";
 
       this.getApiData.page = 1;
       this.getApiData.pageSize = 10;
@@ -276,6 +284,19 @@ export default {
         path: '/addNcomplaint',
         query: data
       });
+    },
+
+    getDepartment() {
+      this.$store.dispatch('pool/getDepartment', { 'pid': 0 }).then(res => {
+        if (res.code == 200) {
+          this.department = res.data;
+        }
+      }).catch(() => {
+        this.$message({
+          type: 'warning',
+          message: '网络错误,请重试!'
+        });
+      })
     }
     //添加新闻 end ------------------------------------------------------------>
   },
@@ -283,6 +304,7 @@ export default {
     this.type_id = getUseType()
     //1.获得初始数据
     this.getData();
+    this.getDepartment();
   }
 }
 </script>

+ 30 - 8
src/views/news/ncomplaintListApply.vue

@@ -13,8 +13,12 @@
           </el-col>
           <el-col :span="6">
             <div class="searchBox">
-              <div class="searchTitle">投诉类型:</div>
-              <el-input placeholder="请输入投诉类型" autocomplete="off" v-model="getApiData.title" />
+              <div class="searchTitle">行政职能:</div>
+              <el-select v-model="getApiData.department_id" placeholder="请选择..">
+                <el-option v-for="department in department" :key="department.id" :label="department.name"
+                  :value="department.id"></el-option>
+
+              </el-select>
             </div>
           </el-col>
           <el-col :span="6">
@@ -35,7 +39,6 @@
 
     <div class="layerBoxNoBg">
       <div>
-        <el-button type="primary" @click="goCreat">发布投诉举报</el-button>
       </div>
       <div>
         <el-button @click="clearSearchList">重置</el-button>
@@ -73,21 +76,21 @@
             </el-table-column>
             <el-table-column prop="deal" label="处理状态" width="">
               <template slot-scope="scope">
-                <span v-if="scope.row.deal == 1">
+                <span class="  listUpBtn" v-if="scope.row.deal == 1">
                   未处理
                 </span>
-                <span v-if="scope.row.deal == 2">
+                <span class="listDeleteBtn" v-if="scope.row.deal == 2">
                   处理中
                 </span>
-                <span v-if="scope.row.deal == 3">
+                <span class="listEditBtn" v-if="scope.row.deal == 3">
                   已完结
                 </span>
-                <span v-if="scope.row.deal == 4">
+                <span class="listDeleteBtn" v-if="scope.row.deal == 4">
                   不予处理
                 </span>
               </template>
             </el-table-column>
-            <el-table-column prop="start" label="投诉时间" width="">
+            <el-table-column prop="start" label="发生日期" width="">
 
             </el-table-column>
             <el-table-column prop="created_at" label="创建时间" width=""></el-table-column>
@@ -164,6 +167,7 @@ export default {
       examineWindow: false,//审核窗口
       //提交驳回
       formLabelWidth: '80px',//表单的长度
+      department: [],//部门
       type_id: 0,//用户身份
       form: {
         reason: ""
@@ -176,6 +180,7 @@ export default {
         website_name: "",//网站名称
         type_id: "",//发布类型
         status1: 1,//审核状态
+        department_id: "",//部门id
         page: 1,//当前是第几页
         page_size: 10,//一共多少条
       },
@@ -315,6 +320,8 @@ export default {
       this.tableData = [];
       this.getApiData.title = "";
       this.getApiData.level = "";
+      this.getApiData.department_id = "";
+      this.getApiData.deal = "";
 
       this.getApiData.page = 1;
       this.getApiData.pageSize = 10;
@@ -336,6 +343,20 @@ export default {
         path: '/addNComplaint',
         query: data
       });
+    },
+
+    getDepartment() {
+      this.$store.dispatch('pool/getDepartment', { 'pid': 0 }).then(res => {
+        if (res.code == 200) {
+          console.log(res.data, '---3-')
+          this.department = res.data;
+        }
+      }).catch(() => {
+        this.$message({
+          type: 'warning',
+          message: '网络错误,请重试!'
+        });
+      })
     }
     //添加新闻 end ------------------------------------------------------------>
   },
@@ -343,6 +364,7 @@ export default {
     this.type_id = getUseType()
     //1.获得初始数据
     this.getData();
+    this.getDepartment();
   }
 }
 </script>

+ 37 - 8
src/views/news/ncomplaintListDeal.vue

@@ -13,8 +13,12 @@
           </el-col>
           <el-col :span="6">
             <div class="searchBox">
-              <div class="searchTitle">投诉类型:</div>
-              <el-input placeholder="请输入投诉类型" autocomplete="off" v-model="getApiData.title" />
+              <div class="searchTitle">行政职能:</div>
+              <el-select v-model="getApiData.department_id" placeholder="请选择..">
+                <el-option v-for="department in department" :key="department.id" :label="department.name"
+                  :value="department.id"></el-option>
+
+              </el-select>
             </div>
           </el-col>
           <el-col :span="6">
@@ -35,7 +39,6 @@
 
     <div class="layerBoxNoBg">
       <div>
-        <el-button type="primary" @click="goCreat">发布投诉举报</el-button>
       </div>
       <div>
         <el-button @click="clearSearchList">重置</el-button>
@@ -72,21 +75,21 @@
             </el-table-column>
             <el-table-column prop="deal" label="处理状态" width="">
               <template slot-scope="scope">
-                <span v-if="scope.row.deal == 1">
+                <span class="  listUpBtn" v-if="scope.row.deal == 1">
                   未处理
                 </span>
-                <span v-if="scope.row.deal == 2">
+                <span class="listDeleteBtn" v-if="scope.row.deal == 2">
                   处理中
                 </span>
-                <span v-if="scope.row.deal == 3">
+                <span class="listEditBtn" v-if="scope.row.deal == 3">
                   已完结
                 </span>
-                <span v-if="scope.row.deal == 4">
+                <span class="listDeleteBtn" v-if="scope.row.deal == 4">
                   不予处理
                 </span>
               </template>
             </el-table-column>
-            <el-table-column prop="start" label="投诉时间" width="">
+            <el-table-column prop="start" label="发生日期" width="">
 
             </el-table-column>
             <el-table-column prop="created_at" label="创建时间" width=""></el-table-column>
@@ -165,6 +168,7 @@ export default {
       examineWindow: false,//审核窗口
       //提交驳回
       formLabelWidth: '80px',//表单的长度
+      department: [],//部门
       type_id: 0,//用户身份
       user_id: this.$store.state.user.userid,
       form: {
@@ -179,6 +183,8 @@ export default {
         type_id: "",//发布类型
         status: 2,//审核状态
         deal_user: 1,//处理状态
+
+        department_id: "",//部门id
         page: 1,//当前是第几页
         page_size: 10,//一共多少条
       },
@@ -268,7 +274,13 @@ export default {
             message: '投诉举报处理状态已修改!'
           });
           this.getData();
+        } else {
+          this.$message({
+            message: res.message,
+            type: 'error'
+          })
         }
+
       }).catch(() => {
         this.$message({
           type: 'warning',
@@ -339,6 +351,8 @@ export default {
       this.tableData = [];
       this.getApiData.title = "";
       this.getApiData.level = "";
+      this.getApiData.department_id = "";
+      this.getApiData.deal = "";
 
       this.getApiData.page = 1;
       this.getApiData.pageSize = 10;
@@ -362,6 +376,20 @@ export default {
         query: data
       });
     }
+    ,
+
+    getDepartment() {
+      this.$store.dispatch('pool/getDepartment', { 'pid': 0 }).then(res => {
+        if (res.code == 200) {
+          this.department = res.data;
+        }
+      }).catch(() => {
+        this.$message({
+          type: 'warning',
+          message: '网络错误,请重试!'
+        });
+      })
+    }
     //添加新闻 end ------------------------------------------------------------>
   },
   mounted() {
@@ -369,6 +397,7 @@ export default {
 
     //1.获得初始数据
     this.getData();
+    this.getDepartment();
   }
 }
 </script>