index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div class="repair">
  3. <div class="top-add" @click="goNavigator()">
  4. <i class="iconfont icon-xinzeng"></i>
  5. <span class="txt">新增派单</span>
  6. </div>
  7. <div class="info-repairList">
  8. <div
  9. class="info-item"
  10. v-for="item in recordList"
  11. :key="item.id"
  12. @click="jumpPageDetails(item.id)"
  13. >
  14. <div class="info-top">
  15. <div class="left">
  16. <img :src="item.fileUrl.url" alt="" />
  17. </div>
  18. <div class="right">
  19. <p class="tit">
  20. {{ item.description }}
  21. </p>
  22. <p class="txt">{{ item.companyName }}</p>
  23. </div>
  24. </div>
  25. <div class="info-bottom">
  26. <div class="left">
  27. <i class="iconfont icon-shijian"></i>
  28. <span>
  29. {{ item.createdAt }}
  30. </span>
  31. </div>
  32. <div class="right">
  33. <span
  34. v-if="item.status == 'unAcceptance'"
  35. class="normal-tip yd h-bg"
  36. >待派单</span
  37. >
  38. <span
  39. v-if="item.status != 'unAcceptance'"
  40. class="normal-tip yd z-bg"
  41. >已派单</span
  42. >
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. </div>
  48. </template>
  49. <script>
  50. import { repairList, getByCodes } from "@/js_sdk/http.js";
  51. // import Base from "@/pages/base/base";
  52. export default {
  53. data() {
  54. return {
  55. BASE_URI: this.$constant.BASE_URI,
  56. dic_key: ["REPAIR_STATUS"],
  57. dic_SelectList: {},
  58. recordList: [],
  59. params: {
  60. // pageNum: 1,
  61. // pageSize: 10,
  62. // groupId: "870261874875170816",
  63. // createdBy: '877225455206268928' // auth.currUser().id
  64. },
  65. totalPage: 1,
  66. allData: [],
  67. repairList: [
  68. {
  69. title: "关于组织2020年无锡市服务业提质增效资金项目申报的通知",
  70. name: "无锡 XXXX有限公司",
  71. date: "2020-09-18 19:34:06",
  72. type: "1",
  73. },
  74. {
  75. title:
  76. "关于组织2020年无锡市服务业提质增效资金项目申报的通知关于组织2020年无锡市服务业提质增效资金项目申报的通知",
  77. name: "无锡 XXXX有限公司",
  78. date: "2020-09-18 19:34:06",
  79. type: "2",
  80. },
  81. ],
  82. };
  83. },
  84. mounted() {
  85. // if (window.history && window.history.pushState) {
  86. // // 向历史记录中插入了当前页
  87. // history.pushState(null, null, document.URL);
  88. // window.addEventListener("popstate", this.goBack, false);
  89. // }
  90. },
  91. onLoad() {},
  92. onShow() {
  93. this.getByCodes();
  94. },
  95. methods: {
  96. goNavigator(id) {
  97. uni.navigateTo({
  98. url: "/pages/subPackages/repairDispatch-app/add",
  99. });
  100. },
  101. jumpPageDetails(id) {
  102. uni.navigateTo({
  103. url: "/pages/subPackages/repairDispatch-app/detail?id=" + id,
  104. });
  105. },
  106. async getByCodes() {
  107. let that = this;
  108. let data = await getByCodes(JSON.stringify(this.dic_key));
  109. that.dic_SelectList = that.$common.handleDicList(data);
  110. that.selectData();
  111. },
  112. // auth.currUser().id
  113. selectData() {
  114. const _this = this;
  115. repairList(this.params).then((res) => {
  116. if (res.data) {
  117. _this.recordList = [];
  118. res.data.forEach(function (item) {
  119. const jsonMap = _this.getItemJson(item);
  120. _this.recordList.push(jsonMap);
  121. });
  122. }
  123. });
  124. },
  125. getItemJson: function (item) {
  126. const fileUrls =
  127. item.fileUrl && item.fileUrl.length > 0 ? item.fileUrl.split(",") : [];
  128. console.log(fileUrls);
  129. const fileUrl = {
  130. url:
  131. this.$constant.BASE_URI +
  132. "/wx/fileController/download/" +
  133. fileUrls[0],
  134. };
  135. item.fileUrl = fileUrl;
  136. // fileUrls.forEach((item) => {
  137. // item.url = this.$constant.BASE_URI + "/wx/fileController/download/" + item;
  138. // // item.isImage = true;
  139. // fileUrl.push({ url: item, isImage: true });
  140. // });
  141. // const fileUrls = item.fileUrl !== "" ? JSON.parse(item.fileUrl) : [];
  142. // console.log(fileUrls);
  143. // item.fileUrl = fileUrls;
  144. // item.createdAt = this.$common.transServDate(item.createdAt);
  145. // console.log(item.status);
  146. // console.log(this.dic_SelectList.REPAIR_STATUS);
  147. // let index = this.dic_SelectList.REPAIR_STATUS.findIdex((e)=>e.value==item.status)
  148. // item.statusName = this.dic_SelectList.REPAIR_STATUS[index];
  149. console.log(item);
  150. return item;
  151. },
  152. /**
  153. *
  154. */
  155. quickSelect(item) {
  156. if (this.quickSleced.val && this.quickSleced.val === item.val) {
  157. this.quickSleced = {};
  158. } else {
  159. this.quickSleced = item;
  160. }
  161. },
  162. /**
  163. * 上传文件
  164. */
  165. afterRead(file) {
  166. console.log(file);
  167. },
  168. /**
  169. * 设置状态样式
  170. */
  171. setStatusStyle(status) {
  172. let statusClass = null;
  173. switch (status) {
  174. case "unAcceptance":
  175. statusClass = "pending-btn";
  176. break;
  177. case "acceptance":
  178. statusClass = "accepted-btn";
  179. break;
  180. case "processed":
  181. statusClass = "processed-btn";
  182. break;
  183. case "evaluated":
  184. statusClass = "evaluated-btn";
  185. break;
  186. }
  187. return statusClass;
  188. },
  189. },
  190. /**
  191. * 过滤器
  192. */
  193. filters: {
  194. /**
  195. * 状态:0、待受理 1、已受理 2、已处理 3、已评价
  196. */
  197. statusFilter(val) {
  198. let res = null;
  199. switch (val) {
  200. case "unAcceptance":
  201. res = "待处理";
  202. break;
  203. case "acceptance":
  204. res = "已受理";
  205. break;
  206. case "processed":
  207. res = "已处理";
  208. break;
  209. case "evaluated":
  210. res = "已评价";
  211. break;
  212. }
  213. return res;
  214. },
  215. },
  216. };
  217. </script>
  218. <style lang="scss" type="text/scss" scoped>
  219. .repair {
  220. .top-add {
  221. background-color: #fff;
  222. padding: 30rpx;
  223. margin-bottom: 20rpx;
  224. text-align: right;
  225. box-shadow: 0rpx 5rpx 10rpx 0rpx rgba(0, 0, 0, 0.05);
  226. i {
  227. font-size: 36rpx;
  228. color: $text6;
  229. margin-right: 15rpx;
  230. }
  231. .txt {
  232. font-size: 32rpx;
  233. color: $text6;
  234. }
  235. }
  236. .info-repairList {
  237. height: calc(100vh - 124rpx);
  238. overflow-y: auto;
  239. .info-item {
  240. background-color: #fff;
  241. padding: 20rpx 30rpx;
  242. margin-bottom: 20rpx;
  243. .info-top {
  244. @include flex;
  245. .left {
  246. width: 286rpx;
  247. height: 168rpx;
  248. font-size: 0;
  249. border-radius: 10rpx;
  250. overflow: hidden;
  251. img {
  252. width: 100%;
  253. height: 100%;
  254. }
  255. }
  256. .right {
  257. align-self: flex-start;
  258. width: 380rpx;
  259. .tit {
  260. width: 380rpx;
  261. font-size: 32rpx;
  262. line-height: 1.4;
  263. font-weight: bold;
  264. color: #333333;
  265. @include line-clamp;
  266. margin-bottom: 20rpx;
  267. }
  268. .txt {
  269. font-size: 28rpx;
  270. color: #666;
  271. }
  272. }
  273. }
  274. .info-bottom {
  275. margin-top: 20rpx;
  276. padding-top: 20rpx;
  277. border-top: 1rpx dashed #dbdbdb;
  278. @include flex;
  279. .left {
  280. i {
  281. font-size: 30rpx;
  282. color: #999999;
  283. margin-left: 10rpx;
  284. }
  285. span {
  286. font-size: 28rpx;
  287. color: #999999;
  288. }
  289. }
  290. .right {
  291. }
  292. }
  293. }
  294. }
  295. }
  296. </style>