{"remainingRequest":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\examine-fvue\\src\\components\\ImportExportData\\FormatJson.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\examine-fvue\\src\\components\\ImportExportData\\FormatJson.vue","mtime":1667280203717},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/web.dom.iterable\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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 utils from '@/hotent-ui-util';\nimport SelectDict from '@/components/ImportExportData/SelectDict';\nimport SelectRelative from '@/components/ImportExportData/SelectRelative';\nimport CustomQuery from '@/components/ImportExportData/CustomQuery.js';\nexport default {\n name: 'FormatJson',\n components: {\n SelectDict: SelectDict,\n SelectRelative: SelectRelative\n },\n data: function data() {\n return {\n dialogShow: false,\n tableHeight: 300,\n currentScope: {},\n data: [{\n key: 0,\n value: '',\n label: ''\n }]\n };\n },\n mounted: function mounted() {\n var _this = this;\n\n this.calcTableHeight();\n this.$root.$on('resize', function () {\n _this.calcTableHeight(500);\n });\n },\n methods: {\n getDictData: function getDictData(dictCode) {\n if (sessionStorage.getItem('dict_data')) {\n var dict_data = JSON.parse(sessionStorage.getItem('dict_data'));\n\n if (dict_data[dictCode]) {\n var dictItem = dict_data[dictCode]; // 格式key 是值 value 是显示值\n\n dictItem.forEach(function (item, index) {\n item.key = dictCode + index;\n item.value = item.value;\n item.label = item.name;\n });\n return dictItem;\n }\n }\n },\n changeDict: function changeDict(dictCode) {\n var newDictItems = this.getDictData(dictCode);\n\n if (this.data.length == 1) {\n if (!this.data[0].value && !this.data[0].label) {\n this.data = newDictItems;\n }\n } else {\n this.data = this.data.concat(newDictItems);\n }\n },\n handleOpenDict: function handleOpenDict() {\n this.$refs.selectDict.openDialog();\n },\n changeRelative: function changeRelative(row, fields) {\n var _this2 = this;\n\n CustomQuery.load(row.alias).then(function (relativeData) {\n console.log(relativeData, 'relativeData');\n\n _this2.formatRelativeData(relativeData, fields);\n });\n },\n //加载关联查询数据\n formatRelativeData: function formatRelativeData(relativeData, fields) {\n var tempData = [];\n relativeData.forEach(function (item) {\n tempData.push({\n key: item.id,\n value: item[fields.value],\n label: item[fields.label]\n });\n });\n\n if (this.data.length == 1) {\n if (!this.data[0].value && !this.data[0].label) {\n this.data = tempData;\n }\n } else {\n this.data = this.data.concat(tempData);\n }\n },\n handleOpenRelative: function handleOpenRelative() {\n this.$refs.selectRelative.openDialog();\n },\n handleAdd: function handleAdd() {\n this.data.push({\n key: this.data.length + 1,\n value: '',\n label: ''\n });\n },\n handleDel: function handleDel(key) {\n var dataTemp = utils.deepClone(this.data);\n var filterData = dataTemp.filter(function (item) {\n return item.key !== key;\n });\n this.data = filterData;\n },\n openDialog: function openDialog(scope) {\n this.dialogShow = true;\n this.currentScope = scope;\n this.currentScope.row.fieldDataJson ? this.data = JSON.parse(this.currentScope.row.fieldDataJson) : null;\n },\n formatJson: function formatJson() {\n var _this3 = this;\n\n var result;\n var objValue = {};\n var objLabel = {};\n this.data.forEach(function (item, index) {\n if (!item.value) {\n item.valueFailed = true;\n item.valueTips = '请完善数据';\n\n _this3.$nextTick(function () {\n _this3.$message.warning(\"\\u8BF7\\u5B8C\\u5584\\u6570\\u636E!\");\n });\n } else if (objValue[item.value]) {\n item.valueFailed = true;\n item.valueTips = '字段实际值重复';\n\n _this3.$nextTick(function () {\n _this3.$message.warning(\"\\u5B57\\u6BB5\\u5B9E\\u9645\\u503C\\u91CD\\u590D!\");\n });\n } else if (item.value && !objValue[item.value]) {\n objValue[item.value] = true;\n item.valueFailed = false;\n item.valueTips = '';\n }\n\n if (!item.label) {\n item.labelFailed = true;\n item.labelTips = '请完善数据';\n\n _this3.$nextTick(function () {\n _this3.$message.warning(\"\\u8BF7\\u5B8C\\u5584\\u6570\\u636E!\");\n });\n } else if (objLabel[item.label]) {\n item.labelFailed = true;\n item.labelTips = '字段显示值重复';\n\n _this3.$nextTick(function () {\n _this3.$message.warning(\"\\u5B57\\u6BB5\\u663E\\u793A\\u503C\\u91CD\\u590D!\");\n });\n } else if (item.label && !objLabel[item.label]) {\n objValue[item.label] = true;\n item.labelFailed = false;\n item.labelTips = '';\n }\n\n if (!item.labelFailed && !item.valueFailed) {\n item.pass = true;\n } else {\n item.pass = false;\n item.key = new Date().getTime() + index;\n }\n });\n var isResultFalse = this.data.some(function (item) {\n if (!item.pass) {\n return true;\n }\n });\n console.log(this.data, 'this.data');\n\n if (!isResultFalse) {\n result = [];\n this.data.forEach(function (item) {\n var tempObj = {\n value: item.value,\n label: item.label\n };\n result.push(tempObj);\n });\n } else {\n this.$forceUpdate();\n result = false;\n }\n\n return result;\n },\n handleOk: function handleOk() {\n if (this.data.length) {\n var json = this.formatJson();\n\n if (!json) {\n return;\n } else {\n this.$emit('getJson', JSON.stringify(json), this.currentScope);\n }\n } else {\n this.$emit('getJson', '', this.currentScope);\n }\n\n this.closeDialog();\n },\n closeDialog: function closeDialog() {\n this.data = [{\n key: 0,\n value: '',\n label: ''\n }];\n this.dialogShow = false;\n },\n // 动态计算表格的高度,自适应当前容器\n calcTableHeight: function calcTableHeight(delay) {\n var _this4 = this;\n\n setTimeout(function () {\n _this4.tableHeight = document.documentElement.clientHeight * 0.9 - 200;\n }, delay || 0);\n }\n }\n};",null]}