From e80dcecc39552e86f44720676d4037272e41c45b Mon Sep 17 00:00:00 2001 From: shijing Date: Fri, 15 Jul 2022 08:46:01 +0800 Subject: [PATCH 1/2] rparty --- src/api/model/common.js | 23 +- src/components/scSelect/userselect.vue | 43 +- src/components/scUpload/index.vue | 13 +- src/components/scWorkflow/nodes/branch.vue | 2 +- src/config/route.js | 9 + src/router/index.js | 17 +- src/utils/tool.js | 23 +- src/views/bigScreen/index.vue | 17 +- src/views/login/components/passwordForm.vue | 2 +- src/views/ops/files.vue | 71 +++ src/views/vm/visit.vue | 532 ++++++++++---------- src/views/wf/details.vue | 2 +- src/views/wf/visitdetail.vue | 4 +- src/views/wf/workflow.vue | 41 +- 14 files changed, 458 insertions(+), 341 deletions(-) create mode 100644 src/views/ops/files.vue diff --git a/src/api/model/common.js b/src/api/model/common.js index 61012f7d..1f036a7c 100644 --- a/src/api/model/common.js +++ b/src/api/model/common.js @@ -16,30 +16,9 @@ export default { return await http.post(this.url, data, config); } }, - exportFile: { - url: `${config.API_URL}/fileExport`, - name: "导出附件", - get: async function(data, config={}){ - return await http.get(this.url, data, config); - } - }, - importFile: { - url: `${config.API_URL}/fileImport`, - name: "导入附件", - post: async function(data, config={}){ - return await http.post(this.url, data, config); - } - }, file: { - menu: { - url: `${config.API_URL}/file/menu`, - name: "获取文件分类", - get: async function(){ - return await http.get(this.url); - } - }, list: { - url: `${config.API_URL}/file/list`, + url: `${config.API_URL}/file`, name: "获取文件列表", get: async function(params){ return await http.get(this.url, params); diff --git a/src/components/scSelect/userselect.vue b/src/components/scSelect/userselect.vue index ab905acc..4d4f2905 100644 --- a/src/components/scSelect/userselect.vue +++ b/src/components/scSelect/userselect.vue @@ -125,11 +125,6 @@ name: "employee", components: {}, props: { - value: { - // 接受外部v-model传入的值 - type: [String], - default: "", - }, user: { // 接受外部v-model传入的值 type: [String], @@ -163,8 +158,13 @@ this.getUser(); this.getDept(); this.getPost(); - - + debugger; + if(this.user===""){ + this.selection = []; + this.apiObj.map(item => { + this.$refs.table.toggleRowSelection(item, false) + }) + } }, watch: { filterText(val) { @@ -181,13 +181,25 @@ }, methods: { showDialog() { - this.dialoguser = true; - this.$nextTick(function () { - this.apiObj.map(item => { - if (item.id === this.user) { - this.$refs.table.toggleRowSelection(item, true) - } - }) + debugger; + let that = this; + that.dialoguser = true; + that.$nextTick(function () { + debugger; + if(that.user===""){ + that.selection = []; + that.apiObj.map(item => { + that.$refs.table.toggleRowSelection(item, false) + }) + }else{ + that.apiObj.map(item => { + debugger; + if (item.id === that.user) { + that.$refs.table.toggleRowSelection(item, true) + } + }) + } + }) }, @@ -240,16 +252,19 @@ }, //表格选择后回调事件 selectionChange(selection) { + debugger; if (selection.length > 1) { let del_row = selection.shift(); this.selection = selection[1]; this.$refs.userTable.toggleRowSelection(del_row, false); // 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中) }else{ + debugger; this.selection = selection; } }, submitfrom() { + debugger; if(this.selection.length===1){ let obj={id:this.selection[0].id,name:this.selection[0].name}; this.$emit("handlerSubmit", obj); diff --git a/src/components/scUpload/index.vue b/src/components/scUpload/index.vue index 6b93f843..ffe05c18 100644 --- a/src/components/scUpload/index.vue +++ b/src/components/scUpload/index.vue @@ -233,13 +233,12 @@ param.onProgress({percent: complete}) } }).then(res => { - config.parseData(res); - param.onSuccess(res) - // if(response.code == config.successCode){ - // param.onSuccess(res) - // }else{ - // param.onError(response.msg || "未知错误") - // } + var response = config.parseData(res); + if(response.code == config.successCode){ + param.onSuccess(res) + }else{ + param.onError(response.msg || "未知错误") + } }).catch(err => { param.onError(err) }) diff --git a/src/components/scWorkflow/nodes/branch.vue b/src/components/scWorkflow/nodes/branch.vue index 9da0b4aa..c6b05d6c 100644 --- a/src/components/scWorkflow/nodes/branch.vue +++ b/src/components/scWorkflow/nodes/branch.vue @@ -2,7 +2,7 @@
- 添加条件 +
diff --git a/src/config/route.js b/src/config/route.js index dba6a91c..24a9a49b 100644 --- a/src/config/route.js +++ b/src/config/route.js @@ -688,6 +688,15 @@ const routes = [ "icon": "el-icon-fold", }, "component": "ops/thirdLogs" + }, + { + "name": "files", + "path": "/ops/files", + "meta": { + "title": "文件日志", + "icon": "el-icon-fold", + }, + "component": "ops/files" }, ] }, diff --git a/src/router/index.js b/src/router/index.js index a7be01ee..ee0ec1cf 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -67,18 +67,21 @@ router.beforeEach(async (to, from, next) => { //加载动态/静态路由 if(!isGetRouter){ // let apiMenu = tool.data.get("MENU") || [] - let userInfo = tool.data.get("USER_INFO") + debugger; + let userInfo = tool.data.get("USER_INFO"); + let permissions = tool.data.get("PERMISSIONS"); let userMenu = treeFilter(userRoutes, node => { return node.meta.perms ? node.meta.perms.filter(item=>userInfo.perms.indexOf(item)>-1).length > 0 : true - }) + }); // let menu = [...userMenu, ...apiMenu] - var menuRouter = filterAsyncRouter(userMenu) - menuRouter = flatAsyncRoutes(menuRouter) + var menuRouter = filterAsyncRouter(userMenu); + menuRouter = flatAsyncRoutes(menuRouter); menuRouter.forEach(item => { router.addRoute("layout", item) - }) - routes_404_r = router.addRoute(routes_404) - if (to.matched.length == 0) { + }); + routes_404_r = router.addRoute(routes_404); + debugger; + if (to.matched.length ==0||permissions[0]==='superuser') { router.push(to.fullPath); } isGetRouter = true; diff --git a/src/utils/tool.js b/src/utils/tool.js index 8c027dbc..d8672e85 100644 --- a/src/utils/tool.js +++ b/src/utils/tool.js @@ -147,7 +147,7 @@ tool.objCopy = function (obj) { /* 日期格式化 */ tool.dateFormat = function (date, fmt='yyyy-MM-dd hh:mm:ss') { - date = new Date(date) + date = new Date(date); var o = { "M+" : date.getMonth()+1, //月份 "d+" : date.getDate(), //日 @@ -155,14 +155,21 @@ tool.dateFormat = function (date, fmt='yyyy-MM-dd hh:mm:ss') { "m+" : date.getMinutes(), //分 "s+" : date.getSeconds(), //秒 "q+" : Math.floor((date.getMonth()+3)/3), //季度 - "S" : date.getMilliseconds() //毫秒 + "S" : date.getMilliseconds(), //毫秒 + "W" : date.getDay(), //毫秒 }; - if(/(y+)/.test(fmt)) { - fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length)); - } - for(var k in o) { - if(new RegExp("("+ k +")").test(fmt)){ - fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); + var weeks = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"); + + if(fmt==='week'){ + fmt =weeks[o.w]; + }else{ + if(/(y+)/.test(fmt)) { + fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length)); + } + for(var k in o) { + if(new RegExp("("+ k +")").test(fmt)){ + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); + } } } return fmt; diff --git a/src/views/bigScreen/index.vue b/src/views/bigScreen/index.vue index edf98210..fd9a27cd 100644 --- a/src/views/bigScreen/index.vue +++ b/src/views/bigScreen/index.vue @@ -5,9 +5,9 @@
曲阳金隅智慧安全
- 2022-06-22 + {{ currentDay }} 周三下午 - 17:59:52 + {{ currentTime }}
@@ -831,6 +831,8 @@ LBType: '1', userMarker: {}, todayDate:'', + currentDay:'', + currentTime:'', } }, created() { @@ -841,7 +843,12 @@ }, mounted() { let date = new Date(); - this.todayDate = this.warningData.params.start_create = this.cateAggForm.start_create =date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate(); + this.timeNow = date.getDay(); + this.todayDate = this.warningData.params.start_create = this.cateAggForm.start_create =this.$TOOL.dateFormat(new Date(), 'yyyy-MM-dd'); + this.showTime(); + setInterval(()=>{ + this.showTime(); + },1000); window.map = new jsmap.JSMap({ mapType: jsmap.JSMapType.MAP_3D, container: 'mapContainer', @@ -1016,6 +1023,10 @@ setInterval(function () {}, 3000) }, methods: { + showTime(){ + this.currentTime = this.$TOOL.dateFormat(new Date(), 'hh:mm:ss'); + this.currentDay = this.$TOOL.dateFormat(new Date(), 'yyyy年MM月dd日') + }, getWarningTotal(){ let that = this; that.$API.ecm.event.cateAgg.req(that.cateAggForm).then(res=>{ diff --git a/src/views/login/components/passwordForm.vue b/src/views/login/components/passwordForm.vue index 48af8fc5..2e2dd9ce 100644 --- a/src/views/login/components/passwordForm.vue +++ b/src/views/login/components/passwordForm.vue @@ -159,7 +159,7 @@ export default { try { var res1 = await this.$API.auth.info.get(); this.$TOOL.data.set("USER_INFO", res1); - this.$TOOL.data.set("PERMISSIONS", res1.perms.keys()); + this.$TOOL.data.set("PERMISSIONS", Object.keys(res1.perms)); this.$router.replace({ path: "/", }); diff --git a/src/views/ops/files.vue b/src/views/ops/files.vue new file mode 100644 index 00000000..8d4487ff --- /dev/null +++ b/src/views/ops/files.vue @@ -0,0 +1,71 @@ + + + diff --git a/src/views/vm/visit.vue b/src/views/vm/visit.vue index 073fa35d..04799f78 100644 --- a/src/views/vm/visit.vue +++ b/src/views/vm/visit.vue @@ -1,260 +1,280 @@ - \ No newline at end of file + export default { + name: "visit", + components: { + saveDialog, + detialDialog + }, + data() { + return { + dialog: { + save: false, + permission: false, + }, + apiObj: this.$API.vm.visit.list, + query: {}, + selection: [], + search: { + keyword: null, + }, + + purpose_: { + 10: "参观", + 20: "拜访", + 30: "面试", + 40: "开会" + }, + state_: { + 10: "创建中", + 20: "审批中", + 30: "待入厂", + 40: "进行中", + 50: "已完成", + }, + act_states: { + 0: "草稿中",//p + 1: "进行中",//p + + 2: "被退回",//d + 3: "被撤回",//d + + 4: "已完成",//s + 5: "已关闭",//d + }, + }; + }, + methods: { + //添加 + add() { + this.dialog.save = true; + this.$nextTick(() => { + this.$refs.saveDialog.open("add"); + }); + }, + addpepple(row) { + this.$router.push({ + name: "vistoradd", + query: { + visitid: row.id, //访问项目id + }, + }); + }, + + + //查看 + table_show(row) { + this.dialog.save = true; + this.$nextTick(() => { + this.$refs.detialDialog.open("show").setData(row); + }); + }, + + //权限设置 + permission() { + this.dialog.permission = true; + this.$nextTick(() => { + this.$refs.permissionDialog.open(); + }); + }, + //删除 + table_del(row) { + this.$API.vm.visit.delete + .req(row.id) + .then((res) => { + this.$message.success("删除成功"); + + return res; + }) + .catch((err) => { + return err; + }); + + }, + + //表格选择后回调事件 + selectionChange(selection) { + this.selection = selection; + }, + + + //本地更新数据 + handleSaveSuccess(data, mode) { + if (mode == "add") { + this.$refs.table.refresh(); + } else if (mode == "edit") { + this.$refs.table.refresh(); + } + }, + resetQuery() { + this.query = {}; + }, + }, + }; + diff --git a/src/views/wf/details.vue b/src/views/wf/details.vue index 6f9c1661..356b0494 100644 --- a/src/views/wf/details.vue +++ b/src/views/wf/details.vue @@ -6,7 +6,7 @@ fit stripe style="width: 100%;" - height="500" + height="400" highlight-current-row > diff --git a/src/views/wf/visitdetail.vue b/src/views/wf/visitdetail.vue index 8355ed7d..dc264d1b 100644 --- a/src/views/wf/visitdetail.vue +++ b/src/views/wf/visitdetail.vue @@ -59,7 +59,7 @@ 转交
- {{item.name}} + {{item.name}}
@@ -72,7 +72,7 @@ - + diff --git a/src/views/wf/workflow.vue b/src/views/wf/workflow.vue index e6793c76..2cb362b1 100644 --- a/src/views/wf/workflow.vue +++ b/src/views/wf/workflow.vue @@ -17,6 +17,7 @@ +