wagonLoad.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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)"
  32. :disabled="!scope.row.isEdit"
  33. type="text" size="small"
  34. >修改</el-button
  35. >
  36. <!-- <el-button
  37. type="text"
  38. size="small"
  39. @click="deleteclick(scope.row.resultId)"
  40. >删除</el-button
  41. > -->
  42. </template>
  43. </el-table-column>
  44. </dilTable>
  45. </div>
  46. </template>
  47. <script>
  48. import { sjTime } from "@/utils/sharedJsFile";
  49. export default {
  50. name: "wagonload",
  51. data() {
  52. return {
  53. startTime: null,
  54. endTime: null,
  55. input: "",
  56. option: {
  57. // 表格请求数据的地址
  58. requestUrl: ""
  59. }
  60. };
  61. },
  62. created() {
  63. this.getRequestUrl();
  64. },
  65. methods: {
  66. getRequestUrl() {
  67. this.option.requestUrl =
  68. "/api/v1/tms/getTmstrainWagonLoad?apiId=58&resultType=1&i=" +
  69. new Date();
  70. },
  71. onclick() {
  72. let startTime = null;
  73. let endTime = null;
  74. if (this.startTime) {
  75. startTime = sjTime(this.startTime);
  76. }
  77. if (this.endTime) {
  78. endTime = sjTime(this.endTime);
  79. }
  80. if (startTime && endTime) {
  81. if (startTime < endTime) {
  82. this.option.requestUrl =
  83. "/api/v1/tms/getTmstrainWagonLoad?apiId=58&resultType=1&con=" +
  84. this.input +
  85. "&startTime=" +
  86. startTime +
  87. "&endTime=" +
  88. endTime +
  89. "&i=" +
  90. new Date();
  91. }
  92. } else {
  93. this.option.requestUrl =
  94. "/api/v1/tms/getTmstrainWagonLoad?apiId=58&resultType=1&con=" +
  95. this.input;
  96. }
  97. },
  98. btnclick() {
  99. this.$router.push("/addWagonLoad");
  100. },
  101. click(resultId) {
  102. this.$router.push("/editWagonLoad/" + resultId);
  103. },
  104. deleteclick(scope) {
  105. let resultId = scope;
  106. this.$confirm("是否删除", "提示", {
  107. confirmButtonText: "确定",
  108. cancelButtonText: "取消",
  109. type: "warning",
  110. center: true
  111. })
  112. .then(() => {
  113. this.$message({
  114. type: "success",
  115. message: "删除成功!"
  116. });
  117. this.axios
  118. .post(
  119. "/api/v1/tms/deleteTmstrainLoadingResultByResultId?resultId=" +
  120. resultId
  121. )
  122. .then(() => {
  123. this.getRequestUrl();
  124. });
  125. })
  126. .catch(() => {
  127. this.$message({
  128. type: "info",
  129. message: "取消删除!"
  130. });
  131. });
  132. }
  133. }
  134. };
  135. </script>
  136. <style lang="scss" scoped>
  137. .trainTransport {
  138. .top {
  139. padding: 1.25rem 0.375rem;
  140. .el-input {
  141. width: 20%;
  142. margin-right: 1.25rem;
  143. }
  144. }
  145. }
  146. </style>