{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\form\\customquery\\CustomQueryList.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\form\\customquery\\CustomQueryList.vue","mtime":1675071992960},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.function.name\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport { Message } from \"element-ui\";\nimport req from \"@/request.js\";\n\nvar customQueryShow = function customQueryShow() {\n return import(\"@/views/form/customquery/CustomQueryShow.vue\");\n};\n\nvar VariablesSelector = function VariablesSelector() {\n return import(\"@/components/common/VariablesSelector.vue\");\n};\n\nimport form from \"@/api/form.js\";\nexport default {\n components: {\n customQueryShow: customQueryShow,\n VariablesSelector: VariablesSelector\n },\n computed: {\n //删除关联查询数据的URL\n deleteUrl: function deleteUrl() {\n return window.context.form + \"/form/customQuery/v1/removes\";\n },\n //保存关联查询数据的URL (关联查询新增修改时)\n saveUrl: function saveUrl() {\n return window.context.form + \"/form/customQuery/v1/save\";\n },\n addColumnsTitle: function addColumnsTitle() {\n var statusWord = \"\";\n\n switch (this.tabStatus) {\n case \"condition\":\n statusWord = \"条件\";\n break;\n\n case \"return\":\n statusWord = \"返回\";\n break;\n\n case \"order\":\n statusWord = \"排序\";\n break;\n }\n\n return \"\\u5C06\\u5DE6\\u4FA7\\u6240\\u9009\\u5B57\\u6BB5\\u6DFB\\u52A0\\u5230\".concat(statusWord, \"\\u5B57\\u6BB5\\u4E2D\");\n }\n },\n data: function data() {\n return {\n isSqlBuildType: false,\n isSubmit: true,\n //侧边栏是否提交\n number_opList: [{\n value: \"等于\",\n key: \"EQ\"\n }, {\n value: \"大于等于\",\n key: \"GE\"\n }, {\n value: \"大于\",\n key: \"GT\"\n }, {\n value: \"小于\",\n key: \"LT\"\n }, {\n value: \"小于等于\",\n key: \"LE\"\n }, {\n value: \"in\",\n key: \"IN\"\n }],\n //运算条件数组-number\n string_opList: [{\n value: \"等于\",\n key: \"EQ\"\n }, {\n value: \"like\",\n key: \"LK\"\n }, {\n value: \"likeEnd\",\n key: \"LFK\"\n }, {\n value: \"in\",\n key: \"IN\"\n }],\n //运算条件数组-varchar\n date_opList: [{\n value: \"等于\",\n key: \"EQ\"\n }, // { value: \"between\", key: \"BETWEEN\" },\n {\n value: \"大于等于\",\n key: \"GE\"\n }, {\n value: \"小于等于\",\n key: \"LE\"\n }],\n //运算条件数组-日期\n value_sourceList_list: [{\n value: \"参数传入\",\n key: \"1\"\n }, {\n value: \"固定值\",\n key: \"2\"\n }],\n //值来源数组_列表\n value_sourceList_tree: [{\n value: \"固定值\",\n key: \"2\"\n }, {\n value: \"动态传入\",\n key: \"4\"\n }],\n //值来源数组_树\n sort_typeList: [{\n value: \"升序\",\n key: \"asc\"\n }, {\n value: \"降序\",\n key: \"desc\"\n }],\n //排序字段升序还是降序\n param_ctList: [{\n value: \"单行文本框\",\n key: \"1\"\n }],\n //控制器的类型\n tabStatus: \"return\",\n //设置列的条件字段、返回字段等的tabs标签页\n table: {},\n //获取设置列获取字段信息\n titleSetting: \"未命名-设置列\",\n //设置列侧边栏的名称\n dialogVisibleSetting: false,\n //是否显示可配置设置列\n disabled: false,\n //是否禁止操作\n tableOrViewList: [],\n //数据源表\n objName: \"\",\n //查询数据源时表或视图名称\n title: \"添加关联查询\",\n data: [],\n //列表数据\n treeSidebarData: {\n diySql: \"\"\n },\n //关联查询的新增修改数据\n pageResult: {\n page: 1,\n pageSize: 20,\n total: 0\n },\n dataSourcesInBean: [],\n //数据源池\n isTableList: [{\n key: 0,\n value: \"视图\"\n }, {\n key: 1,\n value: \"表\"\n }],\n //表和视图\n dialogVisible: false,\n //侧边栏是否显示\n selectOptions: [],\n selectOp: \"\",\n cmOptions: {\n showCursorWhenSelecting: true,\n value: \"\",\n mode: \"application/json\",\n readOnly: false,\n smartIndent: true,\n autofocus: true,\n tabSize: 2,\n theme: \"eclipse\",\n lineNumbers: true,\n line: true,\n inputStyle: \"textarea\"\n },\n uploadDialogVisible: false,\n fileList: [],\n uploadUrl: window.context.form + \"/form/customQuery/v1/import\",\n innerValidation: true\n };\n },\n methods: {\n //鼠标选中行改变复选框\n rowClick: function rowClick(row, column, event) {\n this.$refs.htTable.$refs.htTable.toggleRowSelection(row);\n },\n changeOptions: function changeOptions() {\n if (this.treeSidebarData.diySql) {\n this.treeSidebarData.diySql = this.treeSidebarData.diySql + this.selectOp;\n } else {\n this.treeSidebarData.diySql = this.selectOp;\n }\n\n this.selectOp = null;\n this.$forceUpdate();\n },\n diySqlChange: function diySqlChange(e) {\n this.$forceUpdate();\n },\n handleVarSelectorClick: function handleVarSelectorClick(s, n) {\n if (n && n.data && n.data.field) {\n var fieldExp = \"${\" + n.data.field + \"}\";\n this.$refs.dataParamCode && this.$refs.dataParamCode.codemirror.replaceSelection(fieldExp);\n }\n },\n //添加为对话框\n saveDialogByQuery: function saveDialogByQuery(id) {\n var _this = this;\n\n this.$confirm(\"确认添加为对话框?\").then(function (_) {\n _this.getDialogById(id, \"add\");\n }).catch(function (_) {});\n },\n //预览\n preview: function preview(row) {\n if (!row || !row.alias) {\n this.$message.error(\"\\u6240\\u8981\\u9884\\u89C8\\u7684\\u5173\\u8054\\u67E5\\u8BE2\\u4E3A\\u7A7A\\u6216\\u5176\\u522B\\u540D\\u4E0D\\u5B58\\u5728\");\n return;\n }\n\n var title = \"\".concat(row.name, \" - \\u5173\\u8054\\u67E5\\u8BE2\\u9884\\u89C8\");\n this.$refs.customQueryShow.showDialog(row.alias, title); //显示自定义对话框列表预览弹框\n },\n //判断数据是否包含某个对象,并返回数据包含对象的下标\n indexArray: function indexArray(array, item) {\n if (array.length == 0) {\n return -1;\n }\n\n for (var i = 0; i < array.length; i++) {\n if (JSON.stringify(array[i]) == JSON.stringify(item)) {\n return i;\n }\n }\n\n return -1;\n },\n //批量勾选设置列的字段\n handleSelectionChange: function handleSelectionChange(rows) {\n //先把所有选择的字段设置为未选中\n for (var i = 0; i < this.table.columnList.length; i++) {\n if (this.table.columnList[i].selected) {\n this.table.columnList[i].selected = false;\n }\n }\n\n if (rows && rows.length > 0) {\n //再根据勾选的字段设置为选中\n for (var _i = 0; _i < rows.length; _i++) {\n var res = this.indexArray(this.table.columnList, rows[_i]);\n this.table.columnList[res].selected = true;\n }\n }\n },\n //保存设置列的内容\n save: function save() {\n var _this2 = this;\n\n var this_ = this;\n this_.$validator.validateAll(\"settingSave\").then(function (result) {\n if (result) {\n for (var i in _this2.treeSidebarData.conditionfield) {\n var column = _this2.treeSidebarData.conditionfield[i];\n\n if (column.dbType == \"date\" && column.condition == \"BETWEEN\") {\n column.defaultValue += \"|\" + column.endDate;\n }\n }\n\n if (!this_.treeSidebarData.diySql && this_.isSqlBuildType) {\n Message.warning(\"请添加sql语句\");\n return;\n }\n\n if (_this2.treeSidebarData.sortfield && _this2.treeSidebarData.sortfield.length > 3) {\n Message.warning(\"您添加的排序字段太多,最多只能添加3个排序字段!\");\n return;\n }\n\n _this2.dialogVisibleSetting = false;\n } else {\n var arr = this_.$validator.errors.items.filter(function (item) {\n return item.scope == \"settingSave\";\n });\n var errorLength = arr.length;\n this_.$message({\n showClose: true,\n message: \"\\u6709\".concat(errorLength, \"\\u4E2A\\u5B57\\u6BB5\\u672A\\u901A\\u8FC7\\u6821\\u9A8C\\uFF0C\\u8BF7\\u6B63\\u786E\\u586B\\u5199\\u8868\\u5355\\u5185\\u5BB9\\u3002\"),\n type: \"warning\"\n });\n }\n });\n },\n //关闭设置列弹框\n close: function close() {\n var _this3 = this;\n\n var this_ = this;\n this_.$validator.validateAll(\"settingSave\").then(function (result) {\n if (!result) {\n this_.innerValidation = false;\n this_.doClose();\n return;\n }\n\n for (var i in _this3.treeSidebarData.conditionfield) {\n var column = _this3.treeSidebarData.conditionfield[i];\n\n if (column.dbType == \"date\" && column.condition == \"BETWEEN\") {\n column.defaultValue += \"|\" + column.endDate;\n }\n }\n\n if (!this_.treeSidebarData.diySql && this_.isSqlBuildType) {\n this_.innerValidation = false;\n this_.doClose();\n return;\n }\n\n if (_this3.treeSidebarData.sortfield && _this3.treeSidebarData.sortfield.length > 3) {\n this_.innerValidation = false;\n this_.doClose();\n return;\n }\n\n this_.innerValidation = true;\n this_.doClose();\n });\n },\n doClose: function doClose() {\n this.dialogVisibleSetting = false;\n },\n //添加设置列的字段\n addFields: function addFields() {\n var column = {};\n column.fieldName = \"\";\n column.comment = \"\";\n column.columnType = \"varchar\";\n this.table.columnList.push(column);\n },\n //把设置列的字段新增到条件字段、返回字段等\n addColumns: function addColumns() {\n //检查是否选择了列\n for (var i in this.table.columnList) {\n var c = this.table.columnList[i];\n if (c.selected) break;\n\n if (i == this.table.columnList.length - 1) {\n if (i == this.table.columnList.length - 1) {\n Message.warning(\"请选择左边的列\");\n }\n }\n } //判断tabs标签页是否选择了条件字段\n\n\n if (this.tabStatus == \"condition\") {\n for (var _i2 in this.table.columnList) {\n var _c = this.table.columnList[_i2];\n if (!_c.selected) continue;\n var column = {};\n column.field = _c.fieldName;\n column.comment = _c.comment;\n column.condition = \"EQ\";\n column.dbType = _c.columnType;\n column.defaultType = \"2\";\n column.defaultValue = \"\";\n var show = this.judgeAryData(this.treeSidebarData.conditionfield, column);\n\n if (show) {\n this.treeSidebarData.conditionfield.push(column);\n }\n } //去除重复项\n\n\n this.treeSidebarData.resultfield.unique(function (a, b) {\n return a.field == b.field;\n }); //判断tabs标签页是否选择了返回字段\n } else if (this.tabStatus == \"return\") {\n for (var _i3 in this.table.columnList) {\n var _c2 = this.table.columnList[_i3];\n if (!_c2.selected) continue;\n var _column = {};\n _column.field = _c2.fieldName;\n _column.comment = _c2.comment;\n _column.idKey = \"0\";\n _column.AggFuncOp = \"\"; //合计函数运算符\n\n _column.columnType = _c2.columnType; //字段类型\n\n var _show = this.judgeAryData(this.treeSidebarData.resultfield, _column);\n\n if (_show) {\n this.treeSidebarData.resultfield.push(_column);\n }\n } //去除重复项\n\n\n this.treeSidebarData.resultfield.unique(function (a, b) {\n return a.field == b.field;\n });\n } else if (this.tabStatus == \"order\") {\n var errorMsg = \"\"; //判断tabs标签页是否选择了排序字段\n\n for (var _i4 in this.table.columnList) {\n var _c3 = this.table.columnList[_i4];\n if (!_c3.selected) continue;\n var _column2 = {}; //大文本类型与一些未明确的字段类型不可作为排序字段\n\n if (_c3.columnType == 'clob' || !_c3.columnType) {\n errorMsg += _c3.fieldName + \" \";\n continue;\n }\n\n _column2.field = _c3.fieldName;\n _column2.sortType = \"asc\";\n _column2.comment = _c3.comment;\n\n var _show2 = this.judgeAryData(this.treeSidebarData.sortfield, _column2);\n\n if (_show2) {\n this.treeSidebarData.sortfield.push(_column2);\n }\n }\n\n if (errorMsg) {\n this.$message.error('字段:' + errorMsg + '的字段类型不支持作为排序字段');\n } //去除重复项\n\n\n this.treeSidebarData.sortfield.unique(function (a, b) {\n return a.field == b.field;\n });\n }\n },\n //判断是否存在重复字段\n judgeAryData: function judgeAryData(data, column) {\n var show = true;\n\n for (var i = 0; i < data.length; i++) {\n if (data[i].field == column.field && data[i].comment == column.comment) {\n show = false;\n break;\n }\n }\n\n return show;\n },\n //删除字段\n deleteSetting: function deleteSetting(list, index) {\n list.splice(index, 1);\n },\n sourceListChang: function sourceListChang(item) {\n //条件字段是参数传入或动态传入,但是固定值还有值,则清空固定值\n if ((item.defaultType == \"1\" || item.defaultType == \"4\") && item.defaultValue != \"\") {\n for (var i = 0; i < this.treeSidebarData.conditionfield.length; i++) {\n if ((this.treeSidebarData.conditionfield[i].defaultType == \"1\" || this.treeSidebarData.conditionfield[i].defaultType == \"4\") && this.treeSidebarData.conditionfield[i].defaultValue != \"\") {\n this.treeSidebarData.conditionfield[i].defaultValue = \"\";\n }\n }\n }\n },\n //打开设置列弹框\n showSettingDialog: function showSettingDialog() {\n var _this4 = this;\n\n this.tabStatus = \"return\"; //默认打开返回字段\n\n this.dialogVisibleSetting = true;\n\n if (this.treeSidebarData.conditionfield && this.treeSidebarData.conditionfield.length > 0 && this.selectOptions.length == 0) {\n this.treeSidebarData.conditionfield.forEach(function (item) {\n if (item.defaultType == \"1\") {\n var selectOp = {};\n selectOp.field = item.field;\n selectOp.comment = item.comment;\n\n _this4.selectOptions.push(selectOp);\n }\n });\n }\n\n if (this.treeSidebarData.sqlBuildType === 0 || !this.treeSidebarData.sqlBuildType) {\n this.isSqlBuildType = false;\n } else {\n this.isSqlBuildType = true;\n }\n\n if (this.treeSidebarData.name) {\n this.titleSetting = this.treeSidebarData.name + \"-设置列\";\n } else {\n this.titleSetting = \"未命名-设置列\";\n } //打开设置如果是数据源,先获取数据源的字段\n\n\n if (this.treeSidebarData.dsType == \"dataSource\") {\n var params = {\n dsalias: this.treeSidebarData.dsalias,\n isTable: this.treeSidebarData.isTable,\n objName: this.treeSidebarData.objName\n };\n var this_ = this; //获取数据源的字段\n\n var url = window.context.form + \"/form/customQuery/v1/getTable\";\n req.post(url, params).then(function (data) {\n this_.table = data.data.table;\n this_.handleFilterColumn();\n });\n } //打开设置列如果不是数据源\n\n\n if (this.treeSidebarData.dsType != \"dataSource\") {\n //值来源数组_树改变如下\n this.value_sourceList_tree = [{\n key: \"固定值\",\n value: \"2\"\n }]; //判断REST接口是否是GET请求\n\n if (this.treeSidebarData.requestType == \"GET\") {\n //运算条件数组-varchar改变如下\n this.string_opList = [{\n value: \"等于\",\n key: \"EQ\"\n }];\n } else {\n //运算条件数组-varchar改变如下\n this.string_opList = [{\n value: \"like\",\n key: \"LK\"\n }];\n }\n\n if (this.treeSidebarData.conditionfield) {\n this.treeSidebarData.conditionfield.forEach(function (item) {\n if (item.defaultValue == \"1\") {\n var selectOp = {};\n selectOp.field = item.field;\n selectOp.comment = item.comment;\n\n _this4.selectOptions.push(selectOp);\n }\n });\n } //字段设置为空\n\n\n this.table = {\n columnList: []\n };\n }\n },\n //查询数据源表或视图\n getByDsObjectName: function getByDsObjectName() {\n if (this.treeSidebarData.id) {\n return;\n }\n\n if (this.treeSidebarData.dsalias == null) {\n Message.warning(\"请选择数据源\");\n return;\n }\n\n this.params = {};\n this.params.dsalias = this.treeSidebarData.dsalias;\n this.params.isTable = this.treeSidebarData.isTable;\n this.params.objName = this.objName;\n var this_ = this;\n var url = window.context.form + \"/form/customQuery/v1/getByDsObjectName\";\n req.post(url, this_.params).then(function (data) {\n this_.tableOrViewList = []; //每次查询前先设置为空\n\n if (!data || data.data.length == 0) {\n Message.warning(\"该数据源中未查询到表或视图\");\n return;\n }\n\n Message.success(\"查询成功\");\n\n for (var i = 0; i < data.data.length; i++) {\n data.data[i].comment = data.data[i].name + \"(\" + data.data[i].comment + \")\";\n this_.tableOrViewList.push(data.data[i]);\n } //选择表或试图时默认选择第一个\n\n\n this_.treeSidebarData.objName = this_.tableOrViewList[0].name;\n });\n },\n //关闭侧边栏\n handleClose: function handleClose() {\n this.treeSidebarData = {}; //清除保存过的数据\n\n this.isSqlBuildType = false;\n this.dialogVisible = false;\n },\n //关联查询新增修改保存后操作\n afterSaveData: function afterSaveData() {\n if (this.treeSidebarData.conditionfield.length == 0) {\n this.selectOptions = [];\n }\n\n this.dialogVisible = false;\n this.$refs.htTable.load(); //重新加载列表数据\n },\n //关联查询新增修改保存前操作\n beforeSaveData: function beforeSaveData() {\n if (!this.innerValidation) {\n Message.warning(\"设置列校验失败,请进入设置列中完善信息并点击右上角保存按钮\");\n this.isSubmit = false;\n return;\n } //如果数据来源不是数据源则没有所属数据源\n\n\n if (this.treeSidebarData.dsType != \"dataSource\") {\n this.treeSidebarData.dsalias = \"\";\n } //sql生成的方式(0:页面设置 1:diy)\n\n\n if (this.isSqlBuildType) {\n this.treeSidebarData.sqlBuildType = 1;\n } else {\n this.treeSidebarData.sqlBuildType = 0;\n }\n\n if (this.treeSidebarData.dsType == \"dataSource\" && !this.treeSidebarData.id) {\n if (this.treeSidebarData.objName == \"\") {\n Message.warning(\"请选择表或视图\");\n this.isSubmit = false;\n return;\n }\n }\n\n if (this.treeSidebarData.resultfield.length == 0) {\n Message.warning(\"请设置需要返回的字段\");\n this.isSubmit = false;\n return;\n }\n\n this.isSubmit = true; //保存成功后清除vuex中的数据,预览时不用再刷新\n\n this.$store.dispatch(\"form/clearCustomQuery\", this.treeSidebarData.alias);\n },\n //点击按钮打开侧边栏\n showDialog: function showDialog(action, id) {\n this.dialogVisible = true;\n\n if (action) {\n this.objName = \"\";\n\n if (action == \"add\") {\n this.title = \"添加关联查询\";\n this.disabled = false;\n this.treeSidebarData = {\n objName: \"\",\n conditionfield: [],\n resultfield: [],\n sortfield: [],\n needPage: 0,\n dsType: \"dataSource\",\n isTable: 1,\n dsalias: \"LOCAL\",\n alias: \"\",\n requestType: \"POST\",\n pageKey: \"page\",\n pageSizeKey: \"pageSize\",\n totalKey: \"total\",\n listKey: \"\",\n name: \"\",\n pageSize: 10\n };\n } else if (action == \"edit\") {\n this.disabled = true;\n this.title = \"编辑关联查询\";\n this.getDialogById(id); //根据关联查询信息ID查询关联查询所有信息\\\n }\n }\n },\n //根据关联查询信息ID查询关联查询所有信息\n getDialogById: function getDialogById(id, action) {\n var this_ = this;\n if (!id) return;\n var url = window.context.form + \"/form/customQuery/v1/\" + id;\n req.get(url).then(function (data) {\n data = data.data;\n this_.treeSidebarData = data;\n this_.treeSidebarData.resultfield = JSON.parse(data.resultfield);\n this_.treeSidebarData.sortfield = JSON.parse(data.sortfield);\n this_.treeSidebarData.conditionfield = JSON.parse(data.conditionfield); //添加为对话框\n\n if (action && action == \"add\") {\n if (this_.treeSidebarData.needPage == 0) {\n this_.treeSidebarData.needPage = false;\n } else {\n this_.treeSidebarData.needPage = true;\n }\n\n for (var i = 0; i < this_.treeSidebarData.resultfield.length; i++) {\n this_.treeSidebarData.resultfield[i].idKey = \"0\";\n this_.treeSidebarData.resultfield[i].AggFuncOp = \"\"; //合计函数运算符\n }\n\n var _url = window.context.form + \"/form/customQuery/v1/saveDialogByQuery\";\n\n req.post(_url, this_.treeSidebarData).then(function (rep) {\n rep = rep.data;\n\n if (rep && rep.state) {\n Message.success(rep.message);\n } else {\n Message.error(rep.message || \"保存失败\");\n }\n });\n }\n });\n },\n //页面加载显示数据\n loadData: function loadData(param, cb) {\n var _this5 = this;\n\n // param.sorter = [{ property: \"CREATE_TIME_\", direction: \"DESC\" }]; //排序字段\n req.post(window.context.form + \"/form/customQuery/v1/list\", param).then(function (response) {\n _this5.data = response.data.rows;\n _this5.pageResult = {\n page: response.data.page,\n pageSize: response.data.pageSize,\n total: response.data.total\n };\n }).finally(function () {\n return cb();\n });\n },\n handleCommond: function handleCommond(param) {\n switch (param.command) {\n case \"preview\":\n this.preview(param.row);\n break;\n\n case \"dialog\":\n this.saveDialogByQuery(param.row.id);\n break;\n }\n },\n // 设置参数的面板中tab切换时\n handleTabSwitch: function handleTabSwitch(m) {\n var _this6 = this;\n\n if (m.name == \"dataParam\") {\n this.$refs.dataParamCode && this.$refs.dataParamCode.refresh();\n } // 选中自定义SQL tab\n\n\n if (m.name == \"custom\") {\n // 清空自定义sql条件字段\n this.selectOptions.splice(0, this.selectOptions.length);\n\n if (this.treeSidebarData.conditionfield) {\n this.treeSidebarData.conditionfield.forEach(function (item) {\n if (item.defaultType == \"1\") {\n var selectOp = {};\n selectOp.field = item.field;\n selectOp.comment = item.comment;\n\n _this6.selectOptions.push(selectOp);\n }\n });\n }\n }\n },\n handleExport: function handleExport() {\n var selection = this.$refs.htTable.$refs.htTable.selection;\n\n if (!selection || selection.length == 0) {\n this.$message({\n type: \"warning\",\n message: \"请至少选择一条数据\"\n });\n return;\n }\n\n var ids = [];\n\n for (var i = 0; i < selection.length; i++) {\n ids.push(selection[i].id);\n }\n\n req.download(window.context.form + \"/form/customQuery/v1/export?ids=\" + ids.join(\",\"));\n },\n //上传对话框关闭\n beforeClose: function beforeClose() {\n this.fileList = [];\n this.uploadDialogVisible = false;\n },\n handleImport: function handleImport(param) {\n var _this7 = this;\n\n var formData = new FormData();\n formData.append(\"file\", param.file);\n form.importCustomQuery(formData).then(function (resp) {\n if (resp.state) {\n _this7.$message({\n type: \"success\",\n message: resp.message\n });\n\n _this7.beforeClose();\n\n _this7.$refs.htTable.load(); //重新加载列表数据\n\n } else {\n _this7.beforeClose();\n }\n });\n },\n uploadSubmit: function uploadSubmit() {\n if (this.$refs.elUpload.uploadFiles.length == 0) {\n this.$message({\n type: \"warning\",\n message: \"请上传文件\"\n });\n }\n\n this.$refs.elUpload.submit();\n },\n handleFilterColumn: function handleFilterColumn() {\n for (var i = this.table.columnList.length - 1; i >= 0; i--) {\n if (this.table.columnList[i].fieldName && this.table.columnList[i].fieldName.toLowerCase() == \"f_form_data_rev_\") {\n this.table.columnList.splice(i, 1);\n }\n }\n }\n },\n mounted: function mounted() {\n this.$validator = this.$root.$validator;\n var this_ = this; //获取数据源池\n\n req.get(window.context.portal + \"/sys/sysDataSource/v1/getDataSources\").then(function (data) {\n this_.dataSourcesInBean = data.data;\n });\n }\n};",null]}