综合办公系统
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.

subContract.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2024-06-21 18:52:00
  4. * @LastEditors: Please set LastEditors
  5. * @LastEditTime: 2025-02-17 15:15:23
  6. -->
  7. <template>
  8. <div class="app-container">
  9. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="128px">
  10. <el-form-item label="合同名称" prop="subContractName">
  11. <el-input v-model="queryParams.subContractName" placeholder="请输入合同名称" clearable
  12. @keyup.enter.native="handleQuery" />
  13. </el-form-item>
  14. <el-form-item label="承接单位" prop="partnerId">
  15. <el-select v-model="queryParams.partnerId" clearable filterable remote reserve-keyword placeholder="请输入承接单位"
  16. :remote-method="remoteMethod" :loading="loading" style="width: 400px;">
  17. <el-option v-for="partner in partnerList" :key="partner.partnerId" :label="partner.partnerName"
  18. :value="partner.partnerId">
  19. </el-option>
  20. </el-select>
  21. </el-form-item>
  22. <!-- <el-form-item label="拟稿人" prop="drafter">
  23. <el-select v-model="queryParams.drafter" filterable clearable @change="handleQuery">
  24. <el-option v-for="item in $store.state.user.userList" :key="item.userId" :label="item.nickName"
  25. :value="item.userId">
  26. </el-option>
  27. </el-select>
  28. </el-form-item> -->
  29. <el-form-item>
  30. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  31. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  32. </el-form-item>
  33. </el-form>
  34. <el-row :gutter="10" class="mb8">
  35. <el-col :span="1.5">
  36. <el-button type="success" plain icon="el-icon-plus" size="mini" @click="handleRegister"
  37. v-hasPermi="['oa:contract:add']">登记分包合同</el-button>
  38. </el-col>
  39. <el-col :span="1.5">
  40. <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
  41. v-hasPermi="['oa:subContract:export']">导出</el-button>
  42. </el-col>
  43. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  44. </el-row>
  45. <el-table v-loading="loading" border :data="subContractList" @selection-change="handleSelectionChange">
  46. <el-table-column type="index" label="序号" width="55" align="center" />
  47. <el-table-column label="合同名称" align="center" prop="subContractName" width="300px" />
  48. <el-table-column label="分包合同金额" align="center" prop="subAmount" />
  49. <el-table-column label="承接单位" align="center" prop="partner.partnerName" />
  50. <!-- <el-table-column label="承接单位联系人" align="center" prop="contactPerson" /> -->
  51. <!-- <el-table-column label="合同文件" align="center" prop="contractDocument" show-overflow-tooltip>
  52. <template slot-scope="scope">
  53. <el-link type="primary" @click="reviewWord(`${baseUrl}${'/profile/upload' + scope.row.contractDocument}`)">
  54. {{ getFileName(scope.row.contractDocument) }}
  55. </el-link>
  56. </template>
  57. </el-table-column> -->
  58. <el-table-column label="拟稿日期" align="center" prop="draftTime">
  59. <template slot-scope="scope">
  60. <span>{{ parseTime(scope.row.draftTime, '{y}-{m}-{d}') }}</span>
  61. </template>
  62. </el-table-column>
  63. <!-- <el-table-column label="合同备注" align="center" prop="remark" /> -->
  64. <el-table-column label="签订日期" align="center" prop="signDate">
  65. <template slot-scope="scope">
  66. <span>{{ parseTime(scope.row.signDate, '{y}-{m}-{d}') }}</span>
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="percentage" align="center" label="付款进度" width="120px" sortable>
  70. <template slot-scope="scope">
  71. <el-progress :text-inside="true" :stroke-width="26" :status="formatStatus(scope.row.percentage)"
  72. :percentage="scope.row.percentage" text-color="#fff"></el-progress>
  73. <div>
  74. {{ scope.row.paidAmount }}
  75. </div>
  76. </template>
  77. </el-table-column>
  78. <!-- <el-table-column label="签订备注" align="center" prop="signRemark" /> -->
  79. <!-- <el-table-column label="签订扫描件" align="center" prop="signScan">
  80. <template slot-scope="scope">
  81. <el-link type="primary" @click="reviewWord(`${baseUrl}${'/profile/upload' + scope.row.signScan}`)">
  82. {{ getFileName(scope.row.signScan) }}
  83. </el-link>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="评审方式" align="center" prop="commentType">
  87. <template slot-scope="scope">
  88. <el-tag :type="scope.row.commentType == '2' ? 'success' : 'warning'">
  89. {{ setCommentType(scope.row.commentType) }}
  90. </el-tag>
  91. </template>
  92. </el-table-column> -->
  93. <el-table-column label="拟稿人" align="center" prop="drafter">
  94. <template slot-scope="scope">
  95. {{ getUserName(scope.row.drafter) }}
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  99. <template slot-scope="scope">
  100. <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)"
  101. v-hasPermi="['oa:subContract:query']">查看</el-button>
  102. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  103. v-hasPermi="['oa:subContract:edit']">修改</el-button>
  104. <el-button size="mini" type="text" icon="el-icon-edit-outline" @click="handleProgress(scope.row)"
  105. v-hasPermi="['oa:contract:paid']">付款进度</el-button>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  110. @pagination="getList" />
  111. <!-- 添加或修改cmc分包合同评审对话框 -->
  112. <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
  113. <sub-edit :form="form" @cancel="cancel()"></sub-edit>
  114. </el-dialog>
  115. <el-dialog :title="title" :visible.sync="openInfo" append-to-body width="60%">
  116. <sub-contract :taskForm="taskForm" :taskName="''" :flowDisabled="false"></sub-contract>
  117. </el-dialog>
  118. <!-- 回款进度 -->
  119. <el-dialog :title="title" :visible.sync="progressOpen" width="50%" append-to-body>
  120. <sub-progress :form="progressContract" @cancel="progressOpen = false" @getList="getList"></sub-progress>
  121. </el-dialog>
  122. </div>
  123. </template>
  124. <script>
  125. import { listSubContract, getSubContract, delSubContract, addSubContract, updateSubContract } from "@/api/oa/contract/subContract";
  126. import { listPartner } from "@/api/oa/partner/partner";
  127. import subContract from '../../flowable/form/business/subContract.vue';
  128. import { listDefinition } from "@/api/flowable/definition";
  129. import { definitionStart, flowXmlAndNode } from "@/api/flowable/definition";
  130. import { todoList, getNextFlowNodeByStart } from "@/api/flowable/todo";
  131. import { Snowflake } from '@/utils/snowFlake.js'
  132. import { listContractComment, addContractComment, updateContractComment, delContractComment } from "@/api/oa/contract/contractComment";
  133. import SubEdit from './components/subEdit.vue';
  134. import SubProgress from "./components/subProgress.vue";
  135. import { listContractPaid } from "@/api/oa/contract/contractPaid";
  136. export default {
  137. components: { subContract, SubEdit, SubProgress },
  138. name: "SubContract",
  139. data() {
  140. return {
  141. baseUrl: process.env.VUE_APP_BASE_API,
  142. // 遮罩层
  143. loading: true,
  144. // 选中数组
  145. ids: [],
  146. // 非单个禁用
  147. single: true,
  148. // 非多个禁用
  149. multiple: true,
  150. // 显示搜索条件
  151. showSearch: true,
  152. // 总条数
  153. total: 0,
  154. // cmc分包合同评审表格数据
  155. subContractList: [],
  156. partnerList: [],
  157. // 弹出层标题
  158. title: "",
  159. // 是否显示弹出层
  160. open: false,
  161. openInfo: false,
  162. // 查询参数
  163. queryParams: {
  164. pageNum: 1,
  165. pageSize: 10,
  166. contractId: null,
  167. subContractName: null,
  168. subAmount: null,
  169. partnerId: null,
  170. contactPerson: null,
  171. drafter: null,
  172. draftTime: null,
  173. signDate: null,
  174. signRemark: null,
  175. signScan: null,
  176. commentType: null
  177. },
  178. // 表单参数
  179. form: {},
  180. // 表单校验
  181. rules: {
  182. },
  183. taskForm: {
  184. formId: ''
  185. },
  186. commentList: [],
  187. commentOpen: false,
  188. progressOpen: false,
  189. progressContract: {}
  190. };
  191. },
  192. created() {
  193. this.getList();
  194. },
  195. methods: {
  196. /** 查询cmc分包合同评审列表 */
  197. getList() {
  198. this.loading = true;
  199. listSubContract(this.queryParams).then(response => {
  200. this.subContractList = response.rows;
  201. this.total = response.total;
  202. for (let subContract of this.subContractList) {
  203. listContractPaid({ contractId: subContract.subContractId }).then(res => {
  204. if (res.total > 0) {
  205. let percentage = res.rows.reduce((sum, item) => sum + Number(item.paidPercentage), 0);
  206. let paidAmount = res.rows.reduce((sum, item) => sum + Number(item.paidAmount), 0);
  207. this.$set(subContract, 'percentage', Number(percentage.toFixed(2)));
  208. this.$set(subContract, 'paidAmount', Number(paidAmount.toFixed(2)));
  209. } else {
  210. this.$set(subContract, 'percentage', 0)
  211. }
  212. this.loading = false;
  213. })
  214. }
  215. });
  216. },
  217. remoteMethod(val) {
  218. listPartner({
  219. pageNum: 1,
  220. pageSize: 20,
  221. partnerName: val
  222. }).then(res => {
  223. this.partnerList = res.rows;
  224. })
  225. },
  226. handleView(row) {
  227. this.openInfo = true;
  228. this.title = "合同详情";
  229. this.form = row;
  230. this.$set(this.taskForm, 'formId', row.subContractId)
  231. },
  232. // 取消按钮
  233. cancel() {
  234. this.open = false;
  235. this.getList()
  236. },
  237. // 表单重置
  238. reset() {
  239. this.form = {
  240. subContractId: null,
  241. contractId: null,
  242. subContractName: null,
  243. subAmount: null,
  244. partnerId: null,
  245. contactPerson: null,
  246. drafter: null,
  247. draftTime: null,
  248. remark: null,
  249. signDate: null,
  250. signRemark: null,
  251. signScan: null,
  252. commentType: null
  253. };
  254. this.resetForm("form");
  255. },
  256. /** 搜索按钮操作 */
  257. handleQuery() {
  258. this.queryParams.pageNum = 1;
  259. this.getList();
  260. },
  261. /** 重置按钮操作 */
  262. resetQuery() {
  263. this.resetForm("queryForm");
  264. this.handleQuery();
  265. },
  266. // 多选框选中数据
  267. handleSelectionChange(selection) {
  268. this.ids = selection.map(item => item.subContractId)
  269. this.single = selection.length !== 1
  270. this.multiple = !selection.length
  271. },
  272. /** 新增按钮操作 */
  273. handleAdd() {
  274. this.reset();
  275. this.open = true;
  276. this.title = "新增分包合同评审";
  277. },
  278. /** 修改按钮操作 */
  279. handleUpdate(row) {
  280. this.reset();
  281. const subContractId = row.subContractId || this.ids
  282. getSubContract(subContractId).then(response => {
  283. this.form = response.data;
  284. this.open = true;
  285. this.title = "修改分包合同评审";
  286. listContractComment({ pageNum: 1, pageSize: 100, contractId: subContractId }).then(res => {
  287. if (res.rows && res.rows.length != 0) {
  288. this.commentList = res.rows;
  289. }
  290. })
  291. });
  292. },
  293. // 回款进度操作
  294. handleProgress(row) {
  295. this.progressContract = row;
  296. this.title = '付款进度';
  297. this.progressOpen = true;
  298. },
  299. async handleRegister() {
  300. let response = await listDefinition({
  301. pageNum: 1,
  302. pageSize: 9999,
  303. name: "分包合同评审",
  304. category: "business",
  305. })
  306. if (response.data.total == 1) {
  307. let obj = response.data.records[0]
  308. this.$confirm("是否发起分包合同评审流程?", '提示', {
  309. confirmButtonText: '确定',
  310. cancelButtonText: '取消',
  311. type: 'warning'
  312. }).then(() => {
  313. this.handleStartProcess(obj)
  314. }).catch(() => { });
  315. }
  316. },
  317. handleStartProcess(row) {
  318. let formId = new Snowflake(1n, 1n, 0n).nextId().toString();
  319. getNextFlowNodeByStart({ deploymentId: row.deploymentId, variables: { formId: formId } }).then(res => {
  320. let data = res.data;
  321. const variables = {};
  322. const formData = {};
  323. formData.disabled = true;
  324. formData.formBtns = false;
  325. formData.formId = formId
  326. if (row.id) {
  327. variables.variables = formData;
  328. let routePath = this.getRoutePath(row);
  329. definitionStart(row.id, JSON.stringify(variables)).then(res => {
  330. this.$modal.msgSuccess(res.msg);
  331. let procInstanceId = res.data;
  332. todoList({
  333. pageNum: 1,
  334. pageSize: 99999999, processInsId: procInstanceId
  335. }).then(toDoRes => {
  336. let records = toDoRes.data.records;
  337. if (records.length == 1) {
  338. records = records[0]
  339. }
  340. this.$router.push({
  341. path: routePath,
  342. query: {
  343. procInsId: records.procInsId,
  344. executionId: records.executionId,
  345. deployId: records.deployId,
  346. taskId: records.taskId,
  347. taskName: records.taskName,
  348. startUser: records.startUserName + '-' + records.startDeptName,
  349. formId: formData.formId,
  350. procDefName: records.procDefName
  351. }
  352. })
  353. })
  354. })
  355. }
  356. })
  357. },
  358. /** 提交按钮 */
  359. submitForm() {
  360. this.$refs["form"].validate(valid => {
  361. if (valid) {
  362. if (this.form.subContractId != null) {
  363. for (let comment of this.commentList) {
  364. updateContractComment(comment);
  365. }
  366. updateSubContract(this.form).then(response => {
  367. this.$modal.msgSuccess("修改成功");
  368. this.open = false;
  369. this.getList();
  370. });
  371. } else {
  372. addSubContract(this.form).then(response => {
  373. this.$modal.msgSuccess("新增成功");
  374. this.open = false;
  375. this.getList();
  376. });
  377. }
  378. }
  379. });
  380. },
  381. getRoutePath(row) {
  382. let path;
  383. for (let p of this.publicData.pathRoute) {
  384. if (p.name == row.name) {
  385. path = p.path
  386. break
  387. } else {
  388. path = '/flowable/task/todo/detail/index'
  389. }
  390. }
  391. return path
  392. },
  393. /** 导出按钮操作 */
  394. handleExport() {
  395. this.download('oa/subContract/export', {
  396. ...this.queryParams
  397. }, `subContract_${new Date().getTime()}.xlsx`)
  398. },
  399. setCommentType(commentType) {
  400. if (commentType == '2') {
  401. return '线上评审'
  402. } else if (commentType == '0') {
  403. return '无须评审'
  404. } else {
  405. return '会议评审'
  406. }
  407. },
  408. formatStatus(row) {
  409. if (!row) {
  410. row = 0
  411. return 'exception'
  412. }
  413. if (row <= 20) {
  414. return 'exception'
  415. } else if (row > 20 && row <= 50) {
  416. return 'warning'
  417. } else if (row > 50 && row <= 80) {
  418. return null
  419. } else {
  420. return 'success'
  421. }
  422. },
  423. }
  424. };
  425. </script>
  426. <style lang="scss" scoped>
  427. table {
  428. /*边框*/
  429. /* border: 1px solid black; */
  430. text-align: center;
  431. border-collapse: collapse;
  432. /*设置背景颜色*/
  433. /* background-color: #bfa; */
  434. td {
  435. padding: 5px;
  436. }
  437. }
  438. </style>