Immediateinspection.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <view class="">
  3. <view class="" style="width: 750rpx;height: 50rpx;">
  4. </view>
  5. <view class="topname">
  6. <view class="topname1" @click="goback">
  7. <u-icon name="arrow-left" color="#000000" size="36"></u-icon>
  8. </view>
  9. <view class="topname2">
  10. 巡检打卡
  11. </view>
  12. </view>
  13. <view class="getuserInfo">
  14. <view class="getuserInfoimg">
  15. <u--image :src="src" width="120rpx" height="120rpx"></u--image>
  16. </view>
  17. <view class="getuserInfoname">
  18. <h3>{{getuserInfo.realName}}</h3>
  19. <view>安保组</view>
  20. </view>
  21. <view class="getuserInfophone">
  22. <view class="getuserInfophone1">
  23. <u-icon name="phone" color="#2979ff" size="36"></u-icon>
  24. </view>
  25. <view class="getuserInfophone2">{{getuserInfo.mobile}}</view>
  26. </view>
  27. </view>
  28. <!--打卡-->
  29. <view class="Punchin">
  30. <view class="dakaweizhi">
  31. <view class="dakaweizhi1">
  32. <u-icon name="map" color="#6DD400" size="36"></u-icon>
  33. </view>
  34. <view class="dakaweizhi2">当前打卡位置:{{Punchposition}}</view>
  35. </view>
  36. <view class="shexiangji" @click="Punchindata">
  37. <view class="shexiangji1">扫码打卡</view>
  38. <view class="shexiangji2">
  39. <u-icon name="camera" color="#ffffff" size="90"></u-icon>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="dakajilv">今日打卡记录</view>
  44. <view class="u-listdata">
  45. <view style="padding:10rpx 0 0 30rpx">
  46. 共有 <span style="color: red">{{totalnumber}}</span>条记录
  47. </view>
  48. <u-list @scrolltolower="scrolltolower" :pagingEnabled='true'>
  49. <u-list-item v-for="(item, index) in indexList" :key="index">
  50. <view class="companylist">
  51. <h3>{{item.position}}</h3>
  52. <view class="Currentamount">
  53. 巡检时间:{{item.circuitTime}}
  54. </view>
  55. </view>
  56. </u-list-item>
  57. </u-list>
  58. </view>
  59. <u-notify ref="uNotify" message=""></u-notify>
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. getCurrentTime
  65. } from "@/utils/index";
  66. export default {
  67. data() {
  68. return {
  69. Punchposition: '',
  70. getuserInfo: {},
  71. pd: true,
  72. totalnumber: 0,
  73. indexList: [],
  74. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  75. dataForm: {
  76. page: 1,
  77. limit: 99999,
  78. circuitType: "",
  79. startDate: "",
  80. endDate: "",
  81. buildingId: "",
  82. storeyId: "",
  83. circuitPersonId: "",
  84. },
  85. }
  86. },
  87. //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
  88. onLoad() {
  89. this.getuserInfo = uni.getStorageSync('getuserInfo');
  90. //console.log('111111111111111111', this.getuserInfo)
  91. var date = new Date();
  92. var year = date.getFullYear();
  93. var month = date.getMonth() + 1;
  94. var day = date.getDate();
  95. // this.circuitPosition = this.$route.query.circuitPosition;
  96. this.dataForm.startDate = `${year}-${month}-${day}` + " 00:00:00";
  97. this.dataForm.endDate = `${year}-${month}-${day}` + " 23:59:59";
  98. this.dataForm.circuitPersonId = this.getuserInfo.id;
  99. // this.dataForm.circuitType = this.userInfo.circuitType;
  100. // console.log('111111111111111111',this.dataForm)
  101. this.getDataList();
  102. },
  103. //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
  104. onReady() {},
  105. //监听页面隐藏
  106. onHide() {},
  107. //监听窗口尺寸变化
  108. onResize() {},
  109. //监听页面卸载
  110. onUnload() {},
  111. //监听用户下拉动作,一般用于下拉刷新
  112. onPullDownRefresh() {},
  113. methods: {
  114. goback() {
  115. uni.navigateTo({
  116. url: '/pages/index/index'
  117. })
  118. },
  119. Punchindata() {
  120. uni.scanCode({
  121. //是否只能从相机扫码,不能从相册扫码
  122. onlyFromCamera: false,
  123. //规定扫码类型 字节跳动小程序不支持此参数
  124. // barcode就是一维码(条形码) qrcode就是(er)维码
  125. // datamatrix就是Data Matrix码 pdf417就是PDF417条码
  126. scanType: ['barCode', 'qrCode', ],
  127. // 是否启动自动识别字符编码功能
  128. autoDecodeCharset: false,
  129. // 是否开启自动放大功能 仅 App-Android (3.5.4+) 支持
  130. autoZoom: false,
  131. // 是否支持手动输入条形码 仅飞书小程序(V3.14.0)支持
  132. barCodeInput: false,
  133. success: (res) => {
  134. // console.log('000000000000000000',res.result)
  135. let lsdata =res.result;
  136. // console.log('111111111111111111', lsdata.substr(lsdata.indexOf('position')+11,lsdata.indexOf('projectId')-(lsdata.indexOf('position')+14)))
  137. if(lsdata.indexOf('houseId')=='-1'){
  138. console.log('888',)
  139. //没有房间号
  140. this.Punchposition = lsdata.substr(lsdata.indexOf('position')+11,lsdata.indexOf('projectId')-(lsdata.indexOf('position')+14));
  141. let postdata = {
  142. "buildingId":lsdata.substr(lsdata.indexOf('buildingId')+12,19), //楼宇id
  143. "storeyId":lsdata.substr(lsdata.indexOf('storeyId')+10,19), //楼层id
  144. "houseId":'', //房间id
  145. "position": this.Punchposition, //位置信息
  146. "circuitPersonId": this.getuserInfo.id, //巡检人员id
  147. "circuitTime": getCurrentTime(), //巡检时间
  148. // "circuitType": this.getuserInfo.circuitType,//巡检类型
  149. "circuitType": '', //巡检类型
  150. "remark": lsdata.substr(lsdata.indexOf('remark')+8,lsdata.indexOf('buildingId')-(lsdata.indexOf('remark')+10)), //备注
  151. }
  152. this.$api.post('/circuitrecord', postdata)
  153. .then(res => {
  154. // console.log('99999', res)
  155. if (res.data.code == 0) {
  156. this.$refs.uNotify.success('打卡成功')
  157. this.getDataListtwo();
  158. } else {
  159. this.$refs.uNotify.error('打卡失败')
  160. }
  161. })
  162. }else{
  163. console.log('999',)
  164. this.Punchposition = lsdata.substr(lsdata.indexOf('position')+11,lsdata.indexOf('projectId')-(lsdata.indexOf('position')+14));
  165. let postdata = {
  166. "buildingId":lsdata.substr(lsdata.indexOf('buildingId')+12,19), //楼宇id
  167. "storeyId":lsdata.substr(lsdata.indexOf('storeyId')+10,19), //楼层id
  168. "houseId":lsdata.substr(lsdata.indexOf('houseId')+9,19), //房间id
  169. "position": this.Punchposition, //位置信息
  170. "circuitPersonId": this.getuserInfo.id, //巡检人员id
  171. "circuitTime": getCurrentTime(), //巡检时间
  172. // "circuitType": this.getuserInfo.circuitType,//巡检类型
  173. "circuitType": '', //巡检类型
  174. "remark": lsdata.substr(lsdata.indexOf('remark')+8,lsdata.indexOf('buildingId')-(lsdata.indexOf('remark')+10)), //备注
  175. }
  176. this.$api.post('/circuitrecord', postdata)
  177. .then(res => {
  178. // console.log('99999', res)
  179. if (res.data.code == 0) {
  180. this.$refs.uNotify.success('打卡成功')
  181. this.getDataListtwo();
  182. } else {
  183. this.$refs.uNotify.error('打卡失败')
  184. }
  185. })
  186. }
  187. },
  188. fail: (error) => {
  189. this.$refs.uNotify.error(error)
  190. }
  191. })
  192. },
  193. getDataListtwo() {
  194. this.dataForm.page = 1;
  195. this.$api.get('/circuitrecord/page', this.dataForm)
  196. .then(res => {
  197. //console.log('111111111111111111',res.data.data)
  198. this.totalnumber = res.data.data.total;
  199. this.indexList = res.data.data.list;
  200. })
  201. },
  202. scrolltolower() {
  203. if (this.pd) {
  204. this.getalldata();
  205. } else {
  206. return
  207. }
  208. },
  209. getDataList() {
  210. this.$api.get('/circuitrecord/page', this.dataForm)
  211. .then(res => {
  212. //console.log('111111111111111111',res.data.data)
  213. this.totalnumber = res.data.data.total;
  214. if (res.data.data.list.length != 0) {
  215. this.indexList.push(...res.data.data.list);
  216. this.dataForm.page = this.dataForm.page + 1;
  217. this.pd = true;
  218. } else {
  219. uni.showToast({
  220. title: '暂无更多数据了',
  221. icon: 'none',
  222. duration: 1500
  223. })
  224. this.pd = false;
  225. }
  226. })
  227. },
  228. }
  229. }
  230. </script>
  231. <style lang="scss">
  232. .dakajilv {
  233. color: #666;
  234. font-size: 32rpx;
  235. padding-left: 30rpx;
  236. }
  237. .Currentamount {
  238. padding-left: 30rpx;
  239. height: 50rpx;
  240. line-height: 50rpx;
  241. color: #BCB3A7;
  242. span {
  243. color: #FA5555;
  244. padding-left: 9rpx;
  245. }
  246. }
  247. .topname {
  248. height: 44px;
  249. width: 750rpx;
  250. display: flex;
  251. align-items: center;
  252. }
  253. .topname1 {
  254. width: 50rpx;
  255. padding-left: 10rpx;
  256. }
  257. .topname2 {
  258. width: 700rpx;
  259. text-align: center;
  260. font-weight: bold;
  261. }
  262. .Callfee {
  263. width: 100rpx;
  264. height: 45rpx;
  265. text-align: center;
  266. line-height: 45rpx;
  267. color: #5C8FFF;
  268. border: 1px solid #5C8FFF;
  269. font-size: 22rpx;
  270. position: absolute;
  271. bottom: 10rpx;
  272. right: 10px;
  273. font-weight: bold;
  274. }
  275. .companylist {
  276. margin: 20rpx 30rpx;
  277. background: #fff;
  278. height: 140rpx;
  279. border-radius: 10px;
  280. position: relative;
  281. h3 {
  282. height: 70rpx;
  283. line-height: 70rpx;
  284. padding-left: 30rpx;
  285. }
  286. }
  287. .settled {
  288. background-color: #09C700;
  289. width: 100rpx;
  290. height: 40rpx;
  291. text-align: center;
  292. line-height: 40rpx;
  293. color: #fff;
  294. font-size: 14rpx;
  295. position: absolute;
  296. top: 0px;
  297. right: 0px;
  298. border-top-right-radius: 10rpx;
  299. border-bottom-left-radius: 10rpx;
  300. }
  301. .outstanding {
  302. background-color: #30D3A2;
  303. width: 100rpx;
  304. height: 40rpx;
  305. text-align: center;
  306. line-height: 40rpx;
  307. color: #fff;
  308. font-size: 14rpx;
  309. position: absolute;
  310. top: 0px;
  311. right: 0px;
  312. border-top-right-radius: 10rpx;
  313. border-bottom-left-radius: 10rpx;
  314. }
  315. .billall {}
  316. .topbill {
  317. display: flex;
  318. justify-content: center;
  319. align-items: center;
  320. height: 100rpx;
  321. background-color: #e6e6e6;
  322. }
  323. .topbilledit {
  324. display: flex;
  325. justify-content: space-around;
  326. align-items: center;
  327. }
  328. .changetime1 {
  329. padding-right: 10rpx;
  330. }
  331. .shexiangji1 {
  332. color: #fff;
  333. font-size: 36rpx;
  334. font-weight: bold;
  335. }
  336. .shexiangji {
  337. width: 300rpx;
  338. height: 300rpx;
  339. border-radius: 50%;
  340. background: #5C8FFF;
  341. margin: 0 auto;
  342. display: flex;
  343. justify-content: center;
  344. flex-direction: column;
  345. align-items: center;
  346. }
  347. .dakaweizhi2 {
  348. color: #999;
  349. font-size: 26rpx;
  350. }
  351. .dakaweizhi {
  352. display: flex;
  353. align-items: center;
  354. justify-content: center;
  355. width: 690rpx;
  356. height: 300rpx;
  357. }
  358. .Punchin {
  359. width: 690rpx;
  360. margin: 30rpx auto;
  361. background: #fff;
  362. height: 690rpx;
  363. }
  364. .getuserInfo {
  365. display: flex;
  366. align-items: center;
  367. width: 690rpx;
  368. margin: 0 auto;
  369. background: #fff;
  370. height: 160rpx;
  371. border-radius: 10rpx;
  372. }
  373. .getuserInfoimg {
  374. margin-left: 20rpx;
  375. margin-right: 30rpx;
  376. }
  377. .getuserInfoname {
  378. height: 120rpx;
  379. display: flex;
  380. flex-direction: column;
  381. justify-content: space-between;
  382. margin-right: 20rpx;
  383. h3 {
  384. color: #333;
  385. font-size: 32rpx;
  386. }
  387. view {
  388. color: #999;
  389. font-size: 24rpx;
  390. }
  391. }
  392. .getuserInfophone {
  393. height: 120rpx;
  394. display: flex;
  395. align-items: flex-start;
  396. }
  397. .getuserInfophone2 {
  398. color: #666;
  399. font-size: 28rpx;
  400. }
  401. </style>