Quellcode durchsuchen

消息管理和政务管理页面

刘湘琪 vor 2 Jahren
Ursprung
Commit
f470ea5ca8

+ 1 - 1
src/api/admin/msg/msg.js

@@ -15,4 +15,4 @@ export function noticeByIdApi(noticeId, query) {
     method: 'get',
     params: query
   })
-}
+}

+ 8 - 0
src/api/admin/tax/tax.js

@@ -31,3 +31,11 @@ export function getTaxInfoByIdApi(id, query) {
     params: query
   })
 }
+//修改税务信息
+export function updateTaxInfoApi(data) {
+  return request({
+    url: `/admin/gov`,
+    method: 'put',
+    data: data
+  })
+}

+ 4 - 10
src/utils/ruoyi.js

@@ -70,19 +70,13 @@ export function addDateRange(params, dateRange, propName) {
 
 // 回显数据字典 
 export function selectDictLabel(datas, value) {
-  if (value === undefined) {
-    return "";
-  }
   var actions = [];
   Object.keys(datas).some((key) => {
-    if (datas[key].value == ('' + value)) {
-      actions.push(datas[key].label);
-      return true;
-    }
+  	if (datas[key].dictValue == ('' + value)) {
+  		actions.push(datas[key].dictLabel);
+  		return true;
+  	}
   })
-  if (actions.length === 0) {
-    actions.push(value);
-  }
   return actions.join('');
 }
 

+ 36 - 20
src/views/message/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" size="small" label-width="100px">
-      <el-form-item label="内容关键字">
+      <el-form-item label="内容关键字" prop="noticeContent">
         <el-input v-model="queryParams.noticeContent" clearable style="width: 200px;" placeholder="请输入内容关键字"></el-input>
       </el-form-item>
       <el-form-item>
@@ -13,15 +13,14 @@
       <span class="title">列表</span>
     </h3>
     <el-table v-loading="loading" :data="list" border>
-      <el-table-column label="通知类型" prop="noticeType" width="120" align="center" />
-      <el-table-column label="内容" prop="noticeContent" align="center"></el-table-column>
-      <el-table-column label="状态" prop="status" align="center" width="120" />
-      <el-table-column label="发送时间" align="center" prop="createTime" width="160"></el-table-column>
-      <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
-          <el-button type="text" @click="handleView(scope.row)">查看</el-button>
-        </template>
+      <el-table-column label="通知类型" prop="noticeType" width="120" align="center" :formatter="noticeTypeFormat"/>
+      <el-table-column label="内容" prop="noticeContent" align="center">
+        <template slot-scope="scope" >
+          <span class="content_msg"> {{scope.row.noticeContent}}</span> <el-button @click="handleView(scope.row)" type="text" size="small">查看详情</el-button>
+         </template>
       </el-table-column>
+      <el-table-column label="状态" prop="status" align="center" width="120" :formatter="statusFormat"/>
+      <el-table-column label="发送时间" align="center" prop="createTime" width="160"></el-table-column>
     </el-table>
     <pagination
       v-show="total>0"
@@ -33,7 +32,7 @@
 </template>
 
 <script>
-  import {listMsgApi} from "@/api/admin/msg/msg"
+  import {listMsgApi,noticeByIdApi} from "@/api/admin/msg/msg"
   import {entStateOptions, getLabel, authStateOptions} from '@/utils/dataFormat'
   export default {
     data () {
@@ -44,6 +43,8 @@
         provinceDataList: [],
         cityDataList: [],
         districtDataList: [],
+        msgTypeOptions: [], //通知类型
+        statusOptions: [], //通知状态
         entStateOptions: entStateOptions,
         authStateOptions: authStateOptions,
         // 模板状态
@@ -62,6 +63,15 @@
     },
     created() {
       this.getList()
+      //通知类型
+      this.getDicts("sys_notice_type").then(response => {
+        this.msgTypeOptions = response.data;
+      });
+      //通知状态 sys_notice_status
+      this.getDicts("msg_type").then(response => {
+        this.statusOptions = response.data;
+      });
+
     },
     methods: {
       getList() {
@@ -72,8 +82,12 @@
           this.loading = false;
         });
       },
-      handleView(row) {
-        this.$router.push("message/info/"+row.noticeId)
+      /** 查看 */
+      handleView(row){
+       const id = row.noticeId;
+         noticeByIdApi(id).then(response => {
+           this.$alert(response.data.noticeContent, "消息内容");
+         });
       },
       // 重置
       resetQuery() {
@@ -85,18 +99,20 @@
         this.queryParams.pageNum = 1;
         this.getList();
       },
-      statusFormat(row, col, val, index) {
-        return getLabel(accessStatus, val)
+      noticeTypeFormat(row, col) {
+        return this.selectDictLabel(this.msgTypeOptions, row.noticeType);
       },
-      entSateFormat(row, col, val, index) {
-        return getLabel(entStateOptions, val)
-      },
-      authStateFormat(row, col, val, index) {
-        return getLabel(authStateOptions, val)
+      statusFormat(row, col) {
+        return this.selectDictLabel(this.statusOptions, row.status)
       }
     }
   }
 </script>
 
-<style>
+<style scoped>
+  .content_msg{
+   white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+  }
 </style>

+ 94 - 24
src/views/tax/components/AddTaxUser.vue

@@ -11,7 +11,7 @@
            <el-input v-model="form.phonenumber"></el-input>
          </el-form-item>
          <el-form-item label="负责地区" prop="dutyArea">
-           <el-select v-model="form.dutyArea" placeholder="请选择负责地区" style="width: 200px;" filterable>
+           <el-select v-model="form.dutyArea" placeholder="请选择负责地区" style="width: 200px;" filterable @change="changeDuty">
              <el-option v-for="(item,index) in dutyAreaOptions" :key="index" :label="item.dictLabel" :value="item.dictValue"></el-option>
            </el-select>
          </el-form-item>
@@ -26,7 +26,7 @@
            </el-select>
          </el-form-item>
          <el-form-item label="区" prop="districtId" v-if="form.dutyArea == '3'">
-           <el-select v-model="form.districtId" placeholder="请选择区" filterable style="width: 200px;">
+           <el-select v-model="form.districtId" placeholder="请选择区" filterable style="width: 200px;" @change="changeDistrict">
              <el-option v-for="(item, index) in districtDataList" :key="index" :label="item.name" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
@@ -45,7 +45,7 @@
  </template>
 
  <script>
-   import {addTaxUserApi,getTaxInfoByIdApi} from "@/api/admin/tax/tax"
+   import {addTaxUserApi,getTaxInfoByIdApi,updateTaxInfoApi} from "@/api/admin/tax/tax"
    import {getProvinceDataApi,getRegionChildrenApi} from "@/api/common/common"
    import {dutyAreaOptions} from '@/utils/dataFormat'
    export default {
@@ -62,7 +62,9 @@
          cityName: '',
          districtName: '',
          dutyAreaOptions: dutyAreaOptions,
+         id: undefined,
          form: {
+           id: ''
          },
          rules: {
            checkStatus: [
@@ -77,23 +79,67 @@
      methods: {
        init(type, id) {
          this.open = true
+         this.reset()
          this.type = type
          this.form.id = id
+         this.id = id
          if(this.type == 'add') {
            this.title = '新增'
          }else if(this.type == 'update') {
            this.title = '修改'
          }
-         if(this.form.id) {
-           this.getData()
-         }
-         this.resetForm("form");
          this.getProvinceData()
+
+        setTimeout(() => {        // 加延时
+          if(this.form.id) {
+            this.getData()
+          }
+        }, 50);
+
+         // this.resetForm("form");
+       },
+       // 表单重置
+       reset() {
+         this.form = {
+         };
+         this.resetForm("form");
        },
        getData() {
          getTaxInfoByIdApi(this.form.id).then(res => {
            if(res.code == 200) {
              this.form = res.data
+             //获取parentArea 若长度为2,则为省级,三为市级,四为区级
+             let arr = res.data.parentArea.split(',')
+             if(arr.length == 2) {
+               this.form.provinceId = res.data.scopeId
+             }else if(arr.length == 3) {
+               this.form.provinceId = arr[2]
+               getRegionChildrenApi(this.form.provinceId).then(res => {
+                 if(res.code == 200) {
+                   this.cityDataList = res.data
+                 }
+               })
+               setTimeout(() => {        // 加延时
+                 this.form.cityId = res.data.scopeId
+               }, 50);
+
+             }else if(arr.length == 4) {
+               this.form.provinceId = arr[2]
+               getRegionChildrenApi(this.form.provinceId).then(res => {
+                 if(res.code == 200) {
+                   this.cityDataList = res.data
+                 }
+               })
+               setTimeout(() => {        // 加延时
+                 this.form.cityId = arr[3]
+                 getRegionChildrenApi(this.form.cityId).then(res => {
+                   if(res.code == 200) {
+                     this.districtDataList = res.data
+                   }
+                 })
+               }, 50);
+              this.form.districtId = res.data.scopeId
+             }
              let list = []
              list = res.data
              if(list.userType == 'GOV_PROV') {
@@ -106,6 +152,13 @@
            }
          })
        },
+       getProvinceData() {
+         getProvinceDataApi().then(res => {
+           if(res.code == 200) {
+             this.provinceDataList = res.data
+           }
+         })
+       },
        //选择省份
        getCityData() {
          this.form.cityId = ''
@@ -115,6 +168,7 @@
              this.cityDataList = res.data
            }
          })
+         this.$forceUpdate()
        },
        //选择市
        getDistrictData() {
@@ -124,13 +178,14 @@
              this.districtDataList = res.data
            }
          })
+         this.$forceUpdate()
        },
-       getProvinceData() {
-         getProvinceDataApi().then(res => {
-           if(res.code == 200) {
-             this.provinceDataList = res.data
-           }
-         })
+       changeDistrict() {
+         this.$forceUpdate()
+       },
+       //视图更新不够及时
+       changeDuty() {
+         this.$forceUpdate()
        },
        submitForm() {
          this.$refs.form.validate(valid => {
@@ -172,17 +227,32 @@
                this.form.scopeId = this.form.districtId
                this.form.userType = 'GOV_DISTRI'
              }
-             addTaxUserApi(this.form).then(res => {
-               this.disabled = false;
-               if(res.code == 200) {
-                 this.$message({
-                   message: '新增成功',
-                   type: 'success'
-                 });
-               }
-               this.open = false;
-               this.$emit('refreshData');
-             })
+             if(this.id) {
+               updateTaxInfoApi(this.form).then(res => {
+                 this.disabled = false;
+                 if(res.code == 200) {
+                   this.$message({
+                     message: '修改成功',
+                     type: 'success'
+                   });
+                 }
+                 this.open = false;
+                 this.$emit('refreshData');
+               })
+             }else {
+               addTaxUserApi(this.form).then(res => {
+                 this.disabled = false;
+                 if(res.code == 200) {
+                   this.$message({
+                     message: '新增成功',
+                     type: 'success'
+                   });
+                 }
+                 this.open = false;
+                 this.$emit('refreshData');
+               })
+             }
+
            }
          })
        },

+ 1 - 1
src/views/tax/index.vue

@@ -16,7 +16,7 @@
           <el-option v-for="(item, index) in districtDataList" :key="index" :label="item.name" :value="item.id"></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="用户名称">
+      <el-form-item label="用户名称" prop="entName">
         <el-input v-model="queryParams.entName" clearable style="width: 200px;" placeholder="请输入用户名称"></el-input>
       </el-form-item>
       <el-form-item>