{"remainingRequest":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\cssc-fvue\\src\\components\\eipControl\\EipHotSubDialog.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\cssc-fvue\\src\\components\\eipControl\\EipHotSubDialog.vue","mtime":1667804639071},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"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":["import \"core-js/modules/es6.regexp.constructor\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport _typeof from \"D:/jenkins/workspace/cssc-fvue/node_modules/@babel/runtime/helpers/esm/typeof\";\nimport \"core-js/modules/es6.regexp.search\";\nimport _toConsumableArray from \"D:/jenkins/workspace/cssc-fvue/node_modules/@babel/runtime/helpers/esm/toConsumableArray\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/web.dom.iterable\";\nimport \"core-js/modules/es6.regexp.split\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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 { mapState } from \"vuex\";\nimport utils from \"@/utils.js\";\nimport { Message } from \"element-ui\";\nexport default {\n name: \"ht-hot-subDialog\",\n props: [\"validate\", \"value\", \"btnName\", \"atter\", \"single\", \"custdialog\"],\n data: function data() {\n return {\n customDialogShowList: false,\n customDialogShowTree: false,\n selectOrgProps: {\n label: \"btnName\"\n },\n style: \"\",\n //对话框宽高\n selectOrgs: null,\n inputSuffixHeight: 30,\n config: null,\n updating: false,\n displayfield: [],\n //显示字段\n customDialog: {},\n //\n comment: \"\",\n queryParam: \"\",\n props1: [],\n showData: [],\n checkBoxDataAll: [],\n //选中对象的集合\n defaultProps: {\n children: \"childrens\",\n label: \"label\"\n },\n propsData: [],\n querysShow: false,\n //是否显示搜索框\n undefineda: \"\",\n opMap: {\n 'EQ': 'EQUAL',\n 'GE': 'GREAT_EQUAL',\n 'GT': 'GREAT',\n 'LT': 'LESS',\n 'LE': 'LESS_EQUAL',\n 'IN': 'IN',\n 'LK': 'LIKE',\n 'LFK': 'LEFT_LIKE',\n 'RHK': 'RIGHT_LIKE'\n }\n };\n },\n computed: mapState({\n pagination: function pagination(state) {\n return state.dialog.pagination;\n },\n total: function total(state) {\n return state.dialog.total;\n },\n dialogData: function dialogData(state) {\n return state.dialog.rows;\n },\n inputVal: function inputVal() {\n if (!this.value) {\n return null;\n } else {\n var nameAry = this.value.split(\",\");\n\n if (this.value.indexOf(\"||\") > 0) {\n nameAry = this.value.split(\"||\")[0].split(\",\");\n this.showData = JSON.parse(this.value.split(\"||\")[1]);\n }\n\n var idAry = null;\n var accountAry = null;\n var result = [];\n nameAry.forEach(function (m, i) {\n var n = {\n value: m\n };\n result.push(n);\n });\n return result;\n }\n },\n inputWriteable: function inputWriteable() {\n return utils.getWriteable(this.permission);\n },\n inputValidate: function inputValidate() {\n var validateObj = this.$store.state.index.validate;\n return utils.addRequiredOrNot(this.permission, this.validate, validateObj, this);\n },\n inputName: function inputName() {\n return this.name ? this.name : utils.getName();\n },\n // 是否有回填设置\n bindSet: function bindSet() {\n return this.selectorconfig ? this.selectorconfig.bind : null;\n },\n getPlaceholder: function getPlaceholder() {\n return this.custdialog.name;\n }\n }),\n mounted: function mounted() {},\n created: function created() {\n this.$validator = this.$root.$validator;\n },\n watch: {\n customDialogShowTree: function customDialogShowTree(newVal) {\n if (newVal) {\n this.checkBoxDataAll = [];\n\n if (this.inputVal && this.inputVal.constructor == Array) {\n this.selectOrgs = _toConsumableArray(this.inputVal);\n } else {\n this.selectOrgs = [];\n }\n }\n },\n customDialogShowList: function customDialogShowList(newVal) {\n if (newVal) {\n this.checkBoxDataAll = [];\n\n if (this.inputVal && this.inputVal.constructor == Array) {\n this.selectOrgs = _toConsumableArray(this.inputVal);\n } else {\n this.selectOrgs = [];\n }\n }\n }\n },\n methods: {\n handleSizeChange: function handleSizeChange(size) {\n //每页下拉显示数据\n this.$store.dispatch(\"dialog/setPaginationSize\", size);\n this.search();\n },\n handleCurrentChange: function handleCurrentChange(currentPage) {\n var this_ = this;\n\n if (this.selectOrgs != undefined && this.selectOrgs.length > 0) {\n this.selectOrgs.forEach(function (row) {\n var res = this_.indexArray(this_.checkBoxDataAll, row);\n\n if (res == -1) {\n this_.checkBoxDataAll.push(row);\n }\n });\n }\n\n this_.selectOrgs = this_.checkBoxDataAll; //点击第几页\n\n this.$store.dispatch(\"dialog/setPaginationPageNum\", currentPage);\n this.search();\n },\n checkList: function checkList() {\n var this_ = this;\n setTimeout(function () {\n if (this_.selectOrgs != undefined && this_.selectOrgs.length > 0) {\n if (this_.selectOrgs == undefined || this_.selectOrgs.length == 0) {\n this_.selectOrgs = this_.checkBoxDataAll;\n }\n\n if (this_.selectOrgs != undefined && this_.selectOrgs.length > 0) {\n this_.selectOrgs.forEach(function (row) {\n var res = this_.indexArray(this_.dialogData, row);\n\n if (res != -1) {\n this_.$refs.orgTable.toggleRowSelection(this_.dialogData[res], true);\n }\n });\n }\n } else {\n if (this_.showData != undefined && this_.showData.length > 0) {\n this_.showData.forEach(function (row) {\n var res = this_.indexArray(this_.dialogData, row);\n\n if (res != -1) {\n this_.$refs.orgTable.toggleRowSelection(this_.dialogData[res], true);\n }\n });\n }\n }\n }, 250);\n },\n showDialog: function showDialog(item) {\n var _this2 = this;\n\n var selectNum = -1;\n var subRelationObj = $(item.target).parents(\"[sub-relation]\");\n\n if (subRelationObj.length > 0 && $(subRelationObj[0]).attr(\"sub-relation\") == \"onetoone\") {\n selectNum = 1;\n }\n\n var alias = this.custdialog.custDialog.alias;\n this.$store.dispatch(\"dialog/setDialogData\", []);\n this.$store.dispatch(\"form/getByAlias\", alias).then(function (customDialog) {\n if (!customDialog || !customDialog.alias) {\n Message.error(\"对话框别名【\" + alias + \"】不存在!\");\n return;\n }\n\n customDialog.selectNum = selectNum;\n var list = JSON.parse(customDialog.conditionfield);\n var param = {};\n list.forEach(function (ele) {\n if (ele.defaultType == \"4\") {\n param[ele.field] = ele.comment;\n }\n });\n _this2.style = \"height:\" + customDialog.height + \"px\";\n\n if (JSON.stringify(param) == \"{}\") {\n //没有动态传入的字段\n if (customDialog.style == 0) {\n _this2.customDialogShow({\n alias: alias,\n customDialog: customDialog\n });\n } else {\n _this2.customDialogTreeShow({\n alias: alias,\n customDialog: customDialog\n });\n }\n } else {}\n });\n },\n indexArray: function indexArray(array, item) {\n var id = \"\";\n\n if (_typeof(item) == \"object\") {\n id = item.id;\n } else {\n id = item;\n }\n\n for (var i = 0; i < array.length; i++) {\n if (array[i].id == id) {\n return i;\n }\n }\n\n return -1;\n },\n onTableSelect: function onTableSelect(rows, row) {\n var selected = rows.length && rows.indexOf(row) !== -1;\n\n if (!selected) {\n var res = this.indexArray(this.checkBoxDataAll, row);\n this.checkBoxDataAll.splice(res, 1);\n\n if (this.checkBoxDataAll.length == 0) {\n this.selectOrgs = [];\n }\n }\n },\n orgRowClick: function orgRowClick(row, column, event) {\n if (this.customDialog.selectNum === 1) {\n $(event.currentTarget.children[0].children[0].children[0]).trigger(\"click\");\n this.selectOrgs = [row];\n }\n\n this.$refs.orgTable.toggleRowSelection(row);\n },\n orgTableSelection: function orgTableSelection(selection) {\n if (this.customDialog.selectNum != 1 && selection && selection.length > 0) {\n this.selectOrgs = selection;\n }\n },\n dialogConfirm: function dialogConfirm() {\n this.$store.dispatch(\"dialog/setDialogData\", []);\n this.customDialogShowList = false;\n this.calacInputSuffixHeight();\n this.syncInputValue();\n },\n //重置\n reset: function reset() {\n this.queryParam = \"\";\n this.search();\n },\n search: function search() {\n var _this3 = this;\n\n var querys = []; //查询条件\n\n var queryFilter = {};\n var pageBean = {\n pageBean: this.pagination\n };\n\n var _this = this;\n\n if (this.queryParam != \"\") {\n var conditionfield = JSON.parse(this.customDialog.conditionfield);\n conditionfield.forEach(function (item) {\n if (item.defaultType == '1') {\n querys.push({\n property: item.field,\n value: _this3.queryParam,\n group: \"main\",\n operation: _this.opMap[item.condition],\n relation: \"OR\"\n });\n }\n });\n } //处理参数传入\n\n\n var conditions = this.custdialog.custDialog.conditions;\n var formInst = utils.getOnlineFormInstance(this);\n\n if (conditions && conditions.length > 0 && formInst && formInst['data']) {\n var curData = formInst['data'];\n conditions.forEach(function (item) {\n if (item.defaultType == \"3\" && item.bind) {\n var obj = {};\n item.field = item.field;\n var bindArray = item.bind.split('.');\n\n if (bindArray.length == 3) {\n var targetValue = curData[bindArray[1]][bindArray[2]];\n querys.push({\n property: item.field,\n value: targetValue,\n group: \"type3\",\n operation: _this.opMap[item.condition],\n relation: \"AND\"\n });\n }\n }\n });\n }\n\n if (querys.length > 0) {\n queryFilter = {\n pageBean: this.pagination,\n querys: querys\n };\n this.customDialog.pageBean = queryFilter;\n this.$store.dispatch(\"dialog/getlistJson\", this.customDialog);\n } else {\n this.customDialog.pageBean = pageBean;\n this.$store.dispatch(\"dialog/getlistJson\", this.customDialog);\n }\n\n this.checkList();\n },\n searchTree: function searchTree(requestParams) {\n var _this4 = this;\n\n if (this.props1.length < 1) {\n this.$store.dispatch(\"dialog/getTreeData\", requestParams).then(function (res) {\n if (_this4.customDialog.displayfield && _this4.customDialog.resultfield) {\n var displayfield = JSON.parse(_this4.customDialog.displayfield);\n _this4.defaultProps.label = displayfield.displayName;\n var resultfield = JSON.parse(_this4.customDialog.resultfield);\n _this4.props1 = _this4.toTreeData(res, displayfield.id, displayfield.pid, displayfield.displayName, displayfield.pvalue ? displayfield.pvalue : \"0\", resultfield);\n }\n });\n }\n },\n // 同步选择结果\n syncInputValue: function syncInputValue() {\n var _this5 = this;\n\n var returnStr = JSON.parse(this.customDialog.resultfield); //拿到返回的字段\n\n var field = new Array([returnStr.length]);\n var comment = new Array([returnStr.length]);\n var str = [];\n var ids = [];\n\n for (var i = 0; i < returnStr.length; i++) {\n field[i] = this.customDialog.dsType == \"dataSource\" ? returnStr[i].field.toUpperCase() : returnStr[i].field;\n comment[i] = this.customDialog.dsType == \"dataSource\" ? returnStr[i].comment.toUpperCase() : returnStr[i].comment;\n }\n\n var this_ = this;\n this.selectOrgs.forEach(function (row) {\n if (this_.checkBoxDataAll || this_.checkBoxDataAll.length < 1) {\n this_.checkBoxDataAll.push(row);\n } else if (JSON.stringify(this_.indexArray).indexOf(JSON.stringify(row)) == -1) {\n this_.checkBoxDataAll.push(row);\n }\n });\n var s = this.checkBoxDataAll;\n\n if (this.customDialog.selectNum === 1) {\n var temp = \"\";\n\n for (var i = 0; i < comment.length; i++) {\n var va = s[0][field[i]];\n va = typeof va == 'undefined' ? '' : va;\n temp += '\"' + comment[i] + '\":\"' + va + '\",';\n }\n\n if (temp != \"\") {\n temp = \"{\" + temp.substring(0, temp.length - 1) + \"}\";\n }\n\n str.push(utils.parseToJson(temp));\n ids.push(s[0].id);\n } else {\n for (var i = 0; i < s.length; i++) {\n var temp = \"\";\n\n for (var j = 0; j < comment.length; j++) {\n var _va = s[i][field[j]];\n _va = typeof _va == 'undefined' ? '' : _va;\n temp += '\"' + comment[j] + '\":\"' + _va + '\",';\n }\n\n if (temp != \"\") {\n temp = \"{\" + temp.substring(0, temp.length - 1) + \"}\";\n }\n\n str.push(utils.parseToJson(temp));\n ids.push(s[i].id);\n }\n }\n\n var returnData = str;\n\n var _this = this;\n\n var formInst = utils.getOnlineFormInstance(this);\n var hotTableTarget = '';\n returnData.forEach(function (row) {\n var targetArray = null;\n var subLineData = {};\n\n _this5.custdialog.custDialog.mappingConf.forEach(function (con) {\n if (con.target[0]) {\n hotTableTarget = con.target[0];\n targetArray = con.target[0].split(\".\");\n var from = \"\";\n\n if (_this.customDialog.dsType == \"restful\") {\n from = con.from;\n } else {\n from = con.from.toUpperCase();\n }\n\n subLineData[targetArray[targetArray.length - 1]] = row[from];\n }\n });\n\n if (targetArray) {\n var subBo = formInst[\"data\"][targetArray[0]][targetArray[1]];\n\n if (_this.customDialog.selectNum == 1 && subBo.length > 0) {\n subBo.shift();\n } //子表回填 自动把之前添加的字段且为空的也回填\n // if (formInst[\"data\"][targetArray[0]][targetArray[1]]) {\n // formInst[\"data\"][targetArray[0]][targetArray[1]].forEach(obj => {\n // for (let item in obj) {\n // if (!obj[item]) {\n // for (let subData in subLineData) {\n // obj[item] = subLineData[item];\n // }\n // }\n // }\n // });\n // }\n\n\n subBo.push(subLineData); //把子表回填值存在控件的父组件中\n\n formInst.subBackfill.set(\"data.\" + targetArray[0] + \".\" + targetArray[1], subLineData);\n }\n });\n\n if (hotTableTarget) {\n formInst.hotTableFillback = hotTableTarget + '_timestamp_' + Date.parse(new Date());\n }\n },\n dialogCancel: function dialogCancel() {\n var _this6 = this;\n\n this.$store.dispatch(\"dialog/setDialogData\", []);\n this.customDialogShowList = false;\n\n if (this.selectOrgs) {\n this.selectOrgs.forEach(function (item) {\n if (!_this6.inputVal || _this6.inputVal.indexOf(item) === -1) {\n _this6.$refs.orgTable.toggleRowSelection(item, false);\n } else {\n _this6.$refs.orgTable.toggleRowSelection(item, true);\n }\n });\n } // this.selectOrgs = this.inputVal ? this.inputVal : null;\n\n },\n dialogTreeConfirm: function dialogTreeConfirm() {\n var _this7 = this;\n\n this.$store.dispatch(\"dialog/setDialogData\", []);\n var returnStr = JSON.parse(this.customDialog.resultfield);\n var field = new Array([returnStr.length]);\n var comment = new Array([returnStr.length]);\n var str = [];\n\n for (var i = 0; i < returnStr.length; i++) {\n field[i] = returnStr[i].field;\n comment[i] = returnStr[i].comment;\n }\n\n if (this.customDialog.selectNum === 1) {\n var nodes = this.propsData[0];\n var temp = \"\";\n\n for (var i = 0; i < comment.length; i++) {\n temp += '\"' + comment[i] + '\":\"' + nodes[field[i]] + '\",';\n }\n\n if (temp != \"\") {\n temp = \"{\" + temp.substring(0, temp.length - 1) + \"}\";\n }\n\n str.push(utils.parseToJson(temp));\n } else {\n var nodes = this.propsData;\n nodes.forEach(function (item, k) {\n var temp = \"\";\n\n for (var i = 0; i < comment.length; i++) {\n temp += '\"' + comment[i] + '\":\"' + nodes[field[i]] + '\",';\n temp += '\"' + comment[i] + '\":\"' + nodes[k][field[i]] + '\",';\n }\n\n if (temp != \"\") {\n temp = \"{\" + temp.substring(0, temp.length - 1) + \"}\";\n }\n\n str.push(utils.parseToJson(temp));\n });\n }\n\n var returnData = str;\n\n var _this = this;\n\n var formInst = utils.getOnlineFormInstance(this);\n returnData.forEach(function (row) {\n var targetArray = null;\n var subLineData = {};\n\n _this7.custdialog.custDialog.mappingConf.forEach(function (con) {\n targetArray = con.target[0].split(\".\");\n var from = \"\";\n\n if (_this.customDialog.dsType == \"restful\") {\n from = con.from;\n } else {\n from = con.from.toUpperCase();\n }\n\n subLineData[targetArray[targetArray.length - 1]] = row[from];\n });\n\n if (targetArray) {\n var subBo = formInst[\"data\"][targetArray[0]][targetArray[1]];\n\n if (_this.customDialog.selectNum == 1 && subBo.length > 0) {\n subBo.shift();\n }\n\n subBo.push(subLineData);\n }\n }); //this.$emit(\"input\", JSON.stringify(str));\n\n this.customDialogShowTree = false;\n },\n dialogCancelTree: function dialogCancelTree() {\n this.$store.dispatch(\"dialog/setDialogData\", []);\n this.customDialogShowTree = false;\n },\n getChecked: function getChecked(data, checked, indeterminate) {\n if (this.customDialog.selectNum === 1) {\n this.propsData = [];\n this.propsData.push(data);\n } else {\n this.propsData = this.$refs.tree.getCheckedNodes();\n }\n },\n treeClick: function treeClick(data, n, i) {\n if (this.customDialog.selectNum === 1) {\n this.propsData = [];\n this.propsData.push(data);\n }\n },\n clearAllSelectOrgs: function clearAllSelectOrgs() {\n this.selectOrgs = null;\n this.$refs.orgTable.clearSelection();\n },\n removeSelectOrgs: function removeSelectOrgs() {\n var _this8 = this;\n\n var ary = this.$refs.selectTree.getCheckedNodes();\n ary.forEach(function (item) {\n _this8.selectOrgs.remove(item);\n\n _this8.$refs.orgTable.toggleRowSelection(item, false);\n });\n },\n removeSelectOrg: function removeSelectOrg(item) {\n if (this.customDialog.selectNum === 1) {\n this.$emit(\"input\", \"\");\n } else {\n this.inputVal.splice(item, 1);\n this.showData.splice(item, 1);\n this.calacInputSuffixHeight();\n var value = \"\";\n this.inputVal.forEach(function (val) {\n value += val.value + \",\";\n });\n\n if (value.length > 0) {\n value = value.substring(0, value.length - 1);\n }\n\n if (value != \"\") {\n value = value + \"||\" + JSON.stringify(this.showData);\n }\n\n this.$emit(\"input\", value);\n }\n },\n calacInputSuffixHeight: function calacInputSuffixHeight() {\n var _this9 = this;\n\n setTimeout(function () {\n if (!_this9.$refs.tagSpans) return;\n\n if (_this9.$refs.tagSpans.offsetHeight) {\n _this9.inputSuffixHeight = _this9.$refs.tagSpans.offsetHeight + 5;\n } else {\n _this9.inputSuffixHeight = 30;\n } // 触发验证\n\n\n _this9.$validator.validate();\n }, 0);\n },\n customDialogShow: function customDialogShow(pageParam) {\n var _this10 = this;\n\n this.customDialogShowList = true;\n this.customDialog = pageParam.customDialog;\n this.customDialog.queryUrl = this.customDialog.dsType == \"dataSource\" ? \"${form}/form/customDialog/v1/getListData?alias=\" + this.customDialog.alias + \"&mapParam=\" + (this.customDialog.mapParam ? this.customDialog.mapParam : \"\") : this.customDialog.url;\n var conditionfield = JSON.parse(this.customDialog.conditionfield);\n\n if (!this.comment && conditionfield.length > 0) {\n conditionfield.forEach(function (item) {\n if (item.controllerType == 1 && item.dbType == \"varchar\") {\n _this10.comment += item.comment + \",\";\n }\n });\n\n if (this.comment) {\n this.querysShow = true;\n this.comment = \"通过\" + this.comment.substring(0, this.comment.length - 1) + \"查询\";\n }\n }\n\n if (this.dialogData.length < 1) {\n this.search();\n this.displayfield = JSON.parse(pageParam.customDialog.displayfield);\n\n if (this.customDialog.dsType == \"dataSource\") {\n for (var i = 0; i < this.displayfield.length; i++) {\n this.displayfield[i].field = this.displayfield[i].field.toUpperCase();\n }\n }\n }\n },\n customDialogTreeShow: function customDialogTreeShow(pageParam) {\n this.customDialog = pageParam.customDialog;\n var customDialog = this.customDialog;\n var mapParam = \"\";\n\n if (pageParam.param != undefined) {\n mapParam = JSON.stringify(pageParam.param);\n mapParam = mapParam.substring(1, mapParam.length - 1);\n }\n\n var requestType = customDialog.dsType == \"dataSource\" ? \"GET\" : customDialog.requestType ? customDialog.requestType : \"POST\";\n var url = \"${form}/form/customDialog/v1/getTreeData?alias=\" + pageParam.alias + \"&mapParam=\" + mapParam;\n var paramsObj = {};\n\n if (customDialog.dsType != \"dataSource\") {\n url = customDialog.url;\n var templatePa = customDialog.dataParam;\n\n if (customDialog.conditionfield) {\n var conditions = JSON.parse(customDialog.conditionfield);\n\n for (var i = 0; i < conditions.length; i++) {\n var con = conditions[i];\n\n if (requestType == \"POST\") {\n if (templatePa) {\n templatePa = templatePa.replace(new RegExp(\"\\\\{\" + con.field + \"\\\\}\", \"g\"), con.defaultValue);\n } else {\n paramsObj[con.field] = con.defaultValue;\n }\n } else {\n var ljChar = url.indexOf(\"?\") == -1 ? \"?\" : \"&\";\n url = url + ljChar + con.field + \"=\" + con.defaultValue;\n }\n }\n\n if (templatePa) {\n paramsObj = JSON.parse(templatePa);\n }\n }\n }\n\n var requestParams = {};\n requestParams.requestType = requestType;\n requestParams.url = url;\n requestParams.paramsObj = paramsObj;\n this.searchTree(requestParams);\n this.customDialogShowTree = true;\n },\n toTreeData: function toTreeData(data, id, pid, name, pvalue, returnStr) {\n // 建立个树形结构,需要定义个最顶层的父节点,pvalue是0\n var ztree = translateDataToTree(data, pid, id, name);\n\n function translateDataToTree(data, pid, id, name) {\n var parents = data.filter(function (value) {\n return value[id] == value[pid] || value[pid] == null || value[pid] == null || value[pid] == 0;\n });\n parents.label = parents[name];\n var childrens = data.filter(function (value) {\n return value[pid] !== \"undefined\" && value[pid] != null && value[id] != value[pid];\n });\n\n var translator = function translator(parents, childrens) {\n parents.forEach(function (parent) {\n childrens.forEach(function (current, index) {\n if (current[pid] === parent[id]) {\n var temp = JSON.parse(JSON.stringify(childrens));\n temp.splice(index, 1);\n translator([current], temp);\n current.label = current[name];\n typeof parent.childrens !== \"undefined\" ? parent.childrens.push(current) : parent.childrens = [current];\n }\n });\n });\n };\n\n translator(parents, childrens);\n return parents;\n }\n\n return ztree;\n }\n }\n};",null]}