index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='故障工单'></cus-header>
  4. <div class="status">
  5. <div class="pre" :class="{'active':sidx===0}" @tap="changeStatus('',0)">全部</div>
  6. <div class="pre" :class="{'active':sidx===1}" @tap="changeStatus(0,1)">待解决</div>
  7. <div class="pre" :class="{'active':sidx===2}" @tap="changeStatus(1,2)">已解决</div>
  8. </div>
  9. <div class="query">
  10. <!-- <div class="pre" @tap="selectQuery(1)">
  11. <span>{{typeText}}</span>
  12. <u-icon name="arrow-down-fill" color="#C0C4CC" size="20rpx"></u-icon>
  13. </div> -->
  14. <div class="pre" @tap="selectQuery(2)">
  15. <span>{{timeText}}</span>
  16. <u-icon name="arrow-down-fill" color="#C0C4CC" size="20rpx"></u-icon>
  17. </div>
  18. <div class="pre" @tap="selectQuery(3)">
  19. <span>{{placeText}}</span>
  20. <u-icon name="arrow-down-fill" color="#C0C4CC" size="20rpx"></u-icon>
  21. </div>
  22. </div>
  23. <div class="boxs" v-if="dataList.length">
  24. <div class="item" v-for="(item,index) in dataList" :key="index">
  25. <div class="left">
  26. <div class="name">{{item.customer||''}}</div>
  27. <p>故障类型<span>{{item.typeName}}</span></p>
  28. <p>故障描述<span>{{item.repairDesc||''}}</span></p>
  29. <p>报修时间<span>{{item.createDate||''}}</span></p>
  30. </div>
  31. <div class="right">
  32. <div class="top" :class="{'djj':item.status===0,'yjj':item.status===1}">{{item.status===0?'待解决':'已解决'}}</div>
  33. <div class="bottom" @tap="toDetail(item)">查看</div>
  34. </div>
  35. </div>
  36. </div>
  37. <template v-else>
  38. <page-empty :height="'calc(100vh - 140px)'"></page-empty>
  39. </template>
  40. <u-picker :itemHeight="88" :show="show1" :columns="columns1" keyName="label" title="故障类型"
  41. @cancel="show1=false" @confirm="e=>confirm(e,1)" :immediateChange="true"></u-picker>
  42. <u-datetime-picker :itemHeight="88" :show="show2" v-model="queryParams.month" mode="date" title="报修时间"
  43. @cancel="show2=false" @confirm="e=>confirm(e,2)" :immediateChange="true" :minDate="minDate" :maxDate="maxDate"></u-datetime-picker>
  44. <u-picker :itemHeight="88" :show="show3" :columns="columns3" title="报修地点"
  45. @cancel="show3=false" @confirm="e=>confirm(e,3)" :immediateChange="true"></u-picker>
  46. </view>
  47. </template>
  48. <script>
  49. import pageEmpty from '@/components/pageEmpty/index.vue'
  50. export default {
  51. components:{
  52. pageEmpty
  53. },
  54. data(){
  55. return {
  56. sidx:0,
  57. typeText:'故障类型',
  58. timeText:'报修时间',
  59. placeText:'报修地点',
  60. queryParams:{
  61. page:1,
  62. limit:10,
  63. createStartDate:'',
  64. createEndDate:'',
  65. customer:'',
  66. status:''
  67. },
  68. show1:false,
  69. show2:false,
  70. show3:false,
  71. columns1:[[
  72. {value:0,label:'类型1'},
  73. {value:1,label:'类型2'}
  74. ]],
  75. columns3:[],
  76. minDate:'',
  77. maxDate:'',
  78. isOver:false,
  79. dataList:[]
  80. }
  81. },
  82. onReachBottom() {
  83. if(this.isOver) return
  84. this.getList();
  85. },
  86. async onShow() {
  87. this.init()
  88. this.getCustomerList();
  89. await this.getTypeList();
  90. this.getList();
  91. let d = new Date();
  92. this.minDate = new Date(d.getFullYear()-3,d.getMonth()+1,d.getDate()).getTime();
  93. this.maxDate = new Date().getTime();
  94. },
  95. methods:{
  96. getTypeList(){
  97. return new Promise((resolve,reject)=>{
  98. this.$api.get('/sys/dict/data/getListByType/wms_operation_category').then(res=>{
  99. if(res.data.code===0){
  100. this.typeList = res.data.data;
  101. resolve()
  102. }else this.$showToast(res.data.msg)
  103. })
  104. })
  105. },
  106. getCustomerList(){
  107. this.$api.get('/wms/project/getCustomerList',{page:1,limit:-1}).then(res=>{
  108. if(res.data.code!==0) return this.$showToast(res.data.msg)
  109. this.columns3 = [res.data.data]
  110. })
  111. },
  112. init(){
  113. this.sidx = 0;
  114. this.typeText = '故障类型';
  115. this.timeText = '报修时间';
  116. this.placeText = '报修地点';
  117. this.queryParams = {
  118. page:1,
  119. limit:10,
  120. createStartDate:'',
  121. createEndDate:'',
  122. customer:'',
  123. status:''
  124. };
  125. this.isOver = false;
  126. this.dataList = [];
  127. },
  128. changeStatus(status,idx){
  129. this.init();
  130. this.sidx = idx;
  131. this.queryParams.status = status;
  132. this.getList();
  133. },
  134. getList(){
  135. this.$api.get('/wms/order/operation/page',this.queryParams).then(res=>{
  136. if(res.data.code===0){
  137. if(this.dataList.length<res.data.data.total){
  138. this.queryParams.page++;
  139. this.dataList = [...this.dataList,...res.data.data.list];
  140. this.dataList.forEach(d=>{
  141. d.typeName = this.typeList.find(t=>t.dictValue==d.optCategory)?.dictLabel;
  142. })
  143. }else this.isOver = true
  144. }else this.$showModal(res.data.msg)
  145. });
  146. },
  147. selectQuery(type){
  148. this['show'+type] = true;
  149. },
  150. toDetail(item){
  151. uni.navigateTo({
  152. url:'/pagesOperation/workorder/detail?id='+item?.id
  153. })
  154. },
  155. confirm(e,type){
  156. this.init();
  157. if(type==1){
  158. this.typeText = e.value[0].label;
  159. this.queryParams.type = e.value[0].value;
  160. this.show1 = false;
  161. }else if(type==2){
  162. this.timeText = new Date(e.value).Format('yyyy-MM-dd');
  163. this.queryParams.createStartDate = new Date(e.value).Format('yyyy-MM-dd');
  164. this.queryParams.createEndDate = new Date(new Date().setDate(new Date(this.queryParams.createStartDate).getDate()+1)).Format('yyyy-MM-dd');
  165. this.show2 = false;
  166. }else if(type==3){
  167. this.placeText = e.value[0];
  168. this.queryParams.customer = e.value[0];
  169. this.show3 = false;
  170. }
  171. this.getList();
  172. }
  173. }
  174. }
  175. </script>
  176. <style scoped lang="less">
  177. .page{
  178. padding-bottom: 40rpx;
  179. background: #F4F8FB;
  180. .status{
  181. width: 100%;
  182. height: 90rpx;
  183. background: #FFFFFF;
  184. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECEEF5;
  185. display: flex;
  186. .pre{
  187. width: calc(100% / 3);
  188. height: 90rpx;
  189. font-family: PingFang-SC, PingFang-SC;
  190. font-weight: bold;
  191. font-size: 30rpx;
  192. color: #1D2129;
  193. line-height: 90rpx;
  194. text-align: center;
  195. position: relative;
  196. &.active{
  197. font-weight: bold;
  198. font-size: 32rpx;
  199. color: #2E69EB;
  200. &::after{
  201. content: '';
  202. width: 59rpx;
  203. height: 5rpx;
  204. background: #2E69EB;
  205. position: absolute;
  206. bottom: 0;
  207. left: 50%;
  208. margin-left: -30rpx;
  209. }
  210. }
  211. }
  212. }
  213. .query{
  214. width: 100%;
  215. height: 88rpx;
  216. background: #FFFFFF;
  217. display: flex;
  218. .pre{
  219. width: calc(100% / 2);
  220. height: 88rpx;
  221. display: flex;
  222. align-items: center;
  223. justify-content: center;
  224. span{
  225. font-family: PingFangSC, PingFang SC;
  226. font-weight: 400;
  227. font-size: 26rpx;
  228. color: #86909C;
  229. line-height: 26rpx;
  230. margin-right: 12rpx;
  231. }
  232. }
  233. }
  234. .boxs{
  235. padding: 0 24rpx;
  236. margin-top: 20rpx;
  237. .item{
  238. background: #FFFFFF;
  239. box-shadow: inset 0rpx -1rpx 0rpx 0rpx #ECEEF5;
  240. padding: 36rpx 27rpx;
  241. display: flex;
  242. .left{
  243. width: calc(100% - 115rpx);
  244. padding-right: 20rpx;
  245. box-sizing: border-box;
  246. .name{
  247. font-family: PingFang-SC, PingFang-SC;
  248. font-weight: bold;
  249. font-size: 30rpx;
  250. color: #1D2129;
  251. line-height: 42rpx;
  252. text-align: left;
  253. white-space: nowrap;
  254. overflow: hidden;
  255. text-overflow: ellipsis;
  256. }
  257. p{
  258. margin-top: 36rpx;
  259. font-family: PingFangSC, PingFang SC;
  260. font-weight: 400;
  261. font-size: 26rpx;
  262. color: #86909C;
  263. line-height: 26rpx;
  264. span{
  265. color: #1D2129;
  266. margin-left: 64rpx;
  267. }
  268. }
  269. }
  270. .right{
  271. width: 115rpx;
  272. display: flex;
  273. flex-direction: column;
  274. justify-content: space-between;
  275. .top{
  276. width: 104rpx;
  277. height: 48rpx;
  278. border-radius: 6rpx;
  279. font-family: PingFangSC, PingFang SC;
  280. font-weight: 400;
  281. font-size: 26rpx;
  282. line-height: 48rpx;
  283. text-align: center;
  284. &.djj{
  285. color: #FEA400;
  286. background: rgba(254,164,0,0.08);
  287. }
  288. &.yjj{
  289. color: #05C17F;
  290. background: rgba(20,204,140,0.08);
  291. }
  292. }
  293. .bottom{
  294. width: 115rpx;
  295. height: 64rpx;
  296. background: #2E69EB;
  297. border-radius: 16rpx;
  298. font-family: PingFang-SC, PingFang-SC;
  299. font-weight: bold;
  300. font-size: 28rpx;
  301. color: #FFFFFF;
  302. line-height: 64rpx;
  303. text-align: center;
  304. }
  305. }
  306. }
  307. }
  308. }
  309. </style>