wansfa 1 year ago
parent
commit
9191c598bf
2 changed files with 373 additions and 0 deletions
  1. 53 0
      src/api/qw/forbiddenMessage.js
  2. 320 0
      src/views/qw/forbiddenMessage/index.vue

+ 53 - 0
src/api/qw/forbiddenMessage.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询企微违禁消息列表
+export function listForbiddenMessage(query) {
+  return request({
+    url: '/qw/forbiddenMessage/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询企微违禁消息详细
+export function getForbiddenMessage(id) {
+  return request({
+    url: '/qw/forbiddenMessage/' + id,
+    method: 'get'
+  })
+}
+
+// 新增企微违禁消息
+export function addForbiddenMessage(data) {
+  return request({
+    url: '/qw/forbiddenMessage',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改企微违禁消息
+export function updateForbiddenMessage(data) {
+  return request({
+    url: '/qw/forbiddenMessage',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除企微违禁消息
+export function delForbiddenMessage(id) {
+  return request({
+    url: '/qw/forbiddenMessage/' + id,
+    method: 'delete'
+  })
+}
+
+// 导出企微违禁消息
+export function exportForbiddenMessage(query) {
+  return request({
+    url: '/qw/forbiddenMessage/export',
+    method: 'get',
+    params: query
+  })
+}

+ 320 - 0
src/views/qw/forbiddenMessage/index.vue

@@ -0,0 +1,320 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="员工" prop="companyUserName">
+        <el-input
+          v-model="queryParams.companyUserName"
+          placeholder="请输入"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="账号" prop="account">
+        <el-input
+          v-model="queryParams.account"
+          placeholder="请输入"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="消息编号" prop="id">
+        <el-input
+          v-model="queryParams.id"
+          placeholder="请输入"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="发送时间" prop="createTimeRange">
+        <el-date-picker
+          style="width:205.4px"
+          clearable size="small"
+          v-model="createTimeRange"
+          type="daterange"
+          value-format="yyyy-MM-dd"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['qw:forbiddenMessage:remove']"
+        >删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['qw:forbiddenMessage:export']"
+        >导出</el-button>
+      </el-col>
+	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" border :data="forbiddenMessageList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="40" align="center" />
+      <el-table-column label="公司" width="200" align="center" prop="companyName" />
+      <el-table-column label="员工" width="100" align="center" prop="companyUserName" />
+      <el-table-column label="发送时间" width="200" align="center" prop="sendTime">
+        <template slot-scope="scope">
+          {{ convertTimestampToTime(scope.row.sendTime) }}
+        </template>
+      </el-table-column>
+      <el-table-column label="提示" align="center" prop="forbiddenMessage">
+        <template slot-scope="scope">
+          <div style="font-size: 16px; color: red;">
+            {{ scope.row.forbiddenMessage }}
+          </div>
+        </template>
+      </el-table-column>
+      <el-table-column label="操作" width="100" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['qw:forbiddenMessage:edit']"
+          >查看</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改企微违禁消息对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="消息id" prop="messageId">
+          <el-input v-model="form.messageId" placeholder="请输入消息id" />
+        </el-form-item>
+        <el-form-item label="会话id" prop="conversationId">
+          <el-input v-model="form.conversationId" placeholder="请输入会话id" />
+        </el-form-item>
+        <el-form-item label="消息体">
+          <editor v-model="form.content" :min-height="192"/>
+        </el-form-item>
+        <el-form-item label="员工id" prop="companyUserId">
+          <el-input v-model="form.companyUserId" placeholder="请输入员工id" />
+        </el-form-item>
+        <el-form-item label="公司id" prop="companyId">
+          <el-input v-model="form.companyId" placeholder="请输入公司id" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listForbiddenMessage, getForbiddenMessage, delForbiddenMessage, addForbiddenMessage, updateForbiddenMessage, exportForbiddenMessage } from "@/api/qw/forbiddenMessage";
+import Editor from '@/components/Editor';
+import { getCompanyList } from "@/api/company/company";
+
+export default {
+  name: "ForbiddenMessage",
+  components: { Editor },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      companys:[],
+      createTimeRange:[],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 企微违禁消息表格数据
+      forbiddenMessageList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        messageId: null,
+        conversationId: null,
+        content: null,
+        companyUserId: null,
+        companyId: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  created() {
+    this.getList();
+    getCompanyList().then(response => {
+      this.companys = response.data;
+    });
+  },
+  methods: {
+    convertTimestampToTime(timestamp) {
+    const milliseconds = timestamp * 1000; // 将时间戳乘以1000以转换为毫秒
+    // 创建一个新的Date对象,并将时间戳作为参数传入构造函数
+    const date = new Date(milliseconds);
+    // 使用Date对象的方法获取日期和时间
+    const year = date.getFullYear();
+    const month = date.getMonth() + 1;
+    const day = date.getDate();
+    const hours = date.getHours();
+    const minutes = date.getMinutes();
+    const seconds = date.getSeconds();
+    // 返回转换后的日期和时间字符串
+    return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+  },
+    /** 查询企微违禁消息列表 */
+    getList() {
+      this.loading = true;
+      if(this.createTimeRange!=null&&this.createTimeRange.length==2){
+        this.queryParams.createTimeRange=this.createTimeRange[0]+"--"+this.createTimeRange[1]
+      }
+      else{
+        this.queryParams.createTimeRange=null;
+      }
+      listForbiddenMessage(this.queryParams).then(response => {
+        this.forbiddenMessageList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        id: null,
+        messageId: null,
+        conversationId: null,
+        content: null,
+        companyUserId: null,
+        companyId: null,
+        createTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加企微违禁消息";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const id = row.id || this.ids
+      getForbiddenMessage(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改企微违禁消息";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateForbiddenMessage(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          } else {
+            addForbiddenMessage(this.form).then(response => {
+              if (response.code === 200) {
+                this.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              }
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$confirm('是否确认删除企微违禁消息编号为"' + ids + '"的数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delForbiddenMessage(ids);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        }).catch(function() {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有企微违禁消息数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportForbiddenMessage(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        }).catch(function() {});
+    }
+  }
+};
+</script>