index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="container">
  3. <u-popup :show="showpopup" @close="showpopup=false" :safeAreaInsetBottom='false' :round="10">
  4. <view class="popupmain">
  5. <view class="popup_title">
  6. <text>筛选</text>
  7. </view>
  8. <view class="line">
  9. </view>
  10. <view class="project">
  11. <view class="project_box" v-for="(item,index) in columns" :key="index">
  12. <view class="title">
  13. {{item.title}}
  14. </view>
  15. <view class="main">
  16. <view class='btns_main' :class="popupData[item.key]===k.id?'primary':''"
  17. @click="changetype(item,k)" style="border-radius: 0.7rem;" v-for="k in item.project"
  18. :key="k.id">{{k.label}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="popup_btns">
  23. <u-button text="重置" @click="repect"></u-button>
  24. <u-button type="primary" text="确定" @click="surepopup">
  25. </u-button>
  26. </view>
  27. </view>
  28. </u-popup>
  29. <view style="position: relative;">
  30. <view style="display: flex;align-items: center;">
  31. <input placeholder='航线名称'
  32. style="background-color: #F2F2F2;border: none;padding: 3px 10px;border-radius: 1rem;"
  33. :style="'width: 85%;'" v-model="dataForm.lineName" type="text" confirm-type="search"
  34. @confirm="searchs">
  35. <u-icon @click="openshowpopup" style="margin-left: 0.3rem;" size="26" name="list-dot"
  36. color="#C6C7CB"></u-icon>
  37. </view>
  38. <view style="position: absolute;right: 2.5rem;top: 0.4rem;z-index:10"
  39. @click="dataForm.lineName='',getList()">
  40. <u-icon v-if="dataForm.lineName" name="close-circle-fill" color="#C6C7CB"></u-icon>
  41. </view>
  42. </view>
  43. <scroll-list ref="list" :option="option" @refresh="refresh" @scrolltolower="loadMore">
  44. <view class="list-item" v-for="(item, index) in list"
  45. :style="{'--isReceivedColor':isReceivedColor[item.isReceived]}" :key="index" @click="handleTest(item)">
  46. <view class="main_box">
  47. <view class="text">
  48. 管线名称 :{{item.lineName}}
  49. </view>
  50. <view class="text">
  51. 管线单元名称 :{{item.lineUnitName}}
  52. </view>
  53. <view class="text">
  54. 任务状态:
  55. <span :style="{ color: isReceivedColor[item.isReceived] }">
  56. {{ isReceived[item.isReceived ]}}
  57. </span>
  58. </view>
  59. </view>
  60. </view>
  61. </scroll-list>
  62. </view>
  63. </template>
  64. <script>
  65. import Config from "@/common/Config.js";
  66. export default {
  67. data() {
  68. return {
  69. option: {
  70. size: 5,
  71. auto: true
  72. },
  73. propsData: {
  74. label: 'name',
  75. value: 'key',
  76. children: 'children',
  77. },
  78. popupData: {
  79. isReceived: "",
  80. },
  81. showpopup: false,
  82. isReceivedColor: {
  83. "0": "#d07946", // 灰色 - 未接收
  84. "1": "#4CAF50", // 绿色 - 已接收
  85. "2": "#9E9E9E", // 深灰色 - 已结束
  86. "3": "#F44336", // 红色 - 已拒绝
  87. "4": "#FFEB3B", // 黄色 - 已经下载航线文件
  88. "5": "#2196F3", // 蓝色 - 已上传文件
  89. "6": "#009688" // 深青色 - 已确认上传文件为最终巡检文件
  90. },
  91. columns: [{
  92. title: '状态',
  93. key: 'isReceived',
  94. project: [{
  95. label: '未接收',
  96. id: 0
  97. }, {
  98. label: '已接收',
  99. id: 1
  100. }, {
  101. label: '已结束',
  102. id: 2
  103. }, {
  104. label: '已拒绝',
  105. id: 3
  106. }, {
  107. label: '已下载文件',
  108. id: 4
  109. }, {
  110. label: '已上传文件',
  111. id: 5
  112. }, {
  113. label: '已确认文件',
  114. id: 6
  115. }]
  116. }],
  117. isReceived: {
  118. 0: '未接收',
  119. 1: '已接收',
  120. 2: '已结束',
  121. 3: '已拒绝',
  122. 4: '已经下载航线文件',
  123. 5: '已上传文件',
  124. 6: '已确认上传文件为最终巡检文件',
  125. },
  126. dataForm: {
  127. page: 1,
  128. limit: 10
  129. },
  130. list: []
  131. }
  132. },
  133. onShow() {
  134. this.list = []
  135. this.dataForm.limit = 10
  136. this.getList()
  137. },
  138. methods: {
  139. handleScroll(x) {
  140. this.scrollTop = x.scrollTop
  141. },
  142. loadMore() {
  143. // 在触底时,调用加载更多的 API 方法
  144. this.dataForm.limit += 10; // 页数加1
  145. this.getList(); // 获取更多数据
  146. },
  147. searchs(e) {
  148. this.checked = []
  149. this.dataList = []
  150. this.list = []
  151. this.dataForm.limit = 10
  152. this.getList()
  153. },
  154. surepopup() {
  155. this.showpopup = false
  156. this.list = []
  157. this.dataForm.limit = 10
  158. this.dataForm = {
  159. ...this.dataForm,
  160. ...this.popupData
  161. }
  162. this.getList()
  163. },
  164. repect() {
  165. for (let key in this.popupData) {
  166. this.popupData[key] = ''
  167. }
  168. },
  169. changetype(x, k) {
  170. this.popupData[x.key] = k.id
  171. },
  172. openshowpopup(e) {
  173. this.showpopup = true
  174. },
  175. handleTest(x) {
  176. uni.navigateTo({
  177. url: '/pages/index/taskDeatils?data=' + JSON.stringify(x)
  178. })
  179. },
  180. getList() {
  181. this.dataForm.handleUserIds = uni.getStorageSync('userInfo').id
  182. this.$api.to_http(`/task/zhkjwurenjitaskarrange/getUserTaskArrange`, this.dataForm, 'get').then((res) => {
  183. this.list.push(...res.data.data.list)
  184. this.$refs.list.loadSuccess({
  185. list: this.list,
  186. total: res.data.data.total
  187. });
  188. })
  189. },
  190. // 加载数据
  191. load(paging) {
  192. this.$api.to_http(`/task/zhkjwurenjitaskarrange/getUserTaskArrange`, this.dataForm, 'get').then((res) => {
  193. let list = [];
  194. for (var i = 0; i < res.data.data.list.length; i++) {
  195. list.push(res.data.data.list[i]);
  196. }
  197. this.list = [...this.list, ...list];
  198. // 加载成功 参数对象{list: 当前列表,total: 数据总长度(后端查询的total)}
  199. this.$refs.list.loadSuccess({
  200. list: this.list,
  201. total: res.data.data.total
  202. });
  203. // 加载失败
  204. // this.$refs.list.loadFail()
  205. })
  206. },
  207. // 刷新刷剧
  208. refresh(paging) {
  209. this.list = []
  210. this.dataForm.limit = 10
  211. this.$api.to_http(`/task/zhkjwurenjitaskarrange/getUserTaskArrange`, this.dataForm, 'get').then((res) => {
  212. let list = [];
  213. for (var i = 0; i < res.data.data.list.length; i++) {
  214. list.push(res.data.data.list[i]);
  215. }
  216. this.list = list;
  217. // 加载成功 参数对象{list: 当前列表,total: 数据总长度(后端查询的total)}
  218. this.$refs.list.refreshSuccess({
  219. list: this.list,
  220. total: res.data.data.total
  221. });
  222. // 加载失败
  223. // this.$refs.list.loadFail()
  224. })
  225. }
  226. }
  227. }
  228. </script>
  229. <style lang="less" scoped>
  230. .list-item {
  231. font-size: 30rpx;
  232. padding: 10rpx 20rpx;
  233. position: relative;
  234. .main_box {
  235. border-radius: 15rpx;
  236. // border: 1px solid #000;
  237. padding: 30rpx;
  238. background-color: #fff;
  239. .text {
  240. margin: 18rpx 0;
  241. }
  242. }
  243. }
  244. .popupmain {
  245. .popup_title {
  246. padding: 0.5rem 1rem;
  247. text-align: center;
  248. }
  249. .line {
  250. height: 0.4rem;
  251. background-color: #F3F4F6;
  252. }
  253. .project {
  254. padding: 0.6rem;
  255. height: 15rem;
  256. overflow: auto;
  257. .project_box {
  258. margin-bottom: 0.5rem;
  259. .main {
  260. margin-top: 0.5rem;
  261. display: grid;
  262. grid-template-columns: 1fr 1fr 1fr;
  263. // grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  264. grid-gap: 0.8rem;
  265. .btns_main {
  266. height: 40px;
  267. position: relative;
  268. align-items: center;
  269. justify-content: center;
  270. display: flex;
  271. flex-direction: row;
  272. box-sizing: border-box;
  273. flex-direction: row;
  274. padding: 0 12px;
  275. font-size: 14px;
  276. border-color: #ebedf0;
  277. border-width: 1px;
  278. border-style: solid;
  279. }
  280. .primary {
  281. background-color: #3c9cff;
  282. border-color: #3c9cff;
  283. color: #fff;
  284. }
  285. }
  286. }
  287. }
  288. .popup_btns {
  289. padding: 0.6rem;
  290. display: flex;
  291. margin-top: 1rem;
  292. border-top: 1px solid #f1f1f1;
  293. .u-button {
  294. width: 47%;
  295. }
  296. }
  297. }
  298. .list-item::after {
  299. display: block;
  300. content: '';
  301. width: 6rpx;
  302. height: 100rpx;
  303. background-color: var(--is-received-color);
  304. position: absolute;
  305. top: 30%;
  306. }
  307. </style>