saleOrderSteel.vue 15 KB

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