saleOrderSteel.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. <template>
  2. <!-- 销售订单页面 -->
  3. <div class="salePlan">
  4. <div class="top">
  5. <el-input placeholder="请输入内容" v-model="input" clearable> </el-input>
  6. <el-button type="primary" class="btn" @click="onclick">
  7. <i class="el-icon-search"></i>查询
  8. </el-button>
  9. <el-button type="primary" @click="btnclick(0)">
  10. <i class="el-icon-plus"></i>钢材订单新增
  11. </el-button>
  12. <el-button type="primary" @click="refresh">
  13. <i class="el-icon-refresh"></i>刷新
  14. </el-button>
  15. <el-button type="primary" @click="batchReport">
  16. <i class="upload2"></i>批量上传
  17. </el-button>
  18. <el-button
  19. type="primary"
  20. @click="exportData()"
  21. v-if="activeName == 'first'"
  22. ><i class="el-icon-download"></i>导出(Excel)</el-button
  23. >
  24. </div>
  25. <div class="table">
  26. <el-tabs v-model="activeName" @tab-click="handleClick">
  27. <!-- 未上报 -->
  28. <el-tab-pane label="未上报" name="first">
  29. <mergeRowTable
  30. v-bind.sync="option"
  31. ref="excelDom"
  32. @selection-change="selectionChange"
  33. >
  34. <el-table-column
  35. fixed="right"
  36. label="操作"
  37. align="center"
  38. width="200"
  39. >
  40. <template slot-scope="scope">
  41. <el-button
  42. @click="uploadclick(scope.row.saleOrderId)"
  43. type="text"
  44. size="small"
  45. >上传</el-button
  46. >
  47. <el-button
  48. @click="click(scope.row.saleOrderId)"
  49. type="text"
  50. size="small"
  51. >修改</el-button
  52. >
  53. <el-button
  54. type="text"
  55. size="small"
  56. @click="deleteclick(scope.row.saleOrderId)"
  57. >删除</el-button
  58. >
  59. </template>
  60. </el-table-column>
  61. <!-- 物资详情抽屉 -->
  62. </mergeRowTable>
  63. </el-tab-pane>
  64. <!-- 已审批 -->
  65. <el-tab-pane label="已审批" name="four">
  66. <mergeRowTable v-bind.sync="option4" ref="table">
  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="getOrderDetails(scope.row.saleOrderId)"
  76. type="text"
  77. size="small"
  78. >运单</el-button
  79. >
  80. <el-button
  81. @click="deleteSaleOrder(scope.row)"
  82. type="text"
  83. size="small"
  84. >关闭订单</el-button
  85. >
  86. </template>
  87. </el-table-column>
  88. </mergeRowTable>
  89. </el-tab-pane>
  90. <el-tab-pane label="反审批" name="five">
  91. <mergeRowTable v-bind.sync="option5" ref="table2">
  92. <el-table-column
  93. fixed="right"
  94. label="操作"
  95. align="center"
  96. width="200"
  97. >
  98. <template slot-scope="scope">
  99. <el-button
  100. @click="updateSaleOrder(scope.row.saleOrderId)"
  101. type="text"
  102. size="small"
  103. >异常处理</el-button
  104. >
  105. </template>
  106. </el-table-column></mergeRowTable
  107. >
  108. </el-tab-pane>
  109. <!-- 已上报 -->
  110. <el-tab-pane label="已上报" name="second">
  111. <mergeRowTable v-bind.sync="option2" ref="table2"> </mergeRowTable>
  112. </el-tab-pane>
  113. </el-tabs>
  114. </div>
  115. </div>
  116. </template>
  117. <script>
  118. import { getCookie } from "@/utils/util.js";
  119. export default {
  120. name: "saleOrder",
  121. data() {
  122. return {
  123. batchReportList: [],
  124. activeName: "first",
  125. tableTitle: "未上传销售订单报表",
  126. drawer: false,
  127. input: "",
  128. index: "",
  129. carrierId: null,
  130. carrierName: null,
  131. option: {
  132. // 表格请求数据的地址
  133. requestUrl: "/api/v1/ams/getSaleOrderInfoes?apiId=408",
  134. selectionType: "select",
  135. comparison: "saleNumber",
  136. columnIndexs: [0, 1, 2, 3, 4, 8, 9, 10, 11, 12, 13, 14, 15, 16]
  137. },
  138. option2: {
  139. // 表格请求数据的地址
  140. requestUrl: "/api/v1/ams/getSaleOrderReportedes?apiId=408",
  141. comparison: "saleNumber",
  142. columnIndexs: [0, 1, 2, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15]
  143. },
  144. option4: {
  145. // 表格请求数据的地址
  146. requestUrl:
  147. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1",
  148. comparison: "saleNumber",
  149. columnIndexs: [
  150. 0,
  151. 1,
  152. 2,
  153. 3,
  154. 7,
  155. 8,
  156. 9,
  157. 10,
  158. 11,
  159. 12,
  160. 13,
  161. 14,
  162. 15,
  163. 16,
  164. 17,
  165. 18,
  166. 20,
  167. 21
  168. ]
  169. },
  170. option5: {
  171. // 表格请求数据的地址
  172. requestUrl: "/api/v1/ams/getSteelOrderDeletedList?apiId=409",
  173. comparison: "saleNumber",
  174. columnIndexs: [
  175. 0,
  176. 1,
  177. 2,
  178. 3,
  179. 7,
  180. 8,
  181. 9,
  182. 10,
  183. 11,
  184. 12,
  185. 13,
  186. 14,
  187. 15,
  188. 16,
  189. 17,
  190. 18,
  191. 20,
  192. 21
  193. ]
  194. },
  195. mapList: [],
  196. mapItemList: []
  197. };
  198. },
  199. created() {
  200. if (getCookie("orgCode") == "shouhuokehu") {
  201. this.option.requestUrl =
  202. "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
  203. getCookie("userId");
  204. this.option2.requestUrl =
  205. "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
  206. getCookie("userId");
  207. this.option4.requestUrl =
  208. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
  209. getCookie("userId");
  210. this.option5.requestUrl =
  211. "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
  212. getCookie("userId");
  213. } else {
  214. this.option.requestUrl =
  215. "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" + null;
  216. this.option2.requestUrl =
  217. "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" + null;
  218. this.option4.requestUrl =
  219. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
  220. null;
  221. this.option5.requestUrl =
  222. "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" + null;
  223. }
  224. },
  225. methods: {
  226. deleteSaleOrder(row) {
  227. this.$prompt("此操作将关闭订单且下面的待运输订单,是否继续?", "提示", {
  228. confirmButtonText: "确定",
  229. cancelButtonText: "取消",
  230. inputPlaceholder: "请输入关闭原因-必填!!!",
  231. center: true,
  232. type: "warning"
  233. })
  234. .then(({ value }) => {
  235. if (value != null) {
  236. let mapValue = {
  237. number: row.saleNumber,
  238. saleOrderId: row.saleOrderId,
  239. reason: value
  240. };
  241. this.axios
  242. .post("/api/v1/ams/deleteSaleOrderSame", mapValue)
  243. .then(res => {
  244. if (res.data.code == 200) {
  245. this.$message.success("关闭成功");
  246. this.getRequestUrl();
  247. }
  248. });
  249. } else {
  250. this.$message.error("请输入理由");
  251. }
  252. })
  253. .catch(() => {
  254. this.$message({
  255. type: "info",
  256. message: "取消输入"
  257. });
  258. });
  259. },
  260. updateSaleOrder(saleOrderId) {
  261. this.$router.push("updateSaleOrderSteel/" + saleOrderId);
  262. },
  263. getOrderDetails(saleOrderId) {
  264. console.log(saleOrderId);
  265. this.$router.push("saleOrderOODetails/" + saleOrderId);
  266. },
  267. getRequestUrl() {
  268. if (getCookie("orgCode") == "shouhuokehu") {
  269. this.option.requestUrl =
  270. "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
  271. getCookie("userId") +
  272. "&i=" +
  273. new Date();
  274. this.option2.requestUrl =
  275. "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
  276. getCookie("userId") +
  277. "&i=" +
  278. new Date();
  279. this.option4.requestUrl =
  280. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
  281. getCookie("userId") +
  282. "&i=" +
  283. new Date();
  284. this.option5.requestUrl =
  285. "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
  286. getCookie("userId") +
  287. "&i=" +
  288. new Date();
  289. } else {
  290. this.option.requestUrl =
  291. "/api/v1/ams/getSaleOrderInfoes?apiId=408&consigneeSsoId=" +
  292. null +
  293. "&i=" +
  294. new Date();
  295. this.option2.requestUrl =
  296. "/api/v1/ams/getSaleOrderReportedes?apiId=408&consigneeSsoId=" +
  297. null +
  298. "&i=" +
  299. new Date();
  300. this.option4.requestUrl =
  301. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&shipperId=1&saleType=1&consigneeSsoId=" +
  302. null +
  303. "&i=" +
  304. new Date();
  305. this.option5.requestUrl =
  306. "/api/v1/ams/getSteelOrderDeletedList?apiId=409&consigneeSsoId=" +
  307. null +
  308. "&i=" +
  309. new Date();
  310. }
  311. },
  312. batchReport() {
  313. if (this.batchReportList.length === 0) {
  314. this.$message.error("请先选择需要批量上传的销售订单");
  315. return;
  316. }
  317. this.axios
  318. .post("/api/v1/ams/uploadSaleOrderList", this.batchReportList)
  319. .then(res => {
  320. if (res.data.code == "200") {
  321. this.$message.success("上传成功");
  322. this.getRequestUrl();
  323. } else {
  324. this.$message.error("上传失败");
  325. }
  326. });
  327. },
  328. selectionChange(selection) {
  329. console.log(selection);
  330. this.batchReportList = [];
  331. this.batchReportList = selection;
  332. },
  333. refresh() {
  334. this.$router.go(0);
  335. },
  336. handleClick(tab, event) {
  337. console.log(tab, event);
  338. },
  339. onclick() {
  340. if (getCookie("orgCode") == "shouhuokehu") {
  341. if (this.activeName == "first") {
  342. this.option.requestUrl =
  343. "/api/v1/ams/getSaleOrderInfoes?apiId=408&saleType=1&con=" +
  344. this.input +
  345. "&consigneeSsoId=" +
  346. getCookie("userId") +
  347. "&i=" +
  348. new Date();
  349. } else if (this.activeName == "second") {
  350. this.option2.requestUrl =
  351. "/api/v1/ams/getSaleOrderReportedes?apiId=408&saleType=1&con=" +
  352. this.input +
  353. "&consigneeSsoId=" +
  354. getCookie("userId") +
  355. "&i=" +
  356. new Date();
  357. } else if (this.activeName == "four") {
  358. this.option4.requestUrl =
  359. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&saleType=1&shipperId=1&con=" +
  360. this.input +
  361. "&consigneeSsoId=" +
  362. getCookie("userId") +
  363. "&i=" +
  364. new Date();
  365. }
  366. } else {
  367. if (this.activeName == "first") {
  368. this.option.requestUrl =
  369. "/api/v1/ams/getSaleOrderInfoes?apiId=408&saleType=1&con=" +
  370. this.input +
  371. "&i=" +
  372. new Date();
  373. } else if (this.activeName == "second") {
  374. this.option2.requestUrl =
  375. "/api/v1/ams/getSaleOrderReportedes?apiId=408&saleType=1&con=" +
  376. this.input +
  377. "&i=" +
  378. new Date();
  379. } else if (this.activeName == "four") {
  380. this.option4.requestUrl =
  381. "/api/v1/ams/getSaleOrderListBySaleCompanyes?apiId=409&saleType=1&shipperId=1&con=" +
  382. this.input +
  383. "&i=" +
  384. new Date();
  385. }
  386. }
  387. },
  388. handleClose() {},
  389. seeclick(saleOrderId) {
  390. this.$router.push("/saleOrderDetail/" + saleOrderId);
  391. },
  392. btnclick() {
  393. this.$router.push("/addSaleOrder");
  394. },
  395. click(saleOrderId) {
  396. this.$router.push("/editSaleOrder/" + saleOrderId);
  397. },
  398. // 上传
  399. uploadclick(saleOrderId) {
  400. this.$confirm("是否上传", "提示", {
  401. confirmButtonText: "确定",
  402. cancelButtonText: "取消",
  403. type: "warning",
  404. center: true
  405. })
  406. .then(() => {
  407. this.axios
  408. .post("/api/v1/ams/uploadSaleOrder?saleOrderId=" + saleOrderId)
  409. .then(res => {
  410. if (res.data.code == "200") {
  411. this.$message.success("上传成功!");
  412. this.getRequestUrl();
  413. } else {
  414. this.$message.success("上传失败!");
  415. this.getRequestUrl();
  416. }
  417. });
  418. })
  419. .catch(() => {
  420. this.$message({
  421. type: "info",
  422. message: "取消上传!"
  423. });
  424. });
  425. },
  426. //删除
  427. deleteclick(scope) {
  428. let saleOrderId = scope;
  429. this.$confirm("是否删除", "提示", {
  430. confirmButtonText: "确定",
  431. cancelButtonText: "取消",
  432. type: "warning",
  433. center: true
  434. })
  435. .then(() => {
  436. this.axios
  437. .post(
  438. "/api/v1/ams/deleteAmsSaleOrderBySaleOrderId?saleOrderId=" +
  439. saleOrderId
  440. )
  441. .then(res => {
  442. if (res.data.code == "200") {
  443. this.$message.success("删除成功");
  444. this.getRequestUrl();
  445. } else {
  446. this.$message.success("删除失败");
  447. this.getRequestUrl();
  448. }
  449. });
  450. })
  451. .catch(() => {
  452. this.$message({
  453. type: "info",
  454. message: "取消删除!"
  455. });
  456. });
  457. }
  458. }
  459. };
  460. </script>
  461. <style lang="scss" scoped>
  462. .salePlan {
  463. .top {
  464. margin-left: 20px;
  465. margin-top: 20px;
  466. .el-input {
  467. width: 20%;
  468. margin-right: 1.25rem;
  469. }
  470. }
  471. .table {
  472. margin-left: 20px;
  473. margin-top: 20px;
  474. }
  475. }
  476. </style>