{"remainingRequest":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/view_calendarview.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/view_calendarview.vue","mtime":1725957645730},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["\n\nimport activity from \"@/components/activity.vue\";\nimport Watermark from '@/assets/js/watermark'; //路径不要写错\nexport default {\n name: \"view-calendarview\",\n props: [\n \"view\",\n \"openParams\",\n \"showtype\",\n ],\n inject: ['addTab'],\n components: {\n activity,\n },\n watch: {\n \n },\n computed: {\n \n },\n created(){\n let weekView = JSON.parse(JSON.stringify(this.view.columns));\n weekView.forEach((el,i) => {\n if(el.hiddenColumn) {\n weekView.splice(i,1);\n i--;\n }\n });\n this.weekView = weekView;\n },\n\n mounted() {\n if(this.showtype === 'home') {\n this.currentActive = 3;\n let date = new Date();\n let startDate = new Date(date.getFullYear(), date.getMonth(), 1);\n let endDate = new Date(date.getFullYear(), date.getMonth() + 1, 0);\n this.monthFirstDay = this.writeCurrentDate(\"\", startDate);\n this.monthLastDay = this.writeCurrentDate(\"\", endDate);\n let ym = this.monthFirstDay.split(\"-\");\n this.currentDate = ym[0] + \"-\" + ym[1];\n let periodColumn = '';\n let columns = this.view.columns;\n let showItemValue = [];\n columns.map((item)=>{\n if(item.showMoon){\n showItemValue.push(item.name);\n }\n })\n for(let i=0; i {\n // this.documents = res.data.data.data;\n let documents = res.data.data.data;\n if(documents && documents.length > 0) {\n documents.forEach(el => {\n // formField: \"DateField\"\n el.showItemValue = showItemValue;\n for(let key in el.items){\n if(el.items[key].formField === \"DateField\") {\n if(el.items[key].value) {\n el.items[key].showValue = el.items[key].value;\n el.items[key].value = el.items[key].value.split(\" \")[0];\n }\n }\n }\n });\n }\n this.documents = documents;\n this.$emit('totalCount' , '', 'calendarview')\n this.getDateList(null);\n //以下判断是否显示更多按钮\n this.$nextTick(()=>{\n this.MonthViewUpdateNode();\n })\n }\n }\n );\n }else {\n let showMode = this.view.defaultShowMode;\n if(showMode == 'month') {\n this.showView(3)\n }else if(showMode == \"week\"){\n this.showView(2)\n }else {\n this.getData();\n }\n }\n },\n\n data: function() {\n return {\n tableData:[],\n tableShowLists: [],\n documents:'',\n currentActive:1,\n checkedAll:[],\n dayNumber: 1,\n currentDate:'',\n showViewList:false,\n currentWeek:0,\n addWeekNum:'',\n startTime:'',\n endTime:'',\n oneWeekArray:[],\n viewColumns:[],\n weekArray:[],\n periodColumn:'',\n currentDocIds:[],\n loading: true,\n emptyData:'',\n \n //以下是周视图的变量\n currentYear: 1970, // 年份\n currentMonth: 1, // 月份\n currentDay: 1, // 日期\n currentWeeks: 1, // 星期\n days: [],\n\n //以下是月视图的变量\n weekDays: [this.$t('date.sun'),this.$t('date.mon'),this.$t('date.tues'),this.$t('date.wed'),this.$t('date.thur'),this.$t('date.fri'),this.$t('date.sat')],\n weeks:[this.$t('date.sunday'),this.$t('date.monday'),this.$t('date.tuesday'),this.$t('date.wednesday'),this.$t('date.thursday'),this.$t('date.friday'),this.$t('date.saturday'),],\n year:new Date().getFullYear(),\n month:new Date().getMonth()+1,\n date:new Date().getDate(),\n dateList:[],\n monthFirstDay:'',\n monthLastDay:'',\n // monthRow: [0,1,2,3,4,5,6],\n monthRow: [0,1,2,3,4,5,6],\n monthDateList:[],\n tdMontnViewWidth:0, //月视图的每个表格宽度\n weekView:[], //周视图所用视图列,因为有隐藏列原本的view在周视图使用不能隐藏\n haveWatermark:false,\n };\n },\n\n methods: {\n /**\n * 截取年月日进行比较\n */\n filtersMonthView: function(value) {\n let val = value.split(\" \")\n return val[0]\n },\n reloadListView(){\n let startTime, endTime, date;\n let currentDate = this.currentDate;\n if(this.currentDate.indexOf(\"~\") > -1) {\n date = this.currentDate.split(\"~\");\n startTime = date[0] + ' 00:00';\n endTime = date[1] + ' 24:00';\n }else {\n date = this.currentDate.split(\"-\");\n if(date.length == 2) {\n startTime = this.monthFirstDay + ' 00:00';\n endTime = this.monthLastDay + ' 24:00';\n }else {\n startTime = currentDate + ' 00:00';\n endTime = currentDate + ' 24:00';\n }\n }\n let columns = this.view.columns;\n let showItemValue = [];\n columns.map((item)=>{\n if(item.showMoon){\n showItemValue.push(item.name);\n }\n })\n let showMode = this.view.defaultShowMode;\n if(showMode == 'month') {\n this.showView(3)\n }else if(showMode == \"week\"){\n this.showView(2)\n }else {\n this.getData('', '', '', startTime, endTime,showItemValue);\n }\n },\n\n seeDateMore(date){\n let params = {\n actionContent: this.view.id,\n name: this.view.name,\n linkType: '01',\n clickDate: date,\n appId: this.openParams.appId,\n };\n this.$emit(\"event\", 'view', params);\n },\n \n seeMore(date){\n this.$api.getViewData(\n //普通视图接口\n this.openParams.appId,\n this.view.id,\n {\n parentId: this.parentId ? this.parentId : \"\",\n currpage: 1,\n lines: 10,\n searchWord:'',\n startDate: date + ' 00:00',\n endDate: date + ' 24:00',\n },\n {},\n {\n onSucess: res => {\n let docs = res.data.data.data;\n this.row_count = res.data.row_count;\n let tds = [];\n if (docs)\n docs.forEach(doc => {\n let rows = {};\n rows.formId = doc.formId;\n rows.docId = doc.id;\n for (var key in doc.items) {\n let items = doc.items[key];\n rows[key] = items.value;\n }\n if(doc.isSum) {\n rows.isSum = doc.isSum;\n }\n tds.push(rows);\n });\n this.tableData = tds;\n this.currentActive = 1;\n this.loading = false;\n }\n }\n );\n },\n\n onActionChild(act){\n //his.$parent.onAction(act);\n //绑定视图的处理事件\n switch (act.type) {\n case 1: //载入视图\n this.$parent.onAction(act);\n break;\n case 2: //创建\n this.$parent.onAction(act);\n break;\n case 3: //删除\n this.doRemove(act);\n break;\n default:\n break;\n }\n },\n\n //是否删除的弹窗提示\n doRemove(act) {\n let docIds = this.currentDocIds;\n if(docIds && docIds.length > 0) {\n this.$confirm(this.$t('msg.del_or_not')+`${docIds.length}`+this.$t('msg.data'), this.$t('tip'), {\n confirmButtonText: this.$t('btns.sure'),\n cancelButtonText: this.$t('btns.cancel'),\n type: 'warning'\n }).then(() => {\n this.runBeforeAction(act, docIds);\n }).catch(() => {\n \n });\n }else {\n this.$confirm(this.$t('msg.select_atLeastOne'), this.$t('tip'), {\n confirmButtonText: this.$t('btns.sure'),\n cancelButtonText: this.$t('btns.cancel'),\n type: 'warning'\n }).then(() => {\n \n }).catch(() => {\n \n });\n }\n },\n\n regReplace(value){\n if(value){\n return value.replace(/%/g, \"%\")\n }\n },\n //删除视图\n removeDocuments(act,docIds) {\n this.$api.batchRemoveDocuments(this.openParams.appId, docIds, {\n onSucess: (res) => {\n if(res.data.errcode == 0) {\n this.$notify({\n title:this.$t('success'),\n message:'',\n type: 'success'\n\n })\n this.runAfterAction(act)\n this.includeReload();\n }\n }\n });\n },\n\n includeReload () { //重新刷新组件刷新\n this.$parent.updateView();\n },\n\n //执行脚本前\n runBeforeAction(act, docIds){\n let formData = {\n docId: \"\",\n document: {},\n formId: this.view.relatedForm,\n parentId: \"\",\n templateForm: this.view.templateForm,\n viewId: this.openParams.actionContent,\n _selects: docIds && docIds.length>0 ? docIds : [],\n }\n let divId = act.id;\n let actType = act.type;\n this.$api.runBeforeActionScript(\n this.openParams.appId, \n divId, \n formData, \n actType,\n '', //treedocid\n '', //flowType\n {\n onSucess: response => {\n if(response.data.errcode == 0 && response.data.data) {\n let errcode = response.data.errcode;\n let errmsg = response.data.data.content;\n this.$notify.error({\n title: errmsg,\n message: ''\n });\n }else if(response.data.errcode == 0){\n if(act.type == 3) { //删除数据\n this.removeDocuments(act,docIds); \n }\n }\n }\n });\n },\n\n //执行脚本后\n runAfterAction(act, docIds) {\n let formData = {\n docId: \"\",\n document: {},\n formId: this.view.relatedForm,\n parentId: \"\",\n templateForm: \"\",\n viewId: this.openParams.actionContent,\n _selects: docIds && docIds.length>0 ? docIds : [],\n }\n let appId = this.openParams.appId;\n let divId = act.id;\n let docId = '';\n let parentId = '';\n let _templateForm = '';\n let _ = '';\n this.$api.runAfterActionScript(\n appId,\n divId,\n docId,\n this.openParams.actionContent,\n this.view.relatedForm,\n _templateForm,\n parentId,\n _,\n formData,\n act.type,\n '', //treedocid\n {\n onSucess: response => {\n if(response.data.errcode == 0) {\n if(response.data.data.content) {\n let errmsg = response.data.data.content.content;\n this.$notify({\n title: errmsg,\n message: '',\n type: 'warning'\n });\n }\n }\n }\n }\n );\n },\n\n onClick() {\n if(this.currentActive == 3) { //如果当前是月视图重新从当前月开始\n this.year = new Date().getFullYear();\n this.month = new Date().getMonth()+1;\n }\n if(this.showViewList) {\n this.showViewList = false;\n // this.getData();\n this.showView(this.currentActive);\n }else {\n let startTime = \"1900-01-01 00:00\",\n endTime = \"2099-12-31 00:00\";\n this.showViewList = true;\n this.getShowListData('', '', '', startTime, endTime);\n }\n \n },\n\n writeCurrentDate(val, paramTime){\n let day = ''\n if(val == \"NEXT\") {\n day = new Date();\n day.setTime(day.getTime()+24*60*60*1000*this.dayNumber);\n }else if(val == \"PREV\"){\n let str = this.currentDate;\n str = str.replace(/-/g,'/');\n day = new Date(str);\n day.setTime(day.getTime()-24*60*60*1000);\n }else if(val == \"WEEK\") {\n day = new Date(paramTime);\n }else {\n day = new Date(paramTime);\n }\n let year = day.getFullYear()\n let Month = day.getMonth() + 1;\n let Day = day.getDate();\n Month = Month >= 10 ? Month: \"0\"+Month;\n Day = Day >= 10 ? Day: \"0\" + Day;\n let s = year +\"-\" + Month + \"-\" + Day;\n return s;\n \n },\n\n //下一个时间\n nextTime(currentActive) {\n if(currentActive === 1) { //日视图\n this.currentDate = this.writeCurrentDate(\"NEXT\");\n this.dayNumber++;\n let startTime = this.currentDate + \" 00:00\";\n let endTime = this.currentDate + \" 24:00\";\n this.getData('', '', '', startTime, endTime); \n }else if (currentActive === 2) { //周视图\n const d = this.oneWeekArray[6];\n d.setDate(d.getDate() + 8);\n let days = this.initData(d);\n this.nextWeekData(days);\n }else if(currentActive === 3) {\n this.month++;\n if(this.month==13){\n this.month=1;\n this.year++;\n }\n let isNextOrPre = true;\n this.getDateList(isNextOrPre);\n \n }\n },\n\n //上一个时间\n prevTime(currentActive) {\n if(currentActive == 1) {\n this.currentDate = this.writeCurrentDate(\"PREV\");\n this.dayNumber--;\n let startTime = this.currentDate + \" 00:00\";\n let endTime = this.currentDate + \" 24:00\";\n this.getData('', '', '', startTime, endTime); \n }else if (currentActive == 2) {\n const d = this.oneWeekArray[0]; // 如果当期日期是7号或者小于7号\n d.setDate(d.getDate() - 6);\n let days = this.initData(d);\n this.nextWeekData(days);\n }else if(currentActive === 3) {\n this.month--;\n if(this.month==0){\n this.month=12;\n this.year--;\n }\n let isNextOrPre = true;\n this.getDateList(isNextOrPre);\n }\n },\n\n nextWeekData(days) {\n let saturday = days[0];\n let sunday = days[6]\n this.currentDate = saturday + \"~\" + sunday;\n saturday = encodeURI(saturday + ' 00:00');\n sunday = encodeURI(sunday + ' 24:00');\n let weeks = [];\n days.forEach((el,index) => {\n let obj = {};\n switch(index) {\n case 0: \n obj.value = el;\n obj.name = this.$t('date.sunday');\n weeks.push(obj);\n break;\n case 1: \n obj.value = el;\n obj.name = this.$t('date.mon');\n weeks.push(obj);\n break;\n case 2: \n obj.value = el;\n obj.name = this.$t('date.tues');\n weeks.push(obj);\n break;\n case 3: \n obj.value = el;\n obj.name = this.$t('date.wed');\n weeks.push(obj);\n break;\n case 4: \n obj.value = el;\n obj.name = this.$t('date.thur');\n weeks.push(obj);\n break;\n case 5: \n obj.value = el;\n obj.name = this.$t('date.fri');\n weeks.push(obj);\n break;\n case 6: \n obj.value = el;\n obj.name = this.$t('date.sat');\n weeks.push(obj);\n break;\n default:\n break;\n }\n });\n let periodColumn = '';\n let columns = this.view.columns;\n let showItemValue = [];\n columns.map((item)=>{\n if(item.showMoon){\n showItemValue.push(item.name);\n }\n })\n for(let i=0; i {\n let documents = res.data.data.data;\n if(documents && documents.length > 0) {\n documents.forEach(el => {\n // formField: \"DateField\"\n el.showItemValue = showItemValue;\n for(let key in el.items){\n if(el.items[key].formField === \"DateField\") {\n if(el.items[key].value) {\n el.items[key].showValue = el.items[key].value;\n el.items[key].value = el.items[key].value.split(\" \")[0];\n }\n }\n }\n });\n }\n this.documents = documents;\n }\n }\n );\n },\n\n //日周月视图切换\n showView(val) {\n if(val == 1) { //日视图\n this.currentActive = val;\n this.getCurrentDate();\n this.getData();\n }else if(val ==2) { //周视图\n this.currentActive = val;\n let days = this.initData(null);\n this.nextWeekData(days);\n }else if(val == 3) { //月视图\n this.tdMontnViewWidth = parseInt((this.$refs.calendarView.clientWidth-20) / 7) || 166;\n this.currentActive = val;\n let date = new Date();\n let startDate = new Date(date.getFullYear(), date.getMonth(), 1);\n let endDate = new Date(date.getFullYear(), date.getMonth() + 1, 0);\n this.monthFirstDay = this.writeCurrentDate(\"\", startDate);\n this.monthLastDay = this.writeCurrentDate(\"\", endDate);\n let ym = this.monthFirstDay.split(\"-\");\n this.currentDate = ym[0] + \"-\" + ym[1];\n let periodColumn = '';\n let columns = this.view.columns;\n let showItemValue = [];\n columns.map((item)=>{\n if(item.showMoon){\n showItemValue.push(item.name);\n }\n })\n for(let i=0; i {\n let documents = res.data.data.data;\n if(documents && documents.length > 0) {\n documents.forEach(el => {\n // formField: \"DateField\"\n el.showItemValue = showItemValue;\n for(let key in el.items){\n if(el.items[key].formField === \"DateField\") {\n if(el.items[key].value) {\n el.items[key].showValue = el.items[key].value;\n // el.items[key].value = el.items[key].value.split(\" \")[0];\n }\n }\n }\n });\n }\n let viewList = this.view.columns;\n viewList.forEach(column => {\n documents.forEach(tr => {\n for(let key in tr.items){\n if(tr.items[key].formField != \"DateField\") {\n tr.items[key].showTitle = tr.items[key].value;\n if(column.formatType=='number') {\n if(column.type=='COLUMN_TYPE_FIELD'){\n if(column.displayType == '00') {\n tr.items[key].value = this.toFixed(tr.items[key].value,column.decimalsNum);\n }else if(column.displayType == '01'){\n tr.items[key].value = this.toFixed(tr.items[key].value,column.decimalsNum).substr(0,column.displayLength);\n }\n }else if(column.type=='COLUMN_TYPE_SCRIPT') {\n // v-html=\"toFixed(tr.items[column.id].value,column.decimalsNum)\"\n }\n }else if(column.formatType=='currency'){\n if(column.type=='COLUMN_TYPE_FIELD') {\n if(column.displayType == '00') {\n tr.items[key].value = tr.items[key].isSum?tr.items[key].value:this.currencyChange(tr.items[key].value, column.decimalsCurr,column.currType)\n }else if(column.displayType == '01') {\n tr.items[key].value = this.currencyChange(tr.items[key].value, column.decimalsCurr,column.currType).substr(0,column.displayLength)\n }\n }else if(column.type=='COLUMN_TYPE_SCRIPT'){\n\n }\n }else if(column.formatType=='simple') {\n if(column.type=='COLUMN_TYPE_FIELD'){\n if(column.displayType == '00') {\n if(column.showIcon) {\n\n }else {\n\n }\n }else if(column.displayType == '01') {\n let val = tr.items[key].value.substr(0,column.displayLength) + (tr.items[key].value.length>column.displayLength?'...':'');\n tr.items[key].value = val\n }\n \n }else if(column.type=='COLUMN_TYPE_LOGO'){\n\n }else if(column.type=='COLUMN_TYPE_OPERATE'){\n \n }else if(column.type=='COLUMN_TYPE_SCRIPT'){\n \n }else if(column.type=='COLUMN_TYPE_ROWNUM'){\n \n }\n }else {\n if(column.type=='COLUMN_TYPE_FIELD'){\n if(column.displayType == '00') {\n\n }else if(column.displayType == '01') {\n let val = tr.items[key].value.substr(0,column.displayLength) + (tr.items[key].value.length>column.displayLength?'...':'');\n tr.items[key].value = val;\n }\n }else if(column.type=='COLUMN_TYPE_SCRIPT') {\n\n }\n }\n }\n }\n });\n });\n this.documents = documents;\n this.getDateList(null);\n if(this.view.waterMarkText) { //判断是否显示水印\n if(!this.haveWatermark) {\n let val = this.view.waterMarkText;\n let id = 'view_' + this.view.id;\n Watermark.set(val, id);\n this.haveWatermark = true;\n }\n }\n //以下判断是否显示更多按钮\n this.$nextTick(()=>{\n for(let i=0; i 3) {\n let app2 = document.getElementById('date-monthdatamore-view'+ i + j);\n app2.style.display = 'block';\n }else {\n let app2 = document.getElementById('date-monthdatamore-view'+ i + j);\n app2.style.display = 'none';\n }\n }\n }\n }\n }\n }\n })\n \n }\n }\n );\n }\n },\n\n //月视图获取月列表\n getDateList(isNextOrPre){\n this.dateList=[];\n let month = this.month,\n year = this.year,\n firstDay = this.getFirstDay(year,month), //当前月\n daysLength = this.getDaysLength(year,month),\n dateList=this.dateList,\n that=this;\n let preMonth = month-1,\n preYear = year,\n nextMonth = month+1,\n nextYear = year;\n if(preMonth == 0){\n preMonth = 12;\n preYear--;\n }\n if(nextMonth == 13){\n nextMonth = 1;\n nextYear++;\n }\n for(var i=0;i<42;i++){\n if(i < firstDay){\n dateList.push({\n date: preYear + '-' + (preMonth>9?preMonth:'0'+preMonth) + '-' + (that.getDaysLength(preYear,preMonth)+(i-firstDay+1)),\n type: 'prev'\n })\n }else if(i < (firstDay+daysLength)){\n dateList.push({\n date: year + '-' + (month>9?month:'0'+month) + '-' + (i-(firstDay)+1>9?i-(firstDay)+1:'0'+(i-(firstDay)+1)),\n type:'now'\n })\n }else{\n dateList.push({\n date: nextYear + '-' + (nextMonth>9?nextMonth:'0'+nextMonth) + '-' + (i-(firstDay+daysLength)+1>9?i-(firstDay+daysLength)+1:'0'+(i-(firstDay+daysLength)+1)),\n type:'next'\n })\n }\n }\n // console.log(\"this.dateList--->\",this.dateList);\n let allArr = [];\n for(let i=0; i<7; i++) {\n let arr = [];\n switch(i) {\n case 0:\n arr = this.dateList.slice(0,7);\n allArr.push(arr);\n break;\n case 1:\n arr = this.dateList.slice(7,14);\n allArr.push(arr);\n break;\n case 2:\n arr = this.dateList.slice(14,21);\n allArr.push(arr);\n break;\n case 3:\n arr = this.dateList.slice(21,28);\n allArr.push(arr);\n break;\n case 4:\n arr = this.dateList.slice(28,35);\n allArr.push(arr);\n break;\n case 5:\n arr = this.dateList.slice(35,42);\n allArr.push(arr);\n break;\n default:\n break\n }\n\n }\n this.monthDateList = allArr;\n // console.log(\"this.monthDateList--->\",this.monthDateList);\n if(isNextOrPre) {\n let ym = (year + \"-\" + (month>9?month:'0' + month));\n let newMonth=parseInt(new Date(ym).getMonth())+1; //获取当前时间的月\n let newYear=parseInt(new Date(ym).getFullYear()); //获取当前时间的年\n let startDate = new Date(newYear,newMonth-1,1); //获取当前月的第一天\n let endDate = new Date(newYear,newMonth,0); //获取当前月的最后一天\n this.monthFirstDay = this.writeCurrentDate(\"\", startDate);\n this.monthLastDay = this.writeCurrentDate(\"\", endDate);\n let YM = this.monthFirstDay.split(\"-\");\n this.currentDate = YM[0] + \"-\" + YM[1];\n this.$api.getViewData(\n //普通视图接口\n this.openParams.appId,\n this.view.id,\n {\n parentId: this.parentId ? this.parentId : \"\",\n currpage: this.currentPage,\n lines: 10,\n searchWord:'',\n startDate: this.monthFirstDay + ' 00:00',\n endDate: this.monthLastDay + ' 24:00',\n },\n {},\n {\n onSucess: res => {\n let columns = this.view.columns;\n let showItemValue = [];\n columns.map((item)=>{\n if(item.showMoon){\n showItemValue.push(item.name);\n }\n })\n let documents = res.data.data.data;\n if(documents && documents.length > 0) {\n documents.forEach(el => {\n el.showItemValue = showItemValue;\n for(let key in el.items){\n if(el.items[key].formField === \"DateField\") {\n if(el.items[key].value) {\n el.items[key].showValue = el.items[key].value;\n el.items[key].value = el.items[key].value.split(\" \")[0];\n }\n }\n }\n });\n }\n let viewList = this.view.columns;\n viewList.forEach(column => {\n documents.forEach(tr => {\n for(let key in tr.items){\n if(tr.items[key].formField != \"DateField\") {\n tr.items[key].showTitle = tr.items[key].value;\n if(column.formatType=='number') {\n if(column.type=='COLUMN_TYPE_FIELD'){\n if(column.displayType == '00') {\n tr.items[key].value = this.toFixed(tr.items[key].value,column.decimalsNum);\n }else if(column.displayType == '01'){\n tr.items[key].value = this.toFixed(tr.items[key].value,column.decimalsNum).substr(0,column.displayLength);\n }\n }else if(column.type=='COLUMN_TYPE_SCRIPT') {\n // v-html=\"toFixed(tr.items[column.id].value,column.decimalsNum)\"\n }\n }else if(column.formatType=='currency'){\n if(column.type=='COLUMN_TYPE_FIELD') {\n if(column.displayType == '00') {\n tr.items[key].value = tr.items[key].isSum?tr.items[key].value:this.currencyChange(tr.items[key].value, column.decimalsCurr,column.currType)\n }else if(column.displayType == '01') {\n tr.items[key].value = this.currencyChange(tr.items[key].value, column.decimalsCurr,column.currType).substr(0,column.displayLength)\n }\n }else if(column.type=='COLUMN_TYPE_SCRIPT'){\n\n }\n }else if(column.formatType=='simple') {\n if(column.type=='COLUMN_TYPE_FIELD'){\n if(column.displayType == '00') {\n if(column.showIcon) {\n \n }else {\n // tr.items[key].value = val;\n \n }\n }else if(column.displayType == '01') {\n let val = tr.items[key].value.substr(0,column.displayLength) + (tr.items[key].value.length>column.displayLength?'...':'');\n tr.items[key].value = val\n }\n \n }else if(column.type=='COLUMN_TYPE_LOGO'){\n\n }else if(column.type=='COLUMN_TYPE_OPERATE'){\n \n }else if(column.type=='COLUMN_TYPE_SCRIPT'){\n \n }else if(column.type=='COLUMN_TYPE_ROWNUM'){\n \n }\n }else {\n if(column.type=='COLUMN_TYPE_FIELD'){\n if(column.displayType == '00') {\n\n }else if(column.displayType == '01') {\n let val = tr.items[key].value.substr(0,column.displayLength) + (tr.items[key].value.length>column.displayLength?'...':'');\n tr.items[key].value = val;\n }\n }else if(column.type=='COLUMN_TYPE_SCRIPT') {\n\n }\n }\n }\n }\n });\n });\n this.documents = documents; \n if(this.view.waterMarkText) { //判断是否显示水印\n if(!this.haveWatermark) {\n let val = this.view.waterMarkText;\n let id = 'view_' + this.view.id;\n Watermark.set(val, id);\n this.haveWatermark = true;\n }\n }\n //以下判断是否显示更多按钮\n this.$nextTick(()=>{\n for(let i=0; i 3) {\n let app2 = document.getElementById('date-monthdatamore-view'+ i + j);\n app2.style.display = 'block';\n }else {\n let app2 = document.getElementById('date-monthdatamore-view'+ i + j);\n app2.style.display = 'none';\n }\n }\n }\n }\n }\n }\n })\n \n }\n }\n );\n }\n \n    },\n\n //月视图获取当月第一天是周几\n getFirstDay(year,month){\n let that=this;\n return new Date(year+'-'+month+'-1').getDay();\n },\n\n //月视图获取月天数\n getDaysLength(year,month){\n var d = new Date(year, month, 0);\n return d.getDate();\n },\n\n formatDate (year, month, day) {\n const y = year\n let m = month\n if (m < 10) m = `0${m}`\n let d = day\n if (d < 10) d = `0${d}`\n return `${y}-${m}-${d}`\n },\n\n initData (cur) {\n this.oneWeekArray = [];\n let date = ''\n if (cur) {\n date = new Date(cur)\n } else {\n date = new Date()\n }\n this.currentDay = date.getDate() // 今日日期 几号\n this.currentYear = date.getFullYear() // 当前年份\n this.currentMonth = date.getMonth() + 1 // 当前月份\n this.currentWeeks = date.getDay() // 1...6,0 // 星期几\n if (this.currentWeeks === 0) {\n this.currentWeeks = 7\n }\n const str = this.formatDate(this.currentYear, this.currentMonth, this.currentDay)// 今日日期 年-月-日\n this.days.length = 0;\n this.days = [];\n for (let i = this.currentWeeks; i > 0; i -= 1) {\n const d = new Date(str)\n d.setDate(d.getDate() - i)\n this.oneWeekArray.push(d);\n let day = this.formatDate(d.getFullYear(), d.getMonth() + 1, d.getDate());\n this.days.push(day)\n }\n for (let i = 0; i <= 7 - this.currentWeeks - 1; i += 1) {\n const d = new Date(str)\n d.setDate(d.getDate() + i)\n this.oneWeekArray.push(d);\n let day = this.formatDate(d.getFullYear(), d.getMonth() + 1, d.getDate());\n this.days.push(day)\n }\n return this.days;\n },\n\n onRowClick(row) {\n let view = this.view\n let op = this.openParams\n if (!view.readonly) {\n let formId\n if (view.templateForm) {\n //判断是模板表单还是数据源表单\n formId = view.templateForm\n } else {\n formId = row.formId\n }\n let params = {\n linkType: \"00\",\n appId: op.appId,\n actionContent: formId, //row.formId,\n _select: row.id?row.id:row.docId,\n viewId: view.id,\n parentId: op.parentId ? op.parentId : \"\", //包含元素时判断是否有parentId\n isRelate: op.isRelate ? op.isRelate : \"\", //包含元素时判断isRelate是否为true\n searchData: this.searchData, \n showtype: this.showtype,\n templateForm: view.templateForm ? view.templateForm : \"\",\n refreshId: op.id, //判断是否得刷新\n };\n if(this.includeDisplayType) {\n params.includeDisplayType = this.includeDisplayType\n }\n this.$api.hasPermissionToForm(op.appId, formId, {\n onSucess: (response) => {\n if (response.data.data) {\n if (this.isView) {\n let arr = []\n arr.push(row)\n let isRadio = true\n this.$emit(\"updateViewData\", params, arr, isRadio)\n } else if (this.view.openType == 1 && !this.isView) { //1为当前页打开\n if (this.showtype == \"include\") {\n this.currentPageParams = params\n this.$refs.multipleTable.toggleRowExpansion(row)\n } else if (this.showtype == \"tab\") {\n params.name = view.name\n this.addTab(params)\n // this.currentPageParams = params;\n // this.$refs.multipleTable.toggleRowExpansion(row);\n }else if (this.showtype == \"target\") {\n let routeData = this.$router.resolve({\n // name: \"form_blank\",\n name: 'open',\n query: params,\n });\n window.open(routeData.href, \"_blank\");\n } else {\n params.name = view.name\n this.$emit(\"add-tab\", params)//打开普通视图\n }\n } else if (view.openType == 277 && !this.isView) { //277为弹窗打开\n if (this.showtype == \"include\") {\n this.$parent.openForm(params)\n } else {\n params.type = 277\n this.$parent.openForm(params)\n }\n } else if (view.openType == 288 && !this.isView) {\n this.$refs.dialog.show(params)\n }\n } else {\n this.$message({\n message: this.$t('msg.refuse'),\n type: \"warning\",\n })\n }\n },\n });\n }\n },\n\n arraySpanMethod({ row, column, rowIndex, columnIndex }) {\n if(row && row.isInclude && columnIndex == 1) {\n let len = this.view.columns.length; \n return [1,len];\n }\n },\n\n handleSelectionChange(val) {\n let docIds = [];\n let hasChildren = \"\";\n if (val.length > 0) {\n for (let i = 0; i < val.length; i++) {\n docIds.push(val[i].docId);\n }\n } else {\n docIds = [];\n }\n this.currentDocIds = docIds;\n console.log(\"docIds--->\",docIds);\n },\n\n getShowListData(page, size, searchData, startTime, endTime,) {\n this.getViewData(page, size,searchData, startTime, endTime).then(response => {\n let docs = response.data.data;\n let documents = response.data.data;\n if(documents && documents.length > 0) {\n documents.forEach(el => {\n for(let key in el.items){\n if(el.items[key].formField === \"DateField\") {\n if(el.items[key].value) {\n el.items[key].showValue = el.items[key].value;\n el.items[key].value = el.items[key].value.split(\" \")[0];\n }\n }\n }\n });\n }\n this.documents = documents;\n this.row_count = response.data.row_count;\n let tds = [];\n if (docs) {\n docs.forEach(doc => {\n let rows = {};\n rows.formId = doc.formId;\n rows.docId = doc.id;\n for (var key in doc.items) {\n let items = doc.items[key];\n if(items.formField == \"DateField\"){\n rows[key] = items.showValue;\n }else {\n rows[key] = items.value;\n }\n }\n if(doc.isSum) {\n rows.isSum = doc.isSum;\n }\n tds.push(rows);\n });\n if(tds.length == 0){\n this.emptyData = this.$t('nodata')\n }\n this.loading = false;\n this.tableShowLists = tds;\n }\n });\n },\n\n //设置分页大小\n handleSizeChange(ev) {\n this.currentPageSize = ev;\n let page = 1;\n this.getData(page, this.currentPageSize, this.searchExcelData);\n },\n \n onPageChang(ev) {\n let page = ev\n let filterInfo = this.filterInformations\n this.getData(page, this.currentPageSize, this.searchExcelData,'', filterInfo);\n //this.$refs.searchform.onSearchClick();\n },\n \n getData(page, size, searchData, startTime, endTime,showItemValue) {\n this.getViewData(page, size,searchData, startTime, endTime).then(response => {\n let docs = response.data.data;\n let documents = response.data.data;\n if(documents && documents.length > 0) {\n documents.forEach(el => {\n // formField: \"DateField\"\n el.showItemValue = showItemValue;\n for(let key in el.items){\n if(el.items[key].formField === \"DateField\") {\n if(el.items[key].value) {\n el.items[key].showValue = el.items[key].value;\n el.items[key].value = el.items[key].value.split(\" \")[0];\n }\n }\n }\n });\n }\n this.documents = documents;\n this.row_count = response.data.row_count;\n let tds = [];\n if (docs) {\n docs.forEach(doc => {\n let rows = {};\n rows.formId = doc.formId;\n rows.docId = doc.id;\n for (var key in doc.items) {\n let items = doc.items[key];\n if(items.formField == \"DateField\"){\n rows[key] = items.showValue;\n }else {\n rows[key] = items.value;\n }\n }\n if(doc.isSum) {\n rows.isSum = doc.isSum;\n }\n tds.push(rows);\n });\n if(tds.length == 0){\n this.emptyData = this.$t('nodata')\n }\n this.loading = false;\n this.tableData = tds;\n }\n\n if(this.view.waterMarkText) { //判断是否显示水印\n if(!this.haveWatermark) {\n let val = this.view.waterMarkText;\n let id = 'view_' + this.view.id;\n Watermark.set(val, id);\n this.haveWatermark = true;\n }\n }\n // let showMode = this.view.defaultShowMode;\n // if(showMode == 'month') {\n // this.showView(3)\n // }else if(showMode == \"week\"){\n // this.showView(2)\n // }\n });\n },\n \n getCurrentDate() {\n // \n let routerDate = this.openParams.clickDate;\n let day = routerDate ? new Date(routerDate) : new Date();\n day.setTime(day.getTime());\n let year = day.getFullYear()\n let Month = day.getMonth() + 1;\n let Day = day.getDate();\n Month = Month >= 10 ? Month: \"0\"+Month;\n Day = Day >= 10 ? Day: \"0\" + Day;\n let s = year +\"-\" + Month + \"-\" + Day;\n this.currentDate = s;\n let obj = {\n startDate: s + \" 00:00\",\n endDate: s + \" 24:00\"\n }\n return obj;\n },\n\n //模拟数据请求\n getViewData(page, size, searchData, startTime, endTime) {\n let startDate = startTime?startTime:this.getCurrentDate().startDate;\n let endDate = endTime?endTime:this.getCurrentDate().endDate;\n let treeData = \"\";\n let treeName = \"\";\n return new Promise(resolve => {\n this.$api.getViewData(\n //普通视图接口\n this.openParams.appId,\n this.view.id,\n {\n parentId: this.parentId ? this.parentId : \"\",\n currpage: page?page:this.currentPage,\n lines: 10,\n searchWord:'',\n startDate:startDate,\n endDate:endDate,\n },\n searchData?searchData:{},\n {\n onSucess: response => {\n let viewData = response.data;\n console.log(\"viewData-------->\",viewData)\n resolve(viewData);\n }\n }\n );\n });\n },\n\n //月视图每个时间点获取是否有数据,有就显示\n MonthViewUpdateNode() {\n if(this.monthRow && this.monthRow.length > 0) { \n for(let i=0; i 0) {\n for(let j=0; j 0) {\n for(let z=0; z\") >= 0) {\n total = total + 1;\n }\n }\n }\n if(total > 0) {\n let app2 = document.getElementById('date-monthdatamore'+ i + j);\n app2.style.color = '#fff';\n app2.style.display = 'block';\n app2.innerText = total\n }else {\n let app2 = document.getElementById('date-monthdatamore'+ i + j);\n app2.style.color = '#fff';\n app2.style.display = 'none';\n app2.innerText = ''\n }\n }\n }\n }\n } \n },\n\n //视图列设置默认图标显示\n setDefaultIcon(value, isLogo){\n let path = '';\n if(isLogo) {\n path = this.setDefaultPath() + '/uploads/lib/icon/' + value;\n }else {\n if(value[0]) {\n path = this.setDefaultPath() + '/uploads/lib/icon/' + value[0].value;\n }\n }\n return path;\n },\n viewFieldPath(value, field) {\n if (value && field == \"ImageUploadField\") {\n return obpmConfig.obpmFilePath + value.path;\n } else if (value && field == \"AttachmentUploadField\") {\n let arr = JSON.parse(value);\n return arr;\n }\n },\n /**\n 点击文件直接预览\n */\n handleFileClick(flie){\n let flieType = flie.name.substring(flie.name.lastIndexOf(\".\")).toLowerCase();\n const imgType = this.isImgType(flieType);\n if(imgType){\n this.isShowImg = true;\n this.addHtml = '';\n }else{\n this.handlePreview(flie)\n }\n },\n\n downloadFile(file){ //列表文件下载\n let link = document.createElement('a')\n link.style.display = 'none'\n link.href = obpmConfig.obpmFilePath + \n \"/runtime/file/download?filename=\"+ file.name +\n \"&filepath=\" + file.path;\n link.setAttribute('download', file.name);\n link.click();\n },\n handlePreview(file) {\n\t\t\tthis.$api.getenvironment(\n\t\t\t\t{\n\t\t\t\t\tonSucess: res => {\n\t\t\t\t\t\tif(res.data.errcode === 0) {\n\t\t\t\t\t\t\tif(res.data.data === true) {\n\t\t\t\t\t\t\t\tlet realName = file.path.split(\"/\")[file.path.split(\"/\").length - 1];\n\t\t\t\t\t\t\t\tlet isEdit = 'edit';\n\t\t\t\t\t\t\t\tlet waterMark = '';\n\t\t\t\t\t\t\t\tlet openWaterMark = false;\n\t\t\t\t\t\t\t\tlet curEditUserId = this.$store.state.myProfile.id;\n\t\t\t\t\t\t\t\tlet userName = this.$store.state.myProfile.name;\n\t\t\t\t\t\t\t\tlet showTrackRevisions = false;\n\t\t\t\t\t\t\t\tlet selectEditPlug = 'tray';\n\t\t\t\t\t\t\t\tlet cp = obpmConfig.obpmFilePath;\n sessionStorage.setItem(\"obpmContextPath\", cp);\n let statiContextPath = obpmConfig.statiContextPath;\n let pdfPath = \"\";\n if(statiContextPath) { //5.0 trunk\n pdfPath = obpmConfig.statiContextPath;\n }else { //4.4 stable\n pdfPath = cp;\n }\n\t\t\t\t\t\t\t\tlet url = pdfPath + '/portal/vue/pdf/pdfviewer.html?action=' + isEdit + \n\t\t\t\t\t\t\t\t\t\t\"&path=\" + file.path + \n\t\t\t\t\t\t\t\t\t\t\"&name=\" + realName + \n\t\t\t\t\t\t\t\t\t\t\"&showName=\" + file.name + \n\t\t\t\t\t\t\t\t\t\t\"&waterMark=\" + waterMark + \n\t\t\t\t\t\t\t\t\t\t\"&openWaterMark=\" + openWaterMark +\n\t\t\t\t\t\t\t\t\t\t\"&curEditUserId=\" + curEditUserId +\n\t\t\t\t\t\t\t\t\t\t\"&userName=\" + userName + \n\t\t\t\t\t\t\t\t\t\t\"&showTrackRevisions=\" + showTrackRevisions +\n\t\t\t\t\t\t\t\t\t\t\"&selectEditPlug=\" + selectEditPlug;\n\t\t\t\t\t\t\t\t\t\tlet URL = encodeURI(url)\n\t\t\t\t\t\t\t\t\t\twindow.open(URL);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t)\n\n\t\t},\n\n //视图列按钮操作\n buttonClick(\n column,\n row\n ) {\n let id = column.id,\n parentView = column.parentView,\n type = column.buttonType,\n name = column.name,\n docId = row.docId,\n actionScript = column.actionScript,\n mappingform = column.mappingform,\n jumpMapping = column.jumpMapping;\n let params = \"\";\n let data = {\n actionScript,\n columnName: name,\n docId,\n };\n switch (type) {\n case \"00\":\n this.$api.beforescript(this.openParams.appId, parentView, id, data, {\n onSucess: (res) => {\n if (res.data.errcode == 0) {\n if(res.data.data) {\n let resData = res.data.data;\n if(!resData.type) {\n\n }else if(resData.type == 32) {\n this.$confirm(`${resData.content}`, this.$t('tip'), {\n confirmButtonText:this.$t('btns.sure'),\n cancelButtonText: this.$t('btns.cancel'),\n type: \"warning\",\n }).then(() => {\n let arr = [];\n arr.push(docId);\n this.$api.batchRemoveDocuments(this.openParams.appId, arr, {\n onSucess: (res) => {\n this.getData();\n },\n });\n }).catch(() => {});\n }\n }else {\n this.$confirm(this.$t('deldata'), this.$t('tip'), {\n confirmButtonText: this.$t('btn.sure'),\n cancelButtonText: this.$t('btn.cancle'),\n type: \"warning\",\n }).then(() => {\n let arr = [];\n arr.push(docId);\n this.$api.batchRemoveDocuments(this.openParams.appId, arr, {\n onSucess: (res) => {\n this.getData();\n },\n });\n }).catch(() => {});\n }\n }\n },\n });\n break;\n case \"01\":\n let isSubmissionProcess = true;\n this.$parent.viewColumnSubmission(isSubmissionProcess, docId);\n break;\n case \"02\":\n break;\n case \"03\":\n params = {\n linkType: \"00\",\n appId: this.openParams.appId,\n actionContent: mappingform?mappingform:column.templateForm,\n _select: docId,\n name,\n refreshId: this.openParams.id,\n };\n if(this.showtype === 'include' || this.showtype === 'tab') {\n this.toTab(params);\n }else {\n this.$emit(\"add-tab\", params);\n }\n break;\n case \"04\":\n this.$api.runActionScript(this.openParams.appId, parentView, id, data, {\n onSucess: (res) => {\n if (res.data.errcode == 0) {\n if(res.data.data) {\n let data = res.data.data;\n if(data.type == '1') {\n this.$message(data.content);\n }\n if(!data.type) {\n this.$message(data);\n }\n }else {\n this.$emit(\"updateView\");\n this.$message({\n showClose: true,\n message:this.$t('success'),\n type: \"success\",\n });\n }\n }\n },\n });\n break;\n case \"05\":\n let isEmpty = \"\";\n let emptyParams = \"\";\n let arr = [];\n if (jumpMapping) {\n let map = jumpMapping.split(\";\");\n if(map.length > 0) {\n for(let i=0; i 0) {\n emptyParams = arr;\n }\n params = {\n linkType: \"00\",\n appId: this.openParams.appId,\n active: true,\n actionContent: mappingform,\n name: this.view.name,\n refreshId: this.openParams.id,\n type: 277,\n };\n this.$parent.openForm(params, emptyParams);\n break;\n }\n },\n\n /*\n * 脚本,o-action\n */\n template(val) {\n return {\n methods: {\n calctextJump: this.calctextJump,\n },\n template: \"
\"+val+\"
\"\n };\n },\n\n /*number 需要保留小数的数\n fractionDigits 保留小数位数\n */\n toFixed(number, fractionDigits) {\n let times = Math.pow(10, fractionDigits);\n let roundNum = Math.round(number * times) / times;\n let currentVal = roundNum.toFixed(fractionDigits);\n if (fractionDigits == \"5\") {\n let num = (roundNum || 0).toString();\n let result = \"\";\n while (num.length > 3) {\n result = \",\" + num.slice(-3) + result;\n num = num.slice(0, num.length - 3);\n }\n if (result) {\n result = num + result + \".\" + currentVal.split(\".\")[1];\n return result;\n } else {\n return currentVal;\n }\n } else {\n return currentVal;\n }\n },\n /* number:要格式化的数字\n * decimals:保留几位小数 默认0位\n * currency:货币类型\n * decPoint:小数点符号 默认.\n * thousandsSep:千分位符号 默认为,\n */\n currencyChange(\n number,\n decimals,\n currency,\n decPoint = \".\",\n thousandsSep = \",\"\n ) {\n number = (number + \"\").replace(/[^0-9+-Ee.]/g, \"\");\n let n = !isFinite(+number) ? 0 : +number;\n let prec = !isFinite(+decimals) ? 0 : Math.abs(decimals);\n let sep = typeof thousandsSep === \"undefined\" ? \",\" : thousandsSep;\n let dec = typeof decPoint === \"undefined\" ? \".\" : decPoint;\n let s = \"\";\n let symbol;\n if (currency == \"zh_CN\") {\n symbol = \"¥\";\n } else if (currency == \"en_US\") {\n symbol = \"$\";\n } else if (currency == \"en_GB\") {\n symbol = \"£\";\n } else if (currency == \"ja_JP\") {\n symbol = \"¥\";\n } else {\n symbol = \"\";\n }\n let toFixedFix = function (n, prec) {\n let k = Math.pow(10, prec);\n return \"\" + Math.ceil(n * k) / k;\n };\n s = (prec ? toFixedFix(n, prec) : \"\" + Math.round(n)).split(\".\");\n let re = /(-?\\d+)(\\d{3})/;\n while (re.test(s[0])) {\n s[0] = s[0].replace(re, \"$1\" + sep + \"$2\");\n }\n if ((s[1] || \"\").length < prec) {\n s[1] = s[1] || \"\";\n s[1] += new Array(prec - s[1].length + 1).join(\"0\");\n }\n return symbol + s.join(dec);\n },\n\t\n },\n filters: {\n formDate: function(value) {\n let val = value.split(\"-\");\n return val[2];\n }\n }\n};\n",null]}