saleOrder.vue 14 KB

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