saleOrder.vue 13 KB

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