Przeglądaj źródła

环境变量修改、自动生成快照、数据状态变更修复、消息发送更改、数据模板下载、通用类调整、系统分类调整

cfort 2 lat temu
rodzic
commit
101116a54f

+ 3 - 1
.env

@@ -1,7 +1,7 @@
 # 所有环境默认
 
 # 页面 title 前缀
-VUE_APP_TITLE= '实验室管理平台-深圳市金源信通科技有限公司'
+VUE_APP_TITLE = '实验室管理平台-深圳市金源信通科技有限公司'
 
 # 此项为jenkins打包需要修改的内容如果修改请明确知会,谢谢
 # 是否启用CDN
@@ -13,3 +13,5 @@ VUE_APP_GZ = true
 
 # element 颜色
 VUE_APP_ELEMENT_COLOR = #409EFF
+
+VUE_APP_BASE_URL = 'https://www.szjyxt.com/'

+ 18 - 19
.env.development

@@ -4,10 +4,10 @@ ENV = 'development'
 2、修复定时任务开启BUG
 #http://39.108.0.125/
 # ========base api====================== 192.168.0.99
-VUE_APP_BASE_API = 'http://localhost:1111/ibps'
-VUE_APP_BASE_WEBSOCKET_API = 'https://www.szjyxt.com/ibps'
-VUE_APP_BASE_GATEWAY_API=http://127.0.0.1:5100/ibps
-# ========report api======================
+VUE_APP_BASE_API = 'https://www.szjyxt.com/ibps'
+VUE_APP_BASE_WEBSOCKET_API = ${VUE_APP_BASE_API}
+VUE_APP_BASE_GATEWAY_API = http://127.0.0.1:5100/ibps
+# ========report api====================
 VUE_APP_BASE_REPORT_API = 'https://www.szjyxt.com/raqsoft'
 # 网络请求地址组
 # VUE_APP_API_[index]_[singleApp]_[name]_[title]=url
@@ -15,22 +15,21 @@ VUE_APP_BASE_REPORT_API = 'https://www.szjyxt.com/raqsoft'
 # 按 index 字段排序
 # index 最小的地址被默认激活
 # singleApp  是否单体应用 0:否,1:是
-# ---测试环境 192.168.2.99
-# VUE_APP_BASE_API_0_0_TEST=http://127.0.0.1:5100/ibps
-# ---后端开发环境
-# VUE_APP_BASE_API_1_0_DEV=http://127.0.0.1:5100/ibps
-# ---前端开发环境
-VUE_APP_BASE_API_2_0_FRONT=https://www.szjyxt.com/ibps
+# ---开发环境
+VUE_APP_BASE_API_0_0_DEV = ${VUE_APP_BASE_API}
+# ---本地环境1
+VUE_APP_BASE_API_1_0_134WY = http://192.168.2.134:5100/ibps
+# ---本地环境2
+VUE_APP_BASE_API_2_0_247GZL = http://192.168.2.247:5100/ibps
 # ---集成环境
-# VUE_APP_BASE_API_3_0_STAGING=https://www.szjyxt.com/ibps
+# VUE_APP_BASE_API_3_0_STAGING = ${VUE_APP_BASE_API}
 # ---生产环境
-# VUE_APP_BASE_API_4_0_PRODUCTION=https://www.szjyxt.com/ibps
+# VUE_APP_BASE_API_4_0_PRODUCTION = ${VUE_APP_BASE_API}
 # ---mock环境
-# VUE_APP_BASE_API_5_0_MOCK=https://www.szjyxt.com/ibps
-# ---本地环境 
-# VUE_APP_BASE_API_6_0_110=https://www.szjyxt.com/ibps
+# VUE_APP_BASE_API_5_0_MOCK = ${VUE_APP_BASE_API}
+# ---测试环境 
+# VUE_APP_BASE_API_6_0_TEST = ${VUE_APP_BASE_API}
 # ---多域名环境 
-# VUE_APP_BASE_API_7_0_DOMAIN=https://www.szjyxt.com/ibps
-#120.78.154.31
-
-
+# VUE_APP_BASE_API_7_0_DOMAIN = ${VUE_APP_BASE_API}
+# ---前端开发环境
+# VUE_APP_BASE_API_8_0_FRONT = ${VUE_APP_BASE_API}

+ 2 - 3
.env.prod.boot

@@ -10,8 +10,7 @@ VUE_APP_PUBLIC_PATH  = '/ibps3/'
 
 # ========base api======================
 VUE_APP_BASE_API = 'https://www.szjyxt.com/ibps'
-VUE_APP_BASE_WEBSOCKET_API = 'https://www.szjyxt.com/ibps'
+VUE_APP_BASE_WEBSOCKET_API = ${VUE_APP_BASE_API}
 
 # ========report api======================
-VUE_APP_BASE_REPORT_API = 'https://www.szjyxt.com/ibps'
-#120.78.154.31
+VUE_APP_BASE_REPORT_API = ${VUE_APP_BASE_API}

+ 0 - 1
.env.prod.cloud

@@ -13,4 +13,3 @@ VUE_APP_BASE_WEBSOCKET_API = 'ws://cloud.bpmhome.cn:28888'
 
 # ========report api======================
 VUE_APP_BASE_REPORT_API = 'https://www.szjyxt.com/ibps'
-#120.78.154.31

+ 2 - 3
.env.prod.test

@@ -10,7 +10,6 @@ ENV = 'prod.test'
 
 # ========base api======================
 VUE_APP_BASE_API = 'https://www.szjyxt.com/ibps'
-VUE_APP_BASE_WEBSOCKET_API = 'https://www.szjyxt.com/ibps'
+VUE_APP_BASE_WEBSOCKET_API = ${VUE_APP_BASE_API}
 # ========report api======================
-VUE_APP_BASE_REPORT_API = 'https://www.szjyxt.com/ibps'
-#120.78.154.31
+VUE_APP_BASE_REPORT_API = ${VUE_APP_BASE_API}

+ 1 - 2
.env.production

@@ -9,5 +9,4 @@ NODE_ENV = 'production'
 	VUE_APP_BASE_API = 'https://www.szjyxt.com/ibps'
 	VUE_APP_BASE_WEBSOCKET_API = 'ws://yapi.bpmhome.cn:28888'
 # ========report api======================
-	VUE_APP_BASE_REPORT_API = 'https://www.szjyxt.com/ibps'
-	#120.78.154.31
+	VUE_APP_BASE_REPORT_API = ${VUE_APP_BASE_API}

+ 0 - 2
.env.staging

@@ -14,5 +14,3 @@ VUE_APP_BASE_WEBSOCKET_API = 'ws://yapi.bpmhome.cn:28888'
 
 # ========report api======================
 VUE_APP_BASE_REPORT_API = 'https://www.szjyxt.com/ibps'
-#https://www.szjyxt.com
-

+ 71 - 71
src/api/platform/message/innerMessage.js

@@ -5,129 +5,129 @@ import { MSG_URL } from '@/api/baseUrl'
  * 查询收到的内部消息
  * @param {*} params
  */
-export function queryReceivePageList(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessage/receive',
-    method: 'post',
-    data: params
-  })
+export function queryReceivePageList (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessage/receive',
+        method: 'post',
+        data: params
+    })
 }
 /**
  * 查询发送的内部消息
  * @param {*} params
  */
-export function querySentPageList(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessage/sent',
-    method: 'post',
-    data: params
-  })
+export function querySentPageList (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessage/sent',
+        method: 'post',
+        data: params
+    })
 }
 
 /**
  * 查询已回复列表数据
  * @param {*} params
  */
-export function getReplyPageList(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessageReply/query',
-    method: 'post',
-    data: params
-  })
+export function getReplyPageList (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessageReply/query',
+        method: 'post',
+        data: params
+    })
 }
 /**
  * 查询已读取列表数据
  * @param {*} params
  */
-export function getReadPageList(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessageRead/query',
-    method: 'post',
-    data: params
-  })
+export function getReadPageList (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessageRead/query',
+        method: 'post',
+        data: params
+    })
 }
 /**
  * 删除数据
  * @param {*} params
  */
-export function remove(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessage/remove',
-    method: 'post',
-    isLoading: true,
-    params: params
-  })
+export function remove (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessage/remove',
+        method: 'post',
+        isLoading: true,
+        params: params
+    })
 }
 /**
  * 标记为已读
  * @param {*} params
  */
-export function markRead(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessage/markRead',
-    method: 'post',
-    isLoading: true,
-    params: params
-  })
+export function markRead (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessage/markRead',
+        method: 'post',
+        isLoading: true,
+        params: params
+    })
 }
 
 /**
  * 回复
  * @param {*} params
  */
-export function saveReply(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessage/saveReply',
-    method: 'post',
-    isLoading: true,
-    data: params
-  })
+export function saveReply (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessage/saveReply',
+        method: 'post',
+        isLoading: true,
+        data: params
+    })
 }
 /**
  * 获取数据(包含列表数据)
  * @param {*} params
  */
-export function get(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessage/get',
-    method: 'get',
-    params
-  })
+export function get (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessage/get',
+        method: 'get',
+        params
+    })
 }
 
 /**
  * 保存内部消息
  * @param {*} params
  */
-export function save(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessage/save',
-    method: 'post',
-    isLoading: true,
-    data: params
-  })
+export function save (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessage/save',
+        method: 'post',
+        isLoading: true,
+        data: params
+    })
 }
 
 /**
  * 取我的消息列表
  * @param {*} params
  */
-export function getMsgList(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessage/msgList',
-    method: 'get',
-    data: params
-  })
+export function getMsgList (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessage/msgList',
+        method: 'get',
+        data: params
+    })
 }
 
 /**
  * 获取我的未读消息列表,带参数
  * @param {*} params
  */
- export function getMyMsgList(params) {
-  return request({
-    url: MSG_URL() + '/msg/innerMessage/indexMsgList',
-    method: 'post',
-    data: params
-  })
-}
+export function getMyMsgList (params) {
+    return request({
+        url: MSG_URL() + '/msg/innerMessage/indexMsgList',
+        method: 'post',
+        data: params
+    })
+}

+ 124 - 50
src/business/platform/bpmn/form/action.js

@@ -6,7 +6,7 @@ import Print from '@/utils/print'
 export default {
     methods: {
         // 内嵌url表单,外部url表单 【自定义】
-        emitButtonEventHandler(actionName, args) {
+        emitButtonEventHandler (actionName, args) {
             // 前置事件
             this.beforeScript(actionName, (result) => {
                 if (result) {
@@ -15,15 +15,15 @@ export default {
             })
         },
         // 设置是否过审的状态
-        setData(title) {
+        setData (title) {
             let data = title
             if (!title) {
-                //获取当前流程步骤名
-                data = "已" + this.getFormEL().formDefData.flowName
+                // 获取当前流程步骤名
+                data = '已' + this.getFormEL().formDefData.flowName
             }
-            this.getFormEL().setData("shiFouGuoShen", data)
+            this.getFormEL().setData('shiFouGuoShen', data)
         },
-        emitEventHandler(actionName, args) {
+        emitEventHandler (actionName, args) {
             const this_ = this
             this.actionName = actionName
             const buttonType = args && args.attributes ? args.attributes.button_type || actionName : actionName
@@ -31,12 +31,7 @@ export default {
             this.submitFormOpinion = this.getFormOpinionData()
             switch (buttonType) {
                 case 'agree':// 同意
-                    // 判断是否最后一步流程
-                    if (this.actionTitle == '同意并结束') {
-                        this.setData("1")
-                    } else {
-                        this.setData()
-                    }
+                    this.setData()
                     // if (this.isHide()) {
                     this.handleDirectActionEvent(actionName)
                     // } else {
@@ -46,15 +41,15 @@ export default {
                 case 'oppose':// 反对
                     this_.$confirm(
                         `确定进行 [ ${args.attributes.label} ] 操作 ?`,
-                        "提示:",
+                        '提示:',
                         {
-                            confirmButtonText: "确定",
-                            cancelButtonText: "取消",
-                            type: "warning"
+                            confirmButtonText: '确定',
+                            cancelButtonText: '取消',
+                            type: 'warning'
                         }
                     ).then(() => {
                         // if (this.isHide()) {
-                        this.setData("未同意")
+                        this.setData('未同意')
                         this.handleDirectActionEvent(actionName)
                         // } else {
                         //     this.agreeDialogVisible = true
@@ -64,11 +59,11 @@ export default {
                 case 'abandon':// 弃权
                     this_.$confirm(
                         `确定进行 [ 弃权 ] 操作 ?`,
-                        "提示:",
+                        '提示:',
                         {
-                            confirmButtonText: "确定",
-                            cancelButtonText: "取消",
-                            type: "warning"
+                            confirmButtonText: '确定',
+                            cancelButtonText: '取消',
+                            type: 'warning'
                         }
                     ).then(() => {
                         if (this.isHide()) {
@@ -92,21 +87,21 @@ export default {
                     break
                 case 'startFlow': // 启动流程
                     if (this.actionTitle === '同意并结束' || this.actionTitle === '提交并结束') {
-                        this.setData("已完成")
+                        this.setData('已完成')
                     } else {
-                        this.setData("已编制")
+                        this.setData('已编制')
                     }
-                    // this.setData("已编制")
+                    // this.setData('已编制')
                     this.handleStartFlow()
                     break
                 case 'saveDraft': // 保存草稿
-                    this.setData("已暂存")
+                    this.setData('已暂存')
                     this.handleSaveDraft()
                     break
                 case 'rejectToPrevious':// 驳回上一步
                 case 'rejectToStart':// 驳回发起人
                 case 'reject':// 驳回
-                    this.setData("已退回")
+                    this.setData('已退回')
                     // if (this.isBpmOpinionHide && actionName === 'rejectToPrevious') {
                     //     this.handleDirectActionEvent(actionName)
                     // } else {
@@ -127,7 +122,7 @@ export default {
                     this.addSignTaskDialogVisible = true
                     break
                 case 'endProcess':// 终止流程
-                    this.setData("2")
+                    this.setData('已终止')
                     this.handleEndProcess()
                     break
                 case 'print':// 打印
@@ -149,7 +144,7 @@ export default {
                     this.handleRecoverProcess()
                     break
                 case 'save':// 节点按钮设置-保存
-                    this.setData("已暂存")
+                    this.setData('已暂存')
                     this.handleSave()
                     break
                 default:
@@ -159,11 +154,11 @@ export default {
         /**
          * 是否隐藏
          */
-        isHide() {
+        isHide () {
             return (this.isBpmOpinionHide && this.attributes.isHidePath) || (this.attributes.isCommonJumpType && this.attributes.isHideOpinion && this.attributes.isHidePath) || (this.attributes.isEnd && this.attributes.isHideOpinion)
         },
         // 是否保存[节点-按钮设置-保存]
-        handleSave() {
+        handleSave () {
             const formData = this.getFormData()
             const loading = this.$loading({
                 lock: true,
@@ -192,7 +187,7 @@ export default {
         /**
          * 处理启动流程
          */
-        handleStartFlow() {
+        handleStartFlow () {
             const firstNodeUserAssign = this.attributes.firstNodeUserAssign || false
             if (firstNodeUserAssign) {
                 const formData = this.getFormData()
@@ -207,7 +202,7 @@ export default {
          * 保存启动流程
          * @param {*}
          */
-        saveStartFlow(params = {}) {
+        saveStartFlow (params = {}) {
             const formData = this.getFormData()
             if (!formData) return
             const jsonData = {
@@ -232,6 +227,8 @@ export default {
             })
             // 1、直接启动
             startFlow(jsonData).then(response => {
+                const { bizKey = '', proInstId = '' } = response.variables || {}
+                this.createSnapshot(bizKey, proInstId)
                 loading.close()
                 this.$alert(`启动成功!`, {
                     showClose: false
@@ -253,7 +250,7 @@ export default {
         /**
          * 保存草稿
          */
-        handleSaveDraft() {
+        handleSaveDraft () {
             // 表单数据
             const formData = this.getFormData()
             if (!formData) return
@@ -293,7 +290,7 @@ export default {
          * 直接同意流程
          * @param {*} actionName
          */
-        handleDirectActionEvent(actionName) {
+        handleDirectActionEvent (actionName) {
             const opinion = this.hasFormOpinion() ? this.getFormOpinionData() : ''
             this.handleActionEvent(actionName, {
                 opinion: opinion
@@ -304,7 +301,7 @@ export default {
          * @param {*} actionName
          * @param {*} params
          */
-        handleActionEvent(actionName, params) {
+        handleActionEvent (actionName, params) {
             if (actionName === 'agree' || actionName === 'oppose' || actionName === 'abandon' || actionName === 'rejectToPrevious' || actionName === 'rejectToStart' || actionName === 'reject') {
                 this.handleComplete(actionName, params)
             } else if (actionName === 'endProcess') {
@@ -313,7 +310,7 @@ export default {
                 this.handleAddSignTask(params)
             }
         },
-        handleComplete(actionName, params = {}) {
+        handleComplete (actionName, params = {}) {
             const formData = this.getFormData()
             if (!formData) return
             const loading = this.$loading({
@@ -325,7 +322,9 @@ export default {
 
             if (actionName === 'agree') {
                 agree(params).then(response => {
+                    console.log(response)
                     this.handleResponse(actionName, loading, response)
+                    this.createSnapshot()
                 }).catch(() => {
                     loading.close()
                 })
@@ -361,7 +360,7 @@ export default {
                 })
             }
         },
-        handleResponse(actionName, loading, response) {
+        handleResponse (actionName, loading, response) {
             loading.close()
             this.$alert(response.message, {
                 showClose: false
@@ -382,7 +381,7 @@ export default {
                 })
             }).catch(() => { })
         },
-        handleEndProcess() {
+        handleEndProcess () {
             if (this.isBpmOpinionHide) {
                 this.$confirm('确定终止流程!', '提示', {
                     type: 'warning'
@@ -400,7 +399,7 @@ export default {
          * 处理终止任务
          * @param {*} params
          */
-        handleDoEndProcess(params) {
+        handleDoEndProcess (params) {
             const loading = this.$loading({
                 lock: true,
                 text: this.$t('common.saving')
@@ -409,11 +408,19 @@ export default {
                 taskId: this.taskId ? this.taskId : this.endProcessTaskId,
                 endReason: params.opinion
             }).then(response => {
+                console.log(response)
                 loading.close()
                 this.$alert(response.message, {
                     showClose: false
                 }).then(() => {
                     this.approveDialogVisible = false
+                    // 更改数据状态为已终止
+                    const { key = '' } = this.getFormEL().formDefData || {}
+                    const { id = '' } = this.getFormEL().formData || {}
+                    if (!id || !key) {
+                        return
+                    }
+                    this.updateState(id, key, '已终止', null)
                     // 后置事件
                     this.afterScript(this.actionName, {
                         data: response.data,
@@ -423,7 +430,7 @@ export default {
                         this.callbackPage()
                     })
                 })
-            }).catch((err) => {
+            }).catch(() => {
                 loading.close()
             })
         },
@@ -431,7 +438,7 @@ export default {
          * 补签
          * @param {*} params
          */
-        handleAddSignTask(params) {
+        handleAddSignTask (params) {
             const loading = this.$loading({
                 lock: true,
                 text: this.$t('common.saving')
@@ -456,14 +463,14 @@ export default {
                         this.callbackPage()
                     })
                 })
-            }).catch((err) => {
+            }).catch(() => {
                 loading.close()
             })
         },
         /**
          * 打印
          */
-        handlePrint() {
+        handlePrint () {
             if (this.$utils.isNotEmpty(this.printTemplateId)) {
                 this.submitFormData = this.getFormData()
                 // 打开打印模版页面
@@ -486,7 +493,7 @@ export default {
         /**
          * 锁定任务
          */
-        handleLock() {
+        handleLock () {
             this.$confirm('确定锁定任务!', '提示', {
                 type: 'warning'
             }).then(() => {
@@ -516,7 +523,7 @@ export default {
         /**
          * 解锁任务
          */
-        handleUnlock() {
+        handleUnlock () {
             this.$confirm('确定解锁任务!', '提示', {
                 type: 'warning'
             }).then(() => {
@@ -546,7 +553,7 @@ export default {
         /**
          * 强制解锁任务
          */
-        handleForceUnlock() {
+        handleForceUnlock () {
             this.$confirm('确定强制解锁任务!', '提示', {
                 type: 'warning'
             }).then(() => {
@@ -576,7 +583,7 @@ export default {
         /**
          * 挂起任务
          */
-        handleSuspendProcess() {
+        handleSuspendProcess () {
             this.$confirm('确定挂起任务', '提示', {
                 type: 'warning'
             }).then(() => {
@@ -606,7 +613,7 @@ export default {
         /**
          * 恢复任务
          */
-        handleRecoverProcess() {
+        handleRecoverProcess () {
             this.$confirm('确定恢复任务', '提示', {
                 type: 'warning'
             }).then(() => {
@@ -637,8 +644,75 @@ export default {
 
             })
         },
-        finishTask(actionName, params, callback) {
-
+        async createSnapshot (bizKey, proId) {
+            const { key = '', name = '' } = this.getFormEL().formDefData || {}
+            const { proInstId = '' } = this.getFormEL().params || {}
+            const id = bizKey || this.getFormEL().formData.id
+            if (!key) {
+                return
+            }
+            // 轮询流程是否结束,流程未结束不生成快照,每2秒查询一次,最多等待10秒钟
+            let timeout = 10000
+            const intervalTime = 2000
+            while (!(await this.isFinish(proId || proInstId))) {
+                timeout -= intervalTime
+                if (timeout <= 0) {
+                    // 超时,流程还未结束,结束生成快照
+                    console.log('流程未结束,无法生成快照')
+                    return
+                }
+                // 等待一段时间后再次查询
+                await new Promise(resolve => setTimeout(resolve, intervalTime))
+            }
+            // if (!(await this.isFinish(proId || proInstId))) {
+            //     return
+            // }
+            const sql = `select * from t_lcidglbdbb where shi_fou_zi_biao_ = 't_${key}'`
+            this.$common.request('sql', sql).then(res => {
+                const { data = [] } = res.variables || {}
+                if (!data.length) {
+                    return
+                }
+                const path = data[0].bao_biao_lu_jing_
+                const url = this.$getReportFile(path, `id_=${id}`)
+                const fileName = name + this.$common.getNow(16, 'string')
+                console.log(url, fileName)
+                this.$common.snapshoot({
+                    url,
+                    name: fileName,
+                    type: 'pdf'
+                }).then(res => {
+                    if (!res.data || !res.data.id) {
+                        this.$message.error('生成快照失败!')
+                    }
+                    const fileId = res.data && res.data.id ? res.data.id : ''
+                    const fileParams = fileId ? { kuai_zhao_: fileId } : {}
+                    this.updateState(id, key, '已完成', fileParams)
+                })
+            })
+        },
+        // 判断流程是否结束
+        async isFinish (id) {
+            const sql = `select * from ibps_bpm_inst_his where id_ = '${id}'`
+            const res = await this.$common.request('sql', sql)
+            const { data = [] } = res.variables || {}
+            return data.length > 0
+        },
+        // 更新数据状态
+        updateState (id, key, state, fileParams) {
+            const params = {
+                tableName: `t_${key}`,
+                updList: [{
+                    where: {
+                        id_: id
+                    },
+                    param: {
+                        shi_fou_guo_shen_: state,
+                        ...fileParams
+                    }
+                }]
+            }
+            this.$common.request('update', params)
         }
     }
 }

+ 1 - 0
src/business/platform/bpmn/form/index.vue

@@ -407,6 +407,7 @@
                     // 一些参数
                     this.attributes = this.initAttributes(data)
                     this.formParams.nodeId = this.attributes.nodeId
+                    this.formParams.proInstId = data.attributes.proInstId
                     // 操作按钮
                     this.buttons = this.buildButtons(data.buttons, this.attributes) || []
                     // 表单意见

+ 11 - 2
src/business/platform/data/templaterender/templates/list.vue

@@ -804,8 +804,17 @@ export default {
                             this.$message.warning('请先配置对应报表路径!')
                             return
                         }
-                        src = `${this.$reportPath}${this.downloadPath}&id_=${selection}`
-                        preview(this, src)
+                        this.$common.snapshoot({
+                            url: this.$getReportFile(this.downloadPath, `id_=${selection}`),
+                            name: selection,
+                            type: 'pdf'
+                        }).then(res => {
+                            if (!res.data || !res.data.id) {
+                                this.$message.error('生成文件失败,请重试!')
+                                return
+                            }
+                            this.$common.download(res.data)
+                        })
                         break
                     case 'print': // 打印
                         ActionUtils.selectedRecord(selection)

+ 19 - 19
src/business/platform/file/utils/index.js

@@ -3,23 +3,23 @@ import Utils from '@/utils/util'
 import ActionUtils from '@/utils/action'
 import { Loading } from 'element-ui'
 
-export function downloadFile(file) {
-  const loadingInstance = Loading.service({
-    lock: true,
-    text: '下载中..'
-  })
-  download({
-    attachmentId: file.id
-  }).then(response => {
-    loadingInstance.close()
-    if (!response) {
-      return
-    }
-    ActionUtils.exportFile(
-      response.data,
-      file.fileName + (Utils.isNotEmpty(file.ext) ? '.' + file.ext : '')
-    )
-  }).catch(() => {
-    loadingInstance.close()
-  })
+export function downloadFile (file) {
+    const loadingInstance = Loading.service({
+        lock: true,
+        text: '下载中..'
+    })
+    download({
+        attachmentId: file.id
+    }).then(response => {
+        loadingInstance.close()
+        if (!response) {
+            return
+        }
+        ActionUtils.exportFile(
+            response.data,
+            file.fileName + (Utils.isNotEmpty(file.ext) ? '.' + file.ext : '')
+        )
+    }).catch(() => {
+        loadingInstance.close()
+    })
 }

+ 298 - 300
src/business/platform/form/formrender/dynamic-form/dynamic-form-item.vue

@@ -1,73 +1,73 @@
 <template>
-  <div v-if="!hidden">
-    <!-- 只读类型-->
-    <ibps-dynamic-form-other
-      v-if="isOtherFieldType"
-      :models="models"
-      :field="field"
-      :params="params"
-    />
-    <template v-else>
-      <el-form-item
-        ref="formItem"
-        :prop="prop"
-        :rules="rules"
-        v-if="fieldType!=='approval_opinion' || ( fieldType==='approval_opinion' && (formOpinionData[fieldName] && formOpinionData[fieldName].length>0 || !readonly))"
-        :label="fieldType==='table'?null:label"
-        :label-width="labelWidth"
-        :class="field.field_options.custom_class"
-      >
-        <template v-if="fieldType!=='table'" slot="label">{{ label + labelSuffix }}
-          <ibps-help v-if="field && field.desc && descPosition==='lableIcon'" type="tooltip" :content="$utils.formatText(field.desc)" />
-        </template>
-        <!-- 表单意见-->
-        <ibps-dynamic-form-opinion
-          v-if="fieldType==='approval_opinion'"
-          ref="formField"
-          :value.sync="dataModel"
-          :field="field"
-          :readonly="readonly"
-          :readonly-style="readonlyStyle"
-          :opinion-data="formOpinionData[fieldName]"
-          :params="params"
-          v-on="listeners"
-        />
-        <!--子表-->
-        <ibps-dynamic-form-table
-          v-else-if="fieldType==='table'"
-          ref="formField"
-          :value.sync="dataModel"
-          :form-data="$utils.isNotEmpty(row)?formData:models"
-          :main-code="code"
-          :field="field"
-          :rights="fieldRights"
-          :readonly="readonly"
-          :params="params"
-          v-on="listeners"
-        />
-        <!--字段-->
-        <ibps-dynamic-form-field
-          v-else
-          ref="formField"
-          :value.sync="dataModel"
-          :field="field"
-          :form-data="models"
-          :readonly="readonly"
-          :readonly-style="readonlyStyle"
-          :row="row"
-          :code="code"
-          :params="params"
-          v-on="listeners"
+    <div v-if="!hidden">
+        <!-- 只读类型-->
+        <ibps-dynamic-form-other
+            v-if="isOtherFieldType"
+            :models="models"
+            :field="field"
+            :params="params"
         />
-        <!-- ######描述属性###### -->
-        <div
-          v-if="field && field.desc && descPosition==='inline'"
-          class="ibps-help-block"
-          v-html="$utils.formatText(field.desc )"
-        />
-      </el-form-item>
-    </template>
-  </div>
+        <template v-else>
+            <el-form-item
+                v-if="fieldType!=='approval_opinion' || ( fieldType==='approval_opinion' && (formOpinionData[fieldName] && formOpinionData[fieldName].length>0 || !readonly))"
+                ref="formItem"
+                :prop="prop"
+                :rules="rules"
+                :label="fieldType==='table'?null:label"
+                :label-width="labelWidth"
+                :class="field.field_options.custom_class"
+            >
+                <template v-if="fieldType!=='table'" slot="label">{{ label + labelSuffix }}
+                    <ibps-help v-if="field && field.desc && descPosition==='lableIcon'" type="tooltip" :content="$utils.formatText(field.desc)" />
+                </template>
+                <!-- 表单意见-->
+                <ibps-dynamic-form-opinion
+                    v-if="fieldType==='approval_opinion'"
+                    ref="formField"
+                    :value.sync="dataModel"
+                    :field="field"
+                    :readonly="readonly"
+                    :readonly-style="readonlyStyle"
+                    :opinion-data="formOpinionData[fieldName]"
+                    :params="params"
+                    v-on="listeners"
+                />
+                <!--子表-->
+                <ibps-dynamic-form-table
+                    v-else-if="fieldType==='table'"
+                    ref="formField"
+                    :value.sync="dataModel"
+                    :form-data="$utils.isNotEmpty(row)?formData:models"
+                    :main-code="code"
+                    :field="field"
+                    :rights="fieldRights"
+                    :readonly="readonly"
+                    :params="params"
+                    v-on="listeners"
+                />
+                <!--字段-->
+                <ibps-dynamic-form-field
+                    v-else
+                    ref="formField"
+                    :value.sync="dataModel"
+                    :field="field"
+                    :form-data="models"
+                    :readonly="readonly"
+                    :readonly-style="readonlyStyle"
+                    :row="row"
+                    :code="code"
+                    :params="params"
+                    v-on="listeners"
+                />
+                <!-- ######描述属性###### -->
+                <div
+                    v-if="field && field.desc && descPosition==='inline'"
+                    class="ibps-help-block"
+                    v-html="$utils.formatText(field.desc )"
+                />
+            </el-form-item>
+        </template>
+    </div>
 </template>
 <script>
 import FormUtil from '@/business/platform/form/utils/formUtil'
@@ -75,248 +75,246 @@ import FormOptions from '../../constants/formOptions'
 import { otherFieldTypes } from '@/business/platform/form/constants/fieldTypes'
 
 export default {
-  props: {
-    models: [Object, Array], // 当前字段数据
-    rights: [String, Object], // 字段权限
-    formData: [Array, Object], // 表单数据(包含子表)
-    field: Object, // 字段
-    code: String, // 表名
-    mainCode: String, // 主表名
-    row: [String, Number], // 子表行数
-    params: Object // 参数
-  },
-  inject: {
-    elForm: {
-      default: ''
-    },
-    elFormItem: {
-      default: ''
-    }
-  },
-  data() {
-    let defaultVal = ''
-    if (this.field.field_type === 'table') {
-      // 一对多,是数组,一对一是对象
-      defaultVal = this.field.field_options.relation === 'one2one' ? {} : []
-    } else {
-      defaultVal = ''
-    }
-
-    return {
-      dataModel: this.models[this.field.name] || defaultVal,
-      fieldRights: this.rights[this.field.name] || 'e'
-    }
-  },
-  computed: {
-    fieldName() {
-      return this.field.name
-    },
-    prop() {
-      if (this.$utils.isNotEmpty(this.row)) {
-        return this.code + '.' + this.row + '.' + this.fieldName
-      }
-      return this.fieldName
-    },
-    label() { // 显示的文本
-      if (this.fieldType === 'table' || this.field.field_options.hide_label) return null
-      return this.$utils.isNotEmpty(this.field.field_options.units) ? this.field.label + '(' + this.field.field_options.units + ')' : this.field.label
-    },
-    labelSuffix() {
-      return this.params.labelSuffix
-    },
-    labelWidth() { // 字段宽度
-      if (this.fieldType === 'table' || this.field.field_options.hide_label) { return '0' }
-      return this.field.field_options.is_label_width ? this.field.field_options.label_width + (this.field.field_options.label_width_unit || 'px') : this.defaultLabelWidth
-    },
-
-    fieldType() {
-      return this.field.field_type
-    },
-    subTableRights() { // 子表权限
-      if (this.fieldType === 'table' && this.$utils.isNotEmpty(this.fieldRights) &&
-      this.$utils.isPlainObject(this.fieldRights)) {
-        return this.fieldRights['rights']
-      }
-      return false
-    },
-    hidden() { // 是否隐藏
-      if (this.subTableRights) {
-        return this.subTableRights === FormOptions.t.PERMISSIONS.HIDE
-      }
-      return this.fieldRights === FormOptions.t.PERMISSIONS.HIDE || this.fieldType === 'hidden' ||
-      (this.fieldType === 'approval_opinion' && (this.$utils.isNotEmpty(this.defId) || this.hiddenApprovalOpinion))
+    props: {
+        models: [Object, Array], // 当前字段数据
+        rights: [String, Object], // 字段权限
+        formData: [Array, Object], // 表单数据(包含子表)
+        field: Object, // 字段
+        code: String, // 表名
+        mainCode: String, // 主表名
+        row: [String, Number], // 子表行数
+        params: Object // 参数
     },
-    readonly() { // 是否只读
-      if (this.subTableRights) {
-        return this.subTableRights === FormOptions.t.PERMISSIONS.READ
-      }
-      return this.readonlyRights ? true : this.fieldRights === FormOptions.t.PERMISSIONS.READ
-    },
-    required() { // 必填  【只读隐藏,都设置非必填】
-      if (this.readonly || this.hidden) {
-        return false
-      }
-      if (this.subTableRights) {
-        return this.subTableRights === FormOptions.t.PERMISSIONS.REQUIRED
-      }
-      return this.fieldRights === FormOptions.t.PERMISSIONS.REQUIRED ? true : this.field.field_options.required || false
-    },
-    isOtherFieldType() {
-      return otherFieldTypes.includes(this.fieldType)
-    },
-    rules() { // 表单字段规则
-      if (this.readonly || this.hidden) { return [] }
-      return FormUtil.buildFormRules(this.field, this.required, this.models)
-    },
-    descPosition() {
-      return this.params.descPosition || 'inline'
-    },
-    defaultLabelWidth() {
-      return this.params.labelWidth
-    },
-    readonlyRights() {
-      return this.params.readonly
-    },
-    readonlyStyle() {
-      return this.params.readonlyStyle
-    },
-    formula() {
-      return this.params.responseFormula
-    },
-    linkages() {
-      return this.params.responseLinkages
-    },
-    formOpinionData() {
-      return this.params.responseFormOpinionData || {}
-    },
-    listeners() {
-      return {
-        ...this.$listeners,
-        change: (data) => { // 在 Input 值改变时触发
-          // 值改变进行数据联动
-          this.runLinkage()
-          this.emitEvent('change', data)
+    inject: {
+        elForm: {
+            default: ''
         },
-        focus: (event) => { this.emitEvent('focus', event) }, // 在 Input 获得焦点时触发
-        blur: (event) => { this.emitEvent('blur', event) }, // 在 Input 失去焦点时触发
-        // click: (event) => { this.emitEvent('click', event) } // 在 Input 点击时触发
-        'change-data': this.handleModels // 数据改变
-      }
-    }
-  },
-  watch: {
-   dataModel: {
-      handler(val) {
-        if (FormOptions.t.NON_MODEL_FIELD_TYPES.includes(this.fieldType)) {
-          return
+        elFormItem: {
+            default: ''
         }
-        this.handleModels(this.fieldName, val)
-        this.$nextTick(() => {
-          // 值改变进行公式计算
-          this.runCalFormula()
-        })
-      },
-     /* deep: false, */
-       immediate: true
-    },
-    models: {
-      handler(val, oldVal) {
-      this.dataModel =  val[this.fieldName]
-      },
-     deep: true
-    },
-    fieldRights: {
-      handler(val) {
-        this.handleFieldRights(this.fieldName, val)
-      },
-      deep: true,
-      immediate: true
-    },
-    rights: {
-      handler(val, oldVal) {
-        this.fieldRights = val[this.fieldName]
-      },
-      deep: true,
-      immediate: true
-    }
-  },
-  methods: {
-    handleModels(name, val) {
-      if (this.$utils.isEmpty(name)) {
-        return
-      }
-      this.models[name] = val
-      this.$emit('update:models', {
-        ...this.models,
-        [name]: val
-      })
-    },
-    handleFieldRights(name, val) {
-      if (this.$utils.isEmpty(name)) {
-        return
-      }
-      this.rights[name] = val
-      this.$emit('update:rights', {
-        ...this.rights,
-        [name]: val
-      })
-    },
-    setFieldData(name, val) {
-      setTimeout(() => {
-        this.$emit('update-form-data', name, val)
-      }, 10)
     },
-    /**
-     * 进行公式计算
-     */
-    runCalFormula() {
-      if (!this.formula) return
-      const { field, code, mainCode, row } = this
-      if (field.field_type === 'table') {
-        const columns = field.field_options.columns || []
-        for (let i = 0; i < columns.length; i++) {
-          const column = columns[i]
-          this.calFormula(field.name, column.name, mainCode, row)
-        }
-      } else {
-        this.calFormula(code, field.name, mainCode, row)
-      }
-    },
-    calFormula(code, name, mainCode, row) {
-      const key = code + '.' + name
-      const formulas = this.formula[key]
-      if (formulas) {
-        if (mainCode) {
-          FormUtil.runSubCalFormula(this, formulas, code, mainCode, row)
+    data () {
+        let defaultVal = ''
+        if (this.field.field_type === 'table') {
+            // 一对多,是数组,一对一是对象
+            defaultVal = this.field.field_options.relation === 'one2one' ? {} : []
         } else {
-          FormUtil.runMainCalFormula(this, formulas, code)
+            defaultVal = ''
+        }
+
+        return {
+            dataModel: this.models[this.field.name] || defaultVal,
+            fieldRights: this.rights[this.field.name] || 'e'
         }
-      }
     },
-    /**
-     * 进行联动数据
-     */
-    runLinkage() {
-      if (!this.linkages) return
-      const { field, code } = this
-      if (field.isSub) { // 子表
-        const key = code + '.' + field.name
-        const linkages = this.linkages ? this.linkages[key] : null
-        if (linkages) {
-          FormUtil.runLinkage(this, linkages, field, field.row)
+    computed: {
+        fieldName () {
+            return this.field.name
+        },
+        prop () {
+            if (this.$utils.isNotEmpty(this.row)) {
+                return this.code + '.' + this.row + '.' + this.fieldName
+            }
+            return this.fieldName
+        },
+        label () { // 显示的文本
+            if (this.fieldType === 'table' || this.field.field_options.hide_label) return null
+            return this.$utils.isNotEmpty(this.field.field_options.units) ? this.field.label + '(' + this.field.field_options.units + ')' : this.field.label
+        },
+        labelSuffix () {
+            return this.params.labelSuffix
+        },
+        labelWidth () { // 字段宽度
+            if (this.fieldType === 'table' || this.field.field_options.hide_label) { return '0' }
+            return this.field.field_options.is_label_width ? this.field.field_options.label_width + (this.field.field_options.label_width_unit || 'px') : this.defaultLabelWidth
+        },
+
+        fieldType () {
+            return this.field.field_type
+        },
+        subTableRights () { // 子表权限
+            if (this.fieldType === 'table' && this.$utils.isNotEmpty(this.fieldRights) && this.$utils.isPlainObject(this.fieldRights)) {
+                return this.fieldRights['rights']
+            }
+            return false
+        },
+        hidden () { // 是否隐藏
+            if (this.subTableRights) {
+                return this.subTableRights === FormOptions.t.PERMISSIONS.HIDE
+            }
+            return this.fieldRights === FormOptions.t.PERMISSIONS.HIDE || this.fieldType === 'hidden' || (this.fieldType === 'approval_opinion' && (this.$utils.isNotEmpty(this.defId) || this.hiddenApprovalOpinion))
+        },
+        readonly () { // 是否只读
+            if (this.subTableRights) {
+                return this.subTableRights === FormOptions.t.PERMISSIONS.READ
+            }
+            return this.readonlyRights ? true : this.fieldRights === FormOptions.t.PERMISSIONS.READ
+        },
+        required () { // 必填  【只读隐藏,都设置非必填】
+            if (this.readonly || this.hidden) {
+                return false
+            }
+            if (this.subTableRights) {
+                return this.subTableRights === FormOptions.t.PERMISSIONS.REQUIRED
+            }
+            return this.fieldRights === FormOptions.t.PERMISSIONS.REQUIRED ? true : this.field.field_options.required || false
+        },
+        isOtherFieldType () {
+            return otherFieldTypes.includes(this.fieldType)
+        },
+        rules () { // 表单字段规则
+            if (this.readonly || this.hidden) { return [] }
+            return FormUtil.buildFormRules(this.field, this.required, this.models)
+        },
+        descPosition () {
+            return this.params.descPosition || 'inline'
+        },
+        defaultLabelWidth () {
+            return this.params.labelWidth
+        },
+        readonlyRights () {
+            return this.params.readonly
+        },
+        readonlyStyle () {
+            return this.params.readonlyStyle
+        },
+        formula () {
+            return this.params.responseFormula
+        },
+        linkages () {
+            return this.params.responseLinkages
+        },
+        formOpinionData () {
+            return this.params.responseFormOpinionData || {}
+        },
+        listeners () {
+            return {
+                ...this.$listeners,
+                change: (data) => { // 在 Input 值改变时触发
+                    // 值改变进行数据联动
+                    this.runLinkage()
+                    this.emitEvent('change', data)
+                },
+                focus: (event) => { this.emitEvent('focus', event) }, // 在 Input 获得焦点时触发
+                blur: (event) => { this.emitEvent('blur', event) }, // 在 Input 失去焦点时触发
+                // click: (event) => { this.emitEvent('click', event) } // 在 Input 点击时触发
+                'change-data': this.handleModels // 数据改变
+            }
         }
-      } else {
-        field.code = code
-        const key = field.code + '.' + field.name
-        const linkages = this.linkages ? this.linkages[key] : null
-        if (linkages) {
-          FormUtil.runLinkage(this, linkages, field)
+    },
+    watch: {
+        dataModel: {
+            handler (val) {
+                if (FormOptions.t.NON_MODEL_FIELD_TYPES.includes(this.fieldType)) {
+                    return
+                }
+                this.handleModels(this.fieldName, val)
+                this.$nextTick(() => {
+                    // 值改变进行公式计算
+                    this.runCalFormula()
+                })
+            },
+            // deep: false,
+            immediate: true
+        },
+        models: {
+            handler (val, oldVal) {
+                this.dataModel = val[this.fieldName]
+            },
+            deep: true
+        },
+        fieldRights: {
+            handler (val) {
+                this.handleFieldRights(this.fieldName, val)
+            },
+            deep: true,
+            immediate: true
+        },
+        rights: {
+            handler (val, oldVal) {
+                this.fieldRights = val[this.fieldName]
+            },
+            deep: true,
+            immediate: true
         }
-      }
     },
-    emitEvent(event) {
-      this.$emit(event, ...Array.from(arguments).slice(1))
+    methods: {
+        handleModels (name, val) {
+            if (this.$utils.isEmpty(name)) {
+                return
+            }
+            this.models[name] = val
+            this.$emit('update:models', {
+                ...this.models,
+                [name]: val
+            })
+        },
+        handleFieldRights (name, val) {
+            if (this.$utils.isEmpty(name)) {
+                return
+            }
+            this.rights[name] = val
+            this.$emit('update:rights', {
+                ...this.rights,
+                [name]: val
+            })
+        },
+        setFieldData (name, val) {
+            setTimeout(() => {
+                this.$emit('update-form-data', name, val)
+            }, 10)
+        },
+        /**
+         * 进行公式计算
+         */
+        runCalFormula () {
+            if (!this.formula) return
+            const { field, code, mainCode, row } = this
+            if (field.field_type === 'table') {
+                const columns = field.field_options.columns || []
+                for (let i = 0; i < columns.length; i++) {
+                    const column = columns[i]
+                    this.calFormula(field.name, column.name, mainCode, row)
+                }
+            } else {
+                this.calFormula(code, field.name, mainCode, row)
+            }
+        },
+        calFormula (code, name, mainCode, row) {
+            const key = code + '.' + name
+            const formulas = this.formula[key]
+            if (formulas) {
+                if (mainCode) {
+                    FormUtil.runSubCalFormula(this, formulas, code, mainCode, row)
+                } else {
+                    FormUtil.runMainCalFormula(this, formulas, code)
+                }
+            }
+        },
+        /**
+         * 进行联动数据
+         */
+        runLinkage () {
+            if (!this.linkages) return
+            const { field, code } = this
+            if (field.isSub) { // 子表
+                const key = code + '.' + field.name
+                const linkages = this.linkages ? this.linkages[key] : null
+                if (linkages) {
+                    FormUtil.runLinkage(this, linkages, field, field.row)
+                }
+            } else {
+                field.code = code
+                const key = field.code + '.' + field.name
+                const linkages = this.linkages ? this.linkages[key] : null
+                if (linkages) {
+                    FormUtil.runLinkage(this, linkages, field)
+                }
+            }
+        },
+        emitEvent (event) {
+            this.$emit(event, ...Array.from(arguments).slice(1))
+        }
     }
-  }
 }
 </script>

+ 217 - 220
src/business/platform/form/formrender/dynamic-form/dynamic-form-table-item.vue

@@ -1,236 +1,233 @@
 <template>
-  <el-form-item
-    v-if="!hidden"
-    :prop="prop"
-    :rules="rules"
-    :label="mode === 'block'?label:null"
-    :label-width="mode === 'block'?fieldLabelWidth:'0px'"
-    :class="{
-      'dynamic-form-table-item__readonly':readonly
-    }"
-  >
-    <!--子表嵌套-->
-    <ibps-dynamic-form-table
-      v-if="field.field_type==='table'"
-      :value.sync="dataModel"
-      :field="field"
-      :row="row"
-      :rights="fieldRights"
-      :readonly="readonly"
-      :params="params"
-      v-on="listeners"
-    />
-    <ibps-dynamic-form-field
-      v-else
-      :value.sync="dataModel"
-      :field="field"
-      :form-data="formData"
-      :row="row"
-      :code="code"
-      :main-code="mainCode"
-      :readonly="readonly"
-      :params="params"
-      v-on="listeners"
-      :is-table="true"
-    />
-    <div
-      v-if="field && field.desc && descPosition==='inline'"
-      class="ibps-help-block"
-      v-html="$utils.formatText(field.desc )"
-    />
-  </el-form-item>
+    <el-form-item
+        v-if="!hidden"
+        :prop="prop"
+        :rules="rules"
+        :label="mode === 'block'?label:null"
+        :label-width="mode === 'block'?fieldLabelWidth:'0px'"
+        :class="{'dynamic-form-table-item__readonly':readonly}"
+    >
+        <!--子表嵌套-->
+        <ibps-dynamic-form-table
+            v-if="field.field_type==='table'"
+            :value.sync="dataModel"
+            :field="field"
+            :row="row"
+            :rights="fieldRights"
+            :readonly="readonly"
+            :params="params"
+            v-on="listeners"
+        />
+        <ibps-dynamic-form-field
+            v-else
+            :value.sync="dataModel"
+            :field="field"
+            :form-data="formData"
+            :row="row"
+            :code="code"
+            :main-code="mainCode"
+            :readonly="readonly"
+            :params="params"
+            :is-table="true"
+            v-on="listeners"
+        />
+        <div
+            v-if="field && field.desc && descPosition==='inline'"
+            class="ibps-help-block"
+            v-html="$utils.formatText(field.desc )"
+        />
+    </el-form-item>
 </template>
 <script>
 import FormUtil from '@/business/platform/form/utils/formUtil'
 import FormOptions from '../../constants/formOptions'
 
 export default {
-  props: {
-    models: [Object, Array], // 字段数据
-    rights: [String, Object], // 字段权限
-    formData: [Array, Object], // 表单数据(包含子表)
-    defaultValue: Object, // 默认值
-    field: Object, // 字段
-    mainCode: String, // 主表名
-    code: String, // 表名
-    row: [String, Number], // 子表行数
-    currPage:[String, Number], //页数量,
-    mode: { // 子表模式
-      type: String,
-      default: 'inner'
-    },
-    params: Object // 参数
-  },
-  data() {
-    let defaultVal = ''
-    if (this.field.field_type === 'table') {
-      // 一对多,是数组,一对一是对象
-      defaultVal = []
-    } else {
-      defaultVal = ''
-    }
-    return {
-      dataModel: this.models[this.field.name] || defaultVal,
-      fieldRights: this.rights[this.field.name] || 'e'
-    }
-  },
-  computed: {
-    prop() {
-      return this.code + '.' + this.row + '.' + this.field.name
-    },
-    label() { // 显示的文本
-      return this.$utils.isNotEmpty(this.field.field_options.units) ? this.field.label + '(' + this.field.field_options.units + ')' : this.field.label
-    },
-    fieldLabelWidth() { // 字段宽度
-      if (this.field.field_type === 'table') { return '0' }
-      return this.field.field_options.is_label_width ? this.field.field_options.label_width + (this.field.field_options.label_width_unit || 'px') : this.labelWidth
-    },
-    hidden() { // 是否隐藏
-      return this.fieldRights === FormOptions.t.PERMISSIONS.HIDE || this.field.field_type === 'hidden'
-    },
-    readonly() { // 是否只读
-      // 弹窗就是只读模式
-      return this.mode === 'dialog' ? true : this.readonlyRights ? true : this.fieldRights === FormOptions.t.PERMISSIONS.READ
-    },
-    required() { // 必填  【只读隐藏,都设置非必填】
-      return (this.readonly || this.hidden) ? false : (this.fieldRights === FormOptions.t.PERMISSIONS.REQUIRED ? true : this.field.field_options.required || false)
-    },
-    rules() {
-      if (this.readonly || this.hidden) { return [] }
-      return FormUtil.buildFormRules(this.field, this.required, this.formData)
-    },
-    descPosition() {
-      return this.params.descPosition || 'inline'
-    },
-    labelWidth() {
-      return this.params.labelWidth
-    },
-    readonlyRights() {
-      return this.params.readonly
-    },
-    readonlyStyle() {
-      return this.params.readonlyStyle
-    },
-    formula() {
-      return this.params.responseFormula
-    },
-    linkages() {
-      return this.params.responseLinkages
-    },
-    listeners() {
-      return {
-        ...this.$listeners,
-        change: (data) => {
-          // 值改变进行数据联动
-          this.runLinkage()
-          this.emitEvent('change', data)
-        }, // 在 Input 值改变时触发
-        focus: (event) => { this.emitEvent('focus', event) }, // 在 Input 获得焦点时触发
-        blur: (event) => { this.emitEvent('blur', event) }, // 在 Input 失去焦点时触发
-        // click: (event) => { this.emitEvent('click', event) } // 在 Input 点击时触发
-        'change-data': this.handleModels // 数据改变
-      }
-    }
-  },
-  watch: {
-    dataModel: {
-      handler(val,out) {
-        if (FormOptions.t.NON_MODEL_FIELD_TYPES.includes(this.field.field_type)) {
-          return
+    props: {
+        models: [Object, Array], // 字段数据
+        rights: [String, Object], // 字段权限
+        formData: [Array, Object], // 表单数据(包含子表)
+        defaultValue: Object, // 默认值
+        field: Object, // 字段
+        mainCode: String, // 主表名
+        code: String, // 表名
+        row: [String, Number], // 子表行数
+        currPage: [String, Number], // 页数量,
+        mode: { // 子表模式
+            type: String,
+            default: 'inner'
+        },
+        params: Object // 参数
+    },
+    data () {
+        let defaultVal = ''
+        if (this.field.field_type === 'table') {
+            // 一对多,是数组,一对一是对象
+            defaultVal = []
+        } else {
+            defaultVal = ''
         }
-        /* 如果是选择器或值来源类型, 需从监控方法进行更新数据*/
-        if(this.field.field_type == 'selector'
-        || this.field.field_type == 'select'
-        || this.field.field_type == "customDialog"
-        || this.field.field_type == "linkdata"){
-          this.handleModels(this.field.name, val)
+        return {
+            dataModel: this.models[this.field.name] || defaultVal,
+            fieldRights: this.rights[this.field.name] || 'e'
         }
-        this.$nextTick(() => {
-          // 值改变进行公式计算
-          this.runCalFormula()
-        })
-      },
-      deep: true,
-      immediate: true
-    },
-    models: {
-      handler(val, oldVal) {
-        this.dataModel = val[this.field.name]
-      },
-      deep: true
-    },
-    fieldRights: {
-      handler(val) {
-        this.rights[this.field.name] = val
-        this.$emit('update:rights', {
-          ...this.rights,
-          [this.field.name]: val
-        })
-      },
-      deep: true,
-      immediate: true
     },
-    rights: {
-      handler(val, oldVal) {
-        this.fieldRights = val[this.field.name]
-      },
-      deep: true,
-      immediate: true
-    }
-  },
-  methods: {
-    handleModels(name, val) {
-      this.models[name] = val
-      if(this.currPage){
-         this.$emit('updateModel', name, val,this.row,this.currPage)
-      }else{
-        this.$emit('update:models', {
-          ...this.models,
-          [name]: val
-        })
-      }
-    },
-    setFieldData(name, val) {
-      this.$emit('update-form-data', name, val)
-    },
-    /**
-     * 进行公式计算
-     */
-    runCalFormula() {
-      if (!this.formula) return
-      const { field, code, mainCode, row } = this
-      const key = code + '.' + field.name
-      const formulas = this.formula ? this.formula[key] : null
-      if (formulas) {
-        FormUtil.runSubCalFormula(this, formulas, code, mainCode, row)
-      }
-    },
-    /**
-     * 进行联动数据
-     */
-    runLinkage() {
-      if (!this.linkages) return
-      const { field, code, row } = this
-      if (field.isSub) { // 子表
-        const key = code + '.' + field.name
-        const linkages = this.linkages ? this.linkages[key] : null
-        if (linkages) {
-          FormUtil.runLinkage(linkages, this.models, field, row)
+    computed: {
+        prop () {
+            return this.code + '.' + this.row + '.' + this.field.name
+        },
+        label () { // 显示的文本
+            return this.$utils.isNotEmpty(this.field.field_options.units) ? this.field.label + '(' + this.field.field_options.units + ')' : this.field.label
+        },
+        fieldLabelWidth () { // 字段宽度
+            if (this.field.field_type === 'table') { return '0' }
+            return this.field.field_options.is_label_width ? this.field.field_options.label_width + (this.field.field_options.label_width_unit || 'px') : this.labelWidth
+        },
+        hidden () { // 是否隐藏
+            return this.fieldRights === FormOptions.t.PERMISSIONS.HIDE || this.field.field_type === 'hidden'
+        },
+        readonly () { // 是否只读
+            // 弹窗就是只读模式
+            return this.mode === 'dialog' ? true : this.readonlyRights ? true : this.fieldRights === FormOptions.t.PERMISSIONS.READ
+        },
+        required () { // 必填  【只读隐藏,都设置非必填】
+            return (this.readonly || this.hidden) ? false : (this.fieldRights === FormOptions.t.PERMISSIONS.REQUIRED ? true : this.field.field_options.required || false)
+        },
+        rules () {
+            if (this.readonly || this.hidden) { return [] }
+            return FormUtil.buildFormRules(this.field, this.required, this.formData)
+        },
+        descPosition () {
+            return this.params.descPosition || 'inline'
+        },
+        labelWidth () {
+            return this.params.labelWidth
+        },
+        readonlyRights () {
+            return this.params.readonly
+        },
+        readonlyStyle () {
+            return this.params.readonlyStyle
+        },
+        formula () {
+            return this.params.responseFormula
+        },
+        linkages () {
+            return this.params.responseLinkages
+        },
+        listeners () {
+            return {
+                ...this.$listeners,
+                change: (data) => {
+                    // 值改变进行数据联动
+                    this.runLinkage()
+                    this.emitEvent('change', data)
+                }, // 在 Input 值改变时触发
+                focus: (event) => { this.emitEvent('focus', event) }, // 在 Input 获得焦点时触发
+                blur: (event) => { this.emitEvent('blur', event) }, // 在 Input 失去焦点时触发
+                // click: (event) => { this.emitEvent('click', event) } // 在 Input 点击时触发
+                'change-data': this.handleModels // 数据改变
+            }
         }
-      } else {
-        field.code = code
-        const key = field.code + '.' + field.name
-        const linkages = this.linkages ? this.linkages[key] : null
-        if (linkages) {
-          FormUtil.runLinkage(linkages, this.models, field)
+    },
+    watch: {
+        dataModel: {
+            handler (val, out) {
+                if (FormOptions.t.NON_MODEL_FIELD_TYPES.includes(this.field.field_type)) {
+                    return
+                }
+                /* 如果是选择器或值来源类型, 需从监控方法进行更新数据*/
+                if (this.field.field_type === 'selector' || this.field.field_type === 'select' || this.field.field_type === 'customDialog' || this.field.field_type === 'linkdata') {
+                    this.handleModels(this.field.name, val)
+                }
+                this.$nextTick(() => {
+                    // 值改变进行公式计算
+                    this.runCalFormula()
+                })
+            },
+            deep: true,
+            immediate: true
+        },
+        models: {
+            handler (val, oldVal) {
+                this.dataModel = val[this.field.name]
+            },
+            deep: true
+        },
+        fieldRights: {
+            handler (val) {
+                this.rights[this.field.name] = val
+                this.$emit('update:rights', {
+                    ...this.rights,
+                    [this.field.name]: val
+                })
+            },
+            deep: true,
+            immediate: true
+        },
+        rights: {
+            handler (val, oldVal) {
+                this.fieldRights = val[this.field.name]
+            },
+            deep: true,
+            immediate: true
         }
-      }
     },
-    emitEvent(event,data) {
-       /* 如果是输入值, 需从当前方法进行更新数据*/
-      if(event == 'change' && this.currPage)  this.$emit('updateModel', this.field.name, data,this.row,this.currPage)
-      this.$emit(event, ...Array.from(arguments).slice(1))
+    methods: {
+        handleModels (name, val) {
+            this.models[name] = val
+            if (this.currPage) {
+                this.$emit('updateModel', name, val, this.row, this.currPage)
+            } else {
+                this.$emit('update:models', {
+                    ...this.models,
+                    [name]: val
+                })
+            }
+        },
+        setFieldData (name, val) {
+            this.$emit('update-form-data', name, val)
+        },
+        /**
+         * 进行公式计算
+         */
+        runCalFormula () {
+            if (!this.formula) return
+            const { field, code, mainCode, row } = this
+            const key = code + '.' + field.name
+            const formulas = this.formula ? this.formula[key] : null
+            if (formulas) {
+                FormUtil.runSubCalFormula(this, formulas, code, mainCode, row)
+            }
+        },
+        /**
+         * 进行联动数据
+         */
+        runLinkage () {
+            if (!this.linkages) return
+            const { field, code, row } = this
+            if (field.isSub) { // 子表
+                const key = code + '.' + field.name
+                const linkages = this.linkages ? this.linkages[key] : null
+                if (linkages) {
+                    FormUtil.runLinkage(linkages, this.models, field, row)
+                }
+            } else {
+                field.code = code
+                const key = field.code + '.' + field.name
+                const linkages = this.linkages ? this.linkages[key] : null
+                if (linkages) {
+                    FormUtil.runLinkage(linkages, this.models, field)
+                }
+            }
+        },
+        emitEvent (event, data) {
+            // 如果是输入值, 需从当前方法进行更新数据
+            if (event === 'change' && this.currPage) {
+                this.$emit('updateModel', this.field.name, data, this.row, this.currPage)
+            }
+            this.$emit(event, ...Array.from(arguments).slice(1))
+        }
     }
-  }
 }
 </script>

+ 1 - 1
src/business/platform/form/utils/custom/preview.js

@@ -55,7 +55,7 @@ export const preview = (tableForm, url) => {
                 },
                 methods: {
                     getFile () {
-                        const urlList = url.split('rpx=')[1].split('.rpx&id_=')
+                        const urlList = url.split('rpx=')[1].split('&id_=')
                         const name = urlList[0].split('/')
                         this.name = name[name.length - 1]
                         const params = {

+ 499 - 463
src/components/ibps-tree/index.vue

@@ -1,119 +1,117 @@
 <template>
-  <div
-    ref="ibpsTree"
-    :style="{width:width+'px',position: location}"
-    class="ibps-tree"
-  >
     <div
-      v-if="title"
-      ref="header"
-      :class="['layout-header--' +$ELEMENT.size]"
-      class="layout-header"
+        ref="ibpsTree"
+        :style="{ width: width + 'px', position: location }"
+        class="ibps-tree"
     >
-      <div
-        v-show="isExpand"
-        :style="{width:width-55+'px'}"
-        class="layout-header-title ibps-ellipsis"
-      >{{ title }}</div>
-      <div
-        v-if="angleDouble"
-        class="layout-header-tools"
-      >
-       <!-- <el-tooltip
-          :content="isExpand?'收缩':'展开'"
-          placement="bottom-start"
+        <div
+            v-if="title"
+            ref="header"
+            :class="['layout-header--' + $ELEMENT.size]"
+            class="layout-header"
         >
-          <a
-            herf="javascript:void(0);"
-            class="pinBtn"
-            @click="handleExpandCollapse"
-          >
-            <ibps-icon :name="expandCollapseIcon" />
-          </a>
-        </el-tooltip> -->
-      </div>
-    </div>
-  <!--  <div
-      v-if="toolbars"
-      :class="isExpand?'ibps-show-expand':'ibps-show-collapse'"
-    >
-      <div
-        v-if="toolbars"
-        v-show="isExpand"
-        ref="toolbar"
-        class="ibps-tree-toolbar"
-      >
-        <ibps-toolbar
-          :actions="toolbars"
-          type="icon"
-          @action-event="handleActionEvent"
-        />
-      </div>
-    </div> -->
-   <!-- <div
-      v-show="!isExpand"
-      class="ibps-show"
-      :style="{ height:(isExpand?treeHeight:height)-45+'px'}"
-    >&nbsp;</div>
-    <div
-      v-if="$slots.searchForm "
-      v-show="isExpand"
-      ref="searchForm"
-      class="ibps-tree-search-form"
-    >
-      <slot name="searchForm" />
-    </div> -->
-    <div
-      v-show="isExpand"
-      :style="{ height:(isExpand?treeHeight:height)-45+'px'}"
-      class="ibps-tree-main"
-    >
-      <el-scrollbar
-        style="height: 100%;width:100%;"
-        wrap-class="ibps-tree-wrapper"
-      >
-        <el-tree
-          ref="elTree"
-          v-loading="loading"
-          :data="!lazy?treeData:null"
-          :lazy="lazy"
-          :load="load"
-          v-bind="treeOptions"
-          :default-expand-all ="judgeTitle()"
-          node-key="id"
-          :default-expanded-keys="treeExpandData"
-          @node-click="handleNodeClick"
-          @node-contextmenu="handleNodeContextmenu"
+            <div
+                v-show="isExpand"
+                :style="{ width: width - 55 + 'px' }"
+                class="layout-header-title ibps-ellipsis"
+            >
+                {{ title }}
+            </div>
+            <div v-if="angleDouble" class="layout-header-tools">
+                <el-tooltip
+                    :content="isExpand ? '收缩' : '展开'"
+                    placement="bottom-start"
+                >
+                    <a
+                        herf="javascript:void(0);"
+                        class="pinBtn"
+                        @click="handleExpandCollapse"
+                    >
+                        <ibps-icon :name="expandCollapseIcon" />
+                    </a>
+                </el-tooltip>
+            </div>
+        </div>
+        <div
+            v-if="toolbars"
+            :class="isExpand ? 'ibps-show-expand' : 'ibps-show-collapse'"
         >
-          <span
-            slot-scope="scope"
-            class="ibps-custom-tree-node"
-          >
-            <ibps-icon
-              v-if="showIcon"
-              :name="getIcon(scope.data)"
+            <div
+                v-if="toolbars"
+                v-show="isExpand"
+                ref="toolbar"
+                class="ibps-tree-toolbar"
+            >
+                <ibps-toolbar
+                    :actions="toolbars"
+                    type="icon"
+                    @action-event="handleActionEvent"
+                />
+            </div>
+        </div>
+        <div
+            v-show="!isExpand"
+            class="ibps-show"
+            :style="{ height: (isExpand ? treeHeight : height) - 45 + 'px' }"
+        >
+            &nbsp;
+        </div>
+        <div
+            v-if="$slots.searchForm"
+            v-show="isExpand"
+            ref="searchForm"
+            class="ibps-tree-search-form"
+        >
+            <slot name="searchForm" />
+        </div>
+        <div
+            v-show="isExpand"
+            :style="{ height: (isExpand ? treeHeight : height) - 45 + 'px' }"
+            class="ibps-tree-main"
+        >
+            <el-scrollbar
+                style="height: 100%; width: 100%"
+                wrap-class="ibps-tree-wrapper"
+            >
+                <el-tree
+                    ref="elTree"
+                    v-loading="loading"
+                    :data="!lazy ? treeData : null"
+                    :lazy="lazy"
+                    :load="load"
+                    v-bind="treeOptions"
+                    :default-expand-all="judgeTitle()"
+                    node-key="id"
+                    :default-expanded-keys="treeExpandData"
+                    @node-click="handleNodeClick"
+                    @node-contextmenu="handleNodeContextmenu"
+                >
+                    <span slot-scope="scope" class="ibps-custom-tree-node">
+                        <ibps-icon
+                            v-if="showIcon"
+                            :name="getIcon(scope.data)"
+                        />
+                        <span>{{ scope.node.label }}</span>
+                    </span>
+                </el-tree>
+            </el-scrollbar>
+        </div>
+        <!--右键菜单-->
+        <ibps-contextmenu
+            v-if="contextmenus"
+            ref="contextmenu"
+            :visible.sync="contextmenuFlag"
+            :menulist="contextmenuList"
+            :x="contentmenuX"
+            :y="contentmenuY"
+            :z-index="zIndex"
+        >
+            <ibps-contextmenu-list
+                :menulist="contextmenuList"
+                @row-click="handleContextmenuClick"
             />
-            <span>{{ scope.node.label }}</span>
-          </span>
-        </el-tree>
-      </el-scrollbar>
+        </ibps-contextmenu>
     </div>
-    <!--右键菜单-->
-    <ibps-contextmenu
-      v-if="contextmenus"
-      ref="contextmenu"
-      :visible.sync="contextmenuFlag"
-      :menulist="contextmenuList"
-      :x="contentmenuX"
-      :y="contentmenuY"
-      :z-index="zIndex"
-    >
-      <ibps-contextmenu-list
-        :menulist="contextmenuList"
-        @row-click="handleContextmenuClick"
-      />
-    </ibps-contextmenu>
-  </div>
 </template>
 <script>
 import TreeUtils from '@/utils/tree'
@@ -122,385 +120,423 @@ import IbpsContextmenu from '@/components/ibps-contextmenu'
 import IbpsContextmenuList from '@/components/ibps-contextmenu/components/contentmenu-list'
 
 export default {
-  components: {
-    IbpsContextmenu,
-    IbpsContextmenuList
-  },
-  props: {
-    title: String,
-    angleDouble: {
-      type: Boolean,
-      default: true
-    },
-    width: {
-      type: Number,
-      default: 200
-    },
-    height: {
-      type: Number,
-      default: 400
-    },
-    position: {
-      type: String,
-      default: 'west'
-    },
-    location: {
-      type: String,
-      default: 'initial'
-    },
-    loading: {
-      type: Boolean,
-      default: false
-    },
-    data: {
-      type: Array
-    },
-    dataType: { // 数据类型,tree:树形,list:列表
-      type: String,
-      default: 'list'
-    },
-    customZindex: {
-      type: Number,
-      default: 2003
-    },
-    options: {
-      type: Object,
-      default: () => {
-        return {}
-      }
-    },
-    toolbars: {
-      type: [Array, Boolean],
-      default: () => {
-        return [{
-          key: 'refresh'
-        }, {
-          key: 'expand'
-        }, {
-          key: 'compress'
-        }]
-      }
-    },
-    contextmenus: {
-      type: Array,
-      default: () => {
-        return []
-      }
-    },
-    load: Function,
-    lazy: {
-      type: Boolean,
-      default: false
-    }
-  },
-  data() {
-    return {
-      treeHeight: this.height,
-      isExpand: true,
-      autoPlacement: true,
-      contextmenuFlag: false,
-      contentmenuX: 0,
-      contentmenuY: 0,
-      contextmenuData: {},
-      contextmenuList: [],
-      zIndex: 2003,
-      treeExpandData:[],
-    }
-  },
-  computed: {
-    treeData() {
-      if (!this.data || this.data.length === 0) return []
-      this.data.map(item => {
-        if (item.name === '任务分类') {
-            item.name = '记录分类'
-        }
-      })
-      if (this.dataType === 'list') {
-        return TreeUtils.transformToTreeFormat(JSON.parse(JSON.stringify(this.data)), {
-          idKey: this.treeOptions['node-key'],
-          pIdKey: this.pidKey,
-          childrenKey: this.treeOptions['props']['children']
-        })
-      } else {
-        return JSON.parse(JSON.stringify(this.data))
-      }
-    },
-    treeOptions() {
-      const defaultOptions = {
-        'rootPId': null,
-        'node-key': 'id',
-        'pid-key': 'parentId',
-        'default-expand-all': true,
-        'expand-on-click-node': false,
-        'highlight-current': true,
-        props: {
-          children: 'children',
-          label: 'name'
+    components: {
+        IbpsContextmenu,
+        IbpsContextmenuList
+    },
+    props: {
+        title: String,
+        angleDouble: {
+            type: Boolean,
+            default: true
+        },
+        width: {
+            type: Number,
+            default: 200
+        },
+        height: {
+            type: Number,
+            default: 400
+        },
+        position: {
+            type: String,
+            default: 'west'
+        },
+        location: {
+            type: String,
+            default: 'initial'
+        },
+        loading: {
+            type: Boolean,
+            default: false
+        },
+        data: {
+            type: Array
+        },
+        dataType: {
+            // 数据类型,tree:树形,list:列表
+            type: String,
+            default: 'list'
+        },
+        customZindex: {
+            type: Number,
+            default: 2003
+        },
+        options: {
+            type: Object,
+            default: () => {
+                return {}
+            }
+        },
+        toolbars: {
+            type: [Array, Boolean],
+            default: () => {
+                return [
+                    {
+                        key: 'refresh'
+                    },
+                    {
+                        key: 'expand'
+                    },
+                    {
+                        key: 'compress'
+                    }
+                ]
+            }
+        },
+        contextmenus: {
+            type: Array,
+            default: () => {
+                return []
+            }
+        },
+        load: Function,
+        lazy: {
+            type: Boolean,
+            default: false
         }
-      }
-      return Object.assign(defaultOptions, this.options)
-    },
-    pidKey() {
-      return this.treeOptions['pid-key']
     },
-    rootPId() {
-      return this.treeOptions['rootPId'] || null
-    },
-    showIcon() {
-      return this.treeOptions['showIcon'] || false
-    },
-    expandCollapseIcon() {
-      if (this.position === 'west') {
-        return this.isExpand ? 'angle-double-left' : 'angle-double-right'
-      } else {
-        return this.isExpand ? 'angle-double-right' : 'angle-double-left'
-      }
-    }
-  },
-  watch: {
-    height() {
-      this.handleTreeHeight()
-    },
-    customZindex(val) {
-      this.zIndex = val
-    },
-    treeData(val){
-     if(val && val[0] &&  val[0].children){
-        this.treeExpandData.push(val[0].children[0].id)
+    data () {
+        return {
+            treeHeight: this.height,
+            isExpand: true,
+            autoPlacement: true,
+            contextmenuFlag: false,
+            contentmenuX: 0,
+            contentmenuY: 0,
+            contextmenuData: {},
+            contextmenuList: [],
+            zIndex: 2003,
+            treeExpandData: []
         }
-    }
-  },
-  mounted() {
-    this.handleTreeHeight()
-    if (this.contextmenus && this.contextmenus.length > 0) {
-      this.fixZIndex()
-    }
-  },
-  methods: {
-    /**
-     * 判斷tree是否展开
-     */
-    judgeTitle(){
-      if(this.title == '业务对象管理'||this.title == undefined){
-        return true
-        }
-      return this.lazy
-    },
-    /**
-     * zxh 修复zindex 不是最高的被遮住
-     */
-    fixZIndex() {
-      this.zIndex = PopupManager.getZIndex()
-    },
-    getIcon(data) {
-      let icon = data ? data[this.treeOptions['iconKey'] || 'icon'] : 'list-alt'
-      if (icon) { return icon }
-      if (data[this.pidKey] === this.rootPId) {
-        icon = this.treeOptions['rootIcon'] || 'home'
-      } else {
-        icon = this.treeOptions['nodeIcon'] || 'list-alt'
-      }
     },
-    handleTreeHeight() {
-      this.treeHeight = this.height
-      if (this.$refs.header) {
-        this.treeHeight -= this.$refs.header.clientHeight
-      }
-      if (this.$refs.toolbar) {
-        this.treeHeight -= this.$refs.toolbar.clientHeight
-      }
-      if (this.$refs.searchForm) {
-        this.treeHeight -= this.$refs.searchForm.clientHeight
-      }
-    },
-    handleActionEvent(action, position, data) {
-      const command = action.key
-      if (command === 'expand') {
-        this.expandCompressTree(true)
-      } else if (command === 'compress') {
-        this.expandCompressTree(false)
-      }
-      this.$emit('action-event', command, position, data)
-    },
-    expandCompressTree(expanded) {
-      for (var i = 0; i < this.$refs.elTree.store._getAllNodes().length; i++) {
-        this.$refs.elTree.store._getAllNodes()[i].expanded = expanded
-      }
-    },
-    handleNodeClick(data) {
-      this.$emit('node-click', data)
-    },
-    refreshNode(id) {
-      const node = this.$refs.elTree.getNode(id) // 通过节点id找到对应树节点对象
-      node.loaded = false
-      node.expand() // 主动调用展开节点方法,重新查询该节点下的所有子节点
-    },
-    /**
-     * 处理节点右键菜单
-     */
-    handleNodeContextmenu(event, data) {
-      if (!this.contextmenus || this.contextmenus.length === 0) return
-      let target = event.target
-      let flag = false
-      if ((target && target.className.indexOf('el-tree-node__content') > -1) ||
-        (target && target.className.indexOf('ibps-custom-tree-node') > -1)) {
-        flag = true
-      } else if ((target && target.parentNode.className.indexOf('el-tree-node__content') > -1) ||
-       (target && target.parentNode.className.indexOf('ibps-custom-tree-node') > -1)) {
-        target = target.parentNode
-        flag = true
-      }
-      if (flag) {
-        event.preventDefault()
-        event.stopPropagation()
-        this.handleContextmenuList(data)
-        this.contextmenuData = data
-        this.contextmenuFlag = true
-        this.handleReferenceContextmenu(event)
-      }
-    },
-    handleContextmenuList(data) {
-      this.contextmenuList = []
-      const isRoot = data[this.pidKey] === this.rootPId
-      this.contextmenus.forEach((menu) => {
-        if (!menu.rights) {
-          this.contextmenuList.push(menu)
-        } else {
-          if (Array.isArray(menu.rights)) {
-            if (menu.rights.indexOf('node') > -1 && !isRoot) {
-              this.contextmenuList.push(menu)
+    computed: {
+        treeData () {
+            if (!this.data || this.data.length === 0) return []
+            this.data.map((item) => {
+                if (item.name === '任务分类') {
+                    item.name = '记录分类'
+                }
+            })
+            if (this.dataType === 'list') {
+                return TreeUtils.transformToTreeFormat(
+                    JSON.parse(JSON.stringify(this.data)),
+                    {
+                        idKey: this.treeOptions['node-key'],
+                        pIdKey: this.pidKey,
+                        childrenKey: this.treeOptions['props']['children']
+                    }
+                )
+            } else {
+                return JSON.parse(JSON.stringify(this.data))
+            }
+        },
+        treeOptions () {
+            const defaultOptions = {
+                rootPId: null,
+                'node-key': 'id',
+                'pid-key': 'parentId',
+                'default-expand-all': true,
+                'expand-on-click-node': false,
+                'highlight-current': true,
+                props: {
+                    children: 'children',
+                    label: 'name'
+                }
             }
-          } else if (typeof menu.rights === 'function') {
-            if (menu.rights.call(this, menu, data, isRoot)) {
-              this.contextmenuList.push(menu)
+            return Object.assign(defaultOptions, this.options)
+        },
+        pidKey () {
+            return this.treeOptions['pid-key']
+        },
+        rootPId () {
+            return this.treeOptions['rootPId'] || null
+        },
+        showIcon () {
+            return this.treeOptions['showIcon'] || false
+        },
+        expandCollapseIcon () {
+            if (this.position === 'west') {
+                return this.isExpand
+                    ? 'angle-double-left'
+                    : 'angle-double-right'
+            } else {
+                return this.isExpand
+                    ? 'angle-double-right'
+                    : 'angle-double-left'
             }
-          }
         }
-      })
     },
-    // 处理菜单位置
-    handleReferenceContextmenu(event) {
-      const eventX = event.pageX
-      const eventY = event.pageY
-      this.$nextTick(() => {
-        const contextmenuPosition = {
-          top: eventY,
-          left: eventX
-        }
-        if (this.autoPlacement) {
-          const el = this.$refs.contextmenu.$el
-          const contextmenuWidth = el.clientWidth
-          const contextmenuHeight = el.clientHeight
-          if (contextmenuHeight + eventY >= window.innerHeight) {
-            contextmenuPosition.top -= contextmenuHeight
-          }
-          if (contextmenuWidth + eventX >= window.innerWidth) {
-            contextmenuPosition.left -= contextmenuWidth
-          }
+    watch: {
+        height () {
+            this.handleTreeHeight()
+        },
+        customZindex (val) {
+            this.zIndex = val
+        },
+        treeData (val) {
+            if (val && val[0] && val[0].children) {
+                this.treeExpandData.push(val[0].children[0].id)
+            }
         }
-
-        this.contentmenuX = contextmenuPosition.left
-        this.contentmenuY = contextmenuPosition.top
-      })
     },
-    handleContextmenuClick(command) {
-     this.contextmenuFlag = false
-      this.$emit('action-event', command, 'contextmenu', this.contextmenuData[this.pkKey], this.contextmenuData)
-    },
-    handleExpandCollapse() {
-      this.isExpand = !this.isExpand
-      this.$emit('expand-collapse', this.isExpand)
-    },
-    remove(data) {
-      this.$refs.elTree.remove(data)
+    mounted () {
+        this.handleTreeHeight()
+        if (this.contextmenus && this.contextmenus.length > 0) {
+            this.fixZIndex()
+        }
     },
-    getCurrentKey() {
-      return this.$refs.elTree.getCurrentKey()
+    methods: {
+        /**
+         * 判斷tree是否展开
+         */
+        judgeTitle () {
+            if (this.title === '业务对象管理' || this.title == undefined) {
+                return true
+            }
+            return this.lazy
+        },
+        /**
+         * zxh 修复zindex 不是最高的被遮住
+         */
+        fixZIndex () {
+            this.zIndex = PopupManager.getZIndex()
+        },
+        getIcon (data) {
+            let icon = data
+                ? data[this.treeOptions['iconKey'] || 'icon']
+                : 'list-alt'
+            if (icon) {
+                return icon
+            }
+            if (data[this.pidKey] === this.rootPId) {
+                icon = this.treeOptions['rootIcon'] || 'home'
+            } else {
+                icon = this.treeOptions['nodeIcon'] || 'list-alt'
+            }
+        },
+        handleTreeHeight () {
+            this.treeHeight = this.height
+            if (this.$refs.header) {
+                this.treeHeight -= this.$refs.header.clientHeight
+            }
+            if (this.$refs.toolbar) {
+                this.treeHeight -= this.$refs.toolbar.clientHeight
+            }
+            if (this.$refs.searchForm) {
+                this.treeHeight -= this.$refs.searchForm.clientHeight
+            }
+        },
+        handleActionEvent (action, position, data) {
+            const command = action.key
+            if (command === 'expand') {
+                this.expandCompressTree(true)
+            } else if (command === 'compress') {
+                this.expandCompressTree(false)
+            }
+            this.$emit('action-event', command, position, data)
+        },
+        expandCompressTree (expanded) {
+            for (
+                var i = 0;
+                i < this.$refs.elTree.store._getAllNodes().length;
+                i++
+            ) {
+                this.$refs.elTree.store._getAllNodes()[i].expanded = expanded
+            }
+        },
+        handleNodeClick (data) {
+            this.$emit('node-click', data)
+        },
+        refreshNode (id) {
+            const node = this.$refs.elTree.getNode(id) // 通过节点id找到对应树节点对象
+            node.loaded = false
+            node.expand() // 主动调用展开节点方法,重新查询该节点下的所有子节点
+        },
+        /**
+         * 处理节点右键菜单
+         */
+        handleNodeContextmenu (event, data) {
+            if (!this.contextmenus || this.contextmenus.length === 0) return
+            let target = event.target
+            let flag = false
+            if (
+                (target &&
+                    target.className.indexOf('el-tree-node__content') > -1) ||
+                (target &&
+                    target.className.indexOf('ibps-custom-tree-node') > -1)
+            ) {
+                flag = true
+            } else if (
+                (target &&
+                    target.parentNode.className.indexOf(
+                        'el-tree-node__content'
+                    ) > -1) ||
+                (target &&
+                    target.parentNode.className.indexOf(
+                        'ibps-custom-tree-node'
+                    ) > -1)
+            ) {
+                target = target.parentNode
+                flag = true
+            }
+            if (flag) {
+                event.preventDefault()
+                event.stopPropagation()
+                this.handleContextmenuList(data)
+                this.contextmenuData = data
+                this.contextmenuFlag = true
+                this.handleReferenceContextmenu(event)
+            }
+        },
+        handleContextmenuList (data) {
+            this.contextmenuList = []
+            const isRoot = data[this.pidKey] === this.rootPId
+            this.contextmenus.forEach((menu) => {
+                if (!menu.rights) {
+                    this.contextmenuList.push(menu)
+                } else {
+                    if (Array.isArray(menu.rights)) {
+                        if (menu.rights.indexOf('node') > -1 && !isRoot) {
+                            this.contextmenuList.push(menu)
+                        }
+                    } else if (typeof menu.rights === 'function') {
+                        if (menu.rights.call(this, menu, data, isRoot)) {
+                            this.contextmenuList.push(menu)
+                        }
+                    }
+                }
+            })
+        },
+        // 处理菜单位置
+        handleReferenceContextmenu (event) {
+            const eventX = event.pageX
+            const eventY = event.pageY
+            this.$nextTick(() => {
+                const contextmenuPosition = {
+                    top: eventY,
+                    left: eventX
+                }
+                if (this.autoPlacement) {
+                    const el = this.$refs.contextmenu.$el
+                    const contextmenuWidth = el.clientWidth
+                    const contextmenuHeight = el.clientHeight
+                    if (contextmenuHeight + eventY >= window.innerHeight) {
+                        contextmenuPosition.top -= contextmenuHeight
+                    }
+                    if (contextmenuWidth + eventX >= window.innerWidth) {
+                        contextmenuPosition.left -= contextmenuWidth
+                    }
+                }
+
+                this.contentmenuX = contextmenuPosition.left
+                this.contentmenuY = contextmenuPosition.top
+            })
+        },
+        handleContextmenuClick (command) {
+            this.contextmenuFlag = false
+            this.$emit(
+                'action-event',
+                command,
+                'contextmenu',
+                this.contextmenuData[this.pkKey],
+                this.contextmenuData
+            )
+        },
+        handleExpandCollapse () {
+            this.isExpand = !this.isExpand
+            this.$emit('expand-collapse', this.isExpand)
+        },
+        remove (data) {
+            this.$refs.elTree.remove(data)
+        },
+        getCurrentKey () {
+            return this.$refs.elTree.getCurrentKey()
+        }
     }
-  }
 }
 </script>
 
 <style lang="scss" >
 $border-color: #e5e6e7;
 .ibps-tree {
-  .layout-header {
-    background: #FFFFFF;
-    height: 35px;
-    border-left: 1px solid $border-color;
-    border-bottom: 1px solid $border-color;
-    font-weight: bold;
-    text-align: center;
-    padding: 5px;
-    position: relative;
-    overflow: hidden;
-    overflow-y: none;
-    &--medium {
-      height: 40px;
-    }
-    &--small {
+    .layout-header {
+        background: #ffffff;
         height: 35px;
+        border-left: 1px solid $border-color;
+        border-bottom: 1px solid $border-color;
+        font-weight: bold;
+        text-align: center;
+        padding: 5px;
+        position: relative;
+        overflow: hidden;
+        overflow-y: none;
+        &--medium {
+            height: 40px;
+        }
+        &--small {
+            height: 35px;
+        }
+        &--mini {
+            height: 30px;
+        }
+        .layout-header-title {
+            float: left;
+            text-align: left;
+            font-size: 14px;
+            margin: 10px 5px 5px;
+            padding: 0;
+        }
+        .layout-header-tools {
+            float: right;
+            margin-top: 5px;
+            position: relative;
+            padding: 0;
+            .pinBtn {
+                cursor: pointer;
+                margin-left: 5px;
+                color: #c4c4c4;
+                font-size: 25px;
+            }
+        }
     }
-    &--mini {
-        height: 30px;
-    }
-    .layout-header-title {
-      float: left;
-      text-align: left;
-      font-size: 14px;
-      margin: 10px 5px 5px;
-      padding: 0;
+    .ibps-show {
+        background: #ffffff;
     }
-    .layout-header-tools {
-      float: right;
-      margin-top: 5px;
-      position: relative;
-      padding: 0;
-      .pinBtn {
-        cursor: pointer;
-        margin-left: 5px;
-        color: #c4c4c4;
-        font-size: 25px;
-      }
+    .ibps-show-expand {
+        height: 42px;
+        background: #ffffff;
+        border-bottom: 1px solid $border-color;
     }
-  }
-  .ibps-show {
-    background: #ffffff;
-  }
-  .ibps-show-expand{
-    height: 42px;
-    background: #ffffff;
-    border-bottom: 1px solid $border-color;
-  }
 
-  .ibps-show-collapse{
-     background: #ffffff;
-  }
+    .ibps-show-collapse {
+        background: #ffffff;
+    }
 
-  .ibps-tree-toolbar {
-    border: 1px solid $border-color;
-    height: 35px;
-    padding: 5px;
-  }
+    .ibps-tree-toolbar {
+        border: 1px solid $border-color;
+        height: 35px;
+        padding: 5px;
+    }
 
-  .ibps-tree-search-form {
-    padding: 5px;
-    border-right: 1px solid $border-color;
-    background: #ffffff;
-  }
-  .ibps-tree-main {
-    border: 1px solid $border-color;
-    background: #ffffff;
-  }
-  .ibps-tree-wrapper {
-    background: #ffffff;
-    .el-tree > .el-tree-node {
-      display: inline-block;
+    .ibps-tree-search-form {
+        padding: 5px;
+        border-right: 1px solid $border-color;
+        background: #ffffff;
+    }
+    .ibps-tree-main {
+        border: 1px solid $border-color;
+        background: #ffffff;
+    }
+    .ibps-tree-wrapper {
+        background: #ffffff;
+        .el-tree > .el-tree-node {
+            display: inline-block;
+        }
+    }
+    .ibps-custom-tree-node {
+        font-size: 14px;
+        padding-right: 8px;
     }
-  }
-  .ibps-custom-tree-node {
-    font-size: 14px;
-    padding-right: 8px;
-  }
 }
 </style>

+ 4 - 4
src/plugins/ibps/index.js

@@ -39,6 +39,7 @@ import pluginOpen from '@/plugins/open'
 // 平台配置文件
 import setting from '@/setting.js'
 import env from '@/env'
+const BASE_URL = process.env.VUE_APP_BASE_URL
 
 export default {
     async install (Vue, options) {
@@ -56,17 +57,16 @@ export default {
         Vue.prototype.$buildTime = env.VUE_APP_BUILD_TIME
 
         Vue.prototype.$ibpsUrl = env.VUE_APP_BASE_API_0_0_TEST
+        const reportPath = '金通医学实验室管理系统'
         const downloadReport = (src, where, type = 6) => {
             // 目前可用type    6:生成报表的pdf文件【默认】   7:生成报表的word文件   3:生成报表的excel文件
-            return `https://www.szjyxt.com/demo/reportServlet?action=${type}&file=${encodeURIComponent(src)}.rpx&columns=0&srcType=file&paramString=${encodeURIComponent(where)}`
+            return `${BASE_URL}demo/reportServlet?action=${type}&file=${encodeURIComponent(reportPath + '/' + src)}&columns=0&srcType=file&paramString=${encodeURIComponent(where)}`
         }
-        const reportPath = '金通医学实验室管理系统'
         const timer = setInterval(() => { // 定时循环添加参数
             if (getToken()) {
                 // 报表路径
-                Vue.prototype.$reportPath = `https://www.szjyxt.com/demo/reportJsp/showReport.jsp?access_token=${getToken()}&rpx=${reportPath}/`
+                Vue.prototype.$reportPath = `${BASE_URL}demo/reportJsp/showReport.jsp?access_token=${getToken()}&rpx=${reportPath}/`
                 Vue.prototype.$getReportFile = downloadReport // 通过方法函数,拼接url,并将字符串格式化
-                Vue.prototype.$getFileDow = 'https://www.szjyxt.com/ibps/platform/v3/file/download?attachmentId=' // 文件下载地址
                 clearInterval(timer) // 添加成功后即删除定时任务
             }
         }, 500)

+ 254 - 258
src/router/routes.js

@@ -1,7 +1,6 @@
 import layoutHeaderAside from '@/layout/header-aside'
 import layoutCustom from '@/layout/custom-layout'
 
-
 // 由于懒加载页面太多的话会造成webpack热更新太慢,所以开发环境不使用懒加载,只有生产环境使用懒加载
 const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
 
@@ -9,300 +8,297 @@ const _import = require('@/utils/util.import.' + process.env.NODE_ENV)
  * 在主框架内显示
  */
 const frameIn = [
- {
-    path: '/',
-    redirect: { name: 'dashboard' },
-    component: layoutHeaderAside,
-    children: [
+    {
+        path: '/',
+        redirect: { name: 'dashboard' },
+        component: layoutHeaderAside,
+        children: [
 
-      // 首页
-	  {
-	    path: 'dashboard',
-	    name: 'dashboard',
-	    meta: {
-	      title: '首页',
-	      auth: true
-	    },
-	    component: _import('/system/dashboard')
-	  },
-	  {
-	    path: 'blank',
-	    name: 'blank',
-	    meta: {
-	      title: '首页',
-	      auth: true
-	    },
-	    component: _import('/system/blank')
-	  },
-   {
-       path: 'jbdHome',
-       name: 'jbdHome',
-       meta: {
-         title: '数据统计',
-         auth: true
-       },
-       component: _import('/system/jbdHome')
-     },
-      // 系统 前端日志
-      {
-        path: 'log',
-        name: 'log',
-        meta: {
-          title: '前端日志',
-          auth: true
-        },
-        component: _import('/system/log')
-      },
-		/* 	{
-			  path: 'dashboard',
-			  name: 'dashboard',
-			  meta: {
-			    title: '工作中心',
-			    auth: true
-			  },
-			  component: _import('/system/dashboard')
-			}, */
-      // 刷新页面 必须保留
-      {
-        path: 'refresh',
-        name: 'refresh',
-        hidden: true,
-        component: _import('/system/function/refresh')
-      },
-      // 页面重定向 必须保留
-      {
-        path: 'redirect/:route*',
-        name: 'redirect',
-        hidden: true,
-        component: _import('/system/function/redirect')
-      },
-      {
-        path: '/message',
-        name: 'message',
-        meta: {
-          title: '消息中心',
-          auth: true
-        },
-        component: _import('/platform/message/inner/receive')
-      }
-    ]
-  }
+            // 首页
+            {
+                path: 'dashboard',
+                name: 'dashboard',
+                meta: {
+                    title: '首页',
+                    auth: true
+                },
+                component: _import('/system/dashboard')
+            },
+            {
+                path: 'blank',
+                name: 'blank',
+                meta: {
+                    title: '首页',
+                    auth: true
+                },
+                component: _import('/system/blank')
+            },
+            {
+                path: 'jbdHome',
+                name: 'jbdHome',
+                meta: {
+                    title: '数据统计',
+                    auth: true
+                },
+                component: _import('/system/jbdHome')
+            },
+            // 系统 前端日志
+            {
+                path: 'log',
+                name: 'log',
+                meta: {
+                    title: '前端日志',
+                    auth: true
+                },
+                component: _import('/system/log')
+            },
+            // {
+            //     path: 'dashboard',
+            //     name: 'dashboard',
+            //     meta: {
+            //         title: '工作中心',
+            //         auth: true
+            //     },
+            //     component: _import('/system/dashboard')
+            // },
+            // 刷新页面 必须保留
+            {
+                path: 'refresh',
+                name: 'refresh',
+                hidden: true,
+                component: _import('/system/function/refresh')
+            },
+            // 页面重定向 必须保留
+            {
+                path: 'redirect/:route*',
+                name: 'redirect',
+                hidden: true,
+                component: _import('/system/function/redirect')
+            },
+            {
+                path: '/message',
+                name: 'message',
+                meta: {
+                    title: '消息中心',
+                    auth: true
+                },
+                component: _import('/platform/message/inner/receive')
+            }
+        ]
+    }
 ]
 
 /**
  * 在主框架之外显示
  */
 const frameOut = [
-       // 首页
-    /*  {
-        path: 'jbdHome',
-        name: 'jbdHome',
+    // 首页
+    // {
+    //     path: 'jbdHome',
+    //     name: 'jbdHome',
+    //     meta: {
+    //         title: '数据统计',
+    //         auth: true
+    //     },
+    //     component: _import('/system/jbdHome')
+    // },
+    // 登录
+    {
+        path: '/login',
+        name: 'login',
         meta: {
-          title: '数据统计',
-          auth: true
+            title: '登录'
         },
-        component: _import('/system/jbdHome')
-      }, */
-  // 登录
-  {
-    path: '/login',
-    name: 'login',
-    meta: {
-      title: '登录'
-    },
-    component: _import('/system/login')
-  },
- {
-    path: '/fileView',
-    name: 'fileView',
-    meta: {
-      title: '文件预览页',
+        component: _import('/system/login')
     },
-    component: _import('/viewFile')
-  },
-/*  */  {
-    path: '/register',
-    name: 'register',
-    meta: {
-      title: '注册账号'
+    {
+        path: '/fileView',
+        name: 'fileView',
+        meta: {
+            title: '文件预览页'
+        },
+        component: _import('/viewFile')
     },
-    component: _import('/system/register')
-  },
-  {
-    path: '/tenantRegister',
-    name: 'tenantRegister',
-    meta: {
-      title: '企业注册'
+    {
+        path: '/register',
+        name: 'register',
+        meta: {
+            title: '注册账号'
+        },
+        component: _import('/system/register')
     },
-    component: _import('/saas/tenant/register')
-  },
-  {
-    path: '/forget',
-    name: 'forget',
-    meta: {
-      title: '忘记密码'
+    {
+        path: '/tenantRegister',
+        name: 'tenantRegister',
+        meta: {
+            title: '企业注册'
+        },
+        component: _import('/saas/tenant/register')
     },
-    component: _import('/system/forget')
-  },
-  {
-    path: '/tenantForget',
-    name: 'tenantForget',
-    meta: {
-      title: '忘记密码'
+    {
+        path: '/forget',
+        name: 'forget',
+        meta: {
+            title: '忘记密码'
+        },
+        component: _import('/system/forget')
     },
-    component: _import('/system/tenantForget')
-  },
-  {
-    path: '/systemSelect',
-    name: 'systemSelect',
-    meta: {
-      title: '选择子系统'
+    {
+        path: '/tenantForget',
+        name: 'tenantForget',
+        meta: {
+            title: '忘记密码'
+        },
+        component: _import('/system/tenantForget')
     },
-    component: _import('/system/system')
-  },
-  {
-    path: '/tenantSelect',
-    name: 'tenantSelect',
-    meta: {
-      title: '选择租户'
+    {
+        path: '/systemSelect',
+        name: 'systemSelect',
+        meta: {
+            title: '选择子系统'
+        },
+        component: _import('/system/system')
     },
-    component: _import('/saas/tenant/tenantSelect')
-  },
-  {
-    path: '/locking',
-    name: 'locking',
-    meta: {
-      title: '锁屏'
+    {
+        path: '/tenantSelect',
+        name: 'tenantSelect',
+        meta: {
+            title: '选择租户'
+        },
+        component: _import('/saas/tenant/tenantSelect')
     },
-    component: _import('/system/locking')
-  },
-  {
-    path: '/iframe',
-    name: 'iframe',
-    meta: {
-      title: 'iframe'
+    {
+        path: '/locking',
+        name: 'locking',
+        meta: {
+            title: '锁屏'
+        },
+        component: _import('/system/locking')
     },
-    component: _import('/system/iframe')
-  }
+    {
+        path: '/iframe',
+        name: 'iframe',
+        meta: {
+            title: 'iframe'
+        },
+        component: _import('/system/iframe')
+    }
 ]
 
-
-
 /**
  * 响应式
  */
- const ziliao = [
-{
-//path: '/ziliao/:id',
-path: '/ziliao',
-name: 'ziliao',
-meta: {
- title: ' 罗湖实验室管理平台'
-},
-//component: _import('/system/ziliao'),
-component: _import('/component/ziliao'),
-//requireAuth: false
-
-},
- ]
+const ziliao = [
+    {
+        // path: '/ziliao/:id',
+        path: '/ziliao',
+        name: 'ziliao',
+        meta: {
+            title: ' 罗湖实验室管理平台'
+        },
+        // component: _import('/system/ziliao'),
+        component: _import('/component/ziliao'),
+        // requireAuth: false
+    }
+]
 
 /**
  * 错误页面
  */
 const errorPage = [
-  {
-    path: '/404',
-    name: 'error404',
-    meta: {
-      title: '404-页面不存在'
-    },
-    hidden: true,
-    component: _import('/system/error/404')
-  },
-  {
-    path: '/401',
-    name: 'error401',
-    meta: {
-      title: '401- 未授权'
+    {
+        path: '/404',
+        name: 'error404',
+        meta: {
+            title: '404-页面不存在'
+        },
+        hidden: true,
+        component: _import('/system/error/404')
     },
-    hidden: true,
-    component: _import('/system/error/401')
-  },
-  {
-    path: '/403',
-    name: 'error403',
-    meta: {
-      title: '403-权限不足'
+    {
+        path: '/401',
+        name: 'error401',
+        meta: {
+            title: '401- 未授权'
+        },
+        hidden: true,
+        component: _import('/system/error/401')
     },
-    hidden: true,
-    component: _import('/system/error/403')
-  },
-  {
-    path: '/nomenu',
-    name: 'nomenu',
-    meta: {
-      title: '没有菜单资源'
+    {
+        path: '/403',
+        name: 'error403',
+        meta: {
+            title: '403-权限不足'
+        },
+        hidden: true,
+        component: _import('/system/error/403')
     },
-    hidden: true,
-    component: _import('/system/error/nomenu')
-  }
+    {
+        path: '/nomenu',
+        name: 'nomenu',
+        meta: {
+            title: '没有菜单资源'
+        },
+        hidden: true,
+        component: _import('/system/error/nomenu')
+    }
 
 ]
 
 // 自定义【例子】
 const frameCustom = [
-  {
-    path: '/d/:id(\\w+)',
-    component: _import('/platform/data/dataTemplate/template-list'),
-    name: 'dataTemplateList',
-    meta: { title: '数据模版' }
-  },
-  {
-    path: '/business',
-    name: 'business',
-    component: layoutHeaderAside,
-    children: [{
-      path: 'bpmn/form',
-      name: 'businessBpmnForm',
-      meta: {
-        title: '流程表单'
-      },
-      component: _import('/platform/bpmn/form/index')
+    {
+        path: '/d/:id(\\w+)',
+        component: _import('/platform/data/dataTemplate/template-list'),
+        name: 'dataTemplateList',
+        meta: { title: '数据模版' }
     },
     {
-      path: 'dataTemplate/form',
-      name: 'businessDataTemplateForm',
-      meta: {
-        title: '数据模版表单'
-      },
-      component: _import('/platform/data/dataTemplate/form/index')
-    }
+        path: '/business',
+        name: 'business',
+        component: layoutHeaderAside,
+        children: [{
+            path: 'bpmn/form',
+            name: 'businessBpmnForm',
+            meta: {
+                title: '流程表单'
+            },
+            component: _import('/platform/bpmn/form/index')
+        },
+        {
+            path: 'dataTemplate/form',
+            name: 'businessDataTemplateForm',
+            meta: {
+                title: '数据模版表单'
+            },
+            component: _import('/platform/data/dataTemplate/form/index')
+        }
 
-    ]
-  },
-  {
-    path: '/platform',
-    name: 'platform',
-    component: layoutCustom,
-    children: [{
-      path: 'bpmn/form',
-      name: 'bpmnForm',
-      meta: {
-        title: '流程表单'
-      },
-      component: _import('/platform/bpmn/form/index')
+        ]
     },
     {
-      path: 'dataTemplate/form',
-      name: 'dataTemplateForm',
-      meta: {
-        title: '数据模版表单'
-      },
-      component: _import('/platform/data/dataTemplate/form/index')
-    }
+        path: '/platform',
+        name: 'platform',
+        component: layoutCustom,
+        children: [{
+            path: 'bpmn/form',
+            name: 'bpmnForm',
+            meta: {
+                title: '流程表单'
+            },
+            component: _import('/platform/bpmn/form/index')
+        },
+        {
+            path: 'dataTemplate/form',
+            name: 'dataTemplateForm',
+            meta: {
+                title: '数据模版表单'
+            },
+            component: _import('/platform/data/dataTemplate/form/index')
+        }
 
-    ]
-  }
+        ]
+    }
 ]
 
 // 导出需要显示菜单的
@@ -310,9 +306,9 @@ export const frameInRoutes = frameIn
 
 // 重新组织后导出
 export default [
-  ...frameIn,
-  ...frameOut,
-  ...errorPage,
-  ...frameCustom,
-  ...ziliao
+    ...frameIn,
+    ...frameOut,
+    ...errorPage,
+    ...frameCustom,
+    ...ziliao
 ]

+ 155 - 155
src/setting.js

@@ -10,163 +10,163 @@
 const version = process.env.VUE_APP_VERSION
 
 export default {
-  // 快捷键
-  // 支持快捷键 例如 ctrl+shift+s
-  hotkey: {
+    // 快捷键
+    // 支持快捷键 例如 ctrl+shift+s
+    hotkey: {
+        search: {
+            open: 'Ctrl+Q',
+            close: 'Esc'
+        },
+        lock: {
+            open: 'Ctrl+L'
+        }
+    },
+    // 侧边栏默认配置
+    menu: {
+        activeHeader: '1',
+        asideCollapse: false,
+        asideTransition: true
+    },
+    // 在读取持久化数据失败时默认页面
+    page: {
+        opened: [
+            {
+                name: 'dashboard',
+                fullPath: '/dashboard',
+                meta: {
+                    title: '首页',
+                    auth: true
+                }
+            }
+        ]
+    },
+    // 默认菜单
+    menus: [
+        {
+            path: '/dashboard',
+            name: '首页',
+            alias: 'dashboard',
+            icon: 'home'
+        }
+    ],
+    // 版本
+    releases: {
+        D2AdminVersion: '1.18.0', // 感谢D2 Admin 同步更新下D2版本(https://github.com/d2-projects/d2-admin/releases)
+        version: version,
+        api: ''// 更新版本的api
+    },
+    // 全局key
+    globalKey: 'ibps-' + version,
+    // 系统默认值设置
+    system: {
+        size: 'small',
+        language: 'zh-CN',
+        languageList: [
+            { value: 'zh-CN', label: '简体中文' },
+            { value: 'zh-TW', label: '繁体中文' },
+            { value: 'en', label: 'English' },
+            { value: 'ja', label: '日本語' }
+        ]
+    },
+    // 主题色
+    color: {
+        predefine: [
+            '#242D38',
+            '#f5222d',
+            '#fa541c',
+            '#faad14',
+            '#13c2c2',
+            '#409EFF',
+            '#52c41a',
+            '#1890ff',
+            '#2f54eb',
+            '#722ed1'
+        ]
+    },
+    // 菜单搜索
     search: {
-      open: 'Ctrl+Q',
-      close: 'Esc'
+        enable: true
+    },
+    // 注册的主题
+    theme: {
+        list: [
+            {
+                title: '经典',
+                name: 'ibps',
+                preview: 'images/theme/ibps/preview@2x.png'
+            },
+            {
+                title: 'Chester',
+                name: 'chester',
+                preview: 'images/theme/chester/preview@2x.png'
+            },
+            {
+                title: 'Element',
+                name: 'element',
+                preview: 'images/theme/element/preview@2x.png'
+            },
+            {
+                title: '紫罗兰',
+                name: 'violet',
+                preview: 'images/theme/violet/preview@2x.png'
+            },
+            {
+                title: '简约线条',
+                name: 'line',
+                backgroundImage: 'images/theme/line/bg.jpg',
+                preview: 'images/theme/line/preview@2x.png'
+            },
+            {
+                title: '流星',
+                name: 'star',
+                backgroundImage: 'images/theme/star/bg.jpg',
+                preview: 'images/theme/star/preview@2x.png'
+            },
+            {
+                title: 'Tomorrow Night Blue (vsCode)',
+                name: 'tomorrow-night-blue',
+                preview: 'images/theme/tomorrow-night-blue/preview@2x.png'
+            }
+        ]
     },
-    lock: {
-      open: 'Ctrl+L'
-    }
-  },
-  // 侧边栏默认配置
-  menu: {
-    activeHeader: '1',
-    asideCollapse: false,
-    asideTransition: true
-  },
-  // 在读取持久化数据失败时默认页面
-  page: {
-    opened: [
-      {
-        name: 'dashboard',
-        fullPath: '/dashboard',
-        meta: {
-          title: '首页',
-          auth: true
+    // 在读取持久化数据失败时默认用户信息
+    userInfo: {
+        user: {
+            name: 'ghost',
+            photo: 'images/lc.png'
         }
-      }
-    ]
-  },
-  // 默认菜单
-  menus: [
-    {
-      path: '/dashboard',
-      name: '首页',
-      alias: 'dashboard',
-      icon: 'home'
-    }
-  ],
-  // 版本
-  releases: {
-    D2AdminVersion: '1.18.0', // 感谢D2 Admin 同步更新下D2版本(https://github.com/d2-projects/d2-admin/releases)
-    version: version,
-    api: ''// 更新版本的api
-  },
-  // 全局key
-  globalKey: 'ibps-' + version,
-  // 系统默认值设置
-  system: {
-    size: 'small',
-    language: 'zh-CN',
-    languageList: [
-      { value: 'zh-CN', label: '简体中文' },
-      { value: 'zh-TW', label: '繁体中文' },
-      { value: 'en', label: 'English' },
-      { value: 'ja', label: '日本語' }
-    ]
-  },
-  // 主题色
-  color: {
-    predefine: [
-      '#242D38',
-      '#f5222d',
-      '#fa541c',
-      '#faad14',
-      '#13c2c2',
-      '#409EFF',
-      '#52c41a',
-      '#1890ff',
-      '#2f54eb',
-      '#722ed1'
-    ]
-  },
-  // 菜单搜索
-  search: {
-    enable: true
-  },
-  // 注册的主题
-  theme: {
-    list: [
-      {
-        title: '经典',
-        name: 'ibps',
-        preview: 'images/theme/ibps/preview@2x.png'
-      },
-      {
-        title: 'Chester',
-        name: 'chester',
-        preview: 'images/theme/chester/preview@2x.png'
-      },
-      {
-        title: 'Element',
-        name: 'element',
-        preview: 'images/theme/element/preview@2x.png'
-      },
-      {
-        title: '紫罗兰',
-        name: 'violet',
-        preview: 'images/theme/violet/preview@2x.png'
-      },
-      {
-        title: '简约线条',
-        name: 'line',
-        backgroundImage: 'images/theme/line/bg.jpg',
-        preview: 'images/theme/line/preview@2x.png'
-      },
-      {
-        title: '流星',
-        name: 'star',
-        backgroundImage: 'images/theme/star/bg.jpg',
-        preview: 'images/theme/star/preview@2x.png'
-      },
-      {
-        title: 'Tomorrow Night Blue (vsCode)',
-        name: 'tomorrow-night-blue',
-        preview: 'images/theme/tomorrow-night-blue/preview@2x.png'
-      }
+    },
+    // 是否默认开启页面切换动画
+    transition: {
+        active: true
+    },
+    // 最长请求时间
+    requestTimeout: 1000 * 90,
+    // 白名单,不重定向白名单,不经过token校验的路由
+    whiteRouterList: [
+        '/login',
+        '/register',
+        '/forget',
+        '/tenantRegister',
+        '/tenantForget',
+        '/authredirect',
+        '/ziliao',
+        '/fileView'
+    ],
+    // 白名单,匿名请求的URL
+    whiteRequestList: [
+        '/oauth2/v3/user/captcha',
+        '/oauth2/v3/user/login',
+        '/oauth2/v3/user/login/apply',
+        '/oauth2/v3/authorize',
+        '/oauth2/v3/authorize/apply',
+        '/oauth2/v3/authentication',
+        '/oauth2/v3/authentication/apply',
+        '/oauth2/v3/user/open',
+        '/oauth2/v3/user/register',
+        '/oauth2/v3/user/open/tenant',
+        '/platform/v3/saas/tenant/register',
+        '/oauth2/v3/user/reset/passwd',
+        '/oauth2/v3/user/send/sms'
     ]
-  },
-  // 在读取持久化数据失败时默认用户信息
-  userInfo: {
-    user: {
-      name: 'ghost',
-      photo: 'images/lc.png'
-    }
-  },
-  // 是否默认开启页面切换动画
-  transition: {
-    active: true
-  },
-  // 最长请求时间
-  requestTimeout: 1000 * 90,
-  // 白名单,不重定向白名单,不经过token校验的路由
-  whiteRouterList: [
-    '/login',
-    '/register',
-    '/forget',
-    '/tenantRegister',
-    '/tenantForget',
-    '/authredirect',
-    '/ziliao',
-    '/fileView'
-  ],
-  // 白名单,匿名请求的URL
-  whiteRequestList: [
-    '/oauth2/v3/user/captcha',
-    '/oauth2/v3/user/login',
-    '/oauth2/v3/user/login/apply',
-    '/oauth2/v3/authorize',
-    '/oauth2/v3/authorize/apply',
-    '/oauth2/v3/authentication',
-    '/oauth2/v3/authentication/apply',
-    '/oauth2/v3/user/open',
-    '/oauth2/v3/user/register',
-    '/oauth2/v3/user/open/tenant',
-    '/platform/v3/saas/tenant/register',
-    '/oauth2/v3/user/reset/passwd',
-    '/oauth2/v3/user/send/sms'
-  ]
 }

+ 9 - 4
src/utils/common.js

@@ -8,12 +8,13 @@ import { getNextIdByAlias } from '@/api/platform/system/identity'
 import { save as sendMsg } from '@/api/platform/message/innerMessage'
 import { bpmTaskSave } from '@/api/platform/bpmn/bpmTask'
 import { onlyOfficeToPdf } from '@/api/platform/form/seal'
+import { downloadFile as download } from '@/business/platform/file/utils'
 
 // base64解码
 const decode = str => decodeURIComponent(window.atob(str).split('').map(c => `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`).join(''))
 
 // 下载
-export const download = (o, name) => {
+export const downloadByBlob = (o, name) => {
     if (!(o instanceof Blob)) {
         return
     }
@@ -37,7 +38,10 @@ export const download = (o, name) => {
 }
 
 // 获取当前时间
-export const getNow = length => {
+export const getNow = (length, formatType) => {
+    if (formatType === 'string') {
+        return new Date(new Date().getTime() + 28800000).toJSON().slice(0, length).replace(/[-:T]/g, '')
+    }
     return new Date(new Date().getTime() + 28800000).toJSON().slice(0, length).replace('T', ' ')
 }
 
@@ -49,9 +53,10 @@ export default {
     getNextIdByAlias,
     decode,
     encryptByAes,
-    download,
+    downloadByBlob,
     sendMsg,
     bpmTaskSave,
     getNow,
-    onlyOfficeToPdf
+    onlyOfficeToPdf,
+    download
 }

+ 10 - 1
src/views/platform/bo/boDef/constants/index.js

@@ -220,7 +220,7 @@ export const defaultAttrs = [
         code: 'bianZhiBuMen',
         fieldName: 'bian_zhi_bu_men_',
         dataType: 'varchar',
-        attrLength: 200,
+        attrLength: 256,
         precision: 0,
         format: ''
     }, {
@@ -232,6 +232,15 @@ export const defaultAttrs = [
         attrLength: 32,
         precision: 0,
         format: ''
+    }, {
+        id: uuid(),
+        name: '快照',
+        code: 'kuaiZhao',
+        fieldName: 'kuai_zhao_',
+        dataType: 'varchar',
+        attrLength: 256,
+        precision: 0,
+        format: ''
     }
 ]
 

+ 260 - 245
src/views/platform/cat/type/manage.vue

@@ -1,58 +1,74 @@
 <template>
-  <ibps-layout ref="layout">
-    <!--  -->
-    <div slot="west">
-      <ibps-tree :width="width"
-                 :height="height"
-                 :data="treeData"
-                 :options="treeOptions"
-                 :contextmenus="treeContextmenus"
-                 title="分类管理"
-                 @action-event="handleTreeAction"
-                 @node-click="handleNodeClick"
-                 @expand-collapse="handleExpandCollapse">
-        <el-select slot="searchForm"
-                   v-model="categoryKey"
-                   @change="loadTreeData(false)">
-          <el-option v-for="item in categoryOptions"
-                     :key="item.id"
-                     :label="item.name"
-                     :value="item.categoryKey" />
-        </el-select>
-      </ibps-tree>
-    </div>
+    <ibps-layout ref="layout">
+        <!--  -->
+        <div slot="west">
+            <ibps-tree
+                :width="width"
+                :height="height"
+                :data="treeData"
+                :options="treeOptions"
+                :contextmenus="treeContextmenus"
+                title="分类管理"
+                @action-event="handleTreeAction"
+                @node-click="handleNodeClick"
+                @expand-collapse="handleExpandCollapse"
+            >
+                <el-select
+                    slot="searchForm"
+                    v-model="categoryKey"
+                    @change="loadTreeData(false)"
+                >
+                    <el-option
+                        v-for="item in categoryOptions"
+                        :key="item.id"
+                        :label="item.name"
+                        :value="item.categoryKey"
+                    />
+                </el-select>
+            </ibps-tree>
+        </div>
 
-    <ibps-container :margin-left="width+'px'"
-                    class="page">
-      <edit v-show="show"
-            :id="editId"
-            ref="editForm"
-            :readonly="readonly"
-            :category-key="categoryKey"
-            :parent-data="nodeData"
-            :is-private="isPrivate"
-            :random-num="randomNum"
-            display-type="edit"
-            @callback="loadTreeData" />
-      <el-alert v-show="!show"
+        <ibps-container
+            :margin-left="width+'px'"
+            class="page"
+        >
+            <edit
+                v-show="show"
+                :id="editId"
+                ref="editForm"
+                :readonly="readonly"
+                :category-key="categoryKey"
+                :parent-data="nodeData"
+                :is-private="isPrivate"
+                :random-num="randomNum"
+                display-type="edit"
+                @callback="loadTreeData"
+            />
+            <el-alert
+                v-show="!show"
                 :closable="false"
                 title="请选择左边菜单右键进行操作!"
                 type="warning"
                 show-icon
-                style="height:50px;" />
-    </ibps-container>
+                style="height:50px;"
+            />
+        </ibps-container>
 
-    <!-- 数据字典 -->
-    <import-xml :id="editId"
-                :visible="importFormVisible"
-                @callback="callback"
-                @close="visible => importFormVisible = visible" />
-    <sort :id="editId"
-          :visible="sortFormVisible"
-          title="分类排序"
-          @callback="callback"
-          @close="visible => sortFormVisible = visible" />
-  </ibps-layout>
+        <!-- 数据字典 -->
+        <import-xml
+            :id="editId"
+            :visible="importFormVisible"
+            @callback="callback"
+            @close="visible => importFormVisible = visible"
+        />
+        <sort
+            :id="editId"
+            :visible="sortFormVisible"
+            title="分类排序"
+            @callback="callback"
+            @close="visible => sortFormVisible = visible"
+        />
+    </ibps-layout>
 </template>
 <script>
 import { queryPageList } from '@/api/platform/cat/category'
@@ -64,210 +80,209 @@ import Sort from './sort'
 import Edit from './edit'
 
 export default {
-  components: {
-    ImportXml,
-    Sort,
-    Edit
-  },
-  mixins: [FixHeight],
-  props: {
-    categoryKey: {
-      type: String,
-      default: 'FLOW_TYPE'
-    }
-  },
-  data() {
-    return {
-      width: 200,
-      height: document.clientHeight,
-      importFormVisible: false,
-      sortFormVisible: false,
-      editId: '0', // 编辑dialog需要使用
-      readonly: false, // 是否只读
-      randomNum: '',
-      loading: false,
-      // 树配置
-      treeOptions: { 'rootPId': '-1' },
-      treeContextmenus: [
-        {
-          icon: 'add',
-          label: '添加分类',
-          value: 'add',
-          rights: function (menu, data, isRoot) {
-            if (isRoot) return true
-            if (data.struType === '0') return false // 平铺结构类型不允许添加子分类
-            if (!(data.ownerId === '0' || this.$utils.isEmpty(data.ownerId))) {
-              return false
-            }
-            return true
-          }
-        },
-        {
-          icon: 'add',
-          label: '添加私有分类',
-          value: 'addPrivate',
-          rights: function (menu, data, isRoot) {
-            if (data.struType === '0') return false // 平铺结构类型不允许添加子分类
-            return true
-          }
-        },
-        { icon: 'edit', label: '编辑分类', value: 'edit', rights: ['node'] },
-        { icon: 'delete', label: '删除分类', value: 'remove', rights: ['node'] },
-        { type: 'divided' },
-        { icon: 'export', label: '导出', value: 'export' },
-        { icon: 'import', label: '导入', value: 'import' },
-        {
-          type: 'divided',
-          rights: function (menu, data, isRoot) {
-            if (isRoot) return true
-            if (data.isLeaf === 'Y') return false
-            return true
-          }
-        },
-        {
-          icon: 'sort',
-          label: '子节点排序',
-          value: 'sort',
-          rights: function (menu, data, isRoot) {
-            if (isRoot) return true
-            if (data.isLeaf === 'Y') return false
-            return true
-          }
-        }
-      ],
-      treeData: [],
-      nodeData: {},
-      isPrivate: false,
-      type: {},
-      //   categoryKey: 'FLOW_TYPE',
-      categoryOptions: [],
-      show: false
-    }
-  },
-  created() {
-    this.loadCategoryData()
-    this.loadTreeData()
-  },
-  methods: {
-    // 加载下拉框 分类标识数据
-    loadCategoryData() {
-      this.loading = true
-      queryPageList({}).then(response => {
-        this.categoryOptions = response.data.dataResult
-        this.loading = false
-      }).catch(() => {
-        this.loading = false
-      })
+    components: {
+        ImportXml,
+        Sort,
+        Edit
     },
-    // 加载具体分类数据
-    loadTreeData(isEdit) {
-      findTreeData({ 'categoryKey': this.categoryKey }).then(response => {
-        const data = response.data
-        this.treeData = data
-        this.show = isEdit
-      })
-    },
-    handleTreeAction(command, position, selection, data) {
-      if (position === 'toolbar') {
-        if (command === 'refresh') {
-          this.loadTreeData()
-        }
-      } else {
-        if (command === 'add') { // 添加
-          this.editId = null
-          this.nodeData = data
-          this.isPrivate = false
-          this.handTreeEdit()
-        } else if (command === 'addPrivate') {
-          this.editId = null
-          this.isPrivate = true
-          this.nodeData = data
-          this.handTreeEdit()
-        } else if (command === 'edit') {
-          if (data.name == '内部文件' || data.name == '外部文件' || data.name == '记录表单') {
-            ActionUtils.warning('请不要操作内部文件、外部文件、记录表单分类!!如果需要更改,请联系管理员。')
-            return
-          }
-          this.handleNodeClick(data, false)
-        } else if (command === 'remove') {
-          if (data.name == '内部文件' || data.name == '外部文件' || data.name == '记录表单') {
-            ActionUtils.warning('请不要操作内部文件、外部文件、记录表单分类!!如果需要更改,请联系管理员。')
-            return
-          }
-          this.handleTreeRemove(data.id)
-        } else if (command === 'export') {
-          this.handTreeExport(data.id, data.name)
-        } else if (command === 'import') {
-          this.handTreeImport(data.id)
-        } else if (command === 'sort') {
-          this.handTreeSort(data)
+    mixins: [FixHeight],
+    data () {
+        return {
+            width: 200,
+            height: document.clientHeight,
+            importFormVisible: false,
+            sortFormVisible: false,
+            editId: '0', // 编辑dialog需要使用
+            readonly: false, // 是否只读
+            randomNum: '',
+            loading: false,
+            // 树配置
+            treeOptions: { 'rootPId': '-1' },
+            treeContextmenus: [
+                {
+                    icon: 'add',
+                    label: '添加分类',
+                    value: 'add',
+                    rights: function (menu, data, isRoot) {
+                        if (isRoot) return true
+                        if (data.struType === '0') return false // 平铺结构类型不允许添加子分类
+                        if (!(data.ownerId === '0' || this.$utils.isEmpty(data.ownerId))) {
+                            return false
+                        }
+                        return true
+                    }
+                },
+                {
+                    icon: 'add',
+                    label: '添加私有分类',
+                    value: 'addPrivate',
+                    rights: function (menu, data, isRoot) {
+                        if (data.struType === '0') return false // 平铺结构类型不允许添加子分类
+                        return true
+                    }
+                },
+                { icon: 'edit', label: '编辑分类', value: 'edit', rights: ['node'] },
+                { icon: 'delete', label: '删除分类', value: 'remove', rights: ['node'] },
+                { type: 'divided' },
+                { icon: 'export', label: '导出', value: 'export' },
+                { icon: 'import', label: '导入', value: 'import' },
+                {
+                    type: 'divided',
+                    rights: function (menu, data, isRoot) {
+                        if (isRoot) return true
+                        if (data.isLeaf === 'Y') return false
+                        return true
+                    }
+                },
+                {
+                    icon: 'sort',
+                    label: '子节点排序',
+                    value: 'sort',
+                    rights: function (menu, data, isRoot) {
+                        if (isRoot) return true
+                        if (data.isLeaf === 'Y') return false
+                        return true
+                    }
+                }
+            ],
+            treeData: [],
+            nodeData: {},
+            isPrivate: false,
+            type: {},
+            categoryKey: 'FLOW_TYPE',
+            categoryOptions: [],
+            show: false
         }
-      }
-    },
-    handleNodeClick(data, readonly = true) {
-      if (data.depth === 0 || data.parentId === '-1') {
-        return
-      }
-      this.readonly = readonly
-      this.nodeData = data
-      this.editId = data.id
-      this.show = true
-      this.randomNum = (new Date()).getTime()
-    },
-    handleExpandCollapse(isExpand, readonly = false) {
-      this.width = isExpand ? 200 : 50
-    },
-    handTreeEdit(editId, readonly = false) {
-      this.editId = editId || ''
-      this.readonly = readonly
-      this.show = true
-      this.randomNum = (new Date()).getTime()
     },
-    handTreeImport(editId) {
-      this.editId = editId || ''
-      this.importFormVisible = true
-    },
-    handTreeSort(data) {
-      const children = data.children
-      if (children && children.length > 0) {
-        if (children.length === 1) {
-          ActionUtils.warning('只有一个节点无需排序')
-        } else {
-          this.editId = data.id || ''
-          this.sortFormVisible = true
-        }
-      } else {
-        ActionUtils.warning('无子节点排序')
-      }
+    created () {
+        this.loadCategoryData()
+        this.loadTreeData()
     },
-    handTreeExport(editId, name) {
-      // 获取数据
-      exportXml({ typeId: editId }).then(response => {
-        ActionUtils.exportFile(response.data, name + '.xml')
-      }).catch(() => {
+    methods: {
+    // 加载下拉框 分类标识数据
+        loadCategoryData () {
+            this.loading = true
+            queryPageList({}).then(response => {
+                this.categoryOptions = response.data.dataResult
+                this.loading = false
+            }).catch(() => {
+                this.loading = false
+            })
+        },
+        // 加载具体分类数据
+        loadTreeData (isEdit) {
+            findTreeData({ 'categoryKey': this.categoryKey }).then(response => {
+                const data = response.data
+                this.treeData = data
+                this.show = isEdit
+            })
+        },
+        handleTreeAction (command, position, selection, data) {
+            if (position === 'toolbar') {
+                if (command === 'refresh') {
+                    this.loadTreeData()
+                }
+            } else {
+                if (command === 'add') { // 添加
+                    this.editId = null
+                    this.nodeData = data
+                    this.isPrivate = false
+                    this.handTreeEdit()
+                } else if (command === 'addPrivate') {
+                    this.editId = null
+                    this.isPrivate = true
+                    this.nodeData = data
+                    this.handTreeEdit()
+                } else if (command === 'edit') {
+                    if (this.isSpecial(data.name)) {
+                        return
+                    }
+                    this.handleNodeClick(data, false)
+                } else if (command === 'remove') {
+                    if (this.isSpecial(data.name)) {
+                        return
+                    }
+                    this.handleTreeRemove(data.id)
+                } else if (command === 'export') {
+                    this.handTreeExport(data.id, data.name)
+                } else if (command === 'import') {
+                    this.handTreeImport(data.id)
+                } else if (command === 'sort') {
+                    this.handTreeSort(data)
+                }
+            }
+        },
+        handleNodeClick (data, readonly = true) {
+            if (data.depth === 0 || data.parentId === '-1') {
+                return
+            }
+            this.readonly = readonly
+            this.nodeData = data
+            this.editId = data.id
+            this.show = true
+            this.randomNum = (new Date()).getTime()
+        },
+        handleExpandCollapse (isExpand, readonly = false) {
+            this.width = isExpand ? 200 : 50
+        },
+        handTreeEdit (editId, readonly = false) {
+            this.editId = editId || ''
+            this.readonly = readonly
+            this.show = true
+            this.randomNum = (new Date()).getTime()
+        },
+        handTreeImport (editId) {
+            this.editId = editId || ''
+            this.importFormVisible = true
+        },
+        handTreeSort (data) {
+            const children = data.children
+            if (children && children.length > 0) {
+                if (children.length === 1) {
+                    ActionUtils.warning('只有一个节点无需排序')
+                } else {
+                    this.editId = data.id || ''
+                    this.sortFormVisible = true
+                }
+            } else {
+                ActionUtils.warning('无子节点排序')
+            }
+        },
+        handTreeExport (editId, name) {
+            // 获取数据
+            exportXml({ typeId: editId }).then(response => {
+                ActionUtils.exportFile(response.data, name + '.xml')
+            }).catch(() => {
 
-      })
-    },
-    handleTreeRemove(ids) {
-      // 获取数据
-      remove({ typeId: ids }).then(response => {
-        ActionUtils.removeSuccessMessage()
-        this.loadTreeData()
-      }).catch(() => {
+            })
+        },
+        handleTreeRemove (ids) {
+            // 获取数据
+            remove({ typeId: ids }).then(response => {
+                ActionUtils.removeSuccessMessage()
+                this.loadTreeData()
+            }).catch(() => {
 
-      })
-    },
-    getSelectedData(id, list) {
-      for (let index = 0; index < list.length; index++) {
-        if (list[index].id === id) {
-          return list[index]
+            })
+        },
+        getSelectedData (id, list) {
+            for (let index = 0; index < list.length; index++) {
+                if (list[index].id === id) {
+                    return list[index]
+                }
+            }
+        },
+        callback (data) {
+            this.loadTreeData()
+        },
+        isSpecial (name) {
+            const type = ['内部文件', '外部文件', '记录表单']
+            if (this.categoryKey === 'FILE_TYPE' && type.includes(name)) {
+                ActionUtils.warning('请不要操作内部文件、外部文件、记录表单分类!!如果需要更改,请联系管理员。')
+                return true
+            }
+            return false
         }
-      }
-    },
-    callback(data) {
-      this.loadTreeData()
     }
-
-  }
 }
 </script>

+ 42 - 42
src/views/platform/message/inner/constants/index.js

@@ -1,47 +1,47 @@
 export const typeOptions = [
-  {
-    value: '',
-    label: '全部'
-  },
-  {
-    value: 'normal',
-    label: '普通',
-    type: 'primary'
-  },
-  {
-    value: 'system',
-    label: '系统消息',
-    type: 'danger'
-  }
-  // {
-  //   value: 'bulletin',
-  //   label: '公告',
-  //   type: 'yellow'
-  // }
+    {
+        value: '',
+        label: '全部'
+    },
+    {
+        value: 'normal',
+        label: '普通',
+        type: 'primary'
+    },
+    {
+        value: 'system',
+        label: '系统消息',
+        type: 'danger'
+    },
+    {
+        value: 'bulletin',
+        label: '公告',
+        type: 'yellow'
+    }
 ]
-export const renderHeader = function(h, { column, $index }) {
-  return h('span', [
-    h('el-tooltip', {
-      props: {
-        content: '是否已读'
-      }
-    }, [h('i', { class: 'ibps-icon-envelope-o' })]),
-    h('el-tooltip', {
-      props: {
-        content: '是否有附件'
-      }
-    }, [h('i', { class: 'ibps-icon-paperclip' })]
-    )
-  ])
+export const renderHeader = function (h, { column, $index }) {
+    return h('span', [
+        h('el-tooltip', {
+            props: {
+                content: '是否已读'
+            }
+        }, [h('i', { class: 'ibps-icon-envelope-o' })]),
+        h('el-tooltip', {
+            props: {
+                content: '是否有附件'
+            }
+        }, [h('i', { class: 'ibps-icon-paperclip' })]
+        )
+    ])
 }
 export const publicOrCanreplyOptions = [
-  {
-    value: 0,
-    label: '否',
-    type: 'danger'
-  },
-  {
-    value: 1,
-    label: '是'
-  }
+    {
+        value: 0,
+        label: '否',
+        type: 'danger'
+    },
+    {
+        value: 1,
+        label: '是'
+    }
 ]

+ 270 - 257
src/views/platform/message/inner/receive.vue

@@ -1,62 +1,76 @@
 <template>
-  <div class="receive-container">
-    <ibps-crud ref="crud"
-               :height="height"
-               :data="listData"
-               :toolbars="listConfig.toolbars"
-               :search-form="listConfig.searchForm"
-               :pk-key="pkKey"
-               :columns="listConfig.columns"
-               :row-handle="listConfig.rowHandle"
-               :pagination="pagination"
-               :loading="loading"
-               :index-row="false"
-               displayField="消息中心"
-               @action-event="handleAction"
-               @sort-change="handleSortChange"
-               @column-link-click="handleLinkClick"
-               @pagination-change="handlePaginationChange">
-      <template slot="handIcon"
-                slot-scope="scope">
-        <el-tooltip v-if="!scope.row.receiverTime"
+    <div class="receive-container">
+        <ibps-crud
+            ref="crud"
+            :height="height"
+            :data="listData"
+            :toolbars="listConfig.toolbars"
+            :search-form="listConfig.searchForm"
+            :pk-key="pkKey"
+            :columns="listConfig.columns"
+            :row-handle="listConfig.rowHandle"
+            :pagination="pagination"
+            :loading="loading"
+            :index-row="false"
+            display-field="未读消息"
+            @action-event="handleAction"
+            @sort-change="handleSortChange"
+            @column-link-click="handleLinkClick"
+            @pagination-change="handlePaginationChange"
+        >
+            <template
+                slot="handIcon"
+                slot-scope="scope"
+            >
+                <el-tooltip
+                    v-if="!scope.row.receiverTime"
                     class="item"
                     effect="dark"
                     content="未读"
-                    placement="bottom">
-          <i class="ibps-icon-envelope-o" />
-        </el-tooltip>
-        <el-tooltip v-else
+                    placement="bottom"
+                >
+                    <i class="ibps-icon-envelope-o" />
+                </el-tooltip>
+                <el-tooltip
+                    v-else
                     class="item"
                     effect="dark"
                     content="已读"
-                    placement="bottom">
-          <i class="ibps-icon-envelope-open-o" />
-        </el-tooltip>
-        <el-tooltip v-if="scope.row.fileMsg"
+                    placement="bottom"
+                >
+                    <i class="ibps-icon-envelope-open-o" />
+                </el-tooltip>
+                <el-tooltip
+                    v-if="scope.row.fileMsg"
                     class="item"
                     effect="dark"
                     content="含附件"
-                    placement="bottom">
-          <i class="ibps-icon-paperclip" />
-        </el-tooltip>
-      </template>
-    </ibps-crud>
-    <!-- 明细 -->
-    <detail :id="editId"
+                    placement="bottom"
+                >
+                    <i class="ibps-icon-paperclip" />
+                </el-tooltip>
+            </template>
+        </ibps-crud>
+        <!-- 明细 -->
+        <detail
+            :id="editId"
             :title="title"
             :readonly="readonly"
             :visible="dialogFormVisible"
-            :tableId="tableId"
-            :tableName="tableName"
+            :table-id="tableId"
+            :table-name="tableName"
             @callback="search"
-            @close="visible => closeDetail(visible)" />
-    <!-- 回复 -->
-    <reply :id="editId"
-           :title="title"
-           :visible="repliFormVisible"
-           @callback="search"
-           @close="visible => (repliFormVisible = visible)" />
-  </div>
+            @close="visible => closeDetail(visible)"
+        />
+        <!-- 回复 -->
+        <reply
+            :id="editId"
+            :title="title"
+            :visible="repliFormVisible"
+            @callback="search"
+            @close="visible => (repliFormVisible = visible)"
+        />
+    </div>
 </template>
 
 <script>
@@ -66,241 +80,240 @@ import FixHeight from '@/mixins/height'
 import { typeOptions, renderHeader } from './constants'
 import Detail from './detail/dialog'
 import Reply from './reply'
-import Bus from "@/utils/EventBus";
+import Bus from '@/utils/EventBus'
 
 export default {
-  components: {
-    Detail,
-    Reply
-  },
-  mixins: [FixHeight],
-  data() {
-    return {
-      dialogFormVisible: false, // 弹窗
-      repliFormVisible: false, // 弹窗
-      editId: '', // 编辑dialog需要使用
-      pkKey: 'id', // 主键  如果主键不是pk需要传主键
-      title: '',
-      loading: true,
-      isEnvelope: true,
-      link: false,
-      readonly: false,
-      height: document.clientHeight,
-      listData: [],
-      pagination: {},
-      sorts: {},
-      tableId: '',
-      tableName: '',
-      listConfig: {
-        toolbars: [
-          {
-            key: 'search'
-          },
-          {
-            key: 'remove'
-          },
-          {
-            key: 'markRead',
-            icon: 'ibps-icon-check-circle',
-            label: '标记为已读'
-          }
-        ],
-        searchForm: {
-          forms: [
-            { prop: 'Q^subject^SL', label: '主题' },
-            { prop: 'Q^ownerName^SL', label: '发送人' },
-            {
-              prop: 'Q^messageType^SL',
-              label: '消息类型',
-              fieldType: 'select',
-              options: typeOptions
-            },
-            {
-              prop: ['Q^beginreceiveTime^DL', 'Q^endreceiveTime^DG'],
-              label: '发送时间',
-              fieldType: 'daterange'
-            }
-          ]
-        },
-        // 表格字段配置
-        columns: [
-          {
-            prop: 'stateIcon',
-            label: '',
-            slotName: 'handIcon',
-            width: '65',
-            renderHeader: renderHeader
-          },
-          {
-            prop: 'subject',
-            sortBy: 'SUBJECT_',
-            label: '主题',
-            link: 'dialog',
-            sortable: 'custom',
-            width: '250'
-          },
-          { prop: 'ownerName', label: '发送人', width: '150' },
-          { prop: 'messageType', label: '消息类型', tags: typeOptions, width: '250' },
-          { prop: 'content', label: '消息描述' },
-
-          { prop: 'createTime', label: '发送时间', dateFormat: 'yyyy-MM-dd HH:mm:ss', width: '250' }
-        ],
-        rowHandle: {
-          actions: [
-            {
-              key: 'reply',
-              icon: 'ibps-icon-reply-all',
-              label: '回复',
-              hidden: function (row, index) {
-                return (row.canreply === 0 || row.messageType === 'system' || row.messageType === 'bulletin')
-              }
-            },
-            {
-              key: 'remove'
-            },
-            {
-              key: 'detail'
+    components: {
+        Detail,
+        Reply
+    },
+    mixins: [FixHeight],
+    data () {
+        return {
+            dialogFormVisible: false, // 弹窗
+            repliFormVisible: false, // 弹窗
+            editId: '', // 编辑dialog需要使用
+            pkKey: 'id', // 主键  如果主键不是pk需要传主键
+            title: '',
+            loading: true,
+            isEnvelope: true,
+            link: false,
+            readonly: false,
+            height: document.clientHeight,
+            listData: [],
+            pagination: {},
+            sorts: {},
+            tableId: '',
+            tableName: '',
+            listConfig: {
+                toolbars: [
+                    {
+                        key: 'search'
+                    },
+                    {
+                        key: 'remove'
+                    },
+                    {
+                        key: 'markRead',
+                        icon: 'ibps-icon-check-circle',
+                        label: '标记为已读'
+                    }
+                ],
+                searchForm: {
+                    forms: [
+                        { prop: 'Q^subject^SL', label: '主题' },
+                        { prop: 'Q^ownerName^SL', label: '发送人' },
+                        {
+                            prop: 'Q^messageType^SL',
+                            label: '消息类型',
+                            fieldType: 'select',
+                            options: typeOptions
+                        },
+                        {
+                            prop: ['Q^beginreceiveTime^DL', 'Q^endreceiveTime^DG'],
+                            label: '发送时间',
+                            fieldType: 'daterange'
+                        }
+                    ]
+                },
+                // 表格字段配置
+                columns: [
+                    {
+                        prop: 'stateIcon',
+                        label: '',
+                        slotName: 'handIcon',
+                        width: '60',
+                        renderHeader: renderHeader
+                    },
+                    {
+                        prop: 'subject',
+                        sortBy: 'SUBJECT_',
+                        label: '主题',
+                        link: 'dialog',
+                        sortable: 'custom',
+                        width: '150'
+                    },
+                    { prop: 'ownerName', label: '发送人', width: '100' },
+                    { prop: 'messageType', label: '消息类型', tags: typeOptions, width: '100' },
+                    { prop: 'content', label: '消息描述', minWidth: '200' },
+                    { prop: 'createTime', label: '发送时间', dateFormat: 'yyyy-MM-dd HH:mm:ss', width: '150' }
+                ],
+                rowHandle: {
+                    actions: [
+                        {
+                            key: 'reply',
+                            icon: 'ibps-icon-reply-all',
+                            label: '回复',
+                            hidden: function (row, index) {
+                                return (row.canreply === 0 || row.messageType === 'system' || row.messageType === 'bulletin')
+                            }
+                        },
+                        {
+                            key: 'remove'
+                        },
+                        {
+                            key: 'detail'
+                        }
+                    ]
+                }
             }
-          ]
         }
-      }
-    }
-  },
-  created() {
-    this.loadData()
-  },
-  methods: {
-    // 加载数据
-    loadData() {
-      this.loading = true
-      // queryReceivePageList({
-      //     parameters:[
-      //         {key: "Q^subject^SL", value: "提醒"},
-      //         {key: "Q^messageType^SL", value: "system"}
-      //     ],
-      //     requestPage:{limit: 10,pageNo: 1,totalCount: 0},
-      //     sorts: []
-      // }).then(response => {
-      getMyMsgList(this.getSearcFormData()).then(response => {
-        const data = response.data
-        const { pageResult = {} } = data
-        ActionUtils.handleListData(this, data)
-        Bus.$emit('getMessageCount', pageResult.totalCount ? pageResult.totalCount : 0)
-        this.loading = false
-      }).catch(err => {
-        this.loading = false
-      })
     },
-    /**
+    created () {
+        this.loadData()
+    },
+    methods: {
+    // 加载数据
+        loadData () {
+            this.loading = true
+            // queryReceivePageList({
+            //     parameters:[
+            //         {key: "Q^subject^SL", value: "提醒"},
+            //         {key: "Q^messageType^SL", value: "system"}
+            //     ],
+            //     requestPage:{limit: 10,pageNo: 1,totalCount: 0},
+            //     sorts: []
+            // }).then(response => {
+            getMyMsgList(this.getSearcFormData()).then(response => {
+                const data = response.data
+                const { pageResult = {}} = data
+                ActionUtils.handleListData(this, data)
+                Bus.$emit('getMessageCount', pageResult.totalCount ? pageResult.totalCount : 0)
+                this.loading = false
+            }).catch(err => {
+                this.loading = false
+            })
+        },
+        /**
      * 获取格式化参数
      */
-    getSearcFormData() {
-      return ActionUtils.formatParams(
-        this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
-        this.pagination,
-        this.sorts
-      )
-    },
-    /**
+        getSearcFormData () {
+            return ActionUtils.formatParams(
+                this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
+                this.pagination,
+                this.sorts
+            )
+        },
+        /**
      * 处理分页事件
      */
-    handlePaginationChange(page) {
-      ActionUtils.setPagination(this.pagination, page)
-      this.loadData()
-    },
-    /**
+        handlePaginationChange (page) {
+            ActionUtils.setPagination(this.pagination, page)
+            this.loadData()
+        },
+        /**
      * 处理排序
      */
-    handleSortChange(sort) {
-      ActionUtils.setSorts(this.sorts, sort)
-      this.loadData()
-    },
-    /**
+        handleSortChange (sort) {
+            ActionUtils.setSorts(this.sorts, sort)
+            this.loadData()
+        },
+        /**
      * 查询
      */
-    search() {
-      this.loadData()
-    },
-    handleLinkClick(data, columns) {
-      console.log('data', data)
-      this.handleEdit(data.id, true)
-      this.tableId = data.tableId
-      this.tableName = data.tableName
-      this.title = '信息明细'
-    },
-    /**
+        search () {
+            this.loadData()
+        },
+        handleLinkClick (data, columns) {
+            console.log('data', data)
+            this.handleEdit(data.id, true)
+            this.tableId = data.tableId
+            this.tableName = data.tableName
+            this.title = '信息明细'
+        },
+        /**
      * 处理按钮事件
      */
-    handleAction(command, position, selection, data) {
-      switch (command) {
-        case 'search': // 查询
-          ActionUtils.setFirstPagination(this.pagination)
-          this.search()
-          break
-        case 'markRead': // 标记为已读
-          ActionUtils.selectedMultiRecord(selection).then(id => {
-            this.handleAlreadyRead(id)
-            // this.isEnvelope = false
-          }).catch(() => { })
-          break
-        case 'reply': // 回复
-          ActionUtils.selectedRecord(selection).then(id => {
-            this.handleReply(id)
-            this.title = '信息回复'
-          }).catch(() => { })
-          break
-        case 'detail': // 明细
-          ActionUtils.selectedRecord(selection).then(id => {
-            this.handleEdit(id, true)
-            this.title = '信息明细'
-          }).catch(() => { })
-          break
-        case 'remove': // 删除
-          ActionUtils.removeRecord(selection).then(ids => {
-            this.handleRemove(ids)
-          }).catch(() => { })
-          break
-        default:
-          break
-      }
-    },
-    /**
+        handleAction (command, position, selection, data) {
+            switch (command) {
+                case 'search': // 查询
+                    ActionUtils.setFirstPagination(this.pagination)
+                    this.search()
+                    break
+                case 'markRead': // 标记为已读
+                    ActionUtils.selectedMultiRecord(selection).then(id => {
+                        this.handleAlreadyRead(id)
+                        // this.isEnvelope = false
+                    }).catch(() => { })
+                    break
+                case 'reply': // 回复
+                    ActionUtils.selectedRecord(selection).then(id => {
+                        this.handleReply(id)
+                        this.title = '信息回复'
+                    }).catch(() => { })
+                    break
+                case 'detail': // 明细
+                    ActionUtils.selectedRecord(selection).then(id => {
+                        this.handleEdit(id, true)
+                        this.title = '信息明细'
+                    }).catch(() => { })
+                    break
+                case 'remove': // 删除
+                    ActionUtils.removeRecord(selection).then(ids => {
+                        this.handleRemove(ids)
+                    }).catch(() => { })
+                    break
+                default:
+                    break
+            }
+        },
+        /**
      * 标记为已读
      */
-    handleAlreadyRead(ids) {
-      markRead({ innerMessageIds: ids }).then(response => {
-        ActionUtils.success('标记已读成功')
-        this.search()
-      }).catch(() => { })
-    },
-    /**
+        handleAlreadyRead (ids) {
+            markRead({ innerMessageIds: ids }).then(response => {
+                ActionUtils.success('标记已读成功')
+                this.search()
+            }).catch(() => { })
+        },
+        /**
      * 处理回复
      */
-    handleReply(id = '') {
-      this.editId = id
-      this.repliFormVisible = true
-    },
-    /**
+        handleReply (id = '') {
+            this.editId = id
+            this.repliFormVisible = true
+        },
+        /**
      * 处理明细
      */
-    handleEdit(id = '', readonly) {
-      this.editId = id
-      this.readonly = readonly
-      this.dialogFormVisible = true
-    },
-    /**
+        handleEdit (id = '', readonly) {
+            this.editId = id
+            this.readonly = readonly
+            this.dialogFormVisible = true
+        },
+        /**
      * 处理删除
      */
-    handleRemove(ids) {
-      remove({ innerMessageIds: ids }).then(response => {
-        ActionUtils.removeSuccessMessage()
-        this.search()
-      }).catch(() => { })
-    },
-    closeDetail(visible) {
-      this.dialogFormVisible = visible
-      this.search()
+        handleRemove (ids) {
+            remove({ innerMessageIds: ids }).then(response => {
+                ActionUtils.removeSuccessMessage()
+                this.search()
+            }).catch(() => { })
+        },
+        closeDetail (visible) {
+            this.dialogFormVisible = visible
+            this.search()
+        }
     }
-  }
 }
 </script>

+ 192 - 137
src/views/platform/message/inner/send.vue

@@ -1,159 +1,214 @@
 <template>
-  <ibps-container type="full" header-background-color class="page send send-form">
-    <div slot="header">
-      <ibps-toolbar
-        :actions="toolbars"
-        :socpe="thatSocpe"
-        @action-event="handleActionEvent"
-      />
-    </div>
-    <el-row class="send-form-row">
-      <el-form ref="form" :model="form" :rules="rules" label-width="100px" class="demo-form" @submit.native.prevent>
-        <el-form-item label="主题:" prop="subject">
-          <el-input v-model="form.subject" />
-        </el-form-item>
-        <el-form-item label="收件人:" prop="receiverId">
-          <ibps-employee-selector
-            :value="form.receiverId"
-            multiple
-            @input="handleInput"
-          />
-        </el-form-item>
-        <el-form-item label="收件组织:" prop="groupId">
-          <ibps-org-selector
-            :value="form.groupId"
-            :multiple="true"
-            @input="depNameInput"
-          />
-        </el-form-item>
-        <el-form-item label="是否回复:" prop="canreply">
-          <el-radio-group v-model="form.canreply">
-            <el-radio label="1">是</el-radio>
-            <el-radio label="0">否</el-radio>
-          </el-radio-group>
-        </el-form-item>
-        <el-form-item label="附件:" prop="fileMsg">
-          <ibps-attachment-selector
-            v-model="form.fileMsg"
-            accept="*"
-            multiple
-          />
-        </el-form-item>
-        <el-form-item label="正文:" prop="content" class="demo-form-content">
-          <ibps-ueditor v-model="form.content" :z-index="2000" />
-        </el-form-item>
-      </el-form>
-    </el-row>
-  </ibps-container>
+    <ibps-container
+        type="full"
+        header-background-color
+        class="page send send-form"
+    >
+        <div slot="header">
+            <ibps-toolbar
+                :actions="toolbars"
+                :socpe="thatSocpe"
+                @action-event="handleActionEvent"
+            />
+        </div>
+        <el-row class="send-form-row">
+            <el-form
+                ref="form"
+                :model="form"
+                :rules="rules"
+                label-width="100px"
+                class="demo-form"
+                @submit.native.prevent
+            >
+                <el-form-item label="主题:" prop="subject">
+                    <el-input v-model="form.subject" />
+                </el-form-item>
+                <el-form-item label="消息类型:" prop="messageType">
+                    <el-radio-group v-model="form.messageType" @input="handleChange">
+                        <template v-for="item in typeOptions">
+                            <el-radio v-if="item.value" :key="item.value" :label="item.value">{{ item.label }}</el-radio>
+                        </template>
+                    </el-radio-group>
+                </el-form-item>
+                <el-form-item label="收件人:" prop="receiverId">
+                    <ibps-employee-selector
+                        :value="form.receiverId"
+                        multiple
+                        placeholder="请选择接收用户"
+                        @input="handleInput"
+                    />
+                </el-form-item>
+                <!-- <el-form-item label="收件组织:" prop="groupId">
+                    <ibps-org-selector
+                        :value="form.groupId"
+                        :multiple="true"
+                        @input="depNameInput"
+                    />
+                </el-form-item> -->
+                <el-form-item label="收件部门:" prop="positionId">
+                    <ibps-pos-selector
+                        :value="form.positionId"
+                        :multiple="true"
+                        placeholder="请选择接收部门"
+                        @input="posNameInput"
+                    />
+                </el-form-item>
+                <el-form-item v-if="form.messageType !== 'bulletin'" label="是否可回复:" prop="canreply">
+                    <el-radio-group v-model="form.canreply">
+                        <el-radio label="1">是</el-radio>
+                        <el-radio label="0">否</el-radio>
+                    </el-radio-group>
+                </el-form-item>
+                <el-form-item label="附件:" prop="fileMsg">
+                    <ibps-attachment-selector
+                        v-model="form.fileMsg"
+                        accept="*"
+                        multiple
+                    />
+                </el-form-item>
+                <el-form-item
+                    label="正文:"
+                    prop="content"
+                    class="demo-form-content"
+                >
+                    <ibps-ueditor v-model="form.content" :z-index="2000" />
+                </el-form-item>
+            </el-form>
+        </el-row>
+    </ibps-container>
 </template>
 <script>
 import { save } from '@/api/platform/message/innerMessage'
+import { typeOptions } from './constants'
 import ActionUtils from '@/utils/action'
 import IbpsEmployeeSelector from '@/business/platform/org/employee/selector'
 import IbpsOrgSelector from '@/business/platform/org/org/selector'
+import IbpsPosSelector from '@/business/platform/org/position/selector'
 import IbpsUeditor from '@/components/ibps-ueditor'
 import IbpsAttachmentSelector from '@/business/platform/file/attachment/selector'
 
 export default {
-  components: {
-    IbpsUeditor,
-    IbpsEmployeeSelector,
-    IbpsOrgSelector,
-    IbpsAttachmentSelector
-  },
-  data() {
-    return {
-      formName: 'form',
-      toolbars: [{ key: 'send', label: '发送消息', icon: 'ibps-icon-send' }],
-      form: {
-        subject: '',
-        receiverId: '',
-        receiver: '',
-        groupId: '',
-        groupName: '',
-        canreply: '0',
-        fileMsg: '',
-        content: '',
-        id: '',
-        editorValue: ''
-      },
-      rules: {
-        subject: [{ required: true, message: this.$t('validate.required') }],
-        receiverId: [{ required: false }],
-        groupId: [{ required: false }],
-        canreply: [{ required: false }],
-        fileMsg: [{ required: false }],
-        content: [{ required: false }]
-      }
-    }
-  },
-  computed: {
-    thatSocpe() {
-      return this
-    }
-  },
-  mounted() {
-    this.$nextTick(() => {
-      this.$refs[this.formName].validate(() => {})
-    })
-  },
-  methods: {
-    handleInput(data) {
-      this.form.receiverId = data
-    },
-    depNameInput(data) {
-      this.form.groupId = data
+    components: {
+        IbpsUeditor,
+        IbpsEmployeeSelector,
+        IbpsOrgSelector,
+        IbpsPosSelector,
+        IbpsAttachmentSelector
     },
-    handleActionEvent({ key }) {
-      switch (key) {
-        case 'send':// 发送信息
-          this.handSend()
-          break
-        default:
-          break
-      }
+    data () {
+        return {
+            typeOptions,
+            formName: 'form',
+            toolbars: [
+                // { key: 'back', label: '返回', icon: 'ibps-icon-back' },
+                { key: 'send', label: '发送', icon: 'ibps-icon-send' }
+            ],
+            form: {
+                subject: '',
+                messageType: 'normal',
+                receiverId: '',
+                receiver: '',
+                groupId: '',
+                groupName: '',
+                positionId: '',
+                positionName: '',
+                canreply: '0',
+                fileMsg: '',
+                content: '',
+                id: '',
+                editorValue: ''
+            },
+            rules: {
+                subject: [
+                    { required: true, message: this.$t('validate.required') }
+                ],
+                receiverId: [{ required: false }],
+                groupId: [{ required: false }],
+                positionId: [{ required: false }],
+                canreply: [{ required: false }],
+                fileMsg: [{ required: false }],
+                content: [{ required: true }]
+            }
+        }
     },
-    handSend() {
-      this.$refs[this.formName].validate(valid => {
-        if (valid) {
-          this.sendNews()
-        } else {
-          ActionUtils.saveErrorMessage()
+    computed: {
+        thatSocpe () {
+            return this
         }
-      })
     },
-    sendNews() {
-      if (this.form.receiverId === '' && this.form.groupId === '') {
-        ActionUtils.warning('至少选择一种收件人或收件组织!')
-        return
-      }
-      // this.form.ownerName = this.$store.getters.name
-      // this.form.ownerId = this.$store.getters.userId
-      save(this.form).then(response => {
-        ActionUtils.saveSuccessAlert('消息发送成功', () => {
-          this.$refs[this.formName].resetFields()
+    mounted () {
+        this.$nextTick(() => {
+            this.$refs[this.formName].validate(() => {})
         })
-      }).catch((err) => {
-        console.error(err)
-      })
+    },
+    methods: {
+        handleInput (data) {
+            this.form.receiverId = data
+        },
+        depNameInput (data) {
+            this.form.groupId = data
+        },
+        posNameInput (data) {
+            this.form.positionId = data
+        },
+        handleActionEvent ({ key }) {
+            switch (key) {
+                case 'send': // 发送信息
+                    this.handSend()
+                    break
+                case 'back':
+                    this.$router.go(-1)
+                    break
+                default:
+                    break
+            }
+        },
+        handSend () {
+            this.$refs[this.formName].validate((valid) => {
+                if (valid) {
+                    this.sendNews()
+                } else {
+                    ActionUtils.saveErrorMessage()
+                }
+            })
+        },
+        sendNews () {
+            if (this.form.receiverId === '' && this.form.groupId === '' && this.form.positionId === '') {
+                ActionUtils.warning('至少选择一个收件人或收件部门!')
+                return
+            }
+            this.form.ownerName = this.$store.getters.name
+            this.form.ownerId = this.$store.getters.userId
+            save(this.form).then((response) => {
+                ActionUtils.saveSuccessAlert('消息发送成功', () => {
+                    this.$refs[this.formName].resetFields()
+                })
+            }).catch((err) => {
+                console.error(err)
+            })
+        },
+        handleChange (v) {
+            if (v === 'bulletin') {
+                this.form.canreply = '0'
+            }
+        }
     }
-  }
 }
 </script>
-<style lang="scss">
-.send{
-  .ibps-container-full__body{
-    padding: 15px !important;
-  }
-.send-form{
-  .send-form-row{
-    padding: 10px;
-    .demo-form-content{
-      .edui-editor-iframeholder{
-        height: 100% !important;
-      }
+<style lang="scss" scoped>
+.send {
+    .ibps-container-full__body {
+        padding: 15px !important;
+    }
+    .send-form {
+        .send-form-row {
+            padding: 10px;
+            .demo-form-content {
+                .edui-editor-iframeholder {
+                    height: 100% !important;
+                }
+            }
+        }
     }
-  }
-}
 }
 </style>

+ 188 - 188
src/views/platform/message/inner/sent.vue

@@ -1,204 +1,204 @@
 <template>
-  <div class="receive-container">
-    <ibps-crud
-      ref="crud"
-      :height="height"
-      :data="listData"
-      :toolbars="listConfig.toolbars"
-      :search-form="listConfig.searchForm"
-      :pk-key="pkKey"
-      :columns="listConfig.columns"
-      :row-handle="listConfig.rowHandle"
-      :pagination="pagination"
-      :loading="loading"
-      :index-row="false"
-      @action-event="handleAction"
-      @sort-change="handleSortChange"
-      @pagination-change="handlePaginationChange"
-      @column-link-click="handleColumnLink"
-    />
-    <!-- <template slot="handIcon" slot-scope="scope">
-        <el-tooltip v-if="!scope.row.receiverTime" class="item" effect="dark" content="未读" placement="bottom">
-          <i class="ibps-icon-envelope-o" />
-        </el-tooltip>
-        <el-tooltip v-else class="item" effect="dark" content="已读" placement="bottom">
-          <i class="ibps-icon-envelope-open-o" />
-        </el-tooltip>
-        <el-tooltip v-if="scope.row.fileMsg" class="item" effect="dark" content="含附件" placement="bottom">
-          <i class="ibps-icon-paperclip" />
-        </el-tooltip>
-      </template>
-    </ibps-crud> -->
-    <edit
-      :id="editId"
-      :title="title"
-      :readonly="readonly"
-      :visible="dialogFormVisible"
-      @callback="search"
-      @reply="reply"
-      @close="visible => dialogFormVisible = visible"
-    />
-  </div>
+    <div class="receive-container">
+        <ibps-crud
+            ref="crud"
+            :height="height"
+            :data="listData"
+            :toolbars="listConfig.toolbars"
+            :search-form="listConfig.searchForm"
+            :pk-key="pkKey"
+            :columns="listConfig.columns"
+            :row-handle="listConfig.rowHandle"
+            :pagination="pagination"
+            :loading="loading"
+            :index-row="false"
+            @action-event="handleAction"
+            @sort-change="handleSortChange"
+            @pagination-change="handlePaginationChange"
+            @column-link-click="handleColumnLink"
+        />
+        <template slot="handIcon" slot-scope="scope">
+            <el-tooltip v-if="!scope.row.receiverTime" class="item" effect="dark" content="未读" placement="bottom">
+                <i class="ibps-icon-envelope-o" />
+            </el-tooltip>
+            <el-tooltip v-else class="item" effect="dark" content="已读" placement="bottom">
+                <i class="ibps-icon-envelope-open-o" />
+            </el-tooltip>
+            <el-tooltip v-if="scope.row.fileMsg" class="item" effect="dark" content="含附件" placement="bottom">
+                <i class="ibps-icon-paperclip" />
+            </el-tooltip>
+        </template>
+        </ibps-crud>
+        <edit
+            :id="editId"
+            :title="title"
+            :readonly="readonly"
+            :visible="dialogFormVisible"
+            @callback="search"
+            @reply="reply"
+            @close="visible => dialogFormVisible = visible"
+        />
+    </div>
 </template>
 
 <script>
 import { querySentPageList, remove } from '@/api/platform/message/innerMessage'
 import ActionUtils from '@/utils/action'
 import FixHeight from '@/mixins/height'
-import { typeOptions } from './constants'
-// import { typeOptions, renderHeader } from './constants'
+import { typeOptions, renderHeader } from './constants'
 import Edit from './detail/dialog'
 
 export default {
-  components: {
-    Edit
-  },
-  mixins: [FixHeight],
-  data() {
-    return {
-      dialogFormVisible: false, // 弹窗
-      editId: '', // 编辑dialog需要使用
-      pkKey: 'id', // 主键  如果主键不是pk需要传主键
-      icon: 'envelope',
-      title: '',
-      loading: true,
-      readonly: false,
-      height: document.clientHeight,
-      listData: [],
-      pagination: {},
-      sorts: {},
-      listConfig: {
-        toolbars: [
-          {
-            key: 'search'
-          },
-          {
-            key: 'remove'
-          }
-        ],
-        searchForm: {
-          forms: [
-            { prop: 'Q^subject_^SL', label: '主题' },
-            { prop: 'Q^owner_^SL', label: '发送人' },
-            {
-              prop: 'Q^message_type_^SL',
-              label: '消息类型',
-              fieldType: 'select',
-              options: typeOptions
-            },
-            { prop: ['Q^create_time_^DL', 'Q^create_time_^DG'], label: '发送时间', fieldType: 'daterange' }
-          ]
-        },
-        // 表格字段配置
-        columns: [
-          // { prop: 'stateIcon', label: '', slotName: 'handIcon', renderHeader: renderHeader, width: '60' },
-          { prop: 'subject', label: '主题', link: 'dialog', sortable: 'custom' },
-          { prop: 'ownerName', label: '发送人' },
-          { prop: 'messageType', label: '消息类型', tags: typeOptions },
-          { prop: 'createTime', label: '发送时间', dateFormat: 'yyyy-MM-dd HH:mm:ss' }
-        ],
-        rowHandle: {
-          actions: [{
-            key: 'remove'
-          }, {
-            key: 'detail'
-          }]
-        }
-      }
-    }
-  },
-  created() {
-    this.loadData()
-  },
-  methods: {
-    reply(id) {
-      this.editId = id
-      this.repliFormVisible = true
-    },
-    // 加载数据
-    loadData() {
-      this.loading = true
-      querySentPageList(this.getSearcFormData()).then(response => {
-        ActionUtils.handleListData(this, response.data)
-        this.loading = false
-      }).catch(() => {
-        this.loading = false
-      })
-    },
-    /**
-     * 获取格式化参数
-     */
-    getSearcFormData() {
-      return ActionUtils.formatParams(
-        this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
-        this.pagination,
-        this.sorts)
+    components: {
+        Edit
     },
-    /**
-     * 处理分页事件
-     */
-    handlePaginationChange(page) {
-      ActionUtils.setPagination(this.pagination, page)
-      this.loadData()
-    },
-    /**
-     * 处理排序
-     */
-    handleSortChange(sort) {
-      ActionUtils.setSorts(this.sorts, sort)
-      this.loadData()
-    },
-    /**
-     * 查询
-     */
-    search() {
-      this.loadData()
-    },
-    handleColumnLink(column, row) {
-      this.handleEdit(column.id, true)
-      this.title = '发送信息明细'
-    },
-    /**
-     * 处理按钮事件
-     */
-    handleAction(command, position, selection, data) {
-      switch (command) {
-        case 'search':// 查询
-          ActionUtils.setFirstPagination(this.pagination)
-          this.search()
-          break
-        case 'detail':// 明细
-          ActionUtils.selectedRecord(selection).then((id) => {
-            this.handleEdit(id, true)
-            this.title = '信息明细'
-          }).catch(() => { })
-          break
-        case 'remove':// 删除
-          ActionUtils.removeRecord(selection).then((ids) => {
-            this.handleRemove(ids)
-          }).catch(() => { })
-          break
-        default:
-          break
-      }
+    mixins: [FixHeight],
+    data () {
+        return {
+            dialogFormVisible: false, // 弹窗
+            editId: '', // 编辑dialog需要使用
+            pkKey: 'id', // 主键  如果主键不是pk需要传主键
+            icon: 'envelope',
+            title: '',
+            loading: true,
+            readonly: false,
+            height: document.clientHeight,
+            listData: [],
+            pagination: {},
+            sorts: {},
+            listConfig: {
+                toolbars: [
+                    {
+                        key: 'search'
+                    },
+                    {
+                        key: 'remove'
+                    }
+                ],
+                searchForm: {
+                    forms: [
+                        { prop: 'Q^subject_^SL', label: '主题' },
+                        { prop: 'Q^owner_^SL', label: '发送人' },
+                        {
+                            prop: 'Q^message_type_^SL',
+                            label: '消息类型',
+                            fieldType: 'select',
+                            options: typeOptions
+                        },
+                        { prop: ['Q^create_time_^DL', 'Q^create_time_^DG'], label: '发送时间', fieldType: 'daterange' }
+                    ]
+                },
+                // 表格字段配置
+                columns: [
+                    { prop: 'stateIcon', label: '', slotName: 'handIcon', renderHeader: renderHeader, width: '60' },
+                    { prop: 'subject', label: '主题', link: 'dialog', sortable: 'custom', width: '150' },
+                    { prop: 'content', label: '消息描述', minWidth: '200' },
+                    { prop: 'ownerName', label: '发送人', width: '100' },
+                    { prop: 'messageType', label: '消息类型', tags: typeOptions, width: '100' },
+                    { prop: 'createTime', label: '发送时间', dateFormat: 'yyyy-MM-dd HH:mm:ss', width: '150' }
+                ],
+                rowHandle: {
+                    actions: [{
+                        key: 'remove'
+                    }, {
+                        key: 'detail'
+                    }]
+                }
+            }
+        }
     },
-    /**
-     * 处理明细
-     */
-    handleEdit(id = '', readonly) {
-      this.editId = id
-      this.readonly = readonly
-      this.dialogFormVisible = true
+    created () {
+        this.loadData()
     },
-    /**
-     * 处理删除
-     */
-    handleRemove(ids) {
-      remove({ innerMessageIds: ids }).then(response => {
-        ActionUtils.removeSuccessMessage()
-        this.search()
-      }).catch(() => {})
+    methods: {
+        reply (id) {
+            this.editId = id
+            this.repliFormVisible = true
+        },
+        // 加载数据
+        loadData () {
+            this.loading = true
+            querySentPageList(this.getSearcFormData()).then(response => {
+                ActionUtils.handleListData(this, response.data)
+                this.loading = false
+            }).catch(() => {
+                this.loading = false
+            })
+        },
+        /**
+         * 获取格式化参数
+         */
+        getSearcFormData () {
+            return ActionUtils.formatParams(
+                this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
+                this.pagination,
+                this.sorts)
+        },
+        /**
+         * 处理分页事件
+         */
+        handlePaginationChange (page) {
+            ActionUtils.setPagination(this.pagination, page)
+            this.loadData()
+        },
+        /**
+         * 处理排序
+         */
+        handleSortChange (sort) {
+            ActionUtils.setSorts(this.sorts, sort)
+            this.loadData()
+        },
+        /**
+         * 查询
+         */
+        search () {
+            this.loadData()
+        },
+        handleColumnLink (column, row) {
+            this.handleEdit(column.id, true)
+            this.title = '发送信息明细'
+        },
+        /**
+         * 处理按钮事件
+         */
+        handleAction (command, position, selection, data) {
+            switch (command) {
+                case 'search':// 查询
+                    ActionUtils.setFirstPagination(this.pagination)
+                    this.search()
+                    break
+                case 'detail':// 明细
+                    ActionUtils.selectedRecord(selection).then((id) => {
+                        this.handleEdit(id, true)
+                        this.title = '信息明细'
+                    }).catch(() => { })
+                    break
+                case 'remove':// 删除
+                    ActionUtils.removeRecord(selection).then((ids) => {
+                        this.handleRemove(ids)
+                    }).catch(() => { })
+                    break
+                default:
+                    break
+            }
+        },
+        /**
+         * 处理明细
+         */
+        handleEdit (id = '', readonly) {
+            this.editId = id
+            this.readonly = readonly
+            this.dialogFormVisible = true
+        },
+        /**
+         * 处理删除
+         */
+        handleRemove (ids) {
+            remove({ innerMessageIds: ids }).then(response => {
+                ActionUtils.removeSuccessMessage()
+                this.search()
+            }).catch(() => {})
+        }
     }
-  }
 }
 </script>