saleOrderSteel.vue 17 KB

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