综合办公系统
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

changeData.vue 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <template>
  2. <div class="mt20" style="width:99%">
  3. <div class="nav-btn" v-if="taskName != ''">
  4. <div>
  5. <el-button class="mb20" type="primary" plain size="mini" icon="el-icon-plus" @click="addChange">变更记录</el-button>
  6. </div>
  7. <div>
  8. <el-button icon="el-icon-refresh" circle size="mini" @click="getList()"></el-button>
  9. </div>
  10. </div>
  11. <el-table :data="projectChangeList">
  12. <el-table-column type="index" width="55" align="center" label="序号" />
  13. <el-table-column label="变更id" align="center" prop="changeId" />
  14. <el-table-column label="项目id" align="center" prop="projectId" />
  15. <el-table-column label="变更内容" align="center" prop="content" />
  16. <el-table-column label="登记人" align="center" prop="registrant" />
  17. <el-table-column label="登记时间" align="center" prop="registerTime" width="180">
  18. <template slot-scope="scope">
  19. <span>{{ parseTime(scope.row.registerTime, '{y}-{m}-{d}') }}</span>
  20. </template>
  21. </el-table-column>
  22. <el-table-column label="操作" fixed="right" header-align="center">
  23. <template slot-scope="scope">
  24. <el-button icon="el-icon-view" type="text" size="mini" @click="handleLook(scope.row)">查看明细</el-button>
  25. </template>
  26. </el-table-column>
  27. </el-table>
  28. <el-dialog title=" 变更记录" :visible.sync="open" append-to-body width="65%">
  29. <change-form :taskForm="openObj" :taskName="''" :isFlow="false"></change-form>
  30. </el-dialog>
  31. </div>
  32. </template>
  33. <script>
  34. import { listProjectChange } from "@/api/oa/project/projectChange";
  35. import { listDefinition } from "@/api/flowable/definition";
  36. import { getNextFlowNodeByStart } from "@/api/flowable/todo";
  37. import { definitionStart, flowXmlAndNode } from "@/api/flowable/definition";
  38. import { todoList } from "@/api/flowable/todo";
  39. import changeForm from '../changeForm.vue';
  40. import { getProject } from "@/api/oa/project/project";
  41. import { MessageBox } from 'element-ui'
  42. import { Snowflake } from '@/utils/snowFlake.js'
  43. export default {
  44. components: { changeForm },
  45. props: {
  46. taskForm: {
  47. type: Object,
  48. required: true
  49. },
  50. taskName: {
  51. type: String,
  52. default: ''
  53. }
  54. },
  55. data() {
  56. return {
  57. // 是否显示弹出层
  58. open: false,
  59. openObj: {},
  60. // 表单参数
  61. form: {},
  62. definitionList: [],
  63. projectChangeList: [],
  64. };
  65. },
  66. mounted() {
  67. this.getList();
  68. this.listDefinition();
  69. },
  70. methods: {
  71. /** 查询cmc项目变更列表 */
  72. getList() {
  73. listProjectChange({ pageSize: 9999, projectId: this.taskForm.formId }).then(response => {
  74. this.projectChangeList = response.rows;
  75. });
  76. },
  77. listDefinition() {
  78. listDefinition({
  79. pageNum: 1,
  80. pageSize: 9999,
  81. name: '项目变更'
  82. }).then(response => {
  83. this.definitionList = response.data.records;
  84. });
  85. },
  86. handleLook(row) {
  87. this.form = row
  88. this.openObj.formId = row.changeId
  89. getProject(row.projectId).then(res => {
  90. if (res.data)
  91. this.$set(this.form, 'projectName', res.data.projectNumber + '-' + res.data.projectName)
  92. this.open = true
  93. })
  94. },
  95. addChange() {
  96. let row = this.definitionList[0];
  97. let formId = new Snowflake(1n, 1n, 0n).nextId().toString();
  98. getNextFlowNodeByStart({ deploymentId: row.deploymentId, variables: { formId: formId } }).then(res => {
  99. let data = res.data
  100. const variables = {};
  101. const formData = {};
  102. formData.formId = formId
  103. if (row.id) {
  104. MessageBox.confirm('是否发起项目变更?', '系统提示', { confirmButtonText: '确认', cancelButtonText: '取消', type: 'warning' }).then(() => {
  105. variables.variables = formData;
  106. // 启动流程并将表单数据加入流程变量
  107. definitionStart(row.id, JSON.stringify(variables)).then(res => {
  108. this.$modal.msgSuccess(res.msg);
  109. let procInstanceId = res.data;
  110. todoList({
  111. pageNum: 1,
  112. pageSize: 99999999,
  113. processInsId: procInstanceId
  114. }).then(toDoRes => {
  115. let records = toDoRes.data.records;
  116. if (records.length == 1) {
  117. records = records[0]
  118. }
  119. this.$router.push({
  120. path: '/applyForm/change',
  121. query: {
  122. procInsId: records.procInsId,
  123. executionId: records.executionId,
  124. deployId: records.deployId,
  125. taskId: records.taskId,
  126. taskName: records.taskName,
  127. startUser: records.startUserName + '--' + records.startDeptName,
  128. formId: formData.formId,
  129. procDefName: records.procDefName,
  130. projectId: this.taskForm.formId
  131. }
  132. })
  133. })
  134. })
  135. })
  136. }
  137. })
  138. },
  139. }
  140. };
  141. </script>
  142. <style lang="scss" scoped>
  143. .nav-btn {
  144. display: flex;
  145. justify-content: space-between;
  146. }
  147. .custom-table {
  148. display: block;
  149. /* 确保表格不会超出容器 */
  150. overflow-x: auto;
  151. /* 横向滚动条 */
  152. }
  153. </style>