Inspectionrecord.vue 7.7 KB

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