{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\system\\SysDict\\SysDict.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\system\\SysDict\\SysDict.vue","mtime":1675071993210},{"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":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\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 portal from '@/api/portal'\r\nimport LowerDictModal from './LowerDictModal.vue'\r\nimport tenant from '@/store/tenant'\r\nimport user from '@/store/user'\r\n\r\nconst htAsideTree = () => import('@/components/common/HtAsideTree.vue')\r\nconst htSysTypeTree = () => import('@/components/common/HtSysTypeTree.vue')\r\nexport default {\r\n components: {\r\n htAsideTree,\r\n LowerDictModal,\r\n htSysTypeTree,\r\n },\r\n data() {\r\n return {\r\n tableHeight: 'calc(100vh - 318px)',\r\n dictItem: [],\r\n dialogVisible: false,\r\n filtersOptions: [\r\n {value: -1, text: '草稿'},\r\n {value: 1, text: '启用'},\r\n {value: 0, text: '禁用'},\r\n ],\r\n data: [],\r\n querySearch: [\r\n {\r\n label: '名称',\r\n prop: 'name_',\r\n },\r\n {\r\n label: '编码',\r\n prop: 'code_',\r\n },\r\n ],\r\n pageResult: {\r\n page: 1,\r\n pageSize: 50,\r\n total: 0,\r\n },\r\n options: {\r\n kindId: [\r\n {code: 1, desc: '系统字典'},\r\n {code: 2, desc: '租户字典'},\r\n ],\r\n },\r\n PortalSysDictionary: {\r\n name: '',\r\n code: '',\r\n kindId: 1,\r\n memo: '',\r\n details: [],\r\n treeId: '',\r\n },\r\n saveMethod: 'POST',\r\n multipleSelection: [],\r\n dictSelection: [],\r\n defaultQuerys: [],\r\n parantTreeId: '',\r\n // 移动字典\r\n moveDialog: false,\r\n moveDictionary: {},\r\n moveTreeId: '',\r\n currentDictId: '',\r\n snChange: null,\r\n tenantId: undefined, // -1 是超管,\r\n changeTree: false,\r\n }\r\n },\r\n mounted() {\r\n this.$validator = this.$root.$validator\r\n },\r\n methods: {\r\n // 树的点击回调 查询列表\r\n handleNodeClick(node) {\r\n this.changeTree = true\r\n if (node.parentId != 0) {\r\n this.$set(this.defaultQuerys, 0, {\r\n property: 'TREE_ID_',\r\n value: node.id,\r\n operation: 'EQUAL',\r\n })\r\n this.parantTreeId = node.id\r\n } else {\r\n //清空旧的查询值\r\n this.defaultQuerys.splice(0)\r\n this.parantTreeId = ''\r\n }\r\n this.$refs.htTable.load()\r\n },\r\n // 加载字典\r\n loadData(param, cb) {\r\n console.log(param,'param')\r\n if (this.changeTree && this.parantTreeId) {\r\n param.querys = [\r\n {\r\n property: 'TREE_ID_',\r\n value: this.parantTreeId,\r\n operation: 'EQUAL',\r\n },\r\n ]\r\n }else if (this.changeTree && !this.parantTreeId){\r\n param.querys = []\r\n }\r\n portal\r\n .loadDictList(param)\r\n .then((resp) => {\r\n let response = resp\r\n this.data = response.rows\r\n this.pageResult = {\r\n page: response.page,\r\n pageSize: response.pageSize,\r\n total: response.total,\r\n }\r\n this.changeTree = false\r\n })\r\n .finally(() => cb())\r\n },\r\n // 新增编辑\r\n showDialog(id) {\r\n if (\r\n user.state.currentUserDetail &&\r\n user.state.currentUserDetail.user\r\n ) {\r\n this.tenantId = user.state.currentUserDetail.user.tenantId\r\n }\r\n if (id) {\r\n this.currentDictId = id\r\n this.loadDictItem()\r\n } else {\r\n if (!this.parantTreeId) {\r\n this.$message.warning('请先选择左侧添加的父节点!')\r\n } else {\r\n this.dialogVisible = true\r\n }\r\n }\r\n },\r\n // 更新状态\r\n handleDictFlag(flag) {\r\n // this.dictSelection 选中的数据\r\n if (!this.dictSelection.length) {\r\n this.$message.warning(`请选择要${flag}用的数据`)\r\n return\r\n } else {\r\n let msg = `确定${flag}用选中数据吗?`\r\n this.$confirm(msg, '提示', {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消',\r\n type: 'warning',\r\n })\r\n .then(() => {\r\n let ids = []\r\n this.dictSelection.forEach((item) => {\r\n ids.push(item.id)\r\n })\r\n let param = this.qs.stringify({\r\n status: flag == '启' ? 1 : 0,\r\n ids: ids.join(','),\r\n })\r\n // 调用接口 提交数据\r\n portal.updateDictionariesStatus(param).then((res) => {\r\n this.dictSelection = [];\r\n this.$refs.htTable.load()\r\n })\r\n })\r\n .catch(() => {\r\n this.$message({\r\n type: 'info',\r\n message: `已取消${flag ? '启用' : '禁用'}`,\r\n })\r\n })\r\n }\r\n },\r\n // 清空选择项\r\n afterDelete(){\r\n this.dictSelection = [];\r\n },\r\n\r\n // 选择字典回调\r\n selectDict(selection, row) {\r\n this.dictSelection = selection\r\n },\r\n // 获取字典子表 --字典项\r\n loadDictItem() {\r\n let data = this.qs.stringify({id: this.currentDictId})\r\n portal.loadDictionaryById(data).then(\r\n (resp) => {\r\n this.PortalSysDictionary = resp\r\n if (this.PortalSysDictionary.details.length) {\r\n this.PortalSysDictionary.details.sort((a, b) => {\r\n return a.sn - b.sn\r\n })\r\n this.PortalSysDictionary.details.forEach(\r\n (item, index) => {\r\n item.key = new Date().getTime() + index\r\n }\r\n )\r\n this.dictItem = [...this.PortalSysDictionary.details]\r\n }\r\n this.dialogVisible = true\r\n },\r\n (error) => {\r\n reject(error)\r\n }\r\n )\r\n },\r\n // 子表改变排序号\r\n changeSN(row) {\r\n if (this.snChange == null) {\r\n this.snChange = {}\r\n this.snChange[row.id] = row.sn\r\n } else {\r\n this.snChange[row.id] = row.sn\r\n }\r\n console.log(this.snChange)\r\n },\r\n // 同步缓存\r\n handleSyncRedis() {\r\n portal\r\n .syncDictionaryRedis()\r\n .then((resp) => {\r\n this.$message.success(resp.message)\r\n })\r\n .catch((err) => {\r\n this.$message.warning(err)\r\n })\r\n },\r\n // 移动字典\r\n handleMoveDict() {\r\n if (!this.dictSelection.length) {\r\n this.$message.warning(`请选择要移动的字典`)\r\n return\r\n } else {\r\n this.moveDialog = true\r\n }\r\n },\r\n beforeCloseMoveDialog() {\r\n this.moveTreeId = ''\r\n this.moveDialog = false\r\n },\r\n MoveDict() {\r\n if (!this.moveTreeId) {\r\n this.$message.warning(`请选择移动的目标字典目录`)\r\n return\r\n }\r\n let ids = []\r\n this.dictSelection.forEach((item) => {\r\n ids.push(item.id)\r\n })\r\n let data = this.qs.stringify({\r\n treeId: this.moveTreeId,\r\n ids: ids.join(','),\r\n })\r\n portal\r\n .moveDictionaries(data)\r\n .then((res) => {\r\n this.moveTreeId = ''\r\n this.moveDialog = false\r\n this.dictSelection = []\r\n this.$refs.htTable.load()\r\n })\r\n .catch((err) => {\r\n this.$message.warning(err)\r\n })\r\n },\r\n handleMoveTreeClick(node) {\r\n console.log(node)\r\n if (node.parentId != 0) {\r\n this.moveTreeId = node.id\r\n } else {\r\n this.moveTreeId = ''\r\n }\r\n },\r\n // 子表验证\r\n checkRepeat(value, column, currentItem) {\r\n return new Promise((resolve) => {\r\n let Temp = this.dictItem.filter(\r\n (item) => item.key != currentItem.key\r\n )\r\n if (Temp.length) {\r\n Temp.forEach((item) => {\r\n if (item[column] == value) {\r\n resolve(false)\r\n }\r\n })\r\n resolve(true)\r\n } else {\r\n resolve(true)\r\n }\r\n })\r\n },\r\n // 提交验证\r\n async beforeSaveData() {\r\n console.log(this.dictItem, this.tenantId)\r\n if (this.dictItem.length) {\r\n // this.checkDictItem();\r\n let TempArr = [...this.dictItem]\r\n TempArr.forEach((item) => {\r\n delete item.key\r\n })\r\n this.PortalSysDictionary.details = TempArr\r\n }\r\n console.log(this.dictItem, 'beforeSaveData')\r\n if (!this.PortalSysDictionary.treeId) {\r\n this.PortalSysDictionary.treeId = this.parantTreeId\r\n }\r\n console.log(tenant)\r\n if (tenant.state.tenantId) {\r\n this.PortalSysDictionary.tenantId = tenant.state.tenantId\r\n }\r\n // 超管默认添加系统字典,其他默认是租户字典\r\n this.PortalSysDictionary.kindId = this.tenantId == '-1' ? 1 : 2\r\n this.isSubmit = true\r\n },\r\n handleAdd() {\r\n let length = this.dictItem.length\r\n let dictionaryId = ''\r\n if (this.PortalSysDictionary && this.PortalSysDictionary.id) {\r\n dictionaryId = this.PortalSysDictionary.id\r\n }\r\n this.dictItem.push({\r\n dictionaryId,\r\n name: '',\r\n value: '',\r\n sn: length + 1,\r\n flag: -1,\r\n key: new Date().getTime() + length,\r\n })\r\n },\r\n handleDictItemDel() {\r\n // 非草稿状态不可删除\r\n // 区别有id 没得id\r\n if (!this.multipleSelection.length) {\r\n this.$message.warning('请选择要删除得数据')\r\n return\r\n } else {\r\n // 过滤出草稿状态得数据\r\n let initDictItem = this.multipleSelection.filter(\r\n (item) => item.flag == -1\r\n )\r\n if (!initDictItem.length) {\r\n this.$message.warning('启用或禁用状态的数据,不可删除!')\r\n } else {\r\n let msg =\r\n '如存在未保存的字典成员,请先保存!如继续此操作未保存的编辑将被删除,是否继续?'\r\n this.$confirm(msg, '提示', {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消',\r\n type: 'warning',\r\n })\r\n .then(() => {\r\n // 收集已提交的数据id\r\n let ids = [],\r\n keys = []\r\n initDictItem.forEach((item) => {\r\n keys.push(item.key)\r\n if (item.id) {\r\n ids.push(item.id)\r\n }\r\n })\r\n // 本地删除草稿的数据\r\n const dataSource = [...this.dictItem]\r\n let dataTemp = dataSource.filter(\r\n (item) => !keys.includes(item.key)\r\n )\r\n this.dictItem = dataTemp\r\n\r\n if (ids.length > 0) {\r\n // 提交数据\r\n let params = this.qs.stringify({\r\n ids: ids.join(','),\r\n })\r\n portal.deleteDictItem(params).then(() => {\r\n this.loadDictItem()\r\n this.$message.success('删除成功')\r\n })\r\n }\r\n })\r\n .catch(() => {\r\n this.$message({\r\n type: 'info',\r\n message: `已取消删除`,\r\n })\r\n })\r\n }\r\n }\r\n },\r\n handleDictItemFlag(status) {\r\n this.multipleSelection.forEach((item) => {\r\n item.keys\r\n })\r\n let hasNoSave = false\r\n if (this.multipleSelection.length <= 0) {\r\n this.$message.warning('请选择至少一条数据!')\r\n return\r\n } else {\r\n let ids = []\r\n this.multipleSelection.forEach((item) => {\r\n if (!item.id) {\r\n hasNoSave = true\r\n return\r\n }\r\n ids.push(item.id)\r\n })\r\n if (ids.length <= 0) {\r\n this.$message.warning('所选数据未保存,不能进行该操作!')\r\n return\r\n }\r\n let query = {\r\n ids: ids.join(','),\r\n status,\r\n }\r\n let param = this.qs.stringify(query, {\r\n indices: false,\r\n })\r\n let tag = status ? '启' : '禁'\r\n let msg\r\n if (hasNoSave) {\r\n msg =\r\n '存在未保存的字段成员,请先保存!如继续此操作未保存的编辑将被清除,是否继续?'\r\n } else {\r\n msg = `确定${tag}用选中数据,是否继续?`\r\n }\r\n this.$confirm(msg, '提示', {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消',\r\n type: 'warning',\r\n })\r\n .then(() => {\r\n // 调用接口 提交数据\r\n portal.updateDictItemStatus(param).then(() => {\r\n this.loadDictItem()\r\n this.$message.success(\r\n `${status ? '启用' : '禁用'}成功`\r\n )\r\n })\r\n })\r\n .catch(() => {\r\n this.$message({\r\n type: 'info',\r\n message: `已取消${status ? '启用' : '禁用'}`,\r\n })\r\n })\r\n }\r\n },\r\n handleIndex() {\r\n if (this.snChange == null) {\r\n this.$message.warning('字典项排序号无更改')\r\n } else {\r\n portal.updateDictItemSequence(this.snChange).then(() => {\r\n this.loadDictItem()\r\n this.$message.success('排序号更新成功!')\r\n })\r\n }\r\n },\r\n // 子表的选择回调\r\n handleSelectionChange(val) {\r\n this.multipleSelection = val\r\n },\r\n // 打开级联字典弹窗\r\n loadSub(row, type) {\r\n console.log(row, type)\r\n this.$refs.lowerDict.open(row, type, this.currentDictId)\r\n },\r\n // 关闭前重置状态\r\n beforeCloseDialog() {\r\n this.PortalSysDictionary = {\r\n kindId: 1,\r\n name: '',\r\n code: '',\r\n memo: '',\r\n details: [],\r\n treeId: '',\r\n }\r\n this.dictItem = []\r\n this.currentDictId = ''\r\n this.dialogVisible = false\r\n },\r\n afterSaveData(close) {\r\n setTimeout(() => {\r\n if (close) {\r\n this.beforeCloseDialog()\r\n } else {\r\n this.loadDictItem()\r\n }\r\n this.$refs.htTable.load()\r\n }, 0)\r\n },\r\n GetResponseValue(value){\r\n this.currentDictId = value;\r\n }\r\n },\r\n}\r\n",null]}