Jelajahi Sumber

fix:补充文件发放确认前先查一次已读表是否已存在数据逻辑

liujiayin 2 tahun lalu
induk
melakukan
9224e997f9
1 mengubah file dengan 193 tambahan dan 181 penghapusan
  1. 193 181
      src/views/platform/message/inner/detail/dialog.vue

+ 193 - 181
src/views/platform/message/inner/detail/dialog.vue

@@ -1,199 +1,211 @@
 <template>
-  <el-dialog :title="title"
-             :visible.sync="dialogVisible"
-             :close-on-click-modal="false"
-             :close-on-press-escape="false"
-             :class="[inside ? 'inside-dialog' : 'inner-dialog']"
-             append-to-body
-             top="10vh"
-             width="65%"
-             @open="getFormData"
-             @close="closeDialog">
-    <inner-message :id="id"
-                   ref="innerMessage"
-                   :inside="inside"
-                   :readonly="readonly"
-                   @callback="handleCallback"
-                   :type="type" />
-    <div slot="footer"
-         class="el-dialog--center">
-      <ibps-toolbar :actions="toolbars"
-                    @action-event="handleActionEvent" />
-    </div>
-  </el-dialog>
+    <el-dialog
+        :title="title"
+        :visible.sync="dialogVisible"
+        :close-on-click-modal="false"
+        :close-on-press-escape="false"
+        :class="[inside ? 'inside-dialog' : 'inner-dialog']"
+        append-to-body
+        top="10vh"
+        width="65%"
+        @open="getFormData"
+        @close="closeDialog"
+    >
+        <inner-message
+            :id="id"
+            ref="innerMessage"
+            :inside="inside"
+            :readonly="readonly"
+            :type="type"
+            @callback="handleCallback"
+        />
+        <div
+            slot="footer"
+            class="el-dialog--center"
+        >
+            <ibps-toolbar
+                :actions="toolbars"
+                @action-event="handleActionEvent"
+            />
+        </div>
+    </el-dialog>
 </template>
 <script>
 import InnerMessage from './index'
-import curdPost from "@/business/platform/form/utils/custom/joinCURD.js";
-import getDate from "@/business/platform/form/utils/custom/getDateRule.js";
+import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
+import getDate from '@/business/platform/form/utils/custom/getDateRule.js'
 import {
-  generateUUID
+    generateUUID
 } from '@/api/platform/file/attachment'
 export default {
-  components: { InnerMessage },
-  props: {
-    inside: {
-      type: Boolean,
-      default: false
-    },
-    visible: {
-      type: Boolean,
-      default: false
-    },
-    readonly: {
-      type: Boolean,
-      default: false
-    },
-    // type: {
-    //   type: String,
-    //   default: ''
-    // },
-    tableId: {
-      type: String,
-      default: ''
-    },
-    tableName: {
-      type: String,
-      default: ''
-    },
+    components: { InnerMessage },
+    props: {
+        inside: {
+            type: Boolean,
+            default: false
+        },
+        visible: {
+            type: Boolean,
+            default: false
+        },
+        readonly: {
+            type: Boolean,
+            default: false
+        },
+        // type: {
+        //   type: String,
+        //   default: ''
+        // },
+        tableId: {
+            type: String,
+            default: ''
+        },
+        tableName: {
+            type: String,
+            default: ''
+        },
 
-    id: String,
-    // 子表ID
-    subId: String,
-    title: String
-  },
-  data() {
-    return {
-      dialogVisible: this.visible,
-      dialogLoading: false,
-      toolbars: [{ key: 'cancel', label: '关闭' }],
-      type: ''
-    }
-  },
-  watch: {
-    visible: {
-      handler: function (val, oldVal) {
-        this.dialogVisible = this.visible
-      },
-      immediate: true
+        id: String,
+        // 子表ID
+        subId: String,
+        title: String
     },
-    tableId: {
-      handler: function (val, oldVal) {
-        const btn1 = [
-          { key: 'confirm', label: '确认' },
-          { key: 'cancel', label: '关闭' }
-        ]
-        const btn2 = [
-          { key: 'cancel', label: '关闭' }
-        ]
-        if (val) {
-          this.toolbars = btn1
-          this.type = '1'
-        } else {
-          this.toolbars = btn2
+    data () {
+        return {
+            dialogVisible: this.visible,
+            dialogLoading: false,
+            toolbars: [{ key: 'cancel', label: '关闭' }],
+            type: ''
         }
-      }
-    }
-  },
-  methods: {
-    handleActionEvent({ key }) {
-      switch (key) {
-        case 'cancel':
-          this.closeDialog()
-          break
-        case 'confirm':
-          this.confirmMsg()
-          break
-        default:
-          break
-      }
     },
-    // 关闭当前窗口
-    closeDialog() {
-      this.$emit('close', false)
-    },
-    // 获取表单数据
-    getFormData() {
-      this.$nextTick(() => {
-        this.$refs.innerMessage.getFormData()
-        this.handleCallback(true)
-      })
-    },
-    // 消息确认,受控文件用
-    confirmMsg() {
-        console.log('1111111111')
-      // TODO
-      this.$confirm('点击确认将在系统信息管理模块查看到所通知文件的具体信息', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        type: 'warning',
-        showClose: false,
-        closeOnClickModal: false
-      }).then(() => {
-        // TODO 受控文件逻辑处理
-        const perInfosId = this.$store.getters.userInfo.user.id
-        const perInfosOrg = this.$store.getters.userInfo.org
-        if (!perInfosOrg) {
-            alert('系统所登录的账户并没有所属部门,请先在系统设置完再进行确认!')
-            return
-        }
-        let sql = "select qian_zi_tu_wen_ FROM t_ryjbqk WHERE parent_id_ = '" + perInfosId + "'"
-        console.log('perInfosId', perInfosId)
-        curdPost("sql", sql).then((ryjbqkRes) => {
-          let ryjbqkDatas = ryjbqkRes.variables.data
-          if (ryjbqkDatas.length == 0) {
-            alert('系统所登录的账户并没有签字图文在系统,请先上传系统再进行确认!')
-            return
-          }
-          let tempObj = {
-            id_: generateUUID(),
-            parent_id_: this.tableId,
-            tong_zhi_bu_men_i: perInfosOrg.id,
-            que_ren_qian_ming: JSON.stringify([{
-              id: ryjbqkDatas[0].qian_zi_tu_wen_,
-              fileName: '确认签名'
-            }]),
-            que_ren_ri_qi_: getDate(),
-            qian_ming_id_: ryjbqkDatas[0].qian_zi_tu_wen_
-          }
-          let returnParams = {
-            tableName: this.tableName.slice(0, this.tableName.indexOf("(")), // 字符串 "表名(发放时间)"
-            paramWhere: [tempObj]
-          }
-          // 获取所发放的文件
-          let files = this.$refs.innerMessage.form.fileMsg
-          let addwjcysqbs = []
-          for (let i of files.split(",")) {
-            let addwjcysqb = {
-              yong_hu_id_: this.$store.getters.userInfo.user.id,
-              wen_jian_id_: i,
-              shou_quan_: '1',
-              fa_bu_ri_qi_: this.tableName.slice(this.tableName.indexOf("(") + 1, this.tableName.lastIndexOf(")")),
+    watch: {
+        visible: {
+            handler: function (val, oldVal) {
+                this.dialogVisible = this.visible
+            },
+            immediate: true
+        },
+        tableId: {
+            handler: function (val, oldVal) {
+                const btn1 = [
+                    { key: 'confirm', label: '确认' },
+                    { key: 'cancel', label: '关闭' }
+                ]
+                const btn2 = [
+                    { key: 'cancel', label: '关闭' }
+                ]
+                if (val) {
+                    this.toolbars = btn1
+                    this.type = '1'
+                } else {
+                    this.toolbars = btn2
+                }
             }
-            addwjcysqbs.push(addwjcysqb)
-          }
-          curdPost('add', JSON.stringify(returnParams)).then(() => { console.log('确认接收到发放文件') }).then(
-            () => {
-              this.type = ''
-              this.getFormData()
+        }
+    },
+    methods: {
+        handleActionEvent ({ key }) {
+            switch (key) {
+                case 'cancel':
+                    this.closeDialog()
+                    break
+                case 'confirm':
+                    this.confirmMsg()
+                    break
+                default:
+                    break
             }
-          )
+        },
+        // 关闭当前窗口
+        closeDialog () {
+            this.$emit('close', false)
+        },
+        // 获取表单数据
+        getFormData () {
+            this.$nextTick(() => {
+                this.$refs.innerMessage.getFormData()
+                this.handleCallback(true)
+            })
+        },
+        // 消息确认,受控文件用
+        confirmMsg () {
+            console.log('1111111111')
+            // TODO
+            this.$confirm('点击确认将在系统信息管理模块查看到所通知文件的具体信息', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning',
+                showClose: false,
+                closeOnClickModal: false
+            }).then(() => {
+                // TODO 受控文件逻辑处理
+                const perInfosId = this.$store.getters.userInfo.user.id
+                const perInfosOrg = this.$store.getters.userInfo.org
+                if (!perInfosOrg) {
+                    alert('系统所登录的账户并没有所属部门,请先在系统设置完再进行确认!')
+                    return
+                }
+                // 判断签字图文是否存在
+                const sql1 = "select qian_zi_tu_wen_ FROM t_ryjbqk WHERE parent_id_ = '" + perInfosId + "'"
+                // 判断是否已经点击过确认
+                const sql2 = `select id_ FROM ibps_msg_read WHERE msg_id_ = '${this.id}' and receiver_id_='${perInfosId}'`
+                console.log('perInfosId', perInfosId)
+                Promise.all([curdPost('sql', sql1), curdPost('sql', sql2)]).then((res) => {
+                    const ryjbqkDatas = res[0].variables.data
+                    const cont2 = res[1].variables.data
+                    if (!ryjbqkDatas.length) {
+                        alert('系统所登录的账户并没有签字图文在系统,请先上传系统再进行确认!')
+                        return
+                    }
+                    if (!cont2.length) {
+                        const tempObj = {
+                            id_: generateUUID(),
+                            parent_id_: this.tableId,
+                            tong_zhi_bu_men_i: perInfosOrg.id,
+                            que_ren_qian_ming: JSON.stringify([{
+                                id: ryjbqkDatas[0].qian_zi_tu_wen_,
+                                fileName: '确认签名'
+                            }]),
+                            que_ren_ri_qi_: getDate(),
+                            qian_ming_id_: ryjbqkDatas[0].qian_zi_tu_wen_
+                        }
+                        const returnParams = {
+                            tableName: this.tableName.slice(0, this.tableName.indexOf('(')), // 字符串 "表名(发放时间)"
+                            paramWhere: [tempObj]
+                        }
+                        // 获取所发放的文件
+                        const files = this.$refs.innerMessage.form.fileMsg
+                        const addwjcysqbs = []
+                        for (const i of files.split(',')) {
+                            const addwjcysqb = {
+                                yong_hu_id_: this.$store.getters.userInfo.user.id,
+                                wen_jian_id_: i,
+                                shou_quan_: '1',
+                                fa_bu_ri_qi_: this.tableName.slice(this.tableName.indexOf('(') + 1, this.tableName.lastIndexOf(')'))
+                            }
+                            addwjcysqbs.push(addwjcysqb)
+                        }
+                        curdPost('add', JSON.stringify(returnParams)).then(() => { console.log('确认接收到发放文件') }).then(
+                            () => {
+                                this.type = ''
+                                this.getFormData()
+                            }
+                        )
+                        curdPost('add',
+                            '{"tableName": "t_wjcysqb","paramWhere":' + JSON.stringify(addwjcysqbs) + '}'
+                        ).then(response => {
+                            console.log(response)
+                        })
+                    }
+                })
+                this.closeDialog()
+            }).catch(() => { })
+        },
+        handleCallback (res) {
+            this.$emit('callback', res)
+        }
 
-          curdPost('add',
-            '{"tableName": "t_wjcysqb","paramWhere":' + JSON.stringify(addwjcysqbs) + '}'
-          ).then(response => {
-            console.log(response)
-          }).catch(error => {
-          })
-        });
-        this.closeDialog()
-      }).catch(() => { })
-    },
-    handleCallback(res) {
-      this.$emit('callback', res)
     }
-
-  }
 }
 </script>
 <style lang="scss">