list.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. <template>
  2. <view class="list_s">
  3. <view class="header_s">
  4. <u-popup v-model="show" mode="top">
  5. <view class="popup">
  6. <view style="margin-top: 120rpx;">
  7. <view>
  8. <view class="font-fifty-six SourceHanSansCN choose" @click="openHouse('xiaoqu')">
  9. {{house ? house :'选择小区'}}
  10. <u-popup v-model="pop" mode="top" height="1000rpx">
  11. <view style="margin: 20rpx;">
  12. <u-search placeholder="请输入搜索内容" v-model="keyword" :action-style="{'font-size':'40rpx'}" @custom="searchinfo(selectType)"></u-search>
  13. </view>
  14. <view>
  15. <scroll-view scroll-y="true" style="height: 600rpx; text-align: center;">
  16. <view v-for="(item,index) in chooseHouseList" :key="item.value" >
  17. <view :class="current === index ? 'active' : '' " style="color: #000000;" @click="active(item,index)">
  18. {{item.label}}
  19. </view>
  20. </view>
  21. </scroll-view>
  22. <view class="">
  23. <button type="default" class="font-fifty-six" @click="search(selectType)">确定</button>
  24. </view>
  25. <view class="">
  26. <button type="default" @click="pop = false;" class="font-fifty-six">取消</button>
  27. </view>
  28. </view>
  29. </u-popup>
  30. </view>
  31. </view>
  32. <view>
  33. <view class="font-fifty-six SourceHanSansCN choose" @click="openHouse('louyu')">
  34. {{bulid ? bulid : '选择楼宇'}}
  35. </view>
  36. </view>
  37. <view>
  38. <view class="font-fifty-six SourceHanSansCN choose" @click="openHouse('danyuan')">
  39. {{unit ? unit : '选择单元'}}
  40. </view>
  41. </view>
  42. <view>
  43. <view class="font-fifty-six SourceHanSansCN choose" @click="openHouse('menpai')">
  44. {{houseNumber ? houseNumber : '选择门牌'}}
  45. </view>
  46. </view>
  47. <view>
  48. <!-- <view class="font-fifty-six SourceHanSansCN choose" @click="openType('shows')">
  49. 上门类型 <text class="font-fifty-six SourceHanSansCN" style="color: #232146;">
  50. {{type ? '----' + type : ''}}</text>
  51. <u-select v-model="shows" :list="mounicipalList" @confirm="confirm"></u-select>
  52. </view> -->
  53. <view>
  54. <view class="font-fifty-six SourceHanSansCN choose" @click="showStart = true">
  55. {{form.starTime ? form.starTime : '开始时间'}}
  56. <u-picker v-model="showStart" mode="time" @confirm="confirmStart"></u-picker>
  57. </view>
  58. </view>
  59. <view>
  60. <view class="font-fifty-six SourceHanSansCN choose" @click="showEnd = true">
  61. {{form.endTime ? form.endTime : '结束时间'}}
  62. <u-picker v-model="showEnd" mode="time" @confirm="confirmEnd"></u-picker>
  63. </view>
  64. </view>
  65. <view style="display: flex;">
  66. <view style="height: 100rpx; font-size: 64rpx; width: 180rpx; font-weight: 600;">工号</view>
  67. <u-input
  68. style="font-size: 64rpx!important; font-weight: 600; width: 400rpx!important;"
  69. placeholder="请输入工号"
  70. placeholder-style="font-size: 64rpx;"
  71. v-model="form.jobNum"
  72. maxlength = '4'
  73. :type='numberType'
  74. :border="border" />
  75. </view>
  76. <view class="font-fifty-six SourceHanSansCN total background-color1" @click="submit()">
  77. 提交数据
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </u-popup>
  83. <view style="display: flex;">
  84. <view class="btn_s" @click="show = true">查询</view>
  85. <view class="btn_s" @click="kong">重置</view>
  86. </view>
  87. </view>
  88. <view class="footer_s" v-if="list.length > 0">
  89. <view class="footer-item" v-for="(item, index) in list">
  90. <view class="item-title">地址: {{item.house}}</view>
  91. <view class="item-title">职工: {{item.userName}}</view>
  92. <view class="item-title">时间: {{item.time}}</view>
  93. <view class="item-title">备注:
  94. <text class="" v-if="item.remark != null">
  95. {{item.remark}}
  96. </text>
  97. <text class="" v-else>
  98. </text>
  99. </view>
  100. <view class="item-img">
  101. <view class="img-view" v-for="img in item.picUrl">
  102. <image :src="img" mode="" @tap="preAvatar(img)" v-if="img.substring(img.length - 3) == 'png' || img.substring(img.length - 3) == 'jpg' "></image>
  103. <video :src="img" controls v-else ></video>
  104. </view>
  105. <!-- <image v-for="img in item.picUrl" :src="img" @tap="preAvatar(img)"></image> -->
  106. </view>
  107. <view class="main-list-icon"></view>
  108. </view>
  109. </view>
  110. <view class="footer_s" style="padding-top: 100rpx;" v-else>
  111. <u-empty text="暂无数据" mode="list"></u-empty>
  112. </view>
  113. </view>
  114. </template>
  115. <script>
  116. import service from '@/api/index.js'
  117. export default {
  118. data() {
  119. return {
  120. id: 0,
  121. numberType: 'number',
  122. name: '',
  123. address: '',
  124. keyword:'',
  125. selectType:'',
  126. pop: false,
  127. show: false,
  128. border: false,
  129. typeValue: '',
  130. current:-1,
  131. labelPosition: 'left',
  132. errorType: ['message'],
  133. list: [],
  134. chooseHouseList: [],
  135. typeList: [],
  136. showStart: false,
  137. showEnd: false,
  138. form: {
  139. starTime: '',
  140. endTime: '',
  141. jobNum: '',
  142. },
  143. params: {
  144. pageNum: 1,
  145. pageSize: 10,
  146. },
  147. listTypeShow: false,
  148. tubeTypeShow: false,
  149. tubeLongShow: false,
  150. house: '选择小区',
  151. bulid: '选择楼宇',
  152. unit: '选择单元',
  153. houseNumber: '选择门牌',
  154. shows: false,
  155. // mounicipalList: [],
  156. tubeTypeLongList: [],
  157. tubeTypeList: [],
  158. houseid:'',
  159. type: '',
  160. buildid:'',
  161. unitid:'',
  162. numberid:'',
  163. }
  164. },
  165. onLoad(e) {
  166. this.id = e.id;
  167. this.name = e.name;
  168. this.address = e.address
  169. this.getListFn();
  170. this.getArea();
  171. // this.select();
  172. this.getProjectType();
  173. this.getTubeType();
  174. this.getTubeLong();
  175. },
  176. onReachBottom() {
  177. this.getNextListFn()
  178. },
  179. onPullDownRefresh() {
  180. this.getListFn();
  181. setTimeout(function () {
  182. uni.stopPullDownRefresh();
  183. }, 1000);
  184. },
  185. methods:{
  186. kong(){
  187. this.houseid = '';
  188. this.buildid = '';
  189. this.unitid = '';
  190. this.numberid = '';
  191. this.form.starTime = '';
  192. this.form.endTime = '';
  193. this.form.jobNum = '';
  194. this.getListFn();
  195. },
  196. confirmStart(e){
  197. console.log(e)
  198. this.form.starTime = `${e.year}-${e.month}-${e.day}`
  199. },
  200. confirmEnd(e){
  201. console.log(e)
  202. this.form.endTime = `${e.year}-${e.month}-${e.day}`
  203. },
  204. openUnit() {
  205. this.unitShow = !this.unitShow
  206. },
  207. //选择门牌
  208. open() {
  209. this.houseNumberShow = !this.houseNumberShow
  210. },
  211. //选择上门类型
  212. confirm(e) {
  213. this.type = e[0].label
  214. this.typeValue = e[0].value
  215. this.imgArr = [];
  216. this.tubeType = null;
  217. this.tubeLong = null;
  218. this.valueType = null;
  219. },
  220. //选择类型
  221. // select() {
  222. // service.getDic({
  223. // dicType: 'service_type'
  224. // }).then(res => {
  225. // res.forEach(item => {
  226. // this.mounicipalList.push({
  227. // value: item.value,
  228. // label: item.name
  229. // })
  230. // })
  231. // })
  232. // },
  233. openType(type) {
  234. if (type === 'shows') {
  235. this.shows = !this.shows
  236. } else if (type === 'tubeType') {
  237. this.tubeTypeShow = !this.tubeTypeShow
  238. } else {
  239. this.tubeLongShow = !this.tubeLongShow
  240. }
  241. },
  242. tubeTypeConfirm(e) {
  243. this.tubeType = e[0].label
  244. },
  245. listType(e) {
  246. this.valueType = e[0].label
  247. },
  248. tubeLongConfirm(e) {
  249. this.tubeLong = e[0].label
  250. },
  251. getTubeType() {
  252. service.getPipeType().then(res => {
  253. res.forEach(item => {
  254. this.tubeTypeList.push({
  255. value: item.id,
  256. label: item.pipeType
  257. })
  258. })
  259. })
  260. },
  261. getTubeLong() {
  262. service.getPipeLength().then(res => {
  263. res.forEach(item => {
  264. this.tubeTypeLongList.push({
  265. value: item.id,
  266. label: item.pipeLength
  267. })
  268. })
  269. })
  270. },
  271. getProjectType() {
  272. service.getProject().then(res => {
  273. console.log('getProjectType', res)
  274. this.typeList = [];
  275. res.forEach(item => {
  276. this.typeList.push({
  277. value: item.id,
  278. label: item.valveType
  279. })
  280. })
  281. })
  282. },
  283. projectType() {
  284. this.listTypeShow = !this.listTypeShow
  285. },
  286. search(selectType){
  287. console.log('this.housename', this.housename)
  288. console.log('this.selectType', this.selectType)
  289. if(selectType == 'xiaoqu'){
  290. this.house = this.housename;
  291. service.getBuilding({areaId: this.houseid}).then(res => {
  292. this.chooseHouseList = [];
  293. res.forEach(item => {
  294. this.chooseHouseList.push({
  295. value: item.id,
  296. label: item.name,
  297. selectType:'louyu'
  298. })
  299. })
  300. })
  301. this.current = -1;
  302. this.bulid = null;
  303. this.unit = null;
  304. this.houseNumber = null;
  305. }else if(selectType == 'louyu'){
  306. this.bulid = this.housename;
  307. service.getUnit({buildingId: this.buildid}).then(res => {
  308. this.chooseHouseList = [];
  309. res.forEach(item => {
  310. this.chooseHouseList.push({
  311. value: item.id,
  312. label: item.name,
  313. selectType:'danyuan'
  314. })
  315. })
  316. })
  317. this.unit = null;
  318. this.houseNumber = null;
  319. this.current = -1;
  320. }else if(selectType == 'danyuan'){
  321. this.unit = this.housename;
  322. service.getAllHouse({unitId: this.unitid}).then(res => {
  323. this.chooseHouseList = [];
  324. res.forEach(item => {
  325. this.chooseHouseList.push({
  326. value: item.id,
  327. label: item.name,
  328. selectType:'menpai'
  329. })
  330. })
  331. })
  332. this.houseNumber = null;
  333. this.current = -1;
  334. }else if(selectType == 'menpai'){
  335. this.houseNumber = this.housename;
  336. this.housedata = this.numberid;
  337. this.current = -1;
  338. }
  339. this.pop = false;
  340. },
  341. openHouse(selectType) {
  342. if(selectType === 'xiaoqu'){
  343. //选择小区
  344. this.selectType = 'xiaoqu';
  345. this.getArea();
  346. }else if(selectType === 'louyu'){
  347. //选择楼宇
  348. this.selectType = 'louyu'
  349. service.getBuilding({areaId: this.houseid}).then(res => {
  350. this.chooseHouseList = [];
  351. res.forEach(item => {
  352. this.chooseHouseList.push({
  353. value: item.id,
  354. label: item.name,
  355. selectType:'louyu'
  356. })
  357. })
  358. })
  359. }else if(selectType === 'danyuan'){
  360. //选择单元
  361. this.selectType = 'danyuan'
  362. service.getUnit({buildingId: this.buildid}).then(res => {
  363. this.chooseHouseList = [];
  364. res.forEach(item => {
  365. this.chooseHouseList.push({
  366. value: item.id,
  367. label: item.name,
  368. selectType:'danyuan'
  369. })
  370. })
  371. })
  372. }else if(selectType === 'menpai'){
  373. //选择门牌
  374. this.selectType = 'menpai'
  375. service.getAllHouse({unitId: this.unitid}).then(res => {
  376. this.chooseHouseList = [];
  377. res.forEach(item => {
  378. this.chooseHouseList.push({
  379. value: item.id,
  380. label: item.name,
  381. selectType:'menpai'
  382. })
  383. })
  384. })
  385. }
  386. this.pop = !this.pop;
  387. },
  388. searchinfo(selectType){
  389. if(selectType == 'xiaoqu'){
  390. console.log('ssss',this.selectType)
  391. service.getArea({name:this.keyword}).then(res => {
  392. this.chooseHouseList = [];
  393. res.forEach((item, index) => {
  394. this.chooseHouseList.push({
  395. value: item.id,
  396. label: item.name,
  397. selectType:'xiaoqu'
  398. })
  399. })
  400. })
  401. this.keyword = '';
  402. }else if(selectType == 'louyu'){
  403. console.log('ssss',this.selectType)
  404. service.getBuilding({areaId: this.houseid,name:this.keyword}).then(res => {
  405. this.chooseHouseList = [];
  406. res.forEach((item, index) => {
  407. this.chooseHouseList.push({
  408. value: item.id,
  409. label: item.name,
  410. selectType:'louyu'
  411. })
  412. })
  413. })
  414. this.keyword = '';
  415. }else if(selectType == 'danyuan'){
  416. console.log('ssss',this.selectType)
  417. service.getUnit({buildingId: this.buildid,name:this.keyword}).then(res => {
  418. this.chooseHouseList = [];
  419. res.forEach((item, index) => {
  420. this.chooseHouseList.push({
  421. value: item.id,
  422. label: item.name,
  423. selectType:'danyuan'
  424. })
  425. })
  426. })
  427. this.keyword = '';
  428. }else if(selectType == 'menpai'){
  429. console.log('ssss',this.selectType)
  430. service.getAllHouse({unitId: this.unitid,name:this.keyword}).then(res => {
  431. this.chooseHouseList = [];
  432. res.forEach((item, index) => {
  433. this.chooseHouseList.push({
  434. value: item.id,
  435. label: item.name,
  436. selectType:'menpai'
  437. })
  438. })
  439. })
  440. this.keyword = '';
  441. }
  442. },
  443. active(item,index){
  444. this.current = index;
  445. this.housename = item.label;
  446. if(item.selectType == 'xiaoqu'){
  447. this.houseid = item.value;
  448. }else if(item.selectType == 'louyu'){
  449. this.buildid = item.value;
  450. }else if(item.selectType == 'danyuan'){
  451. this.unitid = item.value;
  452. }else if(item.selectType == 'menpai'){
  453. this.numberid = item.value
  454. }
  455. this.selectType = item.selectType;
  456. },
  457. //获取小区
  458. getArea() {
  459. service.getArea().then(res => {
  460. this.chooseHouseList = [];
  461. res.forEach((item, index) => {
  462. this.chooseHouseList.push({
  463. value: item.id,
  464. label: item.name,
  465. selectType:'xiaoqu'
  466. })
  467. })
  468. })
  469. },
  470. getListFn(){
  471. let that = this;
  472. let params ={
  473. areaId: this.houseid,
  474. buildingId: this.buildid,
  475. unitId: this.unitid,
  476. houseId: this.numberid,
  477. starTime: this.form.starTime,
  478. endTime: this.form.endTime,
  479. jobNum: this.form.jobNum,
  480. pageSize: 10,
  481. pageNum: 1,
  482. serviceType: this.id
  483. }
  484. console.log('params', params)
  485. service.getOtherList(params).then(res =>{
  486. console.log("999", res)
  487. that.list = res.records;
  488. that.total = res.total || 0;
  489. that.params.pageNum = res.current + 1;
  490. })
  491. },
  492. getNextListFn(){
  493. let that = this;
  494. let params={
  495. areaId: this.houseid,
  496. buildingId: this.buildid,
  497. unitId: this.unitid,
  498. houseId: this.numberid,
  499. starTime: this.form.starTime,
  500. endTime: this.form.endTime,
  501. jobNum: this.form.jobNum,
  502. pageSize: this.params.pageSize,
  503. pageNum: this.params.pageNum,
  504. serviceType: this.id
  505. }
  506. if (this.list.length < this.total) {
  507. service.getOtherList(params).then(response => {
  508. that.params.pageNum = response.current + 1
  509. response.records.forEach(item =>{
  510. that.list.push(item)
  511. })
  512. })
  513. }
  514. },
  515. // 预览图片
  516. preAvatar(url) {
  517. console.log('url', url)
  518. wx.previewImage({
  519. current: url, // 当前显示图片的 http 链接
  520. urls: [url] ,// 需要预览的图片 http 链接列表
  521. })
  522. },
  523. submit() {
  524. console.log('submit',this.houseid,this.buildid,this.unitid,this.numberid);
  525. this.show = false;
  526. this.getListFn()
  527. }
  528. }
  529. }
  530. </script>
  531. <style lang="scss" scoped>
  532. /deep/ .u-input__input{
  533. font-size: 64rpx!important;
  534. color: #303133;
  535. width: calc(100% - 200rpx)!important;
  536. }
  537. /deep/ .u-column-item{
  538. display: flex;
  539. flex-direction: row;
  540. align-items: center;
  541. justify-content: center;
  542. font-size: 64rpx!important;
  543. color: #303133;
  544. padding: 8rpx;
  545. }
  546. /deep/ .u-btn-picker.data-v-70102400 {
  547. padding: 16rpx;
  548. box-sizing: border-box;
  549. text-align: center;
  550. text-decoration: none;
  551. font-size: 64rpx!important;
  552. }
  553. .list_s{
  554. min-height: 100vh;
  555. background-color: #F9F9F9;
  556. }
  557. .header_s{
  558. padding: 30rpx 30rpx 0rpx 30rpx;
  559. .popup{
  560. padding: 0rpx 30rpx;
  561. }
  562. .btn_s{
  563. margin: 0 15rpx;
  564. width: calc(50% - 15px);
  565. height: 100rpx;
  566. line-height: 100rpx;
  567. text-align: center;
  568. background-color: #3857F3;
  569. color: #fff;
  570. font-size: 64rpx;
  571. border-radius: 16rpx;
  572. }
  573. }
  574. .footer_s{
  575. padding: 30rpx;
  576. .footer-item{
  577. background: #FFFFFF;
  578. height: auto;
  579. border-radius: 8rpx;
  580. margin-bottom: 30rpx;
  581. padding: 20rpx 0rpx 20rpx 66rpx;
  582. position: relative;
  583. .item-title{
  584. font-size: 48rpx;
  585. font-family: PingFangSC-Medium, PingFang SC;
  586. font-weight: 500;
  587. color: #333333;
  588. padding-bottom: 20rpx;
  589. }
  590. .main-list-icon{
  591. position: absolute;
  592. top: 43rpx;
  593. left: 30rpx;
  594. width: 16rpx;
  595. height: 16rpx;
  596. background: #3857F3;
  597. border-radius: 2rpx;
  598. }
  599. .item-img{
  600. display: flex;
  601. justify-content: flex-start;
  602. flex-wrap: wrap;
  603. .img-view{
  604. width: calc(50% - 20rpx);
  605. height: 200rpx;
  606. padding-bottom: 20rpx;
  607. padding-right: 20rpx;
  608. image{
  609. width: 100%;
  610. height: 100%;
  611. }
  612. video{
  613. width: 100%;
  614. height: 100%;
  615. }
  616. }
  617. }
  618. }
  619. }
  620. .choose {
  621. text-align: center;
  622. padding: 20rpx;
  623. margin: 30rpx;
  624. color: #FFFFFF;
  625. background: #43CEB1;
  626. border-radius: 64rpx;
  627. }
  628. .active{
  629. background-color: #1890FF;
  630. }
  631. .select-type {
  632. border: 2rpx solid #3857F3;
  633. text-align: center;
  634. padding: 20rpx;
  635. margin: 30rpx;
  636. color: #3857F3;
  637. border-radius: 64rpx;
  638. }
  639. .total {
  640. width: 100%;
  641. padding: 40rpx 30rpx;
  642. text-align: center;
  643. color: #FFFFFF;
  644. }
  645. </style>