{"remainingRequest":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\examine-fvue\\src\\components\\eipControl\\EipSubtableBackfill.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\examine-fvue\\src\\components\\eipControl\\EipSubtableBackfill.vue","mtime":1667280204061},{"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":["//\n//\n//\n//\n\r\nimport utils from \"@/utils.js\";\r\nimport hotentUtils from \"@/hotent-ui-util.js\";\r\nimport CustomQuery from \"@/components/eipControl/bus/CustomQuery.js\";\r\n\r\n\r\nexport default {\r\n name: \"eip-subtable-backfill\",\r\n props: [\r\n \"customQuery\"\r\n ],\r\n data() {\r\n return {\r\n };\r\n },\r\n computed: {\r\n\r\n },\r\n mounted() {\r\n\r\n const pInst = utils.getOnlineFormInstance(this);\r\n let oldParams = \"\";\r\n let readyLoad = true;\r\n if(this.customQuery.path && this.customQuery.alias && this.customQuery.conditionfield.length>0 ){\r\n pInst.$watch(this.customQuery.path,(newV,oldV)=>{\r\n if(newV && newV.length>=1 && readyLoad ){\r\n let params = this.prepareLoadParams(newV,this.customQuery.conditionfield); \r\n readyLoad = false;\r\n CustomQuery.load(this.customQuery.alias, params).then((data) => {\r\n this.backfill(newV,data);\r\n setTimeout(()=>{\r\n readyLoad = true;\r\n },800);\r\n });\r\n }\r\n },{ immediate: true });\r\n }\r\n },\r\n created() {\r\n\r\n },\r\n methods: {\r\n backfill(subArr,rows){\r\n\r\n if(this.customQuery.resultfield){\r\n subArr.forEach(subRow=>{\r\n let dbData = rows.filter(row=>{\r\n return row[this.customQuery.conditionfield[0].field] == subRow[this.customQuery.conditionfield[0].fieldPath]\r\n });\r\n if(dbData[0]){\r\n this.customQuery.resultfield.forEach(setting=>{\r\n if(setting.fieldPath){\r\n subRow[setting.fieldPath] = dbData[0][setting.field];\r\n }\r\n }) \r\n }\r\n });\r\n }\r\n const pInst = utils.getOnlineFormInstance(this);\r\n let subArrTemp =Object.assign([], subArr);\r\n eval(\"(pInst.\"+this.customQuery.path+\"=subArrTemp)\");\r\n },\r\n // 准备查询参数\r\n prepareLoadParams: function(subArr,condition) {\r\n let params = {};\r\n if (condition && !hotentUtils.isEmpty(condition)) {\r\n // 获取当前控件是否在子表某行中\r\n let { index } = hotentUtils.getSubScopeElAndIndex(this.$el);\r\n\r\n const pInst = utils.getOnlineFormInstance(this);\r\n Object.keys(condition).forEach(k => {\r\n let val = subArr.extractByKey(condition[k][\"fieldPath\"]);\r\n if (!hotentUtils.isEmpty(val)) {\r\n params[condition[k][\"field\"]] = val.join(\",\");\r\n }\r\n });\r\n }\r\n return params;\r\n },\r\n // 动态加载选项\r\n dynamicLoadOption: function() {\r\n const params = this.prepareLoadParams(this.ganged.bind);\r\n this.$emit(\"dynamic-options:load\", this.ganged.alias, params);\r\n },\r\n // 动态加载选项返回值处理\r\n dynamicOptionResponse: function(alias, data) {\r\n if (\r\n this.ganged &&\r\n this.ganged.alias == alias &&\r\n this.ganged.valueBind &&\r\n this.ganged.labelBind\r\n ) {\r\n this.options = [];\r\n if (data && data.constructor == Array && data.length > 0) {\r\n data.forEach(d => {\r\n this.options.push({\r\n key: d[this.ganged.valueBind] + \"\",\r\n value: d[this.ganged.labelBind] + \"\"\r\n });\r\n });\r\n }\r\n } else if (\r\n this.ganged &&\r\n this.ganged.alias &&\r\n (!this.ganged.valueBind || !this.ganged.labelBind)\r\n ) {\r\n let name = this.inputName;\r\n this.$message.error(\r\n `下拉框【${name.split(\"-\")[1]}】配置了动态选项,但是没有正确的配置选项绑定关系。`\r\n );\r\n }\r\n },\r\n // 触发绑定的关联查询\r\n relatedQueryLoad: function() {\r\n if (\r\n this.relatedQuery &&\r\n this.relatedQuery.constructor == Array &&\r\n this.relatedQuery.length > 0\r\n ) {\r\n // 遍历所有的关联查询,逐个触发\r\n this.relatedQuery.forEach(q => {\r\n const params = this.prepareLoadParams(q.condition);\r\n this.$emit(\"related-query:load\", q.alias, params, q.result);\r\n });\r\n }\r\n }\r\n }\r\n};\r\n",null]}