deliveryNotice.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <!-- 发货通知页面 -->
  3. <div class="shipTransport">
  4. <div class="top">
  5. <el-input placeholder="请输入内容" v-model="input" clearable> </el-input>
  6. <el-date-picker
  7. v-model="startTime"
  8. type="datetime"
  9. placeholder="选择日期"
  10. >
  11. </el-date-picker>
  12. <span>至</span>
  13. <el-date-picker v-model="endTime" type="datetime" placeholder="选择日期">
  14. </el-date-picker>
  15. <el-button type="primary" class="btn" @click="onclick">
  16. <i class="el-icon-search"></i>查询
  17. </el-button>
  18. <el-button type="primary" class="btn" @click="addClick">
  19. <i class="el-icon-circle-plus-outline"></i>新增
  20. </el-button>
  21. <el-button type="primary" @click="refresh()">
  22. <i class="el-icon-refresh"></i>刷新
  23. </el-button>
  24. <el-button type="primary" @click="exportData()" v-if="activeName == 'second'">
  25. <i class="el-icon-download"></i>导出(Excel)
  26. </el-button>
  27. </div>
  28. <el-tabs v-model="activeName" @tab-click="handleClick">
  29. <!-- 未下发 -->
  30. <el-tab-pane label="未下发" name="first">
  31. <dilTable v-bind.sync="option1" ref="table">
  32. <el-table-column
  33. fixed="right"
  34. align="center"
  35. label="操作"
  36. width="120"
  37. >
  38. <template slot-scope="scope">
  39. <el-button
  40. @click="sendClick(scope.row.noticeId)"
  41. type="text"
  42. size="small"
  43. >
  44. 下发
  45. </el-button>
  46. <el-button
  47. @click="modifyclick(scope.row.noticeId)"
  48. type="text"
  49. size="small"
  50. >
  51. 修改
  52. </el-button>
  53. <el-button
  54. @click="deleteclick(scope.row.noticeId)"
  55. type="text"
  56. size="small"
  57. >
  58. 删除
  59. </el-button>
  60. <el-button
  61. @click="toPhotoClick(scope.row.noticeId)"
  62. type="text"
  63. size="small"
  64. >
  65. 货权转移图片</el-button
  66. >
  67. </template>
  68. </el-table-column>
  69. </dilTable>
  70. </el-tab-pane>
  71. <!-- 已下发 -->
  72. <el-tab-pane label="已下发" name="second">
  73. <dilTable v-bind.sync="option2" ref="excelDom">
  74. <el-table-column
  75. fixed="right"
  76. align="center"
  77. label="操作"
  78. width="120"
  79. >
  80. <template slot-scope="scope">
  81. <el-button
  82. @click="toPhotoClick(scope.row.noticeId)"
  83. type="text"
  84. size="small"
  85. >
  86. 货权转移图片</el-button
  87. >
  88. </template>
  89. </el-table-column>
  90. </dilTable>
  91. </el-tab-pane>
  92. </el-tabs>
  93. <vxe-modal width="549px" height="731px" v-model="isShow" show-footer>
  94. <div class="demo-image__preview">
  95. <div
  96. class="href"
  97. style="
  98. margin-left: 80px;
  99. text-align: center;
  100. font-family: fangsong;
  101. font-weight: 300;
  102. font-size:18px;
  103. "
  104. >
  105. 如果加载失败,请尝试<a
  106. style="color: red"
  107. :href="src"
  108. download="货权转移.pdf"
  109. >点此下载pdf</a
  110. >
  111. </div>
  112. <el-image
  113. style="height: 731px; text-align: center"
  114. :src="src"
  115. :preview-src-list="srcList"
  116. >
  117. </el-image>
  118. </div>
  119. </vxe-modal>
  120. </div>
  121. </template>
  122. <script>
  123. import { sjTime } from "@/utils/sharedJsFile";
  124. import { getCookie } from "@/utils/util.js";
  125. export default {
  126. name: "homeworkPath",
  127. data() {
  128. return {
  129. srcList: [],
  130. isShow: false,
  131. src: "",
  132. startTime: null,
  133. endTime: null,
  134. tableTitle: "发货通知",
  135. // restaurants: [],
  136. input: "",
  137. activeName: "first",
  138. option1: {
  139. // 表格请求数据的地址
  140. requestUrl: "/api/v1/tms/getshipDeliveryNoticeList?apiId=69&status=0",
  141. },
  142. option2: {
  143. // 表格请求数据的地址
  144. requestUrl: "/api/v1/tms/getshipDeliveryNoticeList?apiId=69&status=1",
  145. },
  146. };
  147. },
  148. mounted(){
  149. this.initDate();
  150. this.onclick();
  151. },
  152. methods: {
  153. initDate(){
  154. this.startTime=new Date();
  155. this.endTime=new Date();
  156. this.startTime.setDate(1);
  157. this.startTime.setHours(0);
  158. this.startTime.setMinutes(0);
  159. this.startTime.setSeconds(0);
  160. },
  161. onclick() {
  162. let startTime = null;
  163. let endTime = null;
  164. if (this.startTime) {
  165. startTime = sjTime(this.startTime);
  166. }
  167. if (this.endTime) {
  168. endTime = sjTime(this.endTime);
  169. }
  170. if (startTime && endTime && startTime < endTime) {
  171. this.option1.requestUrl =
  172. "/api/v1/tms/getshipDeliveryNoticeList?apiId=69&status=0&carrierSSOId=" +
  173. getCookie("userId") +
  174. "&con=" +
  175. this.input +
  176. "&startTime=" +
  177. startTime +
  178. "&endTime=" +
  179. endTime;
  180. this.option2.requestUrl =
  181. "/api/v1/tms/getshipDeliveryNoticeList?apiId=69&status=1&carrierSSOId=" +
  182. getCookie("userId") +
  183. "&con=" +
  184. this.input +
  185. "&startTime=" +
  186. startTime +
  187. "&endTime=" +
  188. endTime;
  189. } else {
  190. this.option1.requestUrl =
  191. "/api/v1/tms/getshipDeliveryNoticeList?apiId=69&status=0&carrierSSOId=" +
  192. getCookie("userId") +
  193. "&con=" +
  194. this.input;
  195. this.option2.requestUrl =
  196. "/api/v1/tms/getshipDeliveryNoticeList?apiId=69&status=1&carrierSSOId=" +
  197. getCookie("userId") +
  198. "&con=" +
  199. this.input;
  200. }
  201. },
  202. addClick() {
  203. this.$router.push("/addDeliveryNotice/");
  204. },
  205. modifyclick(noticeId) {
  206. this.$router.push("/modifyDeliveryNotice/" + noticeId);
  207. },
  208. deleteclick(scope) {
  209. let noticeId = scope;
  210. this.$confirm("是否删除", "提示", {
  211. confirmButtonText: "确定",
  212. cancelButtonText: "取消",
  213. type: "warning",
  214. center: true,
  215. })
  216. .then(() => {
  217. this.axios
  218. .post("/api/v1/tms/deleteByNoticeId/" + noticeId)
  219. .then(() => {
  220. this.$message({
  221. type: "success",
  222. message: "删除成功!",
  223. });
  224. this.option1.requestUrl =
  225. "/api/v1/tms/getshipDeliveryNoticeList?apiId=69&status=0&i=" +
  226. new Date();
  227. });
  228. })
  229. .catch(() => {
  230. this.$message({
  231. type: "info",
  232. message: "取消删除!",
  233. });
  234. });
  235. },
  236. toPhotoClick(noticeId) {
  237. this.axios
  238. .post("/api/v1/tms/downLoadDeilveryNotice?noticeId=" + noticeId)
  239. .then((res) => {
  240. this.srcList = [];
  241. this.src = res.data.data;
  242. this.isShow = true;
  243. this.srcList.push(res.data.data);
  244. });
  245. },
  246. handleClick(tab, event) {
  247. console.log(tab, event);
  248. },
  249. sendClick(scope) {
  250. let noticeId = scope;
  251. this.$confirm("是否下发", "提示", {
  252. confirmButtonText: "确定",
  253. cancelButtonText: "取消",
  254. type: "warning",
  255. center: true,
  256. })
  257. .then(() => {
  258. this.axios
  259. .post("/api/v1/tms/sendDeliveryNotice/" + noticeId)
  260. .then(() => {
  261. this.$message({
  262. type: "success",
  263. message: "下发成功!",
  264. });
  265. this.option1.requestUrl =
  266. "/api/v1/tms/getshipDeliveryNoticeList?apiId=69&status=0&i=" +
  267. new Date();
  268. this.option2.requestUrl =
  269. "/api/v1/tms/getshipDeliveryNoticeList?apiId=69&status=1&i=" +
  270. new Date();
  271. });
  272. })
  273. .catch(() => {
  274. this.$message({
  275. type: "info",
  276. message: "取消下发!",
  277. });
  278. });
  279. },
  280. refresh() {
  281. this.$router.go(0);
  282. },
  283. },
  284. };
  285. </script>
  286. <style lang="scss" scoped>
  287. .shipTransport {
  288. .top {
  289. padding: 1.25rem 0.375rem;
  290. .el-input {
  291. width: 20%;
  292. margin-right: 40rpx;
  293. }
  294. }
  295. }
  296. </style>