index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <view>
  3. <u-navbar title="我的巡检" :background="{ background: '#1669e6' }" title-color="#FFFFFF" back-icon-color="#FFFFFF">
  4. <view slot="right" v-if="deptName != '外部用户'" style="margin-right: 20rpx;color: #FFFFFF;" @click="addCamera">
  5. 创建巡检</view>
  6. </u-navbar>
  7. <view style="box-shadow: 0px 0px 8px 0px rgba(165, 189, 251, 0.4);margin-bottom: 20rpx">
  8. <u-tabs :list="list" :is-scroll="false" :current="current" @change="changetwo"></u-tabs>
  9. </view>
  10. <view v-for="(item,index) in dataList" :key="index"
  11. style="box-shadow: 0px 0px 8px 0px rgba(165, 189, 251, 0.4);width: 96%;border-top-right-radius: 10rpx;margin: 10rpx auto;padding-top: 10rpx;">
  12. <span
  13. style="width: 10rpx;height: 40rpx;background-color: #2979ff;display: block;float: left;margin-top: 10rpx;"></span>
  14. <h4
  15. style="width: 140rpx;border-radius: 200rpx;text-align: center;color: #2979ff;border: 2rpx solid #1785FF;float: right;margin-right: 10rpx;margin-top: 10rpx;">
  16. {{item.fInspectorName}}
  17. </h4>
  18. <view style="width: 90%;margin: 0 auto;margin: 0 auto;">
  19. <view style="display: flex;justify-content: space-between;height: 60rpx;line-height: 60rpx;border-bottom: 1rpx solid #eff4ff;">
  20. <h4>{{item.fWarehouseName}}</h4>
  21. </view>
  22. <view>
  23. <view style="width: 100%;height: 60rpx;line-height: 60rpx;">
  24. <view style="float: left;">计划日期</view>
  25. <view style="float: right;">{{item.fInspectionDatetime}}</view>
  26. </view>
  27. <view style="width: 100%;height: 60rpx;line-height: 60rpx;">
  28. <view style="float: left;">最新巡查日期</view>
  29. <view style="float: right;">{{item.fUpdateTime}}</view>
  30. </view>
  31. <view style="width: 100%;">
  32. <u-form-item label="备注" style="margin: 0;padding: 0;">
  33. <u-input v-model="item.fRemark" :disabled="true" height="70rpx" type="textarea"
  34. placeholder="" />
  35. </u-form-item>
  36. </view>
  37. </view>
  38. <view
  39. style="width: 100%;margin: 0 auto;height: 80rpx;margin: 0 auto;line-height: 80rpx;border-top: 1rpx solid #eff4ff;"
  40. @click="expenseDetails(item)">
  41. <view style="float: left;">
  42. <h3>{{deptName != '外部用户'?'立即巡检':'查看巡检'}}</h3>
  43. </view>
  44. <view style="float: right;">
  45. <u-icon name="arrow-right"></u-icon>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <u-toast ref="uToast" />
  51. <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" />
  52. <u-calendar :closeable="false" v-model="show" z-index="10076" mode="range" @change="change" :mask-close-able="false">
  53. </u-calendar>
  54. <!-- <u-action-sheet :list="warehouseList" @click="click" @close="close" :mask-close-able="false" v-model="warehouse"></u-action-sheet> -->
  55. <u-calendar :mask-close-able="false" :closeable="false" v-model="range" mode="range" @change="changeRange">
  56. </u-calendar>
  57. <u-picker v-model="warehouse" z-index="10076" mode="selector" :range="warehouseList" range-key="fName" @confirm="confirm" @cancel="close"></u-picker>
  58. <u-popup v-model="screen" @close="closeScreen" mode="bottom" length="60%" border-radius="40" :closeable="true">
  59. <view>
  60. <view style="text-align: center;height: 100rpx;line-height: 100rpx;">
  61. <text style="font-weight: bold;font-size: 32rpx;">全部筛选</text>
  62. </view>
  63. <view style="width: 96%;margin: 0 auto;">
  64. <text style="font-size: 32rpx;">仓库选择</text>
  65. <u-field
  66. style="margin: 20rpx auto;"
  67. v-model="warehouseName"
  68. label="仓库"
  69. placeholder="请选择仓库"
  70. disabled
  71. @click="warehouse = true"
  72. />
  73. <text style="font-size: 32rpx;">计划日期</text>
  74. <u-field
  75. style="margin: 20rpx auto;"
  76. v-model="datatime"
  77. label="计划日期"
  78. placeholder="请选择计划日期"
  79. disabled
  80. @click="show = true"
  81. />
  82. <view
  83. style="width: 100%;position:fixed; bottom:0;background-color: #FFFFFF;padding-left: 20px;padding-right: 20px;padding-bottom: 30rpx;z-index: 9999;">
  84. <u-button type="primary" @click="confirmCompletion">确认完成</u-button>
  85. </view>
  86. </view>
  87. </view>
  88. </u-popup>
  89. </view>
  90. </template>
  91. <script>
  92. export default {
  93. data() {
  94. return {
  95. show: false,
  96. range: false,
  97. screen: false,
  98. status: 'loadmore',
  99. warehouseName:'',
  100. warehouseId:'',
  101. datatime:'',
  102. inspectionBeginDate:'',
  103. inspectionEndDate:'',
  104. warehouseList: [],
  105. warehouse: false,
  106. loadText: {
  107. loadmore: uni.getStorageSync('deptName') == '外部用户' ? '请切换选择仓库' : '轻轻上拉',
  108. loading: '努力加载中',
  109. nomore: '实在没有了'
  110. },
  111. iconType: 'flower',
  112. dataList: [],
  113. list: [{
  114. name: '全部'
  115. }, {
  116. name: '仓库'
  117. }, {
  118. name: '计划日期'
  119. }, {
  120. name: '今日计划'
  121. }, {
  122. name: '筛选'
  123. }],
  124. form: {
  125. pageNum: 1,
  126. pageSize: 10,
  127. },
  128. current: 3,
  129. total: 0,
  130. deptName: uni.getStorageSync('deptName')
  131. }
  132. },
  133. created() {
  134. if (uni.getStorageSync('deptName') == '外部用户') {
  135. this.list = [{
  136. name: '选择仓库'
  137. }, {
  138. name: '选择日期'
  139. }, {
  140. name: '筛选'
  141. }]
  142. delete this.form.fInspectionDatetime
  143. } else {
  144. this.query()
  145. }
  146. this.$u.get('/basicdata/warehouse/appList', {
  147. fStatus: 0,
  148. delFlag: 0
  149. }).then(res => {
  150. console.log(res)
  151. this.warehouseList = res.rows
  152. // res.rows.forEach((item, index) => {
  153. // this.warehouse.push({
  154. // id: item.fId,
  155. // text: item.fName
  156. // })
  157. // })
  158. })
  159. },
  160. onReachBottom() {
  161. this.status = 'loading'
  162. if (this.dataList.length < this.total) {
  163. this.form.pageNum++
  164. this.query()
  165. } else {
  166. this.status = 'nomore'
  167. }
  168. },
  169. methods: {
  170. //确定
  171. confirm(index) {
  172. // console.log(index)
  173. if(this.screen === true){
  174. this.warehouseName = this.warehouseList[index].fName
  175. this.warehouseId = this.warehouseList[index].fId
  176. }else{
  177. this.form = {
  178. pageNum: 1,
  179. pageSize: 10,
  180. fWarehouseFid:this.warehouseList[index].fId
  181. }
  182. this.dataList = []
  183. this.current = null
  184. this.query()
  185. }
  186. },
  187. confirmCompletion(){
  188. this.form = {
  189. pageNum: 1,
  190. pageSize: 10,
  191. fWarehouseFid:this.warehouseId,
  192. inspectionBeginDate:this.inspectionBeginDate,
  193. inspectionEndDate:this.inspectionEndDate
  194. }
  195. this.dataList = []
  196. this.current = null
  197. this.screen = false
  198. this.query()
  199. },
  200. //创建巡检
  201. addCamera() {
  202. this.$u.route('/pages/home/patrolInspection/createPatrol');
  203. },
  204. close() {
  205. // this.deptName = uni.getStorageSync('deptName')
  206. this.current = null
  207. },
  208. //弹出框收起触发
  209. closeScreen(){
  210. this.current = null
  211. this.screen = false
  212. },
  213. click(index) {
  214. console.log(index)
  215. this.form.fWarehouseFid = this.warehouseList[index].fId
  216. this.dataList = []
  217. this.current = null
  218. this.query()
  219. },
  220. query() {
  221. // this.current = null
  222. if (uni.getStorageSync('deptName') == '外部用户') {
  223. this.$u.get('/warehouse/checkitems/appListByUser', this.form).then(res => {
  224. console.log(res)
  225. this.dataList = this.dataList.concat(res.rows)
  226. this.total = res.total
  227. if (res.total === 0) this.status = 'nomore'
  228. })
  229. } else {
  230. this.$u.get('/warehouse/checkitems/listByUser', this.form).then(res => {
  231. console.log(res)
  232. this.dataList = this.dataList.concat(res.rows)
  233. this.total = res.total
  234. if (res.total === 0) this.status = 'nomore'
  235. })
  236. }
  237. },
  238. change(e) {
  239. if(this.screen == true){
  240. this.current = null
  241. this.datatime = e.startDate + e.endDate
  242. this.inspectionBeginDate = e.startDate+' 00:00:00'
  243. this.inspectionEndDate = e.endDate +' 23:59:59'
  244. }else{
  245. this.current = null
  246. // this.form.inspectionDate = e.startDate+' 00:00:00' + ',' + e.endDate +' 23:59:59'
  247. // this.form.inspectionBeginDate = e.startDate+' 00:00:00'
  248. // this.form.inspectionEndDate = e.endDate +' 23:59:59'
  249. this.form = {
  250. pageNum: 1,
  251. pageSize: 10,
  252. inspectionBeginDate:e.startDate+' 00:00:00',
  253. inspectionEndDate:e.endDate +' 23:59:59'
  254. }
  255. this.dataList = []
  256. this.query()
  257. }
  258. },
  259. changeRange(e) {
  260. this.current = null
  261. if (this.form.fWarehouseFid) {
  262. this.form.inspectionDate = e.startDate + ',' + e.endDate
  263. this.dataList = []
  264. this.query()
  265. } else {
  266. this.$refs.uToast.show({
  267. title: '请选择仓库',
  268. })
  269. }
  270. },
  271. changetwo(index) {
  272. console.log(index)
  273. if (uni.getStorageSync('deptName') == '外部用户') {
  274. if (index === 0) this.warehouse = true
  275. if (index === 1) this.range = true
  276. if (index === 2) this.screen = true
  277. } else {
  278. if (index === 0) {
  279. this.dataList = []
  280. this.form = {
  281. pageNum: 1,
  282. pageSize: 10
  283. }
  284. this.query()
  285. }
  286. if (index === 1) this.warehouse = true
  287. if (index === 2) this.show = true
  288. if (index === 3) {
  289. delete this.form.inspectionDate
  290. this.form.fInspectionDatetime = new Date().toLocaleDateString().replace(/\//g, "-")
  291. this.dataList = []
  292. this.query()
  293. }
  294. if(index === 4) this.screen = true
  295. }
  296. this.current = index;
  297. },
  298. expenseDetails(item) {
  299. this.$u.route('/pages/home/patrolInspection/patrolDetails', {
  300. form: JSON.stringify(item)
  301. });
  302. },
  303. }
  304. }
  305. </script>
  306. <style lang="scss" scoped>
  307. .wrap {
  308. padding: 24rpx;
  309. }
  310. .item {
  311. padding: 24rpx 0;
  312. color: $u-content-color;
  313. font-size: 28rpx;
  314. }
  315. </style>