index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  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 - 325px)"
  12. full-height="calc(100vh - 116px)"
  13. tool-class="ele-toolbar-form"
  14. :selection.sync="selection"
  15. cache-key="eomContactPageTable"
  16. >
  17. <!-- 表头工具栏 -->
  18. <template v-slot:toolbar>
  19. <el-button
  20. size="small"
  21. type="primary"
  22. icon="el-icon-plus"
  23. class="ele-btn-icon"
  24. @click="openEdit('add', {})"
  25. >
  26. 新建
  27. </el-button>
  28. <el-button
  29. size="small"
  30. type="primary"
  31. icon="el-icon-plus"
  32. class="ele-btn-icon"
  33. @click="addGenerateContract('all')"
  34. :disabled="selection?.length === 0"
  35. >
  36. 生成合同
  37. </el-button>
  38. <el-button
  39. size="small"
  40. type="danger"
  41. el-icon-delete
  42. class="ele-btn-icon"
  43. @click="allDelBtn"
  44. >
  45. 批量删除
  46. </el-button>
  47. </template>
  48. <!-- 查看详情列 -->
  49. <template v-slot:inquiryCode="{ row }">
  50. <el-link type="primary" :underline="false" @click="openDetail(row)">
  51. {{ row.inquiryCode }}</el-link
  52. >
  53. </template>
  54. <!-- 查看详情列 -->
  55. <template v-slot:planName="{ row }">
  56. <el-link
  57. type="primary"
  58. :underline="false"
  59. @click="openPlanDetail(row)"
  60. >
  61. {{ row.planName }}</el-link
  62. >
  63. </template>
  64. <!-- 状态 -->
  65. <template v-slot:status="{ row }">
  66. {{ getStatus(row.status) }}
  67. </template>
  68. <!-- 操作列 -->
  69. <template v-slot:action="{ row }">
  70. <el-link
  71. type="primary"
  72. :underline="false"
  73. icon="el-icon-edit"
  74. @click="openEdit('edit', row)"
  75. v-if="[0, 3].includes(row.status)"
  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="[0, 3].includes(row.status)"
  85. >
  86. 提交
  87. </el-link>
  88. <el-link
  89. type="primary"
  90. :underline="false"
  91. icon="el-icon-plus"
  92. @click="addGenerateContract('add', row)"
  93. v-if="[2].includes(row.status)"
  94. >
  95. 生成合同
  96. </el-link>
  97. <el-popconfirm
  98. class="ele-action"
  99. title="确定要删除此信息吗?"
  100. @confirm="remove([row.id])"
  101. v-if="[0, 3].includes(row.status)"
  102. >
  103. <template v-slot:reference>
  104. <el-link type="danger" :underline="false" icon="el-icon-delete">
  105. 删除
  106. </el-link>
  107. </template>
  108. </el-popconfirm>
  109. </template>
  110. </ele-pro-table>
  111. </div>
  112. </el-card>
  113. <add-dialog ref="addDialogRef" @done="reload"></add-dialog>
  114. <add-dialog ref="addDialogRef" @done="reload"></add-dialog>
  115. <detail-dialog ref="contactDetailDialogRef"></detail-dialog>
  116. <planDetaillog ref="planDetaillogRef"></planDetaillog>
  117. <!-- 多选删除弹窗 -->
  118. <pop-modal
  119. :visible.sync="delVisible"
  120. content="是否确定删除?"
  121. @done="commitBtn"
  122. />
  123. <addContractBookDialog
  124. ref="addContractBookDialogRef"
  125. :categoryTreeList="treeList"
  126. ></addContractBookDialog>
  127. </div>
  128. </template>
  129. <script>
  130. import searchQuotation from './components/searchIndex.vue';
  131. import addDialog from './components/addDialog.vue';
  132. import addContractBookDialog from '@/views/contractManage/contractBook/components/addDialog.vue';
  133. import detailDialog from './components/detailDialog.vue';
  134. import planDetaillog from '../../purchasingManage/purchasePlanManage/components/detailDialog.vue';
  135. import popModal from '@/components/pop-modal';
  136. import dictMixins from '@/mixins/dictMixins';
  137. import {contactDetail, contactTypeTree} from '@/api/saleManage/contact';
  138. import {
  139. getTableList,
  140. deleteInformation,
  141. generateContract,
  142. submit, isHasGeneratedContractPI
  143. } from '@/api/purchasingManage/inquiryManage';
  144. export default {
  145. mixins: [dictMixins],
  146. components: {
  147. searchQuotation,
  148. popModal,
  149. addDialog,
  150. detailDialog,
  151. planDetaillog,
  152. addContractBookDialog
  153. },
  154. data() {
  155. return {
  156. selection: [], //单选中集合
  157. delVisible: false, //批量删除弹框状态
  158. loading: false, // 加载状态
  159. treeList: [],
  160. columns: [
  161. {
  162. width: 45,
  163. type: 'selection',
  164. columnKey: 'selection',
  165. align: 'center'
  166. },
  167. {
  168. columnKey: 'index',
  169. label: '序号',
  170. type: 'index',
  171. width: 55,
  172. align: 'center',
  173. showOverflowTooltip: true,
  174. fixed: 'left'
  175. },
  176. {
  177. prop: 'inquiryCode',
  178. slot: 'inquiryCode',
  179. label: '采购询价单编码',
  180. align: 'center',
  181. showOverflowTooltip: true,
  182. minWidth: 200
  183. },
  184. {
  185. prop: 'inquiryName',
  186. label: '采购询价单名称',
  187. align: 'center',
  188. showOverflowTooltip: true,
  189. minWidth: 200
  190. },
  191. {
  192. prop: 'planName',
  193. slot: 'planName',
  194. label: '采购计划单名称',
  195. align: 'center',
  196. showOverflowTooltip: true,
  197. minWidth: 200
  198. },
  199. // {
  200. // prop: 'supplierNames',
  201. // label: '供应商名称',
  202. // align: 'center',
  203. // showOverflowTooltip: true,
  204. // minWidth: 200
  205. // },
  206. {
  207. prop: 'winnerName',
  208. label: '中标供应商',
  209. align: 'center',
  210. showOverflowTooltip: true,
  211. minWidth: 200
  212. },
  213. // {
  214. // prop: 'requireDeptName',
  215. // label: '需求部门',
  216. // align: 'center',
  217. // slot: 'requireDeptName',
  218. // showOverflowTooltip: true,
  219. // minWidth: 200
  220. // },
  221. // {
  222. // prop: 'requireUserName',
  223. // label: '需求人',
  224. // align: 'center',
  225. // showOverflowTooltip: true,
  226. // minWidth: 140
  227. // },
  228. // {
  229. // prop: 'responsibleName',
  230. // label: '负责人',
  231. // align: 'center',
  232. // showOverflowTooltip: true,
  233. // minWidth: 120
  234. // },
  235. // {
  236. // prop: 'detailCount',
  237. // label: '明细条数',
  238. // align: 'center',
  239. // showOverflowTooltip: true,
  240. // minWidth: 140
  241. // },
  242. // {
  243. // prop: 'finishDate',
  244. // label: '完成日期',
  245. // align: 'center',
  246. // showOverflowTooltip: true,
  247. // minWidth: 140
  248. // },
  249. {
  250. prop: 'createTime',
  251. label: '创建时间',
  252. align: 'center',
  253. showOverflowTooltip: true,
  254. minWidth: 180
  255. },
  256. {
  257. prop: 'status',
  258. label: '状态',
  259. align: 'center',
  260. slot: 'status',
  261. showOverflowTooltip: true,
  262. minWidth: 120
  263. },
  264. {
  265. prop: 'remark',
  266. label: '备注',
  267. align: 'center',
  268. showOverflowTooltip: true,
  269. minWidth: 170
  270. },
  271. {
  272. columnKey: 'action',
  273. label: '操作',
  274. width: 230,
  275. align: 'center',
  276. resizable: false,
  277. slot: 'action',
  278. showOverflowTooltip: true,
  279. fixed: 'right'
  280. }
  281. ]
  282. };
  283. },
  284. computed: {},
  285. created() {
  286. this.getTreeData();
  287. },
  288. methods: {
  289. /* 表格数据源 */
  290. datasource({ page, limit, where, order }) {
  291. return getTableList({
  292. pageNum: page,
  293. size: limit,
  294. ...where
  295. });
  296. },
  297. //获取合同分类
  298. async getTreeData() {
  299. try {
  300. this.treeLoading = true;
  301. const res = await contactTypeTree({ type: 20 });
  302. this.treeLoading = false;
  303. if (res?.code === '0') {
  304. this.treeList = res.data;
  305. return this.treeList;
  306. }
  307. } catch (error) {}
  308. this.treeLoading = false;
  309. },
  310. /* 刷新表格 */
  311. reload(where) {
  312. this.$refs.table.reload({ page: 1, where });
  313. },
  314. //新增合同
  315. async addGenerateContract(type, row) {
  316. let { verify, text, ids } = this.verify(type, row);
  317. if (!verify) {
  318. this.$message.warning(text);
  319. return;
  320. }
  321. let contractInfo = await generateContract(ids);
  322. let contact = await contactDetail(contractInfo.contractVO.partbId);
  323. contractInfo.contractVO.contractName = contact.base.simpleName;
  324. this.$refs.addContractBookDialogRef.open('add', contractInfo, true,'inquiryManage');
  325. },
  326. //新增编辑
  327. openEdit(type, row) {
  328. this.$refs.addDialogRef.open(type, row, row.id);
  329. this.$refs.addDialogRef.$refs.form &&
  330. this.$refs.addDialogRef.$refs.form.clearValidate();
  331. },
  332. //批量删除
  333. allDelBtn() {
  334. if (this.selection.length === 0) return;
  335. let flag = this.selection.some(item=>[1,2].includes(item.status))
  336. if(flag) return this.$message.warning('抱歉已审核、审核中的数据不能删除,请检查')
  337. this.delVisible = true;
  338. },
  339. //删除接口
  340. remove(delData) {
  341. deleteInformation(delData).then((res) => {
  342. this.$message.success('删除成功!');
  343. this.reload();
  344. });
  345. },
  346. //删除弹框确定
  347. commitBtn() {
  348. const dataId = this.selection.map((v) => v.id);
  349. this.remove(dataId);
  350. },
  351. //查看详情
  352. openDetail(row) {
  353. this.$refs.contactDetailDialogRef.open(row);
  354. },
  355. //查看详情
  356. openPlanDetail(row) {
  357. this.$refs.planDetaillogRef.open(row);
  358. },
  359. // 合同验证
  360. verify(type, data) {
  361. let verify = true;
  362. let text = '';
  363. let ids = [];
  364. if (type == 'add') {
  365. if (!data.winnerId) {
  366. verify = false;
  367. text = '核价单中标供应商为空';
  368. }
  369. if (verify) {
  370. ids.push(data.id);
  371. }
  372. }
  373. if (type == 'all') {
  374. let status = '';
  375. let winnerIds = this.selection
  376. .filter((item) => item.winnerId)
  377. .map((item) => item.winnerId);
  378. this.selection.forEach((item) => {
  379. this.selection.forEach((val) => {
  380. if (item.winnerId != val.winnerId) {
  381. verify = false;
  382. text = '中标供应商不一致';
  383. }
  384. if (item.status != 2) {
  385. verify = false;
  386. text = '请选择审核已通过的核价单';
  387. }
  388. // if (item.planCode != val.planCode) {
  389. // verify = false;
  390. // text = '采购计划不一致';
  391. // }
  392. });
  393. });
  394. if (winnerIds.length != this.selection.length) {
  395. verify = false;
  396. text = '核价单中标供应商为空';
  397. }
  398. if (verify) {
  399. ids = this.selection.map((item) => item.id);
  400. }
  401. }
  402. return { verify, text, ids };
  403. },
  404. sub(res) {
  405. submit({
  406. businessId: res.id
  407. })
  408. .then((res) => {
  409. this.$message.success('提交成功');
  410. this.reload();
  411. })
  412. .catch((e) => {
  413. this.$message.error(e.message);
  414. });
  415. },
  416. //获取状态
  417. getStatus(status) {
  418. return status == 0
  419. ? '未提交'
  420. : status == 1
  421. ? '审核中'
  422. : status == 2
  423. ? '审核通过'
  424. : status == 3
  425. ? '审核不通过'
  426. : '';
  427. }
  428. }
  429. };
  430. </script>
  431. <style lang="scss" scoped>
  432. :deep(.el-link--inner) {
  433. margin-left: 0px !important;
  434. }
  435. .sys-organization-list {
  436. height: calc(100vh - 264px);
  437. box-sizing: border-box;
  438. border-width: 1px;
  439. border-style: solid;
  440. overflow: auto;
  441. }
  442. .sys-organization-list :deep(.el-tree-node__content) {
  443. height: 40px;
  444. & > .el-tree-node__expand-icon {
  445. margin-left: 10px;
  446. }
  447. }
  448. </style>