index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='巡检记录'></cus-header>
  4. <div class="top" @tap="placeShow = true;">
  5. <div class="left">
  6. <image :src="imgBase+'inspection/record_location.png'"></image>
  7. <text>{{location}}</text>
  8. </div>
  9. <div class="right">
  10. <u-icon name="arrow-right" color="#FFFFFF" size="32"></u-icon>
  11. </div>
  12. </div>
  13. <div class="filtrate">
  14. <!-- <div class="pre" @tap="timeShow = true;">
  15. <text>巡检时间</text>
  16. <div style="transform: rotate(30deg);"><u-icon name="play-left-fill" color="#999999" size="24"></u-icon></div>
  17. </div> -->
  18. <div class="pre" @tap="typeShow = true">
  19. <text>{{xjType}}</text>
  20. <div style="transform: rotate(30deg);"><u-icon name="play-left-fill" color="#999999" size="24"></u-icon></div>
  21. </div>
  22. <div class="pre" @tap="userShow = true">
  23. <text>{{xjPerson}}</text>
  24. <div style="transform: rotate(30deg);"><u-icon name="play-left-fill" color="#999999" size="24"></u-icon></div>
  25. </div>
  26. </div>
  27. <div class="title">共有<span>{{total}}</span>条记录</div>
  28. <div class="boxs" v-if="list.length">
  29. <div class="box" v-for="(item,index) in list" :key="index">
  30. <div class="place">{{item.position||''}}</div>
  31. <div class="pre">巡检类型<span>{{xjObj[item.circuitType]||''}}</span></div>
  32. <div class="pre">巡检人员<span>{{item.circuitPerson.realName||''}}</span></div>
  33. <div class="pre">联系电话<span>{{item.circuitPerson.mobile||''}}</span></div>
  34. <div class="pre">巡检时间<span>{{item.circuitTime||''}}</span></div>
  35. </div>
  36. </div>
  37. <template v-else>
  38. <page-empty :height="'calc(100vh - 200px)'"></page-empty>
  39. </template>
  40. <u-picker :show="placeShow" :columns="placeColumns" keyName="orgName" @cancel="placeShow=false" @change="changeHandler" @confirm="placeConfirm" ref="uPicker"></u-picker>
  41. <!-- <u-picker :show="timeShow" :columns="timeColumns" title="巡检时间" @cancel="timeShow=false" @confirm="e=>paramsConfirm(e,'')"></u-picker> -->
  42. <u-picker :show="typeShow" :columns="typeColumns" title="巡检类型" keyName="label" @cancel="typeShow=false" @confirm="e=>paramsConfirm(e,'circuitType','xjType')"></u-picker>
  43. <u-picker :show="userShow" :columns="userColumns" title="巡检人员" keyName="label" @cancel="userShow=false" @confirm="e=>paramsConfirm(e,'circuitPersonId','xjPerson')"></u-picker>
  44. </view>
  45. </template>
  46. <script>
  47. import pageEmpty from '@/components/pageEmpty/index.vue'
  48. export default {
  49. components:{
  50. pageEmpty
  51. },
  52. data(){
  53. return {
  54. location:'',
  55. timeShow:false,
  56. timeColumns:[
  57. ['不限','2025-01-09','2025-01-08']
  58. ],
  59. placeShow:false,
  60. placeColumns:[],
  61. placeColumnData: [],
  62. xjType:'巡检类型',
  63. xjPerson:'巡检人员',
  64. typeShow:false,
  65. typeColumns:[
  66. [{value:'',label:'全部'}]
  67. ],
  68. userShow:false,
  69. userColumns:[
  70. [{value:'',label:'全部'}]
  71. ],
  72. isOver:false,
  73. params:{
  74. page:1,
  75. limit:10,
  76. buildingId:'',
  77. storeyId:'',
  78. circuitType:'',
  79. circuitPersonId:''
  80. },
  81. list:[],
  82. total:0,
  83. xjObj:{},
  84. }
  85. },
  86. onReachBottom() {
  87. if(this.isOver) return
  88. this.getList();
  89. },
  90. async onLoad() {
  91. await this.getXjTypeData();
  92. this.getUserList();
  93. this.getFloorInfo();
  94. this.getList();
  95. },
  96. methods:{
  97. async getXjTypeData(){
  98. let res = await this.$api.get('/sys/dict/data/getListByType/ReviewType');
  99. if(res.data.code===0){
  100. res.data.data.forEach(d=>{
  101. this.xjObj[d.dictValue] = d.dictLabel;
  102. this.typeColumns[0].push({value:d.dictValue,label:d.dictLabel})
  103. })
  104. }else this.$showToast(res.data.msg)
  105. },
  106. getUserList(){
  107. this.$api.get('/user/list',{page:1,limit:9999}).then(res=>{
  108. if(res.data.code===0){
  109. res.data.data.forEach(d=>{
  110. this.userColumns[0].push({value:d.id,label:d.realName})
  111. })
  112. }else this.$showToast(res.data.msg)
  113. })
  114. },
  115. getFloorInfo(){
  116. this.$api.get('/control/getOrgStructureTree/').then(res=>{
  117. if(res.data.code===0){
  118. this.location = res.data.data[0].orgName;
  119. this.placeColumns = [
  120. res.data.data[0].childrenList,
  121. res.data.data[0].childrenList[0].childrenList
  122. ]
  123. let allfloor = [];
  124. for (let i = 0; i < res.data.data[0].childrenList.length; i++) {
  125. allfloor.push(res.data.data[0].childrenList[i].childrenList)
  126. }
  127. this.placeColumnData = allfloor;
  128. }else this.$showToast(res.data.msg)
  129. })
  130. },
  131. getList(){
  132. this.$api.get('/circuitrecord/page',this.params).then(res=>{
  133. if(res.data.code===0){
  134. this.total = res.data.data.total;
  135. if(this.list.length<res.data.data.total){
  136. this.params.page++;
  137. this.list = [...this.list,...res.data.data.list];
  138. }else this.isOver = true
  139. }else this.$showModal(res.data.msg)
  140. });
  141. },
  142. changeHandler(e) {
  143. const {
  144. columnIndex,
  145. value,
  146. values, // values为当前变化列的数组内容
  147. index,
  148. // 微信小程序无法将picker实例传出来,只能通过ref操作
  149. picker = this.$refs.uPicker
  150. } = e
  151. // 当第一列值发生变化时,变化第二列(后一列)对应的选项
  152. if (columnIndex === 0) {
  153. // picker为选择器this实例,变化第二列对应的选项
  154. picker.setColumnValues(1, this.placeColumnData[index])
  155. }
  156. },
  157. placeConfirm(e){
  158. this.params.buildingId = e.value[0].orgId;
  159. this.params.storeyId = e.value[1].orgId;
  160. this.placeShow = false;
  161. this.init()
  162. },
  163. paramsConfirm(e,type,key){
  164. this.placeShow = this.timeShow= this.typeShow = this.userShow = false;
  165. this.params[type] = e.value[0].value;
  166. this[key] = e.value[0].label;
  167. this.init();
  168. },
  169. init(){
  170. this.params.page = 1;
  171. this.isOver = false;
  172. this.list = [];
  173. this.getList();
  174. }
  175. }
  176. }
  177. </script>
  178. <style scoped lang="less">
  179. .page{
  180. padding-bottom: 20rpx;
  181. background: #F4F8FB;
  182. box-sizing: border-box;
  183. .top{
  184. width: 100%;
  185. height: 102rpx;
  186. background: #198CFF;
  187. padding: 0 30rpx;
  188. box-sizing: border-box;
  189. display: flex;
  190. align-items: center;
  191. justify-content: space-between;
  192. .left{
  193. display: flex;
  194. align-items: center;
  195. image{
  196. width: 36rpx;
  197. height: 36rpx;
  198. }
  199. text{
  200. font-family: PingFangSC, PingFang SC;
  201. font-weight: 400;
  202. font-size: 30rpx;
  203. color: #FFFFFF;
  204. line-height: 42rpx;
  205. margin-left: 10rpx;
  206. }
  207. }
  208. }
  209. .filtrate{
  210. width: 100%;
  211. height: 90rpx;
  212. background: #FFFFFF;
  213. display: flex;
  214. .pre{
  215. width: calc(100% / 2);
  216. height: 100%;
  217. display: flex;
  218. align-items: center;
  219. justify-content: center;
  220. text{
  221. font-family: PingFangSC, PingFang SC;
  222. font-weight: 400;
  223. font-size: 28rpx;
  224. color: #4E5969;
  225. line-height: 40rpx;
  226. margin-right: 12rpx;
  227. }
  228. }
  229. }
  230. .title{
  231. font-family: PingFang-SC, PingFang-SC;
  232. font-weight: bold;
  233. font-size: 32rpx;
  234. color: #1D2129;
  235. line-height: 32rpx;
  236. margin-top: 36rpx;
  237. padding-left: 24rpx;
  238. span{
  239. color: #198CFF;
  240. margin: 0 10rpx;
  241. }
  242. }
  243. .boxs{
  244. width: 100%;
  245. padding: 0 24rpx;
  246. box-sizing: border-box;
  247. margin-top: 16rpx;
  248. overflow: hidden;
  249. .box{
  250. margin-top: 20rpx;
  251. background: #FFFFFF;
  252. border-radius: 16rpx;
  253. padding: 36rpx 24rpx;
  254. .place{
  255. font-family: PingFang-SC, PingFang-SC;
  256. font-weight: bold;
  257. font-size: 32rpx;
  258. color: #1D2129;
  259. line-height: 36rpx;
  260. white-space: nowrap;
  261. overflow: hidden;
  262. text-overflow: ellipsis;
  263. }
  264. .pre{
  265. font-family: PingFangSC, PingFang SC;
  266. font-weight: 400;
  267. font-size: 24rpx;
  268. color: #86909C;
  269. line-height: 24rpx;
  270. margin-top: 26rpx;
  271. span{
  272. font-family: PingFangSC, PingFang SC;
  273. font-weight: 400;
  274. font-size: 26rpx;
  275. color: #1D2129;
  276. line-height: 26rpx;
  277. margin-left: 20rpx;
  278. }
  279. }
  280. }
  281. }
  282. }
  283. </style>