综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

technicalForm.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <el-col :span="18" :xs="24">
  5. <el-form ref="form" :model="form" :rules="rules" label-width="150px">
  6. <el-form-item label="项目编号:" prop="projectId" v-if="taskForm.procDefName == '技术交底'">
  7. <el-input v-model="chooseProject.projectNumber" placeholder="请输入项目编号" disabled style="width: 300px" />
  8. <el-descriptions border v-if="isSelect" style="margin-top: 10px;" :column="1">
  9. <el-descriptions-item label="项目编号" label-class-name="my-label">{{ chooseProject.projectNumber
  10. }}</el-descriptions-item>
  11. <el-descriptions-item label="项目名称" label-class-name="my-label">{{ chooseProject.projectName
  12. }}</el-descriptions-item>
  13. <el-descriptions-item label="项目负责人" label-class-name="my-label">{{ chooseProject.projectLeaderUser ?
  14. chooseProject.projectLeaderUser.nickName : ''
  15. }}</el-descriptions-item>
  16. <el-descriptions-item label="承担部门" label-class-name="my-label">
  17. <el-tag size="small">{{ chooseProject.undertakingDeptName }}</el-tag>
  18. </el-descriptions-item>
  19. <el-descriptions-item label="项目类型" label-class-name="my-label">{{ chooseProject.projectType
  20. }}</el-descriptions-item>
  21. </el-descriptions>
  22. </el-form-item>
  23. <el-form-item label="接受交底人" prop="disclosureAccepter">
  24. <el-select v-model="form.disclosureAccepter" style="width:220px" :disabled="true">
  25. <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId"
  26. v-if="item.nickName != 'admin'">
  27. </el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item label="技术交底内容" prop="content">
  31. <el-input v-model="form.content" placeholder="请输入技术交底内容" type="textarea"
  32. :disabled="taskName != '技术交底'" :autosize="{ minRows: 8 }" />
  33. </el-form-item>
  34. <el-form-item label="附件" prop="document">
  35. <el-input v-model="form.document" placeholder="请输入附件" type="textarea"
  36. :disabled="taskName != '技术交底'" :autosize="{ minRows: 8 }" />
  37. </el-form-item>
  38. <el-form-item label="技术交底意见" prop="disclosureComment">
  39. <el-input v-model="form.disclosureComment" placeholder="请输入技术交底意见" type="textarea"
  40. :disabled="taskName != '技术交底'" :autosize="{ minRows: 4 }" />
  41. </el-form-item>
  42. <el-row>
  43. <el-col :span="6" :xs="24" :offset="12">
  44. <el-form-item label="签名" prop="disclosurer">
  45. <span class="auditor"> {{ form.disclosurerUser ? form.disclosurerUser.nickName : disclosurerUser }}
  46. </span>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="6">
  50. <el-form-item label="日期:" label-width="120px">
  51. <span> {{ parseTime(form.disclosureTime, '{y}-{m}-{d}') }} </span>
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. <el-form-item label="接受交底意见" prop="acceptComment" v-if="taskName != '技术交底'">
  56. <el-input v-model="form.acceptComment" placeholder="请输入接受交底意见" type="textarea" :autosize="{ minRows: 4 }"
  57. :disabled="taskName == ''" />
  58. </el-form-item>
  59. <el-row>
  60. <el-col :span="6" :xs="24" :offset="12">
  61. <el-form-item label="签名" v-if="taskName != '技术交底'">
  62. <span class="auditor"> {{ form.accepterUser ? form.accepterUser.nickName : accepterUser }} </span>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="6">
  66. <el-form-item label="日期:" label-width="120px" v-if="taskName != '技术交底'">
  67. <span> {{ parseTime(form.acceptTime, '{y}-{m}-{d}') }} </span>
  68. </el-form-item>
  69. </el-col>
  70. </el-row>
  71. </el-form>
  72. <div style="text-align: center;" v-if="taskName">
  73. <el-button type="primary" @click="submitForm">提 交</el-button>
  74. </div>
  75. </el-col>
  76. <el-col :span="6" :xs="24">
  77. <el-card>
  78. <h2 style="text-align: center;">流程进度</h2>
  79. <div>
  80. <flow :flowData="flowData" />
  81. </div>
  82. </el-card>
  83. </el-col>
  84. </el-row>
  85. </div>
  86. </template>
  87. <script>
  88. import { listTechnical, getTechnical, delTechnical, addTechnical, updateTechnical } from "@/api/oa/technical/technical";
  89. import { getProject } from "@/api/oa/project/project";
  90. import { listUser } from '@/api/system/user';
  91. import flow from '@/views/flowable/task/todo/detail/flow';
  92. import { complete, getNextFlowNode } from "@/api/flowable/todo";
  93. import { flowXmlAndNode } from "@/api/flowable/definition";
  94. export default {
  95. components: {
  96. flow
  97. },
  98. name: "Technical",
  99. props: {
  100. taskName: {
  101. type: String,
  102. required: true
  103. },
  104. taskForm: {
  105. type: Object,
  106. required: true
  107. }
  108. },
  109. data() {
  110. return {
  111. disclosurerUser: '',
  112. accepterUser: '',
  113. // 遮罩层
  114. loading: true,
  115. // 选中数组
  116. ids: [],
  117. // 非单个禁用
  118. single: true,
  119. // 非多个禁用
  120. multiple: true,
  121. // 显示搜索条件
  122. showSearch: true,
  123. // 总条数
  124. total: 0,
  125. // cmc技术交底表格数据
  126. technicalList: [],
  127. // 弹出层标题
  128. title: "",
  129. // 是否显示弹出层
  130. open: false,
  131. // 查询参数
  132. queryParams: {
  133. pageNum: 1,
  134. pageSize: 10,
  135. projectId: null,
  136. disclosureAccepter: null,
  137. disclosurer: null,
  138. content: null,
  139. document: null,
  140. disclosureComment: null,
  141. disclosureTime: null,
  142. acceptTime: null
  143. },
  144. userList: [],
  145. chooseProject: {},
  146. isSelect: false,
  147. // 表单参数
  148. form: {
  149. user: {
  150. nickName: '',
  151. }
  152. },
  153. // 表单校验
  154. rules: {},
  155. formTotal: 0,
  156. flowData: {}
  157. };
  158. },
  159. created() {
  160. this.getProjectById();
  161. this.getUserList();
  162. this.getList();
  163. flowXmlAndNode({ procInsId: this.taskForm.procInsId, deployId: this.taskForm.deployId }).then(res => {
  164. this.flowData = res.data;
  165. })
  166. },
  167. mounted() {
  168. this.initRules();
  169. this.initForm();
  170. },
  171. methods: {
  172. initRules() {
  173. if (this.taskName == '技术交底') {
  174. this.rules = {
  175. disclosureComment: [
  176. { required: true, message: '请输入技术交底意见', trigger: 'blur' },
  177. ],
  178. }
  179. }
  180. else if (this.taskName == '接受交底') {
  181. this.rules = {
  182. acceptComment: [
  183. { required: true, message: '请输入接受交底意见', trigger: 'blur' },
  184. ],
  185. }
  186. }
  187. },
  188. initForm() {
  189. getTechnical(this.taskForm.formId).then(res => {
  190. if (this.isEmptyObject(res.data)) {
  191. this.formTotal = 0;
  192. this.form.disclosurer = this.$store.getters.userId;
  193. this.disclosurerUser = this.$store.getters.name;
  194. this.form.disclosureTime = new Date();
  195. }
  196. else {
  197. this.formTotal = 1;
  198. this.form = res.data;
  199. this.accepterUser = this.$store.getters.name;
  200. this.form.acceptTime = new Date();
  201. }
  202. })
  203. },
  204. // 查询项目
  205. getProjectById() {
  206. getProject(this.taskForm.formId).then(response => {
  207. this.chooseProject = response.data;
  208. this.isSelect = true;
  209. this.form.disclosureAccepter = response.data.projectLeader;
  210. });
  211. },
  212. // 查询用户列表
  213. getUserList() {
  214. listUser({ pageSize: 9999, pageNum: 1 }).then(res => {
  215. this.userList = res.rows
  216. })
  217. },
  218. /** 查询cmc技术交底列表 */
  219. getList() {
  220. this.loading = true;
  221. listTechnical(this.queryParams).then(response => {
  222. this.technicalList = response.rows;
  223. this.total = response.total;
  224. this.loading = false;
  225. });
  226. },
  227. // 取消按钮
  228. cancel() {
  229. this.open = false;
  230. this.reset();
  231. },
  232. isEmptyObject(obj) {
  233. for (var key in obj) {
  234. if (obj.hasOwnProperty(key)) {
  235. return false;
  236. }
  237. }
  238. return true;
  239. },
  240. // 表单重置
  241. reset() {
  242. this.form = {
  243. technicalId: null,
  244. projectId: null,
  245. disclosureAccepter: null,
  246. disclosurer: null,
  247. content: null,
  248. document: null,
  249. disclosureComment: null,
  250. disclosureTime: null,
  251. acceptTime: null
  252. };
  253. this.resetForm("form");
  254. },
  255. /** 搜索按钮操作 */
  256. handleQuery() {
  257. this.queryParams.pageNum = 1;
  258. this.getList();
  259. },
  260. /** 重置按钮操作 */
  261. resetQuery() {
  262. this.resetForm("queryForm");
  263. this.handleQuery();
  264. },
  265. // 多选框选中数据
  266. handleSelectionChange(selection) {
  267. this.ids = selection.map(item => item.technicalId)
  268. this.single = selection.length !== 1
  269. this.multiple = !selection.length
  270. },
  271. /** 新增按钮操作 */
  272. handleAdd() {
  273. this.reset();
  274. this.open = true;
  275. this.title = "添加cmc技术交底";
  276. },
  277. /** 修改按钮操作 */
  278. handleUpdate(row) {
  279. this.reset();
  280. const technicalId = row.technicalId || this.ids
  281. getTechnical(technicalId).then(response => {
  282. this.form = response.data;
  283. this.open = true;
  284. this.title = "修改cmc技术交底";
  285. });
  286. },
  287. /** 提交按钮 */
  288. submitForm() {
  289. this.$refs["form"].validate(valid => {
  290. if (valid) {
  291. if (this.formTotal != 0) {
  292. updateTechnical(this.form).then(response => {
  293. this.$modal.msgSuccess("修改成功");
  294. this.open = false;
  295. this.getList();
  296. });
  297. const params = { taskId: this.taskForm.taskId };
  298. getNextFlowNode(params).then(res => {
  299. complete(this.taskForm).then(response => {
  300. this.$modal.msgSuccess(response.msg);
  301. this.$emit('goBack')
  302. });
  303. })
  304. } else {
  305. this.form.technicalId = this.taskForm.formId;
  306. this.form.projectId = this.taskForm.formId;
  307. addTechnical(this.form).then(response => {
  308. this.$modal.msgSuccess("新增成功");
  309. this.open = false;
  310. this.getList();
  311. });
  312. const params = { taskId: this.taskForm.taskId };
  313. getNextFlowNode(params).then(res => {
  314. this.$set(this.taskForm.variables, "formId", this.taskForm.formId);
  315. this.$set(this.taskForm.variables, "approval", this.form.disclosureAccepter);
  316. complete(this.taskForm).then(response => {
  317. this.$modal.msgSuccess(response.msg);
  318. this.$emit('goBack')
  319. });
  320. })
  321. }
  322. }
  323. });
  324. },
  325. /** 删除按钮操作 */
  326. handleDelete(row) {
  327. const technicalIds = row.technicalId || this.ids;
  328. this.$modal.confirm('是否确认删除cmc技术交底编号为"' + technicalIds + '"的数据项?').then(function () {
  329. return delTechnical(technicalIds);
  330. }).then(() => {
  331. this.getList();
  332. this.$modal.msgSuccess("删除成功");
  333. }).catch(() => { });
  334. },
  335. /** 导出按钮操作 */
  336. handleExport() {
  337. this.download('oa/technical/export', {
  338. ...this.queryParams
  339. }, `technical_${new Date().getTime()}.xlsx`)
  340. }
  341. }
  342. };
  343. </script>
  344. <style lang="scss" scoped>
  345. @import "@/assets/styles/element-reset.scss";
  346. </style>