Inspectionrecord.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="page">
  3. <view class="billall">
  4. <u-cell-group class="toptemplate">
  5. <u-cell :title="mytitle" @click="floorchange">
  6. <u-icon slot="icon" size="40" color="#fff" name="map"></u-icon>
  7. <u-icon slot="right-icon" size="40" color="#fff" name="search"></u-icon>
  8. </u-cell>
  9. </u-cell-group>
  10. <view class="topbill">
  11. <view class="topbilledit" @click="xunjianchange">
  12. <view class="changetime1">
  13. {{xjlx}}
  14. </view>
  15. <view class="changetime2">
  16. <u-icon name="arrow-down-fill" color="#999" size="20"></u-icon>
  17. </view>
  18. </view>
  19. <view class="topbilledit" @click="typechange">
  20. <view class="changetime1">
  21. {{xjry}}
  22. </view>
  23. <view class="changetime2">
  24. <u-icon name="arrow-down-fill" color="#666666" size="20"></u-icon>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="u-listdata">
  29. <view style="padding:16rpx 0 16rpx 32rpx">
  30. 共有 <span style="color: red">{{totalnumber}}</span>条记录
  31. </view>
  32. <u-list @scrolltolower="scrolltolower" :pagingEnabled='true'>
  33. <u-list-item v-for="(item, index) in indexList" :key="index">
  34. <view class="companylist">
  35. <h3>{{item.position}}</h3>
  36. <view class="Currentamount">
  37. 巡检类型: 安保
  38. </view>
  39. <view class="Currentamount">
  40. 巡检人员: {{item.circuitPerson.realName}}
  41. </view>
  42. <view class="Currentamount">
  43. 联系电话:¥{{item.circuitPerson.mobile}}
  44. </view>
  45. <view class="Currentamount">
  46. 巡检时间: {{item.circuitTime}}
  47. </view>
  48. </view>
  49. </u-list-item>
  50. </u-list>
  51. </view>
  52. </view>
  53. <u-picker :show="showtypexunjian" :itemHeight="80" :columns="columnstypexunjian" keyName="dictLabel"
  54. @confirm="confirmxunjian" @cancel='cancelxunjian'>
  55. </u-picker>
  56. <u-picker :show="showtype" :itemHeight="80" :columns="columnstype" keyName="realName" @confirm="confirmtype"
  57. @cancel='canceltype'>
  58. </u-picker>
  59. <u-picker :show="showfloor" :itemHeight="80" ref="uPicker" :loading="loading" @confirm="confirmfloor"
  60. @cancel='cancelfloor' :columns="columns" keyName="orgName" @change="changeHandler"></u-picker>
  61. <u-notify ref="uNotify" :show="showdct" message="服务器请求失败"></u-notify>
  62. </view>
  63. </template>
  64. <script>
  65. import cellGroup from '../../../uni_modules/uview-ui/libs/config/props/cellGroup';
  66. export default {
  67. components: {},
  68. data() {
  69. const currentDate = this.getDate({
  70. format: 'yyyy-mm'
  71. })
  72. return {
  73. totalnumber: 0,
  74. showtypexunjian: false,
  75. setyesno: true,
  76. indexList: [],
  77. xjlx: '巡检类型',
  78. dataList: [],
  79. dataForm: {
  80. buildingId: "",
  81. storeyId: "",
  82. circuitType: "",
  83. circuitPersonId: "",
  84. page: 1,
  85. limit: 10,
  86. },
  87. showtype: false,
  88. showdct: false,
  89. mytitle: '',
  90. alldata: [],
  91. showfloor: false,
  92. loading: false,
  93. columns: [],
  94. columnData: [],
  95. pd: true,
  96. xjry: '巡检人员',
  97. showPicker: false,
  98. myday: currentDate,
  99. columnstypexunjian: [],
  100. columnstype: [],
  101. }
  102. },
  103. //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
  104. onLoad() {
  105. let getDictDataList = uni.getStorageSync('getDictDataList');
  106. for (let i = 0; i < getDictDataList.length; i++) {
  107. if (getDictDataList[i].dictType == 'ReviewType') {
  108. let pushdata = {
  109. dictLabel: "全部",
  110. dictValue: "",
  111. }
  112. getDictDataList[i].dataList.unshift(pushdata)
  113. this.columnstypexunjian = [getDictDataList[i].dataList]
  114. }
  115. }
  116. this.getUserList();
  117. this.getfloor();
  118. // this.loadmore();
  119. },
  120. //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
  121. onReady() {
  122. // 微信小程序需要用此写法
  123. },
  124. //监听页面隐藏
  125. onHide() {},
  126. //监听窗口尺寸变化
  127. onResize() {},
  128. //监听页面卸载
  129. onUnload() {},
  130. //监听用户下拉动作,一般用于下拉刷新
  131. onPullDownRefresh() {},
  132. methods: {
  133. getUserList() {
  134. this.$api.get('/user/list', {
  135. page: 1,
  136. limit: 999,
  137. })
  138. .then(res => {
  139. let pushdata = {
  140. realName: "全部",
  141. id: "",
  142. };
  143. this.columnstype = [res.data.data];
  144. this.columnstype[0].unshift(pushdata)
  145. })
  146. },
  147. scrolltolower() {
  148. if (this.pd) {
  149. this.getalldata();
  150. } else {
  151. return
  152. }
  153. },
  154. xunjianchange() {
  155. this.showtypexunjian = true;
  156. },
  157. cancelxunjian() {
  158. this.showtypexunjian = false;
  159. },
  160. confirmxunjian(e) {
  161. this.xjlx = e.value[0].dictLabel;
  162. this.dataForm.circuitType = e.value[0].dictValue;
  163. this.indexList = [];
  164. this.dataForm.page = 1;
  165. this.getalldata();
  166. this.showtypexunjian = false;
  167. },
  168. getalldata() {
  169. this.$api.get('/circuitrecord/page', this.dataForm)
  170. .then(res => {
  171. this.totalnumber = res.data.data.total;
  172. if (res.data.data.list.length != 0) {
  173. this.indexList.push(...res.data.data.list);
  174. this.dataForm.page = this.dataForm.page + 1;
  175. this.pd = true;
  176. } else {
  177. uni.showToast({
  178. title: '暂无更多数据了',
  179. icon: 'none',
  180. duration: 1500
  181. })
  182. this.pd = false;
  183. }
  184. })
  185. },
  186. canceltype() {
  187. this.showtype = false;
  188. },
  189. confirmtype(e) {
  190. this.showtype = false;
  191. this.xjry = e.value[0].realName;
  192. this.dataForm.circuitPersonId = e.value[0].id;
  193. this.indexList = [];
  194. this.dataForm.page = 1;
  195. this.getalldata();
  196. },
  197. typechange() {
  198. this.showtype = true;
  199. },
  200. getDate(type) {
  201. const date = new Date();
  202. let year = date.getFullYear();
  203. let month = date.getMonth() + 1;
  204. if (type === 'start') {
  205. year = year - 60;
  206. } else if (type === 'end') {
  207. year = year + 2;
  208. }
  209. month = month > 9 ? month : '0' + month;
  210. return `${year}-${month}`;
  211. },
  212. getfloor() {
  213. this.$api.get('/control/getOrgStructureTree/', {})
  214. .then(res => {
  215. if (res.data.code == 0) {
  216. this.mytitle = res.data.data[0].orgName;
  217. this.alldata = res.data.data[0].childrenList;
  218. this.columns = [
  219. res.data.data[0].childrenList,
  220. res.data.data[0].childrenList[0].childrenList
  221. ]
  222. let allfloor = [];
  223. for (let i = 0; i < res.data.data[0].childrenList.length; i++) {
  224. allfloor.push(res.data.data[0].childrenList[i].childrenList)
  225. }
  226. this.columnData = allfloor;
  227. this.indexList = [];
  228. this.dataForm.page = 1;
  229. this.getalldata();
  230. } else {
  231. this.showdct = true
  232. }
  233. })
  234. },
  235. floorchange() {
  236. this.showfloor = true;
  237. },
  238. changeHandler(e) {
  239. const {
  240. columnIndex,
  241. index,
  242. // 微信小程序无法将picker实例传出来,只能通过ref操作
  243. picker = this.$refs.uPicker
  244. } = e
  245. if (columnIndex === 0) {
  246. this.loading = true
  247. picker.setColumnValues(1, this.columnData[index])
  248. this.loading = false
  249. }
  250. // this.getalldata();
  251. },
  252. confirmfloor(e) {
  253. this.mytitle = e.value[0].orgName + e.value[1].orgName;
  254. this.dataForm.buildingId = e.value[0].orgId;
  255. this.dataForm.storeyId = e.value[1].orgId;
  256. this.showfloor = false;
  257. this.indexList = [];
  258. this.dataForm.page = 1;
  259. this.getalldata();
  260. },
  261. cancelfloor() {
  262. this.showfloor = false;
  263. },
  264. }
  265. }
  266. </script>
  267. <style lang="scss">
  268. .billall {
  269. height: 100%;
  270. display: flex;
  271. flex-direction: column;
  272. }
  273. .u-listdata {
  274. height: 400px;
  275. flex: 1;
  276. display: flex;
  277. flex-direction: column;
  278. }
  279. .companylist {
  280. margin: 0 32rpx 24rpx;
  281. background: #fff;
  282. padding: 24rpx 32rpx;
  283. border-radius: 8rpx;
  284. position: relative;
  285. h3 {
  286. margin-bottom: 16rpx;
  287. }
  288. .Currentamount {
  289. margin-bottom: 8rpx;
  290. color: #999;
  291. span {
  292. color: #FA5555;
  293. padding-left: 9rpx;
  294. }
  295. }
  296. }
  297. .topbill {
  298. display: flex;
  299. justify-content: space-around;
  300. align-items: center;
  301. height: 100rpx;
  302. background-color: #fff;
  303. .topbilledit {
  304. display: flex;
  305. justify-content: space-around;
  306. align-items: center;
  307. .changetime1 {
  308. padding-right: 10rpx;
  309. }
  310. }
  311. }
  312. </style>