{"remainingRequest":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\cssc-fvue\\src\\components\\ImportExportData\\AddFields.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\cssc-fvue\\src\\components\\ImportExportData\\AddFields.vue","mtime":1667804638384},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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 portal from '@/api/portal'\r\nexport default {\r\n name: 'AddFields',\r\n props: {\r\n // 页面组件别名\r\n bizCode: {\r\n type: String,\r\n default: '',\r\n required: true,\r\n },\r\n type: {\r\n type: String,\r\n default: 'import',\r\n required: true,\r\n },\r\n originAPIOptions: {\r\n type: Object,\r\n default: () => {},\r\n required: true,\r\n },\r\n dataBaseOptions: {\r\n type: Object,\r\n default: () => {},\r\n required: true,\r\n },\r\n },\r\n data() {\r\n return {\r\n dialogShow: false,\r\n tableHeight: 300,\r\n currentPage: 1,\r\n total: 0,\r\n multipleSelection: [],\r\n data: [],\r\n selectFields: [],\r\n selectData: [],\r\n data1: [],\r\n data2: [],\r\n loading: false\r\n }\r\n },\r\n mounted() {\r\n this.calcTableHeight()\r\n this.$root.$on('resize', () => {\r\n this.calcTableHeight(500)\r\n })\r\n },\r\n computed: {\r\n title() {\r\n if (this.type == 'import') {\r\n return '导入模板添加字段'\r\n } else {\r\n return '导出模板添加字段'\r\n }\r\n },\r\n },\r\n methods: {\r\n // tableData.slice((currentPage - 1) * pageSize,currentPage * pageSize)\r\n handleCurrentChange(current) {\r\n console.log(current, 'current')\r\n this.data = this[`data${current}`]\r\n this.$nextTick(() => {\r\n this.$refs.allFieldsTable.clearSelection()\r\n this.data.forEach((element) => {\r\n if (this.selectFields.includes(element.fieldName)) {\r\n console.log(element)\r\n console.log(this.$refs)\r\n this.$nextTick(() => {\r\n this.$refs.allFieldsTable.toggleRowSelection(\r\n element,\r\n true\r\n )\r\n })\r\n }\r\n })\r\n })\r\n },\r\n loadData() {\r\n this.loading = true\r\n if (this.type == 'import') {\r\n let data = {\r\n dataBaseId: this.dataBaseOptions.dataBaseId,\r\n tableName: this.dataBaseOptions.tableName,\r\n tableSchema: this.dataBaseOptions.tableSchema,\r\n }\r\n let params = this.qs.stringify(data)\r\n portal.getAllImportFields(params).then((res) => {\r\n res.forEach((item) => {\r\n item.fieldName = item.columnName\r\n item.fieldComments = item.columnComment\r\n })\r\n this.data = res\r\n console.log(res)\r\n }).finally(()=>{\r\n this.loading = false\r\n })\r\n } else if (this.type == 'export') {\r\n let params = {\r\n originAPIOptions: this.originAPIOptions,\r\n bizCode: this.bizCode,\r\n }\r\n console.log(params, 'params')\r\n portal.getAllExportFields(params).then((res) => {\r\n let index = res.indexOf(']')\r\n let resData = JSON.parse(res.slice(0, index + 2)).fields\r\n if (Array.isArray(resData)) {\r\n resData.forEach((item) => {\r\n item.fieldName = item.fieldName\r\n item.fieldComments = item.fieldDesc\r\n })\r\n this.data = resData\r\n }\r\n }).finally(()=>{\r\n this.loading = false\r\n })\r\n }\r\n },\r\n openDialog() {\r\n this.dialogShow = true\r\n this.loadData()\r\n },\r\n closeDialog() {\r\n this.dialogShow = false\r\n this.data = []\r\n this.selectFields = []\r\n this.selectData = []\r\n },\r\n handleOk() {\r\n this.$emit('addFiedls', this.selectData)\r\n this.closeDialog()\r\n },\r\n handleSelectionChange(selection) {\r\n selection.forEach((element) => {\r\n if (!this.selectFields.includes(element.fieldName)) {\r\n this.selectFields.push(element.fieldName)\r\n this.selectData.push(element)\r\n }\r\n })\r\n },\r\n handleDelFields(row) {\r\n this.selectData = this.selectData.filter(\r\n (item) => item.fieldName !== row.fieldName\r\n )\r\n this.selectFields = this.selectFields.filter(\r\n (item) => item !== row.fieldName\r\n )\r\n },\r\n // 动态计算表格的高度,自适应当前容器\r\n calcTableHeight(delay) {\r\n // let gap = this.type == 'import' ? 206 : 236\r\n let gap = 200\r\n setTimeout(() => {\r\n this.tableHeight =\r\n document.documentElement.clientHeight * 0.9 - gap\r\n }, delay || 0)\r\n },\r\n },\r\n}\r\n",null]}