Inspectionrecord.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  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="#666666" 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. <!-- 列表 -->
  28. <!-- <t-table>
  29. <t-tr>
  30. <t-th>序号</t-th>
  31. <t-th>姓名</t-th>
  32. <t-th>年龄</t-th>
  33. <t-th>爱好</t-th>
  34. <t-th>操作</t-th>
  35. </t-tr>
  36. <t-tr v-for="item in tableList" :key="item.id">
  37. <t-td>{{ item.id + 1 }}</t-td>
  38. <t-td>{{ item.name }}</t-td>
  39. <t-td>{{ item.age }}</t-td>
  40. <t-td>{{ item.hobby }}</t-td>
  41. <t-td align="left"> <u-button @click="edit(item)" size="small" type="primary" :plain="true" text="编辑"></u-button></t-td>
  42. </t-tr>
  43. </t-table> -->
  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. 巡检类型: 安保
  54. </view>
  55. <view class="Currentamount">
  56. 巡检人员: {{item.circuitPerson.realName}}
  57. </view>
  58. <view class="Currentamount">
  59. 联系电话:¥{{item.circuitPerson.mobile}}
  60. </view>
  61. <view class="Currentamount">
  62. 巡检时间: {{item.circuitTime}}
  63. </view>
  64. </view>
  65. </u-list-item>
  66. </u-list>
  67. </view>
  68. <u-picker :show="showtypexunjian" :columns="columnstypexunjian" keyName="dictLabel" @confirm="confirmxunjian"
  69. @cancel='cancelxunjian'>
  70. </u-picker>
  71. <u-picker :show="showtype" :columns="columnstype" keyName="label" @confirm="confirmtype" @cancel='canceltype'>
  72. </u-picker>
  73. <u-picker :show="showfloor" ref="uPicker" :loading="loading" @confirm="confirmfloor" @cancel='cancelfloor'
  74. :columns="columns" keyName="orgName" @change="changeHandler"></u-picker>
  75. <u-notify ref="uNotify" :show="showdct" message="服务器请求失败"></u-notify>
  76. </view>
  77. </template>
  78. <script>
  79. // import tTable from '@/components/t-table/t-table.vue';
  80. // import tTh from '@/components/t-table/t-th.vue';
  81. // import tTr from '@/components/t-table/t-tr.vue';
  82. import cellGroup from '../../../uni_modules/uview-ui/libs/config/props/cellGroup';
  83. // import tTd from '@/components/t-table/t-td.vue';
  84. export default {
  85. components: {
  86. // tTable,
  87. // tTh,
  88. // tTr,
  89. // tTd
  90. },
  91. data() {
  92. const currentDate = this.getDate({
  93. format: 'yyyy-mm'
  94. })
  95. return {
  96. totalnumber: 0,
  97. showtypexunjian: false,
  98. setyesno: true,
  99. // tableList: [{
  100. // id: 0,
  101. // name: '张三',
  102. // age: '19',
  103. // hobby: '游泳'
  104. // },
  105. // {
  106. // id: 1,
  107. // name: '李四',
  108. // age: '21',
  109. // hobby: '绘画'
  110. // },
  111. // ],
  112. indexList: [],
  113. xjlx: '巡检类型',
  114. dataList: [],
  115. dataForm: {
  116. projectId: "",
  117. buildingId: "",
  118. storeyId: "",
  119. circuitType: "",
  120. cycle: "",
  121. //status: "",
  122. page: 1,
  123. limit: 10,
  124. },
  125. showtype: false,
  126. showdct: false,
  127. mytitle: '',
  128. alldata: [],
  129. showfloor: false,
  130. loading: false,
  131. columns: [],
  132. columnData: [],
  133. pd: true,
  134. myday: '',
  135. xjry: '巡检人员',
  136. showPicker: false,
  137. myday: currentDate,
  138. columnstypexunjian: [],
  139. columnstype: [
  140. [{
  141. label: '张三',
  142. id: ''
  143. }, {
  144. label: '李四',
  145. id: 0
  146. },
  147. {
  148. label: '王五',
  149. id: 1
  150. }
  151. ]
  152. ],
  153. }
  154. },
  155. //监听页面加载,其参数为上个页面传递的数据,参数类型为 Object(用于页面传参
  156. onLoad() {
  157. let getDictDataList = uni.getStorageSync('getDictDataList');
  158. console.log('111111111111111111', getDictDataList)
  159. for (let i = 0; i < getDictDataList.length; i++) {
  160. if (getDictDataList[i].dictType == 'ReviewType') {
  161. let pushdata = {
  162. dictLabel: "全部",
  163. dictValue: "",
  164. }
  165. getDictDataList[i].dataList.unshift(pushdata)
  166. this.columnstypexunjian = [getDictDataList[i].dataList]
  167. }
  168. }
  169. this.getfloor();
  170. // this.loadmore();
  171. },
  172. //监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
  173. onReady() {
  174. // 微信小程序需要用此写法
  175. },
  176. //监听页面隐藏
  177. onHide() {},
  178. //监听窗口尺寸变化
  179. onResize() {},
  180. //监听页面卸载
  181. onUnload() {},
  182. //监听用户下拉动作,一般用于下拉刷新
  183. onPullDownRefresh() {},
  184. methods: {
  185. scrolltolower() {
  186. if (this.pd) {
  187. this.getalldata();
  188. } else {
  189. return
  190. }
  191. },
  192. xunjianchange() {
  193. this.showtypexunjian = true;
  194. },
  195. cancelxunjian() {
  196. this.showtypexunjian = false;
  197. },
  198. confirmxunjian(e) {
  199. console.log('111111111111111111',e)
  200. this.xjlx = e.value[0].dictLabel;
  201. this.dataForm.circuitType = e.value[0].dictValue;
  202. this.indexList=[];
  203. this.dataForm.page = 1;
  204. this.getalldata();
  205. this.showtypexunjian = false;
  206. },
  207. getalldata() {
  208. this.$api.get('/circuitrecord/page', this.dataForm)
  209. .then(res => {
  210. this.totalnumber = res.data.data.total;
  211. // console.log('111111111111111111',res.data.data.list)
  212. if (res.data.data.list.length != 0) {
  213. this.indexList.push(...res.data.data.list);
  214. this.dataForm.page = this.dataForm.page + 1;
  215. this.pd = true;
  216. } else {
  217. uni.showToast({
  218. title: '暂无更多数据了',
  219. icon: 'none',
  220. duration: 1500
  221. })
  222. this.pd = false;
  223. //this.jfnodata=true
  224. }
  225. })
  226. },
  227. canceltype() {
  228. this.showtype = false;
  229. },
  230. confirmtype(e) {
  231. this.showtype = false;
  232. this.xjry = e.value[0].label;
  233. this.dataForm.cycle = e.value[0].id;
  234. this.indexList=[];
  235. this.dataForm.page = 1;
  236. this.getalldata();
  237. },
  238. typechange() {
  239. this.showtype = true;
  240. },
  241. dateChange(e) {
  242. this.myday = e.target.value;
  243. this.dataForm.cycle = e.target.value;
  244. this.indexList=[];
  245. this.dataForm.page = 1;
  246. this.getalldata();
  247. },
  248. getDate(type) {
  249. const date = new Date();
  250. let year = date.getFullYear();
  251. let month = date.getMonth() + 1;
  252. if (type === 'start') {
  253. year = year - 60;
  254. } else if (type === 'end') {
  255. year = year + 2;
  256. }
  257. month = month > 9 ? month : '0' + month;
  258. // day = day > 9 ? day : '0' + day;
  259. return `${year}-${month}`;
  260. },
  261. getfloor() {
  262. this.$api.get('/control/getOrgStructureTree/', {})
  263. .then(res => {
  264. if (res.data.code == 0) {
  265. this.dataForm.projectId = res.data.data[0].orgId;
  266. this.mytitle = res.data.data[0].orgName;
  267. this.alldata = res.data.data[0].childrenList;
  268. //console.log('111111111111111111', res.data.data[0].childrenList)
  269. this.columns = [
  270. res.data.data[0].childrenList,
  271. res.data.data[0].childrenList[0].childrenList
  272. ]
  273. let allfloor = [];
  274. for (let i = 0; i < res.data.data[0].childrenList.length; i++) {
  275. allfloor.push(res.data.data[0].childrenList[i].childrenList)
  276. }
  277. // console.log('111111111111111111',allfloor)
  278. this.columnData = allfloor;
  279. this.indexList=[];
  280. this.dataForm.page = 1;
  281. this.getalldata();
  282. } else {
  283. this.showdct = true
  284. }
  285. })
  286. },
  287. floorchange() {
  288. this.showfloor = true;
  289. },
  290. changeHandler(e) {
  291. const {
  292. columnIndex,
  293. index,
  294. // 微信小程序无法将picker实例传出来,只能通过ref操作
  295. picker = this.$refs.uPicker
  296. } = e
  297. if (columnIndex === 0) {
  298. this.loading = true
  299. picker.setColumnValues(1, this.columnData[index])
  300. this.loading = false
  301. }
  302. // this.getalldata();
  303. },
  304. confirmfloor(e) {
  305. console.log('222222', e.value)
  306. this.mytitle = e.value[0].orgName + e.value[1].orgName;
  307. this.dataForm.buildingId = e.value[0].orgId;
  308. this.dataForm.storeyId = e.value[1].orgId;
  309. this.showfloor = false;
  310. this.indexList=[];
  311. this.dataForm.page = 1;
  312. this.getalldata();
  313. },
  314. cancelfloor() {
  315. this.showfloor = false;
  316. },
  317. }
  318. }
  319. </script>
  320. <style lang="scss">
  321. .Currentamount {
  322. padding-left: 30rpx;
  323. height: 50rpx;
  324. line-height: 50rpx;
  325. color: #BCB3A7;
  326. span {
  327. color: #FA5555;
  328. padding-left: 9rpx;
  329. }
  330. }
  331. .Callfee {
  332. width: 100rpx;
  333. height: 45rpx;
  334. text-align: center;
  335. line-height: 45rpx;
  336. color: #5C8FFF;
  337. border: 1px solid #5C8FFF;
  338. font-size: 22rpx;
  339. position: absolute;
  340. bottom: 10rpx;
  341. right: 10px;
  342. font-weight: bold;
  343. }
  344. .companylist {
  345. margin: 20rpx 30rpx;
  346. background: #fff;
  347. height: 280rpx;
  348. border-radius: 10px;
  349. position: relative;
  350. h3 {
  351. height: 70rpx;
  352. line-height: 70rpx;
  353. padding-left: 30rpx;
  354. }
  355. }
  356. .settled {
  357. background-color: #09C700;
  358. width: 100rpx;
  359. height: 40rpx;
  360. text-align: center;
  361. line-height: 40rpx;
  362. color: #fff;
  363. font-size: 14rpx;
  364. position: absolute;
  365. top: 0px;
  366. right: 0px;
  367. border-top-right-radius: 10rpx;
  368. border-bottom-left-radius: 10rpx;
  369. }
  370. .outstanding {
  371. background-color: #FA5555;
  372. width: 100rpx;
  373. height: 40rpx;
  374. text-align: center;
  375. line-height: 40rpx;
  376. color: #fff;
  377. font-size: 14rpx;
  378. position: absolute;
  379. top: 0px;
  380. right: 0px;
  381. border-top-right-radius: 10rpx;
  382. border-bottom-left-radius: 10rpx;
  383. }
  384. .billall {}
  385. .topbill {
  386. display: flex;
  387. justify-content: space-around;
  388. align-items: center;
  389. height: 100rpx;
  390. background-color: #e6e6e6;
  391. }
  392. .topbilledit {
  393. display: flex;
  394. justify-content: space-around;
  395. align-items: center;
  396. }
  397. .changetime1 {
  398. padding-right: 10rpx;
  399. }
  400. </style>