Immediateinspection.vue 10 KB

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