From 6141b7de1b900b0de3dd1db7d0b34af2e947e299 Mon Sep 17 00:00:00 2001 From: PQZ Date: Tue, 22 Oct 2024 18:32:32 +0800 Subject: [PATCH] 1 --- pages-warehouse/home/home.vue | 233 +++++++++++++--------------------- pages/login/login.vue | 16 ++- 2 files changed, 99 insertions(+), 150 deletions(-) diff --git a/pages-warehouse/home/home.vue b/pages-warehouse/home/home.vue index 456ba05..e62fe7d 100644 --- a/pages-warehouse/home/home.vue +++ b/pages-warehouse/home/home.vue @@ -22,7 +22,7 @@ 搜索 - {{ item.name }} @@ -34,28 +34,23 @@ - + - {{ '牟科宇的配件审批单' }} - {{ '2024-10-20 12:00' }} + {{ item.repairName+'的配件申请单' }} + {{ item.createTimeStr }} - {{ '待审批' }} + {{ item.statusStr }} - 客户信息:{{ '张三' }} {{ '157****6879' }} + 申请人:{{ item.repairName }} - 车牌号:{{ '川A 184AO1' }} - - - 车辆信息:{{ '一汽奥迪 2024款 A6L' }} + 服务顾问:{{ item.adviserName }} - - 原因:当前库存炫驰全合成机油S7 4L/ALL数量不足 - + - - - + @@ -86,7 +79,13 @@ import OrderCard from "@/components/orderCard.vue"; import config from '@/config' import request from '@/utils/request'; import {builderOrder, formatTimestamp, saveTicketsRecords} from "@/utils/utils"; -import {getToken, getUserInfo} from '@/utils/auth' +import { + getToken, + getUserInfo, + getStrData, + getTenantId +} from '@/utils/auth' +import {getDictTextByCodeAndValue,formatDate} from "@/utils/utils"; export default { components: { @@ -96,46 +95,44 @@ export default { }, data() { return { + tabList: [ + { + name: '领配件' + }, + { + name: '退配件' + }, + ], + //配件单查询条件 + queryParams:{ + pageNo: 1, + pageSize: 10, + query: null, + type: "01", + }, + //配件单列表 + ticketWares:[], + //数量 + total: 0, + //下拉刷新状态 + isTriggered: false, + imgUrlPrex: config.baseImageUrl, userInfo: { avatar: undefined, nickname: '' }, - tabList: [ - { - name: '待审批' - }, - { - name: '未通过' - }, - { - name: '已审批' - } - ], + active: 0, - menuList: [ - { - title: '新建工单', - desc: '直接添加客户订单', - icon: require('@/static/icons/homeMenuIcon/menu1.png'), - path: '/pages-order/addOrder/addOrder' - }, - { - title: '预约开单', - desc: '查询预约记录', - icon: require('@/static/icons/homeMenuIcon/menu1.png'), - path: '/pages-order/appointOrder/appointOrder' - } - ], + bannerIndex: 0, shopList: [], bannerList: [], richTextHtml: null, pageNo: 1, pageSize: 10, - total: 0, - //下来刷新状态 - isTriggered: false, + + orderList: [ { orderNo: '1209840149750105501', @@ -162,9 +159,10 @@ export default { }) } else { if (!this.$msgSocket) { - // this.$startMsgSocket(getTenantId(), getStrData("userId")) + this.$startMsgSocket(getTenantId(), getStrData("userId")) } } + this.onRefresherrefresh() }, onShow() { if (!getToken()) { @@ -177,128 +175,71 @@ export default { nickname: '用户', roleNames: '角色' } - // this.onRefresherrefresh() + this.onRefresherrefresh() } }, methods: { - /** - * 上滑加载数据 - */ - onReachBottomCus() { - //判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕 - if (this.pageNo * this.pageSize >= this.total) { - uni.$u.toast('没有更多数据了') - return - } - //页码+1,调用获取数据的方法获取第二页数据 - this.pageNo++ - //此处调用自己获取数据列表的方法 - this.getOrderList() + activeTab(index){ + this.active = index + this.queryParams.type = 1==index?'01':'02' + this.onRefresherrefresh() }, + /** * 下拉刷新数据 */ onRefresherrefresh() { this.isTriggered = true - this.pageNo = 1 + this.queryParams.pageNo = 1 this.total = 0 - this.orderList = [] - this.getOrderList() + this.ticketWares = [] + this.getTicketWares() }, /** - * 开始施工 + * 配件单查询 */ - startWork(id) { - let paramsObj = {ticketId: id} - //先查当前用户在本工单下有几个维修项目 + getTicketWares(){ request({ - url: '/admin-api/repair/titem/listProject', + url: '/admin-api/repair/tw/page', method: 'get', - params: paramsObj - }).then((res) => { - console.log(res) - if (res.code == 200 && res.data.length > 0) { - if (res.data.length == 1) { - //只有1个,直接开始施工 - this.startWorkRequest(id, "02", res.data[0].id, "02", "kssg", "开始施工") - } else { - uni.showActionSheet({ - itemList: res.data.map(m => m.itemName), - success: ({ - tapIndex - }) => { - this.startWorkRequest(id, "02", res.data[tapIndex].id, "02", "kssg", "开始施工") - } - }) - } - } else { - uni.showToast({ - title: '操作失败,请联系管理员', - icon: 'none' - }) - } - }) - }, - /** - * 开始施工请求后台 - */ - async startWorkRequest(id, ticketsWorkStatus, itemId, itemStatus, recordType, remark) { - try { - const result = await saveTicketsRecords(id, ticketsWorkStatus, itemId, itemStatus, recordType, remark, null); - console.error("result", result); - this.onRefresherrefresh() - } catch (error) { - console.error(error); - } - }, - /** - * 查本人待处理工单 - */ - getOrderList() { - let paramsObj = {pageNo: this.pageNo, pageSize: this.pageSize, isFinish: "0"} - request({ - url: '/admin-api/repair/tickets/pageType', - method: 'get', - params: paramsObj - }).then((res) => { - console.log(res) - if (res.code == 200) { - let thisPageRecords = [] - if (res.data && res.data.hasOwnProperty("records")) { - for (let i = 0; i < res.data.records.length; i++) { - let order = res.data.records[i] - let viewOrder = builderOrder(order) - if (order.booking) { - viewOrder['appointDate'] = formatTimestamp(order.createTime) - } - let projectList = [] - if (order.itemList) { - for (let j = 0; j < order.itemList.length; j++) { - let itemObj = order.itemList[j] - if ("01" == itemObj.itemType) { - projectList.push({ - id: itemObj.id, - name: itemObj.itemName - }) - } - } - } - viewOrder['projectList'] = projectList - thisPageRecords.push(viewOrder) - } - } - //判断 如果获取的数据的页码不是第一页,就让之前赋值获取过的数组数据 concat连接 刚获取的第n页数据 + params: this.queryParams + }).then((res)=>{ + console.log(res,187) + if (res.code == 200){ + this.ticketWares = res.rows + this.total = res.total if (this.pageNo != 1) { - this.orderList = this.orderList.concat(thisPageRecords) + this.ticketWares = this.ticketWares.concat(res.rows) } else { - this.orderList = thisPageRecords + this.ticketWares = res.rows } - //将获取的总条数赋值 - this.total = res.data.total + this.ticketWares.map((item) => { + item.statusStr = getDictTextByCodeAndValue('ticket_wares_status', item.status) + item.createTimeStr = formatDate(item.createTime) + }) this.isTriggered = false } }) }, + + + /** + * 上滑加载数据 + */ + onReachBottomCus() { + //判断 如果页码*页容量大于等于总条数,提示该页数据加载完毕 + if (this.queryParams.pageNo * this.queryParams.pageSize >= this.total) { + uni.$u.toast('没有更多数据了') + return + } + //页码+1,调用获取数据的方法获取第二页数据 + this.queryParams.pageNo++ + //此处调用自己获取数据列表的方法 + this.getTicketWares() + }, + + + gotoPage(menu) { uni.navigateTo({ url: menu.path diff --git a/pages/login/login.vue b/pages/login/login.vue index 76ab478..ca413de 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -162,10 +162,18 @@ this.getIdLeader() } this.getStaffInfo(res.data.userinfo.id) - //跳转首页 - uni.navigateTo({ - url: '/pages-home/home/home' - }) + if (res.data.userinfo.roleCodes.includes("repair_warehouse")){ + //跳转首页 + uni.navigateTo({ + url: '/pages-warehouse/home/home' + }) + } else { + //跳转首页 + uni.navigateTo({ + url: '/pages-home/home/home' + }) + } + }else{ uni.showToast({ title: res.msg,