{"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_gridview.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/view_gridview.vue","mtime":1725957645732},{"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":["\nimport form_searchform from \"@/components/form_searchform.vue\";\nimport activity from \"@/components/activity.vue\";\nimport mdialog from \"@/components/dialog.vue\";\nimport API from \"@/api.js\";\nimport Constant from \"@/Constant.js\";\nimport Watermark from \"@/assets/js/watermark\";\nimport isJSON from \"@/assets/js/isJSON.js\";\nexport default {\n name: \"view-gridview\",\n props: [\n \"openParams\",\n \"view\",\n \"showtype\",\n \"isIncludeViewRefresh\",\n \"isFormPrint\",\n \"fixationHeight\",\n \"includeDisplayType\",\n ],\n components: {\n form_searchform,\n activity,\n mdialog,\n },\n data: function () {\n return {\n Constant,\n rowdatas: {},\n status: {}, //存放编辑状态\n currentPage: 1,\n tableData: [],\n tableHeight:\n document.documentElement.clientHeight - 55 - 15 - 45 - 50 - 18 - 20 - 2, // 55: 按钮 15:padding 45:tabs(padding-top) 50: header 18:table的padding 20:padding-bottom 2: border\n row_count: 0,\n dataList: [],\n formdata: \"\",\n newBuild: \"\",\n currentFormData: [],\n selectDocId: [],\n allFormdata: [],\n newBuildDocId: [],\n isZomm: true,\n viewGridviewZomm: {\n position: \"fixed\",\n top: \"93px\",\n left: \"225px\",\n zIndex: \"2000\",\n backgroundColor: \"#fff\",\n },\n tdWidth: \"\",\n subDocuments: [],\n totalColumnWidth: \"\", //网格视图所有视图列都有设置列宽的总和\n activityBtns: [],\n };\n },\n computed: {\n pagesize() {\n return this.view.data ? this.view.data.page_lines : 0;\n },\n\n listenSaveSubDocments() {\n return this.$store.state.saveSubDocments;\n },\n\n },\n watch: {\n listenSaveSubDocments(newVal){ //如果是包含元素打开标签页,返回或者关闭页签时刷新视图\n let op = this.openParams;\n if(Object.values(newVal).length > 0 && newVal.docId === op.docId) {\n let subDoc = this.setSaveDoc() || []\n subDoc = JSON.parse(JSON.stringify(subDoc))\n if(subDoc && subDoc.length > 0) {\n this.$store.commit(\"SET_SUBDOCUMENTS_DATA\", {\n sourceDocId: op.docId,\n currentViewFormId: subDoc[0].formId,\n saveData: subDoc\n })\n }\n // if(afd && afd.length > 0) {\n // afd.forEach(item => {\n // let bfd = this.buildFormData(true, item.data)\n // formId = bfd.formId\n // let saveData = {\n // edit: true,\n // formId: bfd.formId,\n // id: bfd.id,\n // items: bfd.items\n // }\n // if(op.parentId) {\n // saveData.parentId = op.parentId\n // }\n // if(op.isRelate) {\n // saveData.isRelate = \"true\"\n // }\n // subDoc.push(saveData)\n // });\n // this.$store.commit(\"SET_SUBDOCUMENTS_DATA\", {\n // sourceDocId: op.docId,\n // currentViewFormId: formId,\n // saveData: subDoc\n // })\n // }\n }\n },\n },\n created() {\n let view = this.view;\n if (view.activities && view.activities.length > 0) {\n let arr = [];\n let iType = this.includeDisplayType;\n if (\n iType == Constant.PermissionType_READONLY ||\n iType == Constant.PermissionType_DISABLED\n ) {\n //只读状态下。某些按钮隐藏\n view.activities.forEach((el) => {\n if (\n el.type != 34\n ) {\n arr.push(el);\n }\n });\n this.activityBtns = arr;\n } else {\n this.activityBtns = view.activities;\n }\n }\n let columns = JSON.parse(JSON.stringify(view.columns));\n let count = 0; //网格视图有设置视图列宽度的个数\n for (let i = 0; i < columns.length; i++) {\n if (columns[i].width) {\n count = count + 1;\n }\n }\n if (count == columns.length) {\n //只有当网格所有的视图列的宽度都有设置宽度时totalColumnWidth才会有值\n this.totalColumnWidth = Number(this.totalColumnWidth);\n for (let x = 0; x < columns.length; x++) {\n this.totalColumnWidth =\n this.totalColumnWidth + Number(columns[x].width);\n }\n this.totalColumnWidth = this.totalColumnWidth + 100 + 50 + \"px\"; //100是操作的宽度,50是打勾的宽度\n }\n columns.forEach((el, i) => {\n if (el.hiddenColumn) {\n columns.splice(i, 1);\n i--;\n }\n });\n let activities = JSON.parse(JSON.stringify(view.activities));\n activities.forEach((el, i) => {\n if (el.type == 18) {\n activities.splice(i, 1);\n i--;\n }\n });\n this.view.columns = columns;\n this.view.activities = activities;\n // let id = \"delegate_\" + this.openParams.actionContent;\n let id = \"formTemplate_\" + this.openParams.docId;\n this.$nextTick(() => {\n let dom = document.getElementById(id);\n if (dom) {\n let totalWidth = dom.clientWidth - 40;\n let averageWidth = Math.floor(totalWidth / this.view.columns.length);\n this.tdWidth = averageWidth > 130 ? averageWidth : 130;\n }\n });\n },\n mounted() {\n this.getData();\n },\n updated() {//更新生命周期触发\n this.$refs.multipleTable&&this.$refs.multipleTable.doLayout() //重新刷新页面解决fix固定列问题\n },\n methods: {\n checkbox(row) {\n if (row.row.isSum) {\n //当前页小计\n return \"mycell isSum\";\n }\n if (row.row.isTotal) {\n //总计\n return \"mycell isTotal\";\n }\n },\n onRowClick(row) {\n if (!row.isTotal && !row.isSum) {\n this.doEdit(row, this.view.columns, row.index);\n }\n },\n //视图列类型-操作\n template(val) {\n return {\n methods: {\n // calctextJump: this.calctextJump,\n },\n template: \"
\" + val + \"
\",\n };\n },\n previewFile(item) {\n let url = obpmConfig.obpmFilePath + item.path;\n window.open(url);\n },\n\n downloadFile(file) {\n //列表文件下载\n // let link = document.createElement('a')\n // link.style.display = 'none'\n // link.href = this.obpmConfig.obpmFilePath +\n // \"/runtime/file/download?filename=\"+ file.name +\n // \"&filepath=\" + file.path;\n // link.setAttribute('download', file.name);\n // link.click();\n let link = document.createElement(\"a\");\n link.style.display = \"none\";\n\n let op = obpmConfig.obpmFilePath;\n let statiContextPath = obpmConfig.statiContextPath;\n if (statiContextPath) {\n //5.0 trunk\n op = obpmConfig.contextPath;\n }\n link.href =\n op +\n \"/runtime/file/download?filename=\" +\n file.name +\n \"&filepath=\" +\n file.path;\n link.setAttribute(\"download\", file.name);\n link.click();\n },\n\n handlePreview(file) {\n this.$api.getenvironment({\n onSucess: (res) => {\n if (res.data.errcode === 0) {\n if (res.data.data === true) {\n let realName =\n file.path.split(\"/\")[file.path.split(\"/\").length - 1];\n let isEdit = \"edit\";\n let waterMark = \"\";\n let openWaterMark = false;\n let curEditUserId = this.$store.state.myProfile.id;\n let userName = this.$store.state.myProfile.name;\n let showTrackRevisions = false;\n let selectEditPlug = \"tray\";\n let cp = obpmConfig.obpmFilePath;\n sessionStorage.setItem(\"obpmContextPath\", cp);\n let statiContextPath = obpmConfig.statiContextPath;\n let pdfPath = \"\";\n if (statiContextPath) {\n //5.0 trunk\n pdfPath = obpmConfig.statiContextPath;\n } else {\n //4.4 stable\n pdfPath = cp;\n }\n let url =\n pdfPath +\n \"/portal/vue/pdf/pdfviewer.html?action=\" +\n isEdit +\n \"&path=\" +\n file.path +\n \"&name=\" +\n realName +\n \"&showName=\" +\n file.name +\n \"&waterMark=\" +\n waterMark +\n \"&openWaterMark=\" +\n openWaterMark +\n \"&curEditUserId=\" +\n curEditUserId +\n \"&userName=\" +\n userName +\n \"&showTrackRevisions=\" +\n showTrackRevisions +\n \"&selectEditPlug=\" +\n selectEditPlug;\n let URL = encodeURI(url);\n window.open(URL);\n }\n }\n },\n });\n },\n /**\n 点击文件直接预览\n */\n handleFileClick(flie) {\n let flieType = flie.name\n .substring(flie.name.lastIndexOf(\".\"))\n .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 /**\n * 判断是否是图片类型\n */\n isImgType(extName) {\n switch (extName) {\n case \".jpg\":\n case \".jpeg\":\n case \".png\":\n case \".gif\":\n case \".bmp\":\n return true;\n default:\n return false;\n }\n },\n\n isJson(str) {\n return isJSON(str);\n },\n\n filterHandler(value, row, column) {\n const property = column[\"property\"];\n return row[property][0] === value;\n },\n\n getIconMapping(val, keyVal) {\n let valObj = JSON.parse(val);\n for (let i = 0; i < valObj.length; i++) {\n if (valObj[i].key == keyVal) {\n return valObj[i].key;\n }\n }\n },\n\n //视图列按钮操作\n buttonClick(column, row) {\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 (\n type //type为操作类型\n ) {\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 } else if (resData.type == 32) {\n this.$confirm(`${resData.content}`, this.$t(\"tip\"), {\n confirmButtonText: this.$t(\"msg.confirm\"),\n cancelButtonText: this.$t(\"btns.cancel\"),\n type: \"warning\",\n })\n .then(() => {\n let arr = [];\n arr.push(docId);\n this.$api.batchRemoveDocuments(\n this.openParams.appId,\n arr,\n {\n onSucess: (res) => {\n this.getData();\n },\n }\n );\n })\n .catch(() => {});\n }\n } else {\n this.$confirm(this.$t(\"msg.deldata\"), this.$t(\"tip\"), {\n confirmButtonText: this.$t(\"msg.confirm\"),\n cancelButtonText: this.$t(\"btns.cancel\"),\n type: \"warning\",\n })\n .then(() => {\n let arr = [];\n arr.push(docId);\n this.$api.batchRemoveDocuments(\n this.openParams.appId,\n arr,\n {\n onSucess: (res) => {\n this.getData();\n },\n }\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: 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(\n this.openParams.appId,\n parentView,\n id,\n data,\n {\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 );\n break;\n case \"05\":\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 < map.length; i++) {\n let currentObj = map[i].split(\":\");\n let obj = {};\n for (let key in row) {\n if (currentObj[1] === key) {\n obj[currentObj[0]] = row[key];\n arr.push(obj);\n }\n }\n }\n }\n }\n if (arr.length > 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 title: \"\",\n type: 277,\n };\n this.$parent.openForm(params, emptyParams);\n break;\n }\n },\n\n tableRowClassName({ row, rowIndex }) {\n row.index = rowIndex;\n if (rowIndex % 2 != 0) {\n return \"table-row-color\";\n } else {\n return \"\";\n }\n },\n\n onClickZoom() {\n let el = document.getElementById(\"mainHomeContent\");\n let delegateWidth = el.getBoundingClientRect().width - 16,\n delegateHeight = el.getBoundingClientRect().height - 40;\n this.viewGridviewZomm.width = delegateWidth + \"px\";\n this.viewGridviewZomm.height = delegateHeight + \"px\";\n this.isZomm = !this.isZomm;\n },\n\n setSubDocuments() {\n let editRow = [];\n if (this.newBuildDocId && this.newBuildDocId.length > 0) {\n //(this.newBuildDocId的数组有问题,未去重)该方法判断如果不是新建的行数据,那么编辑确定后行数据放到editRow数组中\n for (let i = 0; i < this.newBuildDocId.length; i++) {\n for (let j = 0; j < this.tableData.length; j++) {\n if (this.newBuildDocId[i] === this.tableData[j].docId) {\n editRow.push(this.tableData[j]);\n }\n }\n }\n }\n for (let i = 0; i < editRow.length; i++) {\n //判断原有的行数据编辑后,赋予到this.dataList中,改变值,新建的数据不用赋予到this.dataList\n for (let j = 0; j < this.dataList.length; j++) {\n if (editRow[i].docId === this.dataList[j].id) {\n for (let key in editRow[i]) {\n for (let el in this.dataList[j].items) {\n if (key === el) {\n this.dataList[j].items[el].value = editRow[i][key][0];\n }\n }\n }\n }\n }\n }\n // for (let i = 0; i < this.tableData.length; i++) { //当table有数据,对数据编辑时,新的数据给旧的数据\n // for (let j = 0; j < this.dataList.length; j++) {\n // if (this.tableData[i].docId === this.dataList[j].id) {\n // for (let key in this.tableData[i]) {\n // for (let el in this.dataList[j].items) {\n // if (key === el) {\n // this.dataList[j].items[el].value = this.tableData[i][key][0];\n // }\n // }\n // }\n // }\n // }\n // }\n let arr = [];\n for (let i = 0; i < this.dataList.length; i++) {\n let obj = JSON.parse(JSON.stringify(this.dataList[i]));\n obj.items = {};\n for (let j = 0; j < this.view.columns.length; j++) {\n for (let key in this.dataList[i].items) {\n if (key == this.view.columns[j].id) {\n // obj.items[this.view.columns[j].name] = this.dataList[i].items[\n // key\n // ].value;\n obj.items[this.dataList[i].items[key].name] =\n this.dataList[i].items[key].value;\n }\n }\n }\n arr.push(obj);\n }\n for (let i = 0; i < arr.length; i++) {\n if (arr[i].id) {\n arr[i].edit = true;\n arr[i].isRelate = this.openParams.isRelate.toString();\n delete arr[i].isRunningBack;\n arr[i].parentId = this.openParams.parentId; //2020-10-22,执行前脚本错误,注释这里\n } else {\n arr.splice(i, 1);\n i--;\n }\n }\n return arr;\n },\n\n getData(page) {\n this.getViewData(page).then((response) => {\n // response.data.data.forEach((item,index) => { //网格视图不显示后台配置好的汇总(当前页小计,总计)属性\n // if(item.isSum) {\n // response.data.data.splice(index,1)\n // }\n // })\n let docs = response.data.data;\n this.dataList = response.data.data;\n this.row_count = response.data.row_count;\n let tds = [];\n if (docs.length > 0) {\n docs.forEach((doc, index) => {\n let rows = {};\n let newBuild = {};\n rows.formId = doc.formId;\n rows.docId = doc.id;\n if (doc.isSum) {\n rows.isSum = doc.isSum;\n }\n if (doc.isTotal) {\n rows.isTotal = doc.isTotal;\n }\n\n newBuild.formId = doc.formId;\n newBuild.docId = doc.id;\n for (var key in doc.items) {\n let items = doc.items[key];\n //rows[key] = items.value;\n rows[key] = [];\n rows[key].push(items.value);\n newBuild[key] = [];\n newBuild[key].push(\"\");\n }\n if (!doc.isSum && !doc.isTotal) {\n this.newBuild = newBuild;\n }\n tds.push(rows);\n });\n } else {\n let newBuild = {};\n for (let i = 0; i < this.view.columns.length; i++) {\n newBuild[this.view.columns[i].id] = [];\n newBuild[this.view.columns[i].id].push(\"\");\n }\n this.newBuild = newBuild;\n }\n if (!this.newBuild) {\n //如果是有总计\n let newBuild = {};\n for (let i = 0; i < this.view.columns.length; i++) {\n newBuild[this.view.columns[i].id] = [];\n newBuild[this.view.columns[i].id].push(\"\");\n }\n this.newBuild = newBuild;\n }\n let columns = this.view.columns;\n columns.forEach((el) => {\n let filtersList = [];\n docs.forEach((items) => {\n for (let key in items.items) {\n if (key == el.id) {\n let obj = {};\n obj.text = items.items[key].value;\n obj.value = items.items[key].value;\n filtersList.push(obj);\n }\n }\n });\n filtersList = this.deteleObject(filtersList);\n\n el.filtersList = filtersList;\n });\n this.tableData = tds;\n this.$nextTick(() => {\n if (this.view.showWaterMark === true) {\n if (this.view.waterMarkText) {\n //判断是否显示水印\n let val = this.view.waterMarkText;\n let id = \"view_\" + this.view.id;\n Watermark.set(val, id);\n }\n }\n });\n });\n },\n\n //模拟数据请求\n getViewData(page) {\n let openParams = this.openParams;\n let treeData = \"\";\n let treeName = \"\";\n let searchData = {};\n if (this.parentId) {\n //树形视图\n return new Promise((resolve) => {\n this.$api.getTreeViewData(\n //树形视接口\n this.openParams.appId,\n this.openParams.actionContent,\n {\n parentId: this.parentId ? this.parentId : \"\",\n },\n treeData,\n treeName,\n {\n onSucess: (response) => {\n let treeViewData = response.data;\n resolve(treeViewData);\n },\n }\n );\n });\n } else if (this.openParams && this.openParams.parentId) {\n //包含元素时\n return new Promise((resolve) => {\n this.$api.getViewData(\n //普通视图接口\n this.openParams.appId,\n this.view.id,\n {\n parentId: this.openParams.parentId,\n isRelate: this.openParams.isRelate,\n currpage: page ? page : this.currentPage,\n lines: this.view.data ? this.view.data.page_lines : 2000,\n searchWord: \"\",\n },\n {},\n {\n onSucess: (response) => {\n let viewData = response.data;\n resolve(viewData);\n },\n }\n );\n });\n } else {\n if (openParams.queryString) {\n searchData = this.setParams(openParams.queryString, searchData);\n }\n let urlParams = openParams.urlParams;\n if (urlParams) {\n searchData = this.setParams(urlParams, searchData);\n }\n if (openParams.exparams) {\n searchData = this.setParams(openParams.exparams, searchData);\n }\n if (openParams.formParams) {\n searchData = this.setParams(openParams.formParams, searchData);\n }\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: this.view.data ? this.view.data.page_lines : 2000,\n searchWord: \"\",\n },\n searchData ? searchData : {},\n {\n onSucess: (response) => {\n let viewData = response.data;\n resolve(viewData);\n },\n }\n );\n });\n }\n },\n\n setParams(params, obj) {\n params = params.replace(/^(\\s|&)+|(\\s|&)+$/g, \"\");\n let list = params.split(\"&\");\n for (let i = 0; i < list.length; i++) {\n let p = list[i].split(\"=\");\n let isJson = this.isJSON(p[1]);\n if (isJson) {\n obj[p[0]] = encodeURI(p[1]); //encodeURIComponent(p[1])\n } else {\n obj[p[0]] = p[1] ? p[1] : \"\";\n }\n }\n return obj;\n },\n\n isJSON(str) {\n //判断是json字符串\n if (typeof str == \"string\") {\n try {\n let obj = JSON.parse(str);\n if (typeof obj == \"object\" && obj) {\n return true;\n } else {\n return false;\n }\n } catch (e) {\n return false;\n }\n }\n },\n\n onPageChang(ev) {\n let page = ev;\n this.getData(page);\n //this.$refs.searchform.onSearchClick();\n },\n\n onSearch(searchData) {\n this.$parent.initView({\n appId: this.openParams.appId,\n viewId: this.openParams.actionContent,\n data: searchData,\n exparams: {\n currpage: this.currentPage,\n lines: this.pagesize,\n },\n });\n },\n\n //进入编辑状态\n doEdit(row, column, index, isNewBuild) {\n if (!isNewBuild) {\n // let newBuildDocId = {};\n // newBuildDocId.docId = row.docId;\n this.newBuildDocId.push(row.docId);\n }\n\n let op = this.openParams\n let objParams = {}\n if(op.isRelate === true || op.isRelate === 'true') { //包含原素或者标签也新建可能会携带isRelate和parentId,需要传到后台\n objParams.isRelate = 'true'\n }else {\n objParams.isRelate = op.isRelate\n }\n if(op.parentId) {\n objParams.parentId = op.parentId\n }\n\n API.getForm(\n op.appId,\n this.view.relatedForm ? this.view.relatedForm : row.formId,\n row.docId,\n objParams,\n {\n onSucess: (response) => {\n let fields, formdata;\n if (row.data) {\n fields = row.data.fields;\n formdata = row.data;\n this.formdata = formdata;\n } else {\n fields = response.data.data.fields;\n formdata = response.data.data;\n this.formdata = formdata;\n if (isNewBuild) {\n let obj = {};\n const loopOpe = (fields) => {\n for (let i = 0; i < fields.length; i++) {\n for (let j = 0; j < this.view.columns.length; j++) {\n if (fields[i].divId === this.view.columns[j].fieldId) {\n obj[this.view.columns[j].id] = fields[i];\n }\n if (fields[i].tabs && fields[i].tabs.length > 0) {\n fields[i].tabs.forEach((tab) => {\n if (tab.fields) {\n loopOpe(tab.fields);\n }\n });\n }\n }\n }\n };\n loopOpe(formdata.fields);\n let newRow = {\n id: row.docId,\n edit: true,\n // formId: row.formId,\n formId: formdata.fields[0].formId,\n items: obj,\n formName: this.$t(\"view.view_type\"),\n };\n this.dataList.push(newRow);\n }\n }\n let eachLine = {\n docId: row.docId,\n data: this.formdata,\n };\n if (isNewBuild) {\n eachLine.isNewBuild = true;\n }\n if (this.allFormdata.length > 0) {\n //每次编辑或者新建把formdata放进这里\n let result = this.allFormdata.some((item) => {\n if (item.docId === eachLine.docId) {\n return true;\n }\n });\n if (result) {\n for (let i = 0; i < this.allFormdata.length; i++) {\n if (this.allFormdata[i].docIds === eachLine.docId) {\n this.allFormdata[i].data = eachLine.data;\n }\n }\n } else {\n this.allFormdata.push(eachLine);\n }\n } else {\n this.allFormdata.push(eachLine);\n }\n let docId = \"\";\n\n const loopOpe = (fields) => {\n for (let item in row) {\n for (let i = 0; i < column.length; i++) {\n if (item == column[i].id) {\n //this.view.columns[i].control = formdata;\n let controlName = row.docId + \"_\" + column[i].fieldName;\n fields.forEach((fld) => {\n let template = \"\";\n //网格视图的表单的样式在这里写个class,通过class去_view.scss的.gridview-box里面添加样式\n if (fld.formField == \"InputField\") {\n template =\n \"
\";\n } else if (fld.formField == \"RadioField\") {\n template =\n \"
\";\n } else if (fld.formField == \"CheckboxField\") {\n template =\n \"
\";\n } else if (fld.formField == \"SelectField\") {\n template =\n \"
\";\n } else if (fld.formField == \"IncludeField\") {\n template =\n \"
\";\n } else if (fld.formField == \"TextareaField\") {\n template =\n \"
\";\n } else if (fld.formField == \"DateField\") {\n template =\n \"
\";\n } else if (fld.formField == \"UserField\") {\n template =\n \"
\";\n } else if (fld.formField == \"DepartmentField\") {\n template =\n \"
\";\n } else if (fld.formField == \"ImageUploadField\") {\n template =\n \"
\";\n } else if (fld.formField == \"AttachmentUploadField\") {\n template =\n \"
\";\n } else if (fld.formField == \"QRCodeField\") {\n template =\n \"
\";\n } else if (fld.formField == \"TreeDepartmentField\") {\n template =\n \"
\";\n } else if (fld.formField == \"SelectAboutField\") {\n template =\n \"
\";\n } else if (fld.formField == \"HTMLEditorField\") {\n template =\n \"
\";\n } else if (fld.formField == \"SurveyField\") {\n template =\n \"
\";\n } else if (fld.formField == \"FlowHistoryField\") {\n template =\n \"
\";\n } else if (fld.formField == \"ButtonField\") {\n template =\n \"
\";\n } else if (fld.formField == \"ViewDialogField\") {\n template =\n \"
\";\n } else if (fld.formField == \"TabField\") {\n template =\n \"
\";\n } else if (fld.formField == \"GenericWordField\") {\n template =\n \"
\";\n } else if (fld.formField == \"WeixinGpsField\") {\n template =\n \"
\";\n } else if (fld.formField == \"CalctextField\") {\n template =\n \"
\";\n } else if (fld.formField == \"FlowReminderHistoryField\") {\n template =\n \"
\";\n } else if (fld.formField == \"OnLineTakePhotoField\") {\n template =\n \"
\";\n } else if (fld.formField == \"SuggestField\") {\n template =\n \"
\";\n } else if (fld.formField == \"NoField\") {\n template =\n \"
\";\n }\n\n if (fld.formField != \"IncludeField\") {\n if (controlName == fld.id) {\n let temp = {\n methods: {\n findField(controlName) {\n if (controlName == fld.id) {\n return fld;\n }\n return {\n id: fld.id,\n displayType: Constant.PermissionType_HIDDEN,\n hiddenValue: \"\",\n };\n },\n refresh: this.refresh,\n checkData: this.checkData,\n getAllFields: this.getAllFields,\n },\n template: template,\n };\n if (!this.tableData[index][item][1]) {\n this.tableData[index][item][1] = temp;\n }\n }\n }\n if (fld.tabs && fld.tabs.length) {\n fld.tabs.forEach((tab) => {\n if (tab.fields) {\n loopOpe(tab.fields);\n }\n });\n }\n });\n }\n }\n }\n };\n loopOpe(fields);\n this.$set(this.status, row.docId, 1);\n },\n }\n );\n },\n\n //确定记录\n doConfirm(row, column) {\n let buildData = \"\";\n let op = this.openParams;\n let appId = this.openParams.appId,\n id = this.openParams.parentId,\n viewId = this.view.id;\n for (let i = 0; i < this.allFormdata.length; i++) {\n if (row.docId === this.allFormdata[i].docId) {\n buildData = this.allFormdata[i].data;\n }\n }\n let jsonData = this.buildFormData(true, buildData);\n this.$api.setGridView(appId, viewId, id, jsonData, {\n onSucess: (response) => {\n if (response.data.errcode == 0) {\n let showtype = this.showtype;\n if (showtype && (showtype == \"include\" || showtype == \"tab\")) {\n for (let i = 0; i < this.allFormdata.length; i++) {\n if (row.docId === this.allFormdata[i].docId) {\n buildData = this.allFormdata[i].data;\n }\n }\n let jsonData = this.buildFormData(\"isInclude\", buildData);\n if (op.isRelate === true) {\n jsonData.isRelate = \"true\";\n }\n const loopOpe = (fields) => {\n for (let i = 0; i < fields.length; i++) {\n for (let j = 0; j < column.length; j++) {\n if (column[j].fieldId == fields[i].divId) {\n if (fields[i].formField === \"DateField\") {\n row[column[j].id][0] = this.writeCurrentDate(\n fields[i].value,\n fields[i].dateFormat\n );\n } else if (fields[i].formField === \"SelectField\") {\n\n //某些控件有显示值,给显示显示值(未完善),编辑数据保存时,显示值保存到了后台(错了)\n let options = fields[i].options;\n for (let z = 0; z < options.length; z++) {\n if (options[z].value === fields[i].value) {\n // row[column[j].id].push(options[z].option);\n row[column[j].id][2] = options[z].option\n }\n }\n row[column[j].id][0] = fields[i].value;\n } else if (fields[i].formField === \"DepartmentField\") {\n let valArr = \"\";\n let value = fields[i].value;\n let deptName = \"\";\n if (value) {\n valArr = value.split(\";\");\n }\n if (valArr && valArr.length > 0) {\n let data = fields[i].options;\n valArr.forEach((item) => {\n data.forEach((el) => {\n if (item == el.value) {\n deptName += el.option + \";\";\n }\n });\n });\n }\n deptName = deptName.replace(/^(\\s|;)+|(\\s|;)+$/g, \"\");\n row[column[j].id][0] = deptName;\n } else if (\n fields[i].formField === \"TreeDepartmentField\"\n ) {\n let valArr = \"\";\n let value = fields[i].value;\n let deptName = \"\";\n if (value) {\n valArr = value.split(\";\");\n }\n if (valArr && valArr.length > 0) {\n let data = fields[i].data;\n valArr.forEach((item) => {\n data.forEach((el) => {\n if (item == el.key) {\n deptName += el.label + \";\";\n }\n });\n });\n }\n deptName = deptName.replace(/^(\\s|;)+|(\\s|;)+$/g, \"\");\n row[column[j].id][0] = deptName;\n } else if (fields[i].formField === \"UserField\") {\n let valArr = \"\";\n let value = fields[i].value;\n let userName = \"\";\n if (value) {\n valArr = value.split(\";\");\n }\n if (valArr && valArr.length > 0) {\n let data = fields[i].data;\n valArr.forEach((item) => {\n data.forEach((el) => {\n if (item == el.id) {\n userName += el.name + \";\";\n }\n });\n });\n }\n userName = userName.replace(/^(\\s|;)+|(\\s|;)+$/g, \"\");\n row[column[j].id][0] = userName;\n } else {\n row[column[j].id][0] = fields[i].value;\n }\n }\n }\n if (fields[i].tabs && fields[i].tabs.length > 0) {\n fields[i].tabs.forEach((tab) => {\n if (tab.fields) {\n loopOpe(tab.fields);\n }\n });\n }\n }\n };\n loopOpe(buildData.fields);\n this.$set(this.status, row.docId, 0);\n if(op.isRefreshOnChanged) {\n this.$api.refreshView(jsonData, {\n onSucess: (res) => {\n if (res.data.errcode === 0) {\n // let obj = {};\n // obj.data = this.setSubDocuments();\n // obj.isRefresh = this.isIncludeViewRefresh;\n // this.$store.commit(\"saveSubDocuments\", obj);\n }\n },\n });\n //this.$set(this.status, row.docId, 0);\n }\n } else {\n let allFormdata = this.allFormdata;\n let formdata = \"\";\n for (let z = 0; z < allFormdata.length; z++) {\n if (row.docId === allFormdata[z].docId) {\n formdata = allFormdata[z].data;\n break;\n }\n }\n for (let i = 0; i < formdata.fields.length; i++) {\n for (let j = 0; j < column.length; j++) {\n if (column[j].fieldId == formdata.fields[i].divId) {\n if (formdata.fields[i].formField === \"DateField\") {\n row[column[j].id][0] = this.writeCurrentDate(\n formdata.fields[i].value,\n formdata.fields[i].dateFormat\n );\n } else if (formdata.fields[i].formField === \"SelectField\") {\n let options = formdata.fields[i].options;\n for (let z = 0; z < options.length; z++) {\n if (options[z].value === formdata.fields[i].value) {\n row[column[j].id][2] = options[z].option////row[column[j].id].push(options[z].option);\n }\n }\n row[column[j].id][0] = formdata.fields[i].value;\n } else if (\n formdata.fields[i].formField === \"DepartmentField\"\n ) {\n let valArr = \"\";\n let value = formdata.fields[i].value;\n let deptName = \"\";\n if (value) {\n valArr = value.split(\";\");\n }\n if (valArr && valArr.length > 0) {\n let data = formdata.fields[i].options;\n valArr.forEach((item) => {\n data.forEach((el) => {\n if (item == el.value) {\n deptName += el.option + \";\";\n }\n });\n });\n }\n deptName = deptName.replace(/^(\\s|;)+|(\\s|;)+$/g, \"\");\n row[column[j].id][0] = deptName;\n } else if (\n formdata.fields[i].formField === \"TreeDepartmentField\"\n ) {\n let valArr = \"\";\n let value = formdata.fields[i].value;\n let deptName = \"\";\n if (value) {\n valArr = value.split(\";\");\n }\n if (valArr && valArr.length > 0) {\n let data = formdata.fields[i].data;\n valArr.forEach((item) => {\n data.forEach((el) => {\n if (item == el.key) {\n deptName += el.label + \";\";\n }\n });\n });\n }\n deptName = deptName.replace(/^(\\s|;)+|(\\s|;)+$/g, \"\");\n row[column[j].id][0] = deptName;\n } else if (formdata.fields[i].formField === \"UserField\") {\n let valArr = \"\";\n let value = formdata.fields[i].value;\n let userName = \"\";\n if (value) {\n valArr = value.split(\";\");\n }\n if (valArr && valArr.length > 0) {\n let data = formdata.fields[i].data;\n valArr.forEach((item) => {\n data.forEach((el) => {\n if (item == el.id) {\n userName += el.name + \";\";\n }\n });\n });\n }\n userName = userName.replace(/^(\\s|;)+|(\\s|;)+$/g, \"\");\n row[column[j].id][0] = userName;\n } else {\n row[column[j].id][0] = formdata.fields[i].value;\n }\n this.$set(this.status, row.docId, 0);\n }\n }\n }\n /*\n 下面那些实在没办法,先这样写了。\n */\n row.data = formdata;\n let obj = {\n docId: row.docId,\n data: formdata,\n };\n this.currentFormData.push(obj);\n }\n } else if (response.data.errcode == 4001) {\n let promptData = \"\";\n let errcode = response.data.errcode;\n let errmsg = response.data.errmsg;\n let errorsList = response.data.errors;\n if (errorsList && errorsList.length > 0) {\n errorsList.forEach((item) => {\n promptData += item.errmsg + \"
\";\n });\n }\n this.promptBox(errcode, errmsg, promptData);\n }\n },\n });\n },\n\n getAllFields() {\n return this.formdata.fields;\n },\n\n //执行脚本前\n runBeforeAction(act) {\n let op = this.openParams;\n let formData = {\n docId: \"\",\n document: {},\n formId: this.view.relatedForm,\n parentId: \"\",\n templateForm: this.view.templateForm,\n viewId: op.actionContent,\n _selects: this.selectDocId.length > 0 ? this.selectDocId : [],\n };\n if (op.parentId) {\n formData.parentId = op.parentId;\n formData.isRelate = op.isRelate;\n }\n let divId = act.id;\n this.$api.runBeforeActionScript(\n this.openParams.appId,\n divId,\n formData,\n act.type,\n \"\", //treedocid\n \"\", //flowType\n {\n onSucess: (response) => {\n if (response.data.data) {\n //如果有数据返回,结束下一步\n let resData = response.data.data;\n let errmsg = response.data.data.content;\n if (!resData.type) {\n //没有type值,但是有返回数据,把数据放进document\n if (resData.changedField) {\n this.$notify.success({\n title: resData.content,\n message: \"\",\n });\n }\n } else if (resData.type == 1) {\n this.$notify.success({\n title: errmsg,\n message: \"\",\n });\n } else if (resData.type == 16) {\n this.$notify.error({\n title: errmsg,\n message: \"\",\n });\n } else if (resData.type == 32) {\n this.$confirm(`${errmsg}`, this.$t(\"tip\"), {\n confirmButtonText: this.$t(\"msg.confirm\"),\n cancelButtonText: this.$t(\"btns.cancel\"),\n type: \"warning\",\n })\n .then(() => {\n switch (act.type) {\n case 1: //载入视图\n this.getTemplate(act);\n break;\n case 2: //新建表单\n this.doCreate(act);\n break;\n case 3: //删除数据\n for (let i = 0; i < this.selectDocId.length; i++) {\n for (let j = 0; j < this.dataList.length; j++) {\n if (this.selectDocId[i] == this.dataList[j].id) {\n this.dataList[j].delete = true;\n }\n }\n }\n for (let i = 0; i < this.selectDocId.length; i++) {\n for (let j = 0; j < this.tableData.length; j++) {\n if (\n this.selectDocId[i] == this.tableData[j].docId\n ) {\n this.tableData.splice(j, 1);\n j--;\n }\n }\n }\n // let obj = {};\n // obj.data = this.setSubDocuments();\n // obj.isRefresh = this.isIncludeViewRefresh;\n // this.$store.commit(\"saveSubDocuments\", obj);\n break;\n case 34:\n this.doSave(act);\n break;\n default:\n this.getTemplate(act);\n break;\n }\n })\n .catch(() => {});\n }\n } else {\n if (act.type == 2) {\n this.doCreate(act);\n } else if (act.type == 3) {\n for (let i = 0; i < this.selectDocId.length; i++) {\n for (let j = 0; j < this.dataList.length; j++) {\n if (this.selectDocId[i] == this.dataList[j].id) {\n this.dataList[j].delete = true;\n }\n }\n }\n for (let i = 0; i < this.selectDocId.length; i++) {\n for (let j = 0; j < this.tableData.length; j++) {\n if (this.selectDocId[i] == this.tableData[j].docId) {\n this.tableData.splice(j, 1);\n j--;\n }\n }\n }\n // let obj = {};\n // obj.data = this.setSubDocuments();\n // obj.isRefresh = this.isIncludeViewRefresh;\n // this.$store.commit(\"saveSubDocuments\", obj);\n } else if (act.type == 34) {\n this.doSave(act);\n } else {\n this.getTemplate(act);\n }\n }\n },\n }\n );\n },\n\n //执行脚本后\n runAfterAction(act, docIds) {\n let op = this.openParams;\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\n let appId = this.openParams.appId;\n let divId = act.id;\n let docId = \"\";\n let parentId = \"\";\n let _templateForm = \"\";\n let _ = \"\";\n if (op.parentId) {\n formData.parentId = op.parentId;\n formData.isRelate = op.isRelate;\n parentId = op.parentId;\n }\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 (act.type == 34) {\n // this.getData();\n this.$parent.updateView()\n }\n\n if (response.data.data) {\n let errmsg = response.data.data.content.content;\n this.$notify({\n title: errmsg,\n message: \"\",\n type: \"warning\",\n });\n } else {\n if (act.type == 20) {\n this.popupVisible = false;\n }\n }\n\n if (act.type == 2) {\n //新建, 针对最外层直接保存\n let _afd = this.allFormdata;\n let _dl = this.dataList;\n let view = this.view;\n let op = this.openParams;\n this.$store.commit(\"SET_SUBDOCUMENTS_DATA\", {\n _afd,\n _dl,\n view,\n op,\n });\n }\n }\n },\n }\n );\n },\n\n setSaveDoc(){\n //针对直接保存包含元素,单点击确定的勾后也行\n let _afd = this.allFormdata;\n let _dl = this.dataList;\n if (_afd && _afd.length > 0) {\n for (let i = 0; i < _afd.length; i++) {\n for (let j = 0; j < _dl.length; j++) {\n if (_afd[i].docId == _dl[j].id) {\n let fields = _afd[i].data.fields\n let items = _dl[j].items\n _dl[j].edit = true\n for (let key in items) {\n // for (let z = 0; z < fields.length; z++) {\n // if (items[key].id == fields[z].id) {\n // items[key].value = fields[z].value\n // }\n // }\n const loopOpe = fields => {\n for (let z = 0; z < fields.length; z++) {\n if (items[key].id == fields[z].id) {\n items[key].value = fields[z].value\n }\n if(fields[z].tabs && fields[z].tabs.length>0) {\n fields[z].tabs.forEach(tab => {\n if(tab.fields) {\n loopOpe(tab.fields)\n }\n })\n }\n }\n }\n loopOpe(fields)\n }\n }\n }\n }\n }\n let arr = [];\n let dataList = this.dataList;\n if(dataList.length >= 1) { \n for(let x = 0; x < dataList.length; x++) { //网格视图当前页小计和总计不保存\n if(dataList[x].isSum || dataList[x].isTotal) {\n dataList.splice(x--,1); //x要--\n }\n }\n }\n let view = this.view;\n let op = this.openParams;\n \n for (let i = 0; i < dataList.length; i++) {\n let obj = JSON.parse(JSON.stringify(dataList[i]));\n if (op.parentId) {\n obj.parentId = op.parentId;\n }\n if (op.isRelate === true) {\n obj.isRelate = \"true\";\n }\n obj.items = {};\n if(obj.edit || obj[\"delete\"]) {\n for (let j = 0; j < view.columns.length; j++) {\n for (let key in dataList[i].items) {\n if (key == view.columns[j].id) {\n obj.items[dataList[i].items[key].name] = dataList[i].items[key].value;\n if (dataList[i].delete) {\n delete dataList[i].edit;\n delete dataList[i].isRelate;\n delete dataList[i].isRunningBack;\n delete dataList[i].parentId;\n continue;\n } else {\n if (dataList[i].edit) {\n obj.edit = true;\n } \n }\n }\n }\n }\n arr.push(obj);\n }\n }\n if(arr && arr.length > 0) {\n arr.forEach(item => {\n if(item[\"delete\"] && item.edit) {\n delete item.edit\n }\n })\n }\n return arr\n },\n\n doSave(act) {\n let jsonData = {};\n jsonData.data = this.setSaveDoc();\n if (!this.showtype) {\n //普通视图删除后保存\n arr.forEach((el) => {\n if (el.delete) {\n delete el.edit;\n el.items = {};\n }\n });\n }\n\n this.$api.saveGridview(this.openParams.appId, jsonData, {\n onSucess: (res) => {\n if (res.data.errcode === 0) {\n this.$notify({\n title: res.data.errmsg,\n message: \"\",\n type: \"success\",\n });\n this.runAfterAction(act);\n } else if (res.data.errcode === 4001) {\n let promptData = \"\";\n let errcode = res.data.errcode;\n let errmsg = res.data.errmsg;\n let errorsList = res.data.errors;\n if (errorsList && errorsList.length > 0) {\n errorsList.forEach((item) => {\n promptData += item.errmsg + \"
\";\n });\n }\n this.promptBox(errcode, errmsg, promptData);\n }\n },\n });\n },\n\n //获取视图模板\n getTemplate(act) {\n this.$emit(\"gridviewTem\", act);\n // let op = this.openParams;\n // let appId = op.appId;\n // let viewId = act.onActionView;\n // let exparams = {};\n // let st = this.showtype;\n // if((st && st == 'tab') || (st && st == 'include')) { //如果是控件选项卡或包含元素\n // exparams.parentId = op.parentId;\n // exparams.isRelate = op.isRelate;\n // }\n // this.$api.getViewTemplate(appId, viewId, exparams, {\n // onSucess: response => {\n // if(response.data.errcode == 0) {\n // this.runAfterAction(act, []);\n // }\n // }\n // })\n },\n\n //返回成功或失败时的提示框\n promptBox(errcode, errmsg, title) {\n let that = this;\n let p = new Promise(function (resolve) {\n if (errcode == 4001) {\n that.$toastr.e({\n closeButton: true,\n title: errmsg,\n msg: title,\n clickClose: true, //Disable click to close\n timeout: 3000, // 3 sec\n type: \"error\", //error, warning, success, info\n preventDuplicates: true,\n });\n } else if (errcode == 0) {\n that.$toastr.s({\n closeButton: true,\n msg: errmsg,\n clickClose: true,\n timeout: 2000,\n type: \"success\",\n preventDuplicates: true,\n });\n resolve(\"成功\");\n }\n });\n return p;\n },\n\n handleSelectionChange(val) {\n let docIds = [];\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.selectDocId = docIds;\n this.$emit(\"getDocIds\", docIds);\n },\n\n onAction(act) {\n //绑定视图的处理事件\n let activityType = act.type;\n switch (act.type) {\n case 1: //载入视图\n this.runBeforeAction(act);\n break;\n case 2: //创建\n this.runBeforeAction(act);\n break;\n case 3: //删除\n if (this.selectDocId.length <= 0) {\n this.$message({\n message: this.$t(\"msg.least_one_data\"),\n type: \"warning\",\n });\n } else {\n this.runBeforeAction(act);\n }\n // this.doRemove(act);\n break;\n case 4: //保存并启动流程\n break;\n case 5: //流程处理\n this.$parent.flowHandle();\n break;\n case 8: //关闭窗口\n this.$parent.runBeforeAction(act.id, \"\", \"\", activityType);\n break;\n case 10: //返回\n this.doBack();\n //this.$parent.goBack();\n break;\n case 11: //保存并返回\n this.$parent.runBeforeAction(act.id, \"\", \"\", activityType);\n break;\n case 13: //无\n break;\n case 14: //网页打印(表单)\n case 15: //网页打印含历史\n this.$parent.runBeforeAction(act.id, \"\", \"\", activityType);\n break;\n case 16: //导出excel\n this.$parent.runBeforeAction(act, \"\", \"\", activityType);\n break;\n case 19: //保存草稿不校检\n //this.$parent.saveDraft();\n this.$parent.runBeforeAction(act.id, \"\", \"\", activityType);\n break;\n case 18: //清空所有数据\n break;\n case 20: //批量提交\n this.$parent.showSubmitPanel(act, this.selectDocId);\n break;\n case 21: //保存并复制\n case 25: //PDF导出\n case 26: //文件下载\n this.$parent.runBeforeAction(act);\n break;\n case 27: //导入excel\n this.$parent.runBeforeAction(act, \"\", \"\", activityType);\n break;\n case 28: //电子签章\n break;\n case 29: //批量签章\n break;\n case 33: //流程启动\n break;\n case 34: //保存\n this.runBeforeAction(act);\n break;\n case 36: //网页打印(视图)\n this.$parent.runBeforeAction(act);\n // this.$emit(\"action\",act);\n break;\n case 37: //邮件短信分享\n break;\n case 42: //保存并新建\n this.$parent.runBeforeAction(act.id, \"\", \"\", activityType);\n break;\n case 43: //跳转\n this.$parent.runBeforeAction(act);\n break;\n case 45: //归档\n this.$parent.runBeforeAction(act.id, \"\", \"\", activityType);\n break;\n case 46: //签章\n break;\n case 47: //回退流程\n break;\n case 48: //催办流程\n break;\n case 49: //挂起流程\n break;\n case 50: //恢复流程\n break;\n case 51: //回撤流程\n break;\n case 52: //终止流程\n break;\n case 53: //编辑流程审批人\n break;\n case 54: //调整流程\n break;\n case 55: //点评\n break;\n case 56: //补签\n break;\n case 57: //加签主办\n break;\n case 58: //加签协办\n default:\n break;\n }\n },\n\n getExcelParams() {\n if (this.searchExcelData) {\n return this.searchExcelData;\n } else {\n return \"\";\n }\n },\n\n reloadListView() {\n this.getData();\n },\n\n checkData(value, fieldId) { //method哪里注释了,因为每一行buildFormData()的数据都不一样,有空再改了\n if (value) {\n let allFormdata = this.allFormdata\n let haveRow = false\n let index = ''\n let data\n if(allFormdata && allFormdata.length > 0) {\n for(let i=0; i 0) {\n for(let i=0; i {\n let fields = response.data.data\n let keys = Object.keys(fields)\n keys.forEach((key) => {\n let field = fields[key];\n formdata.fields.forEach((f, i) => {\n if (field.id == f.id) {\n formdata.fields[i].value = field.value //只能更新value,而不能简单做对象替换,field.value绑定在组件v-model上,如果直接替换只是数组内存指针简单变更\n formdata.fields[i].options = field.options\n formdata.fields[i].tabs = field.tabs\n //如果为选择类型field,则options也要在这里替换.....\n formdata.fields[i].displayType = field.displayType\n }\n })\n })\n },\n });\n },\n\n buildFormData(val, buildData) {\n let formDataFields = \"\";\n if (val == \"isInclude\" || val) {\n formDataFields = buildData.fields\n } else {\n formDataFields = this.formdata.fields\n }\n let items = {}\n if(formDataFields){\n const loopOpe = fields => {\n for (let i = 0; i < fields.length; i++) {\n let fld = fields[i]\n if (\n fld.name &&\n fld.value != undefined &&\n fld.formField != \"ButtonField\" && \n fld.displayType != undefined\n ) {\n if(fld.textType ==\"hidden\" && fld.value ) {\n items[fld.name] = fld.value;\n }else if(fld.textType !=\"hidden\"){\n items[fld.name] = fld.value\n }\n if(fld.textType ==\"hidden\" && !fld.value) {\n if(fld.isUpdatedValue) { //这里针对视图选择框 隐藏并且没值时,但有选过值,也要把这个属性传到后台\n items[fld.name] = ''\n }\n }\n }\n if(fld.addInTtems) {\n items[fld.name] = fld.value\n }\n if(fld.tabs && fld.tabs.length>0) {\n fld.tabs.forEach(tab => {\n if(tab.fields) {\n loopOpe(tab.fields)\n }\n })\n }\n }\n }\n loopOpe(formDataFields)\n }\n\n let obj = {\n applicationId: this.openParams.appId,\n formId: formDataFields[0].formId,\n id: formDataFields[0].docId,\n items: items,\n parentId: this.openParams.parentId ? this.openParams.parentId : \"\",\n sign: \"\",\n subDocuments: [],\n versions: \"0\",\n }\n return obj\n },\n\n writeCurrentDate(val, dateFormat) {\n if (val) {\n let now = new Date(val);\n let year = now.getFullYear();\n let month = now.getMonth() + 1;\n let date = now.getDate();\n let hour = now.getHours();\n let minute = now.getMinutes();\n let second = now.getSeconds();\n\n month = month < 10 ? \"0\" + month : month;\n date = date < 10 ? \"0\" + date : date;\n hour = hour < 10 ? \"0\" + hour : hour;\n minute = minute < 10 ? \"0\" + minute : minute;\n second = second < 10 ? \"0\" + second : second;\n if (dateFormat == \"HH:mm:ss\") {\n return val; //hour+\":\"+minute+\":\"+second;\n } else if (dateFormat == \"yyyy-MM-dd HH:mm:ss\") {\n return (\n year +\n \"-\" +\n month +\n \"-\" +\n date +\n \" \" +\n hour +\n \":\" +\n minute +\n \":\" +\n second\n );\n } else if (dateFormat == \"yyyy-MM-dd HH:mm\") {\n return year + \"-\" + month + \"-\" + date + \" \" + hour + \":\" + minute;\n } else if (dateFormat == \"yyyy-MM-dd\") {\n return year + \"-\" + month + \"-\" + date;\n } else if (dateFormat == \"yyyy-MM\") {\n return year + \"-\" + month;\n } else if (dateFormat == \"yyyy\") {\n return year;\n }\n // return year + \"-\" + month + \"-\" + date + \" \"; //hour+\":\"+minute+\":\"+second;\n } else {\n return \"\";\n }\n },\n\n //取消记录\n doCancel(row, column) {\n let allFormdata = this.allFormdata;\n let formdata = \"\";\n for (let z = 0; z < allFormdata.length; z++) {\n if (row.docId === allFormdata[z].docId) {\n formdata = allFormdata[z].data;\n break;\n }\n }\n for (let i = 0; i < formdata.fields.length; i++) {\n for (let j = 0; j < column.length; j++) {\n if (column[j].fieldId == formdata.fields[i].divId) {\n formdata.fields[i].value = row[column[j].id][0];\n }\n }\n }\n this.$set(this.status, row.docId, 0);\n // let af = allFormdata;\n // let td = this.tableData;\n // for(let i=0; i {\n let rows = {};\n rows.formId = view.relatedForm;\n rows.docId = response.data.data.id;\n let obj = JSON.parse(JSON.stringify(this.newBuild))\n ? JSON.parse(JSON.stringify(this.newBuild))\n : { formId: this.view.relatedForm };\n obj.docId = rows.docId;\n // this.tableData.push(obj);\n // let index = this.tableData.length - 1;\n this.tableData.unshift(obj);\n let index = 0;\n let isNewBuild = true;\n this.doEdit(obj, view.columns, index, isNewBuild);\n this.runAfterAction(act);\n },\n }\n );\n },\n\n //删除记录\n doRemove(row, index) {\n let dataList = this.dataList;\n dataList.forEach((el) => {\n if (el.id == row.docId) {\n el.delete = true;\n }\n });\n // this.dataList[index].delete = true;\n // for (let i = 0; i < this.selectDocId.length; i++) {\n // for (let j = 0; j < this.tableData.length; j++) {\n // if (this.selectDocId[i] == this.tableData[j].docId) {\n // this.tableData.splice(j, 1);\n // j--;\n // }\n // }\n // }\n // let obj = {};\n // obj.data = this.setSubDocuments();\n // obj.isRefresh = this.isIncludeViewRefresh;\n // this.$store.commit(\"saveSubDocuments\", obj);\n this.tableData.splice(index, 1);\n },\n\n //以下的方法都是listview的方法\n viewFieldPath(value, field) {\n if (value && field == \"ImageUploadField\") {\n return obpmConfig.obpmFilePath + value.path;\n } else if (\n value &&\n (field == \"AttachmentUploadField\" || field == \"NullField\")\n ) {\n if (value instanceof Array) {\n return value;\n } else {\n let arr = JSON.parse(value);\n return arr;\n }\n }\n },\n\n regReplace(value) {\n if (value) {\n return value.replace(/%/g, \"%\");\n }\n },\n\n //获取路径(默认obpm)\n setDefaultPath() {\n return obpmConfig.obpmFilePath;\n },\n\n //视图列设置默认图标显示\n setDefaultIcon(value, isLogo, keyVal) {\n let statiContextPath = obpmConfig.statiContextPath;\n let path = \"\";\n if (isLogo) {\n path = this.setDefaultPath() + \"/uploads/lib/icon/\" + value;\n } else {\n let valueObject = JSON.parse(value);\n if (valueObject) {\n for (let i = 0; i < valueObject.length; i++) {\n if (valueObject[i].key == keyVal) {\n if (statiContextPath) {\n //5.0\n path = this.setDefaultPath() + valueObject[i].value;\n } else {\n path =\n this.setDefaultPath() +\n \"/uploads/lib/icon\" +\n valueObject[i].value;\n }\n }\n }\n }\n }\n return path;\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\n deteleObject(obj) {//去除数组中的重复对象 \n let uniques = [];\n let stringify = {};\n for (var i = 0; i < obj.length; i++) {\n let keys = Object.keys(obj[i]);\n keys.sort(function (a, b) {\n return Number(a) - Number(b);\n });\n let str = \"\";\n for (var j = 0; j < keys.length; j++) {\n str += JSON.stringify(keys[j]);\n str += JSON.stringify(obj[i][keys[j]]);\n }\n if (!stringify.hasOwnProperty(str)) {\n uniques.push(obj[i]);\n stringify[str] = true;\n }\n }\n uniques = uniques;\n return uniques;\n },\n },\n};\n",null]}