{"remainingRequest":"D:\\jenkins\\workspace\\cssc-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\cssc-fvue\\src\\components\\eipControl\\EipDialog.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\cssc-fvue\\src\\components\\eipControl\\EipDialog.vue","mtime":1667804639071},{"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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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 {mapState} from 'vuex'\r\nimport utils from '@/utils.js'\r\nimport hotentUiUtils from '@/hotent-ui-util.js'\r\nimport {Message} from 'element-ui'\r\nimport req from '@/request.js'\r\nimport sub_pio_mixin from \"@/sub-permission-mixin.js\"\r\nimport EipTag from '@/components/eipControl/EipTag.vue'\r\nimport EipSelectDia from '@/components/eipControl/EipSelectDia.vue'\r\nexport default {\r\n components: {EipTag, EipSelectDia},\r\n name: 'eip-dialog',\r\n props: ['validate', 'value', 'name', 'permission', 'atter', 'single', 'selectorconfig', 'custdialog', 'placeholder', 'tooltipplacement'],\r\n mixins: [sub_pio_mixin],//混入方式引入表单组件中公共属性,处理子表、孙表行内联动(切面修改permission_sub)\r\n data() {\r\n return {\r\n dialogVisible:false,//打开树形输入动态参数值的对话框\r\n pageParam:{},//树形对话框参数\r\n conditionfieldTree:[],//树形对话框条件字段\r\n data: {\r\n qxdd: {}\r\n },\r\n inputSuffixWidth:0,\r\n placeholderBo: '',\r\n quickSearch: '', //填写提示\r\n conditionBind: [], //参数查询字段\r\n nodeKey: 'ID_', //树形数据父Id\r\n customDialogShowList: false,\r\n customDialogShowTree: false,\r\n selectOrgProps: {\r\n label: 'name'\r\n },\r\n style: '', //对话框宽高\r\n selectOrgs: null,\r\n inputSuffixHeight: 33,\r\n config: null,\r\n updating: false,\r\n displayfield: [], //显示字段\r\n customDialog: {},\r\n queryParam: '', //查询条件输入的值\r\n props1: [],\r\n showData: [],\r\n checkBoxDataAll: [], //选中对象的集合\r\n defaultProps: {\r\n children: 'children',\r\n label: 'label',\r\n isLeaf:\"isLeaf\"\r\n },\r\n propsData: [],\r\n querysShow: false, //是否显示搜索框\r\n undefineda: '',\r\n isCurrentChange: false, //是否不执行 orgTableSelection方法\r\n pagination: {\r\n page: 1,\r\n pageSize: 10,\r\n total: 0\r\n },\r\n param: [], //绑定的表单字段\r\n treeList: [],\r\n displayField: {},\r\n queryParams: [],\r\n placeholders: [],\r\n oldselectOrgs: [],\r\n combinationTreeData:[],\r\n combiTreeDisplayField:[],\r\n combinationTreeQuerys:[],\r\n combinationRule:{},\r\n toggleBtn: \"el-icon-arrow-left\",\r\n treeShow: true,\r\n transtionWidth: \"25%\",\r\n leftTreeTitle:\"\",\r\n writeable:true,\r\n }\r\n },\r\n watch: {\r\n props1: function(newVal, oldVal) {\r\n //树形\r\n if (this.showData != undefined && this.showData.length > 0) {\r\n const this_ = this\r\n let data = []\r\n for (let i = 0; i < this.showData.length; i++) {\r\n data.push(this.showData[i])\r\n }\r\n setTimeout(() => {\r\n for (let i = 0; i < data.length; i++) {\r\n this_.$refs.tree.setChecked(data[i], true)\r\n this_.checkNode(data[i], this_)\r\n }\r\n }, 200)\r\n }\r\n }\r\n },\r\n mounted() {\r\n const { subScopeEl, index } = hotentUiUtils.getSubScopeElAndIndex(this.$el);\r\n if (subScopeEl && (subScopeEl.getAttribute(\"row_readonly\") == 'true' || subScopeEl.getAttribute(\"row_readonly\") === true)) {\r\n this.writeable = false;\r\n }\r\n //获取对话框按钮名称宽度\r\n if(this.$refs.inputSuffix){\r\n this.inputSuffixWidth = this.$refs.inputSuffix.offsetWidth+1;\r\n }\r\n },\r\n computed: mapState({\r\n // pagination: state => state.dialog.pagination,\r\n total: state => state.dialog.total,\r\n dialogData: state => {\r\n return state.dialog.rows\r\n },\r\n inputVal: function() {\r\n if (!this.value || this.value == '||[]') {\r\n this.checkBoxDataAll = []\r\n // this.showData = [];\r\n return null\r\n } else {\r\n let nameAry = this.value.split(',')\r\n if (this.value.indexOf('||') > 0) {\r\n nameAry = this.value.split('||')[0].split(',')\r\n // this.showData=JSON.parse(this.value.split(\"||\")[1]);\r\n }\r\n // this.showData =this.selectOrgs;\r\n let idAry = null\r\n let accountAry = null\r\n let result = []\r\n nameAry.forEach((m, i) => {\r\n let n = {value: m}\r\n result.push(n)\r\n })\r\n return result;\r\n }\r\n },\r\n inputWriteable: function() {\r\n return this.writeable ? utils.getWriteable(this.permission_sub):this.writeable;\r\n },\r\n inputValidate: function() {\r\n var validateObj = this.$store.state.index.validate\r\n return utils.addRequiredOrNot(this.permission_sub, this.validate, validateObj, this)\r\n },\r\n inputName: function() {\r\n let labeldesc = ''\r\n if (this.$slots && this.$slots.labeldesc && this.$slots.labeldesc[0].children && this.$slots.labeldesc[0].children[0].text) {\r\n labeldesc = this.$slots.labeldesc[0].children[0].text\r\n return this.name ? this.name : utils.getName() + '-' + labeldesc\r\n } else {\r\n return this.name ? this.name : utils.getName()\r\n }\r\n },\r\n // 是否有回填设置\r\n bindSet: function() {\r\n return this.selectorconfig ? this.selectorconfig.bind : null\r\n }\r\n }),\r\n created() {\r\n if (!this.placeholder) {\r\n this.placeholderBo = '请选择内容'\r\n } else {\r\n this.placeholderBo = this.placeholder\r\n }\r\n this.$validator = this.$root.$validator\r\n },\r\n methods: {\r\n selectAll(selection) {\r\n if(this.oldselectOrgs!=null && selection.length>0){\r\n for (let x = 0; x < selection.length; x++) {\r\n if (this.indexArray(this.oldselectOrgs, selection[x]) === -1) {\r\n this.oldselectOrgs.push(selection[x]);\r\n }\r\n }\r\n this.selectOrgs = _.cloneDeep(this.oldselectOrgs);\r\n }else{\r\n this.selectOrgs = _.cloneDeep(selection);\r\n }\r\n },\r\n checkNode(data, this_, pnode) {\r\n if (data.Pid) {\r\n let node = this_.$refs.tree.getNode(data.Pid)\r\n node.indeterminate = true\r\n if (node.data.Pid) {\r\n this_.$refs.tree.getNode(node.data.Pid).indeterminate = true\r\n this.checkNode(this_.$refs.tree.getNode(node.data.Pid).data, this_, this_.$refs.tree.getNode(node.data.Pid))\r\n }\r\n if (!node.indeterminate) {\r\n node.indeterminate = true\r\n }\r\n } else if (pnode && !pnode.indeterminate) {\r\n pnode.indeterminate = true\r\n }\r\n },\r\n //回车查询\r\n searchEnterFun: function(e) {\r\n var keyCode = window.event ? e.keyCode : e.which\r\n if (keyCode == 13) {\r\n this.search()\r\n }\r\n },\r\n handleSizeChange: function(size) {\r\n this.isCurrentChange = true\r\n //每页下拉显示数据\r\n this.pagination.pageSize = size\r\n this.search()\r\n },\r\n handleCurrentChange: function(currentPage) {\r\n const this_ = this\r\n if (this.selectOrgs != undefined && this.selectOrgs.length > 0) {\r\n this.selectOrgs.forEach(row => {\r\n let res = this_.indexArray(this_.checkBoxDataAll, row)\r\n if (res == -1) {\r\n this_.checkBoxDataAll.push(row)\r\n }\r\n })\r\n }\r\n this.isCurrentChange = true\r\n //点击第几页\r\n this.pagination.page = currentPage\r\n this.search()\r\n },\r\n checkList() {\r\n const this_ = this\r\n setTimeout(() => {\r\n //列表\r\n if (this_.checkBoxDataAll != undefined && this_.checkBoxDataAll.length > 0) {\r\n this_.checkBoxDataAll.forEach(row => {\r\n let res = this_.indexArray(this_.dialogData, row)\r\n this_.undefineda = res\r\n if (res != -1) {\r\n this_.isCurrentChange = true\r\n this_.toggleRowSelection(res, true)\r\n }\r\n })\r\n }\r\n }, 300)\r\n },\r\n toggleRowSelection(res, val) {\r\n this.$refs.orgTable.toggleRowSelection(this.dialogData[res], val)\r\n },\r\n showDialog(item) {\r\n const this_ = this\r\n var alias = this.custdialog.custDialog.alias\r\n this.$store.dispatch('form/getByAlias', alias).then(customDialog => {\r\n if (!customDialog || !customDialog.alias) {\r\n Message.error('对话框别名【' + alias + '】不存在!')\r\n return\r\n }\r\n if (customDialog.style == 1) {\r\n var displaylist = JSON.parse(customDialog.displayfield)\r\n this_.nodeKey = displaylist.id\r\n }\r\n //对话框按表单字段查询(参数传入的)\r\n let bindList = this_.custdialog.custDialog.conditions\r\n this_.param = [] //绑定的表单字段\r\n if (bindList.length > 0) {\r\n bindList.forEach(ele => {\r\n //绑定表单字段\r\n if (ele.defaultType == '3' && ele.bind) {\r\n let obj = {}\r\n obj.field = ele.field\r\n obj.bind = ele.bind\r\n this_.param.push(obj)\r\n }\r\n })\r\n }\r\n //判断对话框查询是否有条件\r\n let userInputList = JSON.parse(customDialog.conditionfield)\r\n this_.quickSearch = '' //填写提示 placeholder\r\n this_.conditionBind = []\r\n let queryParams = []\r\n let placeholders = []\r\n if (userInputList.length > 0) {\r\n userInputList.forEach(ele => {\r\n var obj = {}\r\n //条件查询参数(用户输入的) 文本框输入\r\n if (ele.defaultType == '1') {\r\n obj[ele.field] = ''\r\n queryParams.push(obj)\r\n this_.conditionBind.push(ele)\r\n placeholders.push('请输入' + ele.comment)\r\n }\r\n })\r\n this.$set(this, 'queryParams', queryParams)\r\n this.$set(this, 'placeholders', placeholders)\r\n }\r\n //判断是否显示条件查询输入框\r\n if (this_.quickSearch != '') {\r\n this_.querysShow = true\r\n } else {\r\n this_.querysShow = true\r\n }\r\n this_.quickSearch = '请输入' + this.quickSearch + '查询'\r\n this_.style = 'height:' + customDialog.height + 'px'\r\n if (window.screen.height && window.screen.height <= 900) {\r\n this.style = 'height:440px'\r\n }\r\n if (customDialog.style == 0 || customDialog.style == 2) {\r\n //列表\r\n this_.customDialogShow({alias: alias, customDialog: customDialog})\r\n } else if(customDialog.style == 1) {\r\n //树形\r\n this_.pageParam = { alias: alias,customDialog: customDialog };\r\n this_.customDialog = customDialog;\r\n let param = {};\r\n this_.conditionfieldTree = [];\r\n //判断是否存在条件\r\n if(customDialog.conditionfield){\r\n this_.conditionfieldTree = JSON.parse(customDialog.conditionfield);\r\n if (this_.conditionfieldTree.length > 0) {\r\n for (let i = this_.conditionfieldTree.length - 1; i >= 0; i--) {\r\n //判断条件字段是否是动态传入(defaultType:4:动态传入,2:固定值 )\r\n if (this_.conditionfieldTree[i].defaultType == \"4\") {\r\n param[this_.conditionfieldTree[i].field] = this_.conditionfieldTree[i].comment;\r\n }\r\n }\r\n }\r\n }\r\n //有动态传入的字段\r\n if (JSON.stringify(param) != \"{}\") {\r\n this_.dialogVisible = true;\r\n }else{\r\n //无动态传入的字段\r\n this_.customDialogTreeShow(this_.pageParam);\r\n }\r\n }\r\n })\r\n },\r\n //打开树形动态参数输入值的对话框\r\n handleSave(){\r\n this.customDialogTreeShow(this.pageParam);\r\n this.dialogVisible = false;\r\n },\r\n //关闭树形动态参数输入值的对话框\r\n handleClose(){\r\n this.dialogVisible = false;\r\n },\r\n //判断数据是否包含某个对象,并返回数据包含对象的下标\r\n indexArray(array, item) {\r\n if (array.length == 0) {\r\n return -1\r\n }\r\n for (let i = 0; i < array.length; i++) {\r\n if (JSON.stringify(array[i]) == JSON.stringify(item)) {\r\n return i\r\n }\r\n }\r\n return -1\r\n },\r\n //点击列表某一个复选框时触发\r\n onTableSelect(rows, row) {\r\n this.isCurrentChange = false\r\n //判断点击列表数据时复选框是否勾选 selected:true不勾选,false勾选\r\n let selected = this.selectOrgs && this.selectOrgs.length > 0 && this.indexArray(this.selectOrgs, row) !== -1\r\n if (selected) {\r\n this.isCurrentChange = true\r\n let res = this.indexArray(this.selectOrgs, row)\r\n this.selectOrgs.splice(res, 1)\r\n }\r\n },\r\n //点击列表某一条数据时触发\r\n orgRowClick(row, column, event) {\r\n if (this.customDialog.selectNum === 1) {\r\n $(event.currentTarget.children[0].children[0].children[0]).trigger('click')\r\n this.selectOrgs = []\r\n this.selectOrgs.push(row)\r\n } else if (this.customDialog.selectNum != 1) {\r\n this.isCurrentChange = false\r\n //判断点击列表数据时复选框是否勾选 selected:true不勾选,false勾选\r\n let selected = this.selectOrgs && this.selectOrgs.length > 0 && this.indexArray(this.selectOrgs, row) !== -1\r\n if (selected) {\r\n this.isCurrentChange = true\r\n let res = this.indexArray(this.selectOrgs, row)\r\n this.selectOrgs.splice(res, 1)\r\n }\r\n this.$refs.orgTable.toggleRowSelection(row)\r\n }\r\n },\r\n //列表复选框有改变时触发\r\n orgTableSelection(selection) {\r\n //全选的情况特殊处理(为了与原本功能逻辑不冲突,先复制一份旧的选中数据.然后拿到全选事件中去计算)\r\n this.oldselectOrgs = _.cloneDeep(this.selectOrgs)\r\n //多选\r\n if (this.customDialog.selectNum != 1 && !this.isCurrentChange) {\r\n if (selection && selection.length > 0) {\r\n if (selection.length == 1 && (!this.selectOrgs || this.selectOrgs.length == 0)) {\r\n this.selectOrgs = selection\r\n } else if ((!this.selectOrgs || this.selectOrgs.length == 0) && selection.length > 1) {\r\n if (!this.selectOrgs) {\r\n this.selectOrgs = []\r\n }\r\n for (let i = selection.length - 1; i >= 0; i--) {\r\n this.selectOrgs.push(selection[i])\r\n }\r\n } else if (this.isCurrentChange && selection.length >= 10) {\r\n if (!this.selectOrgs) {\r\n this.selectOrgs = []\r\n } else {\r\n for (let u = this.selectOrgs.length - 1; u >= 0; u--) {\r\n let res = this.indexArray(selection, this.selectOrgs[u])\r\n if (res != -1) {\r\n this.selectOrgs.splice(res, 1)\r\n }\r\n }\r\n }\r\n for (let i = 0; i < selection.length; i++) {\r\n this.selectOrgs.push(selection[i])\r\n }\r\n } else {\r\n for (let i = selection.length - 1; i >= 0; i--) {\r\n this.selectOrgs.push(selection[i])\r\n break\r\n }\r\n }\r\n }\r\n }\r\n },\r\n dialogConfirm() {\r\n this.queryParam = ''\r\n this.customDialogShowList = false\r\n this.calacInputSuffixHeight()\r\n this.syncInputValue()\r\n // this.$store.dispatch(\"dialog/setDialogData\", []);\r\n },\r\n //重置\r\n reset() {\r\n this.queryParams.forEach(paramObj => {\r\n for (let key in paramObj) {\r\n this.queryParams[key] = ''\r\n }\r\n })\r\n //组合树重置\r\n let nodes = this.$refs.combinationTree.store.nodesMap;\r\n for(let key in nodes){\r\n nodes[key].expanded = false;\r\n }\r\n this.combinationTreeQuerys.splice(0);\r\n this.search(true)\r\n },\r\n //查询\r\n search(resetPagintion) {\r\n let querys = [] //查询条件\r\n let queryFilter = {}\r\n if (JSON.stringify(this.pagination) == '{}') {\r\n this.pagination = {page: '1', pageSize: '10', showTotal: 'true'}\r\n }\r\n let pageBean = {pageBean: this.pagination}\r\n if (resetPagintion) {\r\n pageBean.pageBean = {page: '1', pageSize: '10', showTotal: 'true'}\r\n }\r\n //用户输入的\r\n if (this.queryParams.length != 0 && this.queryParams[0] != '') {\r\n this.conditionBind.forEach((item, index) => {\r\n querys.push({\r\n property: item.field,\r\n value: this.queryParams[item.field],\r\n group: 'main',\r\n operation: 'LIKE',\r\n relation: 'AND'\r\n })\r\n })\r\n }\r\n //参数传入的查询拼接\r\n if (this.param) {\r\n const pInst = utils.getOnlineFormInstance(this)\r\n this.param.forEach(item => {\r\n querys.push({\r\n property: item.field,\r\n value: utils.getValueByPath(pInst, item.bind),\r\n group: 'main',\r\n operation: 'LIKE',\r\n relation: 'AND'\r\n })\r\n })\r\n }\r\n //来自组合对话框的\r\n if(this.combinationTreeQuerys && this.combinationTreeQuerys.length != 0){\r\n for(let i = 0 ; i < this.combinationTreeQuerys.length ; i++){\r\n querys.push(this.combinationTreeQuerys[i]);\r\n }\r\n }\r\n if (querys.length > 0) {\r\n queryFilter = this.handlePostData({pageBean: pageBean.pageBean, querys});\r\n this.customDialog.pageBean = queryFilter\r\n this.$store.dispatch('dialog/getlistJson', this.customDialog).then(() => {\r\n this.checkList()\r\n })\r\n } else {\r\n this.customDialog.pageBean = pageBean\r\n this.$store.dispatch('dialog/getlistJson', this.customDialog).then(() => {\r\n this.checkList()\r\n })\r\n }\r\n },\r\n // 处理POST请求时的参数\r\n handlePostData (queryFilter) {\r\n if (!this.customDialog.dataParam || this.customDialog.dataParam.constructor != String) {\r\n return queryFilter;\r\n }\r\n // 构建上下文数据对象\r\n let ctx = {};\r\n queryFilter &&\r\n queryFilter.querys.forEach(element => {\r\n ctx[element.property] = element.value;\r\n });\r\n const exp = hotentUiUtils.parseExp(this.customDialog.dataParam, ctx);\r\n try {\r\n return JSON.parse(exp);\r\n } catch (e) {\r\n CustomQuery._throwException(`POST参数不是有效的JSON格式${query.dataParam}`);\r\n }\r\n },\r\n async doQuery(param) {\r\n let paramLoadData = []\r\n const pInst = utils.getOnlineFormInstance(this)\r\n //获取关联查询绑定的表单参数\r\n for (let i = 0; i < param.conditionfield.length; i++) {\r\n if (param.conditionfield[i].fieldPath != '') {\r\n let bindVal = utils.getValueByPath(pInst, param.conditionfield[i].fieldPath, null)\r\n let obj = {key: param.conditionfield[i].field, value: bindVal}\r\n paramLoadData.push(obj)\r\n }\r\n }\r\n\r\n let queryUrl = param.dsType == 'dataSource' ? '${form}/form/customQuery/v1/doQuery?alias=' + param.alias + '&page=1' : param.url\r\n let requestMethod = 'POST'\r\n //如果关联数据列表查询数据不是数据源则请求方法为restful配置的请求方式\r\n if (param.dsType != 'dataSource') {\r\n requestMethod = param.requestType\r\n }\r\n //查询数据\r\n req.request({url: queryUrl, method: requestMethod, data: paramLoadData}).then(res => {\r\n //判断是否有关联查询数据返回\r\n if (res.data.rows.length > 0) {\r\n //获取关联查询返回的表单参数\r\n for (let io = 0; io < param.resultfield.length; io++) {\r\n if (param.resultfield[io].fieldPath != '') {\r\n let val = ''\r\n for (let j = 0; j < res.data.rows.length; j++) {\r\n if (res.data.rows[j][param.resultfield[io].field]) {\r\n val = val + res.data.rows[j][param.resultfield[io].field] + ','\r\n }\r\n }\r\n val = val.substring(0, val.length - 1)\r\n let pathArr = param.resultfield[io].fieldPath.split('.')\r\n if (pathArr.length == 3) {\r\n //主表\r\n utils.setValueByPath(pInst, param.resultfield[io].fieldPath, val, null)\r\n } else if (pathArr.length == 4) {\r\n //子表\r\n let subData = pInst.data[pathArr[1]][pathArr[2]]\r\n if (subData.length == 0) {\r\n //子表没数据的情况\r\n let subTabName = pathArr[2].replace('sub_', '')\r\n //得到子表的所有字段\r\n let subInitData = pInst.data[pathArr[1]].initData[subTabName] || {}\r\n //把数组里面的值为 null 转换为空字符串\r\n let str = JSON.stringify(subInitData).replace(/null/g, '\"\"')\r\n let subData = JSON.parse(str)\r\n for (var key in subData) {\r\n //点添加时判断要新增子表记录中的孙表是否有值\r\n if (key.indexOf('sub_') == 0 && subData[key].length > 0) {\r\n subData[key] = [] //有则清空\r\n }\r\n //点添加时判断要新增子表记录中的字段是否有值\r\n if (subData[key]) {\r\n subData[key] = '' //有则清空\r\n }\r\n }\r\n //新增一条数据\r\n pInst.data[pathArr[1]][pathArr[2]].push(subData)\r\n //对话框关联查询返回的值赋值给绑定的字段\r\n utils.setValueByPath(pInst, param.resultfield[io].fieldPath, val, 0)\r\n } else {\r\n //子表有数据的情况\r\n for (let p = 0; p < subData.length; p++) {\r\n //对话框关联查询返回的值赋值给绑定的字段\r\n utils.setValueByPath(pInst, param.resultfield[io].fieldPath, val, p)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n } else {\r\n //没有返回的值则清空\r\n //获取关联查询返回的表单参数\r\n for (let iop = 0; iop < param.resultfield.length; iop++) {\r\n if (param.resultfield[iop].fieldPath != '') {\r\n let pathArr = param.resultfield[iop].fieldPath.split('.')\r\n if (pathArr.length == 3) {\r\n //主表\r\n //赋值给绑定的字段\r\n utils.setValueByPath(pInst, param.resultfield[iop].fieldPath, '', null)\r\n } else if (pathArr.length == 4) {\r\n //子表\r\n let subData = pInst.data[pathArr[1]][pathArr[2]]\r\n for (let p = 0; p < subData.length; p++) {\r\n //对话框关联查询返回的值赋值给绑定的字段\r\n utils.setValueByPath(pInst, param.resultfield[iop].fieldPath, '', p)\r\n }\r\n }\r\n }\r\n }\r\n }\r\n })\r\n },\r\n // 同步选择结果\r\n syncInputValue() {\r\n let thisIndex = null //当前数据所在下标\r\n let parentIndex = null //父节点所在下标\r\n if (this.$el) {\r\n thisIndex = utils.getSomeAttributeFromParentElement(this.$el, 'data-index')\r\n parentIndex = utils.getSomeAttributeFromParentElement(this.$parent.$el, 'data-index')\r\n }\r\n var returnStr = JSON.parse(this.customDialog.resultfield)\r\n //拿到返回的字段\r\n var field = new Array([returnStr.length])\r\n var comment = new Array([returnStr.length])\r\n var str = []\r\n for (var i = 0; i < returnStr.length; i++) {\r\n field[i] = this.customDialog.dsType == 'dataSource' ? returnStr[i].field.toLowerCase() : returnStr[i].field\r\n comment[i] = this.customDialog.dsType == 'dataSource' ? returnStr[i].comment.toLowerCase() : returnStr[i].comment\r\n }\r\n const this_ = this\r\n var s = this.selectOrgs\r\n this.showData = [...this.selectOrgs]\r\n this.checkBoxDataAll = [...this.selectOrgs]\r\n if (this.customDialog.selectNum === 1) {\r\n s = this.selectOrgs\r\n }\r\n if (this.customDialog.selectNum === 1) {\r\n var temp = ''\r\n for (var i = 0; i < comment.length; i++) {\r\n let sField = s[0][field[i]] === undefined ? '' : s[0][field[i]]\r\n let encodeStr = encodeURIComponent(sField)\r\n temp += '\"' + comment[i] + '\":\"' + encodeStr + '\",'\r\n }\r\n if (temp != '') {\r\n temp = '{' + temp.substring(0, temp.length - 1) + '}'\r\n }\r\n str.push(utils.parseToJson(temp))\r\n } else {\r\n for (var i = 0; i < s.length; i++) {\r\n var temp = ''\r\n for (var j = 0; j < comment.length; j++) {\r\n let encodeStr = encodeURIComponent(s[i][field[j]])\r\n temp += '\"' + comment[j] + '\":\"' + encodeStr + '\",'\r\n }\r\n if (temp != '') {\r\n temp = '{' + temp.substring(0, temp.length - 1) + '}'\r\n }\r\n str.push(utils.parseToJson(temp))\r\n }\r\n }\r\n // this.$emit(\"input\", JSON.stringify(str));\r\n const pInst = utils.getOnlineFormInstance(this)\r\n const _this = this\r\n this.custdialog.custDialog.mappingConf.forEach(con => {\r\n var val = ''\r\n var from = ''\r\n if (_this.customDialog.dsType == 'restful') {\r\n from = con.from\r\n } else {\r\n from = con.from.toLowerCase()\r\n }\r\n str.forEach(item => {\r\n val += decodeURIComponent(item[from]) + ','\r\n })\r\n if (this.atter == 'data.' + con['target'][0]) {\r\n val = val.substring(0, val.length - 1)\r\n utils.setValueByPath(pInst, 'data.' + con['target'][0], val, thisIndex)\r\n } else if (this.atter == 'searchForm.' + con['target'][0]) {\r\n utils.setValueByPath(pInst, 'searchForm.' + con['target'][0], val.substring(0, val.length - 1), thisIndex)\r\n } else {\r\n let configAttr= con['target'][0].split(\".\")\r\n let path= con['target'][0];\r\n if (configAttr.length==4 && parentIndex>=0){//孙表数据赋值\r\n path=configAttr[0]+\".\"+configAttr[1]+\"[\"+parentIndex+\"].\"+configAttr[2]+\".\"+configAttr[3];\r\n }\r\n if (pInst.data){\r\n utils.setValueByPath(pInst, 'data.' +path,val.substring(0, val.length - 1), thisIndex)\r\n } else{\r\n utils.setValueByPath(pInst, 'model.' +path,val.substring(0, val.length - 1), thisIndex)\r\n }\r\n }\r\n })\r\n //判断对话框是否绑定了关联查询\r\n let custQueryJson = this.custdialog.custDialog.custQueryJson\r\n if (custQueryJson.length > 0) {\r\n for (let i = 0; i < custQueryJson.length; i++) {\r\n if (custQueryJson[i].conditionfield.length > 0) {\r\n this.doQuery(custQueryJson[i])\r\n } else {\r\n console.error('[' + custQueryJson[i].comment + ']关联查询取值参数未绑定表单字段')\r\n }\r\n }\r\n }\r\n },\r\n //取消按钮\r\n dialogCancel() {\r\n const this_ = this\r\n this_.queryParam = ''\r\n this_.$store.dispatch('dialog/setDialogData', []).then(() => {\r\n this_.customDialogShowList = false\r\n //判断是否是点击了确认再点击取消的 inputVal没有值则表示直接点击的取消\r\n if (!this_.inputVal) {\r\n this_.selectOrgs = []\r\n } else {\r\n this_.selectOrgs = [...this_.showData]\r\n this.checkBoxDataAll = [...this_.selectOrgs]\r\n }\r\n })\r\n },\r\n dialogTreeConfirm() {\r\n this.calacInputSuffixHeight()\r\n let thisIndex = null //当前数据所在下标\r\n let parentIndex = null //父节点所在下标\r\n if (this.$el) {\r\n thisIndex = utils.getSomeAttributeFromParentElement(this.$el, 'data-index')\r\n parentIndex = utils.getSomeAttributeFromParentElement(this.$parent.$el, 'data-index')\r\n }\r\n this.$store.dispatch('dialog/setDialogData', [])\r\n var returnStr = JSON.parse(this.customDialog.resultfield)\r\n var field = new Array([returnStr.length])\r\n var comment = new Array([returnStr.length])\r\n var str = []\r\n for (var i = 0; i < returnStr.length; i++) {\r\n field[i] = returnStr[i].field\r\n comment[i] = returnStr[i].comment\r\n }\r\n if (this.customDialog.selectNum === 1) {\r\n var nodes = this.propsData[0]\r\n var temp = ''\r\n for (var i = 0; i < comment.length; i++) {\r\n temp += '\"' + comment[i] + '\":\"' + nodes[field[i]] + '\",'\r\n }\r\n if (temp != '') {\r\n temp = '{' + temp.substring(0, temp.length - 1) + '}'\r\n }\r\n str.push(utils.parseToJson(temp))\r\n } else {\r\n var nodes = this.propsData\r\n nodes.forEach((item, k) => {\r\n var temp = ''\r\n for (var i = 0; i < comment.length; i++) {\r\n temp += '\"' + comment[i] + '\":\"' + nodes[field[i]] + '\",'\r\n temp += '\"' + comment[i] + '\":\"' + nodes[k][field[i]] + '\",'\r\n }\r\n if (temp != '') {\r\n temp = '{' + temp.substring(0, temp.length - 1) + '}'\r\n }\r\n str.push(utils.parseToJson(temp))\r\n })\r\n }\r\n const pInst = utils.getOnlineFormInstance(this)\r\n this.custdialog.custDialog.mappingConf.forEach(con => {\r\n var val = ''\r\n str.forEach(item => {\r\n val += item[con.from] + ','\r\n })\r\n if (this.atter == 'data.' + con['target'][0]) {\r\n utils.setValueByPath(pInst, 'data.' + con['target'][0], val.substring(0, val.length - 1), thisIndex)\r\n } else if (this.atter == 'searchForm.' + con['target'][0]) {\r\n utils.setValueByPath(pInst, 'searchForm.' + con['target'][0], val.substring(0, val.length - 1), thisIndex)\r\n } else {\r\n let configAttr= con['target'][0].split(\".\")\r\n let path= con['target'][0];\r\n if (configAttr.length==4 && parentIndex>=0){//孙表数据赋值\r\n path=configAttr[0]+\".\"+configAttr[1]+\"[\"+parentIndex+\"].\"+configAttr[2]+\".\"+configAttr[3];\r\n }\r\n if (pInst.data){\r\n utils.setValueByPath(pInst, 'data.' +path,val.substring(0, val.length - 1), thisIndex)\r\n } else{\r\n utils.setValueByPath(pInst, 'model.' +path,val.substring(0, val.length - 1), thisIndex)\r\n }\r\n\r\n }\r\n })\r\n //this.$emit(\"input\", JSON.stringify(str));\r\n this.showData = [...this.propsData] //回显的值\r\n this.customDialogShowTree = false\r\n },\r\n dialogCancelTree() {\r\n this.$store.dispatch('dialog/setDialogData', [])\r\n this.customDialogShowTree = false\r\n },\r\n getChecked(data, checked, indeterminate) {\r\n if (this.customDialog.selectNum === 1) {\r\n this.propsData = []\r\n this.propsData.push(data)\r\n } else {\r\n this.propsData = this.$refs.tree.getCheckedNodes()\r\n }\r\n },\r\n treeClick(data, n, i) {\r\n if (this.customDialog.selectNum === 1) {\r\n this.propsData = []\r\n this.propsData.push(data)\r\n }\r\n },\r\n clearAllSelectOrgs() {\r\n this.selectOrgs = null\r\n this.$refs.orgTable.clearSelection()\r\n },\r\n removeSelectOrg(item) {\r\n if (this.customDialog.selectNum === 1) {\r\n this.$emit('input', '')\r\n this.selectOrgs.splice(item, 1)\r\n this.showData.splice(item, 1)\r\n } else {\r\n this.inputVal.splice(item, 1)\r\n // let removeId = this.showData[item];\r\n //树形\r\n if (this.propsData.length > 0) {\r\n this.propsData.splice(item, 1)\r\n }\r\n if (this.showData.length > 0) {\r\n this.showData.splice(item, 1)\r\n }\r\n //列表\r\n if (this.selectOrgs != null) {\r\n this.selectOrgs.splice(item, 1)\r\n this.checkBoxDataAll.splice(item, 1)\r\n this.selectOrgs.forEach(row => {\r\n // if(item.id ==removeId ){\r\n this.isCurrentChange = true\r\n this.toggleRowSelection(row, false)\r\n // }\r\n })\r\n }\r\n this.calacInputSuffixHeight()\r\n let value = ''\r\n this.inputVal.forEach(val => {\r\n value += val.value + ','\r\n })\r\n if (value.length > 0) {\r\n value = value.substring(0, value.length - 1)\r\n }\r\n if (value != '') {\r\n value = value + '||' + JSON.stringify(this.showData)\r\n }\r\n this.$emit('input', value)\r\n }\r\n this.syncInputValue()\r\n },\r\n calacInputSuffixHeight() {\r\n setTimeout(() => {\r\n if (!this.$refs.tagSpans) return\r\n if (this.$refs.tagSpans.offsetHeight) {\r\n this.inputSuffixHeight = this.$refs.tagSpans.offsetHeight + 5\r\n } else {\r\n this.inputSuffixHeight = 30\r\n }\r\n // 触发验证\r\n this.$validator.validate()\r\n }, 0)\r\n },\r\n customDialogShow(pageParam) {\r\n this.customDialogShowList = true\r\n this.customDialog = pageParam.customDialog\r\n this.customDialog.queryUrl =\r\n this.customDialog.dsType == 'dataSource'\r\n ? '${form}/form/customDialog/v1/getListData?alias=' +\r\n this.customDialog.alias +\r\n '&mapParam=' +\r\n (this.customDialog.mapParam ? this.customDialog.mapParam : '')\r\n : this.customDialog.url\r\n if (this.dialogData.length < 1) {\r\n this.search()\r\n this.displayfield = JSON.parse(pageParam.customDialog.displayfield)\r\n if (this.customDialog.dsType == 'dataSource') {\r\n for (var i = 0; i < this.displayfield.length; i++) {\r\n this.displayfield[i].field = this.displayfield[i].field.toLowerCase()\r\n }\r\n }\r\n } else if (this.dialogData.length > 1) {\r\n this.search()\r\n }\r\n if (this.dialogData.length > 0 && this.displayfield.length == 0) {\r\n this.search()\r\n this.displayfield = JSON.parse(pageParam.customDialog.displayfield)\r\n if (this.customDialog.dsType == 'dataSource') {\r\n for (var i = 0; i < this.displayfield.length; i++) {\r\n this.displayfield[i].field = this.displayfield[i].field.toLowerCase()\r\n }\r\n }\r\n }\r\n },\r\n customDialogTreeShow(pageParam) {\r\n var customDialog = this.customDialog\r\n let mapParamObj = {};//数据来源是数据源,且有动态参数传入时调用\r\n let mapParam = \"\";\r\n let defaultPValue = \"\";//父ID值\r\n if(this.conditionfieldTree.length>0){\r\n for(let i=0;i value[id] == value[pid] || value[pid] == null || value[pid] == pvalue);\r\n if (!parents){\r\n parents = data.filter(value => value[pid] !== 'undefined' && value[pid] != null && value[id] != value[pid]);\r\n }\r\n return parents\r\n },\r\n loadTree(node, resolve) {\r\n if (node) {\r\n let this_ = this\r\n let displayField = this_.customDialog.style == 2 ? this_.combiTreeDisplayField : this_.displayField\r\n resolve(this.treeList.filter(value => value[displayField.pid] === node.data[displayField.id]))\r\n if (this.showData && this.showData.length > 0) {\r\n setTimeout(() => {\r\n this.showData.forEach(v => {\r\n if (v.Pid == node.key) {\r\n this_.$refs.tree.setChecked(v, true)\r\n } else {\r\n this_.checkNode(v, this_)\r\n }\r\n })\r\n }, 400)\r\n }\r\n }\r\n },\r\n\r\n afterOpen(){\r\n //打开对话框之后加载树\r\n this.loadCombinationTree()\r\n },\r\n loadCombinationTree(){\r\n if(this.customDialog.style != 2){\r\n return ;\r\n }\r\n let combinationRule = JSON.parse(this.customDialog.combinationRule);\r\n this.combinationRule = combinationRule;\r\n let treeAlias = combinationRule.leftTree;\r\n //获取对话框数据\r\n req.get('${form}/form/customDialog/v1/getByAlias?alias='+treeAlias).then(resp=>{\r\n let treeDialog = resp.data;\r\n this.leftTreeTitle = treeDialog.name;\r\n let reqParam = {};\r\n let requestType = treeDialog.dsType == 'dataSource' ? 'GET' : treeDialog.requestType ? treeDialog.requestType : 'POST';\r\n let url = '${form}/form/customDialog/v1/getTreeData?alias=' + treeAlias + \"&mapParam=\";\r\n let paramsObj = {};\r\n if(treeDialog.dsType != 'dataSource'){\r\n url = treeDialog.url;\r\n let templatePa = treeDialog.dataParam;\r\n if(treeDialog.conditionfield){\r\n let conditions = JSON.parse(treeDialog.conditionfield);\r\n for(let i = 0 ; i < conditions.length ; i++){\r\n let con = conditions[i];\r\n if(requestType == 'POST'){\r\n if(templatePa){\r\n templatePa = templatePa.replace(new RegExp('\\\\{' + con.field + '\\\\}', 'g'),con.defaultValue);\r\n }else{\r\n paramsObj[con.field] = con.defaultValue;\r\n }\r\n }else{\r\n let ljChar = url.indexOf('?') == -1 ? '?' : '&';\r\n url = url + ljChar + con.field + '=' + con.defaultValue;\r\n }\r\n }\r\n if(templatePa){\r\n paramsObj = JSON.parse(templatePa);\r\n }\r\n }\r\n }\r\n let requestParams = {};\r\n requestParams.requestType = requestType;\r\n requestParams.url = url;\r\n requestParams.paramsObj = paramsObj;\r\n this.$store.dispatch('dialog/getTreeData',requestParams).then(resp => {\r\n if(treeDialog.displayfield && treeDialog.resultfield){\r\n let displayField = JSON.parse(treeDialog.displayfield);\r\n let resultfield = JSON.parse(treeDialog.resultfield);\r\n this.defaultProps.label = displayField.displayName;\r\n this.treeList = resp;\r\n this.combiTreeDisplayField = displayField;\r\n this.combinationTreeData = this.toTreeData(\r\n resp,\r\n displayField.id,\r\n displayField.pid,\r\n displayField.displayName,\r\n displayField.pvalue ? displayField.pvalue:'0',\r\n resultfield\r\n )\r\n }\r\n })\r\n })\r\n },\r\n combiTreeClick(paramObj,node,nodeComponent){\r\n //组合对话框点击左树\r\n //清空旧的\r\n this.combinationTreeQuerys.splice(0);\r\n let combinationRule = JSON.parse(this.customDialog.combinationRule);\r\n if(!combinationRule.rules || combinationRule.rules.length == 0){\r\n return ;\r\n }\r\n let rules = combinationRule.rules;\r\n for(let i = 0;i < rules.length ; i++){\r\n let value = paramObj[rules[i].treeField];\r\n let property = rules[i].listField;\r\n this.combinationTreeQuerys.push({\r\n property:property,\r\n value: value,\r\n group: \"treeGroup\",\r\n operation:this.getOperation(rules[i].condition),\r\n relation: \"AND\"\r\n })\r\n }\r\n this.search();\r\n },\r\n //获取运算符号\r\n getOperation(old){\r\n if(!old){\r\n return \"\";\r\n }\r\n if(old == \"EQ\"){\r\n return \"EQUAL\";\r\n }\r\n if(old == \"LK\"){\r\n return \"LIKE\"\r\n }\r\n if(old == \"LFK\"){\r\n return \"LIKE\"\r\n }\r\n if(old == \"IN\"){\r\n return \"IN\";\r\n }\r\n },\r\n toggleTree(){\r\n if(this.treeShow){\r\n this.treeShow = false;\r\n this.transtionWidth = \"0%\";\r\n this.toggleBtn = \"el-icon-arrow-right\"\r\n }else{\r\n this.treeShow = true;\r\n this.transtionWidth = \"25%\";\r\n this.toggleBtn = \"el-icon-arrow-left\"\r\n }\r\n }\r\n }\r\n}\r\n",null]}