{"remainingRequest":"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\\customDialog\\CustomDialogShow.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\form\\customDialog\\CustomDialogShow.vue","mtime":1675071992928},{"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":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\r\nimport { Message } from \"element-ui\";\r\nimport req from \"@/request.js\";\r\nimport CustomDialogShowDetail from \"@/views/form/customDialog/CustomDialogShowDetail.vue\";\r\nexport default {\r\n name: \"custom-dialog-show\",\r\n components: { CustomDialogShowDetail },\r\n props: {\r\n title: {\r\n type: String,\r\n required: true,\r\n default: \"自定义对话框列表预览\"\r\n },\r\n //自定义对话框的别名\r\n alias: {\r\n type: String,\r\n required: true\r\n },\r\n //自定义对话框的配置\r\n customDialog: {\r\n type: Object,\r\n required: true\r\n }\r\n },\r\n data() {\r\n return {\r\n customDialogPostParam: [], //为REST接口且请求类型是POST,条件字段是固定值的参数\r\n customDialogGetUrl: \"\", //为REST接口且请求类型是GET,条件字段是固定值的请求地址\r\n selectionRadio: [], //ht-table列表单选选择的数据\r\n textRadio: \"\", //ht-table列表数据的单选按钮\r\n selectable: true, //表示ht-table列表第一列是否显示复选框\r\n isShowSearch: false, //是否显示高级搜索\r\n nopagination: false, //是否隐藏分页组件,false:显示,true:隐藏\r\n dialogVisible: false, //是否显示对话框\r\n tableData: [], //ht-table列表数据\r\n pageResult: {\r\n page: 1,\r\n pageSize: 20,\r\n total: 0\r\n }\r\n };\r\n },\r\n methods: {\r\n //显示对话框\r\n showDialog() {\r\n this.customDialogPostParam = []; //清空为REST接口且请求类型是POST,条件字段是固定值的参数\r\n this.customDialogGetUrl = \"\"; //清空为REST接口且请求类型是GET,条件字段是固定值的请求地址\r\n this.selectionRadio = []; //清空ht-table列表单选选择的数据\r\n this.textRadio = \"\"; //清空ht-table列表数据单选按钮的选中状态\r\n this.isShowSearch = false; //不显示高级搜索\r\n this.dialogVisible = true;\r\n // setTimeout(() => {\r\n // this.$refs.customDialogShowDetail.initData();\r\n // });\r\n },\r\n //点击列表某一条数据时触发\r\n orgRowClick(row) {\r\n this.selectionRadio = [row];\r\n },\r\n //确定对话框\r\n handleSave() {\r\n let elTable = this.$refs.customDialogShowDetail.$refs.htTable;\r\n if (elTable && elTable.$refs.htTable) {\r\n elTable = elTable.$refs.htTable;\r\n }\r\n //多选\r\n if (\r\n elTable &&\r\n elTable.selection &&\r\n elTable.selection.length == 0 &&\r\n this.customDialog.selectNum === -1\r\n ) {\r\n Message.error(\"请至少选择一条数据\");\r\n return;\r\n }\r\n //单选\r\n if (this.selectionRadio == 0 && this.customDialog.selectNum === 1) {\r\n Message.error(\"请至少选择一条数据\");\r\n return;\r\n }\r\n //拿到配置的返回字段\r\n let returnStr = this.customDialog.resultfield;\r\n //返回字段的字段名有多少个\r\n let field = new Array([returnStr.length]);\r\n //返回字段的返回名称有多少个\r\n let comment = new Array([returnStr.length]);\r\n let str = [];\r\n for (let i = 0; i < returnStr.length; i++) {\r\n //得到返回字段的字段名\r\n field[i] =\r\n this.customDialog.dsType == \"dataSource\"\r\n ? returnStr[i].field\r\n : returnStr[i].field;\r\n //得到返回字段的返回名称\r\n comment[i] =\r\n this.customDialog.dsType == \"dataSource\"\r\n ? returnStr[i].comment\r\n : returnStr[i].comment;\r\n }\r\n let s = [];\r\n //获取选择的数据集合\r\n if (this.customDialog.selectNum === 1) {\r\n s = this.selectionRadio;\r\n } else {\r\n s = elTable.selection;\r\n }\r\n this.$emit(\"return-all-data\", s);\r\n //是否单选 1:单选;-1:多选\r\n if (this.customDialog.selectNum === 1) {\r\n let temp = \"\";\r\n for (let i = 0; i < comment.length; i++) {\r\n temp += '\"' + comment[i] + '\":\"' + s[0][field[i]] + '\",';\r\n }\r\n //去除字符串最后一个字符逗号\r\n if (temp != \"\") {\r\n temp = \"{\" + temp.substring(0, temp.length - 1) + \"}\";\r\n }\r\n str.push(JSON.parse(temp));\r\n } else {\r\n for (let i = 0; i < s.length; i++) {\r\n var temp = \"\";\r\n for (let j = 0; j < comment.length; j++) {\r\n temp += '\"' + comment[j] + '\":\"' + s[i][field[j]] + '\",';\r\n }\r\n //去除字符串最后一个字符逗号\r\n if (temp != \"\") {\r\n temp = \"{\" + temp.substring(0, temp.length - 1) + \"}\";\r\n }\r\n str.push(JSON.parse(temp));\r\n }\r\n }\r\n //发布确认事件,并返回选中的数据\r\n this.$emit(\"handle-save\", str);\r\n this.dialogVisible = false;\r\n },\r\n //关闭对话框\r\n handleClose() {\r\n this.dialogVisible = false;\r\n }\r\n }\r\n};\r\n",null]}