wagonLoad.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. },
  61. created() {
  62. this.getRequestUrl();
  63. },
  64. methods: {
  65. getRequestUrl(){
  66. this.option.requestUrl = "/api/v1/tms/getTmstrainWagonLoad?apiId=58&resultType=1&i=" + new Date()
  67. },
  68. onclick() {
  69. let startTime = null;
  70. let endTime = null;
  71. if (this.startTime) {
  72. startTime = sjTime(this.startTime);
  73. }
  74. if (this.endTime) {
  75. endTime = sjTime(this.endTime);
  76. }
  77. if (startTime && endTime) {
  78. if (startTime < endTime) {
  79. this.option.requestUrl =
  80. "/api/v1/tms/getTmstrainWagonLoad?apiId=58&resultType=1&con=" +
  81. this.input + "&startTime=" +
  82. startTime +
  83. "&endTime=" +
  84. endTime +
  85. "&i=" +
  86. new Date();
  87. }
  88. } else {
  89. this.option.requestUrl =
  90. "/api/v1/tms/getTmstrainWagonLoad?apiId=58&resultType=1&con=" +
  91. this.input;
  92. }
  93. },
  94. btnclick() {
  95. this.$router.push("/addWagonLoad");
  96. },
  97. click(resultId) {
  98. this.$router.push("/editWagonLoad/" + resultId);
  99. },
  100. deleteclick(scope) {
  101. let resultId = scope;
  102. this.$confirm("是否删除", "提示", {
  103. confirmButtonText: "确定",
  104. cancelButtonText: "取消",
  105. type: "warning",
  106. center: true,
  107. })
  108. .then(() => {
  109. this.$message({
  110. type: "success",
  111. message: "删除成功!",
  112. });
  113. this.axios
  114. .post(
  115. "/api/v1/tms/deleteTmstrainLoadingResultByResultId?resultId=" +
  116. resultId
  117. )
  118. .then(() => {
  119. this.getRequestUrl()
  120. });
  121. })
  122. .catch(() => {
  123. this.$message({
  124. type: "info",
  125. message: "取消删除!",
  126. });
  127. });
  128. },
  129. },
  130. };
  131. </script>
  132. <style lang='scss' scoped>
  133. .trainTransport {
  134. .top {
  135. padding: 1.25rem 0.375rem;
  136. .el-input {
  137. width: 20%;
  138. margin-right: 1.25rem;
  139. }
  140. }
  141. }
  142. </style>