index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <script>
  2. import { taskList } from "@/api/business/purchase/purchase-task";
  3. import AddPurchaseTaskDrawer from "./add-purchase-task.vue";
  4. import SeePurchaseTaskDrawer from "./see-purchase-task.vue";
  5. import DirectSourcingTable from "./direct-sourcing.vue";
  6. export default {
  7. name: "PuchaseTask",
  8. components: {
  9. AddPurchaseTaskDrawer,
  10. SeePurchaseTaskDrawer,
  11. DirectSourcingTable,
  12. },
  13. data() {
  14. const arr2Obj = function (data, keyName, valueName) {
  15. return Object.fromEntries(
  16. data.map((item) => [item[keyName], item[valueName]])
  17. );
  18. };
  19. const searchColumns = [
  20. { title: "物料分类", key: "", type: "TagSelect" },
  21. { title: "物料", key: "", type: "TagSelect" },
  22. { title: "物料编码", key: "material", type: "Input" },
  23. { title: "物料描述", key: "materialDesc", type: "Input" },
  24. { title: "需求组织", key: "", type: "TagSelect" },
  25. { title: "需求日期", key: "", type: "DatePicker" },
  26. { title: "计划人员", key: "", type: "TagSelect" },
  27. { title: "采购组织", key: "", type: "TagSelect" },
  28. { title: "创建时间", key: "", type: "DatePicker" },
  29. { title: "采购员", key: "", type: "TagSelect" },
  30. { title: "状态", key: "", type: "Select" },
  31. {
  32. title: "来源单据号",
  33. key: "",
  34. type: "Input",
  35. placeholder: "请输入来源单据号,多个用英文逗号分割",
  36. },
  37. { title: "收货组织", key: "", type: "TagSelect" },
  38. { title: "采购分类", key: "", type: "Input" },
  39. // { title: "受理人", key: "", type: "TagSelect" },
  40. { title: "项目", key: "", type: "TagSelect" },
  41. { title: "需求部门", key: "", type: "TagSelect" },
  42. { title: "需求人", key: "", type: "TagSelect" },
  43. { title: "ERP信息", key: "", type: "Input" },
  44. ];
  45. const initSearchColumns = () => searchColumns;
  46. const initSearchParams = () => arr2Obj(initSearchColumns(), "key", "value");
  47. const tableColumns = [
  48. {
  49. title: "物料名称",
  50. key: "materialName",
  51. },
  52. {
  53. title: "物料编码",
  54. key: "material",
  55. },
  56. {
  57. title: "来源单据号",
  58. key: "material",
  59. },
  60. {
  61. title: "来源单据行号",
  62. key: "material",
  63. },
  64. {
  65. title: "采购数量",
  66. key: "material",
  67. },
  68. {
  69. title: "采购单位",
  70. key: "material",
  71. },
  72. {
  73. title: "采购换算率",
  74. key: "material",
  75. },
  76. {
  77. title: "主数量",
  78. key: "material",
  79. },
  80. {
  81. title: "主计量单位",
  82. key: "material",
  83. },
  84. {
  85. title: "计价单位",
  86. key: "material",
  87. },
  88. {
  89. title: "计价换算率",
  90. key: "material",
  91. },
  92. {
  93. title: "计价数量",
  94. key: "material",
  95. },
  96. {
  97. title: "未执行数量",
  98. key: "material",
  99. },
  100. {
  101. title: "主未执行数量",
  102. key: "material",
  103. },
  104. {
  105. title: "计价未执行数量",
  106. key: "material",
  107. },
  108. {
  109. title: "已执行数量",
  110. key: "material",
  111. },
  112. {
  113. title: "交易类型",
  114. key: "material",
  115. },
  116. {
  117. title: "分配日期",
  118. key: "material",
  119. },
  120. {
  121. title: "SKU编码",
  122. key: "material",
  123. },
  124. {
  125. title: "SKU名称",
  126. key: "material",
  127. },
  128. {
  129. title: "SKU规格说明",
  130. key: "material",
  131. },
  132. {
  133. title: "SKU型号",
  134. key: "material",
  135. },
  136. {
  137. title: "SKU规格",
  138. key: "material",
  139. },
  140. {
  141. title: "产品规格",
  142. key: "material",
  143. },
  144. {
  145. title: "产品型号",
  146. key: "material",
  147. },
  148. {
  149. title: "物料描述",
  150. key: "material",
  151. },
  152. {
  153. title: "品牌",
  154. key: "material",
  155. },
  156. {
  157. title: "计划价",
  158. key: "material",
  159. },
  160. {
  161. title: "需求附件",
  162. key: "material",
  163. },
  164. {
  165. title: "物料附件",
  166. key: "material",
  167. },
  168. {
  169. title: "项目",
  170. key: "material",
  171. },
  172. {
  173. title: "建议供应商",
  174. key: "material",
  175. },
  176. {
  177. title: "需求组织",
  178. key: "material",
  179. },
  180. {
  181. title: "需求部门",
  182. key: "material",
  183. },
  184. {
  185. title: "需求人",
  186. key: "material",
  187. },
  188. {
  189. title: "已下单采购数量",
  190. key: "material",
  191. },
  192. {
  193. title: "采购组织",
  194. key: "material",
  195. },
  196. {
  197. title: "采购员",
  198. key: "material",
  199. },
  200. {
  201. title: "计划员",
  202. key: "material",
  203. },
  204. {
  205. title: "计划部门",
  206. key: "material",
  207. },
  208. {
  209. title: "联系电话",
  210. key: "material",
  211. },
  212. {
  213. title: "采购分类",
  214. key: "material",
  215. },
  216. {
  217. title: "收货人",
  218. key: "material",
  219. },
  220. {
  221. title: "收货地址",
  222. key: "material",
  223. },
  224. {
  225. title: "收货人电话",
  226. key: "material",
  227. },
  228. {
  229. title: "需求时间",
  230. key: "material",
  231. },
  232. // {
  233. // title: "受理状态",
  234. // key: "material",
  235. // },
  236. {
  237. title: "状态",
  238. key: "material",
  239. },
  240. // {
  241. // title: "受理人",
  242. // key: "material",
  243. // },
  244. {
  245. title: "委托受理人",
  246. key: "material",
  247. },
  248. {
  249. title: "弹性分单条件",
  250. key: "material",
  251. },
  252. {
  253. title: "备注",
  254. key: "material",
  255. },
  256. {
  257. title: "ERP相关信息",
  258. key: "material",
  259. },
  260. {
  261. title: "创建时间",
  262. key: "material",
  263. },
  264. {
  265. title: "最新价格",
  266. key: "material",
  267. },
  268. {
  269. title: "生产厂家",
  270. key: "material",
  271. },
  272. {
  273. title: "报价供应商",
  274. key: "material",
  275. },
  276. {
  277. title: "历史最低价",
  278. key: "material",
  279. },
  280. {
  281. title: "生产订单状态",
  282. key: "material",
  283. },
  284. // {
  285. // title: "寻源退回原因",
  286. // key: "material",
  287. // },
  288. {
  289. title: "收货仓库档案编码",
  290. key: "material",
  291. },
  292. {
  293. title: "自定义项16",
  294. key: "material",
  295. },
  296. {
  297. title: "收货客户",
  298. key: "material",
  299. },
  300. {
  301. title: "入库仓库",
  302. key: "material",
  303. },
  304. {
  305. title: "货位",
  306. key: "material",
  307. },
  308. {
  309. title: "指定供应商",
  310. key: "material",
  311. },
  312. {
  313. title: "单位",
  314. key: "material",
  315. },
  316. {
  317. title: "自定义项15",
  318. key: "material",
  319. },
  320. {
  321. title: "收货地址",
  322. key: "material",
  323. },
  324. {
  325. title: "收货联系人",
  326. key: "material",
  327. },
  328. {
  329. title: "需求来源",
  330. key: "material",
  331. },
  332. ];
  333. const initTableColumns = () => tableColumns;
  334. const initTableData = () => {
  335. const data = [];
  336. for (let index = 0; index < 25; index++) {
  337. data.push({ materialName: index });
  338. }
  339. return data;
  340. };
  341. return {
  342. loading: false,
  343. isSimpleSearch: true,
  344. searchColumns: initSearchColumns(),
  345. searchParams: {
  346. isAsc: "desc",
  347. reasonable: "",
  348. orderByColumn: "",
  349. ...initSearchParams(),
  350. },
  351. tableColumns: initTableColumns(),
  352. tableData: initTableData(),
  353. page: { pageNum: 1, pageSize: 25 },
  354. total: 0,
  355. pageSizes: [25, 50, 100],
  356. };
  357. },
  358. computed: {
  359. showSearchColumns() {
  360. return this.isSimpleSearch
  361. ? this.searchColumns.slice(0, 4)
  362. : this.searchColumns;
  363. },
  364. },
  365. // watch: {
  366. // $route: {
  367. // handler: function (route) {
  368. // this.redirect = route.query && route.query.redirect;
  369. // },
  370. // immediate: true,
  371. // },
  372. // },
  373. created() {
  374. // this.fetchTaskList();
  375. console.log("Vue", this);
  376. },
  377. methods: {
  378. async fetchTaskList() {
  379. this.loading = true;
  380. try {
  381. const { code, msg, rows, total } = await taskList({
  382. ...this.page,
  383. ...this.searchParams,
  384. });
  385. if (code === 200) {
  386. this.total = total;
  387. this.tableData = rows;
  388. this.$notify.success({ title: msg });
  389. } else {
  390. this.$notify.warning({ title: msg });
  391. }
  392. } catch (err) {
  393. this.$notify.error({ title: "error", message: err });
  394. } finally {
  395. this.loading = false;
  396. }
  397. },
  398. handleSearchChange() {
  399. this.isSimpleSearch = !this.isSimpleSearch;
  400. this.$notify.info({
  401. title: this.isSimpleSearch ? "Simple Search" : "All Search",
  402. });
  403. },
  404. handleSizeChange() { },
  405. handleCurrentChange() { },
  406. handleOpenAddDrawer() {
  407. const { setVisible } = this.$refs.addDrawerFef;
  408. setVisible(true);
  409. setTimeout(() => {
  410. this.$notify.info("Open Add Drawer");
  411. }, 250);
  412. },
  413. handleOpenSeeDrawer() {
  414. const { setVisible } = this.$refs.seeDrawerFef;
  415. setVisible(true);
  416. setTimeout(() => {
  417. this.$notify.info("Open See Drawer");
  418. }, 250);
  419. },
  420. },
  421. };
  422. </script>
  423. <template>
  424. <el-card v-loading="loading" style="width: calc(100% - 24px); height: 100%; margin: 10px" :body-style="{ padding: 0 }">
  425. <AddPurchaseTaskDrawer ref="addDrawerFef"></AddPurchaseTaskDrawer>
  426. <SeePurchaseTaskDrawer ref="seeDrawerFef"></SeePurchaseTaskDrawer>
  427. <el-form size="mini" label-position="right" label-width="85px" :model="searchParams" style="padding: 20px 0 0 0">
  428. <el-row :gutter="24">
  429. <el-col :span="22">
  430. <el-row :gutter="20">
  431. <el-col v-for="column in showSearchColumns" :key="column.title" :xl="6" :lg="6" :md="8" :sm="12" :xs="24">
  432. <el-form-item :prop="column.key" :label="column.title">
  433. <el-input v-model="searchParams[column.key]" :placeholder="column.placeholder"></el-input>
  434. </el-form-item>
  435. </el-col>
  436. </el-row>
  437. </el-col>
  438. <el-col :span="2">
  439. <el-row :gutter="24">
  440. <el-col :span="24">
  441. <el-button type="primary" size="mini">搜索</el-button>
  442. </el-col>
  443. <el-col v-show="!isSimpleSearch" :span="24" style="margin: 10px 0 0">
  444. <el-button size="mini">重置</el-button>
  445. </el-col>
  446. </el-row>
  447. </el-col>
  448. </el-row>
  449. </el-form>
  450. <el-divider>
  451. <i :class="isSimpleSearch ? 'el-icon-arrow-down' : 'el-icon-arrow-up'" style="cursor: pointer"
  452. @click="handleSearchChange"></i>
  453. </el-divider>
  454. <el-row :gutter="24" style="padding: 0 20px">
  455. <el-col :span="6">123</el-col>
  456. <el-col :span="18" style="text-align: right">
  457. <el-button size="mini" type="danger" style="margin: 0 10px 0 0" @click="handleOpenAddDrawer">
  458. 新增
  459. </el-button>
  460. <el-dropdown placement="bottom-start">
  461. <el-button size="mini" style="margin: 0 10px 0 0">
  462. 发布
  463. <i class="el-icon-arrow-down el-icon--right"></i>
  464. </el-button>
  465. <el-dropdown-menu slot="dropdown">
  466. <el-dropdown-item>发布寻源</el-dropdown-item>
  467. <el-dropdown-item>发布委托</el-dropdown-item>
  468. <el-dropdown-item>采购方案</el-dropdown-item>
  469. </el-dropdown-menu>
  470. </el-dropdown>
  471. <el-dropdown placement="bottom-start">
  472. <el-button size="mini" style="border-right: 0; border-radius: 3px 0 0 3px">
  473. 首次协议直采
  474. <i class="el-icon-arrow-down el-icon--right"></i>
  475. </el-button>
  476. <el-dropdown-menu slot="dropdown">
  477. <el-dropdown-item>首次协议直采</el-dropdown-item>
  478. <el-dropdown-item>余量协议直采</el-dropdown-item>
  479. </el-dropdown-menu>
  480. </el-dropdown>
  481. <el-dropdown placement="bottom-start">
  482. <el-button size="mini" style="border-right: 0; border-radius: 0">
  483. 跟单采购
  484. <i class="el-icon-arrow-down el-icon--right"></i>
  485. </el-button>
  486. <el-dropdown-menu slot="dropdown">
  487. <el-dropdown-item>按合同(普通)取价</el-dropdown-item>
  488. </el-dropdown-menu>
  489. </el-dropdown>
  490. <el-button size="mini" style="border-right: 0; border-radius: 0">
  491. Excel导出
  492. </el-button>
  493. <el-button size="mini" style="margin: 0; border-right: 0; border-radius: 0">
  494. 退回请购
  495. </el-button>
  496. <el-dropdown placement="bottom-start">
  497. <el-button size="mini" style="border-right: 0; border-radius: 0">
  498. 清单采购
  499. <i class="el-icon-arrow-down el-icon--right"></i>
  500. </el-button>
  501. <el-dropdown-menu slot="dropdown">
  502. <el-dropdown-item>商超匹配下单</el-dropdown-item>
  503. </el-dropdown-menu>
  504. </el-dropdown>
  505. <el-button size="mini" disabled style="margin: 0 10px 0 0; border-radius: 0 3px 3px 0">
  506. 一键合同下单
  507. </el-button>
  508. <el-button size="mini" style="margin: 0 10px 0 0">删除</el-button>
  509. <el-dropdown placement="bottom-end">
  510. <el-button size="mini">
  511. 更多
  512. <i class="el-icon-arrow-down el-icon--right"></i>
  513. </el-button>
  514. <el-dropdown-menu slot="dropdown">
  515. <el-dropdown-item>抢单</el-dropdown-item>
  516. <el-dropdown-item>批量修改收货组织</el-dropdown-item>
  517. <el-dropdown-item>批量退回</el-dropdown-item>
  518. <el-dropdown-item>退回需求申请</el-dropdown-item>
  519. <el-dropdown-item>刷新缓存</el-dropdown-item>
  520. </el-dropdown-menu>
  521. </el-dropdown>
  522. </el-col>
  523. </el-row>
  524. <el-table @row-dblclick="handleOpenSeeDrawer" :data="tableData" size="mini" style="width: 100%; margin: 20px 0 0 0">
  525. <el-table-column v-for="(column, index) in tableColumns" :key="index" :prop="column.key" :label="column.title"
  526. :width="column.width || 180" :show-overflow-tooltip="column.showOverflowTooltip || true">
  527. </el-table-column>
  528. </el-table>
  529. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :total="total"
  530. :page-sizes="pageSizes" :page-size="page.pageSize" :current-page="page.pageNum" hide-on-single-page
  531. layout="total, prev, pager, next, sizes, jumper">
  532. </el-pagination>
  533. <DirectSourcingTable></DirectSourcingTable>
  534. </el-card>
  535. </template>