wagonLoadEmergency.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <!-- 装车作业页面 -->
  3. <div class="homeworkPath">
  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(0)">
  22. <i class="el-icon-search"></i>查询
  23. </el-button>
  24. <el-button type="primary" @click="onclick(1)">
  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: "/api/v1/tms/getTmstrainWagonLoad?apiId=508&resultType=2",
  59. },
  60. };
  61. },
  62. methods: {
  63. onclick(num, resultId) {
  64. if (num == 0) {
  65. let startTime = null;
  66. let endTime = null;
  67. if (this.startTime) {
  68. startTime = sjTime(this.startTime);
  69. }
  70. if (this.endTime) {
  71. endTime = sjTime(this.endTime);
  72. }
  73. if (startTime && endTime) {
  74. if (startTime < endTime) {
  75. this.option.requestUrl =
  76. "/api/v1/tms/getTmstrainWagonLoad?apiId=508&resultType=2&con=" +
  77. this.input + "&startTime=" +
  78. startTime +
  79. "&endTime=" +
  80. endTime +
  81. "&i=" +
  82. new Date();
  83. }
  84. } else {
  85. this.option.requestUrl =
  86. "/api/v1/tms/getTmstrainWagonLoad?apiId=508&resultType=2&con=" +
  87. this.input;
  88. }
  89. } else if (num == 1) {
  90. this.$router.push("/addWagonLoadEmergency");
  91. } else if (num == 2) {
  92. // console.log("resultId",resultId);
  93. this.$router.push("/editWagonLoadEmergency/" + resultId);
  94. }
  95. },
  96. click(resultId) {
  97. this.$router.push("/editWagonLoadEmergency/" + resultId);
  98. },
  99. deleteclick(resultId) {
  100. this.$confirm("是否删除", "提示", {
  101. confirmButtonText: "确定",
  102. cancelButtonText: "取消",
  103. type: "warning",
  104. center: true,
  105. })
  106. .then(() => {
  107. this.$message({
  108. type: "success",
  109. message: "删除成功!",
  110. });
  111. this.axios
  112. .post(
  113. "/api/v1/tms/deleteTmstrainLoadingResultByResultId?resultId=" +
  114. resultId
  115. )
  116. .then(() => {
  117. this.$router.go(0);
  118. });
  119. })
  120. .catch(() => {
  121. this.$message({
  122. type: "info",
  123. message: "取消删除!",
  124. });
  125. });
  126. },
  127. },
  128. };
  129. </script>
  130. <style lang='scss' scoped>
  131. .homeworkPath {
  132. .top {
  133. padding: 1.25rem 0.375rem;
  134. .el-input {
  135. width: 20%;
  136. margin-right: 40rpx;
  137. }
  138. .btn {
  139. width: 5.5%;
  140. margin-left: 0.25rem;
  141. }
  142. }
  143. }
  144. </style>