wagonLoad.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <!-- 装车作业页面 -->
  3. <div class="trainTransport">
  4. <div class="top">
  5. <el-input
  6. class="el-input"
  7. placeholder="请输入内容"
  8. v-model="input"
  9. clearable
  10. >
  11. </el-input>
  12. <el-date-picker
  13. v-model="startTime"
  14. type="datetime"
  15. placeholder="选择日期"
  16. >
  17. </el-date-picker>
  18. <span>至</span>
  19. <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
  20. </el-date-picker>
  21. <el-button type="primary" class="btn" @click="onclick">
  22. <i class="el-icon-search"></i>查询
  23. </el-button>
  24. <el-button type="primary" @click="btnclick(0)">
  25. <i class="el-icon-plus"></i>新增
  26. </el-button>
  27. </div>
  28. <dilTable v-bind.sync="option">
  29. <el-table-column fixed="right" label="操作" width="100">
  30. <template slot-scope="scope">
  31. <el-button @click="click(scope.row.resultId)" type="text" size="small"
  32. >修改</el-button
  33. >
  34. <el-button
  35. type="text"
  36. size="small"
  37. @click="deleteclick(scope.row.resultId)"
  38. >删除</el-button
  39. >
  40. </template>
  41. </el-table-column>
  42. </dilTable>
  43. </div>
  44. </template>
  45. <script>
  46. import { sjTime } from "@/utils/sharedJsFile";
  47. export default {
  48. name: "wagonload",
  49. data() {
  50. return {
  51. startTime: null,
  52. endTime: null,
  53. input: "",
  54. option: {
  55. // 表格请求数据的地址
  56. requestUrl: ""
  57. }
  58. };
  59. },
  60. created() {
  61. this.getRequestUrl();
  62. },
  63. methods: {
  64. getRequestUrl() {
  65. this.option.requestUrl =
  66. "/api/v1/tms/getTmstrainWagonLoad?apiId=58&resultType=1&i=" +
  67. new Date();
  68. },
  69. onclick() {
  70. let startTime = null;
  71. let endTime = null;
  72. if (this.startTime) {
  73. startTime = sjTime(this.startTime);
  74. }
  75. if (this.endTime) {
  76. endTime = sjTime(this.endTime);
  77. }
  78. if (startTime && endTime) {
  79. if (startTime < endTime) {
  80. this.option.requestUrl =
  81. "/api/v1/tms/getTmstrainWagonLoad?apiId=58&resultType=1&con=" +
  82. this.input +
  83. "&startTime=" +
  84. startTime +
  85. "&endTime=" +
  86. endTime +
  87. "&i=" +
  88. new Date();
  89. }
  90. } else {
  91. this.option.requestUrl =
  92. "/api/v1/tms/getTmstrainWagonLoad?apiId=58&resultType=1&con=" +
  93. this.input;
  94. }
  95. },
  96. btnclick() {
  97. this.$router.push("/addWagonLoadCopy");
  98. },
  99. click(resultId) {
  100. this.$router.push("/editWagonLoad/" + resultId);
  101. },
  102. deleteclick(scope) {
  103. let resultId = scope;
  104. this.$confirm("是否删除", "提示", {
  105. confirmButtonText: "确定",
  106. cancelButtonText: "取消",
  107. type: "warning",
  108. center: true
  109. })
  110. .then(() => {
  111. this.$message({
  112. type: "success",
  113. message: "删除成功!"
  114. });
  115. this.axios
  116. .post(
  117. "/api/v1/tms/deleteTmstrainLoadingResultByResultId?resultId=" +
  118. resultId
  119. )
  120. .then(() => {
  121. this.getRequestUrl();
  122. });
  123. })
  124. .catch(() => {
  125. this.$message({
  126. type: "info",
  127. message: "取消删除!"
  128. });
  129. });
  130. }
  131. }
  132. };
  133. </script>
  134. <style lang="scss" scoped>
  135. .trainTransport {
  136. .top {
  137. padding: 1.25rem 0.375rem;
  138. .el-input {
  139. width: 20%;
  140. margin-right: 1.25rem;
  141. }
  142. }
  143. }
  144. </style>