Explorar el Código

修改所有弹窗移动和部分支持缩放

FinalYu hace 1 año
padre
commit
6576768e3c

+ 68 - 10
chuanyi_client2/src/App.vue

@@ -5,17 +5,17 @@
 </template>
 
 <script>
-import errorCode from "@/utils/errorCode";
+import cqcyCode from "@/utils/cqcyCode";
 import {getToken} from '@/utils/auth'
 import {showAlertWin} from "@/utils/cqcy";
 
 export default {
   name: 'App',
   provide() {
-      return {
-        getWebSocket: this,
-        __self: this
-      }
+    return {
+      getWebSocket: this,
+      __self: this
+    }
   },
   metaInfo() {
     return {
@@ -32,9 +32,67 @@ export default {
     }
   },
   mounted() {
-    this.clientRole = errorCode['clientRole']
+    this.clientRole = cqcyCode['clientRole']
     this.initWebSocket()
   },
+  created() {
+    $("body").on("mousedown", '.el-message-box__header', (e) => {
+      const dialogHeaderEl = document.querySelector('.el-message-box__header')
+      const dragDom = document.querySelector('.el-message-box')
+      dialogHeaderEl.style.cursor = 'move'
+      // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
+      const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null)
+      // 鼠标按下,计算当前元素距离可视区的距离
+      const disX = e.clientX - dialogHeaderEl.offsetLeft
+      const disY = e.clientY - dialogHeaderEl.offsetTop
+      // 获取到的值带px 正则匹配替换
+      let styL, styT
+      // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
+      if (sty.left.includes('%')) {
+        styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100)
+        styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100)
+      } else {
+        let lefts = sty.left
+        let tops = sty.top
+        if (sty.left == 'auto') {
+          lefts = '0px'
+        }
+        if (sty.top == 'auto') {
+          tops = '0px'
+        }
+        styL = +lefts.replace(/\px/g, '')
+        styT = +tops.replace(/\px/g, '')
+      }
+      const dragDomWidth = dragDom.offsetWidth
+      const dragDomHeight = dragDom.offsetHeight
+      const screenWidth = document.body.clientWidth
+      const screenHeight = document.body.clientHeight
+      const maxDragDomLeft = screenWidth - dragDomWidth
+      const maxDragDomTop = screenHeight - dragDomHeight
+
+      document.onmousemove = function (e) {
+        // 通过事件委托,计算移动的距离
+        const l = e.clientX - disX
+        const t = e.clientY - disY
+        // 移动当前元素
+        let _left = l + styL
+        _left = _left < 0 ? 0 : _left
+        _left = _left > maxDragDomLeft ? maxDragDomLeft : _left
+        let _top = t + styT
+        _top = _top < 0 ? 0 : _top
+        _top = _top > maxDragDomTop ? maxDragDomTop : _top
+        dragDom.style.left = `${_left}px`
+        dragDom.style.top = `${_top}px`
+        dragDom.style.position = `absolute`
+        // 将此时的位置传出去
+        // binding.value({x:e.pageX,y:e.pageY})
+      }
+      document.onmouseup = function (e) {
+        document.onmousemove = null
+        document.onmouseup = null
+      }
+    })
+  },
   destroyed() {
   },
   methods: {
@@ -42,15 +100,15 @@ export default {
       console.log('webSocket');
       let _this = this
       if (typeof (WebSocket) === 'undefined') {
-        showAlertWin(_this, '您使用的环境暂不支持socket服务!')
+        showAlertWin(_this, null, '您使用的环境暂不支持socket服务!')
       } else {
         let wsurl = ''
-        let wsbase = errorCode['ws']
+        let wsbase = cqcyCode['ws']
         let sysHost = localStorage.getItem('SYS_HOST_BASE')
         if (sysHost) {
           wsurl = wsbase.replace('{0}', sysHost)
         } else {
-          wsurl = wsbase.replace('{0}', errorCode['host'] + ':' + errorCode['port'])
+          wsurl = wsbase.replace('{0}', cqcyCode['host'] + ':' + cqcyCode['port'])
         }
         // 实例化socket
         _this.webSocket = new WebSocket(wsurl + getToken())
@@ -69,7 +127,7 @@ export default {
       let _this = this
       let count = 0
       const interval = setInterval(() => {
-        count ++
+        count++
         console.log('count', count)
         if (_this.webSocket && _this.webSocket.readyState === 1) {
           _this.webSocket.send(getToken())

+ 37 - 52
chuanyi_client2/src/components/HeaderMain/index.vue

@@ -106,7 +106,7 @@
         class="group-dialog"
         width="600px"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="groupDialogVisible"
         :before-close="handleClose"
         :visible.sync="groupDialogVisible"
@@ -241,7 +241,7 @@
         top="10vh"
         class="cy-custom-dialog"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="dataItemDialogVisible"
         :before-close="itemDialogClose"
         :visible.sync="dataItemDialogVisible"
@@ -434,17 +434,18 @@
 
     <el-dialog
         title="条件读取配置"
-        width="500px"
+        width="600px"
         top="10vh"
+        class="cy-tj-config"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="dialogReportEventConfigVisible"
         :before-close="dialogReportEventConfigClose"
         :visible.sync="dialogReportEventConfigVisible"
         :close-on-click-modal="false"
         :append-to-body="true">
       <el-form :model="reportEventConfigForm" ref="reportEventConfigForm" :rules="reportEventConfigFormRules" label-position="top"
-               style="height: 50vh; overflow: auto;">
+               style="height: 100%; overflow: auto;">
         <el-form-item label="条件数据项:" prop="itemName">
           <el-radio-group v-model="reportEventConfigForm.itemName">
             <el-radio v-for="item in groupBasicForm.itemList" :label="item.itemName" style="margin: 5px 0; width: 100%;">
@@ -480,19 +481,19 @@ import {
   getAllDataSource,
   getAllItemGroup, getAllReportTable, getAllTableTemplate,
   getDataSourceItemTree, getItemGroupById, runGroupById,
-  saveOrUpdateItemGroup, updateTableNameById, updateTableTemplateNameById
+  saveOrUpdateItemGroup, updateTableTemplateNameById
 } from "@/api/datasource";
 import {getDictByKey} from "@/api/basic";
 import {
   customCompare,
   deepTreeFilter,
-  deepTreeKey, diffObj, getLuckysheetConfig,
-  showAlertWin,
-  showLoading,
+  deepTreeKey,
+  showAlertWin, showConfirmWin,
+  showLoading, showPromptWin,
   traverseNode,
   traverseVisible
 } from "@/utils/cqcy";
-import errorCode from "@/utils/errorCode";
+import cqcyCode from "@/utils/cqcyCode";
 import {mapGetters} from "vuex";
 import { v4 as uuidv4 } from 'uuid'
 
@@ -838,7 +839,7 @@ export default {
         resolve(dataList)
       }).catch((e) => {
         resolve([])
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 懒加载查询组配置文件:组配置列表 */
@@ -860,7 +861,7 @@ export default {
           resolve(arr)
         }).catch((e) => {
           resolve([])
-          showAlertWin(this, e)
+          showAlertWin(this, null, e)
         })
       } else {
         // getItemGroupById(node.data.id).then(res => {
@@ -1207,12 +1208,7 @@ export default {
         })
         return
       }
-      _this.$confirm('您确定要删除该数据组吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(_this, null, '您确定要删除该数据组吗?', () => {
         const loading = showLoading(_this, '删除中,请稍候···')
         delItemGroupById(this.chooseGroupData.id).then(res => {
           loading.close()
@@ -1229,7 +1225,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch(() => {
       })
     },
     /** 刷新数据组列表 */
@@ -1249,26 +1244,19 @@ export default {
     updateReportName() {
       if (!this.chooseReportData || !this.chooseReportData.id) {
         this.$message({
-          message: errorCode[201],
+          message: cqcyCode[201],
           type: 'error'
         })
         return
       }
-      this.$prompt('请输入报表模板名称', '修改报表模板名称', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        inputValue: this.chooseReportData.reportName,
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValidator: (val) => {
-          if (!val || !val.trim()) {
-            return '报表模板名称不能为空'
-          }
-          if (val.length > 20) {
-            return '报表模板名称必须在20字以内'
-          }
+      showPromptWin(this, '修改报表模板名称', '请输入报表模板名称', this.chooseReportData.reportName, (val) => {
+        if (!val || !val.trim()) {
+          return '报表模板名称不能为空'
+        }
+        if (val.length > 20) {
+          return '报表模板名称必须在20字以内'
         }
-      }).then(({value}) => {
+      }, (value) => {
         const loading = showLoading(this, '修改中,请稍候···')
         let params = {
           'id': this.chooseReportData.id,
@@ -1288,25 +1276,18 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch((e) => {
-        console.log(e)
       })
     },
     /** 删除报表信息 */
     delReport() {
       if (!this.chooseReportData || !this.chooseReportData.id) {
         this.$message({
-          message: errorCode[201],
+          message: cqcyCode[201],
           type: 'error'
         })
         return
       }
-      this.$confirm('您确定要删除该报表模板吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除该报表模板吗?', () => {
         const loading = showLoading(this, '删除中,请稍候···')
         delTableTemplateById(this.chooseReportData.id).then(res => {
           loading.close()
@@ -1322,14 +1303,13 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch(() => {
       })
     },
     /** 导出模板报表 */
     exportReport() {
       if (!this.chooseReportData || !this.chooseReportData.id) {
         this.$message({
-          message: errorCode[201],
+          message: cqcyCode[201],
           type: 'error'
         })
         return
@@ -1971,12 +1951,7 @@ export default {
     /** 报表模板移除 */
     removeReportItem(node, data) {
       this.delFlag = false
-      this.$confirm('您确定要删除该报表模板吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除该报表模板吗?', () => {
         const loading = showLoading(this, '删除中,请稍候···')
         delTableTemplateById(data.id).then(res => {
           loading.close()
@@ -1996,7 +1971,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch(() => {
       })
     },
     /** 关闭右键弹出层 */
@@ -2254,4 +2228,15 @@ export default {
     width: 70px;
   }
 }
+
+
+.cy-tj-config {
+  .el-dialog {
+    height: 70vh;
+
+    .el-dialog__body {
+      height: calc(100% - 100px);
+    }
+  }
+}
 </style>

+ 13 - 38
chuanyi_client2/src/components/HeaderPersonal/index.vue

@@ -84,7 +84,7 @@
         width="80vw"
         class="cy-warn-dialog"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="dialogNoticeVisible"
         :before-close="dialogClose"
         :visible.sync="dialogNoticeVisible"
@@ -149,9 +149,9 @@ import {mapGetters} from 'vuex'
 import {updatePwd} from '@/api/user'
 import {getPubKey} from '@/utils/auth'
 import {encrypt} from '@/utils/jsencrypt'
-import {customCompare, showAlertWin, showLoading} from '@/utils/cqcy'
+import {customCompare, showAlertWin, showConfirmWin, showLoading} from '@/utils/cqcy'
 import {getAllMessageNotice} from "@/api/basic";
-import {clearMessage, delDataModelById, deleteMessageNoticeById, delMesNotByIdList} from "@/api/datasource";
+import {clearMessage, deleteMessageNoticeById, delMesNotByIdList} from "@/api/datasource";
 
 let pkg = require('../../../package.json')
 
@@ -289,7 +289,7 @@ export default {
             this.dialogClose()
           }).catch((e) => {
             loading.close()
-            showAlertWin(this, e)
+            showAlertWin(this, null, e)
           })
         }
       })
@@ -322,37 +322,25 @@ export default {
         this.tableNoticeData = res.data.messageNoticeList
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /**
      * 退出登录
      */
     logout() {
-      this.$confirm('您确定要退出系统吗?', '提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        type: 'warning'
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要退出系统吗?', () => {
         this.$store.dispatch('user/Logout').then(() => {
           // location.href = '/index';
           this.$router.push({path: '/', query: {}})
           window.location.reload()
         }).catch(() => {
         })
-      }).catch(() => {
-      });
+      })
     },
     /** 删除报警信息 */
     handleDelete(index, row) {
-      this.$confirm('您确定要删除该报警信息吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除该报警信息吗?', () => {
         const loading = showLoading(this, '删除中,请稍候···')
         deleteMessageNoticeById(row.id).then(res => {
           loading.close()
@@ -364,9 +352,8 @@ export default {
           this.getWarnInfo()
         }).catch((e) => {
           loading.close()
-          showAlertWin(this, e)
+          showAlertWin(this, null, e)
         })
-      }).catch(() => {
       })
     },
     /** 表格选择事件 */
@@ -382,12 +369,7 @@ export default {
         })
         return
       }
-      this.$confirm('您确定要删除选中的' + this.multipleSelectionMsg.length + '条报警信息吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除选中的' + this.multipleSelectionMsg.length + '条报警信息吗?', () => {
         const loading = showLoading(this, '删除中,请稍候···')
         let ids = Array.from(this.multipleSelectionMsg, ({ id }) => id)
         delMesNotByIdList(ids).then(res => {
@@ -400,19 +382,13 @@ export default {
           this.getWarnInfo()
         }).catch((e) => {
           loading.close()
-          showAlertWin(this, e)
+          showAlertWin(this, null, e)
         })
-      }).catch(() => {
       })
     },
     /** 清空所有消息 */
     delMsgAllEvent() {
-      this.$confirm('清除后不可恢复,您确定要继续吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '清除后不可恢复,您确定要继续吗?', () => {
         const loading = showLoading(this, '清除中,请稍候···')
         clearMessage().then(res => {
           loading.close()
@@ -424,9 +400,8 @@ export default {
           this.getWarnInfo()
         }).catch((e) => {
           loading.close()
-          showAlertWin(this, e)
+          showAlertWin(this, null, e)
         })
-      }).catch(() => {
       })
     },
     /** 弹出层关闭事件 */

+ 12 - 18
chuanyi_client2/src/components/LeftMenu/index.vue

@@ -31,7 +31,7 @@
         width="80%"
         top="10vh"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="datasourceDialogVisible"
         :before-close="handleClose"
         :visible.sync="datasourceDialogVisible"
@@ -181,7 +181,7 @@ import {
   saveOrUpdateDataSource,
   testConnect
 } from "@/api/datasource";
-import {showAlertWin, showLoading} from "@/utils/cqcy";
+import {showAlertWin, showConfirmWin, showLoading} from "@/utils/cqcy";
 import {encrypt} from "@/utils/jsencrypt";
 import {getPubKey} from "@/utils/auth";
 import {mapGetters} from "vuex";
@@ -358,12 +358,7 @@ export default {
         })
         return
       }
-      _this.$confirm('您确定要删除该数据源吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(_this, null, '您确定要删除该数据源吗?', () => {
         const loading = showLoading(_this, '删除中,请稍候···')
         delDataSourceById(data.id).then(res => {
           loading.close()
@@ -375,9 +370,8 @@ export default {
           this.resetAllDataSource()
         }).catch((e) => {
           loading.close()
-          showAlertWin(_this, e)
+          showAlertWin(_this, null, e)
         })
-      }).catch(() => {
       })
     },
     /** 已连接服务点击事件 */
@@ -587,13 +581,13 @@ export default {
       testConnect(params).then(res => {
         loading.close()
         if (res.data) {
-          showAlertWin(this, '连接成功!')
+          showAlertWin(this, null, '连接成功!')
           return
         }
-        showAlertWin(this, res.msg)
+        showAlertWin(this, null, res.msg)
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 保存连接 */
@@ -602,7 +596,7 @@ export default {
       saveOrUpdateDataSource(params).then(res => {
         loading.close()
         if (res.data) {
-          showAlertWin(this, '保存成功!', (action) => {
+          showAlertWin(this, null, '保存成功!', (action) => {
             this.resetAllDataSource()
           })
           return
@@ -613,7 +607,7 @@ export default {
         })
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 获取左侧数据源类型列表 */
@@ -624,7 +618,7 @@ export default {
         loading.close()
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 获取右侧数据源类型列表 */
@@ -635,7 +629,7 @@ export default {
         loading.close()
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 获取驱动 */
@@ -662,7 +656,7 @@ export default {
             })
           }).catch((e) => {
             loading.close()
-            showAlertWin(this, e)
+            showAlertWin(this, null, e)
           })
         }
       })

+ 1 - 249
chuanyi_client2/src/main.js

@@ -12,6 +12,7 @@ import '@/permission'
 import App from './App.vue'
 import router from './router'
 import store from './store'
+import '@/utils/directives'
 
 Vue.component('split-pane', splitPane);
 
@@ -19,255 +20,6 @@ Vue.use(Element, {
   size: Cookies.get('size') || 'medium'
 })
 
-Vue.directive('dialogDrag', {
-  bind(el, binding, vnode, oldVnode) {
-    //  console.log(el)
-    //弹框可拉伸最小宽高
-    let minWidth = 400;
-    let minHeight = 300;
-    //初始非全屏
-    let isFullScreen = false;
-    //当前宽高
-    let nowWidth = 0;
-    let nowHight = 0;
-    //当前顶部高度
-    let nowMarginTop = 0;
-    //获取弹框头部(这部分可双击全屏)
-    const dialogHeaderEl = el.querySelector('.el-dialog__header');
-    //弹窗
-    const dragDom = el.querySelector('.el-dialog');
-    //给弹窗加上overflow auto;不然缩小时框内的标签可能超出dialog;
-    dragDom.style.overflow = "auto";
-    //清除选择头部文字效果
-    dialogHeaderEl.onselectstart = new Function("return false");
-    //头部加上可拖动cursor
-    dialogHeaderEl.style.cursor = 'move';
-
-    // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
-    const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
-
-    let moveDown = (e) => {
-      // 鼠标按下,计算当前元素距离可视区的距离
-      const disX = e.clientX - dialogHeaderEl.offsetLeft;
-      const disY = e.clientY - dialogHeaderEl.offsetTop;
-
-      // 获取到的值带px 正则匹配替换
-      let styL, styT;
-
-      // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
-      if (sty.left.includes('%')) {
-        styL = +document.body.clientWidth * (+sty.left.replace(/%/g, '') / 100);
-        styT = +document.body.clientHeight * (+sty.top.replace(/%/g, '') / 100);
-      } else {
-        styL = +sty.left.replace(/px/g, '');
-        styT = +sty.top.replace(/px/g, '');
-      }
-      ;
-
-      document.onmousemove = function (e) {
-        // 通过事件委托,计算移动的距离
-        const l = e.clientX - disX;
-        const t = e.clientY - disY;
-
-        // 移动当前元素
-        dragDom.style.left = `${l + styL}px`;
-        dragDom.style.top = `${t + styT}px`;
-
-        //将此时的位置传出去
-        //binding.value({x:e.pageX,y:e.pageY})
-      };
-
-      document.onmouseup = function (e) {
-        document.onmousemove = null;
-        document.onmouseup = null;
-      };
-    }
-    dialogHeaderEl.onmousedown = moveDown;
-    //  双击(头部)效果不想要可以注释
-    dialogHeaderEl.ondblclick = (e) => {
-      if (isFullScreen == false) {
-        nowHight = dragDom.clientHeight;
-        nowWidth = dragDom.clientWidth;
-        nowMarginTop = dragDom.style.marginTop;
-        dragDom.style.left = 0;
-        dragDom.style.top = 0;
-        dragDom.style.height = "100VH";
-        dragDom.style.width = "100VW";
-        dragDom.style.marginTop = 0;
-        isFullScreen = true;
-        dialogHeaderEl.style.cursor = 'initial';
-        dialogHeaderEl.onmousedown = null;
-      } else {
-        dragDom.style.height = "auto";
-        dragDom.style.width = nowWidth + 'px';
-        dragDom.style.marginTop = nowMarginTop;
-        isFullScreen = false;
-        dialogHeaderEl.style.cursor = 'move';
-        dialogHeaderEl.onmousedown = moveDown;
-      }
-    }
-
-    //拉伸(右下方)效果不想要可以注释
-    let resizeEl = document.createElement("div");
-    dragDom.appendChild(resizeEl);
-    //在弹窗右下角加上一个10-10px的控制块
-    resizeEl.style.cursor = 'se-resize';
-    resizeEl.style.position = 'absolute';
-    resizeEl.style.height = '10px';
-    resizeEl.style.width = '10px';
-    resizeEl.style.right = '0px';
-    resizeEl.style.bottom = '0px';
-    resizeEl.style.zIndex = '99';
-    //鼠标拉伸弹窗
-    resizeEl.onmousedown = (e) => {
-      // 记录初始x位置
-      let clientX = e.clientX;
-      // 鼠标按下,计算当前元素距离可视区的距离
-      let disX = e.clientX - resizeEl.offsetLeft;
-      let disY = e.clientY - resizeEl.offsetTop;
-
-      document.onmousemove = function (e) {
-        e.preventDefault(); // 移动时禁用默认事件
-
-        // 通过事件委托,计算移动的距离
-        let x = e.clientX - disX + (e.clientX - clientX);//这里 由于elementUI的dialog控制居中的,所以水平拉伸效果是双倍
-        let y = e.clientY - disY;
-        //比较是否小于最小宽高
-        dragDom.style.width = x > minWidth ? `${x}px` : minWidth + 'px';
-        dragDom.style.height = y > minHeight ? `${y}px` : minHeight + 'px';
-      };
-      //拉伸结束
-      document.onmouseup = function (e) {
-        document.onmousemove = null;
-        document.onmouseup = null;
-      };
-    }
-
-    //拉伸(右边)效果不想要可以注释
-    let resizeElR = document.createElement("div");
-    dragDom.appendChild(resizeElR);
-    //在弹窗右下角加上一个10-10px的控制块
-    resizeElR.style.cursor = 'w-resize';
-    resizeElR.style.position = 'absolute';
-    resizeElR.style.height = '100%';
-    resizeElR.style.width = '10px';
-    resizeElR.style.right = '0px';
-    resizeElR.style.top = '0px';
-    //鼠标拉伸弹窗
-    resizeElR.onmousedown = (e) => {
-      let elW = dragDom.clientWidth;
-      let EloffsetLeft = dragDom.offsetLeft;
-      // 记录初始x位置
-      let clientX = e.clientX;
-      document.onmousemove = function (e) {
-        e.preventDefault(); // 移动时禁用默认事件
-        //右侧鼠标拖拽位置
-        if (clientX > EloffsetLeft + elW - 10 && clientX < EloffsetLeft + elW) {
-          //往左拖拽
-          if (clientX > e.clientX) {
-            if (dragDom.clientWidth < minWidth) {
-            } else {
-              dragDom.style.width = elW - (clientX - e.clientX) * 2 + 'px';
-            }
-          }
-          //往右拖拽
-          if (clientX < e.clientX) {
-            dragDom.style.width = elW + (e.clientX - clientX) * 2 + 'px';
-          }
-        }
-
-      };
-      //拉伸结束
-      document.onmouseup = function (e) {
-        document.onmousemove = null;
-        document.onmouseup = null;
-      };
-    }
-
-    //拉伸(左边)效果不想要可以注释
-    let resizeElL = document.createElement("div");
-    dragDom.appendChild(resizeElL);
-    //在弹窗右下角加上一个10-10px的控制块
-    resizeElL.style.cursor = 'w-resize';
-    resizeElL.style.position = 'absolute';
-    resizeElL.style.height = '100%';
-    resizeElL.style.width = '10px';
-    resizeElL.style.left = '0px';
-    resizeElL.style.top = '0px';
-    //鼠标拉伸弹窗
-    resizeElL.onmousedown = (e) => {
-      let elW = dragDom.clientWidth;
-      let EloffsetLeft = dragDom.offsetLeft;
-      // 记录初始x位置
-      let clientX = e.clientX;
-      document.onmousemove = function (e) {
-        e.preventDefault(); // 移动时禁用默认事件
-        //左侧鼠标拖拽位置
-        if (clientX > EloffsetLeft && clientX < EloffsetLeft + 10) {
-          //往左拖拽
-          if (clientX > e.clientX) {
-            dragDom.style.width = elW + (clientX - e.clientX) * 2 + 'px';
-          }
-          //往右拖拽
-          if (clientX < e.clientX) {
-            if (dragDom.clientWidth < minWidth) {
-            } else {
-              dragDom.style.width = elW - (e.clientX - clientX) * 2 + 'px';
-
-            }
-          }
-        }
-
-      };
-      //拉伸结束
-      document.onmouseup = function (e) {
-        document.onmousemove = null;
-        document.onmouseup = null;
-      };
-    }
-
-    // 拉伸(下边)效果不想要可以注释
-    let resizeElB = document.createElement("div");
-    dragDom.appendChild(resizeElB);
-    //在弹窗右下角加上一个10-10px的控制块
-    resizeElB.style.cursor = 'n-resize';
-    resizeElB.style.position = 'absolute';
-    resizeElB.style.height = '10px';
-    resizeElB.style.width = '100%';
-    resizeElB.style.left = '0px';
-    resizeElB.style.bottom = '0px';
-    //鼠标拉伸弹窗
-    resizeElB.onmousedown = (e) => {
-      let EloffsetTop = dragDom.offsetTop;
-      let ELscrollTop = el.scrollTop;
-      let clientY = e.clientY;
-      let elH = dragDom.clientHeight;
-      document.onmousemove = function (e) {
-        e.preventDefault(); // 移动时禁用默认事件
-        //底部鼠标拖拽位置
-        if (ELscrollTop + clientY > EloffsetTop + elH - 20 && ELscrollTop + clientY < EloffsetTop + elH) {
-          //往上拖拽
-          if (clientY > e.clientY) {
-            if (dragDom.clientHeight < minHeight) {
-            } else {
-              dragDom.style.height = elH - (clientY - e.clientY) * 2 + 'px';
-            }
-          }
-          //往下拖拽
-          if (clientY < e.clientY) {
-            dragDom.style.height = elH + (e.clientY - clientY) * 2 + 'px';
-          }
-        }
-      };
-      //拉伸结束
-      document.onmouseup = function (e) {
-        document.onmousemove = null;
-        document.onmouseup = null;
-      };
-    }
-  }
-})
-
 Vue.config.productionTip = false
 
 new Vue({

+ 2 - 2
chuanyi_client2/src/store/modules/user.js

@@ -2,7 +2,7 @@ import { getUserInfo, login, logout } from '@/api/user'
 import { getToken, setToken, getUid, getUsername, setUid, setUsername, removeAll, setPubKey } from '@/utils/auth'
 import { encrypt } from '@/utils/jsencrypt'
 import { resetRouter } from '@/router'
-import errorCode from '@/utils/errorCode'
+import cqcyCode from '@/utils/cqcyCode'
 
 const state = {
   token: getToken(),
@@ -76,7 +76,7 @@ const actions = {
       getUserInfo(params).then(response => {
         const { data } = response
         if (!data) {
-          reject(errorCode[906])
+          reject(cqcyCode[906])
         }
         const { userId, userName, roleList } = data
 

+ 82 - 30
chuanyi_client2/src/utils/cqcy.js

@@ -1,4 +1,4 @@
-import errorCode from "@/utils/errorCode";
+import cqcyCode from "@/utils/cqcyCode";
 
 /**
  * 通用js方法封装处理
@@ -371,35 +371,6 @@ export function deepTreeKey(list, key) {
 }
 
 /**
- * 显示alert弹出层
- * @param _this
- * @param e
- */
-export function showAlertWin(_this, e, callback) {
-    if (e && e.name == 'TypeError') {
-        console.error(e)
-        return
-    }
-    _this.$alert(e, errorCode[100], {
-        confirmButtonText: '确定',
-        showClose: false,
-        callback: action => {
-            if (callback) callback(action)
-        }
-    })
-}
-
-export function showAlertWinTips(_this, tips, e, callback) {
-    _this.$alert(e, tips, {
-        confirmButtonText: '确定',
-        showClose: false,
-        callback: action => {
-            if (callback) callback(action)
-        }
-    })
-}
-
-/**
  * 排序比较
  * @param {string} propertyName 排序的属性名
  * @param {string} sort ascending(升序)/descending(降序)
@@ -476,4 +447,85 @@ export function getLuckysheetConfig() {
         }
     })
     return JSON.stringify(ls)
+}
+
+/**
+ * 显示alert弹出层
+ * @param _this
+ * @param title
+ * @param e
+ * @param callback
+ */
+export function showAlertWin(_this, title, e, callback) {
+    if (e && e.name == 'TypeError') {
+        console.error(e)
+        return
+    }
+    _this.$alert(e, title ? title : cqcyCode[100], {
+        confirmButtonText: '确定',
+        showClose: false,
+        callback: action => {
+            resetConfirmWinPosition()
+            if (callback) callback(action)
+        }
+    })
+}
+
+/**
+ * 显示询问框
+ * @param _this
+ * @param title
+ * @param msg
+ * @param callback
+ */
+export function showConfirmWin(_this, title, msg, callback) {
+    _this.$confirm(msg, title ? title : cqcyCode[100], {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        customClass: 'close_confirm',
+        closeOnClickModal: false,
+        type: 'warning'
+    }).then(() => {
+        resetConfirmWinPosition()
+        if (callback) callback()
+    }).catch(() => {
+        resetConfirmWinPosition()
+    })
+}
+
+/**
+ * 显示输入框
+ * @param _this
+ * @param title
+ * @param msg
+ * @param val
+ * @param valid
+ * @param callback
+ * @param cancelCallback
+ */
+export function showPromptWin(_this, title, msg, val, valid, callback, cancelCallback) {
+    _this.$prompt(msg, title ? title : cqcyCode[100], {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        customClass: 'close_confirm',
+        closeOnClickModal: false,
+        inputValue: val ? val : '',
+        inputValidator: valid
+    }).then(({value}) => {
+        resetConfirmWinPosition()
+        if (callback) callback(value)
+    }).catch(() => {
+        resetConfirmWinPosition()
+        if (cancelCallback) cancelCallback()
+    })
+}
+
+/**
+ * 重置询问框初始位置
+ */
+export function resetConfirmWinPosition() {
+    setTimeout(() => {
+        const dragDom = document.querySelector('.el-message-box')
+        if (dragDom) dragDom.style = ''
+    }, 500)
 }

+ 1 - 1
chuanyi_client2/src/utils/errorCode.js → chuanyi_client2/src/utils/cqcyCode.js

@@ -6,7 +6,7 @@ export default {
 
     'clientRole': 'ClientRole',
 
-    '100': '温馨提示',
+    '100': '系统提示',
 
     '201': '参数错误,请刷新后重试!',
 

+ 424 - 0
chuanyi_client2/src/utils/directives.js

@@ -0,0 +1,424 @@
+import Vue from 'vue';
+
+// v-dialog-drag-and-zoom: 弹窗拖拽+水平垂直对角线方向伸缩
+Vue.directive('dialogDragAndZoom', {
+    bind(el, binding, vnode, oldVnode) {
+        //弹框可拉伸最小宽高
+        let minWidth = 250;
+        let minHeight = 200;
+        //初始非全屏
+        let isFullScreen = false;
+        //当前宽高
+        let nowWidth = 0;
+        let nowHight = 0;
+        //当前顶部高度
+        let nowMarginTop = 0;
+        //获取弹框头部(这部分可双击全屏)
+        const dialogHeaderEl = el.querySelector('.el-dialog__header');
+        //弹窗
+        const dragDom = el.querySelector('.el-dialog');
+        //给弹窗加上overflow auto;不然缩小时框内的标签可能超出dialog;
+        dragDom.style.overflow = "auto";
+        //清除选择头部文字效果
+        dialogHeaderEl.onselectstart = new Function("return false");
+        //头部加上可拖动cursor
+        dialogHeaderEl.style.cursor = 'move';
+        // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
+        const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null);
+        let moveDown = (e) => {
+            // 鼠标按下,计算当前元素距离可视区的距离
+            const disX = e.clientX - dialogHeaderEl.offsetLeft;
+            const disY = e.clientY - dialogHeaderEl.offsetTop;
+            // 获取到的值带px 正则匹配替换
+            let styL, styT;
+            // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
+            if (sty.left.includes('%')) {
+                styL = +document.body.clientWidth * (+sty.left.replace(/%/g, '') / 100);
+                styT = +document.body.clientHeight * (+sty.top.replace(/%/g, '') / 100);
+            } else {
+                styL = +sty.left.replace(/px/g, '');
+                styT = +sty.top.replace(/px/g, '');
+            }
+            const bodyWidth = document.body.clientWidth
+            const bodyHeight = document.body.clientHeight // 获取屏幕高度
+            document.onmousemove = function (e) {
+                // 通过事件委托,计算移动的距离
+                const l = e.clientX - disX;
+                const t = e.clientY - disY;
+                // console.log("鼠标移动到的位置",e.clientX, e.clientY)
+
+                // 限制不让拖出屏幕 *****
+                if (e.clientY < 20 || e.clientY > bodyHeight - 100) {
+                    return
+                }
+                if (e.clientX < 100 || e.clientX > bodyWidth - 100) {
+                    return
+                }
+
+                // 移动当前元素
+                dragDom.style.left = `${l + styL}px`;
+                dragDom.style.top = `${t + styT}px`;
+                //将此时的位置传出去
+                //binding.value({x:e.pageX,y:e.pageY})
+            }
+            document.onmouseup = function (e) {
+                document.onmousemove = null;
+                document.onmouseup = null;
+            };
+        }
+        dialogHeaderEl.onmousedown = moveDown;
+
+        // 底部可以拖动 start
+        const dialogFooterEl = el.querySelector('.el-dialog__footer');
+        let moveDownFoot = (e) => {
+            // 鼠标按下,计算当前元素距离可视区的距离
+            const disX = e.clientX - dialogFooterEl.offsetLeft;
+            const disY = e.clientY - dialogFooterEl.offsetTop;
+
+            let height = document.getElementsByClassName("summaryDialog")[0].getElementsByClassName('el-dialog')[0].offsetHeight
+            // console.log("99999小结height",height)
+            const height2 = height - 56
+
+            // 获取到的值带px 正则匹配替换
+            let styL, styT;
+            // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
+            if (sty.left.includes('%')) {
+                styL = +document.body.clientWidth * (+sty.left.replace(/%/g, '') / 100);
+                styT = +document.body.clientHeight * (+sty.top.replace(/%/g, '') / 100);
+            } else {
+                styL = +sty.left.replace(/px/g, '');
+                styT = +sty.top.replace(/px/g, '');
+            }
+            const bodyWidth = document.body.clientWidth
+            const bodyHeight = document.body.clientHeight // 获取屏幕高度
+            document.onmousemove = function (e) {
+                // 通过事件委托,计算移动的距离
+                const l = e.clientX - disX;
+                const t = e.clientY - disY;
+
+                // 限制不让拖出屏幕 *****
+                if (e.clientY < 100 || e.clientY > bodyHeight - 20) {
+                    return
+                }
+                if (e.clientX < 100 || e.clientX > bodyWidth - 100) {
+                    return
+                }
+
+                // 移动当前元素
+                dragDom.style.left = `${l + styL}px`;
+                dragDom.style.top = `${t + styT - height2}px`;
+                //将此时的位置传出去
+                //binding.value({x:e.pageX,y:e.pageY})
+            }
+            document.onmouseup = function (e) {
+                document.onmousemove = null;
+                document.onmouseup = null;
+            };
+        }
+        // dialogFooterEl.style.cursor = 'move';
+        // dialogFooterEl.onmousedown = moveDownFoot;
+        // 底部可以拖动 end
+
+
+        //双击头部效果
+        dialogHeaderEl.ondblclick = (e) => {
+            if (isFullScreen == false) {
+                nowHight = dragDom.clientHeight;
+                nowWidth = dragDom.clientWidth;
+                nowMarginTop = dragDom.style.marginTop;
+                dragDom.style.left = 0;
+                dragDom.style.top = 0;
+                dragDom.style.height = "100VH";
+                dragDom.style.width = "100VW";
+                dragDom.style.marginTop = 0;
+                isFullScreen = true;
+                dialogHeaderEl.style.cursor = 'initial';
+                dialogHeaderEl.onmousedown = null;
+            } else {
+                dragDom.style.height = "auto";
+                dragDom.style.width = nowWidth + 'px';
+                dragDom.style.marginTop = nowMarginTop;
+                isFullScreen = false;
+                dialogHeaderEl.style.cursor = 'move';
+                dialogHeaderEl.onmousedown = moveDown;
+            }
+        }
+
+        //拉伸(右下方)
+        let resizeEl = document.createElement("div");
+        dragDom.appendChild(resizeEl);
+        //在弹窗右下角加上一个10-10px的控制块
+        resizeEl.style.cursor = 'se-resize';
+        resizeEl.style.position = 'absolute';
+        resizeEl.style.height = '10px';
+        resizeEl.style.width = '10px';
+        resizeEl.style.right = '0px';
+        resizeEl.style.bottom = '0px';
+        resizeEl.style.zIndex = '99';
+        //鼠标拉伸弹窗
+        resizeEl.onmousedown = (e) => {
+            // 记录初始x位置
+            let clientX = e.clientX;
+            // 鼠标按下,计算当前元素距离可视区的距离
+            let disX = e.clientX - resizeEl.offsetLeft;
+            let disY = e.clientY - resizeEl.offsetTop;
+            document.onmousemove = function (e) {
+                e.preventDefault(); // 移动时禁用默认事件
+
+                // 通过事件委托,计算移动的距离
+                let x = e.clientX - disX + (e.clientX - clientX);//这里 由于elementUI的dialog控制居中的,所以水平拉伸效果是双倍
+                let y = e.clientY - disY;
+                //比较是否小于最小宽高
+                dragDom.style.width = x > minWidth ? `${x}px` : minWidth + 'px';
+                dragDom.style.height = y > minHeight ? `${y}px` : minHeight + 'px';
+            };
+            //拉伸结束
+            document.onmouseup = function (e) {
+                document.onmousemove = null;
+                document.onmouseup = null;
+            };
+        }
+
+        //拉伸(左下方)
+        let resizeElLeft = document.createElement("div");
+        dragDom.appendChild(resizeElLeft);
+        //在弹窗右下角加上一个10-10px的控制块
+        resizeElLeft.style.cursor = 'sw-resize';
+        resizeElLeft.style.position = 'absolute';
+        resizeElLeft.style.height = '10px';
+        resizeElLeft.style.width = '10px';
+        resizeElLeft.style.left = '0px';
+        resizeElLeft.style.bottom = '0px';
+        resizeElLeft.style.zIndex = '99';
+        //鼠标拉伸弹窗
+        resizeElLeft.onmousedown = (e) => {
+            // 记录初始x位置
+            let clientX = e.clientX;
+            // 鼠标按下,计算当前元素距离可视区的距离
+
+            let disX = dragDom.clientWidth;  // 鼠标按下 记录元素的宽
+
+            let disY = e.clientY - resizeElLeft.offsetTop;
+            document.onmousemove = function (e) {
+                e.preventDefault(); // 移动时禁用默认事件
+
+                // 通过事件委托,计算移动的距离
+                let x = disX + (clientX - e.clientX) * 2;//这里 由于elementUI的dialog控制居中的,所以水平拉伸效果是双倍
+                let y = e.clientY - disY;
+                //比较是否小于最小宽高
+                dragDom.style.width = x > minWidth ? `${x}px` : minWidth + 'px';
+                dragDom.style.height = y > minHeight ? `${y}px` : minHeight + 'px';
+            };
+            //拉伸结束
+            document.onmouseup = function (e) {
+                document.onmousemove = null;
+                document.onmouseup = null;
+            };
+        }
+
+        //拉伸(右边)
+        let resizeElR = document.createElement("div");
+        dragDom.appendChild(resizeElR);
+        //在弹窗右下角加上一个10-10px的控制块
+        resizeElR.style.cursor = 'w-resize';
+        resizeElR.style.position = 'absolute';
+        resizeElR.style.height = '100%';
+        resizeElR.style.width = '10px';
+        resizeElR.style.right = '0px';
+        resizeElR.style.top = '0px';
+        //鼠标拉伸弹窗
+        resizeElR.onmousedown = (e) => {
+            let elW = dragDom.clientWidth;
+            let EloffsetLeft = dragDom.offsetLeft;
+            // 记录初始x位置
+            let clientX = e.clientX;
+            document.onmousemove = function (e) {
+                e.preventDefault(); // 移动时禁用默认事件
+                //右侧鼠标拖拽位置
+                if (clientX > EloffsetLeft + elW - 10 && clientX < EloffsetLeft + elW) {
+                    //往左拖拽
+                    if (clientX > e.clientX) {
+                        if (dragDom.clientWidth < minWidth) {
+                            console.log(111)
+                        } else {
+                            dragDom.style.width = elW - (clientX - e.clientX) * 2 + 'px';
+                        }
+                    }
+                    //往右拖拽
+                    if (clientX < e.clientX) {
+                        dragDom.style.width = elW + (e.clientX - clientX) * 2 + 'px';
+                    }
+                }
+
+            };
+            //拉伸结束
+            document.onmouseup = function (e) {
+                document.onmousemove = null;
+                document.onmouseup = null;
+            };
+        }
+
+        //拉伸(左边)
+        let resizeElL = document.createElement("div");
+        dragDom.appendChild(resizeElL);
+        //在弹窗右下角加上一个10-10px的控制块
+        resizeElL.style.cursor = 'w-resize';
+        resizeElL.style.position = 'absolute';
+        resizeElL.style.height = '100%';
+        resizeElL.style.width = '10px';
+        resizeElL.style.left = '0px';
+        resizeElL.style.top = '0px';
+        //鼠标拉伸弹窗
+        resizeElL.onmousedown = (e) => {
+            let elW = dragDom.clientWidth;
+            let EloffsetLeft = dragDom.offsetLeft;
+            // 记录初始x位置
+            let clientX = e.clientX;
+            document.onmousemove = function (e) {
+                e.preventDefault(); // 移动时禁用默认事件
+                //左侧鼠标拖拽位置
+                if (clientX > EloffsetLeft && clientX < EloffsetLeft + 10) {
+                    //往左拖拽
+                    if (clientX > e.clientX) {
+                        dragDom.style.width = elW + (clientX - e.clientX) * 2 + 'px';
+                    }
+                    //往右拖拽
+                    if (clientX < e.clientX) {
+                        if (dragDom.clientWidth < minWidth) {
+                            console.log(222)
+                        } else {
+                            dragDom.style.width = elW - (e.clientX - clientX) * 2 + 'px';
+
+                        }
+                    }
+                }
+
+            };
+            //拉伸结束
+            document.onmouseup = function (e) {
+                document.onmousemove = null;
+                document.onmouseup = null;
+            };
+        }
+
+        // 拉伸(下边)
+        let resizeElB = document.createElement("div");
+        dragDom.appendChild(resizeElB);
+        //在弹窗右下角加上一个10-10px的控制块
+        resizeElB.style.cursor = 'n-resize';
+        resizeElB.style.position = 'absolute';
+        resizeElB.style.height = '10px';
+        resizeElB.style.width = '100%';
+        resizeElB.style.left = '0px';
+        resizeElB.style.bottom = '0px';
+        //鼠标拉伸弹窗
+        resizeElB.onmousedown = (e) => {
+            let EloffsetTop = dragDom.offsetTop;
+            let ELscrollTop = el.scrollTop;
+            let clientY = e.clientY;
+            let elH = dragDom.clientHeight;
+            document.onmousemove = function (e) {
+                e.preventDefault(); // 移动时禁用默认事件
+                //底部鼠标拖拽位置
+                if (ELscrollTop + clientY > EloffsetTop + elH - 20 && ELscrollTop + clientY < EloffsetTop + elH) {
+                    //往上拖拽
+                    if (clientY > e.clientY) {
+                        if (dragDom.clientHeight < minHeight) {
+                            console.log(333)
+                        } else {
+                            dragDom.style.height = elH - (clientY - e.clientY) * 2 + 'px';
+                        }
+                    }
+                    //往下拖拽
+                    if (clientY < e.clientY) {
+                        dragDom.style.height = elH + (e.clientY - clientY) * 2 + 'px';
+                    }
+                }
+            };
+            //拉伸结束
+            document.onmouseup = function (e) {
+                document.onmousemove = null;
+                document.onmouseup = null;
+            };
+        }
+    }
+});
+
+// v-dialogDrag: 弹窗拖拽
+Vue.directive('dialogDrag', {
+    bind: function (el, binding, vnode) {
+        const dialogHeaderEl = el.querySelector('.el-dialog__header')
+        const dragDom = el.querySelector('.el-dialog')
+        dialogHeaderEl.style.cssText += ';cursor:move;'
+        dragDom.style.cssText += ';top:0px;'
+
+        // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
+        const getStyle = (function () {
+            if (window.document.currentStyle) {
+                return (dom, attr) => dom.currentStyle[attr]
+            } else {
+                return (dom, attr) => getComputedStyle(dom, false)[attr]
+            }
+        })()
+
+        dialogHeaderEl.onmousedown = (e) => {
+            // 鼠标按下,计算当前元素距离可视区的距离
+            const disX = e.clientX - dialogHeaderEl.offsetLeft
+            const disY = e.clientY - dialogHeaderEl.offsetTop
+
+            const dragDomWidth = dragDom.offsetWidth
+            const dragDomheight = dragDom.offsetHeight
+
+            const screenWidth = document.body.clientWidth
+            const screenHeight = document.body.clientHeight
+
+            const minDragDomLeft = dragDom.offsetLeft
+            const maxDragDomLeft = screenWidth - dragDom.offsetLeft - dragDomWidth
+
+            const minDragDomTop = dragDom.offsetTop
+            const maxDragDomTop = screenHeight - dragDom.offsetTop - dragDomheight
+
+            // 获取到的值带px 正则匹配替换
+            let styL = getStyle(dragDom, 'left')
+            let styT = getStyle(dragDom, 'top')
+
+            if (styL.includes('%')) {
+                styL = +document.body.clientWidth * (+styL.replace(/%/g, '') / 100)
+                styT = +document.body.clientHeight * (+styT.replace(/%/g, '') / 100)
+            } else {
+                styL = +styL.replace(/\px/g, '')
+                styT = +styT.replace(/\px/g, '')
+            }
+
+            document.onmousemove = function (e) {
+                // 通过事件委托,计算移动的距离
+                let left = e.clientX - disX
+                let top = e.clientY - disY
+
+                // 边界处理
+                if (-(left) > minDragDomLeft) {
+                    left = -minDragDomLeft
+                } else if (left > maxDragDomLeft) {
+                    left = maxDragDomLeft
+                }
+
+                if (-(top) > minDragDomTop) {
+                    top = -minDragDomTop
+                } else if (top > maxDragDomTop) {
+                    top = maxDragDomTop
+                }
+
+                // 移动当前元素
+                dragDom.style.cssText += `;left:${left + styL}px;top:${top + styT}px;`
+
+                // emit onDrag event
+                vnode && vnode.child.$emit('dragDialog')
+            }
+
+            document.onmouseup = function () {
+                document.onmousemove = null
+                document.onmouseup = null
+            }
+        }
+    }
+});

+ 1 - 1
chuanyi_client2/src/utils/luckysheettool.js

@@ -63,7 +63,7 @@ export function insertLuckysheetEChart({
     if (j < 80 || w < 80) {
         if (_self) {
             luckysheet.cancelRangeMerge()
-            showAlertWin(_self, '所选单元格不满足宽度大于80(默认情况下至少3格)或者高度大于80(默认情况下至少5格),请调整大小后重试!')
+            showAlertWin(_self, null, '所选单元格不满足宽度大于80(默认情况下至少3格)或者高度大于80(默认情况下至少5格),请调整大小后重试!')
         }
         return void console.error(`单元[${s},${i}]不满足: width >= 80 && height >= 80,调整大小后重试!`);
     }

+ 9 - 9
chuanyi_client2/src/utils/request.js

@@ -2,7 +2,7 @@ import axios from 'axios'
 import router from "@/router";
 import {Message, Loading} from 'element-ui'
 import {removeAll, getToken} from '@/utils/auth'
-import errorCode from '@/utils/errorCode'
+import cqcyCode from '@/utils/cqcyCode'
 import {tansParams, blobValidate} from "@/utils/cqcy";
 import cache from '@/plugins/cache'
 import {saveAs} from 'file-saver'
@@ -18,7 +18,7 @@ axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
 // 创建axios实例
 const service = axios.create({
     // axios中请求配置有baseURL选项,表示请求URL公共部分
-    baseURL: errorCode['protocol'] + errorCode['host'] + ':' + errorCode['port'],
+    baseURL: cqcyCode['protocol'] + cqcyCode['host'] + ':' + cqcyCode['port'],
     // 超时
     timeout: 30000
 })
@@ -62,7 +62,7 @@ service.interceptors.request.use(config => {
             const s_time = sessionObj.time;                // 请求时间
             const interval = 1000;                         // 间隔时间(ms),小于此时间视为重复提交
             if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
-                const message = errorCode[901];
+                const message = cqcyCode[901];
                 console.warn(`[${s_url}]: ` + message)
                 return Promise.reject(new Error(message))
             } else {
@@ -83,7 +83,7 @@ service.interceptors.response.use(res => {
         // 未设置状态码则默认成功状态
         const code = res.data.code || 200
         // 获取错误信息
-        const msg = errorCode[code] || res.data.msg || errorCode['default']
+        const msg = cqcyCode[code] || res.data.msg || cqcyCode['default']
         // 二进制数据则直接返回
         if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
             return res.data
@@ -127,9 +127,9 @@ service.interceptors.response.use(res => {
     error => {
         let {message} = error;
         if (message == "Network Error") {
-            message = errorCode[904];
+            message = cqcyCode[904];
         } else if (message.includes("timeout")) {
-            message = errorCode[905];
+            message = cqcyCode[905];
         } else if (message.includes("Request failed with status code")) {
             message = "系统接口" + message.substr(message.length - 3) + "异常";
         } else {
@@ -148,7 +148,7 @@ service.interceptors.response.use(res => {
 // 通用下载方法
 export function download(url, params, filename, config) {
     downloadLoadingInstance = Loading.service({
-        text: errorCode[903],
+        text: cqcyCode[903],
         spinner: "el-icon-loading",
         background: "rgba(0, 0, 0, 0.7)",
     })
@@ -167,13 +167,13 @@ export function download(url, params, filename, config) {
         } else {
             const resText = await data.text();
             const rspObj = JSON.parse(resText);
-            const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
+            const errMsg = cqcyCode[rspObj.code] || rspObj.msg || cqcyCode['default']
             Message.error(errMsg);
         }
         downloadLoadingInstance.close();
     }).catch((r) => {
         console.error(r)
-        Message.error(errorCode[902])
+        Message.error(cqcyCode[902])
         downloadLoadingInstance.close();
     })
 }

+ 25 - 32
chuanyi_client2/src/views/data_model/index.vue

@@ -105,7 +105,13 @@
 
 <script>
 import BreadcrumbView from '@/components/BreadcrumbView'
-import {customCompare, showAlertWin, showAlertWinTips, showLoading} from '@/utils/cqcy'
+import {
+  customCompare,
+  showAlertWin,
+  showConfirmWin,
+  showLoading,
+  showPromptWin
+} from '@/utils/cqcy'
 import {
   addDataModel,
   delDataModelById,
@@ -205,7 +211,7 @@ export default {
         this.dialogDataModelVisible = true
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 新增编辑测试 */
@@ -224,20 +230,14 @@ export default {
     },
     /** 测试数据模型值 */
     handleTest(index, row, ruleModel) {
-      this.$prompt('请输入数值', '四则运算表达式验证', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValidator: (val) => {
-          if (!/^(\-)?\d+(\.\d{1,2})?$/.test(val)) {
-            return '请输入正确的数字'
-          }
-          if (val.length > 6) {
-            return '请输入小于6位的数字'
-          }
+      showPromptWin(this, '四则运算表达式验证', '请输入数值', '', (val) => {
+        if (!/^(\-)?\d+(\.\d{1,2})?$/.test(val)) {
+          return '请输入正确的数字'
         }
-      }).then(({ value }) => {
+        if (val.length > 6) {
+          return '请输入小于6位的数字'
+        }
+      }, (value) => {
         const loading = showLoading(this, '计算中,请稍候···')
         if (ruleModel) {
           let params = {
@@ -251,12 +251,12 @@ export default {
             bds = bds.replaceAll(/calcVal/g, value)
             bds += '='
             bds += res.data
-            showAlertWinTips(this, '计算结果', bds)
+            showAlertWin(this, '计算结果', bds)
           }).catch((e) => {
             loading.close()
-            showAlertWin(this, e)
+            showAlertWin(this, null, e)
           })
-         return
+          return
         }
         let params = {
           'id': row.id,
@@ -268,22 +268,16 @@ export default {
           bds = bds.replaceAll(/calcVal/g, value)
           bds += '='
           bds += res.data
-          showAlertWinTips(this, '计算结果', bds)
+          showAlertWin(this, '计算结果', bds)
         }).catch((e) => {
           loading.close()
-          showAlertWin(this, e)
+          showAlertWin(this, null, e)
         })
-      }).catch(() => {
       })
     },
     /** 删除数据模型 */
     handleDelete(index, row) {
-      this.$confirm('您确定要删除该表达式吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除该表达式吗?', () => {
         const loading = showLoading(this, '删除中,请稍候···')
         delDataModelById(row.id).then(res => {
           loading.close()
@@ -295,9 +289,8 @@ export default {
           this.getAllDataModel()
         }).catch((e) => {
           loading.close()
-          showAlertWin(this, e)
+          showAlertWin(this, null, e)
         })
-      }).catch(() => {
       })
     },
     /** 保存数据模型 */
@@ -318,7 +311,7 @@ export default {
               this.getAllDataModel()
             }).catch((e) => {
               loading.close()
-              showAlertWin(this, e)
+              showAlertWin(this, null, e)
             })
            return
           }
@@ -333,7 +326,7 @@ export default {
             this.getAllDataModel()
           }).catch((e) => {
             loading.close()
-            showAlertWin(this, e)
+            showAlertWin(this, null, e)
           })
         }
       })
@@ -377,7 +370,7 @@ export default {
         this.tableData = res.data.dataModelList
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 弹出层关闭事件 */

+ 14 - 26
chuanyi_client2/src/views/group_item/index.vue

@@ -205,14 +205,14 @@
 import {
   batchSetExpresses,
   deleteItemByIdList,
-  getAllDataModel, getAllReportTable,
+  getAllDataModel,
   getItemById,
   getItemGroupById,
   getItemValueById,
   updateItem
 } from "@/api/datasource";
-import {customCompare, showAlertWin, showLoading} from "@/utils/cqcy";
-import errorCode from "@/utils/errorCode";
+import {customCompare, showAlertWin, showConfirmWin, showLoading} from "@/utils/cqcy";
+import cqcyCode from "@/utils/cqcyCode";
 
 export default {
   name: "index",
@@ -324,7 +324,7 @@ export default {
         }
         this.itemDataListF = JSON.parse(JSON.stringify(list))
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
       let temp = setInterval(() => {
         getItemValueById(this.chooseGroup.id).then(res => {
@@ -372,7 +372,7 @@ export default {
         this.itemDataListF = JSON.parse(JSON.stringify(this.itemDataList))
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 查询所有数据模型 */
@@ -394,7 +394,7 @@ export default {
       }).catch((e) => {
         loading.close()
         if (callback) callback(false)
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 编辑 */
@@ -402,7 +402,7 @@ export default {
       let _this = this
       if (!row || !row.id) {
         _this.$message({
-          message: errorCode[201],
+          message: cqcyCode[201],
           type: 'warning'
         })
         return
@@ -423,7 +423,7 @@ export default {
           })
         }).catch((e) => {
           loading.close()
-          showAlertWin(_this, e)
+          showAlertWin(_this, null, e)
         })
         // let params = {
         //   'page': 1,
@@ -495,7 +495,7 @@ export default {
         this.getGroupById(this.chooseGroupId)
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 删除数据项 */
@@ -519,26 +519,20 @@ export default {
         this.getGroupById(this.chooseGroupId)
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 删除 */
     handleClickByDel(row) {
       if (!row || !row.id) {
         this.$message({
-          message: errorCode[201],
+          message: cqcyCode[201],
           type: 'warning'
         })
         return
       }
-      this.$confirm('您确定要删除该数据项吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除该数据项吗?', () => {
         this.delItems([row.id])
-      }).catch(() => {
       })
     },
     /** 多选事件 */
@@ -587,7 +581,7 @@ export default {
         this.getGroupById(this.chooseGroupId)
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 批量删除组数据中数据项 */
@@ -599,15 +593,9 @@ export default {
         })
         return
       }
-      this.$confirm('您确定要删除已选择数据项吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除已选择数据项吗?', () => {
         let ids = Array.from(this.selectionItems, ({ id }) => id)
         this.delItems(ids)
-      }).catch(() => {
       })
     },
     /** 弹出层关闭事件 */

+ 10 - 18
chuanyi_client2/src/views/login.vue

@@ -87,10 +87,10 @@
 </template>
 
 <script>
-import errorCode from '@/utils/errorCode'
+import cqcyCode from '@/utils/cqcyCode'
 import {getCode} from '@/api/user'
 import {Message} from 'element-ui'
-import {showAlertWin, showLoading, testHost} from '@/utils/cqcy'
+import {showAlertWin, showLoading, showPromptWin, testHost} from '@/utils/cqcy'
 
 export default {
   name: "Login",
@@ -203,7 +203,7 @@ export default {
         if (callback) callback(true)
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
         if (callback) callback(false)
       })
     },
@@ -228,7 +228,7 @@ export default {
           localStorage.setItem('REQ_IP', _this.loginForm.ip)
           localStorage.setItem('REQ_PORT', _this.loginForm.port)
           let h = _this.loginForm.ip + ':' + _this.loginForm.port
-          localStorage.setItem('SYS_HOST', errorCode['protocol'] + h)
+          localStorage.setItem('SYS_HOST', cqcyCode['protocol'] + h)
           localStorage.setItem('SYS_HOST_BASE', h)
           if (_this.loginForm.rememberMe) {
             localStorage.setItem('J_USER_NAME', _this.loginForm.username)
@@ -240,7 +240,7 @@ export default {
           if (!_this.loginForm.publicKey) {
             _this.getCode((result) => {
               if (!result) {
-                const msg = errorCode[900];
+                const msg = cqcyCode[900];
                 Message.error(msg)
                 return
               }
@@ -259,7 +259,7 @@ export default {
         this.$router.push({path: this.redirect || '/', query: {}})
         this.loading = false
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
         this.loading = false
         if (this.captchaEnabled) {
           this.getCode()
@@ -269,18 +269,11 @@ export default {
     /** 设置服务端请求地址 */
     editHostEvent() {
       let sysHost = localStorage.getItem('SYS_HOST')
-      this.$prompt('请输入服务端地址', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValue: sysHost,
-        inputValidator: (val) => {
-          if (!testHost(val)) {
-            return '请输入合法的地址信息'
-          }
+      showPromptWin(this, null, '请输入服务端地址', sysHost, (val) => {
+        if (!testHost(val)) {
+          return '请输入合法的地址信息'
         }
-      }).then(({value}) => {
+      }, (value) => {
         localStorage.setItem('SYS_HOST', value)
         // localStorage.setItem('SYS_HOST_BASE', value)
         this.$message({
@@ -290,7 +283,6 @@ export default {
         setTimeout(() => {
           window.location.reload()
         }, 500)
-      }).catch(() => {
       })
     }
   }

+ 43 - 69
chuanyi_client2/src/views/my_report/index.vue

@@ -352,7 +352,7 @@
         width="80%"
         top="10vh"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="dialogHistoryReportVisible"
         :before-close="dialogClose"
         :visible.sync="dialogHistoryReportVisible"
@@ -432,7 +432,13 @@
 
 <script>
 import BreadcrumbView from '@/components/BreadcrumbView'
-import {customCompare, getLuckysheetConfig, getNowFormatDate, showAlertWin, showLoading} from '@/utils/cqcy'
+import {
+  customCompare,
+  getLuckysheetConfig,
+  getNowFormatDate,
+  showAlertWin, showConfirmWin,
+  showLoading, showPromptWin
+} from '@/utils/cqcy'
 import {
   delReportTableById,
   getAllDataModel, getAllOkReportTable,
@@ -744,7 +750,7 @@ export default {
         this.loadReport()
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     resetRadioVal() {
@@ -766,7 +772,7 @@ export default {
           this.cronVal = res.data.cron
           this.analysisCron()
         }).catch((e) => {
-          showAlertWin(this, e)
+          showAlertWin(this, null, e)
         })
         return
       }
@@ -780,7 +786,7 @@ export default {
         this.loadReport()
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 新增报表 */
@@ -820,7 +826,7 @@ export default {
             })
           }).catch((e) => {
             loading.close()
-            showAlertWin(this, e)
+            showAlertWin(this, null, e)
           })
         }
       })
@@ -845,7 +851,7 @@ export default {
         this.dialogReportTemplateVisible = false
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 绘制 Excel 表 */
@@ -882,7 +888,7 @@ export default {
         if (callback) callback(res.data)
       }).catch((e) => {
         if (callback) callback([])
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 获取表格数据 */
@@ -895,7 +901,7 @@ export default {
         if (callback) callback(res.data)
       }).catch((e) => {
         if (callback) callback([])
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 向 Excel 插入表格 */
@@ -1088,7 +1094,7 @@ export default {
         this.reportTemplateList = res.data.tableTemplateList
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 查询所有数据模型 */
@@ -1103,7 +1109,7 @@ export default {
         }
         this.dataModelList = res.data.dataModelList
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 查询我的报表列表 */
@@ -1129,7 +1135,7 @@ export default {
         this.reportDataList = res.data.reportTableList
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 设置用户组信息 */
@@ -1156,7 +1162,7 @@ export default {
           }
         })
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     chooseUserGroupEvent() {
@@ -1187,7 +1193,7 @@ export default {
         this.dialogClose()
         this.loadReport()
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 处理自动报表数据信息 */
@@ -1270,7 +1276,7 @@ export default {
         this.setLuckysheetStatus(luckyData, true, type)
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 设置工作表状态 */
@@ -1374,21 +1380,14 @@ export default {
     },
     /** 修改报表信息 */
     editReportItem(data) {
-      this.$prompt('请输入报表名称', '修改报表名称', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        inputValue: data.reportTableName,
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValidator: (val) => {
-          if (!val || !val.trim()) {
-            return '报表名称不能为空'
-          }
-          if (val.length > 20) {
-            return '报表名称必须在20字以内'
-          }
+      showPromptWin(this, '修改报表名称', '请输入报表名称', data.reportTableName, (val) => {
+        if (!val || !val.trim()) {
+          return '报表名称不能为空'
+        }
+        if (val.length > 20) {
+          return '报表名称必须在20字以内'
         }
-      }).then(({value}) => {
+      }, (value) => {
         const loading = showLoading(this, '修改中,请稍候···')
         let params = {
           'id': data.id,
@@ -1408,18 +1407,11 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch((e) => {
-        console.log(e)
       })
     },
     /** 报表移除 */
     removeReportItem(data, type) {
-      this.$confirm('您确定要删除该报表吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除该报表吗?', () => {
         const loading = showLoading(this, '删除中,请稍候···')
         delReportTableById(data.id).then(res => {
           loading.close()
@@ -1441,7 +1433,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch(() => {
       })
     },
     /** 获取单元格大小 */
@@ -1579,20 +1570,14 @@ export default {
     },
     /** 保存报表信息 */
     saveReportInfo() {
-      this.$prompt('请输入报表名称', '保存', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValidator: (val) => {
-          if (!val) {
-            return '报表名称不能为空'
-          }
-          if (val.length > 20) {
-            return '报表名称必须在20字以内'
-          }
+      showPromptWin(this, '保存', '请输入报表名称', '', (val) => {
+        if (!val) {
+          return '报表名称不能为空'
         }
-      }).then(({value}) => {
+        if (val.length > 20) {
+          return '报表名称必须在20字以内'
+        }
+      }, (value) => {
         if (!this.chooseReportTemplate) {
           this.$message({
             message: '请重新选择报表模板',
@@ -1625,8 +1610,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch((e) => {
-        console.log(e)
       })
     },
     /** 更新报表信息 */
@@ -1639,21 +1622,14 @@ export default {
         })
         return
       }
-      this.$prompt('请输入报表名称', '保存', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValue: this.chooseMyReport.reportTableName,
-        inputValidator: (val) => {
-          if (!val) {
-            return '报表名称不能为空'
-          }
-          if (val.length > 20) {
-            return '报表名称必须在20字以内'
-          }
+      showPromptWin(this, '保存', '请输入报表名称', this.chooseMyReport.reportTableName, (val) => {
+        if (!val) {
+          return '报表名称不能为空'
+        }
+        if (val.length > 20) {
+          return '报表名称必须在20字以内'
         }
-      }).then(({value}) => {
+      }, (value) => {
         const loading = showLoading(this, '保存中,请稍候···')
         let _data = JSON.parse(getLuckysheetConfig())
         let _data2 = JSON.parse(this.chooseMyReport.reportTableData)
@@ -1679,8 +1655,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch((e) => {
-        console.log(e)
       })
     },
     /** 报表下载 */

+ 34 - 51
chuanyi_client2/src/views/my_report/index_block.vue

@@ -278,7 +278,13 @@
 
 <script>
 import BreadcrumbView from '@/components/BreadcrumbView'
-import {getNowFormatDate, showAlertWin, showLoading} from '@/utils/cqcy'
+import {
+  getNowFormatDate,
+  showAlertWin,
+  showConfirmWin,
+  showLoading,
+  showPromptWin
+} from '@/utils/cqcy'
 import {
   delReportTableById,
   getAllDataModel, getAllOkReportTable,
@@ -568,7 +574,7 @@ export default {
         this.loadReport()
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     resetRadioVal() {
@@ -590,7 +596,7 @@ export default {
           this.cronVal = res.data.cron
           this.analysisCron()
         }).catch((e) => {
-          showAlertWin(this, e)
+          showAlertWin(this, null, e)
         })
         return
       }
@@ -604,7 +610,7 @@ export default {
         this.loadReport()
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 新增报表 */
@@ -644,7 +650,7 @@ export default {
             })
           }).catch((e) => {
             loading.close()
-            showAlertWin(this, e)
+            showAlertWin(this, null, e)
           })
         }
       })
@@ -669,7 +675,7 @@ export default {
         this.dialogReportTemplateVisible = false
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 绘制 Excel 表 */
@@ -706,7 +712,7 @@ export default {
         if (callback) callback(res.data)
       }).catch((e) => {
         if (callback) callback([])
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 获取表格数据 */
@@ -719,7 +725,7 @@ export default {
         if (callback) callback(res.data)
       }).catch((e) => {
         if (callback) callback([])
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 向 Excel 插入表格 */
@@ -900,7 +906,7 @@ export default {
         this.reportTemplateList = res.data.tableTemplateList
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 查询所有数据模型 */
@@ -915,7 +921,7 @@ export default {
         }
         this.dataModelList = res.data.dataModelList
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 查询我的报表列表 */
@@ -941,7 +947,7 @@ export default {
         this.reportDataList = res.data.reportTableList
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 设置用户组信息 */
@@ -968,7 +974,7 @@ export default {
           }
         })
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     chooseUserGroupEvent() {
@@ -999,7 +1005,7 @@ export default {
         this.dialogClose()
         this.loadReport()
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 处理自动报表数据信息 */
@@ -1137,21 +1143,14 @@ export default {
     },
     /** 修改报表信息 */
     editReportItem(data) {
-      this.$prompt('请输入报表名称', '修改报表名称', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        inputValue: data.reportTableName,
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValidator: (val) => {
-          if (!val || !val.trim()) {
-            return '报表名称不能为空'
-          }
-          if (val.length > 20) {
-            return '报表名称必须在20字以内'
-          }
+      showPromptWin(this, '修改报表名称', '请输入报表名称', data.reportTableName, (val) => {
+        if (!val || !val.trim()) {
+          return '报表名称不能为空'
+        }
+        if (val.length > 20) {
+          return '报表名称必须在20字以内'
         }
-      }).then(({value}) => {
+      }, (value) => {
         const loading = showLoading(this, '修改中,请稍候···')
         let params = {
           'id': data.id,
@@ -1171,18 +1170,11 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch((e) => {
-        console.log(e)
       })
     },
     /** 报表移除 */
     removeReportItem(data) {
-      this.$confirm('您确定要删除该报表吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除该报表吗?', () => {
         const loading = showLoading(this, '删除中,请稍候···')
         delReportTableById(data.id).then(res => {
           loading.close()
@@ -1199,7 +1191,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch(() => {
       })
     },
     /** 获取单元格大小 */
@@ -1338,20 +1329,14 @@ export default {
     },
     /** 保存报表信息 */
     saveReportInfo() {
-      this.$prompt('请输入报表名称', '保存', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValidator: (val) => {
-          if (!val) {
-            return '报表名称不能为空'
-          }
-          if (val.length > 20) {
-            return '报表名称必须在20字以内'
-          }
+      showPromptWin(this, '保存', '请输入报表名称', '', (val) => {
+        if (!val) {
+          return '报表名称不能为空'
         }
-      }).then(({value}) => {
+        if (val.length > 20) {
+          return '报表名称必须在20字以内'
+        }
+      }, (value) => {
         if (!this.chooseReportTemplate) {
           this.$message({
             message: '请重新选择报表模板',
@@ -1384,8 +1369,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch((e) => {
-        console.log(e)
       })
     },
     /** 报表下载 */

+ 29 - 29
chuanyi_client2/src/views/report_template/index.vue

@@ -129,7 +129,7 @@
         width="600px"
         top="10vh"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="dialogDataItemVisible"
         :before-close="dialogItemClose"
         :visible.sync="dialogDataItemVisible"
@@ -227,7 +227,7 @@
         title="选择模板报表"
         width="60vw"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="dialogCommReportVisible"
         :before-close="dialogClose"
         :visible.sync="dialogCommReportVisible"
@@ -291,7 +291,7 @@
         width="80%"
         top="10vh"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="dialogGroupItemVisible"
         :before-close="dialogClose"
         :visible.sync="dialogGroupItemVisible"
@@ -389,7 +389,14 @@ import {
   saveReportTemplate,
   updateReportTemplate
 } from "@/api/datasource";
-import {getLuckysheetConfig, handleTree, showAlertWin, showLoading, traverseNode, traverseVisible} from "@/utils/cqcy";
+import {
+  getLuckysheetConfig,
+  handleTree,
+  showAlertWin,
+  showLoading, showPromptWin,
+  traverseNode,
+  traverseVisible
+} from "@/utils/cqcy";
 import {getDictByKey} from "@/api/basic";
 import {exportExcel} from "@/utils/export";
 import {insertLuckysheetEChart} from "@/utils/luckysheettool";
@@ -681,21 +688,14 @@ export default {
         this.templateName = '副本_' + _templateName
         _title = '另存为'
       }
-      this.$prompt('请输入/确认报表模板名称', _title, {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValue: this.templateName,
-        inputValidator: (val) => {
-          if (!val) {
-            return '模板名称不能为空'
-          }
-          if (val.length > 20) {
-            return '模板名称必须在20字以内'
-          }
+      showPromptWin(this, _title, '请输入/确认报表模板名称', this.templateName, (val) => {
+        if (!val) {
+          return '模板名称不能为空'
+        }
+        if (val.length > 20) {
+          return '模板名称必须在20字以内'
         }
-      }).then(({ value }) => {
+      }, (value) => {
         const loading = showLoading(this, '保存中,请稍候···')
         let option = JSON.parse(JSON.stringify(this.luckysheetOption))
         let _data = JSON.parse(getLuckysheetConfig())
@@ -729,7 +729,7 @@ export default {
           }).catch((e) => {
             loading.close()
             this.templateName = _templateName
-            showAlertWin(this, e)
+            showAlertWin(this, null, e)
           })
         } else {
           saveReportTemplate(data).then(res => {
@@ -745,10 +745,10 @@ export default {
           }).catch((e) => {
             loading.close()
             this.templateName = _templateName
-            showAlertWin(this, e)
+            showAlertWin(this, null, e)
           })
         }
-      }).catch(() => {
+      }, () => {
         this.templateName = _templateName
       })
     },
@@ -910,7 +910,7 @@ export default {
       getAllItemGroup().then(res => {
         this.dataGroupList = res.data
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 选择数据源值改变事件 */
@@ -956,7 +956,7 @@ export default {
         this.dialogDataItemVisible = true
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 选择的数据项:第一步 */
@@ -1030,7 +1030,7 @@ export default {
         }
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 选择数据模型 */
@@ -1079,7 +1079,7 @@ export default {
         this.dialogCommReportVisible = true
         this.handleReportTypeChange([-1])
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     clickCascader() {
@@ -1140,7 +1140,7 @@ export default {
         }
         this.commTemplateList = res.data
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 选择模板报表 */
@@ -1179,7 +1179,7 @@ export default {
         luckysheet.create(option)
       }).catch((e) => {
         loading.close()
-        showAlertWin(_this, e)
+        showAlertWin(_this, null, e)
       })
     },
     /** 数据项 */
@@ -1216,7 +1216,7 @@ export default {
         this.dialogBaseDataVisible = true
         this.baseDataList = res.data
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 基础数据项插入 */
@@ -1571,7 +1571,7 @@ export default {
         }
         luckysheet.create(option)
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 数据值显示类型事件 */

+ 30 - 56
chuanyi_client2/src/views/run_config/index.vue

@@ -412,7 +412,7 @@
         width="80%"
         top="10vh"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="dialogHistoryReportVisible"
         :before-close="dialogClose"
         :visible.sync="dialogHistoryReportVisible"
@@ -525,7 +525,13 @@
 
 <script>
 import BreadcrumbView from '@/components/BreadcrumbView'
-import {customCompare, getLuckysheetConfig, getNowFormatDate, showAlertWin, showLoading} from '@/utils/cqcy'
+import {
+  customCompare,
+  getLuckysheetConfig,
+  getNowFormatDate,
+  showAlertWin, showConfirmWin,
+  showLoading, showPromptWin
+} from '@/utils/cqcy'
 import {
   delReportTableById,
   getAllDataModel,
@@ -1623,21 +1629,14 @@ export default {
     },
     /** 修改报表信息 */
     editReportItem(data) {
-      this.$prompt('请输入报表名称', '修改报表名称', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        inputValue: data.reportTableName,
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValidator: (val) => {
-          if (!val || !val.trim()) {
-            return '报表名称不能为空'
-          }
-          if (val.length > 20) {
-            return '报表名称必须在20字以内'
-          }
+      showPromptWin(this, '修改报表名称', '请输入报表名称', data.reportTableName, (val) => {
+        if (!val || !val.trim()) {
+          return '报表名称不能为空'
         }
-      }).then(({value}) => {
+        if (val.length > 20) {
+          return '报表名称必须在20字以内'
+        }
+      }, (value) => {
         const loading = showLoading(this, '修改中,请稍候···')
         let params = {
           'id': data.id,
@@ -1657,18 +1656,11 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch((e) => {
-        console.log(e)
       })
     },
     /** 报表移除 */
     removeReportItem(data, type) {
-      this.$confirm('您确定要删除该报表吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除该报表吗?', () => {
         const loading = showLoading(this, '删除中,请稍候···')
         delReportTableById(data.id).then(res => {
           loading.close()
@@ -1690,7 +1682,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch(() => {
       })
     },
     /** 获取单元格大小 */
@@ -1832,20 +1823,14 @@ export default {
     },
     /** 保存报表信息 */
     saveReportInfo() {
-      this.$prompt('请输入报表名称', '保存', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValidator: (val) => {
-          if (!val) {
-            return '报表名称不能为空'
-          }
-          if (val.length > 20) {
-            return '报表名称必须在20字以内'
-          }
+      showPromptWin(this, '保存', '请输入报表名称', '', (val) => {
+        if (!val) {
+          return '报表名称不能为空'
+        }
+        if (val.length > 20) {
+          return '报表名称必须在20字以内'
         }
-      }).then(({value}) => {
+      }, (value) => {
         if (!this.chooseReportTemplate) {
           this.$message({
             message: '请重新选择报表模板',
@@ -1886,8 +1871,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch((e) => {
-        console.log(e)
       })
     },
     /** 更新报表信息 */
@@ -1900,21 +1883,14 @@ export default {
         })
         return
       }
-      this.$prompt('请输入报表名称', '保存', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false,
-        inputValue: this.chooseMyReport.reportTableName,
-        inputValidator: (val) => {
-          if (!val) {
-            return '报表名称不能为空'
-          }
-          if (val.length > 20) {
-            return '报表名称必须在20字以内'
-          }
+      showPromptWin(this, '保存', '请输入报表名称', this.chooseMyReport.reportTableName, (val) => {
+        if (!val) {
+          return '报表名称不能为空'
+        }
+        if (val.length > 20) {
+          return '报表名称必须在20字以内'
         }
-      }).then(({value}) => {
+      }, (value) => {
         const loading = showLoading(this, '保存中,请稍候···')
         let _data2 = JSON.parse(this.chooseMyReport.reportTableData)
         let excelTable = _data2.tables
@@ -1946,8 +1922,6 @@ export default {
           loading.close()
           showAlertWin(this, e)
         })
-      }).catch((e) => {
-        console.log(e)
       })
     },
     /** 报表下载 */

+ 3 - 3
chuanyi_client2/src/views/run_config/index_group.vue

@@ -104,7 +104,7 @@ export default {
         this.groupDataList = res.data
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 根据ID查询组信息 */
@@ -125,7 +125,7 @@ export default {
         this.itemDataList = res.data.itemList
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 修改数据状态 */
@@ -162,7 +162,7 @@ export default {
         })
       }).catch((e) => {
         loading.close()
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 运行事件 */

+ 10 - 16
chuanyi_client2/src/views/user_group/index.vue

@@ -68,7 +68,7 @@
         width="80%"
         top="10vh"
         center
-        v-dialog-drag
+        v-dialog-drag-and-zoom
         v-if="dialogDepartmentTree"
         :before-close="handleDeptCancel"
         :visible.sync="dialogDepartmentTree"
@@ -104,7 +104,7 @@
 
 <script>
 import BreadcrumbView from '@/components/BreadcrumbView'
-import {customCompare, showAlertWin, showLoading} from "@/utils/cqcy";
+import {customCompare, showAlertWin, showConfirmWin, showLoading} from "@/utils/cqcy";
 import {
   addUserGroup,
   delUserGroupById,
@@ -194,17 +194,12 @@ export default {
         this.dialogAddUserGroup = true
       }).catch((e) => {
         this.dialogAddUserGroup = true
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 删除 */
     handleDelete(index, row) {
-      this.$confirm('您确定要删除该用户组吗?', '温馨提示', {
-        confirmButtonText: '确定',
-        cancelButtonText: '取消',
-        customClass: 'close_confirm',
-        closeOnClickModal: false
-      }).then(() => {
+      showConfirmWin(this, null, '您确定要删除该用户组吗?', () => {
         const loading = showLoading(this, '删除中,请稍候···')
         delUserGroupById(row.id).then(res => {
           loading.close()
@@ -215,9 +210,8 @@ export default {
           this.getAllUserGroup()
         }).catch((e) => {
           loading.close()
-          showAlertWin(this, e)
+          showAlertWin(this, null, e)
         })
-      }).catch(() => {
       })
     },
     /** 修改选择用户信息 */
@@ -264,7 +258,7 @@ export default {
           this.updateChooseUserInfo(userIdList[i], true)
         }
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 选择用户事件 */
@@ -285,7 +279,7 @@ export default {
         }
         this.departments = res.data
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 获取用户组 */
@@ -298,7 +292,7 @@ export default {
           this.groupDataList = res.data
         })
       }).catch((e) => {
-        showAlertWin(this, e)
+        showAlertWin(this, null, e)
       })
     },
     /** 添加用户组 */
@@ -319,7 +313,7 @@ export default {
               this.getAllUserGroup()
             }).catch((e) => {
               loading.close()
-              showAlertWin(this, e)
+              showAlertWin(this, null, e)
             })
             return
           }
@@ -334,7 +328,7 @@ export default {
             this.getAllUserGroup()
           }).catch((e) => {
             loading.close()
-            showAlertWin(this, e)
+            showAlertWin(this, null, e)
           })
         }
       })