{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!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\\BusinessObjAttr.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\form\\BusinessObjAttr.vue","mtime":1675071992881},{"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":["import \"core-js/modules/es7.array.includes\";\nimport \"core-js/modules/es6.string.includes\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport \"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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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 form from \"@/api/form.js\";\nimport utils from \"@/hotent-ui-util.js\";\nexport default {\n name: \"BusinessObjAttr\",\n props: [\"openGrandSonAttr\", \"attrTableData\", \"formData\", \"entIndex\", \"grandSonIndex\"],\n watch: {\n openGrandSonAttr: function openGrandSonAttr(v) {\n this.isOpenGrandSonAttr = v;\n },\n attrTableData: function attrTableData(v) {\n this.sonData = v;\n },\n formData: function formData(v) {\n this.tableData = v;\n },\n entIndex: function entIndex(v) {\n this.index = v;\n },\n grandSonIndex: function grandSonIndex(v) {\n this.sonIndex = v;\n }\n },\n data: function data() {\n return {\n index: 0,\n sonIndex: 0,\n isOpenGrandSonAttr: false,\n hideAttr: [],\n sonData: [],\n tableData: [],\n dataType: [{\n key: \"varchar\",\n value: \"字符串\"\n }, {\n key: \"number\",\n value: \"数字\"\n }, {\n key: \"date\",\n value: \"日期\"\n }, {\n key: \"clob\",\n value: \"大文本\"\n }],\n dateFormat: [{\n key: \"yyyy-MM-dd HH:mm:ss\",\n value: \"yyyy-MM-dd HH:mm:ss\"\n }, {\n key: \"yyyy-MM-dd\",\n value: \"yyyy-MM-dd\"\n }]\n };\n },\n computed: {\n attrData: function attrData() {\n var data = this.openGrandSonAttr ? this.sonData : this.formData.ents[this.entIndex].attributeList;\n return data;\n }\n },\n beforeDestroy: function beforeDestroy() {\n //组件注销移除事件监听器,以防多次调用\n this.$root.$off(\"validateField\");\n },\n methods: {\n //校验当前实体字段\n checkEntFunc: function checkEntFunc(type) {\n var checkEntFuncData = {\n \"type\": type,\n \"formData\": [this.formData.ents[this.entIndex]]\n };\n this.$root.$emit(\"validateField\", checkEntFuncData);\n },\n //表单数据加载\n getFormData: function getFormData() {\n var this_ = this;\n\n if (this_.formData.id) {\n form.getEntData(this_.formData.id, function (resp) {\n resp.data.ents.forEach(function (entData, index) {\n if (entData.isExternal == \"1\" && index == 0) {\n entData.show = \"主实体-外\";\n } else if (entData.isExternal == \"1\") {\n entData.show = \"子实体-外\";\n }\n\n if (index === 0) {\n entData.isCheck = true;\n }\n\n if (entData.children) {\n entData.children.forEach(function (v) {\n if (v.isExternal == \"1\") {\n v.show = \"孙实体-外\";\n }\n });\n }\n\n for (var q = 0; q < entData.attributeList.length; q++) {\n if (entData.attributeList[q]) {\n if (entData.attributeList[q].isRequired == 0) {\n entData.attributeList[q].isRequired = \"0\";\n } else {\n entData.attributeList[q].isRequired = \"1\";\n }\n }\n\n for (var i = 0; i < entData.attributeList.length - 1 - q; i++) {\n if (entData.attributeList[i].index > entData.attributeList[i + 1].index) {\n var temp = entData.attributeList[i];\n entData.attributeList[i] = entData.attributeList[i + 1];\n entData.attributeList[i + 1] = temp;\n }\n }\n }\n });\n resp.data.ents.forEach(function (data) {\n data.isCheck = false;\n }); //获取选中实体\n\n resp.data.ents[this_.entIndex].isCheck = true;\n this_.$emit(\"update:formData\", resp.data);\n });\n }\n },\n //刷新元数据\n reloadByEntId: function reloadByEntId(ent) {\n var _this2 = this;\n\n var id = ent.id;\n\n if (this.openGrandSonAttr && ent.children && ent.children.length > 0) {\n id = ent.children[this.grandSonIndex].id;\n }\n\n var _this = this;\n\n form.reloadByEntId(id, _this.formData.alias).then(function (resp) {\n if (resp.state) {\n _this.$message({\n message: \"刷新成功,若字段有变化请重新拖拽字段设计表单\",\n type: \"success\"\n });\n\n _this.getFormData();\n } else {\n _this2.$message({\n message: resp.message,\n type: \"error\"\n });\n }\n });\n },\n entBlur: function entBlur(index) {\n this.$emit(\"entBlur\", index);\n this.checkEntFunc(true);\n },\n chineseFormat: function chineseFormat(id, list, param, index, v) {\n this.$emit(\"chineseFormat\", id, list, param, index, v);\n },\n //新增字段\n addAttrRows: function addAttrRows() {\n var row = {\n comment: \"\",\n name: \"\",\n isRequired: \"0\",\n dataType: \"varchar\",\n format: \"\",\n intLen: \"\",\n attrLength: 200,\n decimalLen: 0,\n isNew: true,\n defaultValue: \"\",\n desc: \"\",\n index: this.openGrandSonAttr ? this.sonData.length + 1 : this.formData.ents[this.entIndex].attributeList.length + 1\n };\n\n if (this.openGrandSonAttr) {\n this.sonData.push(row);\n } else {\n this.formData.ents[this.entIndex].attributeList.push(row);\n }\n },\n //数据类型切换设置默认值\n defaultDataFormat: function defaultDataFormat(row, index) {\n var selectAttr = this.formData.ents[this.entIndex].attributeList;\n\n if (this.openGrandSonAttr) {\n selectAttr = this.sonData;\n }\n\n selectAttr[index].attrLength = 0;\n selectAttr[index].decimalLen = 0;\n selectAttr[index].format = \"\";\n\n if (row.dataType == \"date\") {\n selectAttr[index].format = \"yyyy-MM-dd HH:mm:ss\";\n } else if (row.dataType == \"varchar\") {\n selectAttr[index].attrLength = 200;\n } else if (row.dataType == \"number\") {\n selectAttr[index].attrLength = 10;\n selectAttr[index].decimalLen = 2;\n }\n },\n handleCommand: function handleCommand(param) {\n switch (param.command) {\n case \"del\":\n this.deleteAttrRows(param.row, param.index);\n break;\n\n case \"up\":\n this.attrUp(param.row, param.index);\n break;\n\n case \"down\":\n this.attrDown(param.row, param.index);\n break;\n\n default:\n break;\n }\n },\n // 删除字段 伪删除 设置字段 status 值 hide\n isDel: function isDel(row, index) {\n var _this3 = this;\n\n var count = 0;\n this.formData.ents[this.entIndex].attributeList.forEach(function (item) {\n if (item.status === \"hide\") {\n count++;\n }\n });\n\n if (count >= this.formData.ents[this.entIndex].attributeList.length - 1) {\n this.$message({\n message: \"最后一个字段不能删除!\",\n type: \"warning\"\n });\n return;\n }\n\n if (!this.formData.deployed) {\n form.deleteAttr(row.id).then(function (resp) {\n if (resp.data.state) {\n _this3.$message({\n message: resp.data.message,\n type: \"success\"\n });\n } else {\n _this3.$message({\n message: resp.data.message,\n type: \"error\"\n });\n\n return;\n }\n }).then(function () {\n _this3.formData.ents[_this3.entIndex].attributeList.splice(index, 1);\n\n _this3.formData.ents[_this3.entIndex].attributeList.forEach(function (item, attrIndex) {\n if (attrIndex == index) {\n item.index = item.index - 1;\n ++index;\n }\n });\n\n form.saveEntData(_this3.formData).then(function (resp) {\n if (resp.data.state) {\n _this3.formData.rev++;\n }\n });\n });\n } else {\n form.removeAttr(row, this.formData.alias).then(function (resp) {\n if (resp.data.state) {\n _this3.$message({\n message: resp.data.message + \",建模数据已更新!\",\n type: \"success\"\n });\n\n _this3.$emit(\"getFormData\");\n } else {\n _this3.$message({\n message: resp.data.message,\n type: \"error\"\n });\n\n return;\n }\n });\n }\n },\n //删除字段\n deleteAttrRows: function deleteAttrRows(row, index) {\n if (!this.openGrandSonAttr) {\n if (row.id == undefined) {\n this.formData.ents[this.entIndex].attributeList.splice(index, 1);\n this.formData.ents[this.entIndex].attributeList.forEach(function (item, attrIndex) {\n if (attrIndex == index) {\n item.index = item.index - 1;\n ++index;\n }\n });\n return;\n }\n\n this.isDel(row, index);\n } else {\n if (!row.id) {\n this.attrTableData.splice(index, 1);\n this.attrTableData.forEach(function (item, i) {\n if (i == index) {\n item.index = item.index - 1;\n ++index;\n }\n });\n return;\n }\n\n this.isDel(row, index);\n }\n },\n attrUp: function attrUp(row, index) {\n if (!this.openGrandSonAttr) {\n this.formData.ents[this.entIndex].attributeList[index].index = this.formData.ents[this.entIndex].attributeList[index].index - 1;\n this.formData.ents[this.entIndex].attributeList[index - 1].index = this.formData.ents[this.entIndex].attributeList[index - 1].index + 1;\n this.formData.ents[this.entIndex].attributeList = utils.arrayMove(this.formData.ents[this.entIndex].attributeList, row, \"up\");\n } else {\n this.sonData[index].index = this.sonData[index].index - 1;\n this.sonData[index - 1].index = this.sonData[index - 1].index + 1;\n this.sonData = utils.arrayMove(this.sonData, row, \"up\");\n }\n },\n attrDown: function attrDown(row, index) {\n if (!this.openGrandSonAttr) {\n this.formData.ents[this.entIndex].attributeList[index].index = this.formData.ents[this.entIndex].attributeList[index].index + 1;\n this.formData.ents[this.entIndex].attributeList[index + 1].index = this.formData.ents[this.entIndex].attributeList[index + 1].index - 1;\n this.formData.ents[this.entIndex].attributeList = utils.arrayMove(this.formData.ents[this.entIndex].attributeList, row, \"down\");\n } else {\n this.sonData[index].index = this.sonData[index].index + 1;\n this.sonData[index + 1].index = this.sonData[index + 1].index - 1;\n this.sonData = utils.arrayMove(this.sonData, row, \"down\");\n }\n },\n recovery: function recovery(row) {\n var _this4 = this;\n\n form.recovery(row, this.formData.alias).then(function (resp) {\n if (resp.data.state) {\n _this4.$message({\n message: resp.data.message + \",建模数据已更新\",\n type: \"success\"\n });\n\n _this4.$emit(\"getFormData\");\n }\n });\n },\n refreshAttr: function refreshAttr(cb) {\n var _this5 = this;\n\n var param = {\n dsalias: this.formData.ents[this.entIndex].dsName,\n isTable: \"1\",\n objName: this.formData.ents[this.entIndex].tableName\n };\n\n if (this.openGrandSonAttr) {\n param.objName = this.formData.ents[this.entIndex].children[this.grandSonIndex].tableName;\n param.dsalias = this.formData.ents[this.entIndex].children[this.grandSonIndex].dsName;\n }\n\n form.getHideAttr(param.objName).then(function (resp) {\n if (resp) {\n _this5.hideAttr = resp;\n }\n }).then(function () {\n form.getTableList(param).then(function (resp) {\n _this5.isExit = false;\n _this5.refreshData = resp;\n }).then(function () {\n for (var i = 0; i < _this5.refreshData.data.length; i++) {\n if (_this5.refreshData.data[i].name == param.objName) {\n // 删除主键和外键\n _this5.$http.get(\"${form}/bo/def/v1/reloadByEntId?entId=\" + _this5.formData.ents[_this5.entIndex].id).then(function (resp) {\n var json = JSON.parse(JSON.stringify(resp.data.table.columnList).replace(/charLen/g, \"attrLength\").replace(/fieldName/g, \"name\").replace(/columnType/g, \"dataType\").replace(/fdataType/g, \"fcolumnType\"));\n var _this = _this5;\n var data = {};\n\n if (_this5.hideAttr.length > 0) {\n var attr = \"\";\n\n _this5.hideAttr.forEach(function (v) {\n attr += v.fieldName + \",\";\n });\n\n json = json.filter(function (value) {\n return !attr.includes(value.fieldName);\n });\n }\n\n if (_this5.openGrandSonAttr) {\n _this5.formData.ents[_this5.entIndex].children[_this5.grandSonIndex].attributeList = json;\n data = _this5.formData.ents[_this5.entIndex].children[_this5.grandSonIndex];\n } else {\n _this5.formData.ents[_this5.entIndex].attributeList = json;\n data = _this5.formData.ents[_this5.entIndex];\n }\n\n data.attributeList = data.attributeList.filter(function (item) {\n var val = item.name.toUpperCase();\n return !item.isPk && val != \"F_FORM_DATA_REV_\" && val != \"REF_ID_\" && (!_this.formData.ents.fk || val != _this.formData.ents.fk.toUpperCase());\n });\n data.attributeList.forEach(function (item, index) {\n item.index = index + 1;\n\n if (item.attrLength == 0 && item.intLen != 0) {\n item.attrLength = item.intLen;\n }\n });\n\n _this5.$message({\n message: \"刷新成功\",\n type: \"success\"\n });\n\n _this5.isExit = true;\n });\n\n break;\n }\n }\n\n setTimeout(function () {\n if (!_this5.isExit) {\n if (_this5.openGrandSonAttr) {\n _this5.formData.ents[_this5.entIndex].children[_this5.grandSonIndex].attributeList = [];\n\n _this5.getGrandSonEntsByIndex(_this5.grandSonIndex, _this5.entIndex);\n } else {\n if (_this5.entIndex == 0) {\n form.removeBusinessObj(_this5.formData.id).then(function () {\n _this5.handleDialogClose();\n });\n } else {\n _this5.formData.ents[_this5.entIndex].attributeList = [];\n\n _this5.$emit(\"getEntsByIndex\", _this5.entIndex);\n }\n }\n }\n }, 500);\n _this5.isExit = false;\n });\n });\n }\n },\n mounted: function mounted() {\n var _this = this;\n\n document.onkeydown = function () {\n if (_this.formData.ents && _this.formData.ents.length > 0) {\n var key = window.event.keyCode;\n\n if (key == 113) {\n //== 83 && event.ctrlKey\n _this.addAttrRows();\n\n setTimeout(function () {\n _this.$refs.attrTableScrollbarHeight.bodyWrapper.scrollTop = _this.$refs.attrTableScrollbarHeight.bodyWrapper.scrollHeight;\n }, 500);\n }\n }\n };\n }\n};",null]}