DeptBaseInfo.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div :visible="visible">
  3. <a-descriptions size="small" bordered :column="1">
  4. <a-descriptions-item label="机构名称">{{model.departName}}</a-descriptions-item>
  5. <a-descriptions-item label="上级部门"><span>{{model.parentId}}</span></a-descriptions-item>
  6. <a-descriptions-item label="机构编码"><span>{{model.orgCode}}</span></a-descriptions-item>
  7. <!-- <a-descriptions-item label="机构类型"><span>{{model.orgCategory}}</span></a-descriptions-item>-->
  8. <!-- <a-descriptions-item label="排序"><span>{{model.departOrder}}</span></a-descriptions-item>-->
  9. <a-descriptions-item label="手机号"><span>{{model.mobile}}</span></a-descriptions-item>
  10. <a-descriptions-item label="地址"><span>{{model.address}}</span></a-descriptions-item>
  11. <a-descriptions-item label="备注"><span>{{model.memo}}</span></a-descriptions-item>
  12. </a-descriptions>
  13. </div>
  14. </template>
  15. <script>
  16. import { queryIdTree } from '@/api/api'
  17. export default {
  18. name: 'DeptBaseInfo',
  19. components: {},
  20. data() {
  21. return {
  22. departTree: [],
  23. id: '',
  24. model: {},
  25. visible: false,
  26. disable: true,
  27. treeData: [],
  28. labelCol: {
  29. xs: {span: 24},
  30. sm: {span: 3}
  31. },
  32. wrapperCol: {
  33. xs: {span: 24},
  34. sm: {span: 16}
  35. },
  36. }
  37. },
  38. created() {
  39. this.loadTreeData();
  40. },
  41. methods: {
  42. loadTreeData() {
  43. queryIdTree().then((res) => {
  44. if (res.success) {
  45. for (let i = 0; i < res.result.length; i++) {
  46. let temp = res.result[i];
  47. this.treeData.push(temp);
  48. }
  49. }
  50. })
  51. },
  52. open(record) {
  53. this.visible = true;
  54. //update-begin---author:wangshuai ---date:20220211 for:[JTC-174]部门管理界面参考vue3的改改------------
  55. this.model = Object.assign({}, record)
  56. this.model.parentId = this.findTree(this.treeData,record.parentId);
  57. this.model.orgCategory = this.orgCategoryText(record.orgCategory)
  58. //update-end---author:wangshuai ---date:20220211 for:[JTC-174]部门管理界面参考vue3的改改------------
  59. },
  60. clearForm() {
  61. this.treeData = [];
  62. },
  63. /**
  64. * 通过父id查找部门名称
  65. * @param treeList 树数组
  66. * @param id 父id
  67. * @return id对应的部门名称
  68. */
  69. findTree(treeList,id){
  70. for (let i = 0; i < treeList.length; i++) {
  71. let item = treeList[i];
  72. //如果当前id和父id相同则返回部门名称
  73. if (item.key == id) {
  74. return item.title;
  75. }
  76. let children = item.children
  77. //存在子部门进行递归查询
  78. if(children){
  79. let findResult = this.findTree(children, id);
  80. //返回的数据不为空,结束递归,返回结果
  81. if (findResult) {
  82. return findResult
  83. }
  84. }
  85. }
  86. },
  87. /**
  88. * 将机构类型数值翻译成文本
  89. * @param orgCategory 部门类别
  90. * @return 部门类别对应的文本
  91. */
  92. orgCategoryText(orgCategory) {
  93. if(orgCategory == 1){
  94. return "公司";
  95. }else if(orgCategory == 2){
  96. return "部门";
  97. }else{
  98. return "岗位";
  99. }
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped lang="less">
  105. .ant-descriptions-view{
  106. border: 1px solid #f0f0f0;
  107. }
  108. /deep/ .ant-descriptions-item-label{
  109. width:180px
  110. }
  111. /deep/ .ant-descriptions-item-content span{
  112. color:#000000d9;
  113. }
  114. /deep/ .ant-descriptions-bordered .ant-descriptions-row{
  115. border-bottom: 1px solid #f0f0f0 !important;
  116. }
  117. /deep/ .ant-descriptions-bordered .ant-descriptions-item-label{
  118. border-right: 1px solid #f0f0f0;
  119. }
  120. </style>