saleOrderSteel.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. <template>
  2. <!-- 销售订单页面 -->
  3. <div class="salePlan">
  4. <div class="top">
  5. <span>订单时间:</span>
  6. <el-date-picker
  7. v-model="startTime"
  8. type="datetime"
  9. placeholder="选择日期"
  10. style="width:220px"
  11. >
  12. </el-date-picker>
  13. <span>至</span>
  14. <el-date-picker
  15. v-model="endTime"
  16. type="datetime"
  17. placeholder="选择日期"
  18. style="width:220px"
  19. >
  20. </el-date-picker>
  21. <el-input
  22. placeholder="请输入内容"
  23. v-model="input"
  24. clearable
  25. style="width:250px"
  26. >
  27. </el-input>
  28. <el-button type="primary" class="btn" @click="onclick">
  29. <i class="el-icon-search"></i>
  30. </el-button>
  31. <el-button type="primary" @click="btnclick(0)">
  32. <i class="el-icon-plus"></i>钢材订单新增
  33. </el-button>
  34. <el-button type="primary" @click="refresh">
  35. <i class="el-icon-refresh"></i>
  36. </el-button>
  37. <el-button type="primary" @click="batchReport">
  38. <i class="upload2"></i>批量上传
  39. </el-button>
  40. <el-button
  41. type="primary"
  42. @click="exportData()"
  43. v-if="activeName == 'first'"
  44. ><i class="el-icon-download"></i>Excel</el-button
  45. >
  46. <el-button disabled>物资总件数</el-button>
  47. <el-input
  48. placeholder=""
  49. v-model="matSum"
  50. clearable
  51. style="width:100px"
  52. disabled
  53. >
  54. </el-input>
  55. </div>
  56. <div class="table">
  57. <el-tabs v-model="activeName" @tab-click="handleClick">
  58. <!-- 未上报 -->
  59. <el-tab-pane label="未上报" name="first">
  60. <mergeRowTable
  61. v-bind.sync="option"
  62. ref="excelDom"
  63. @selection-change="selectionChange"
  64. :pageSize="200"
  65. @func="func"
  66. >
  67. <el-table-column
  68. fixed="right"
  69. label="操作"
  70. align="center"
  71. width="200"
  72. >
  73. <template slot-scope="scope">
  74. <el-button
  75. @click="uploadclick(scope.row.saleOrderId)"
  76. type="text"
  77. size="small"
  78. >上传</el-button
  79. >
  80. <el-button
  81. @click="click(scope.row.saleOrderId)"
  82. type="text"
  83. size="small"
  84. >修改</el-button
  85. >
  86. <el-button
  87. type="text"
  88. size="small"
  89. @click="deleteclick(scope.row.saleOrderId)"
  90. >删除</el-button
  91. >
  92. <el-button
  93. type="text"
  94. size="small"
  95. @click="copyClick(scope.row.saleOrderId)"
  96. >复制</el-button
  97. >
  98. </template>
  99. </el-table-column>
  100. </mergeRowTable>
  101. </el-tab-pane>
  102. <!-- 已审批 -->
  103. <el-tab-pane label="已审批" name="four">
  104. <mergeRowTable
  105. v-bind.sync="option4"
  106. ref="table"
  107. :pageSize="200"
  108. @func="func1"
  109. >
  110. <el-table-column
  111. fixed="right"
  112. label="操作"
  113. align="center"
  114. width="200"
  115. >
  116. <template slot-scope="scope">
  117. <el-button
  118. @click="getOrderDetails(scope.row.saleOrderId)"
  119. type="text"
  120. size="small"
  121. >运单</el-button
  122. >
  123. <el-button
  124. @click="deleteSaleOrder(scope.row)"
  125. type="text"
  126. size="small"
  127. >关闭订单</el-button
  128. >
  129. <el-button
  130. @click="updateSaleOrder(scope.row)"
  131. type="text"
  132. size="small"
  133. >异常处理</el-button
  134. >
  135. <el-button
  136. type="text"
  137. size="small"
  138. @click="copyClick(scope.row.saleOrderId)"
  139. >复制</el-button
  140. >
  141. </template>
  142. </el-table-column>
  143. </mergeRowTable>
  144. </el-tab-pane>
  145. <el-tab-pane label="反审批" name="five">
  146. <mergeRowTable
  147. v-bind.sync="option5"
  148. ref="table2"
  149. :pageSize="200"
  150. @func="func3"
  151. >
  152. <el-table-column
  153. fixed="right"
  154. label="操作"
  155. align="center"
  156. width="200"
  157. >
  158. <template slot-scope="scope">
  159. <el-button
  160. @click="updateSaleOrder(scope.row)"
  161. type="text"
  162. size="small"
  163. >异常处理</el-button
  164. >
  165. </template>
  166. </el-table-column></mergeRowTable
  167. >
  168. </el-tab-pane>
  169. <!-- 已上报 -->
  170. <el-tab-pane label="已上报" name="second">
  171. <mergeRowTable
  172. v-bind.sync="option2"
  173. ref="table2"
  174. :pageSize="200"
  175. @func="func2"
  176. >
  177. <el-table-column
  178. fixed="right"
  179. label="操作"
  180. align="center"
  181. width="200"
  182. >
  183. <template slot-scope="scope">
  184. <el-button
  185. @click="updateSaleOrderStatusById(scope)"
  186. type="text"
  187. size="small"
  188. >撤销上报</el-button
  189. >
  190. </template>
  191. </el-table-column>
  192. </mergeRowTable>
  193. </el-tab-pane>
  194. </el-tabs>
  195. </div>
  196. </div>
  197. </template>
  198. <script>
  199. import { getCookie } from "@/utils/util.js";
  200. import { sjTime } from "@/utils/sharedJsFile";
  201. export default {
  202. name: "saleOrder",
  203. data() {
  204. return {
  205. startTime: null,
  206. endTime: null,
  207. batchReportList: [],
  208. activeName: "first",
  209. tableTitle: "未上传销售订单报表",
  210. drawer: false,
  211. input: "",
  212. index: "",
  213. carrierId: null,
  214. carrierName: null,
  215. option: {
  216. // 表格请求数据的地址
  217. requestUrl: "",
  218. selectionType: "select",
  219. comparison: "saleNumber",
  220. columnIndexs: [0, 1, 2, 3, 4, 9, 10, 11, 12, 13, 14, 15, 16, 17]
  221. },
  222. option2: {
  223. // 表格请求数据的地址
  224. requestUrl: "",
  225. comparison: "saleNumber",
  226. columnIndexs: [0, 1, 2, 3, 8, 9, 10, 11, 12, 13, 14, 15, 16]
  227. },
  228. option4: {
  229. // 表格请求数据的地址
  230. requestUrl: "",
  231. comparison: "saleNumber",
  232. columnIndexs: [
  233. 0,
  234. 1,
  235. 2,
  236. 3,
  237. 8,
  238. 9,
  239. 10,
  240. 11,
  241. 12,
  242. 13,
  243. 14,
  244. 15,
  245. 16,
  246. 17,
  247. 18,
  248. 20,
  249. 21,
  250. 22
  251. ]
  252. },
  253. option5: {
  254. // 表格请求数据的地址
  255. requestUrl: "",
  256. comparison: "saleNumber",
  257. columnIndexs: [
  258. 0,
  259. 1,
  260. 2,
  261. 3,
  262. 7,
  263. 8,
  264. 9,
  265. 10,
  266. 11,
  267. 12,
  268. 13,
  269. 14,
  270. 15,
  271. 16,
  272. 17,
  273. 18,
  274. 20,
  275. 21
  276. ]
  277. },
  278. mapList: [],
  279. mapItemList: [],
  280. matSum: null
  281. };
  282. },
  283. created() {
  284. if (getCookie("orgCode") == "shouhuokehu") {
  285. this.option.requestUrl =
  286. "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
  287. getCookie("userId") +
  288. "&i=" +
  289. new Date();
  290. this.option2.requestUrl =
  291. "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
  292. getCookie("userId") +
  293. "&i=" +
  294. new Date();
  295. this.option4.requestUrl =
  296. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
  297. getCookie("userId");
  298. this.option5.requestUrl =
  299. "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
  300. getCookie("userId") +
  301. "&i=" +
  302. new Date();
  303. } else if (getCookie("orgCode") == "xiaoshouyewuyuan") {
  304. this.option.requestUrl =
  305. "/api/v1/ams/getSaleOrderInfoes?apiId=408&saler=" +
  306. getCookie("loginName") +
  307. "&i=" +
  308. new Date();
  309. this.option2.requestUrl =
  310. "/api/v1/ams/getSaleOrderReportedes?apiId=408&saler=" +
  311. getCookie("loginName") +
  312. "&i=" +
  313. new Date();
  314. this.option4.requestUrl =
  315. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&saler=" +
  316. getCookie("loginName") +
  317. "&i=" +
  318. new Date();
  319. this.option5.requestUrl =
  320. "/api/v1/ams/getSteelOrderDeletedList?apiId=409&saler=" +
  321. getCookie("loginName");
  322. } else {
  323. this.option.requestUrl =
  324. "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
  325. null +
  326. "&i=" +
  327. new Date();
  328. this.option2.requestUrl =
  329. "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
  330. null +
  331. "&i=" +
  332. new Date();
  333. this.option4.requestUrl =
  334. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
  335. null +
  336. "&i=" +
  337. new Date();
  338. this.option5.requestUrl =
  339. "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
  340. null +
  341. "&i=" +
  342. new Date();
  343. }
  344. },
  345. methods: {
  346. updateSaleOrderStatusById(scope) {
  347. console.log(scope.row.saleOrderId);
  348. this.$confirm("是否撤销", "警告", {
  349. confirmButtonText: "确定撤销",
  350. cancelButtonText: "取消撤销",
  351. type: "warning",
  352. center: true
  353. })
  354. .then(() => {
  355. this.axios
  356. .post(
  357. "/api/v1/uc/updateSaleOrderStatusById?saleOrderId=" +
  358. scope.row.saleOrderId
  359. )
  360. .then(res => {
  361. if (res.data.code == "200") {
  362. this.$message.success("撤销成功");
  363. this.activeName = "first";
  364. this.getRequestUrl();
  365. } else {
  366. this.$message.error("撤销失败");
  367. }
  368. })
  369. .catch(() => {
  370. this.$message.error("撤销失败");
  371. });
  372. })
  373. .catch(() => {
  374. console.log("取消撤销");
  375. });
  376. },
  377. func(res) {
  378. this.matSum = res.list.reduce(function(prev, item) {
  379. return prev + item.materialNumber;
  380. }, 0);
  381. },
  382. func1(res) {
  383. this.matSum = res.list.reduce(function(prev, item) {
  384. return prev + item.materialNumber;
  385. }, 0);
  386. },
  387. func2(res) {
  388. this.matSum = res.list.reduce(function(prev, item) {
  389. return prev + item.materialNumber;
  390. }, 0);
  391. },
  392. func3(res) {
  393. this.matSum = res.list.reduce(function(prev, item) {
  394. return prev + item.materialNumber;
  395. }, 0);
  396. },
  397. deleteSaleOrder(row) {
  398. this.$prompt("此操作将关闭订单且下面的待运输订单,是否继续?", "提示", {
  399. confirmButtonText: "确定",
  400. cancelButtonText: "取消",
  401. inputPlaceholder: "请输入关闭原因-必填!!!",
  402. center: true,
  403. type: "warning"
  404. })
  405. .then(({ value }) => {
  406. if (value != null) {
  407. let mapValue = {
  408. number: row.saleNumber,
  409. saleOrderId: row.saleOrderId,
  410. reason: value
  411. };
  412. this.axios
  413. .post("/api/v1/ams/deleteSaleOrderSame", mapValue)
  414. .then(res => {
  415. if (res.data.code == 200) {
  416. this.$message.success("关闭成功");
  417. this.getRequestUrl();
  418. }
  419. });
  420. } else {
  421. this.$message.error("请输入理由");
  422. }
  423. })
  424. .catch(() => {
  425. this.$message({
  426. type: "info",
  427. message: "取消输入"
  428. });
  429. });
  430. },
  431. updateSaleOrder(row) {
  432. console.log(row);
  433. this.$router.push(
  434. "updateSaleOrderSteel/" + row.saleOrderId + "/" + row.deleted
  435. );
  436. },
  437. getOrderDetails(saleOrderId) {
  438. console.log(saleOrderId);
  439. this.$router.push("saleOrderOODetails/" + saleOrderId);
  440. },
  441. getRequestUrl() {
  442. if (getCookie("orgCode") == "shouhuokehu") {
  443. this.option.requestUrl =
  444. "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
  445. getCookie("userId") +
  446. "&i=" +
  447. new Date();
  448. this.option2.requestUrl =
  449. "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
  450. getCookie("userId") +
  451. "&i=" +
  452. new Date();
  453. this.option4.requestUrl =
  454. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
  455. getCookie("userId") +
  456. "&i=" +
  457. new Date();
  458. this.option5.requestUrl =
  459. "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
  460. getCookie("userId") +
  461. "&i=" +
  462. new Date();
  463. } else {
  464. this.option.requestUrl =
  465. "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
  466. null +
  467. "&i=" +
  468. new Date();
  469. this.option2.requestUrl =
  470. "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
  471. null +
  472. "&i=" +
  473. new Date();
  474. this.option4.requestUrl =
  475. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
  476. null +
  477. "&i=" +
  478. new Date();
  479. this.option5.requestUrl =
  480. "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
  481. null +
  482. "&i=" +
  483. new Date();
  484. }
  485. },
  486. batchReport() {
  487. if (this.batchReportList.length === 0) {
  488. this.$message.error("请先选择需要批量上传的销售订单");
  489. return;
  490. }
  491. const loading = this.$loading({
  492. lock: true,
  493. text: "正在努力上传",
  494. spinner: "el-icon-loading",
  495. background: "rgba(0, 0, 0, 0.7)"
  496. });
  497. this.axios
  498. .post("/api/v1/ams/uploadSaleOrderList", this.batchReportList)
  499. .then(res => {
  500. if (res.data.code == "200") {
  501. this.$message.success("上传成功");
  502. this.getRequestUrl();
  503. loading.close();
  504. } else {
  505. this.$message.error("上传失败");
  506. loading.close();
  507. }
  508. })
  509. .catch(() => {
  510. this.$message.error("上传失败");
  511. loading.close();
  512. });
  513. },
  514. selectionChange(selection) {
  515. console.log(selection);
  516. this.batchReportList = [];
  517. this.batchReportList = selection;
  518. },
  519. refresh() {
  520. this.$router.go(0);
  521. },
  522. handleClick(tab, event) {
  523. console.log(tab, event);
  524. },
  525. onclick() {
  526. var startTime = null;
  527. var endTime = null;
  528. if (this.startTime && this.endTime) {
  529. startTime = sjTime(this.startTime);
  530. endTime = sjTime(this.endTime);
  531. }
  532. if (getCookie("orgCode") == "shouhuokehu") {
  533. if (this.activeName == "first") {
  534. this.option.requestUrl =
  535. "/api/v1/ams/getSaleOrderInfoes?apiId=408&saleType=1&con=" +
  536. this.input +
  537. "&consigneeSsoId=" +
  538. getCookie("userId") +
  539. "&startTime=" +
  540. startTime +
  541. "&endTime=" +
  542. endTime +
  543. "&i=" +
  544. new Date();
  545. } else if (this.activeName == "second") {
  546. this.option2.requestUrl =
  547. "/api/v1/ams/getSaleOrderReportedes?apiId=408&saleType=1&con=" +
  548. this.input +
  549. "&consigneeSsoId=" +
  550. getCookie("userId") +
  551. "&startTime=" +
  552. startTime +
  553. "&endTime=" +
  554. endTime +
  555. "&i=" +
  556. new Date();
  557. } else if (this.activeName == "four") {
  558. this.option4.requestUrl =
  559. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&saleType=1&shipperId=1&con=" +
  560. this.input +
  561. "&consigneeSsoId=" +
  562. getCookie("userId") +
  563. "&startTime=" +
  564. startTime +
  565. "&endTime=" +
  566. endTime +
  567. "&i=" +
  568. new Date();
  569. }
  570. } else {
  571. if (this.activeName == "first") {
  572. this.option.requestUrl =
  573. "/api/v1/ams/getSaleOrderInfoes?apiId=408&saleType=1&con=" +
  574. this.input +
  575. "&startTime=" +
  576. startTime +
  577. "&endTime=" +
  578. endTime +
  579. "&i=" +
  580. new Date();
  581. } else if (this.activeName == "second") {
  582. this.option2.requestUrl =
  583. "/api/v1/ams/getSaleOrderReportedes?apiId=408&saleType=1&con=" +
  584. this.input +
  585. "&startTime=" +
  586. startTime +
  587. "&endTime=" +
  588. endTime +
  589. "&i=" +
  590. new Date();
  591. } else if (this.activeName == "four") {
  592. this.option4.requestUrl =
  593. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&saleType=1&shipperId=1&con=" +
  594. this.input +
  595. "&startTime=" +
  596. startTime +
  597. "&endTime=" +
  598. endTime +
  599. "&i=" +
  600. new Date();
  601. }
  602. }
  603. },
  604. handleClose() {},
  605. seeclick(saleOrderId) {
  606. this.$router.push("/saleOrderDetail/" + saleOrderId);
  607. },
  608. btnclick() {
  609. this.$router.push("/addSaleOrder");
  610. },
  611. click(saleOrderId) {
  612. this.$router.push("/editSaleOrder/" + saleOrderId);
  613. },
  614. copyClick(saleOrderId) {
  615. this.$router.push("/copySteelOrder/" + saleOrderId);
  616. },
  617. // 上传
  618. uploadclick(saleOrderId) {
  619. this.$confirm("是否上传", "提示", {
  620. confirmButtonText: "确定",
  621. cancelButtonText: "取消",
  622. type: "warning",
  623. center: true
  624. })
  625. .then(() => {
  626. const loading = this.$loading({
  627. lock: true,
  628. text: "正在努力上传",
  629. spinner: "el-icon-loading",
  630. background: "rgba(0, 0, 0, 0.7)"
  631. });
  632. this.axios
  633. .post("/api/v1/ams/uploadSaleOrder?saleOrderId=" + saleOrderId)
  634. .then(res => {
  635. if (res.data.code == "200") {
  636. this.$message.success("上传成功!");
  637. this.getRequestUrl();
  638. loading.close();
  639. } else {
  640. this.$message.success("上传失败!");
  641. this.getRequestUrl();
  642. loading.close();
  643. }
  644. })
  645. .catch(() => {
  646. loading.close();
  647. });
  648. })
  649. .catch(() => {
  650. this.$message({
  651. type: "info",
  652. message: "取消上传!"
  653. });
  654. });
  655. },
  656. //删除
  657. deleteclick(scope) {
  658. let saleOrderId = scope;
  659. this.$confirm("是否删除", "提示", {
  660. confirmButtonText: "确定",
  661. cancelButtonText: "取消",
  662. type: "warning",
  663. center: true
  664. })
  665. .then(() => {
  666. this.axios
  667. .post(
  668. "/api/v1/ams/deleteAmsSaleOrderBySaleOrderId?saleOrderId=" +
  669. saleOrderId
  670. )
  671. .then(res => {
  672. if (res.data.code == "200") {
  673. this.$message.success("删除成功");
  674. this.getRequestUrl();
  675. } else {
  676. this.$message.success("删除失败");
  677. this.getRequestUrl();
  678. }
  679. });
  680. })
  681. .catch(() => {
  682. this.$message({
  683. type: "info",
  684. message: "取消删除!"
  685. });
  686. });
  687. }
  688. }
  689. };
  690. </script>
  691. <style lang="scss" scoped>
  692. .salePlan {
  693. .top {
  694. margin-left: 20px;
  695. margin-top: 20px;
  696. }
  697. .table {
  698. margin-left: 20px;
  699. margin-top: 20px;
  700. }
  701. }
  702. </style>