index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <div class="ele-border-lighter form-content" v-loading="loading">
  5. <search-quotation @search="reload"> </search-quotation>
  6. <!-- 数据表格 -->
  7. <ele-pro-table
  8. ref="table"
  9. :columns="columns"
  10. :datasource="datasource"
  11. height="calc(100vh - 375px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. :selection.sync="selection"
  15. :page-size="20"
  16. @columns-change="handleColumnChange"
  17. :cache-key="cacheKeyUrl"
  18. @sort-change="sortChange"
  19. @header-dragend="handleHeaderDragend"
  20. >
  21. <!-- 表头工具栏 -->
  22. <template v-slot:toolbar>
  23. <el-button
  24. size="small"
  25. type="primary"
  26. icon="el-icon-plus"
  27. class="ele-btn-icon"
  28. @click="openEdit('add', {})"
  29. >
  30. 新建
  31. </el-button>
  32. <el-button
  33. size="small"
  34. type="danger"
  35. el-icon-delete
  36. class="ele-btn-icon"
  37. @click="allDelBtn"
  38. :disabled="selection?.length === 0"
  39. >
  40. 批量删除
  41. </el-button>
  42. <el-button
  43. size="small"
  44. type="primary"
  45. icon="el-icon-print"
  46. class="ele-btn-icon"
  47. v-if="$hasPermission('eom:purchaserequirement:print')"
  48. @click="handlePrint('printTemplateTrRef')"
  49. >
  50. 打印申请单
  51. </el-button>
  52. </template>
  53. <!-- 查看详情列 -->
  54. <template v-slot:requirementCode="{ row }">
  55. <el-link type="primary" :underline="false" @click="openDetail(row)">
  56. {{ row.requirementCode }}</el-link
  57. >
  58. </template>
  59. <!-- 查看详情列 -->
  60. <template v-slot:requirementName="{ row }">
  61. <el-link type="primary" :underline="false" @click="openDetail(row)">
  62. {{ row.requirementName }}</el-link
  63. >
  64. </template>
  65. <!-- 操作列 -->
  66. <template v-slot:action="{ row }">
  67. <el-link
  68. type="primary"
  69. :underline="false"
  70. icon="el-icon-edit"
  71. @click="openEdit('edit', row)"
  72. v-if="
  73. (isNeed_process_is_close && [0, 3].includes(row.status)) ||
  74. !isNeed_process_is_close
  75. "
  76. >
  77. 修改
  78. </el-link>
  79. <el-link
  80. type="primary"
  81. :underline="false"
  82. icon="el-icon-plus"
  83. @click="sub(row)"
  84. v-if="isNeed_process_is_close && [0, 3].includes(row.status)"
  85. >
  86. 提交
  87. </el-link>
  88. <el-popconfirm
  89. class="ele-action"
  90. title="确定要删除此信息吗?"
  91. @confirm="remove([row.id])"
  92. v-if="
  93. (isNeed_process_is_close && [0, 3].includes(row.status)) ||
  94. !isNeed_process_is_close
  95. "
  96. >
  97. <template v-slot:reference>
  98. <el-link type="danger" :underline="false" icon="el-icon-delete">
  99. 删除
  100. </el-link>
  101. </template>
  102. </el-popconfirm>
  103. <el-link
  104. type="primary"
  105. icon="el-icon-plus"
  106. v-if="[2].includes(row.status) && row.isCreatePlanOrder === 0"
  107. @click="openPurchasePlanManage(row)"
  108. >
  109. 生成采购计划
  110. </el-link>
  111. </template>
  112. </ele-pro-table>
  113. </div>
  114. </el-card>
  115. <add-dialog ref="addDialogRef" @done="reload"></add-dialog>
  116. <add-plan-dialog ref="addPlanRef" @done="reload"></add-plan-dialog>
  117. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  118. <!-- 打印申请单弹窗 -->
  119. <print-template-tr ref="printTemplateTrRef" :group-name="groupName"></print-template-tr>
  120. <!-- 多选删除弹窗 -->
  121. <pop-modal
  122. :visible.sync="delVisible"
  123. content="是否确定删除?"
  124. @done="commitBtn"
  125. />
  126. <process-submit-dialog
  127. api-fun-name="purchaserequirementStatusAPI"
  128. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  129. isCloseRefresh="false"
  130. v-if="processSubmitDialogFlag"
  131. ref="processSubmitDialogRef"
  132. @reload="reload"
  133. ></process-submit-dialog>
  134. </div>
  135. </template>
  136. <script>
  137. import searchQuotation from './components/searchQuotation.vue';
  138. import addDialog from './components/addDialog.vue';
  139. import addPlanDialog from '../../purchasingManage/purchasePlanManage/components/addDialog.vue';
  140. import detailDialog from './components/detailDialog.vue';
  141. import popModal from '@/components/pop-modal';
  142. import dictMixins from '@/mixins/dictMixins';
  143. import {
  144. getTableList,
  145. deleteInformation,
  146. submit,
  147. isHasGeneratedPlanAPI
  148. } from '@/api/purchasingManage/purchaseNeedManage';
  149. import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
  150. import tabMixins from '@/mixins/tableColumnsMixin';
  151. import { reviewStatus } from '@/enum/dict';
  152. import printTemplateTr from './components/print-template-tr.vue';
  153. import { enterprisePage } from '@/api/contractManage/contractBook';
  154. import { purchaseOrderProgressStatusEnum } from '@/enum/dict';
  155. export default {
  156. mixins: [dictMixins,tabMixins],
  157. components: {
  158. processSubmitDialog,
  159. searchQuotation,
  160. popModal,
  161. addDialog,
  162. detailDialog,
  163. addPlanDialog,
  164. printTemplateTr
  165. },
  166. data() {
  167. return {
  168. selection: [], //单选中集合
  169. delVisible: false, //批量删除弹框状态
  170. loading: false, // 加载状态
  171. processSubmitDialogFlag: false,
  172. groupName: '',
  173. columns: [
  174. {
  175. width: 45,
  176. type: 'selection',
  177. columnKey: 'selection',
  178. align: 'center'
  179. },
  180. {
  181. columnKey: 'index',
  182. label: '序号',
  183. type: 'index',
  184. width: 55,
  185. align: 'center',
  186. showOverflowTooltip: true,
  187. fixed: 'left'
  188. },
  189. {
  190. prop: 'requirementCode',
  191. slot: 'requirementCode',
  192. label: '需求单编码',
  193. align: 'center',
  194. sortable: true,
  195. showOverflowTooltip: true,
  196. minWidth: 200
  197. },
  198. {
  199. prop: 'requirementName',
  200. slot: 'requirementName',
  201. label: '需求单名称',
  202. align: 'center',
  203. showOverflowTooltip: true,
  204. minWidth: 200
  205. },
  206. {
  207. prop: 'productNames',
  208. label: '产品名称',
  209. align: 'center',
  210. showOverflowTooltip: true,
  211. minWidth: 140
  212. },
  213. {
  214. prop: 'sourceTypeName',
  215. label: '需求类型',
  216. align: 'center',
  217. showOverflowTooltip: true,
  218. minWidth: 140
  219. },
  220. {
  221. prop: 'requireDeptName',
  222. label: '需求部门',
  223. align: 'center',
  224. slot: 'requireDeptName',
  225. showOverflowTooltip: true,
  226. minWidth: 200
  227. },
  228. {
  229. prop: 'requireUserName',
  230. label: '需求人',
  231. align: 'center',
  232. showOverflowTooltip: true,
  233. minWidth: 140
  234. },
  235. // {
  236. // prop: 'finishDate',
  237. // label: '完成日期',
  238. // align: 'center',
  239. // showOverflowTooltip: true,
  240. // minWidth: 140
  241. // },
  242. {
  243. prop: 'createTime',
  244. label: '创建时间',
  245. align: 'center',
  246. showOverflowTooltip: true,
  247. minWidth: 170
  248. },
  249. {
  250. prop: 'progress',
  251. label: '整单进度',
  252. align: 'center',
  253. showOverflowTooltip: true,
  254. formatter: (_row, _column, cellValue) => {
  255. return purchaseOrderProgressStatusEnum.find(
  256. (val) => val.value == _row.progress
  257. )?.label;
  258. },
  259. minWidth: 120
  260. },
  261. {
  262. prop: 'status',
  263. label: '状态',
  264. align: 'center',
  265. formatter: (_row, _column, cellValue) => {
  266. return reviewStatus[cellValue]
  267. },
  268. showOverflowTooltip: true,
  269. minWidth: 120
  270. },
  271. // {
  272. // prop: 'remark',
  273. // label: '备注',
  274. // align: 'center',
  275. // showOverflowTooltip: true,
  276. // minWidth: 170
  277. // },
  278. {
  279. columnKey: 'action',
  280. label: '操作',
  281. width: 230,
  282. align: 'center',
  283. resizable: false,
  284. slot: 'action',
  285. showOverflowTooltip: true,
  286. fixed: 'right'
  287. }
  288. ],
  289. cacheKeyUrl:'eos-d8f2c206-purchaseNeedManage',
  290. };
  291. },
  292. created() {
  293. this.openDashboardRequirement();
  294. enterprisePage({
  295. pageNum: 1,
  296. size: 200
  297. }).then((res) => {
  298. if (res.list?.length > 0) {
  299. this.groupName = res.list[0].name;
  300. }
  301. });
  302. },
  303. watch: { '$route.query.requirementId'() { this.openDashboardRequirement(); } },
  304. methods: {
  305. // 看板创建后定位原需求详情,提交仍沿用原审批入口。
  306. openDashboardRequirement() {
  307. const id = this.$route.query.requirementId;
  308. if (this.$route.query.dashboard === '1' && id) this.$nextTick(() => this.$refs.contactDetailDialogRef.open({ id }));
  309. },
  310. /* 表格数据源 */
  311. datasource({ page, limit, where, order }) {
  312. return getTableList({
  313. pageNum: page,
  314. size: limit,
  315. ...where
  316. });
  317. },
  318. /* 刷新表格 */
  319. reload(where) {
  320. this.$refs.table.reload({ page: 1, where });
  321. },
  322. //新增编辑
  323. openEdit(type, row) {
  324. this.$refs.addDialogRef.open(type, row, row.id);
  325. this.$refs.addDialogRef.$refs.form &&
  326. this.$refs.addDialogRef.$refs.form.clearValidate();
  327. },
  328. //生成采购计划
  329. async openPurchasePlanManage(row) {
  330. this.$refs.addPlanRef.open('add', row);
  331. this.$refs.addPlanRef.$refs.form &&
  332. this.$refs.addPlanRef.$refs.form.clearValidate();
  333. },
  334. //批量删除
  335. allDelBtn() {
  336. if (this.selection.length === 0) return;
  337. let flag = this.selection.some((item) => [1, 2].includes(item.status));
  338. if (flag)
  339. return this.$message.warning(
  340. '抱歉已审核、审核中的数据不能删除,请检查'
  341. );
  342. this.delVisible = true;
  343. },
  344. //删除接口
  345. remove(delData) {
  346. deleteInformation(delData).then((res) => {
  347. this.$message.success('删除成功!');
  348. this.reload();
  349. });
  350. },
  351. //删除弹框确定
  352. commitBtn() {
  353. const dataId = this.selection.map((v) => v.id);
  354. this.remove(dataId);
  355. },
  356. sortChange(column, prop, order){
  357. console.log(column)
  358. console.log(prop)
  359. console.log(order)
  360. },
  361. //查看详情
  362. openDetail(row) {
  363. this.$refs.contactDetailDialogRef.open(row);
  364. },
  365. sub(res) {
  366. this.processSubmitDialogFlag = true;
  367. this.$nextTick(() => {
  368. let params = {
  369. businessId: res.id,
  370. businessKey: 'purchase_requirement_approve_tg',
  371. formCreateUserId: res.createUserId,
  372. variables: {
  373. businessCode: res.requirementCode,
  374. businessName: res.requirementName,
  375. businessType: res.sourceTypeName
  376. }
  377. };
  378. this.$refs.processSubmitDialogRef.init(params);
  379. });
  380. },
  381. //打印申请单
  382. handlePrint(name) {
  383. if (this.selection.length === 0) {
  384. return this.$message.warning('请选择一条数据');
  385. };
  386. this.$refs[name].open(this.selection[0].id);
  387. },
  388. }
  389. };
  390. </script>
  391. <style lang="scss" scoped>
  392. :deep(.el-link--inner) {
  393. margin-left: 0px !important;
  394. }
  395. .sys-organization-list {
  396. height: calc(100vh - 264px);
  397. box-sizing: border-box;
  398. border-width: 1px;
  399. border-style: solid;
  400. overflow: auto;
  401. }
  402. .sys-organization-list :deep(.el-tree-node__content) {
  403. height: 40px;
  404. & > .el-tree-node__expand-icon {
  405. margin-left: 10px;
  406. }
  407. }
  408. </style>