timeTaskResult.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. // 计时作业
  2. <template>
  3. <div class="sale">
  4. <div class="top">
  5. <!-- 框计算 -->
  6. <span class="text">计时时间:</span>
  7. <el-date-picker
  8. v-model="startTime"
  9. type="datetime"
  10. placeholder="选择日期"
  11. >
  12. </el-date-picker>
  13. <span class="text">至</span>
  14. <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
  15. </el-date-picker>
  16. <el-button type="primary" class="btn" @click="onclick">
  17. <i class="el-icon-search"></i>查询
  18. </el-button>
  19. <!-- excel导出 -->
  20. <el-button type="primary" @click="exportData()">
  21. <i class="el-icon-download"></i>导出(Excel)
  22. </el-button>
  23. </div>
  24. <div class="tab">
  25. <dilTable v-bind.sync="option" ref="excelDom">
  26. <el-table-column fixed="right" label="操作" width="180">
  27. <template slot-scope="scope">
  28. <div class="step">
  29. <el-button
  30. @click="detailclick1(scope.row)"
  31. type="text"
  32. size="small"
  33. >运输详情</el-button
  34. >
  35. </div>
  36. <!-- <el-button @click="" type="primary" style="margin-left: 16px;">
  37. 运输详情
  38. </el-button> -->
  39. </template>
  40. </el-table-column>
  41. <!-- 运输进程详情 -->
  42. <el-table-column type="expand" width="1">
  43. <template slot-scope="props">
  44. <el-form label-position="center" inline class="demo-table-expand">
  45. <div v-if="false">{{ props }}</div>
  46. <div>
  47. <el-table :data="tableData1" border>
  48. <el-table-column
  49. v-for="(item, i) in tableHead"
  50. :key="i"
  51. :prop="item.prop"
  52. :label="item.label"
  53. :width="item.width"
  54. ></el-table-column>
  55. </el-table>
  56. </div>
  57. </el-form>
  58. </template>
  59. </el-table-column>
  60. </dilTable>
  61. </div>
  62. <!-- 运输进程详情 -->
  63. <!-- <el-drawer
  64. :visible.sync="drawer"
  65. :direction="direction"> -->
  66. <!-- 步骤条显示 -->
  67. <!-- <div style="height: 200px;content-align:center" >
  68. <el-table
  69. :data="stepList"
  70. style="width: 100%">
  71. <el-table-column
  72. prop="linkName"
  73. label="计时状态"
  74. width="180">
  75. </el-table-column>
  76. <el-table-column
  77. prop="pointDate"
  78. label="时间"
  79. width="180">
  80. </el-table-column>
  81. </el-table>
  82. </div>
  83. </el-drawer> -->
  84. </div>
  85. </template>
  86. <script>
  87. import { getCookie } from "@/utils/util.js";
  88. import { sjTime } from "@/utils/sharedJsFile";
  89. export default {
  90. data() {
  91. return {
  92. inputText: "",
  93. option: {
  94. // 表格请求数据的地址
  95. requestUrl: ""
  96. },
  97. tableHead: [
  98. {
  99. prop: "linkName",
  100. label: "计时状态",
  101. width: 150
  102. },
  103. {
  104. prop: "pointDate",
  105. label: "时间",
  106. width: 150
  107. }
  108. ],
  109. tableData1: [],
  110. tableData: [],
  111. startTime: null,
  112. endTime: null,
  113. oldRow1: "",
  114. oldRowCount1: 1,
  115. drawer: false,
  116. direction: "rtl",
  117. orderId: 0,
  118. stepList: [],
  119. tableTitle: "计时统计"
  120. };
  121. },
  122. created() {
  123. if (
  124. getCookie("orgCode") == "dagangadmin" ||
  125. getCookie("orgCode") == "zidonghuabu" ||
  126. getCookie("orgCode") == "wuliuchuyunzhongxin"
  127. ) {
  128. this.option.requestUrl = "/api/v1/tms/getAllTimeTaskResult?apiId=458";
  129. } else {
  130. this.option.requestUrl =
  131. "/api/v1/tms/getAllTimeTaskResult?apiId=458&userId=" +
  132. getCookie("orgCode");
  133. }
  134. },
  135. methods: {
  136. // -------查看物资详情(已拒绝)
  137. detailclick1(row) {
  138. // 记录重复点击次数
  139. if (this.oldRow1 === row) {
  140. this.oldRowCount1 += 1;
  141. }
  142. this.orderId = row.orderId;
  143. let map = {
  144. orderId: this.orderId
  145. };
  146. // 切换当前详情表
  147. this.$refs.excelDom.toggleRowExpansion(row);
  148. // 打开前关闭上一个详情表
  149. if (this.oldRow1 != "") {
  150. if (this.oldRow1 != row) {
  151. if (this.oldRowCount1 % 2 === 1) {
  152. this.$refs.excelDom.toggleRowExpansion(this.oldRow1);
  153. } else {
  154. this.oldRowCount1 = 1;
  155. }
  156. } else {
  157. this.oldRow1 = null;
  158. return;
  159. }
  160. }
  161. // 重置上一个点击对象
  162. this.oldRow1 = row;
  163. // 根据销售订单物资中间表id查询物资信息
  164. this.axios.post("/api/v1/oms/getOrderResult?orderId=", map).then(res => {
  165. console.log("res", res);
  166. this.tableData1 = res.data;
  167. });
  168. },
  169. getStepsList(row) {
  170. console.log(row.orderId);
  171. this.orderId = row.orderId;
  172. this.drawer = true;
  173. let map = {
  174. orderId: this.orderId
  175. };
  176. this.axios.post("/api/v1/oms/getOrderResult", map).then(res => {
  177. console.log(res);
  178. if (res.status == 200) {
  179. this.stepList = res.data;
  180. } else {
  181. this.$message.error("展示失败!");
  182. }
  183. });
  184. console.log(this.stepList);
  185. },
  186. getRequirementMaterial1(row) {
  187. // 记录重复点击次数
  188. if (this.oldRow1 === row) {
  189. this.oldRowCount1 += 1;
  190. }
  191. // 切换当前详情表
  192. this.$refs.excelDom.toggleRowExpansion(row);
  193. // 打开前关闭上一个详情表
  194. if (this.oldRow1 != "") {
  195. if (this.oldRow1 != row) {
  196. if (this.oldRowCount1 % 2 === 1) {
  197. this.$refs.excelDom.toggleRowExpansion(this.oldRow1);
  198. } else {
  199. this.oldRowCount1 = 1;
  200. }
  201. } else {
  202. this.oldRow1 = null;
  203. return;
  204. }
  205. }
  206. // 重置上一个点击对象
  207. this.oldRow1 = row;
  208. this.getMaterial(row.orderId);
  209. },
  210. onclick() {
  211. let startTime = null;
  212. let endTime = null;
  213. if (this.startTime) {
  214. startTime = sjTime(this.startTime);
  215. }
  216. if (this.endTime) {
  217. endTime = sjTime(this.endTime);
  218. }
  219. if (startTime && endTime) {
  220. if (startTime < endTime) {
  221. console.log(startTime);
  222. console.log(endTime);
  223. if (
  224. getCookie("orgCode") == "dagangadmin" ||
  225. getCookie("orgCode") == "zidonghuabu" ||
  226. getCookie("orgCode") == "wuliuchuyunzhongxin"
  227. ) {
  228. this.option.requestUrl =
  229. "/api/v1/tms/getAllTimeTaskResult?apiId=458&startTime=" +
  230. startTime +
  231. "&endTime=" +
  232. endTime +
  233. "&i=" +
  234. new Date();
  235. } else {
  236. this.option.requestUrl =
  237. "/api/v1/tms/getAllTimeTaskResult?apiId=458&userId=" +
  238. getCookie("orgCode") +
  239. "&startTime=" +
  240. startTime +
  241. "&endTime=" +
  242. endTime +
  243. "&i=" +
  244. new Date();
  245. }
  246. } else {
  247. this.startTime = null;
  248. this.endTime = null;
  249. this.$message.warning("开始时间要比结束时间早");
  250. }
  251. } else {
  252. }
  253. },
  254. getMaterial(orderId) {
  255. console.log(orderId);
  256. this.axios
  257. .post("/api/v1/oms/getPauseTimeTaskDetail/" + orderId)
  258. .then(res => {
  259. console.log(res);
  260. this.tableData = res.data.data;
  261. });
  262. }
  263. }
  264. };
  265. </script>
  266. <style lang="scss">
  267. .sale {
  268. .top {
  269. padding: 1.25rem 1.875rem;
  270. .el-input {
  271. width: 20%;
  272. }
  273. }
  274. }
  275. .el-table th.el-table__cell > .cell {
  276. display: inline-block;
  277. -webkit-box-sizing: border-box;
  278. box-sizing: border-box;
  279. position: relative;
  280. vertical-align: middle;
  281. padding-left: 10px;
  282. padding-right: 10px;
  283. width: 100%;
  284. text-align: center;
  285. }
  286. .step {
  287. text-align: center;
  288. }
  289. </style>