index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='巡检记录'></cus-header>
  4. <div class="query">
  5. <div class="pre" @tap="selectQuery(1)">
  6. <span>{{statusText}}</span>
  7. <u-icon name="arrow-down-fill" color="#C0C4CC" size="20rpx"></u-icon>
  8. </div>
  9. <div class="pre" @tap="selectQuery(2)">
  10. <span>{{timeText}}</span>
  11. <u-icon name="arrow-down-fill" color="#C0C4CC" size="20rpx"></u-icon>
  12. </div>
  13. <div class="pre" @tap="selectQuery(3)">
  14. <span>{{placeText}}</span>
  15. <u-icon name="arrow-down-fill" color="#C0C4CC" size="20rpx"></u-icon>
  16. </div>
  17. </div>
  18. <div class="boxs" v-if="dataList.length">
  19. <div class="box" v-for="(item,index) in dataList" :key="index" @tap="toDetail(item)">
  20. <div class="top">
  21. <div class="left">{{item.inspectionSite||''}}</div>
  22. <div class="right">
  23. <div class="status" :class="{'zc':item.status===0,'yc':item.status===1}">{{item.status===0?'正常':'异常'}}</div>
  24. <image :src="imgBase+'operation/arrow_right.png'" mode="widthFix"></image>
  25. </div>
  26. </div>
  27. <div class="text">
  28. <div class="left">巡检时间</div>
  29. <p>{{item.startDate2||''}}</p>
  30. </div>
  31. <div class="text">
  32. <div class="left">巡检负责人</div>
  33. <p>{{item.inspector||''}}</p>
  34. </div>
  35. </div>
  36. </div>
  37. <template v-else>
  38. <page-empty :height="'calc(100vh - 200px)'"></page-empty>
  39. </template>
  40. <div class="bottom">
  41. <div class="btn" @tap="addRecord">添加巡检记录</div>
  42. </div>
  43. <u-picker :itemHeight="88" :show="show1" :columns="columns1" keyName="label" title="巡检状态"
  44. @cancel="show1=false" @confirm="e=>confirm(e,1)" :immediateChange="true"></u-picker>
  45. <u-datetime-picker :itemHeight="88" :show="show2" v-model="queryParams.month" mode="year-month" title="巡检时间"
  46. @cancel="show2=false" @confirm="e=>confirm(e,2)" :immediateChange="true" :minDate="minDate" :maxDate="maxDate"></u-datetime-picker>
  47. <u-picker :itemHeight="88" :show="show3" :columns="columns3" keyName="customerName" title="巡检地点"
  48. @cancel="show3=false" @confirm="e=>confirm(e,3)" :immediateChange="true"></u-picker>
  49. </view>
  50. </template>
  51. <script>
  52. import pageEmpty from '@/components/pageEmpty/index.vue'
  53. export default {
  54. components:{
  55. pageEmpty
  56. },
  57. data(){
  58. return {
  59. statusText:'巡检状态',
  60. timeText:'巡检时间',
  61. placeText:'巡检地点',
  62. queryParams:{
  63. page:1,
  64. limit:10,
  65. status:'',
  66. startDate:'',
  67. endDate:'',
  68. inspectionSite:''
  69. },
  70. show1:false,
  71. show2:false,
  72. show3:false,
  73. columns1:[[
  74. {value:0,label:'正常'},
  75. {value:1,label:'异常'}
  76. ]],
  77. columns3:[],
  78. minDate:'',
  79. maxDate:'',
  80. isOver:false,
  81. dataList:[]
  82. }
  83. },
  84. onReachBottom() {
  85. if(this.isOver) return
  86. this.getList();
  87. },
  88. onShow() {
  89. let d = new Date();
  90. this.minDate = new Date(d.getFullYear()-3,d.getMonth()+1,d.getDate()).getTime();
  91. this.maxDate = new Date().getTime();
  92. this.init();
  93. this.getCustomerList();
  94. this.getList();
  95. },
  96. methods:{
  97. getCustomerList(){
  98. this.$api.get('/wms/project/getCustomerList',{page:1,limit:-1}).then(res=>{
  99. if(res.data.code!==0) return this.$showToast(res.data.msg)
  100. let list = res.data.data.map(d=>{return {id:d,customerName:d}})
  101. this.columns3 = [list]
  102. })
  103. },
  104. getList(){
  105. this.$api.get('/wms/order/inspection/page',this.queryParams).then(res=>{
  106. if(res.data.code===0){
  107. if(this.dataList.length<res.data.data.total){
  108. this.queryParams.page++;
  109. this.dataList = [...this.dataList,...res.data.data.list];
  110. this.dataList.forEach(d=>{
  111. d.startDate2 = new Date(d.startDate).Format('yyyy-MM-dd');
  112. })
  113. }else this.isOver = true
  114. }else this.$showModal(res.data.msg)
  115. });
  116. },
  117. init(){
  118. this.statusText = '巡检状态';
  119. this.timeText = '巡检时间';
  120. this.placeText = '巡检地点';
  121. this.queryParams = {
  122. page:1,
  123. limit:10,
  124. status:'',
  125. startDate:'',
  126. endDate:'',
  127. inspectionSite:''
  128. };
  129. this.isOver = false;
  130. this.dataList = [];
  131. },
  132. selectQuery(type){
  133. this['show'+type] = true;
  134. },
  135. confirm(e,type){
  136. this.init();
  137. if(type==1){
  138. this.statusText = e.value[0].label;
  139. this.queryParams.status = e.value[0].value;
  140. this.show1 = false;
  141. }else if(type==2){
  142. this.timeText = new Date(e.value).Format('yyyy-MM-dd');
  143. this.queryParams.startDate = new Date(e.value).Format('yyyy-MM-dd');
  144. this.queryParams.endDate = new Date(new Date().setDate(new Date(this.queryParams.startDate).getDate()+1)).Format('yyyy-MM-dd');
  145. this.show2 = false;
  146. }else if(type==3){
  147. this.placeText = e.value[0].customerName;
  148. this.queryParams.inspectionSite = e.value[0].id;
  149. this.show3 = false;
  150. }
  151. this.getList();
  152. },
  153. addRecord(){
  154. uni.navigateTo({
  155. url:'/pagesOperation/record/add'
  156. })
  157. },
  158. toDetail(item){
  159. uni.navigateTo({
  160. url:'/pagesOperation/record/detail?id='+item.id
  161. })
  162. }
  163. }
  164. }
  165. </script>
  166. <style scoped lang="less">
  167. .page{
  168. padding-bottom: 168rpx;
  169. background: #F4F8FB;
  170. .query{
  171. width: 100%;
  172. height: 88rpx;
  173. background: #FFFFFF;
  174. display: flex;
  175. .pre{
  176. width: calc(100% / 3);
  177. height: 88rpx;
  178. display: flex;
  179. align-items: center;
  180. justify-content: center;
  181. span{
  182. font-family: PingFangSC, PingFang SC;
  183. font-weight: 400;
  184. font-size: 26rpx;
  185. color: #86909C;
  186. line-height: 26rpx;
  187. margin-right: 12rpx;
  188. }
  189. }
  190. }
  191. .boxs{
  192. padding: 0 24rpx;
  193. .box{
  194. background: #FFFFFF;
  195. border-radius: 16rpx;
  196. margin-top: 20rpx;
  197. padding: 36rpx 24rpx;
  198. .top{
  199. display: flex;
  200. align-items: center;
  201. justify-content: space-between;
  202. .left{
  203. width: calc(100% - 146rpx);
  204. padding-right: 20rpx;
  205. font-family: PingFang-SC, PingFang-SC;
  206. font-weight: bold;
  207. font-size: 30rpx;
  208. color: #1D2129;
  209. line-height: 30rpx;
  210. overflow: hidden;
  211. white-space: nowrap;
  212. text-overflow: ellipsis;
  213. }
  214. .right{
  215. display: flex;
  216. align-items: center;
  217. .status{
  218. width: 88rpx;
  219. height: 42rpx;
  220. border-radius: 6rpx;
  221. font-family: PingFang-SC, PingFang-SC;
  222. font-weight: bold;
  223. font-size: 26rpx;
  224. color: #FFFFFF;
  225. line-height: 42rpx;
  226. text-align: center;
  227. &.zc{
  228. background: #14CC8C;
  229. }
  230. &.yc{
  231. background: #FF4141;
  232. }
  233. }
  234. image{
  235. width: 24rpx;
  236. height: 24rpx;
  237. margin-left: 10rpx;
  238. }
  239. }
  240. }
  241. .text{
  242. margin-top: 36rpx;
  243. display: flex;
  244. align-items: center;
  245. .left{
  246. width: 168rpx;
  247. font-family: PingFangSC, PingFang SC;
  248. font-weight: 400;
  249. font-size: 26rpx;
  250. color: #86909C;
  251. line-height: 26rpx;
  252. }
  253. p{
  254. font-family: PingFangSC, PingFang SC;
  255. font-weight: 400;
  256. font-size: 26rpx;
  257. color: #1D2129;
  258. line-height: 26rpx;
  259. }
  260. }
  261. }
  262. }
  263. .bottom{
  264. width: 100%;
  265. height: 148rpx;
  266. padding: 20rpx 48rpx;
  267. box-sizing: border-box;
  268. background: #FFFFFF;
  269. position: fixed;
  270. bottom: 0;
  271. left: 0;
  272. z-index: 9;
  273. .btn{
  274. width: 100%;
  275. height: 88rpx;
  276. background: #2E69EB;
  277. border-radius: 16rpx;
  278. font-family: PingFang-SC, PingFang-SC;
  279. font-weight: bold;
  280. font-size: 32rpx;
  281. color: #FFFFFF;
  282. line-height: 88rpx;
  283. text-align: center;
  284. }
  285. }
  286. }
  287. </style>