detailDialog.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <div>
  3. <headerTitle title="计划信息"></headerTitle>
  4. <plan-form ref="planForm" :dialog-type="dialogType" :dialogForm="dialogForm" :deptList="deptList"
  5. :deptTreeList="deptTreeList"></plan-form>
  6. <headerTitle title="计划节点"></headerTitle>
  7. <plan-info-table ref="planInfoTable" :dialog-type="dialogType" :dialogForm="dialogForm" :deptList="deptList"
  8. :deptTreeList="deptTreeList"></plan-info-table>
  9. </div>
  10. </template>
  11. <script>
  12. import PlanForm from "@/views/bpm/handleTask/components/project-manage/plan-manage/plan-form.vue";
  13. import planInfoTable from "@/views/bpm/handleTask/components/project-manage/plan-manage/planInfoTable.vue";
  14. import {projectsPlanGetByIdAPI} from "@/api/bpm/components/project-manage/plan";
  15. import {deepClone} from "ele-admin/lib/utils/core";
  16. import {listOrganizations} from "@/api/system/organization";
  17. export default {
  18. name: "project-form",
  19. components: {PlanForm, planInfoTable},
  20. props: {
  21. dialogType: {
  22. type: String,
  23. default: 'view',
  24. },
  25. businessId: {
  26. default: ''
  27. },
  28. taskId: {
  29. default: ''
  30. },
  31. taskDefinitionKey: {
  32. default: ''
  33. }
  34. },
  35. data() {
  36. return {
  37. dialogForm: {},
  38. deptList: [],
  39. deptTreeList: [],
  40. }
  41. },
  42. async created() {
  43. await this.getProjectPlanInfo(this.businessId)
  44. await this.getDeptList()
  45. },
  46. methods: {
  47. async getProjectPlanInfo(id = '') {
  48. let res = await projectsPlanGetByIdAPI(id)
  49. this.dialogForm = deepClone(res)
  50. this.dialogForm.responsibleUserIds = this.dialogForm.responsibleUserList.map(i => i.userName) || []
  51. this.dialogForm.planStageList.forEach((item, index) => {
  52. let userNames = item.responsibleUserList.map(i => i.userName) || []
  53. this.$set(item, 'responsibleUserNames', userNames.join(','))
  54. })
  55. },
  56. // 获取部门数据
  57. getDeptList() {
  58. listOrganizations().then((list) => {
  59. this.deptList = list;
  60. this.deptTreeList = this.$util.toTreeData({
  61. data: list,
  62. idField: 'id',
  63. parentIdField: 'parentId'
  64. });
  65. });
  66. },
  67. getTableValue() {
  68. return new Promise((resolve, reject) => {
  69. this.$refs.planForm.validate(valid => {
  70. if (!valid) {
  71. this.$message.warning('有必填项未填,请检查')
  72. reject('有必填项未填,请检查')
  73. } else {
  74. resolve(this.form)
  75. }
  76. })
  77. })
  78. }
  79. }
  80. }
  81. </script>
  82. <style scoped lang="scss">
  83. </style>