index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
  5. <el-tab-pane label="待采购列表" name="first">
  6. <byTable
  7. :source="sourceList.data"
  8. :pagination="sourceList.pagination"
  9. :config="config"
  10. :loading="loading"
  11. :searchConfig="searchConfig"
  12. highlight-current-row
  13. @get-list="getList"
  14. @clickReset="clickReset">
  15. <template #code="{ item }">
  16. <div>
  17. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
  18. </div>
  19. </template>
  20. </byTable>
  21. </el-tab-pane>
  22. <el-tab-pane label="采购合同" name="second">
  23. <byTable
  24. :source="sourceListTwo.data"
  25. :pagination="sourceListTwo.pagination"
  26. :config="configTwo"
  27. :loading="loading"
  28. :searchConfig="searchConfigTwo"
  29. highlight-current-row
  30. @get-list="getListTwo"
  31. @clickReset="clickResetTwo">
  32. <template #typeExpand="{ item }">
  33. <div style="padding: 0 20px">
  34. <el-table :data="item.purchaseBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader" border>
  35. <el-table-column label="品号" prop="bomSpecCode" width="120" />
  36. <el-table-column label="品名" prop="bomSpecName" min-width="240" />
  37. <el-table-column label="颜色" prop="bomSpecColour" width="180" />
  38. <el-table-column label="尺寸(长宽高,cm)" width="160">
  39. <template #default="{ row }">
  40. <div>{{ row.bomSpecLength }} * {{ row.bomSpecWidth }} * {{ row.bomSpecHeight }}</div>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="含税单价" prop="unitPrice" width="140" />
  44. <el-table-column label="税率" prop="taxRate" width="120" />
  45. <el-table-column label="不含税单价" width="100">
  46. <template #default="{ row }">
  47. <div>{{ moneyFormat(Number(Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 100) / 100)) }}</div>
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="采购数量" prop="purchaseQuantity" width="120" />
  51. <el-table-column label="含税小计" align="right" width="140">
  52. <template #default="{ row }">
  53. <div>{{ moneyFormat(Number(Math.round(row.unitPrice * row.purchaseQuantity * 100) / 100)) }}</div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="不含税小计" align="right" width="140">
  57. <template #default="{ row }">
  58. <div>
  59. {{
  60. moneyFormat(
  61. Number(Math.round((Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 100) / 100) * row.purchaseQuantity * 100) / 100)
  62. )
  63. }}
  64. </div>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. </div>
  69. </template>
  70. <template #code="{ item }">
  71. <div>
  72. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickPurchaseCode(item)">{{ item.code }}</a>
  73. </div>
  74. </template>
  75. <template #advancePayment="{ item }">
  76. <div>{{ item.advancePayment }}%</div>
  77. </template>
  78. <template #finalPayment="{ item }">
  79. <div>{{ 100 - item.advancePayment }}%</div>
  80. </template>
  81. </byTable>
  82. </el-tab-pane>
  83. </el-tabs>
  84. </el-card>
  85. </div>
  86. </template>
  87. <script setup>
  88. import byTable from "/src/components/byTable/index";
  89. import { ElMessage, ElMessageBox } from "element-plus";
  90. const { proxy } = getCurrentInstance();
  91. const activeName = ref("first");
  92. const flowStatus = ref([
  93. {
  94. dictKey: "0",
  95. dictValue: "未发起",
  96. },
  97. {
  98. dictKey: "1",
  99. dictValue: "进行中",
  100. },
  101. {
  102. dictKey: "2",
  103. dictValue: "已通过",
  104. },
  105. {
  106. dictKey: "3",
  107. dictValue: "已驳回",
  108. },
  109. ]);
  110. const sourceList = ref({
  111. data: [],
  112. pagination: {
  113. total: 0,
  114. pageNum: 1,
  115. pageSize: 10,
  116. code: "",
  117. beginTime: "",
  118. endTime: "",
  119. flowStatus: "2",
  120. },
  121. });
  122. const sourceListTwo = ref({
  123. data: [],
  124. pagination: {
  125. total: 0,
  126. pageNum: 1,
  127. pageSize: 10,
  128. code: "",
  129. flowStatus: "",
  130. supplierName: "",
  131. },
  132. });
  133. const loading = ref(false);
  134. const searchConfig = computed(() => {
  135. return [
  136. {
  137. type: "input",
  138. prop: "code",
  139. label: "申购单号",
  140. },
  141. {
  142. type: "date",
  143. propList: ["beginTime", "endTime"],
  144. label: "申购日期",
  145. },
  146. ];
  147. });
  148. const searchConfigTwo = computed(() => {
  149. return [
  150. {
  151. type: "input",
  152. prop: "code",
  153. label: "采购单号",
  154. },
  155. {
  156. type: "select",
  157. prop: "flowStatus",
  158. data: flowStatus.value,
  159. label: "流程状态",
  160. },
  161. {
  162. type: "input",
  163. prop: "supplierName",
  164. label: "供应商",
  165. },
  166. ];
  167. });
  168. const config = computed(() => {
  169. return [
  170. {
  171. attrs: {
  172. label: "申购单号",
  173. slot: "code",
  174. width: 220,
  175. },
  176. },
  177. {
  178. attrs: {
  179. label: "申购时间",
  180. prop: "applyTime",
  181. align: "center",
  182. width: 160,
  183. },
  184. },
  185. {
  186. attrs: {
  187. label: "申购人",
  188. prop: "applyName",
  189. width: 160,
  190. },
  191. },
  192. {
  193. attrs: {
  194. label: "申购说明",
  195. prop: "remark",
  196. },
  197. },
  198. {
  199. attrs: {
  200. label: "操作",
  201. width: 80,
  202. align: "center",
  203. fixed: "right",
  204. },
  205. renderHTML(row) {
  206. return [
  207. {
  208. attrs: {
  209. label: "采购",
  210. type: "primary",
  211. text: true,
  212. },
  213. el: "button",
  214. click() {
  215. clickPurchase(row);
  216. },
  217. },
  218. ];
  219. },
  220. },
  221. ];
  222. });
  223. const configTwo = computed(() => {
  224. return [
  225. {
  226. type: "expand",
  227. attrs: {
  228. label: " ",
  229. slot: "typeExpand",
  230. width: 50,
  231. },
  232. },
  233. {
  234. attrs: {
  235. label: "采购单号",
  236. slot: "code",
  237. width: 160,
  238. },
  239. },
  240. {
  241. attrs: {
  242. label: "申购单号",
  243. prop: "applyBuyCode",
  244. width: 160,
  245. },
  246. },
  247. {
  248. attrs: {
  249. label: "状态",
  250. prop: "flowStatus",
  251. width: 100,
  252. },
  253. render(val) {
  254. return proxy.dictKeyValue(val, flowStatus.value);
  255. },
  256. },
  257. {
  258. attrs: {
  259. label: "币种",
  260. prop: "currency",
  261. width: 100,
  262. },
  263. render(val) {
  264. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["currency"]);
  265. },
  266. },
  267. {
  268. attrs: {
  269. label: "预付款",
  270. slot: "advancePayment",
  271. width: 80,
  272. },
  273. },
  274. {
  275. attrs: {
  276. label: "尾款",
  277. slot: "finalPayment",
  278. width: 80,
  279. },
  280. },
  281. {
  282. attrs: {
  283. label: "含税总金额",
  284. prop: "totalAmountIncludingTax",
  285. width: 120,
  286. align: "right",
  287. },
  288. },
  289. {
  290. attrs: {
  291. label: "不含税总金额",
  292. prop: "totalAmountExcludingTax",
  293. width: 120,
  294. align: "right",
  295. },
  296. },
  297. {
  298. attrs: {
  299. label: "结算方式",
  300. prop: "settlementMethod",
  301. width: 120,
  302. },
  303. render(val) {
  304. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["settlement_method"]);
  305. },
  306. },
  307. {
  308. attrs: {
  309. label: "发票类型",
  310. prop: "invoiceType",
  311. width: 140,
  312. },
  313. render(val) {
  314. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["invoice_type"]);
  315. },
  316. },
  317. {
  318. attrs: {
  319. label: "交期",
  320. prop: "deliveryDate",
  321. width: 160,
  322. },
  323. },
  324. {
  325. attrs: {
  326. label: "供应商",
  327. prop: "supplierName",
  328. "min-width": 160,
  329. },
  330. },
  331. {
  332. attrs: {
  333. label: "创建时间",
  334. prop: "createTime",
  335. width: 160,
  336. },
  337. },
  338. {
  339. attrs: {
  340. label: "操作",
  341. width: 120,
  342. align: "center",
  343. fixed: "right",
  344. },
  345. renderHTML(row) {
  346. return [
  347. row.flowStatus == "0" || row.flowStatus == "3"
  348. ? {
  349. attrs: {
  350. label: "编辑",
  351. type: "primary",
  352. text: true,
  353. },
  354. el: "button",
  355. click() {
  356. clickUpdate(row);
  357. },
  358. }
  359. : {},
  360. row.flowStatus == "0" || row.flowStatus == "3"
  361. ? {
  362. attrs: {
  363. label: "删除",
  364. type: "danger",
  365. text: true,
  366. },
  367. el: "button",
  368. click() {
  369. clickDelete(row);
  370. },
  371. }
  372. : {},
  373. ];
  374. },
  375. },
  376. ];
  377. });
  378. const getList = async (req) => {
  379. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  380. loading.value = true;
  381. proxy.post("/applyBuy/page", sourceList.value.pagination).then((res) => {
  382. sourceList.value.data = res.rows;
  383. setTimeout(() => {
  384. loading.value = false;
  385. }, 200);
  386. });
  387. };
  388. getList();
  389. const clickReset = () => {
  390. getList("");
  391. };
  392. const getListTwo = async (req, status) => {
  393. if (status) {
  394. sourceListTwo.value.pagination = {
  395. pageNum: sourceListTwo.value.pagination.pageNum,
  396. pageSize: sourceListTwo.value.pagination.pageSize,
  397. };
  398. } else {
  399. sourceListTwo.value.pagination = { ...sourceListTwo.value.pagination, ...req };
  400. }
  401. loading.value = true;
  402. proxy.post("/purchase/page", sourceListTwo.value.pagination).then((res) => {
  403. sourceListTwo.value.data = res.rows;
  404. sourceListTwo.value.pagination.total = res.total;
  405. setTimeout(() => {
  406. loading.value = false;
  407. }, 200);
  408. });
  409. };
  410. const clickResetTwo = () => {
  411. getListTwo("", true);
  412. };
  413. const changeActiveName = (val) => {
  414. if (val === "first") {
  415. getList();
  416. } else {
  417. getListTwo();
  418. }
  419. };
  420. const clickCode = (item) => {
  421. proxy.$router.replace({
  422. path: "/platform_manage/process/processApproval",
  423. query: {
  424. flowKey: "apply_buy",
  425. flowName: "申购流程",
  426. processType: "20",
  427. id: item.id,
  428. flowId: item.flowId,
  429. random: proxy.random(),
  430. },
  431. });
  432. };
  433. const clickPurchaseCode = (item) => {
  434. proxy.$router.replace({
  435. path: "/platform_manage/process/processApproval",
  436. query: {
  437. flowKey: "purchase",
  438. flowName: "采购流程",
  439. processType: "20",
  440. id: item.id,
  441. flowId: item.flowId,
  442. random: proxy.random(),
  443. },
  444. });
  445. };
  446. const clickPurchase = (item) => {
  447. proxy.$router.replace({
  448. path: "/platform_manage/process/processApproval",
  449. query: {
  450. flowKey: "purchase",
  451. flowName: "采购流程",
  452. random: proxy.random(),
  453. subscribeId: item.id,
  454. },
  455. });
  456. };
  457. const clickUpdate = (item) => {
  458. proxy.$router.replace({
  459. path: "/platform_manage/process/processApproval",
  460. query: {
  461. flowKey: "purchase",
  462. flowName: "采购流程",
  463. processType: "40",
  464. id: item.id,
  465. random: proxy.random(),
  466. },
  467. });
  468. };
  469. const clickDelete = (row) => {
  470. ElMessageBox.confirm("你是否确认此操作", "提示", {
  471. confirmButtonText: "确定",
  472. cancelButtonText: "取消",
  473. type: "warning",
  474. })
  475. .then(() => {
  476. proxy.post("/purchase/delete", { id: row.id }).then(() => {
  477. ElMessage({ message: "删除成功", type: "success" });
  478. getListTwo();
  479. });
  480. })
  481. .catch(() => {});
  482. };
  483. </script>
  484. <style lang="scss" scoped>
  485. ::v-deep(.el-input-number .el-input__inner) {
  486. text-align: left;
  487. }
  488. ::v-deep(.el-table__expand-icon) {
  489. display: grid;
  490. place-items: center;
  491. }
  492. </style>