Browse Source

加入备品备件

master
zhang_li 8 months ago
parent
commit
c49cb24590
  1. 11
      src/api/dept.js
  2. 38
      src/api/device.js
  3. 20
      src/api/dict.js
  4. 5
      src/api/location.js
  5. 21
      src/api/mold.js
  6. 35
      src/api/overhaulOrder.js
  7. 47
      src/api/repairOrder.js
  8. 2
      src/api/request2.js
  9. 17
      src/api/spareParts.js
  10. 18
      src/api/sparePartsApplication.js
  11. 14
      src/api/sparePartsApplicationApprove.js
  12. 10
      src/api/sparePartsServiceWorkOrderList.js
  13. 19
      src/api/spotCheckOrder.js
  14. 40
      src/api/upkeepOrder.js
  15. 5
      src/api/user.js
  16. 211
      src/pages.json
  17. 219
      src/pages/device/index.vue
  18. 481
      src/pages/deviceReport/addForm.vue
  19. 229
      src/pages/deviceReport/index.vue
  20. 237
      src/pages/deviceReport/myDeviceReport.vue
  21. 1
      src/pages/index/index.vue
  22. 163
      src/pages/mold/index.vue
  23. 461
      src/pages/overhaulOrder/addForm.vue
  24. 666
      src/pages/overhaulOrder/addServiceRecord.vue
  25. 460
      src/pages/overhaulOrder/detail.vue
  26. 234
      src/pages/overhaulOrder/index.vue
  27. 260
      src/pages/overhaulOrder/reqairOrderList.vue
  28. 493
      src/pages/repairOrder/addForm.vue
  29. 503
      src/pages/repairOrder/addServiceRecord.vue
  30. 792
      src/pages/repairOrder/detail.vue
  31. 236
      src/pages/repairOrder/index.vue
  32. 230
      src/pages/repairOrder/myOrder.vue
  33. 589
      src/pages/repairOrder/transfer.vue
  34. 24
      src/pages/setter/index.vue
  35. 226
      src/pages/spareParts/index.vue
  36. 495
      src/pages/sparePartsApplication/addForm.vue
  37. 307
      src/pages/sparePartsApplication/detail.vue
  38. 183
      src/pages/sparePartsApplication/index.vue
  39. 170
      src/pages/sparePartsApplication/mySparePartsApplication.vue
  40. 199
      src/pages/sparePartsApplicationApprove/index.vue
  41. 170
      src/pages/sparePartsApplicationApprove/mySparePartsApplicationApprove.vue
  42. 494
      src/pages/sparePartsServiceWorkOrderList/addForm.vue
  43. 176
      src/pages/sparePartsServiceWorkOrderList/mySparePartsService.vue
  44. 358
      src/pages/spotCheckOrder/addForm.vue
  45. 217
      src/pages/spotCheckOrder/myOrder.vue
  46. 648
      src/pages/upkeepOrder/addServiceRecord.vue
  47. 484
      src/pages/upkeepOrder/detail.vue
  48. 225
      src/pages/upkeepOrder/index.vue
  49. 229
      src/pages/upkeepOrder/myOrder.vue

11
src/api/dept.js

@ -0,0 +1,11 @@
import http from './http'
// 获取人员列表
export function getSelecUser(params) {
return http.get('/system/dept/selecUserByType',{params})
}
// 获取厂区列表
export function getFactoryAreaList(params) {
return http.get('/system/dept/selectAllFactoryArea',{params})
}

38
src/api/device.js

@ -0,0 +1,38 @@
import http from './http'
// 根据设备号查询信息
export function getDeviceDetailsByNumber(params) {
return http.get('/eam/device-accounts/getDetailsByNumber',{params})
}
// 根据厂区查询设备
export function getDeviceByFactoryAreaNumber(factoryAreaNumber) {
return http.get('/eam/device-accounts/selectData?factoryAreaNumber='+factoryAreaNumber)
}
// 添加报修
export function deviceRepairCreate(data) {
return http.post('/eam/device-repair-request/create',data)
}
// 报修列表
export function deviceRepairPage(params) {
return http.get('/eam/device-repair-request/getAppPage',{params})
}
// 撤销
export function rejected(id) {
return http.delete('/eam/device-repair-request/rejected?id='+id)
}
// 设备列表
export function deviceList(params) {
return http.get('/eam/device-accounts/selectData',{params})
}
// 设备分页列表
export function devicePage(params) {
return http.get('/eam/device-accounts/getAppPage',{params})
}
// 根据设备号码获取二级列表
export function getSubList(params) {
return http.get('/eam/device-mold-items/getListByNumber',{params})
}
// 新增申领备件时获取备件列表
export function getApplyDeviceList() {
return http.get('/eam/device-accounts/selectAll')
}

20
src/api/dict.js

@ -0,0 +1,20 @@
import http from './http'
// 获取字典
export function getDictList(type) {
return http.get('/eam/device-maintenance-job-main/getDictList?type=' + type)
}
export async function getDict(type) {
let data =[]
await getDictList(type).then((res) => {
if (res.code == 0) {
data = res.data.map(item=>{
return {
label:item.label,
value:item.code,
}
})
} else {}
}).catch((err) => {})
return data
}

5
src/api/location.js

@ -0,0 +1,5 @@
import http from './http'
// 获取库位
export function getLocation(number) {
return http.get('/eam/location/scanCodeByNumber?number='+number)
}

21
src/api/mold.js

@ -0,0 +1,21 @@
import http from './http'
// 根据模具号查询信息
export function getMoldDetailsByNumber(params) {
return http.get('/eam/mold-accounts/getDetailsByNumber',{params})
}
// 根据厂区查询模具
export function getMoldByFactoryAreaNumber(factoryAreaNumber) {
return http.get('/eam/mold-accounts/selectData?factoryAreaNumber='+factoryAreaNumber)
}
// 模具分页列表
export function moldPage(params) {
return http.get('/eam/mold-accounts/getAppPage',{params})
}
// 模具列表
export function moldList(params) {
return http.get('/eam/mold-accounts/selectData',{params})
}
// 新增申领备件时获取模具列表
export function getApplyMoldList() {
return http.get('/eam/item-accounts/selectAll')
}

35
src/api/overhaulOrder.js

@ -0,0 +1,35 @@
import http from './http'
// 添加工单
export function overhaulOrderCreate(data) {
return http.post('/eam/device-inspection-job-main/create',data)
}
// 编辑工单
export function overhaulOrderUpdate(data) {
return http.put('/eam/device-inspection-job-main/updat',data)
}
// 报修列表
export function overhaulOrderPage(params) {
return http.get('/eam/device-inspection-job-main/getAppPage',{params})
}
// 操作工单
export function orderClick(params) {
return http.get('/eam/device-inspection-job-main/onClick',{params})
}
// 添加维修工单子项维修内容
export function overhaulOrderDetailCreate(data) {
return http.post('/eam/device-inspection-job-detail/create',data)
}
// 编辑维修工单子项维修内容
export function overhaulOrderDetailUpdate(data) {
return http.put('/eam/device-inspection-job-detail/update',data)
}
// 获得维修工单子列表
export function overhaulOrderDetailList(params) {
return http.get('/eam/device-inspection-job-detail/selectListByNumber',{params})
}
// 删除维修工单子
export function overhaulOrderDetailDelete(id) {
return http.delete('/eam/device-inspection-job-detail/delete?id='+id)
}

47
src/api/repairOrder.js

@ -0,0 +1,47 @@
import http from './http'
// 添加工单
export function repairOrderCreate(data) {
return http.post('/eam/device-maintenance-job-main/create',data)
}
// 编辑工单
export function repairOrderUpdate(data) {
return http.put('/eam/device-maintenance-job-main/update',data)
}
// 工单列表
export function repairOrderPage(params) {
return http.get('/eam/device-maintenance-job-main/getAppPage',{params})
}
// 操作工单
export function orderClick(params) {
return http.get('/eam/device-maintenance-job-main/orderClick',{params})
}
// 添加维修工单子项维修内容
export function repairOrderDetailCreate(data) {
return http.post('/eam/device-maintenance-job-detail/create',data)
}
// 编辑维修工单子项维修内容
export function repairOrderDetailUpdate(data) {
return http.put('/eam/device-maintenance-job-detail/update',data)
}
// 获得维修工单子列表
export function repairOrderDetailList(params) {
return http.get('/eam/device-maintenance-job-detail/selectListByNumber',{params})
}
// 删除维修工单子
export function repairOrderDetailDelete(id) {
return http.delete( '/eam/device-maintenance-job-detail/delete?id='+id)
}
//转办
export function transfer(params) {
return http.get('/eam/device-maintenance-job-main/turnTo',{params})
}
// 获取采取临时措施的维修工单
export function repairOrderList(params) {
return http.get('/eam/device-maintenance-job-main/getList',{params})
}
// 获取维修工单的报修信息
export function getDeviceRepairDetailsByNumber(params) {
return http.get('/eam/device-repair-request/getDetailsByNumber',{params})
}

2
src/api/request2.js

@ -690,7 +690,7 @@ export function putawayJobSubmit(params) {
* @param {*}
*/
export function getPutawayRequestList(params) {
return http.post("/wms/putaway-request-main/senior" + params)
return http.post("/wms/putaway-request-main/senior" , params)
}
/**
* 采购上架申请 获取任务明细

17
src/api/spareParts.js

@ -0,0 +1,17 @@
import http from './http'
// 获取tabs备件列表
export function getSparePartsPage(params) {
return http.get('/eam/item/getAppPage',{params})
}
// 获取备件列表
export function getSparePartsList(params) {
return http.get('/eam/item/getListByNumber',{params})
}
// 新增申领备件时获取备件列表
export function getApplySparePartsList() {
return http.get('/eam/item/getApplyList')
}
// 新增备件维修获取备件列表
export function getServiceSparePartsList() {
return http.get('/eam/item/getItemMaintainList')
}

18
src/api/sparePartsApplication.js

@ -0,0 +1,18 @@
import http from './http'
// 备件领用列表
export function sparePartsApplicationPage(params) {
return http.get('/eam/item-apply-request-main/getAppPage',{params})
}
// 领用备件
export function sparePartsApplicationCreate(data) {
return http.post('/eam/item-apply-request-main/create',data)
}
// 撤回领用备件
export function sparePartsApplicationCancle(id) {
return http.get('/eam/item-apply-request-main/backout?id=' + id)
}
// 领用备件详情
export function sparePartsApplicationDetail(number) {
return http.get('/eam/item-apply-request-main/appGetByNumber?number=' + number)
}

14
src/api/sparePartsApplicationApprove.js

@ -0,0 +1,14 @@
import http from './http'
// 备件领用审批列表
export function sparePartsApplicationApprovePage(params) {
return http.get('/eam/item-apply-request-main/getAppApprovePage',{params})
}
// 通过申请
export function sparePartsApplicationAgree(id) {
return http.get('/eam/item-apply-request-main/agree?id='+id)
}
// 驳回申请
export function sparePartsApplicationReject(id) {
return http.get('/eam/item-apply-request-main/disAgree?id='+id)
}

10
src/api/sparePartsServiceWorkOrderList.js

@ -0,0 +1,10 @@
import http from './http'
// 领用备件
export function sparePartsServiceWorkOrderListCreate(data) {
return http.post('/eam/item-maintenance-record/create',data)
}
// 备件维修列表
export function sparePartsServiceWorkOrderListPage(params) {
return http.get('/eam/item-maintenance-record/getAppPage',{params})
}

19
src/api/spotCheckOrder.js

@ -0,0 +1,19 @@
import http from './http'
// 添加工单
export function spotCheckOrderCreate(data) {
return http.post('/eam/device-spot-inspection-record-main/create',data)
}
// 编辑工单
export function spotCheckOrderUpdate(data) {
return http.put('/eam/device-spot-inspection-record-main/update',data)
}
// 工单列表
export function spotCheckOrderPage(params) {
return http.get('/eam/device-spot-inspection-record-main/getAppPage',{params})
}
// 操作工单
export function orderClick(params) {
return http.get('/eam/device-spot-inspection-record-main/onClick',{params})
}

40
src/api/upkeepOrder.js

@ -0,0 +1,40 @@
import http from './http'
// 添加工单
export function upkeepOrderCreate(data) {
return http.post('/eam/device-maintain-job-main/create',data)
}
// 编辑工单
export function upkeepOrderUpdate(data) {
return http.put('/eam/device-maintain-job-main/update',data)
}
// 工单列表
export function upkeepOrderPage(params) {
return http.get('/eam/device-maintain-job-main/getAppPage',{params})
}
// 接单
export function orderClick(params) {
return http.get('/eam/device-maintain-job-main/orderClick',{params})
}
// 完成保养工单
export function orderClickFinish(params) {
return http.get('/eam/device-maintain-job-main/orderClickFinish',{params})
}
// 添加维修工单子项维修内容
export function upkeepOrderDetailCreate(data) {
return http.post('/eam/device-maintain-job-detail/create',data)
}
// 编辑维修工单子项维修内容
export function upkeepOrderDetailUpdate(data) {
return http.put('/eam/device-maintain-job-detail/update',data)
}
// 获得维修工单子列表
export function upkeepOrderDetailList(params) {
return http.get('/eam/device-maintain-job-detail/selectListByNumber',{params})
}
// 删除维修工单子
export function upkeepOrderDetailDelete(id) {
return http.delete('/eam/device-maintain-job-detail/delete?id='+id)
}

5
src/api/user.js

@ -0,0 +1,5 @@
import http from './http'
// 用户密码重置
export function updateUserPassword(data) {
return http.put('/eam/device-accounts/getDetailsByNumber',data)
}

211
src/pages.json

@ -1686,7 +1686,216 @@
"navigationBarTitleText": "翻包",
"enablePullDownRefresh": false
}
}, {
"path": "pages/device/index",
"style": {
"navigationBarTitleText": "设备列表",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/mold/index",
"style": {
"navigationBarTitleText": "模具",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/spareParts/index",
"style": {
"navigationBarTitleText": "备件",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/deviceReport/index",
"style": {
"navigationBarTitleText": "设备报修",
"navigationStyle": "custom"
}
},{
"path": "pages/deviceReport/addForm",
"style": {
"navigationBarTitleText": "添加报修",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/deviceReport/myDeviceReport",
"style": {
"navigationBarTitleText": "我的报修",
"navigationStyle": "custom"
}
},{
"path": "pages/repairOrder/index",
"style": {
"navigationBarTitleText": "维修工单",
"navigationStyle": "custom"
}
},{
"path": "pages/repairOrder/addForm",
"style": {
"navigationBarTitleText": "添加维修工单",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/repairOrder/detail",
"style": {
"navigationBarTitleText": "维修工单详情",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/repairOrder/myOrder",
"style": {
"navigationBarTitleText": "我的维修工单",
"navigationStyle": "custom"
}
},{
"path": "pages/repairOrder/addServiceRecord",
"style": {
"navigationBarTitleText": "添加维修内容",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/repairOrder/transfer",
"style": {
"navigationBarTitleText": "转办",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/overhaulOrder/index",
"style": {
"navigationBarTitleText": "检修工单",
"navigationStyle": "custom"
}
},{
"path": "pages/overhaulOrder/addForm",
"style": {
"navigationBarTitleText": "添加检修工单",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/overhaulOrder/detail",
"style": {
"navigationBarTitleText": "检修工单详情",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/overhaulOrder/addServiceRecord",
"style": {
"navigationBarTitleText": "添加检修内容",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/overhaulOrder/reqairOrderList",
"style": {
"navigationBarTitleText": "选择维修工单",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/spotCheckOrder/addForm",
"style": {
"navigationBarTitleText": "添加点检工单",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/spotCheckOrder/myOrder",
"style": {
"navigationBarTitleText": "我的点检工单",
"navigationStyle": "custom"
}
},{
"path": "pages/upkeepOrder/index",
"style": {
"navigationBarTitleText": "保养工单",
"navigationStyle": "custom"
}
},{
"path": "pages/upkeepOrder/detail",
"style": {
"navigationBarTitleText": "保养工单详情",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/upkeepOrder/addServiceRecord",
"style": {
"navigationBarTitleText": "添加保养内容",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/upkeepOrder/myOrder",
"style": {
"navigationBarTitleText": "我的保养工单",
"navigationStyle": "custom"
}
},{
"path": "pages/sparePartsApplication/index",
"style": {
"navigationBarTitleText": "领用申请",
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/sparePartsApplication/addForm",
"style": {
"navigationBarTitleText": "领用备件",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/sparePartsApplication/detail",
"style": {
"navigationBarTitleText": "详情",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/sparePartsApplication/mySparePartsApplication",
"style": {
"navigationBarTitleText": "我的领用",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/sparePartsServiceWorkOrderList/addForm",
"style": {
"navigationBarTitleText": "添加备件维修工单",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/sparePartsServiceWorkOrderList/mySparePartsService",
"style": {
"navigationBarTitleText": "我的备件维修",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/sparePartsApplicationApprove/index",
"style": {
"navigationBarTitleText": "领用申请审批",
"navigationStyle": "custom",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/sparePartsApplicationApprove/mySparePartsApplicationApprove",
"style": {
"navigationBarTitleText": "我的领用审批",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}
],
@ -1721,7 +1930,7 @@
"pagePath": "pages/index/index",
"iconPath": "./static/bar/home.png",
"selectedIconPath": "./static/bar/home_p.png",
"text": "首页"
"text": "菜单"
},
{
"pagePath": "pages/message/index",

219
src/pages/device/index.vue

@ -0,0 +1,219 @@
<template>
<!-- 设备 -->
<view class="work-container">
<view class="cartNull" v-show="!token">
还没有登录<navigator open-type="navigate" url="/pages/login">先登录</navigator>
</view>
<view class="" v-show='token'>
<Search @search='search' @screen='screen' :isShowScreen='false' />
<view class="list">
<view class="item" v-for="(item,index) in list" :key='index'>
<u-image :src="item.images" width='160' height="160">
<template v-slot:error>
<view class="image-error">
<u-icon name="photo" color="#c7c7c7" size="38"></u-icon>
<view style="font-size: 24rpx;">暂无图片</view>
</view>
</template>
</u-image>
<view class="text">
<view class="title">
{{item.name}}
</view>
<view class="dec1">
{{item.number}}
</view>
<view class="dec2">
{{item.factoryAreaName}}
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import {
getAccessToken
} from '@/utils/auth'
import * as deviceApi from "@/api/device.js"
import Search from '../../components/search/index.vue'
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
type: '',
name: ''
})
const status = ref('loadmore') //
const list = ref([])
const token = ref('')
//
function search(keyWord) {
params.value.name = keyWord
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
}
function screen() {
proxy.$tab.navigateTo(`/pages/device/screen`)
}
function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
console.log('params.value',params.value)
deviceApi.devicePage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => { })
}
onShow(() => {
if (getAccessToken()) {
token.value = getAccessToken()
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
}
})
onReachBottom(() => {
getList()
})
// onReachBottom() {
// this.getList()
// }
// export default {
// data() {
// return {
// params: {
// pageNo: 1,
// pageSize: 10,
// type: '',
// name:''
// },
// status: 'loadmore', //
// list: [],
// token:''
// }
// },
// methods: {
// //
// search(keyWord) {
// this.params.name = keyWord
// this.params.pageNo = 1
// this.list = []
// this.status = 'loadmore'
// this.getList()
// },
// //
// screen() {
// this.$tab.navigateTo(`/pages/device/screen`)
// },
// //
// getList() {
// if (this.status == 'nomore') return;
// this.status = 'loading';
// this.$modal.loading('')
// deviceApi.devicePage(this.params).then((res) => {
// this.$modal.closeLoading()
// if (res.data.list.length > 0) {
// this.list = this.list.concat(res.data.list);
// this.params.pageNo++;
// this.status = 'loadmore'
// } else {
// this.status = 'nomore'
// }
// }).catch(()=>{})
// },
// },
// onShow() {
// if (getAccessToken()) {
// this.token = getAccessToken()
// this.params.pageNo = 1
// this.list = []
// this.status = 'loadmore'
// this.getList()
// }
// },
// onReachBottom() {
// this.getList()
// }
// }
</script>
<style lang="scss" scoped>
.work-container{
min-height: 100vh;
background: #f5f5f5;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
.text {
margin-left: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
}
.image-error {
text-align: center;
}
.cartNull {
text-align: center;
padding: 500rpx 40rpx 0;
font-size: 28rpx;
color: #888;
}
.cartNull navigator {
color: #2979ff;
}
</style>

481
src/pages/deviceReport/addForm.vue

@ -0,0 +1,481 @@
<template>
<!-- 添加设备报修 -->
<view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="故障描述" prop="describes" required>
<u-input v-model="form.describes" placeholder="请输入故障描述" />
</u-form-item>
<u-form-item label="类型" prop="type" required>
<view class="select" @click="openSingleColumn('type',form.type,appDeviceMoldType)">
<view class="input" v-if='form.type'>
{{form.typeName}}
</view>
<view class="placeholder" v-else>
{{`请选择类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`" prop="deviceNumber" required>
<u-input v-model="form.deviceNumber" :placeholder="`请输入${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`"
@blur="blur()" @confirm='blur()'/>
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`" prop="deviceNumber" required
class="disabled">
<u-input v-model="form.deviceName" :placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`"
disabled />
</u-form-item>
<u-form-item :label="`厂区编码`" prop="factoryAreaNumber" required class="disabled">
<u-input v-model="form.factoryAreaNumber"
:placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`" disabled />
</u-form-item>
<u-form-item :label="`厂区名称`" prop="factoryAreaName" required class="disabled">
<u-input v-model="form.factoryAreaName"
:placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`" disabled />
</u-form-item>
<view class="image" style="margin-top: 20rpx;">
<view class="image-list" v-if='imgList.length>0'>
<view class="image-item" v-for="(item,index) in imgList" :key="index">
<image :src="item" mode=""></image>
<u-icon name="close-circle-fill" color="red" class="close" size="36" @click="delImage(index)">
</u-icon>
</view>
</view>
<view class="image-item image-item1" @click="chooseImage" v-if='imgList.length<3'>
<image src="../../static/images/photo.png" mode=""></image>
</view>
</view>
</u-form>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as deviceApi from "@/api/device.js"
import * as moldApi from "@/api/mold.js"
import * as dictApi from "@/api/dict.js"
import * as uploadApi from "@/api/upload.js"
import * as deptApi from "@/api/dept.js"
const { proxy } = getCurrentInstance()
const loading = ref(false)
const type = ref('')
const appDeviceMoldType = ref([])
const factoryAreaList = ref([])
const form = ref({
describes: "",
deviceNumber: '',
deviceName: '',
factoryAreaName: '',
factoryAreaNumber: '',
type: '',
typeName:''
})
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const imgList = ref([])
const field = ref('')
const msg = ref('')
function chickRightButton(field) {
if (!form.value.type) {
proxy.$modal.showToast('请先选择类型')
return;
}
uni.scanCode({
success: function (res) {
form.value.deviceNumber = res.result
getDetailsByNumber()
}
});
}
function blur() {
if (form.value.deviceNumber) {
getDetailsByNumber()
} else {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
}
}
//
function getFactoryAreaList() {
deptApi.getFactoryAreaList().then((res) => {
if (res.data && res.data.length > 0) {
res.data.map(item => {
item.value = item.id
item.label = item.name
})
factoryAreaList.value = res.data
} else {
factoryAreaList.value = []
}
}).catch(() => { })
}
// /
function getDetailsByNumber() {
if (type.value == 'DEVICE' || type.value == 'TECH') {
deviceApi.getDeviceDetailsByNumber({
number: form.value.deviceNumber,
type: type.value,
flag:1
}).then((res) => {
console.log(res)
if (!res.data) {
msg.value = res.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
return;
}
form.value.deviceName = res.data.name
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch((err) => {
console.log(err)
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
})
} else if (type.value == 'MOLD') {
moldApi.getMoldDetailsByNumber({
number: form.value.deviceNumber,
flag:1
}).then((res) => {
if (!res.data) {
msg.value = res.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
return;
}
form.value.deviceName = res.data.name
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch((err) => {
console.log(err)
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
})
}
}
//
function submit() {
//
if (!form.value.describes) {
proxy.$modal.showToast('请输入故障描述')
return;
}
if (!form.value.factoryAreaNumber) {
proxy.$modal.showToast(`请选择选择所属厂区`)
return;
}
if (!form.value.deviceNumber) {
proxy.$modal.showToast(`请选择${type.value == 'DEVICE' || type.value == 'TECH' ? '设备' : '模具'}`)
return;
}
if (!form.value.deviceName) {
proxy.$modal.showToast(msg.value)
return;
}
if (!form.value.type) {
proxy.$modal.showToast(`请选择类型'}`)
return;
}
const data = {
describes: form.value.describes,
deviceNumber: form.value.deviceNumber,
factoryAreaNumber: form.value.factoryAreaNumber,
type: type.value,
filePathList: imgList.value,
}
proxy.$modal.confirm('是否添加报修').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
deviceApi.deviceRepairCreate(data).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function reset() {
form.value = {}
imgList.value = []
}
//
function openSingleColumn(fieldName, val, list) {
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
if(form.value[field.value] == e[0].value)return;
form.value[field.value] = e[0].value
if (field.value == 'factoryAreaNumber') {
form.value.deviceNumber = ''
form.value.deviceName = ''
getDetailsByNumber()
}
if (field.value == 'type') {
type.value = form.value[field.value]
form.value.typeName = e[0].label
form.value.deviceNumber = ''
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
// getDetailsByNumber()
}
singleColumnShow.value = false
}
function chooseImage() {
uni.chooseImage({
count: 1, // 9
sizeType: ['compressed'], //
sourceType: ['album', 'camera'], //
success: (res) => {
let filePath = res.tempFilePaths[0]
proxy.$modal.loading()
uploadApi.uploadFile({
filePath: filePath,
name: 'file',
formData: {
'user': 'test'
},
}).then(ret => {
proxy.$modal.closeLoading()
imgList.value.push(ret.data)
}).catch((err) => {
proxy.$modal.closeLoading()
});
},
});
}
//
function delImage(index) {
imgList.value.splice(index, 1)
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
appDeviceMoldType.value = await dictApi.getDict('app_device_mold_type')
if (type.value == 'DEVICE') {
appDeviceMoldType.value = appDeviceMoldType.value.filter((item => item.value != "MOLD"))
uni.setNavigationBarTitle({
title: '设备报修'
})
} else {
uni.setNavigationBarTitle({
title: '模具报修'
})
appDeviceMoldType.value =appDeviceMoldType.value.filter((item => item.value == "MOLD"))
}
form.value.type = appDeviceMoldType.value[0].value
form.value.typeName = appDeviceMoldType.value[0].label
getFactoryAreaList()
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
image {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.image {
padding: 0px 30rpx;
padding-bottom: 30rpx;
display: flex;
align-items: center;
flex-wrap: wrap;
.image-list {
display: flex;
align-items: center;
flex-wrap: wrap;
}
}
.image-item {
width: 210rpx;
height: 210rpx;
margin-right: 20rpx;
position: relative;
border: 1px solid rgba(230, 230, 230, 0.5);
margin-bottom: 20rpx;
border-radius: 20rpx;
overflow: hidden;
image {
width: 100%;
height: 100%;
}
.close {
position: absolute;
right: 0px;
top: 0px;
}
}
.image-item1 {
border: none;
margin-right: 0px;
image {
width: 100%;
height: 100%;
}
}
</style>

229
src/pages/deviceReport/index.vue

@ -0,0 +1,229 @@
<template>
<!-- 设备报修 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="设备报修">
<template v-slot:right>
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm"></u-icon>
</template>
</u-navbar>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
类型:<span>{{item.type=='DEVICE'?'设备':item.type=='TECH'?'工艺':'模具'}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="images">
<image :src="cur" mode="" v-for="(cur,key) in item.filePathList" :key='key'
@click="previewImage(key,item.filePathList)"></image>
</view>
<view class="bottom">
<view class="status">
<u-tag :text="item.result" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471'
type="primary" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.isCancel == 0" @click="cancle(item)">撤销</u-button>
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as deviceApi from "@/api/device.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
type: '',
name: ''
})
const status = ref('loadmore') //
const list = ref([])
const type = ref()
function addForm() {
proxy.$tab.navigateTo(`/pages/deviceReport/addForm?type=${params.value.type}`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await deviceApi.deviceRepairPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => { })
}
function cancle(item) {
proxy.$modal.confirm('确定撤销报修吗?').then(() => {
proxy.$modal.loading('加载中')
deviceApi.rejected(item.id).then(async (res) => {
proxy.$modal.closeLoading()
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
await getList()
proxy.$modal.showToast('撤销成功')
}).catch(() => { })
})
}
function previewImage(current, array) {
uni.previewImage({
urls: array,
current: current,
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function (err) {
// console.log(err.errMsg);
}
}
});
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
if (type.value == 'DEVICE') {
uni.setNavigationBarTitle({
title: '设备报修'
})
} else {
uni.setNavigationBarTitle({
title: '模具报修'
})
}
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
min-height: 100vh;
background: #f5f5f5;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.status {
flex: 1;
}
.button {
position: absolute;
right: 0rpx;
}
}
}
}
.images {
display: flex;
width: 100%;
image {
width: 30%;
margin-right: 20rpx;
height: 200rpx;
border-radius: 10rpx;
}
}
</style>

237
src/pages/deviceReport/myDeviceReport.vue

@ -0,0 +1,237 @@
<template>
<!-- 设备报修 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="我的报修">
</u-navbar>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="images">
<image :src="cur" mode="" v-for="(cur,key) in item.filePathList" :key='key'
@click="previewImage(key,item.filePathList)"></image>
</view>
<view class="bottom">
<view class="status">
<u-tag :text="item.result" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471'
type="primary" shape='circle' />
</view>
<!-- <view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.isCancel == 0" @click="cancle(item)">撤销</u-button>
</view> -->
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as deviceApi from "@/api/device.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
flag: 1,
})
const status = ref('loadmore') //
const list = ref([])
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await deviceApi.deviceRepairPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => { })
}
function previewImage(current, array) {
uni.previewImage({
urls: array,
current: current,
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function (err) {
// console.log(err.errMsg);
}
}
});
}
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.list {
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.status {
flex: 1;
}
.button {
position: absolute;
right: 0rpx;
}
}
}
}
.images {
display: flex;
width: 100%;
image {
width: 30%;
margin-right: 20rpx;
height: 200rpx;
border-radius: 10rpx;
}
}
</style>

1
src/pages/index/index.vue

@ -91,6 +91,7 @@ import { useCountStore } from '@/store'
uni.hideLoading()
if (res.menus.length > 0) {
var menus = res.menus.filter(item => item.name == "PDA菜单管理")
console.log(11,menus)
if (menus.length > 0) {
var tab = menus[0].children.filter(res => res.visible == true)
tab.forEach(res => {

163
src/pages/mold/index.vue

@ -0,0 +1,163 @@
<template>
<!-- 设备 -->
<view class="work-container">
<view class="cartNull" v-show="!token">
还没有登录<navigator open-type="navigate" url="/pages/login">先登录</navigator>
</view>
<view class="" v-show='token'>
<Search :searchData='searchData' @search='search' @screen='screen' :isShowScreen='false'/>
<view class="list">
<view class="item" v-for="(item,index) in list" :key='index'>
<u-image :src="item.images" width='160'
height="160">
<template v-slot:error>
<view class="image-error">
<u-icon name="photo" color="#c7c7c7" size="38"></u-icon>
<view style="font-size: 24rpx;">暂无图片</view>
</view>
</template>
</u-image>
<view class="text">
<view class="title">
{{item.name}}
</view>
<view class="dec1">
{{item.number}}
</view>
<view class="dec2">
{{item.factoryAreaName}}
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import {
getAccessToken
} from '@/utils/auth'
import * as moldApi from "@/api/mold.js"
import Search from '../../components/search/index.vue'
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
type: '',
name: ''
})
const status = ref('loadmore') //
const list = ref([])
const token = ref('')
const searchData = ref({
placeholder:'请输入模具名称'
})
//
function search(keyWord) {
params.value.name = keyWord
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
}
function screen() {
proxy.$tab.navigateTo(`/pages/device/screen`)
}
function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
moldApi.moldPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => { })
}
onShow(() => {
if (getAccessToken()) {
token.value = getAccessToken()
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
}
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.work-container{
min-height: 100vh;
background: #f5f5f5;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
.text {
margin-left: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
word-wrap: break-word;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
}
.image-error {
text-align: center;
}
.cartNull {
text-align: center;
padding: 500rpx 40rpx 0;
font-size: 28rpx;
color: #888;
}
.cartNull navigator {
color: #2979ff;
}
</style>

461
src/pages/overhaulOrder/addForm.vue

@ -0,0 +1,461 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="检修描述" prop="describes" required :class="form.id?'disabled':''">
<u-input v-model="form.describes" placeholder="请输入检修描述" :disabled="form&&form.id?true:false" />
</u-form-item>
<u-form-item label="维修工单" prop="maintenanceNumber" :class="form.id?'disabled':''">
<view class="select" @click="openOrder">
<view class="input" v-if='form.maintenanceNumber'>
{{form.maintenanceNumber}}
</view>
<view class="placeholder" v-else>
{{`请选择维修工单`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view>
</u-form-item>
<!-- <u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}名称`" prop="factoryAreaName" required :class="isDisabled?'disabled':''">
<view class="select" @click="openSingleColumn('deviceNumber',form.deviceNumber,deviceList)">
<view class="input" v-if='form.deviceName'>
{{form.deviceName}}
</view>
<view class="placeholder" v-else>
{{`请输入${type=='DEVICE'?'设备' : '模具'}名称`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view>
</u-form-item> -->
<u-form-item label="类型" prop="deviceNumber" required class="disabled">
{{type =='DEVICE'||type == 'TECH'?'设备' : '模具'}}
</u-form-item>
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`" prop="deviceNumber" required
:class="isDisabled?'disabled':''">
<u-input v-model="form.deviceNumber" :placeholder="`请输入${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`"
@blur="blur()" @confirm='blur()'/>
<view class="right-button" @click="chickRightButton" v-show="!isDisabled">
扫描
</view>
</u-form-item>
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`" prop="deviceNumber" required
class="disabled">
<u-input v-model="form.deviceName" :placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`"
disabled />
</u-form-item>
<u-form-item label="所属厂区" prop="factoryAreaName" class="disabled">
<u-input v-model="form.factoryAreaName" placeholder="请输入所属厂区" disabled />
</u-form-item>
<u-form-item label="故障类型" prop="faultType" required>
<view class="select" @click="openSingleColumn('faultType',form.faultType,faultType)">
<view class="input" v-if='form.faultType'>
{{form.faultTypeName}}
</view>
<view class="placeholder" v-else>
{{`请选择故障类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as overhaulOrderApi from "@/api/overhaulOrder.js"
import * as moldApi from "@/api/mold.js"
import * as dictApi from "@/api/dict.js"
import * as repairOrderApi from "@/api/repairOrder.js"
import * as deviceApi from "@/api/device.js"
const { proxy } = getCurrentInstance()
const loading = ref(false)
const type = ref('')
const form = ref({
id: '',
describes: "",
maintenanceNumber: '',
factoryAreaNumber: '',
factoryAreaName: '',
faultType: '',
deviceName: '',
deviceNumber: '',
faultTypeName: ''
})
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const faultType = ref([])
const isDisabled = ref(false)
const choosesingleColumnItem = ref([])
const msg = ref('')
function submit() {
//
if (!form.value.describes) {
proxy.$modal.showToast('请输入故障描述')
return;
}
if (!form.value.deviceNumber) {
proxy.$modal.showToast(`请选择${type.value == 'DEVICE' || type.value == 'TECH' ? '设备' : '模具'}名称`)
return;
}
if (!form.value.deviceName) {
proxy.$modal.showToast(msg.value)
return;
}
if (!form.value.faultType) {
proxy.$modal.showToast('请选择故障类型')
return;
}
const data = {
id: form.value && form.value.id ? form.value.id : '',
describes: form.value.describes,
maintenanceNumber: form.value.maintenanceNumber,
deviceNumber: form.value.deviceNumber,
factoryAreaNumber: form.value.factoryAreaNumber,
type: type.value,
faultType: form.value.faultType,
}
if (form.value.id) {
proxy.$modal.confirm('是否修改检修工单').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
overhaulOrderApi.overhaulOrderUpdate(data).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('修改成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
} else {
proxy.$modal.confirm('是否添加检修工单').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
overhaulOrderApi.overhaulOrderCreate(data).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
}
//
function reset() {
form.value = {
id: '',
describes: "",
maintenanceNumber: '',
factoryAreaNumber:'',
factoryAreaName:'',
faultType: '',
deviceName:'',
deviceNumber:'',
faultTypeName:''
}
isDisabled.value = false
}
//
function openSingleColumn(fieldName, val, list) {
if (fieldName == 'maintenanceNumber' && form.value.id) return;
if (fieldName == 'deviceNumber' && isDisabled.value) return;
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
form.value[field.value] = e[0].value
if (field.value == 'deviceNumber') {
choosesingleColumnItem.value = singleColumnList.value.filter(item => item.number == e[0].value)
form.value.deviceName = choosesingleColumnItem.value[0].name
form.value.factoryAreaName = choosesingleColumnItem.value[0].factoryAreaName
form.value.factoryAreaNumber = choosesingleColumnItem.value[0].factoryAreaNumber
} else if (field.value == 'faultType') {
form.value.faultTypeName = e[0].label
}
singleColumnShow.value = false
}
//
function chickRightButton(field) {
if (!form.value.type) {
proxy.$modal.showToast('请先选择类型')
return;
}
uni.scanCode({
success: function (res) {
form.value.deviceNumber = res.result
getDetailsByNumber()
}
});
}
function blur() {
if (form.value.deviceNumber) {
getDetailsByNumber()
} else {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
}
}
// /
function getDetailsByNumber() {
if (type.value == 'DEVICE' || type.value == 'TECH') {
deviceApi.getDeviceDetailsByNumber({
number: form.value.deviceNumber,
type: type.value
}).then((res) => {
if (!res.data) {
msg.value = res.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
return;
}
form.value.deviceName = res.data.name
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch((error) => {
console.log(error)
msg.value = error.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
})
} else if (type.value == 'MOLD') {
moldApi.getMoldDetailsByNumber({
number: form.value.deviceNumber
}).then((res) => {
console.log(22,res)
if (!res.data) {
msg.value = res.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
return;
}
form.value.deviceName = res.data.name
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch((error) => {
console.log(error)
msg.value = error.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
})
}
}
function openOrder() {
proxy.$tab.navigateTo(`/pages/overhaulOrder/reqairOrderList?type=` + type.value)
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.data) {
let data = JSON.parse(decodeURIComponent(option.data))
form.value = {
id: data.id,
describes: data.describes,
maintenanceNumber: data.maintenanceNumber,
deviceName: data.name,
deviceNumber: data.deviceNumber,
factoryAreaName: data.factoryAreaName,
faultType: data.faultType,
}
isDisabled.value = form.value.maintenanceNumber || form.value.id ? true : false
};
faultType.value = await dictApi.getDict('fault_type')
uni.$on('chooseOrder', data => {
if (data) {
form.value.maintenanceNumber = data.number
form.value.deviceName = data.name
form.value.deviceNumber = data.deviceNumber
form.value.deviceName = data.name
form.value.factoryAreaName = data.factoryAreaName
form.value.factoryAreaNumber = data.factoryAreaNumber
isDisabled.value = true
} else {
form.value.maintenanceNumber = ''
form.value.deviceName = ''
form.value.deviceNumber = ''
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
isDisabled.value = false
}
})
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
image {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
</style>

666
src/pages/overhaulOrder/addServiceRecord.vue

@ -0,0 +1,666 @@
<template>
<!-- 添加检修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="检修描述" prop="name" required>
<u-input v-model="form.name" placeholder="请输入检修描述" maxlength="50" />
</u-form-item>
<u-form-item label="预估人数" prop="peoples" required>
<u-input v-model="form.peoples" type="number" placeholder="请输入预估人数" maxlength="50" />
</u-form-item>
<u-form-item label="预估分钟" prop="estimatedMinutes" required>
<u-input v-model="form.estimatedMinutes" type="number" placeholder="请输入预估分钟" maxlength="50" />
</u-form-item>
<u-form-item label="实际分钟" prop="actualMinutes" required>
<u-input v-model="form.actualMinutes" type="number" placeholder="请输入实际分钟" maxlength="50" />
</u-form-item>
<u-form-item label="责任人" prop="chargePeoples" required>
<view class="select" @click="openSelecUser">
<view class="input" v-if='form.chargePeoples'>
{{selectFormatCheck(form.chargePeoples,selecUserList)}}
</view>
<view class="placeholder" v-else>
请选择维修人员
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="完成情况" prop="status" required>
<view class="select" @click="openSingleColumn('status',form.status,jxDetailsStatus,'form')">
<view class="input" v-if='form.status'>
{{form.statusTxt}}
</view>
<view class="placeholder" v-else>
{{`请选择完成情况`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view>
</u-form-item>
<u-form-item label="完成时间" prop="completionTime" required v-if='form.status === 0||form.status === "0"'>
<view class="select" @click="openDatetime('completionTime',formatDate,params,formatValue)">
<view class="input" v-if='formatDate'>
{{formatDate}}
</view>
<view class="placeholder" v-else>
{{`请选择完成时间`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="未完成原因" prop="uncompleted" required v-if='form.status === 1||form.status === "1"'>
<u-input type='textarea' v-model="form.uncompleted" placeholder="请输入未完成原因" maxlength="200" />
</u-form-item>
<u-form-item label="工程师确认" prop="engineer">
<u-input v-model="form.engineer" placeholder="请输入工程师确认" maxlength="50" />
</u-form-item>
</u-form>
<view class="list">
<view class="title">
<span></span>备件
</view>
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.name}}
</view>
</view>
<u-row gutter="16">
<u-col :span="12">
<view class="dec">
<view class="">
数量:{{item.qty}}
</view>
</view>
</u-col>
</u-row>
</view>
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon>
</view>
<view class="add-btn">
<u-button type="primary" @click="open"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加备件</u-button>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<view class="popup">
<u-form :model="form1" ref="form1Ref" label-width="160rpx">
<u-form-item :label="`备件`" prop="number" required>
<view class="select" @click="openSingleColumn('number',form1.number,sparePartsList,'form1')">
<view class="input" v-if='form1.number'>
{{form1.name}}
</view>
<view class="placeholder" v-else>
请选择备件
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入数量" />
</u-form-item>
</u-form>
</view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>
</view>
</u-popup>
<!-- 选择维修人员 -->
<u-popup v-model="isShowSelecUser" mode="center" border-radius="14">
<view class="popup-title">选择维修人员</view>
<view class="popup">
<u-checkbox-group @change="checkboxGroupChange">
<u-checkbox v-model="item.checked" v-for="(item, index) in selecUserList" :key="index"
:name="item.id">{{item.name}}</u-checkbox>
</u-checkbox-group>
</view>
<view class="popup-footer">
<view @click="isShowSelecUser = false">取消</view>
<view class="sure" @click="chooseUser">确认</view>
</view>
</u-popup>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
<u-picker mode="time" v-model="datetimeShow" :default-time='datetimeDefaultValue' :params="params"
@confirm='chooseDatetime'></u-picker>
</view>
</template>
<script setup lang="ts">
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as overhaulOrderApi from "@/api/overhaulOrder.js"
import * as sparePartsApi from "@/api/spareParts.js"
import * as deptApi from "@/api/dept.js"
import * as dictApi from "@/api/dict.js"
const { proxy} = getCurrentInstance()
const loading = ref(false)
const type = ref('')
//
const isPopupShow = ref(false)
const sparePartsList = ref([])
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const selecUserList = ref([])//
const isShowSelecUser = ref(false)
const jxDetailsStatus = ref([])//
const formatDate = ref('')//
const form = ref({
number: '',
name: '',
peoples: null,
estimatedMinutes: '',
actualMinutes: '',
chargePeoples: '',
status:null,
completionTime: '',
engineer: '',
uncompleted: '',
itemNumbers: []
})
const form1 = ref({
number: "",
name: "",
qty: 0
})
//
const datetimeShow = ref(false)
const params = ref({
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true,
timestamp: true,
})
const datetimeDefaultValue = ref('')
const formatValue = ref('YYYY-MM-DD hh:mm:ss')
const factoryAreaNumber = ref('')
const chooseUserList = ref([])
//
function validateInteger(value){
if (value) {
const integerReg = /^[+]{0,1}(\d+)$/
if (integerReg.test(value)) {
return true
} else {
return false
}
} else {
return false
}
}
//
function submit() {
//
if (!form.value.name) {
proxy.$modal.showToast('请输入检修描述')
return;
}
if (!form.value.peoples || form.value.peoples == 0) {
proxy.$modal.showToast('请输入预估人数')
return;
}
if (!validateInteger(form.value.peoples)) {
proxy.$modal.showToast('预估人数请输入正整数')
return;
}
if (form.value.peoples > 100) {
proxy.$modal.showToast('预估人数不得超出100')
return;
}
if (!form.value.estimatedMinutes || form.value.estimatedMinutes == 0) {
proxy.$modal.showToast(`请输入预估分钟`)
return;
}
if (!validateInteger(form.value.estimatedMinutes)) {
proxy.$modal.showToast('预估分钟请输入正整数')
return;
}
if (!form.value.actualMinutes) {
proxy.$modal.showToast('请输入实际分钟')
return;
}
if (!validateInteger(form.value.actualMinutes)) {
proxy.$modal.showToast('实际分钟请输入正整数')
return;
}
if (!form.value.chargePeoples) {
proxy.$modal.showToast('请选择负责人')
return;
}
if (!form.value.status) {
proxy.$modal.showToast('请选择完成情况')
return;
}
if (form.value.status == 0) {
if (!form.value.completionTime) {
proxy.$modal.showToast('请选择完成时间')
return;
}
}
if (form.value.status == 1) {
if (!form.value.uncompleted) {
proxy.$modal.showToast('请输入未完成原因')
return;
}
}
if (form.value.id) {
proxy.$modal.confirm('是否修改检修内容').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
overhaulOrderApi.overhaulOrderDetailUpdate(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('修改成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
} else {
proxy.$modal.confirm('是否添加检修内容').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
overhaulOrderApi.overhaulOrderDetailCreate(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
}
//
function reset() {
form.value.name = ''
form.value.peoples = null
form.value.estimatedMinutes = ''
form.value.actualMinutes = ''
form.value.chargePeoples = ''
form.value.status = null
form.value.completionTime = ''
form.value.engineer = ''
form.value.uncompleted = ''
form.value.itemNumbers = []
formatDate.value = ''
}
//
async function getSelecUser() {
let data = {
classType: type.value,
factoryAreaNumber: factoryAreaNumber.value,
flag: 0
}
let arr = []
if (form.value.chargePeoples) {
arr = form.value.chargePeoples.split(',')
}
await deptApi.getSelecUser(data).then(res => {
res.data.forEach(item => {
item.checked = false
arr.forEach(cur => {
if (item.id == cur) {
item.checked = true
}
})
})
selecUserList.value = res.data
}).catch(() => { })
}
//
function openSelecUser() {
isShowSelecUser.value = true
}
function checkboxGroupChange(e) {
chooseUserList.value = e
}
//
function selectFormatCheck(val, array) {
const arr = val.split(',').map(Number)
let str = array.filter(item => arr.includes(item.id)).map(item => item.name).join(',')
return str
}
//
function chooseUser() {
form.value.chargePeoples = chooseUserList.value.join(',')
isShowSelecUser.value = false
}
const whichForm = ref()
//
function openSingleColumn(fieldName, val, list, from) {
if (fieldName == 'deviceNumber' && form.value.id) return;
whichForm.value = from
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
if(whichForm.value == 'form'){
form.value[field.value] = e[0].value
if(field.value=='status'){
form.value.statusTxt = e[0].label
formatDate.value = ''
}
}else if(whichForm.value == 'form1'){
form1.value[field.value] = e[0].value
if(field.value=='number'){
form1.value.name = e[0].label
}
}
singleColumnShow.value = false
}
//
async function getSparePartsList() {
await sparePartsApi.getSparePartsList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
sparePartsList.value = res.data
}).catch(() => { })
}
//
function open() {
form1.value = {
number: "",
name:'',
qty: 0
}
isPopupShow.value = true
}
//
function addSpare() {
if (!form1.value.number) {
proxy.$modal.showToast('请选择备件')
return;
}
if (!form1.value.qty || form1.value.qty == 0) {
proxy.$modal.showToast('请输入数量')
return;
}
if (form.value.itemNumbers && form.value.itemNumbers.length > 0) {
let arr = form.value.itemNumbers.filter(item => item.number == form1.value.number)
if (arr && arr.length > 0) {
proxy.$modal.showToast('该备件已添加')
return;
}
}
form.value.itemNumbers.push(form1.value)
isPopupShow.value = false
}
//
function delSpareParts(index) {
form.value.itemNumbers.splice(index, 1)
}
function openDatetime(fieldName, val, params, format) {
params.value = params
formatValue.value = format
field.value = fieldName
form.value[field.value] = val ? val : ''
datetimeDefaultValue.value = val ? val : proxy.$time.formatDate()
datetimeShow.value = true
}
//
function chooseDatetime(e) {
console.log(e)
let array1 = []
let array2 = []
if (formatValue.value.indexOf('YYYY') > -1) {
array1.push(e.year)
}
if (formatValue.value.indexOf('MM') > -1) {
array1.push(e.month)
}
if (formatValue.value.indexOf('DD') > -1) {
array1.push(e.day)
}
if (formatValue.value.indexOf('hh') > -1) {
array2.push(e.hour)
}
if (formatValue.value.indexOf('mm') > -1) {
array2.push(e.minute)
}
if (formatValue.value.indexOf('ss') > -1) {
array2.push(e.second)
}
let str = array1.join('-') + ' ' + array2.join(':')
formatDate.value = str
form.value[field.value] = e.timestamp*1000
console.log(form.value[field.value] )
}
onLoad(async(option) => {
if (option.type) type.value = option.type;
if (option.factoryAreaNumber) factoryAreaNumber.value = option.factoryAreaNumber;
if (option.number) form.value.number = option.number;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) {
form.value = JSON.parse(decodeURIComponent(option.data))
form.value.itemNumbers = form.value.items
formatDate.value = form.value.completionTime ? proxy.$time.formatDate(form.value.completionTime) : ''
form.value.statusTxt = form.value.status == 0 ? '完成' :'未完成'
};
jxDetailsStatus.value = await dictApi.getDict('jx_details_status')
await getSelecUser()
await getSparePartsList()
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0px;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
padding-top: 6rpx;
}
}
.list {
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 60rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

460
src/pages/overhaulOrder/detail.vue

@ -0,0 +1,460 @@
<template>
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>检修工单</view>
</view>
<view class="dec">
<view class="dec-item">
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>维修工单</view>
<view>{{data.maintenanceNumber}}</view>
</view>
<view class="dec-item">
<view>故障类型</view>
<view>{{data.faultTypeName}}</view>
</view>
<view class="dec-item" v-if="data.createTime">
<view>创建时间</view>
<view>{{$time.formatDate(data.createTime)}}</view>
</view>
<view class="dec-item">
<view>检修人员</view>
<view>{{data.maintenanceName}}</view>
</view>
</view>
</view>
<div class="line"></div>
<view class="info" style="padding-bottom: 130rpx;">
<view class="tab">
<u-tabs :list="list" :is-scroll="false" bar-height="2" bar-width="250" v-model="current"
@change="change"></u-tabs>
</view>
<view>
<view class="title">
<view>{{changeItem.name}}</view>
</view>
<view class="dec" v-if="current == 0">
<view class="dec-item">
<view>设备编号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>设备名称</view>
<view>{{data.name}}</view>
</view>
<view class="dec-item">
<view>所属厂区</view>
<view>{{data.factoryAreaName}}</view>
</view>
<view class="dec-item">
<view>设备类型</view>
<view>{{data.type == 'DEVICE'?'设备':data.type == 'TECH'?'工艺':'模具'}}</view>
</view>
</view>
<view class="list" v-if="current == 1">
<view class="item " v-for="(item,index) in serviceList" :key="index"
@click="addSubForm('updata',item)">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.name}}
</view>
<view class="" @click.stop="delService(item)">
<u-icon name="trash" color="#aaaaaa" size="40"></u-icon>
</view>
</view>
<view class="dec2">
<view>预估人数</view>
<view>{{item.peoples}}</view>
</view>
<view class="dec2">
<view>预估分钟</view>
<view>{{item.estimatedMinutes}}分钟</view>
</view>
<view class="dec2">
<view>实际分钟</view>
<view>{{item.actualMinutes}}分钟</view>
</view>
<view class="dec2">
<view>责任人</view>
<view>{{item.chargePeoplesName}}</view>
</view>
<view class="dec2">
<view>完成情况</view>
<view>
{{item.status===0 || item.status === '0'? '完成':item.status===1 ||item.status === '1'?'未完成':''}}
</view>
</view>
<view class="dec2" v-if='item.status === 0 || item.status === "0"'>
<view>完成时间</view>
<view>{{$time.formatDate(item.completionTime)}}</view>
</view>
<view class="dec2">
<view>工程师确认</view>
<view>{{item.engineer}}</view>
</view>
<view class="dec2" v-if="item.status === 1 || item.status === '1'">
<view>未完成原因</view>
<view>{{item.uncompleted}}</view>
</view>
<view class="" v-show="item.items&&item.items.length>0">
<view class="dec2">
备件
</view>
<view class="items" v-for="(cur,key) in item.items" :key="key">
<view class="items-name">
{{cur.name}}
</view>
<view class="items-dec">
备件编号{{cur.number}}
</view>
<view class="items-dec">
数量{{cur.qty}}
</view>
</view>
</view>
</view>
<!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> -->
</view>
<view class="add-btn" v-if="data.status == 'PROCCED'">
<u-button type="primary" @click="addSubForm('creat')"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加检修内容</u-button>
</view>
</view>
</view>
</view>
<view class="footer">
<view class="btns">
<u-button type="primary" v-if="data.status == 'PROCCED'" @click="orderClick()" :loading='loading'
:disabled='loading'>完成</u-button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as overhaulOrderApi from "@/api/overhaulOrder.js"
import { useCountStore } from '@/store'
const { proxy } = getCurrentInstance()
// store
const store = useCountStore()
const list = ref([{
name: '设备信息'
}, {
name: '检修内容'
}])
const current = ref(0)
const changeItem = ref({
name: '设备信息',
value: 1
})
const data = ref()
const loading = ref(false)
const type = ref('')
const serviceList = ref([])
function change(index) {
current.value = index
changeItem.value = list.value[current.value]
}
//
function addSubForm(clickType, item) {
if (data.value.status == 'PENDING') {
proxy.$modal.showToast('请先接单')
return
}
if (clickType == 'updata') {
proxy.$tab.navigateTo(
`/pages/overhaulOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&data=${encodeURIComponent(JSON.stringify(item))}`
)
} else {
proxy.$tab.navigateTo(
`/pages/overhaulOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}`
)
}
}
// APP
function orderClick() {
if (!serviceList.value || serviceList.value && serviceList.value.length == 0) {
proxy.$modal.showToast('请添加检修内容')
return;
}
const paramseData = {
// number: data.number,
// status: data.status,
id: data.value.id,
// requestNumber: ''
}
let tips = '是否完成'
proxy.$modal.confirm(tips).then(() => {
proxy.$modal.loading('加载中')
loading.value = true
overhaulOrderApi.orderClick(paramseData).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function getOverhaulOrderDetailList() {
overhaulOrderApi.overhaulOrderDetailList({
number: data.value.number
}).then((res) => {
if (res.data) {
serviceList.value = res.data
}
}).catch(() => { })
}
//
function delService(item) {
proxy.$modal.confirm('确定删除维修内容吗?').then(() => {
proxy.$modal.loading('加载中')
overhaulOrderApi.overhaulOrderDetailDelete(item.id).then((res) => {
proxy.$modal.closeLoading()
getOverhaulOrderDetailList()
}).catch(() => { })
})
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.data) {
data.value = JSON.parse(decodeURIComponent(option.data))
}
changeItem.value = list.value[current.value]
})
onShow(() => {
getOverhaulOrderDetailList()
})
</script>
<style lang="scss" scoped>
.detail-container {
min-height: 100vh;
background: white;
}
.line {
background: #f5f5f5;
height: 20rpx;
}
.info {
background: white;
}
.tab {
border-bottom: 1px solid #e4e4e4;
}
.title {
display: flex;
align-items: center;
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
view {
&:nth-child(1) {
flex: 1;
border-left: 10rpx solid #409eff;
padding-left: 20rpx;
font-weight: bold;
}
}
}
.dec {
padding: 30rpx;
.dec-item {
padding-bottom: 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 160rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
}
.dec2 {
padding: 10rpx 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 180rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.items {
margin: 20rpx 30rpx;
border-radius: 12rpx;
background: #F5F5F5;
padding-bottom: 20rpx;
.items-name {
padding: 20rpx;
border-bottom: 1px solid #dedede;
}
.items-dec {
padding: 0px 20rpx;
margin-top: 20rpx;
}
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx
}
.popup {
width: 600rpx;
padding: 0rpx 60rpx 0rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
background: white;
z-index: 22;
}
.btns {
display: flex;
padding: 20rpx;
box-shadow: 0px -2rpx 20rpx rgba(0, 0, 0, 0.1);
button {
flex: 1;
margin: 0px 10rpx;
}
.sure {
background: #409eff;
color: white;
border-radius: 8rpx;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
}
.list {
padding: 20rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
border-radius: 12rpx;
border: 1px solid #dedede;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
display: flex;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
flex: 1;
}
}
.dec {
color: #9c9c9c;
padding: 0rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
</style>

234
src/pages/overhaulOrder/index.vue

@ -0,0 +1,234 @@
<template>
<!-- 检修工单 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="检修工单">
<template v-slot:right>
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm"></u-icon>
</template>
</u-navbar>
<!-- <Search @search='search' @screen='screen'/> -->
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" >
<view class="" @click="itemClick(item,index)">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<u-tag text="待接单" v-if="item.status == 'PENDING'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已撤回" v-else-if="item.status=='REJECTED'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle'/>
<u-tag text="已转办" v-else-if="item.status=='TRANSFERRED'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="success" shape='circle'/>
<u-tag text="已接单" v-else-if="item.status=='PECEIVED'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/>
<u-tag text="已验证" v-else-if="item.status=='VERIFIED'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/>
<u-tag text="已完成" v-else-if="item.status=='COMPLETED'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
</view>
<view class="dec">
检修单号:<span>{{item.number}}</span>
</view>
<view class="dec" v-if="item.maintenanceNumber">
维修工单:<span>{{item.maintenanceNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="dec">
故障类型:<span>{{item.faultTypeName}}</span>
</view>
</view>
<view class="bottom">
<view class="time" style="flex: 1;">
{{`${$time.formatDate(item.createTime)}`}}
</view>
<!-- <view class="status">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;" @click="addForm(item)">编辑</u-button>
</view> -->
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as overhaulOrderApi from "@/api/overhaulOrder.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
type: '',
})
const status = ref('loadmore') //
const list = ref([])
function itemClick(item, index) {
proxy.$tab.navigateTo(`/pages/overhaulOrder/detail?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
}
function addForm(item) {
proxy.$tab.navigateTo(`/pages/overhaulOrder/addForm?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await overhaulOrderApi.overhaulOrderPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.button {
position: absolute;
right: 0rpx;
}
}
}
}
</style>

260
src/pages/overhaulOrder/reqairOrderList.vue

@ -0,0 +1,260 @@
<template>
<!-- 维修工单 -->
<view class="container">
<view class="list">
<view class="item" v-for="(item,index) in repairOrderList" :key="index" @click="chooseItem(item)">
<u-checkbox v-model="item.checked" shape="circle" style="margin-top: 8rpx;"></u-checkbox>
<view class="right">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<u-tag text="待接单" v-if="item.status == 'PENDING'" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="已撤回" v-else-if="item.status=='REJECTED'" bg-color='rgba(255,255,255,0)'
color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle' />
<u-tag text="已转办" v-else-if="item.status=='TRANSFERRED'" bg-color='rgba(255,255,255,0)'
color='#e01f54' border-color='#e01f54' type="success" shape='circle' />
<u-tag text="已接单" v-else-if="item.status=='PECEIVED'" bg-color='rgba(255,255,255,0)'
color='#005eaa' border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="已验证" v-else-if="item.status=='VERIFIED'" bg-color='rgba(255,255,255,0)'
color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="已完成" v-else-if="item.status=='COMPLETED'" bg-color='rgba(255,255,255,0)'
color='#2ba471' border-color='#2ba471' type="info" shape='circle' />
</view>
<view class="dec">
工单单号:<span>{{item.number}}</span>
</view>
<view class="dec">
类型:<span>{{item.type=='DEVICE'?'设备':item.type=='TECH'?'工艺':'模具'}}</span>
</view>
<view class="dec">
{{`${type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="dec">
班次:<span>{{item.classesName}}</span>
</view>
<view class="dec">
故障类型:<span>{{item.faultTypeName}}</span>
</view>
</view>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="sure" @click="sure"> 确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as repairOrderApi from "@/api/repairOrder.js"
const { proxy } = getCurrentInstance()
const repairOrderList = ref([])
const type = ref('')
//
function getList() {
proxy.$modal.loading('加载中')
repairOrderApi.repairOrderList({
type: type.value,
result: 'TEMPORARILY'
}).then((res) => {
proxy.$modal.closeLoading()
res.data.forEach(item=>{
item.checked = false
})
repairOrderList.value = res.data
})
}
function chooseItem(item){
let arr = repairOrderList.value.filter(cur=>cur.id != item.id)
arr.forEach(item=>{
item.checked = false
})
item.checked = !item.checked
}
function sure(){
let data =repairOrderList.value.filter(cur=>cur.checked)[0]
uni.$emit('chooseOrder',data)
proxy.$tab.navigateBack()
}
onLoad((option) => {
if (option.type) type.value = option.type;
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
padding-bottom: 120rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
display: flex;
align-items: flex-start;
.right{
flex: 1;
}
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.button {
position: absolute;
right: 0rpx;
}
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
</style>

493
src/pages/repairOrder/addForm.vue

@ -0,0 +1,493 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="故障描述" prop="describes" required>
<u-input v-model="form.describes" placeholder="请输入故障描述" :disabled="form&&form.id?true:false" />
</u-form-item>
<u-form-item label="类型" prop="type" required>
<view class="select" @click="openSingleColumn('type',form.type,appDeviceMoldType)">
<view class="input" v-if='form.type'>
{{form.typeName}}
</view>
<view class="placeholder" v-else>
{{`请选择类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view>
</u-form-item>
<!-- <u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`" prop="deviceNumber" required>
<view class="select" @click="openSingleColumn('deviceNumber',form.deviceNumber,deviceList)">
<view class="input" v-if='form.deviceName'>
{{form.deviceName}}
</view>
<view class="placeholder" v-else>
{{`请输入${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view>
</u-form-item> -->
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`" prop="deviceNumber" required>
<u-input v-model="form.deviceNumber" :placeholder="`请输入${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码`"
@blur="blur()" @confirm='blur()'/>
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item :label="`${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`" prop="deviceNumber" required
class="disabled">
<u-input v-model="form.deviceName" :placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`"
disabled />
</u-form-item>
<u-form-item :label="`厂区编码`" prop="factoryAreaNumber" required class="disabled">
<u-input v-model="form.factoryAreaNumber"
:placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`" disabled />
</u-form-item>
<u-form-item :label="`厂区名称`" prop="factoryAreaName" required class="disabled">
<u-input v-model="form.factoryAreaName"
:placeholder="`根据${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}编码获得`" disabled />
</u-form-item>
<u-form-item label="班次" prop="classes" required>
<view class="select" @click="openSingleColumn('classes',form.classes,maintenanceShift)">
<view class="input" v-if='(form.classes||form.classes==0)&&maintenanceShift.length>0'>
{{form.classesName}}
</view>
<view class="placeholder" v-else>
{{`请选择班次`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="故障类型" prop="classes" required>
<view class="select" @click="openSingleColumn('faultType',form.faultType,faultType)">
<view class="input" v-if='form.faultType'>
{{form.faultTypeName}}
</view>
<view class="placeholder" v-else>
{{`请选择故障类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as deviceApi from "@/api/device.js"
import * as moldApi from "@/api/mold.js"
import * as dictApi from "@/api/dict.js"
import * as repairOrderApi from "@/api/repairOrder.js"
import { useCountStore } from '@/store'
const { proxy } = getCurrentInstance()
// store
const store = useCountStore()
const loading = ref(false)
const appDeviceMoldType = ref([])
const type = ref('')
const form = ref({
id: '',
describes: "",
deviceNumber: '',
deviceName: '',
factoryAreaName: '',
factoryAreaNumber: '',
classes: '',
type: '',
faultType: ''
})
const deviceList = ref([])
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const maintenanceShift = ref([])
const faultType = ref([])
const choosesingleColumnItem = ref()
const msg = ref('')
//
function chickRightButton(field) {
if (!form.value.type) {
proxy.$modal.showToast('请先选择类型')
return;
}
uni.scanCode({
success: function (res) {
form.value.deviceNumber = res.result
getDetailsByNumber()
}
});
}
function blur() {
if (form.value.deviceNumber) {
getDetailsByNumber()
} else {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
}
}
// /
function getDetailsByNumber() {
if (type.value == 'DEVICE' || type.value == 'TECH') {
deviceApi.getDeviceDetailsByNumber({
number: form.value.deviceNumber,
type: type.value
}).then((res) => {
if (!res.data) {
msg.value = res.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
return;
}
form.value.deviceName = res.data.name
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch(() => {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
})
} else if (type.value == 'MOLD') {
moldApi.getMoldDetailsByNumber({
number: form.value.deviceNumber
}).then(res => {
if (!res.data) {
msg.value = res.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
return;
}
form.value.deviceName = res.data.name
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch(() => {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
})
}
}
//
function submit() {
//
if (!form.value.describes) {
proxy.$modal.showToast('请输入故障描述')
return;
}
if (!form.value.deviceNumber) {
proxy.$modal.showToast(`请选择${type.value == 'DEVICE' || type.value == 'TECH' ? '设备' : '模具'}名称`)
return;
}
if (!form.value.deviceName) {
proxy.$modal.showToast(msg.value)
return;
}
if (!form.value.factoryAreaName) {
proxy.$modal.showToast('请输入区域')
return;
}
if (!form.value.classes) {
proxy.$modal.showToast('请选择班次')
return;
}
const data = {
id: form.value && form.value.id ? form.value.id : '',
describes: form.value.describes,
type: form.value.type,
deviceNumber: form.value.deviceNumber,
factoryAreaNumber: form.value.factoryAreaNumber,
classes: form.value.classes,
faultType: form.value.faultType
}
if (form.value.id) {
proxy.$modal.confirm('是否修改维修工单').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
repairOrderApi.repairOrderUpdate(data).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('修改成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
} else {
proxy.$modal.confirm('是否添加维修工单').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
repairOrderApi.repairOrderCreate(data).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
}
//
function reset() {
if (form.value.id) {
form.value.classes = undefined;
form.value.faultType = undefined
} else {
form.value = {}
}
}
//
function openSingleColumn(fieldName, val, list) {
if ((fieldName == 'deviceNumber' || fieldName == 'type') && form.value.id) return;
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
form.value[field.value] = e[0].value
if (field.value == 'deviceNumber') {
choosesingleColumnItem.value = singleColumnList.value.filter(item => item.number == e[0].value)
form.value.factoryAreaName = choosesingleColumnItem.value[0].factoryAreaName
form.value.factoryAreaNumber = choosesingleColumnItem.value[0].factoryAreaNumber
form.value.deviceName = choosesingleColumnItem.value[0].name
}else if(field.value == 'classes'){
form.value.classesName =e[0].label
}else if(field.value == 'faultType'){
form.value.faultTypeName =e[0].label
}else if(field.value == 'type'){
form.value.typeName =e[0].label
}
singleColumnShow.value = false
}
// /
async function getDeviceList() {
if (type.value == 'DEVICE') {
await deviceApi.deviceList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
deviceList.value = res.data
}).catch(() => { })
} else if (type.value == 'MOLD') {
await moldApi.moldList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
deviceList.value = res.data
}).catch(() => { })
}
}
const appDeviceMoldType1 = ref([])
onLoad(async option => {
if (option.type) type.value = option.type;
if (option.data) {
let data = JSON.parse(decodeURIComponent(option.data))
form.value = {
id: data.id,
describes: data.describes,
deviceNumber: data.deviceNumber,
deviceName: data.name,
factoryAreaName: data.factoryAreaName,
factoryAreaNumber: data.factoryAreaNumber,
classes: data.classes || data.classes == 0 ? data.classes : undefined,
faultType: data.faultType,
type: data.type
}
};
await getDeviceList()
maintenanceShift.value = await dictApi.getDict('maintenance_shift')
appDeviceMoldType1.value = await dictApi.getDict('app_device_mold_type')
faultType.value = await dictApi.getDict('fault_type')
if (type.value == 'MOLD') {
appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "MOLD"))
} else {
appDeviceMoldType.value = []
if(store.roles.some(item=>item.indexOf('device')>-1)){
appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "DEVICE"))
}
if(store.roles.some(item=>item.indexOf('tech')>-1)){
appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value == "TECH"))
}
if(store.roles.some(item=>item.indexOf('tech')>-1&&item.indexOf('device')>-1)){
appDeviceMoldType.value = appDeviceMoldType1.value.filter((item => item.value != "MOLD"))
}
}
form.value.type = appDeviceMoldType.value[0].value
form.value.typeName = appDeviceMoldType.value[0].label
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
image {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
</style>

503
src/pages/repairOrder/addServiceRecord.vue

@ -0,0 +1,503 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="故障描述" prop="describes" required>
<u-input v-model="form.describes" placeholder="请输入故障描述" />
</u-form-item>
<u-form-item label="故障真因" prop="describes" required>
<u-input v-model="form.describes1" placeholder="请输入故障真因" />
</u-form-item>
<u-form-item label="解决措施" prop="describes" required>
<u-input type='textarea' v-model="form.workOut" placeholder="请输入解决措施" />
</u-form-item>
<u-form-item label="维修人员" prop="describes" required>
<view class="select" @click="openSelecUser">
<view class="input" v-if='form.maintenances'>
{{selectFormatCheck(form.maintenances,selecUserList)}}
</view>
<view class="placeholder" v-else>
请选择维修人员
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="list">
<view class="title">
<span></span>备件
</view>
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.name}}
</view>
</view>
<u-row gutter="16">
<u-col :span="12">
<view class="dec">
<view class="">
数量:{{item.qty}}
</view>
</view>
</u-col>
</u-row>
</view>
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon>
</view>
<view class="add-btn">
<u-button type="primary" @click="open"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加备件</u-button>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<view class="popup">
<u-form :model="form1" ref="form1Ref" label-width="160rpx">
<u-form-item :label="`备件`" prop="number" required>
<view class="select" @click="openSingleColumn('number',form1.number,sparePartsList)">
<view class="input" v-if='form1.number'>
{{form1.name}}
</view>
<view class="placeholder" v-else>
请选择备件
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入数量" />
</u-form-item>
</u-form>
</view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>
</view>
</u-popup>
<!-- 选择维修人员 -->
<u-popup v-model="isShowSelecUser" mode="center" border-radius="14">
<view class="popup-title">选择维修人员</view>
<view class="popup">
<u-checkbox-group @change="checkboxGroupChange">
<u-checkbox v-model="item.checked" v-for="(item, index) in selecUserList" :key="index"
:name="item.id">{{item.name}}</u-checkbox>
</u-checkbox-group>
</view>
<view class="popup-footer">
<view @click="isShowSelecUser = false">取消</view>
<view class="sure" @click="chooseUser">确认</view>
</view>
</u-popup>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as repairOrderApi from "@/api/repairOrder.js"
import * as sparePartsApi from "@/api/spareParts.js"
import * as deptApi from "@/api/dept.js"
const { proxy } = getCurrentInstance()
const loading = ref(false)
const type = ref('')
const isPopupShow = ref(false)
const sparePartsList = ref([])
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const selecUserList = ref([])
const isShowSelecUser = ref(false)
const form = ref({
number: '',
describes: '',
describes1: '',
workOut: '',
maintenances: '',
itemNumbers: [],
})
const form1 = ref({
number: "",
name:"",
qty: 0
})
const factoryAreaNumber = ref('')
const chooseUserList = ref([])
//
function submit() {
//
if (!form.value.describes) {
proxy.$modal.showToast('请输入故障描述')
return;
}
if (!form.value.describes1) {
proxy.$modal.showToast(`请输入故障真因`)
return;
}
if (!form.value.workOut) {
proxy.$modal.showToast('请输入解决措施')
return;
}
if (!form.value.maintenances) {
proxy.$modal.showToast('请选择维修人员')
return;
}
if (form.value.id) {
proxy.$modal.confirm('是否修改维修内容').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
repairOrderApi.repairOrderDetailUpdate(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('修改成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
} else {
proxy.$modal.confirm('是否添加维修内容').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
repairOrderApi.repairOrderDetailCreate(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
}
//
function reset() {
form.value.describes = ''
form.value.describes1 = ''
form.value.workOut = ''
form.value.maintenances = ''
form.value.itemNumbers = []
}
//
async function getSelecUser() {
let data = {
classType: type.value,
// factoryAreaNumber: factoryAreaNumber.value
}
let arr = []
if (form.value.maintenances) {
arr = form.value.maintenances.split(',')
}
await deptApi.getSelecUser(data).then(res => {
res.data.forEach(item => {
item.checked = false
arr.forEach(cur => {
if (item.id == cur) {
item.checked = true
}
})
})
selecUserList.value = res.data
}).catch(() => { })
}
//
function openSelecUser() {
isShowSelecUser.value = true
}
function checkboxGroupChange(e) {
chooseUserList.value = e
}
//
function selectFormatCheck(val, array) {
const arr = val.split(',').map(Number)
let str = array.filter(item => arr.includes(item.id)).map(item => item.name).join(',')
return str
}
//
function chooseUser() {
form.value.maintenances = chooseUserList.value.join(',')
isShowSelecUser.value = false
}
//
function openSingleColumn(fieldName, val, list) {
if (fieldName == 'deviceNumber' && form.value.id) return;
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
form1.value[field.value] = e[0].value
if(field.value=='number'){
form1.value.name = e[0].label
}
singleColumnShow.value = false
}
//
async function getSparePartsList() {
await sparePartsApi.getSparePartsList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
sparePartsList.value = res.data
}).catch(() => { })
}
//
function open() {
form1.value = {
number: "",
name:'',
qty: 0
}
isPopupShow.value = true
}
//
function addSpare() {
if (!form1.value.number) {
proxy.$modal.showToast('请选择备件')
return;
}
if (!form1.value.qty || form1.value.qty == 0) {
proxy.$modal.showToast('请输入数量')
return;
}
if (form.value.itemNumbers && form.value.itemNumbers.length > 0) {
let arr = form.value.itemNumbers.filter(item => item.number == form1.value.number)
if (arr && arr.length > 0) {
proxy.$modal.showToast('该备件已添加')
return;
}
}
form.value.itemNumbers.push(form1.value)
isPopupShow.value = false
}
//
function delSpareParts(index) {
form.value.itemNumbers.splice(index, 1)
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.factoryAreaNumber) factoryAreaNumber.value = option.factoryAreaNumber;
if (option.number) form.value.number = option.number;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) {
form.value = JSON.parse(decodeURIComponent(option.data))
form.value.itemNumbers = form.value.items
};
await getSelecUser()
await getSparePartsList()
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0px;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
padding-top: 6rpx;
}
}
.list {
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 60rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

792
src/pages/repairOrder/detail.vue

@ -0,0 +1,792 @@
<template>
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>维修工单</view>
<view @click="transfer"
v-if="data.status == 'PECEIVED' && (!serviceList || serviceList && serviceList.length == 0)">转办
</view>
</view>
<view class="dec">
<view class="dec-item">
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>报修描述</view>
<view>{{data.describes}}</view>
</view>
<u-form :model="data" ref="form1" label-width="160rpx"
style="border-top: 1px solid rgba(220,220,220,0.5);border-bottom: 1px solid rgba(220,220,220,0.5);margin-bottom: 20rpx;"
v-if="data.status == 'PECEIVED'">
<u-form-item label="班次" prop="classes" required>
<view class="select" @click="openSingleColumn('classes',data.classes,maintenanceShift)">
<view class="input" v-if='data.classes||data.classes==0'>
{{data.classesName}}
</view>
<view class="placeholder" v-else>
{{`请选择班次`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="故障类型" prop="classes" required>
<view class="select" @click="openSingleColumn('faultType',data.faultType,faultType)">
<view class="input" v-if='data.faultType'>
{{data.faultTypeName}}
</view>
<view class="placeholder" v-else>
{{`请选择故障类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="dec-item" v-if="data.status != 'PECEIVED'">
<view>班次</view>
<view>{{data.classesName}}</view>
</view>
<view class="dec-item" v-if="data.status != 'PECEIVED'">
<view>故障类型</view>
<view>{{data.faultTypeName}}</view>
</view>
<view class="dec-item" v-if="data.createTime">
<view>创建时间</view>
<view>{{$time.formatDate(data.createTime)}}</view>
</view>
<view class="dec-item" v-if="data.creator">
<view>创建人员</view>
<view>{{data.creator}}</view>
</view>
<view class="dec-item" v-if="data.receivingTime">
<view>接单时间</view>
<view>{{$time.formatDate(data.receivingTime)}}</view>
</view>
<view class="dec-item" v-if="data.maintenanceName">
<view>接单人员</view>
<view>{{data.maintenanceName}}</view>
</view>
<view class="dec-item" v-if="data.completionTime">
<view>完成时间</view>
<view>{{$time.formatDate(data.completionTime)}}</view>
</view>
<view class="dec-item" v-if="data.verifyTime">
<view>验证时间</view>
<view>{{$time.formatDate(data.verifyTime)}}</view>
</view>
<view class="dec-item" v-if="data.verifyer">
<view>验证人员</view>
<view>{{data.verifyer}}</view>
</view>
</view>
</view>
<div class="line"></div>
<view class="info" style="padding-bottom: 130rpx;">
<view class="tab">
<u-tabs :list="list" :is-scroll="false" bar-height="2" bar-width="250" v-model="current"
@change="change"></u-tabs>
</view>
<view>
<view class="title">
<view>{{changeItem.name}}</view>
</view>
<view class="dec" v-if="changeItem.value == 1">
<view class="dec-item">
<view>设备编号</view>
<view>{{data.deviceNumber}}</view>
</view>
<view class="dec-item">
<view>设备名称</view>
<view>{{data.name}}</view>
</view>
<view class="dec-item">
<view>所属厂区</view>
<view>{{data.factoryAreaName}}</view>
</view>
<view class="dec-item">
<view>设备类型</view>
<view>{{data.type == 'DEVICE'?'设备':data.type == 'TECH'?'工艺':'模具'}}</view>
</view>
</view>
<view class="dec" v-if="changeItem.value == 2">
<view class="dec-item">
<view>报修单号</view>
<view>{{data1.number}}</view>
</view>
<view class="dec-item">
<view>报修描述</view>
<view>{{data1.describes}}</view>
</view>
<view class="dec-item">
<view>报修人</view>
<view>{{data1.declarName}}</view>
</view>
<view class="dec-item">
<view>报修时间</view>
<view>{{$time.formatDate(data.createTime)}}</view>
</view>
<!-- <view>图片</view> -->
<view class="images">
<image :src="cur" mode="" v-for="(cur,key) in data1.filePathList" :key='key'
@click="previewImage(key,data1.filePathList)"></image>
</view>
</view>
<view class="list" v-if="changeItem.value == 3">
<view class="item " v-for="(item,index) in serviceList" :key="index"
@click.stop="addSubForm('updata',item)">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.describes}}
</view>
<view class="" @click.stop="delService(item)">
<u-icon name="trash" color="#aaaaaa" size="40"
v-if="data.status == 'PENDING' || data.status == 'PECEIVED'"
></u-icon>
</view>
</view>
<view class="dec2">
<view>故障真因</view>
<view>{{item.describes1}}</view>
</view>
<view class="dec2">
<view>解决措施</view>
<view>{{item.workOut}}</view>
</view>
<view class="dec2">
<view>维修人员</view>
<view>{{item.maintenancesName}}</view>
</view>
<view class="" v-show="item.items&&item.items.length>0">
<view class="dec2">
备件
</view>
<view class="items" v-for="(cur,key) in item.items" :key="key">
<view class="items-name">
{{cur.name}}
</view>
<view class="items-dec">
备件编号{{cur.number}}
</view>
<view class="items-dec">
数量{{cur.qty}}
</view>
</view>
</view>
</view>
<!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> -->
</view>
<view class="add-btn"
v-if="data.status == 'PENDING' || data.status == 'PECEIVED'">
<u-button type="primary" @click="addSubForm('creat')"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加维修内容</u-button>
</view>
</view>
</view>
</view>
<view class="footer">
<view class="btns" v-if="data.status == 'PENDING'">
<u-button type="primary" @click="orderClick(1)" :loading='loading' :disabled='loading'>接单</u-button>
</view>
<view class="btns" v-if="data.status == 'PECEIVED'">
<u-button shape="shape" type="warning" style="min-width: 120rpx;" :loading='loading1' @click="editForm"
:disabled='loading1'>修改工单</u-button>
<u-button type="primary" @click="orderClickSuccess()" :loading='loading'
:disabled='loading'>完成</u-button>
</view>
<view class="btns" v-if="data.status == 'COMPLETED'">
<u-button type="primary" @click="orderClick(3)" :loading='loading' :disabled='loading'>验证完结</u-button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 完成类型 -->
<u-popup v-model="isShowSuccess" mode="center" border-radius="14">
<view class="popup-title">完成类型</view>
<view class="popup">
<u-radio-group v-model="result" @change="radioGroupChange">
<u-radio v-for="(item, index) in orderCompleteResult" :key="index" :name="item.value">
{{item.label}}
</u-radio>
</u-radio-group>
</view>
<view class="popup-footer">
<view @click="isShowSuccess = false">取消</view>
<view class="sure" @click="sure">确认</view>
</view>
</u-popup>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as dictApi from "@/api/dict.js"
import * as repairOrderApi from "@/api/repairOrder.js"
import { useCountStore } from '@/store'
const { proxy } = getCurrentInstance()
// store
const store = useCountStore()
const list = ref([{
name: '设备信息',
value: 1
}, {
name: '报修信息',
value: 2
}, {
name: '维修内容',
value: 3
}])
const current = ref(0)
const changeItem = ref({
name: '设备信息',
value: 1
})
const data = ref()
const loading = ref(false)
const loading1 = ref(false)
const type = ref('')
const serviceList = ref([])
const isShowSuccess = ref(false)
const orderCompleteResult = ref([]) //
const result = ref('TEMPORARILY')
const data1 = ref('')
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const maintenanceShift = ref([]) //
const faultType = ref([]) //
function change(index) {
current.value = index
changeItem.value = list.value[current.value]
}
//
function addSubForm(clickType, item) {
if (data.value.status == 'PENDING') {
proxy.$modal.showToast('请先接单')
return
}
if (clickType == 'updata') {
proxy.$tab.navigateTo(
`/pages/repairOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&data=${encodeURIComponent(JSON.stringify(item))}`
)
} else {
proxy.$tab.navigateTo(
`/pages/repairOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}`
)
}
}
//
function orderClickSuccess() {
//
if (data.value.status == 'PECEIVED') {
if (store.id != data.value.maintenance) {
proxy.$modal.showToast('当前人员与接单人员不一致')
return;
}
if (!serviceList.value || serviceList.value && serviceList.value.length == 0) {
proxy.$modal.showToast('请添加维修内容')
return;
}
if (!data.value.classesName || !data.value.faultTypeName) {
proxy.$modal.showToast('请完善班次和故障类型')
return;
}
}
isShowSuccess.value = true
}
function radioGroupChange(e) {
result.value = e
}
function sure() {
isShowSuccess.value = false
orderClick(2)
}
// APP
async function orderClick(type) {
//
// if (this.data.status == 'PENDING') {
// if (this.$store.state.user.dept.parentId != this.data.factoryAreaNumber) {
// this.$modal.showToast('')
// return;
// }
// if (this.$store.state.user.dept.classType != this.data.type) {
// this.$modal.showToast('')
// return;
// }
// }
const dataOne = {
number: data.value.number,
status: data.value.status,
id: data.value.id,
result: type == 2 ? result.value : '',
requestNumber: data.value.requestNumber,
}
//
const dataTwo = {
id: data.value && data.value.id ? data.value.id : '',
describes: data.value.describes,
type: data.value.type,
deviceNumber: data.value.deviceNumber,
factoryAreaNumber: data.value.factoryAreaNumber,
classes: data.value.classes,
faultType: data.value.faultType
}
if(type ==2){
proxy.$modal.loading('加载中')
loading.value = true
//
if (data.value.status == 'PECEIVED') {
await repairOrderApi.repairOrderUpdate(dataTwo).then((res) => { }).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}
await repairOrderApi.orderClick(dataOne).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}else{
let tips = data.value.status == 'PENDING' ? '是否接单?' : data.value.status == 'PECEIVED' ? '是否完成?' : data
.value.status == 'COMPLETED' ? '是否验证完结?' : ''
proxy.$modal.confirm(tips).then(async () => {
proxy.$modal.loading('加载中')
loading.value = true
//
if (data.value.status == 'PECEIVED') {
await repairOrderApi.repairOrderUpdate(dataTwo).then((res) => { }).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}
await repairOrderApi.orderClick(dataOne).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
}
//
function getDeviceRepairDetailsByNumber() {
repairOrderApi.getDeviceRepairDetailsByNumber({
type: data.value.type,
requestNumber: data.value.requestNumber
}).then((res) => {
if (res.data) {
data1.value = res.data
}
}).catch(() => { })
}
//
function getRepairOrderDetaiList() {
repairOrderApi.repairOrderDetailList({
number: data.value.number
}).then((res) => {
if (res.data) {
serviceList.value = res.data
}
}).catch(() => { })
}
//
function delService(item) {
proxy.$modal.confirm('确定删除维修内容吗?').then(() => {
proxy.$modal.loading('加载中')
repairOrderApi.repairOrderDetailDelete(item.id).then((res) => {
proxy.$modal.closeLoading()
getRepairOrderDetaiList()
}).catch(() => { })
})
}
function transfer() {
proxy.$tab.navigateTo(`/pages/repairOrder/transfer?type=${data.value.type}&id=${data.value.id}&deviceNumber=${data.value.deviceNumber}`)
}
function previewImage(current, array) {
uni.previewImage({
urls: array,
current: current,
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function (err) {
console.log(err.errMsg);
}
}
});
}
//
function openSingleColumn(fieldName, val, list) {
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
data.value[field.value] = e[0].value
console.log(field.value)
if (field.value == 'classes') {
data.value.classesName = e[0].label
console.log(data.value.classesName)
}
if (field.value == 'faultType') {
data.value.faultTypeName = e[0].label
}
singleColumnShow.value = false
}
//
function editForm() {
const paramesData = {
id: data.value && data.value.id ? data.value.id : '',
describes: data.value.describes,
type: data.value.type,
deviceNumber: data.value.deviceNumber,
factoryAreaNumber: data.value.factoryAreaNumber,
classes: data.value.classes,
faultType: data.value.faultType
}
proxy.$modal.confirm('是否修改维修工单').then(() => {
proxy.$modal.loading('加载中')
loading1.value = true
repairOrderApi.repairOrderUpdate(paramesData).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('修改成功')
// setTimeout(() => {
// this.$tab.navigateBack()
loading1.value = false
// }, 1500)
} else {
proxy.$modal.showToast('修改失败')
loading1.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.data) {
data.value = JSON.parse(decodeURIComponent(option.data))
}
changeItem.value = list.value[current.value]
orderCompleteResult.value = await dictApi.getDict('order_complete_result')
})
onShow(async () => {
if (data.value.requestNumber) {
getDeviceRepairDetailsByNumber()
list.value = [{
name: '设备信息',
value: 1
}, {
name: '报修信息',
value: 2
}, {
name: '维修内容',
value: 3
}]
} else {
list.value = [{
name: '设备信息',
value: 1
}, {
name: '维修内容',
value: 3
}]
}
getRepairOrderDetaiList()
maintenanceShift.value = await dictApi.getDict('maintenance_shift')
faultType.value = await dictApi.getDict('fault_type')
})
</script>
<style lang="scss" scoped>
.detail-container {
min-height: 100vh;
background: white;
}
.line {
background: #f5f5f5;
height: 20rpx;
}
.info {
background: white;
}
.tab {
border-bottom: 1px solid #e4e4e4;
}
.title {
display: flex;
align-items: center;
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
view {
&:nth-child(1) {
flex: 1;
border-left: 10rpx solid #409eff;
padding-left: 20rpx;
font-weight: bold;
}
}
}
.dec {
padding: 30rpx;
.dec-item {
padding-bottom: 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 160rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
}
.dec2 {
padding: 10rpx 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 160rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.items {
margin: 20rpx 30rpx;
border-radius: 12rpx;
background: #F5F5F5;
padding-bottom: 20rpx;
.items-name {
padding: 20rpx;
border-bottom: 1px solid #dedede;
}
.items-dec {
padding: 0px 20rpx;
margin-top: 20rpx;
}
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx
}
.popup {
width: 600rpx;
padding: 0rpx 60rpx 0rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
background: white;
z-index: 22;
}
.btns {
display: flex;
padding: 20rpx;
box-shadow: 0px -2rpx 20rpx rgba(0, 0, 0, 0.1);
button {
flex: 1;
margin: 0px 10rpx;
}
.sure {
background: #409eff;
color: white;
border-radius: 8rpx;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
}
.list {
padding: 20rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
border-radius: 12rpx;
border: 1px solid #dedede;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
display: flex;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
flex: 1;
}
}
.dec {
color: #9c9c9c;
padding: 0rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
::v-deep .u-radio-group {
display: grid !important;
padding-bottom: 20rpx;
}
.images {
display: flex;
width: 100%;
image {
width: 30%;
margin-right: 20rpx;
height: 200rpx;
border-radius: 10rpx;
}
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
</style>

236
src/pages/repairOrder/index.vue

@ -0,0 +1,236 @@
<template>
<!-- 维修工单 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="维修工单">
<template v-slot:right>
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm"></u-icon>
</template>
</u-navbar>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" >
<view class="" @click="itemClick(item,index)">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<u-tag text="待接单" v-if="item.status == 'PENDING'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已撤回" v-else-if="item.status=='REJECTED'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle'/>
<u-tag text="已转办" v-else-if="item.status=='TRANSFERRED'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="success" shape='circle'/>
<u-tag text="已接单" v-else-if="item.status=='PECEIVED'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/>
<u-tag text="已验证" v-else-if="item.status=='VERIFIED'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/>
<u-tag text="已完成" v-else-if="item.status=='COMPLETED'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
</view>
<view class="dec">
工单单号:<span>{{item.number}}</span>
</view>
<view class="dec">
类型:<span>{{item.type=='DEVICE'?'设备':item.type=='TECH'?'工艺':'模具'}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="dec">
班次:<span>{{item.classesName}}</span>
</view>
<view class="dec">
故障类型:<span>{{item.faultTypeName}}</span>
</view>
</view>
<view class="bottom">
<view class="time" style="flex: 1;">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as repairOrderApi from "@/api/repairOrder.js"
import { useCountStore } from '@/store'
const { proxy } = getCurrentInstance()
// store
const store = useCountStore()
const params = ref({
pageNo: 1,
pageSize: 10,
type: '',
})
const status = ref('loadmore') //
const list = ref([])
function itemClick(item, index) {
proxy.$tab.navigateTo(`/pages/repairOrder/detail?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
}
function addForm(item) {
proxy.$tab.navigateTo(`/pages/repairOrder/addForm?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await repairOrderApi.repairOrderPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.button {
position: absolute;
right: 0rpx;
}
}
}
}
</style>

230
src/pages/repairOrder/myOrder.vue

@ -0,0 +1,230 @@
<template>
<!-- 维修工单 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="维修工单">
</u-navbar>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" >
<view class="">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<u-tag text="待接单" v-if="item.status == 'PENDING'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已撤回" v-else-if="item.status=='REJECTED'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle'/>
<u-tag text="已转办" v-else-if="item.status=='TRANSFERRED'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="success" shape='circle'/>
<u-tag text="已接单" v-else-if="item.status=='PECEIVED'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/>
<u-tag text="已验证" v-else-if="item.status=='VERIFIED'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/>
<u-tag text="已完成" v-else-if="item.status=='COMPLETED'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
</view>
<view class="dec">
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
{{`${item.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${item.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="dec">
班次:<span>{{item.classesName}}</span>
</view>
<view class="dec">
故障类型:<span>{{item.faultTypeName}}</span>
</view>
<view class="dec">
完成时间:<span>{{$time.formatDate(item.completionTime)}}</span>
</view>
</view>
<view class="bottom">
<view class="time" style="flex: 1;">
{{`${$time.formatDate(item.createTime)}`}}
</view>
<!-- <view class="status">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;" @click="addForm(item)">编辑</u-button>
</view> -->
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as repairOrderApi from "@/api/repairOrder.js"
import { useCountStore } from '@/store'
const { proxy } = getCurrentInstance()
// store
const store = useCountStore()
const params = ref({
pageNo: 1,
pageSize: 10,
flag: 1
})
const status = ref('loadmore') //
const list = ref([])
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await repairOrderApi.repairOrderPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.button {
position: absolute;
right: 0rpx;
}
}
}
}
</style>

589
src/pages/repairOrder/transfer.vue

@ -0,0 +1,589 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="转办类型" prop="status" required>
<view class="select" @click="openSingleColumn('status',form.status,tansferType)">
<view class="input" v-if='form.status || form.status == 0'>
{{form.statusTxt}}
</view>
<view class="placeholder" v-else>
{{`请选择转办类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="类型" prop="receiverType" required>
<view class="select" @click="openSingleColumn('receiverType',form.receiverType,deviceMoldType)">
<view class="input" v-if='form.receiverType'>
{{form.receiverTypeTxt}}
</view>
<view class="placeholder" v-else>
{{`请选择类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="厂区名称" prop="factoryAreaNumber" required v-if="form.status==1">
<view class="select"
@click="openSingleColumn('factoryAreaNumber',form.factoryAreaNumber,factoryAreaList)">
<view class="input" v-if='form.factoryAreaNumber'>
{{form.factoryAreaName}}
</view>
<view class="placeholder" v-else>
{{`请选择厂区名称`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item :label="`${form.receiverType=='DEVICE'||form.receiverType == 'TECH'?'设备' : '模具'}编码`" prop="deviceNumber" required
v-if="form.status==0">
<u-input v-model="form.deviceNumber" :placeholder="`请输入${form.receiverType=='DEVICE'||form.receiverType == 'TECH'?'设备' : '模具'}编码`"
@blur="blur()" @confirm='blur()'/>
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item :label="`${form.receiverType=='DEVICE'||form.receiverType == 'TECH'?'设备' : '模具'}名称`" prop="deviceNumber" required
class="disabled" v-if="form.status==0">
<u-input v-model="form.deviceName" :placeholder="`根据${form.receiverType=='DEVICE'||form.receiverType == 'TECH'?'设备' : '模具'}编码获得`"
disabled />
</u-form-item>
<u-form-item label="维修人员" prop="describes" required>
<view class="select" @click="openSelecUser('receiverUserId')">
<view class="input" v-if='form.receiverUserId'>
{{selectFormatRadin(form.receiverUserId,selecUserList)}}
</view>
<view class="placeholder" v-else>
请选择维修人员
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 选择维修人员 -->
<u-popup v-model="isShowSelecUser" mode="center" border-radius="14">
<view class="popup-title">选择维修人员</view>
<view class="popup">
<u-radio-group v-model="form.receiverUserId"
@change="radioGroupChange('receiverUserId',form.receiverUserId,selecUserList)">
<u-radio v-for="(item, index) in selecUserList" :key="index" :name="item.id">
{{item.name}}
</u-radio>
</u-radio-group>
</view>
<view class="popup-footer">
<view @click="isShowSelecUser = false">取消</view>
<view class="sure" @click="chooseUser">确认</view>
</view>
</u-popup>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as deviceApi from "@/api/device.js"
import * as moldApi from "@/api/mold.js"
import * as dictApi from "@/api/dict.js"
import * as repairOrderApi from "@/api/repairOrder.js"
import * as deptApi from "@/api/dept.js"
const { proxy } = getCurrentInstance()
const loading = ref(false)
const type = ref('')
const deviceMoldType = ref([])
const deviceMoldType1 = ref([])
const form = ref({
id: '',
receiverType: "",
receiverTypeTxt: '',
deviceNumber: '',
deviceName: '',
receiverUserId: '',
status: 0,
statusTxt: '设备',
factoryAreaNumber: '',
factoryAreaName: ''
})
const deviceList = ref([])
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
//
const selecUserList = ref([])//
const isShowSelecUser = ref(false)
//
const tansferType = ref([{
value: 0,
label: '设备'
}, {
value: 1,
label: '人员'
}])
const deviceNumber = ref('')//
const factoryAreaList = ref([])
const choosesingleColumnItem = ref([])
const chooseUserInfo = ref({})
//
function submit() {
//
if (!form.value.receiverType) {
proxy.$modal.showToast('请选择类型')
return;
}
if (form.value.status == 0) {
if (!form.value.deviceNumber) {
proxy.$modal.showToast(`请选择${form.value.receiverType == 'DEVICE' || form.value.receiverType == 'TECH' ? '设备' : '模具'}编码`)
return;
}
}
if (!form.value.factoryAreaNumber) {
proxy.$modal.showToast('请选择厂区')
return;
}
if (!form.value.receiverUserId) {
proxy.$modal.showToast('请选择维修人员')
return;
}
const paramsData = {
id: form.value && form.value.id ? form.value.id : '',
receiverType: form.value.receiverType,
deviceNumber: form.value.status == 0 ? form.value.deviceNumber : deviceNumber.value,
receiverUserId: form.value.receiverUserId,
factoryAreaNumber: form.value.factoryAreaNumber,
status: form.value.status,
}
proxy.$modal.confirm('是否转办维修工单').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
repairOrderApi.transfer(paramsData).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('转办成功')
setTimeout(() => {
proxy.$tab.navigateBack(2)
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('转办失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function reset() {
if (form.value.id) {
form.value = {
receiverType: "",
deviceNumber: '',
deviceName: '',
receiverUserId: '',
status: 0,
statusTxt: '设备',
factoryAreaNumber: '',
factoryAreaName: '',
}
form.value.receiverType = deviceMoldType.value[0].value
form.value.receiverTypeTxt = deviceMoldType.value[0].label
selecUserList.value = []
} else {
form.value = {
id: '',
receiverType: "",
deviceNumber: '',
deviceName: '',
receiverUserId: '',
status: 0,
statusTxt: '设备',
factoryAreaNumber: '',
factoryAreaName: '',
}
form.value.receiverType = deviceMoldType.value[0].value
form.value.receiverTypeTxt = deviceMoldType.value[0].label
selecUserList.value = []
}
}
//
function chickRightButton(field) {
if (!form.value.receiverType) {
proxy.$modal.showToast('请先选择类型')
return;
}
uni.scanCode({
success: function (res) {
form.value.deviceNumber = res.result
getDetailsByNumber()
}
});
}
function blur() {
if (form.value.deviceNumber) {
getDetailsByNumber()
} else {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
}
}
// /
function getDetailsByNumber() {
if (form.value.receiverType == 'DEVICE' || form.value.receiverType == 'TECH') {
deviceApi.getDeviceDetailsByNumber({
number: form.value.deviceNumber,
type: form.value.receiverType
}).then(async (res) => {
if (!res.data) {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
selecUserList.value = []
return;
}
form.value.deviceName = res.data.name
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
await getSelecUser()
}).catch(() => {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
selecUserList.value = []
form.value.receiverUserId = ''
})
} else if (form.value.receiverType == 'MOLD') {
moldApi.getMoldDetailsByNumber({
number: form.value.deviceNumber,
}).then(async (res) => {
if (!res.data) {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
selecUserList.value = []
form.value.receiverUserId = ''
return;
}
form.value.deviceName = res.data.name
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
await getSelecUser()
}).catch(() => {
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
selecUserList.value = []
form.value.receiverUserId = ''
})
}
}
//
function openSingleColumn(fieldName, val, list) {
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
form.value[field.value] = e[0].value
if (field.value == 'receiverType') {
form.value.deviceName = ''
form.value.deviceNumber = ''
form.value.receiverUserId = undefined
form.value.receiverTypeTxt = e[0].label
selecUserList.value = []
form.value.receiverUserId = ''
getDeviceList()
} else if (field.value == 'factoryAreaNumber') {
form.value.factoryAreaName = e[0].label
form.value.receiverUserId = ''
getSelecUser()
} else if (field.value == 'status') {
form.value.statusTxt = e[0].label
if (form.value.status == 0) {
deviceMoldType.value = deviceMoldType1.value.filter(item => item.value != type.value)
} else {
deviceMoldType.value = deviceMoldType1.value.filter(item => item.value == type.value)
}
console.log(deviceMoldType.value)
form.value.receiverType = deviceMoldType.value[0].value
form.value.receiverTypeTxt = deviceMoldType.value[0].label
selecUserList.value = []
form.value.receiverUserId = ''
}
singleColumnShow.value = false
}
// /
async function getDeviceList() {
if (form.value.receiverType == 'DEVICE' || form.value.receiverType == 'TECH') {
await deviceApi.deviceList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
deviceList.value = res.data
})
} else if (form.value.receiverType == 'MOLD') {
await moldApi.moldList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
deviceList.value = res.data
})
}
}
//
async function getSelecUser() {
let data = {
classType: form.value.receiverType,
factoryAreaNumber: form.value.factoryAreaNumber,
}
let arr = []
if (form.value.maintenances) {
arr = form.value.maintenances.split(',')
}
await deptApi.getSelecUser(data).then(res => {
res.data.forEach(item => {
item.checked = false
arr.forEach(cur => {
if (item.id == cur) {
item.checked = true
}
})
})
selecUserList.value = res.data
})
}
//
function openSelecUser(fieldName) {
field.value = fieldName
isShowSelecUser.value = true
}
function radioGroupChange(field, e, list) {
chooseUserInfo.value = e
}
//
function selectFormatRadin(val, array) {
let str = array.filter(item => item.id == val)[0].name
return str
}
//
function chooseUser() {
form.value[field.value] = chooseUserInfo.value
isShowSelecUser.value = false
}
//
function getFactoryAreaList() {
deptApi.getFactoryAreaList().then((res) => {
if (res.data && res.data.length > 0) {
res.data.map(item => {
item.value = item.id
item.label = item.name
})
factoryAreaList.value = res.data
} else {
factoryAreaList.value = []
}
}).catch(() => { })
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.id) form.value.id = option.id;
if (option.deviceNumber) deviceNumber.value = option.deviceNumber;
deviceMoldType1.value = await dictApi.getDict('app_device_mold_type')
if (form.value.status == 0) {
deviceMoldType.value = deviceMoldType1.value.filter(item => item.value != type.value)
} else {
deviceMoldType.value = deviceMoldType1.value.filter(item => item.value == type.value)
}
form.value.receiverType = deviceMoldType.value[0].value
form.value.receiverTypeTxt = deviceMoldType.value[0].label
getFactoryAreaList()
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
image {
width: 160rpx;
height: 160rpx;
margin-right: 20rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 60rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-radio-group {
display: grid !important;
}
</style>

24
src/pages/setter/index.vue

@ -76,19 +76,17 @@
})
});
function handleLogout() {
proxy.$modal.confirm('确定注销并退出系统吗?').then(() => {
store.LogOut().then(() => {
// #ifdef H5
uni.reLaunch({
url: '../login/index'
})
// #endif
// #ifdef APP
plus.runtime.quit()
// #endif
}).catch(() => { })
function handlerlogout() {
store.LogOut().then(() => {
// #ifdef H5
uni.reLaunch({
url: '../login/index'
})
// #endif
// #ifdef APP
plus.runtime.quit()
// #endif
}).catch(() => { })
}

226
src/pages/spareParts/index.vue

@ -0,0 +1,226 @@
<template>
<!-- 设备 -->
<view class="work-container">
<view class="cartNull" v-show="!token">
还没有登录<navigator open-type="navigate" url="/pages/login">先登录</navigator>
</view>
<view class="" v-show='token'>
<Search :searchData='searchData' @search='search' @screen='screen' :isShowScreen='false' />
<view class="list">
<view class="item" v-for="(item,index) in list" :key='index'>
<u-image :src="item.images" width='160' height="160">
<template v-slot:error>
<view class="image-error">
<u-icon name="photo" color="#c7c7c7" size="38"></u-icon>
<view style="font-size: 24rpx;">暂无图片</view>
</view>
</template>
</u-image>
<view class="text">
<view class="title">
{{item.name}}
</view>
<view class="dec1">
备件编码{{item.number}}
</view>
<view class="dec2">
总库存{{item.qty}}
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import {
getAccessToken
} from '@/utils/auth'
import * as sparePartsApi from "@/api/spareParts.js"
import Search from '../../components/search/index.vue'
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
type: '',
name: ''
})
const status = ref('loadmore') //
const list = ref([])
const token = ref('')
const searchData = ref({
placeholder:'请输入备件名称'
})
//
function search(keyWord) {
params.value.name = keyWord
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
}
function screen() {
proxy.$tab.navigateTo(`/pages/device/screen`)
}
function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
sparePartsApi.getSparePartsPage(params.value).then((res) => {
proxy.$modal.closeLoading()
console.log(res)
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => { })
}
onShow(() => {
if (getAccessToken()) {
token.value = getAccessToken()
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
}
})
onReachBottom(() => {
getList()
})
// export default {
// components: {
// Search
// },
// data() {
// return {
// searchData: {
// placeholder: ''
// },
// params: {
// pageNo: 1,
// pageSize: 10,
// type: '',
// name: ''
// },
// status: 'loadmore', //
// list: [],
// token: ''
// }
// },
// methods: {
// //
// //
// search(keyWord) {
// this.params.name = keyWord
// this.params.pageNo = 1
// this.list = []
// this.status = 'loadmore'
// this.getList()
// },
// //
// screen() {
// this.$tab.navigateTo(`/pages/spareParts/screen`)
// },
// //
// getList() {
// if (this.status == 'nomore') return;
// this.status = 'loading';
// this.$modal.loading('')
// sparePartsApi.getSparePartsPage(this.params).then((res) => {
// this.$modal.closeLoading()
// if (res.data.list.length > 0) {
// this.list = this.list.concat(res.data.list);
// this.params.pageNo++;
// this.status = 'loadmore'
// } else {
// this.status = 'nomore'
// }
// }).catch(()=>{})
// },
// },
// onShow() {
// if (getAccessToken()) {
// this.token = getAccessToken()
// this.params.pageNo = 1
// this.list = []
// this.status = 'loadmore'
// this.getList()
// }
// },
// onReachBottom() {
// this.getList()
// }
// }
</script>
<style lang="scss" scoped>
.work-container{
min-height: 100vh;
background: #f5f5f5;
}
.list {
padding-bottom: 20rpx;
.item {
margin-top: 20rpx;
background: white;
padding: 30rpx;
display: flex;
align-items: center;
.text {
margin-left: 20rpx;
.title {
font-size: 32rpx;
font-weight: bold;
word-wrap: break-word;
}
.dec1 {
font-size: 28rpx;
margin-top: 16rpx;
color: #acacac;
}
.dec2 {
font-size: 28rpx;
margin-top: 6rpx;
color: #acacac;
}
}
}
}
.image-error {
text-align: center;
}
.cartNull {
text-align: center;
padding: 500rpx 40rpx 0;
font-size: 28rpx;
color: #888;
}
.cartNull navigator {
color: #2979ff;
}
</style>

495
src/pages/sparePartsApplication/addForm.vue

@ -0,0 +1,495 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="申请主题" prop="name" required>
<u-input v-model="form.name" placeholder="请输入申请主题" />
</u-form-item>
</u-form>
<view class="list">
<view class="title">
<span>*</span>申请备件
</view>
<view class="item " v-for="(item,index) in form.subList" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.name}}
</view>
</view>
<u-row gutter="16">
<u-col :span="24">
<view class="dec" v-if="item.type">
类型:{{`${item.type=='DEVICE'?'设备' :item.type=='MOLD'?'模具' : ''}`}}
</view>
</u-col>
<u-col :span="24">
<view class="dec" v-if="item.deviceName">
{{`${item.type=='DEVICE'?'设备' : '模具'}`}}:{{item.deviceName}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
是否以旧换新:{{item.isRadeIn=='TRUE'?'是' :'否'}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
库存:{{item.currentQty}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
数量:{{item.qty}}
</view>
</u-col>
</u-row>
</view>
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon>
</view>
<view class="add-btn">
<u-button type="primary" @click="open"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加备件</u-button>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<view class="popup">
<u-form :model="form1" ref="form1Ref" label-width="200rpx">
<u-form-item :label="`备件`" prop="number" required>
<view class="select" @click="openSingleColumn('itemNumber',form1.itemNumber,sparePartsList)">
<view class="input" v-if='form1.itemNumber'>
{{form1.name}}
</view>
<view class="placeholder" v-else>
请选择备件
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="类型" prop="type">
<view class="select" @click="openSingleColumn('type',form1.type,deviceMoldType)">
<view class="input" v-if='form1.type'>
{{form1.typeName}}
</view>
<view class="placeholder" v-else>
{{`请选择类型`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item :label="`${form1.type=='DEVICE'?'设备' : '模具'}`" prop="deviceNumber">
<view class="select" @click="openSingleColumn('deviceNumber',form1.deviceNumber,deviceList)">
<view class="input" v-if='form1.deviceNumber'>
{{form1.deviceName}}
</view>
<view class="placeholder" v-else>
{{`请选择${form1.type=='DEVICE'?'设备' : '模具'}`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="是否以旧换新" prop="isRadeIn" required class="disabled">
<u-radio-group v-model="form1.isRadeIn" :key="updataKey" disabled>
<u-radio :name="'TRUE'"></u-radio>
<u-radio :name="'FALSE'"></u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="库存" prop="currentQty" required class="disabled">
<u-input v-model="form1.currentQty" type="number" disabled placeholder="请输入库存" />
</u-form-item>
<u-form-item label="数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入数量" />
</u-form-item>
</u-form>
</view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>
</view>
</u-popup>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as sparePartsApplicationApi from "@/api/sparePartsApplication.js"
import * as sparePartsApi from "@/api/spareParts.js"
import * as deviceApi from "@/api/device.js"
import * as dictApi from "@/api/dict.js"
import * as moldApi from "@/api/mold.js"
const { proxy } = getCurrentInstance()
const loading = ref(false)
const type = ref('')
//
const isPopupShow = ref(false)
const sparePartsList = ref([])
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const deviceList = ref([])//
const choosesingleColumnItem = ref([])
const form = ref({
name: '',
subList: []
})
const form1 = ref({
itemNumber: undefined,
type: '',
deviceNumber: undefined,
isRadeIn: '',
currentQty: '',
qty: ''
})
const deviceMoldType = ref([])//
const updataKey = ref(0)
//
function submit() {
//
if (!form.value.name) {
proxy.$modal.showToast('请输入主题')
return;
}
if (form.value.subList.length === 0) {
proxy.$modal.showToast('请选择备件')
return;
}
proxy.$modal.confirm('是否添加备件申请').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
sparePartsApplicationApi.sparePartsApplicationCreate(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function reset() {
form.value = {
name: '',
subList: []
}
}
//
function openSingleColumn(fieldName, val, list) {
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
form1.value[field.value] = e[0].value
if (field.value == 'itemNumber') {
form1.value.name = e[0].label
choosesingleColumnItem.value = singleColumnList.value.filter(item => item.number == e[0].value)
form1.value.isRadeIn = choosesingleColumnItem.value[0].isRadeIn
form1.value.currentQty = choosesingleColumnItem.value[0].qty
updataKey.value++
}
if (field.value == 'type') {
form1.value.typeName = e[0].label
form1.value.deviceNumber = ''
form1.value.deviceName = ''
}
if (field.value == 'deviceNumber') {
form1.value.deviceName = e[0].label
}
getApplyDeviceList()
singleColumnShow.value = false
}
//
async function getApplySparePartsList() {
await sparePartsApi.getApplySparePartsList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
sparePartsList.value = res.data
}).catch(() => { })
}
//
async function getApplyDeviceList() {
if (form1.value.type == 'DEVICE') {
await deviceApi.getApplyDeviceList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
deviceList.value = res.data
}).catch(() => { })
} else if (form1.value.type == 'MOLD') {
moldApi.getApplyMoldList().then((res) => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
deviceList.value = res.data
}).catch(() => { })
}
}
//
function open() {
form1.value = {
itemNumber: undefined,
type: '',
deviceNumber: undefined,
isRadeIn: '',
currentQty: "",
qty: '',
}
isPopupShow.value = true
}
//
function addSpare() {
if (!form1.value.itemNumber) {
proxy.$modal.showToast('请选择备件')
return;
}
// if (!this.form1.deviceNumber) {
// this.$modal.showToast('')
// return;
// }
if (!form1.value.qty || form1.value.qty == 0) {
proxy.$modal.showToast('请输入数量')
return;
}
if (form1.value.qty > form1.value.currentQty) {
proxy.$modal.showToast('数量不可以大于库存')
return;
}
if (form.valuesubList && form.value.subList.length > 0) {
let arr = form.value.subList.filter(item => item.itemNumber == form1.value.itemNumber)
if (arr && arr.length > 0) {
proxy.$modal.showToast('该备件已添加')
return;
}
}
form.value.subList.push(form1.value)
isPopupShow.value = false
}
//
function delSpareParts(index) {
form.value.subList.splice(index, 1)
}
onLoad(async (option) => {
if (option.type)type.value = option.type;
if (option.number) form.value.maintenanceNumber = option.number;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) {
form.value = JSON.parse(decodeURIComponent(option.data))
form.value.subList = form.value.subList
};
deviceMoldType.value = await dictApi.getDict('device_mold_type')
await getApplySparePartsList()
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0rpx;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
top: 19px;
}
}
.list {
padding: 0rpx 30rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 0rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

307
src/pages/sparePartsApplication/detail.vue

@ -0,0 +1,307 @@
<template>
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>备件申领工单</view>
</view>
<view class="dec">
<view class="dec-item">
<view>申请主题</view>
<view>{{data.name}}</view>
</view>
<view class="dec-item">
<view>申请单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>申请备件</view>
</view>
<view class="items" v-for="(cur,key) in data.subList" :key="key" style="margin-bottom: 20rpx;">
<view class="items-name">
备件名称{{cur.itemName}}
</view>
<view class="items-dec" v-if="cur.type">
类型{{cur.type == 'type'?'设备' :'模具'}}
</view>
<view class="items-dec" v-if="cur.name">
{{cur.type == 'type'?'设备' :'模具'}}名称{{cur.name}}
</view>
<view class="items-dec">
是否以旧换新{{cur.isRadeIn == 'TRUE'?'是' :'否'}}
</view>
<view class="items-dec">
数量{{cur.qty}}
</view>
</view>
</view>
</view>
<view class="footer" v-if="from == 3">
<view class="btns">
<button class="reset" @click="reject">驳回</button>
<button class="sure" @click="agree" :loading='loading' :disabled='loading'>通过</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as sparePartsApplicationApi from "@/api/sparePartsApplication.js"
import * as sparePartsApplicationApproveApi from "@/api/sparePartsApplicationApprove.js"
const { proxy } = getCurrentInstance()
const number = ref('')
const data = ref({})
const loading = ref(false)
const from = ref()//13
const type = ref()
function getSparePartsApplicationDetail() {
sparePartsApplicationApi.sparePartsApplicationDetail(number.value).then((res) => {
data.value = res.data
}).catch(() => { })
}
//
function agree() {
proxy.$modal.confirm('确定通过申请吗').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
sparePartsApplicationApproveApi.sparePartsApplicationAgree(data.value.id).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('审核成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('审核失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function reject(item) {
proxy.$modal.confirm('确定驳回申请吗?').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
sparePartsApplicationApproveApi.sparePartsApplicationReject(item.id).then(async (res) => {
if (res.data) {
proxy.$modal.showToast('已驳回')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('审核失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
onLoad((option) => {
if (option.type) type.value = option.type;
if (option.from) from.value = option.from;
if (option.number) {
number.value = option.number
}
})
onShow(() => {
getSparePartsApplicationDetail()
})
</script>
<style lang="scss" scoped>
.detail-container {
min-height: 100vh;
background: white;
}
.line {
background: #f5f5f5;
height: 20rpx;
}
.info {
background: white;
}
.tab {
border-bottom: 1px solid #e4e4e4;
}
.title {
display: flex;
align-items: center;
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
view {
&:nth-child(1) {
flex: 1;
border-left: 10rpx solid #409eff;
padding-left: 20rpx;
font-weight: bold;
}
}
}
.dec {
padding: 30rpx;
.dec-item {
padding-bottom: 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 160rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
}
.dec2 {
padding: 10rpx 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 180rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.items {
border-radius: 12rpx;
background: #F5F5F5;
padding-bottom: 20rpx;
.items-name {
padding: 20rpx;
border-bottom: 1px solid #dedede;
}
.items-dec {
padding: 0px 20rpx;
margin-top: 20rpx;
}
}
.list {
padding: 20rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
border-radius: 12rpx;
border: 1px solid #dedede;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
display: flex;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
flex: 1;
}
}
.dec {
color: #9c9c9c;
padding: 0rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
</style>

183
src/pages/sparePartsApplication/index.vue

@ -0,0 +1,183 @@
<template>
<!-- 备件领用申请 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="备件领用申请">
<template v-slot:right>
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm"></u-icon>
</template>
</u-navbar>
<!-- <Search @search='search' @screen='screen' /> -->
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)">
<view class="title">
<view class="title-txt">
{{item.name}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
申请单号:<span>{{item.number}}</span>
</view>
<view class="dec">
:<span>{{item.applyName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9'
border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa'
border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7'
border-color='#d7d7d7 ' type="warning" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.status==0" @click="cancle(item)">撤回</u-button>
</view>
</view>
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as sparePartsApplicationApi from "@/api/sparePartsApplication.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
type: '',
})
const status = ref('loadmore') //
const list = ref([])
function openDetail(item, index) {
proxy.$tab.navigateTo(`/pages/sparePartsApplication/detail?number=${item.number}`)
}
function addForm(item) {
proxy.$tab.navigateTo(`/pages/sparePartsApplication/addForm`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await sparePartsApplicationApi.sparePartsApplicationPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
//
function cancle(item) {
proxy.$modal.confirm('确定撤回申请吗?').then(() => {
proxy.$modal.loading('加载中')
sparePartsApplicationApi.sparePartsApplicationCancle(item.id).then(async (res) => {
proxy.$modal.closeLoading()
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
await getList()
proxy.$modal.showToast('撤回成功')
}).catch(()=>{})
})
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

170
src/pages/sparePartsApplication/mySparePartsApplication.vue

@ -0,0 +1,170 @@
<template>
<!-- 备件领用申请 -->
<view class="container">
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)">
<view class="title">
<view class="title-txt">
{{item.name}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
申请单号:<span>{{item.number}}</span>
</view>
<view class="dec">
:<span>{{item.applyName}}</span>
</view>
<view class="dec" v-if="item.status!=0">
审批时间:<span>{{`${$time.formatDate(item.approveTime)}`}}</span>
</view>
<view class="dec" v-if="item.status!=0">
:<span>{{item.approveName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9'
border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa'
border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7'
border-color='#d7d7d7 ' type="warning" shape='circle' />
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as sparePartsApplicationApi from "@/api/sparePartsApplication.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
flag:null
})
const status = ref('loadmore') //
const list = ref([])
function openDetail(item, index) {
proxy.$tab.navigateTo(`/pages/sparePartsApplication/detail?number=${item.number}`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await sparePartsApplicationApi.sparePartsApplicationPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
onLoad((option) => {
if (option.flag) params.value.flag = option.flag;
if(params.value.flag == 2){
uni.setNavigationBarTitle({
title:'领用申请审批'
})
}
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

199
src/pages/sparePartsApplicationApprove/index.vue

@ -0,0 +1,199 @@
<template>
<!-- 备件领用申请审批 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="领用申请审批">
</u-navbar>
<!-- <Search @search='search' @screen='screen' /> -->
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)">
<view class="title">
<view class="title-txt">
{{item.name}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
申请单号:<span>{{item.number}}</span>
</view>
<view class="dec">
:<span>{{item.applyName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9'
border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa'
border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7'
border-color='#d7d7d7 ' type="warning" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" size="mini" style="min-width: 120rpx;"
v-if="item.status==0" @click="reject(item)">驳回</u-button>
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;margin-left: 20rpx;"
v-if="item.status==0" @click="agree(item)">通过</u-button>
</view>
</view>
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as sparePartsApplicationApproveApi from "@/api/sparePartsApplicationApprove.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
type: '',
})
const status = ref('loadmore') //
const list = ref([])
const from = ref('')
function openDetail(item, index) {
console.log(from.value)
proxy.$tab.navigateTo(`/pages/sparePartsApplication/detail?number=${item.number}&from=${from.value}`)
}
function addForm(item) {
proxy.$tab.navigateTo(`/pages/sparePartsApplication/addForm`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await sparePartsApplicationApproveApi.sparePartsApplicationApprovePage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
//
function agree(item) {
proxy.$modal.confirm('确定通过申请吗?').then(() => {
proxy.$modal.loading('加载中')
sparePartsApplicationApproveApi.sparePartsApplicationAgree(item.id).then(async (res) => {
proxy.$modal.closeLoading()
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
await getList()
proxy.$modal.showToast('审核成功')
})
}).catch(()=>{})
}
//
function reject(item) {
proxy.$modal.confirm('确定驳回申请吗?').then(() => {
proxy.$modal.loading('加载中')
sparePartsApplicationApproveApi.sparePartsApplicationReject(item.id).then(async (res) => {
proxy.$modal.closeLoading()
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
await getList()
proxy.$modal.showToast('已驳回')
}).catch(()=>{})
})
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
if (option.from)from.value = option.from;
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

170
src/pages/sparePartsApplicationApprove/mySparePartsApplicationApprove.vue

@ -0,0 +1,170 @@
<template>
<!-- 备件领用申请 -->
<view class="container">
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="openDetail(item)">
<view class="title">
<view class="title-txt">
{{item.name}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
申请单号:<span>{{item.number}}</span>
</view>
<view class="dec">
:<span>{{item.applyName}}</span>
</view>
<view class="dec" v-if="item.status!=0">
审批时间:<span>{{`${$time.formatDate(item.approveTime)}`}}</span>
</view>
<view class="dec" v-if="item.status!=0">
:<span>{{item.approveName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9'
border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa'
border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7'
border-color='#d7d7d7 ' type="warning" shape='circle' />
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as sparePartsApplicationApproveApi from "@/api/sparePartsApplicationApprove.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
flag:''
})
const status = ref('loadmore') //
const list = ref([])
function openDetail(item) {
proxy.$tab.navigateTo(`/pages/sparePartsApplication/detail?number=${item.number}&from=1`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await sparePartsApplicationApproveApi.sparePartsApplicationApprovePage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
onLoad((option) => {
if (option.flag) params.value.flag = option.flag;
if(params.value.flag == 2){
uni.setNavigationBarTitle({
title:'领用申请审批'
})
}
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

494
src/pages/sparePartsServiceWorkOrderList/addForm.vue

@ -0,0 +1,494 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<!-- <u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="申请主题" prop="name" required>
<u-input v-model="form.name" placeholder="请输入申请主题" />
</u-form-item>
</u-form> -->
<view class="list">
<view class="title">
<span>*</span>申请备件
</view>
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.name}}
</view>
</view>
<u-row gutter="16">
<u-col :span="24">
<view class="dec">
库位:{{item.locationNumber}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
数量:{{item.qty}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
维修结果:{{item.result == 'YES'?'完成':'未完成'}}
</view>
</u-col>
<u-col :span="24">
<view class="dec">
维修原因:{{item.reasons}}
</view>
</u-col>
</u-row>
</view>
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon>
</view>
<view class="add-btn">
<u-button type="primary" @click="open"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加备件</u-button>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<view class="popup">
<u-form :model="form1" ref="formRef" label-width="200rpx">
<u-form-item :label="`备件`" prop="itemNumber" required>
<view class="select" @click="openSingleColumn('itemNumber',form1.itemNumber,sparePartsList)">
<view class="input" v-if='form1.itemNumber'>
{{form1.name}}
</view>
<view class="placeholder" v-else>
请选择备件
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="库位" prop="locationNumber" required v-if="isShow">
<u-input v-model="form1.locationNumber" placeholder="请输入库位" @blur="blur()" @confirm='blur()'/>
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item label="数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入数量" />
</u-form-item>
<u-form-item label="维修结果" prop="reasons" required>
<u-radio-group v-model="form1.result">
<u-radio :name="item.value" v-for="(item,index) in result"
:key="index">{{item.label}}</u-radio>
</u-radio-group>
</u-form-item>
<u-form-item label="维修原因" prop="reasons" required>
<u-input v-model="form1.reasons" placeholder="请输入维修原因" />
</u-form-item>
</u-form>
</view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>
</view>
</u-popup>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as sparePartsApi from "@/api/spareParts.js"
import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList.js"
import * as dictApi from "@/api/dict.js"
import * as locationApi from "@/api/location.js"
const { proxy } = getCurrentInstance()
const loading = ref(false)
const type = ref('')
//
const isPopupShow = ref(false)
const sparePartsList = ref([])
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const form = ref({
itemNumbers: []
})
const form1 = ref({
itemNumber: "",
qty: '',
result: 'YES',
reasons: '',
locationNumber: '',
areaNumber: ''
})
const result = ref([])
const isShow = ref(false)
const choosesingleColumnItem = ref()
const isInAccount = ref()
const itemNumber = ref()
const msg = ref('')
//
function submit() {
//
if (form.value.itemNumbers == 0) {
proxy.$modal.showToast('请选择备件')
return;
}
proxy.$modal.confirm('是否添加备件维修工单').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
sparePartsServiceWorkOrderListApi.sparePartsServiceWorkOrderListCreate(form.value).then((
res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function reset() {
form.value = {
itemNumbers: []
}
}
//
function openSingleColumn(fieldName, val, list) {
if (fieldName == 'deviceNumber' && form.value.id) return;
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
form1.value[field.value] = e[0].value
if (field.value == 'itemNumber') {
choosesingleColumnItem.value = singleColumnList.value.filter(item => item.number == e[0].value)
form1.value.name = e[0].label
form1.value.locationNumber = choosesingleColumnItem.value[0].locationNumber
form1.value.areaNumber = choosesingleColumnItem.value[0].areaNumber
if (!choosesingleColumnItem.value[0].locationNumber) {
isShow.value = true
} else {
isShow.value = false
itemNumber.value = ''
}
}
singleColumnShow.value = false
}
//
async function getServiceSparePartsList() {
await sparePartsApi.getServiceSparePartsList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
sparePartsList.value = res.data
}).catch(() => { })
}
//
function chickRightButton(field) {
uni.scanCode({
success: function (res) {
form1.value.locationNumber = res.result
getLocation()
}
});
}
function getLocation() {
locationApi.getLocation(form1.value.locationNumber).then(res => {
if (!res.data) {
msg.value = res.msg ? res.msg : '找不到该库位'
proxy.$modal.showToast(msg.value)
form1.value.areaNumber =''
isInAccount.value = ''
itemNumber.value = ''
return;
}
msg.value = ''
form1.value.areaNumber = res.data.areaNumber;
isInAccount.value = res.data.isInAccount
itemNumber.value = res.data.itemNumber
}).catch(() => { })
}
function blur() {
if (form1.value.locationNumber) {
getLocation()
}
}
//
function open() {
form1.value = {
itemNumber: "",
qty: '',
result: 'YES',
reasons: '',
locationNumber: '',
areaNumber: ''
}
isPopupShow.value = true
}
//
function addSpare() {
//
if (!form1.value.itemNumber) {
proxy.$modal.showToast('请选择备件')
return;
}
if (!form1.value.locationNumber) {
proxy.$modal.showToast('请扫描库位')
return;
}
if(msg.value){
proxy.$modal.showToast(msg.value)
return;
}
if (isInAccount.value == 'TRUE') {
proxy.$modal.showToast('该库位属于帐内库,请选择帐外库')
return;
}
if (itemNumber.value) {
proxy.$modal.showToast('该库位已绑定过备件')
return;
}
if (!form1.value.qty) {
proxy.$modal.showToast(`请输入数量`)
return;
}
if (!form1.value.result) {
proxy.$modal.showToast('请选择维修结果')
return;
}
if (!form1.value.reasons) {
proxy.$modal.showToast('请输入维修原因')
return;
}
if (form.value.itemNumbers && form.value.itemNumbers.length > 0) {
let arr = form.value.itemNumbers.filter(item => item.itemNumber == form1.value.itemNumber)
if (arr && arr.length > 0) {
proxy.$modal.showToast('该备件已添加')
return;
}
}
if (form.value.itemNumbers && form.value.itemNumbers.length > 0) {
let arr1 = form.value.itemNumbers.filter(item => item.locationNumber == form1.value.locationNumber)
if (arr1 && arr1.length > 0) {
proxy.$modal.showToast('该库位已经绑定备件')
return;
}
}
form.value.itemNumbers.push(form1.value)
isPopupShow.value = false
}
//
function delSpareParts(index) {
form.value.itemNumbers.splice(index, 1)
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
result.value = await dictApi.getDict('result')
await getServiceSparePartsList()
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0rpx;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
top: 19px;
}
}
.list {
padding: 0rpx 30rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 0rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

176
src/pages/sparePartsServiceWorkOrderList/mySparePartsService.vue

@ -0,0 +1,176 @@
<template>
<!-- 备件领用申请 -->
<view class="container">
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index">
<view class="title">
<view class="title-txt">
{{item.itemName}}
</view>
<view class="time">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
<view>申请单号</view><view>{{item.number}}</view>
</view>
<view class="dec">
<view>备件单号</view><view>{{item.itemNumber}}</view>
</view>
<view class="dec">
<view>数量</view><view>{{item.qty}}</view>
</view>
<view class="dec">
<view>维修结果</view><view>{{item.result == 'YES'?'完成':'未完成'}}</view>
</view>
<view class="dec">
<view>维修原因</view><view>{{item.reasons}}</view>
</view>
<!-- <view class="bottom">
<view class="status">
<u-tag text="待审批" v-if="item.status==0" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="审批通过" v-else-if="item.status==1" bg-color='rgba(255,255,255,0)' color='#2EC7C9'
border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="审批驳回" v-else-if="item.status==2" bg-color='rgba(255,255,255,0)' color='#e01f54'
border-color='#e01f54' type="success" shape='circle' />
<u-tag text="出库中" v-else-if="item.status==3" bg-color='rgba(255,255,255,0)' color='#005eaa'
border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="完成" v-else-if="item.status==4" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="info" shape='circle' />
<u-tag text="撤单" v-else-if="item.status==5" bg-color='rgba(255,255,255,0)' color='#d7d7d7'
border-color='#d7d7d7 ' type="warning" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.status==0" @click="cancle(item)">撤回</u-button>
</view>
</view> -->
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
flag:null
})
const status = ref('loadmore') //
const list = ref([])
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await sparePartsServiceWorkOrderListApi.sparePartsServiceWorkOrderListPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
position: relative;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
display: flex;
align-items: center;
view {
&:nth-child(1){
width: 160rpx;;
}
&:nth-child(2){
color: #999999;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
height: 90rpx;
}
}
}
</style>

358
src/pages/spotCheckOrder/addForm.vue

@ -0,0 +1,358 @@
<template>
<!-- 添加设备报修 -->
<view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="点检描述" prop="describes" required>
<u-input v-model="form.describes" placeholder="请输入点检描述" />
</u-form-item>
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}编码`" prop="deviceNumber" required>
<u-input v-model="form.deviceNumber"
:placeholder="`请输入${type=='DEVICE'?'设备' : '模具'}编码`" @blur="blur" @confirm='blur()'/>
<view class="right-button" @click="chickRightButton">
扫描
</view>
</u-form-item>
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}名称`" prop="deviceName" required class="disabled">
<u-input v-model="form.deviceName" :placeholder="`请输入${type=='DEVICE'?'设备' : '模具'}名称`" disabled />
</u-form-item>
<u-form-item label="点检人" prop="name" required class="disabled">
<u-input v-model=" store.name" placeholder="请输入点检人" disabled />
</u-form-item>
<u-form-item label="班次" prop="classes" required>
<view class="select" @click="openSingleColumn('classes',form.classes,maintenanceShift)">
<view class="input" v-if='form.classes'>
{{form.classesName}}
</view>
<view class="placeholder" v-else>
{{`请选择班次`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
</u-form>
<view class="list">
<!-- <view class="title">
<span></span>备件
</view> -->
<view class="item " v-for="(item,index) in subList" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.name}}
</view>
</view>
<u-row gutter="16">
<u-col :span="12">
<view class="dec">
<view class="">
设备部位名称:
</view>
<view>{{item.equipmentParts}}</view>
</view>
<view class="dec">
<view style="margin-right: 20rpx;">是否符合:</view><u-switch v-model="item.isConform1"></u-switch>
</view>
</u-col>
</u-row>
</view>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
</view>
</template>
<script setup lang="ts">
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as deviceApi from "@/api/device.js"
import * as spotCheckOrderApi from "@/api/spotCheckOrder.js"
import * as dictApi from "@/api/dict.js"
import { useCountStore } from '@/store'
const { proxy } = getCurrentInstance()
// store
const store = useCountStore()
const loading = ref(false)
const type = ref('')
const form = ref({
describes: "",
deviceNumber: '',
deviceName: '',
maintenances:'',
classes: '',
classesName:''
})
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const maintenanceShift = ref([])
const subList = ref([])
//
function chickRightButton(field) {
uni.scanCode({
success: function(res) {
form.value.deviceNumber = res.result
getDetailsByNumber()
getSubList()
}
});
}
function blur() {
if (form.value.deviceNumber) {
getDetailsByNumber()
getSubList()
}
}
// /
function getDetailsByNumber() {
const data = {
number:form.value.deviceNumber,
flag:2
}
deviceApi.getDeviceDetailsByNumber(data).then((res) => {
if (res.data) {
form.value.deviceName = res.data.name
} else {
proxy.$modal.showToast(`找不到该${type.value=='DEVICE'?'设备' : '模具'}`)
}
}).catch(()=>{})
}
//
function getSubList() {
const data = {
number: form.value.deviceNumber
}
deviceApi.getSubList(data).then((res) => {
if (res.data) {
subList.value = res.data
} else {
proxy.$modal.showToast(`找不到该${type.value=='DEVICE'?'设备' : '模具'}`)
}
}).catch(()=>{})
}
//
function submit() {
//
if (!form.value.describes) {
proxy.$modal.showToast('请输入点检描述')
return;
}
if (!form.value.deviceNumber) {
proxy.$modal.showToast(`请输入${type.value=='DEVICE'?'设备' : '模具'}编码`)
return;
}
if (!form.value.classes) {
proxy.$modal.showToast('请选择班次')
return;
}
if (subList.value.length==0) {
proxy.$modal.showToast('该设备无检修项目')
return;
}
subList.value.forEach(item=>{
item.isConform = !item.isConform1 ? 'FALSE' : 'TRUE'
})
const data = {
describes:form.value.describes,
deviceNumber:form.value.deviceNumber,
maintenances: form.value.maintenances,
classes:form.value.classes,
subList:subList.value,
type: type.value
}
proxy.$modal.confirm('是否添加点检工单').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
spotCheckOrderApi.spotCheckOrderCreate(data).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
//
function reset() {
form.value = {
describes: "",
deviceNumber: '',
deviceName: '',
maintenances:'',
classes: ''
}
}
//
function openSingleColumn(fieldName, val, list) {
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
form.value[field.value] = e[0].value
if(field.value == 'classes'){
form.value.classesName = e[0].label
}
singleColumnShow.value = false
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
maintenanceShift.value = await dictApi.getDict('maintenance_shift')
form.value.maintenances = uni.getStorageSync('user').nickname
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item {
padding: 20rpx 30rpx;
}
.disabled {
background: #f5f5f5;
}
.list {
padding: 30rpx 30rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
display: flex;
align-items: center;
}
}
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
</style>

217
src/pages/spotCheckOrder/myOrder.vue

@ -0,0 +1,217 @@
<template>
<!-- 点检工单 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="点检工单">
</u-navbar>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" >
<view class="">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<u-tag text="待接单" v-if="item.status == 'PENDING'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已撤回" v-else-if="item.status=='REJECTED'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle'/>
<u-tag text="已转办" v-else-if="item.status=='TRANSFERRED'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="success" shape='circle'/>
<u-tag text="已接单" v-else-if="item.status=='PECEIVED'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/>
<u-tag text="已验证" v-else-if="item.status=='VERIFIED'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/>
<u-tag text="已完成" v-else-if="item.status=='COMPLETED'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
</view>
<view class="dec">
点检单号:<span>{{item.number}}</span>
</view>
<view class="dec">
{{`${item.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${item.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
班次:<span>{{item.classesName}}</span>
</view>
</view>
<view class="bottom">
<view class="time" style="flex: 1;">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as spotCheckOrderApi from "@/api/spotCheckOrder.js"
import { useCountStore } from '@/store'
const { proxy } = getCurrentInstance()
// store
const store = useCountStore()
const params = ref({
pageNo: 1,
pageSize: 10,
flag:1
})
const status = ref('loadmore') //
const list = ref([])
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await spotCheckOrderApi.spotCheckOrderPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.button {
position: absolute;
right: 0rpx;
}
}
}
}
</style>

648
src/pages/upkeepOrder/addServiceRecord.vue

@ -0,0 +1,648 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="formRef" label-width="160rpx">
<u-form-item label="保养内容" prop="contents" required class="disabled">
<u-input v-model="form.contents" placeholder="请输入保养内容" maxlength="50" disabled/>
</u-form-item>
<!-- <u-form-item label="保养部位" prop="equipmentParts" required>
<u-input v-model="form.equipmentParts" placeholder="请输入保养部位" maxlength="50" disabled/>
</u-form-item> -->
<u-form-item label="预估人数" prop="peoples" class="disabled">
<u-input v-model="form.peoples" type="number" placeholder="请输入预估人数" maxlength="50" disabled/>
</u-form-item>
<u-form-item label="预估分钟" prop="estimatedMinutes" class="disabled">
<u-input v-model="form.estimatedMinutes" type="number" placeholder="请输入预估分钟" maxlength="50" disabled/>
</u-form-item>
<u-form-item label="实际分钟" prop="actualMinutes" required>
<u-input v-model="form.actualMinutes" type="number" placeholder="请输入实际分钟" maxlength="50"/>
</u-form-item>
<u-form-item label="责任人" prop="chargePeoples" required>
<view class="select" @click="openSelecUser">
<view class="input" v-if='form.chargePeoples'>
{{selectFormatCheck(form.chargePeoples,selecUserList)}}
</view>
<view class="placeholder" v-else>
请选择维修人员
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="完成情况" prop="status" required>
<view class="select" @click="openSingleColumn('status',form.status,jxDetailsStatus,'form')">
<view class="input" v-if='form.status'>
{{form.statusTxt}}
</view>
<view class="placeholder" v-else>
{{`请选择完成情况`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view>
</u-form-item>
<u-form-item label="完成时间" prop="completionTime" required v-if='form.status === 0||form.status === "0"'>
<view class="select" @click="openDatetime('completionTime',formatDate,params,formatValue)">
<view class="input" v-if='formatDate'>
{{formatDate}}
</view>
<view class="placeholder" v-else>
{{`请选择完成时间`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="未完成原因" prop="uncompleted" required v-if='form.status === 1||form.status === "1"'>
<u-input type='textarea' v-model="form.uncompleted" placeholder="请输入未完成原因" maxlength="200" />
</u-form-item>
<u-form-item label="工程师确认" prop="engineer">
<u-input v-model="form.engineer" placeholder="请输入工程师确认" maxlength="50"/>
</u-form-item>
</u-form>
<view class="list">
<view class="title">
<span></span>备件
</view>
<view class="item " v-for="(item,index) in form.itemNumbers" :key="index">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.name}}
</view>
</view>
<u-row gutter="16">
<u-col :span="12">
<view class="dec">
<view class="">
数量:{{item.qty}}
</view>
</view>
</u-col>
</u-row>
</view>
<u-icon name="minus-circle" color="#aaaaaa" size="60" @click="delSpareParts(index)"></u-icon>
</view>
<view class="add-btn">
<u-button type="primary" @click="open"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加备件</u-button>
</view>
</view>
<view class="footer">
<view class="btns">
<button class="reset" @click="reset">重置</button>
<button class="sure" @click="submit" :loading='loading' :disabled='loading'>确定</button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
<!-- 添加备件 -->
<u-popup v-model="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加备件</view>
<view class="popup">
<u-form :model="form1" ref="form1Ref" label-width="160rpx">
<u-form-item :label="`备件`" prop="number" required>
<view class="select" @click="openSingleColumn('number',form1.number,sparePartsList,'form1')">
<view class="input" v-if='form1.number'>
{{form1.name}}
</view>
<view class="placeholder" v-else>
请选择备件
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入数量" />
</u-form-item>
</u-form>
</view>
<view class="popup-footer">
<view @click="isPopupShow = false">取消</view>
<view class="sure" @click="addSpare">确认</view>
</view>
</u-popup>
<!-- 选择维修人员 -->
<u-popup v-model="isShowSelecUser" mode="center" border-radius="14">
<view class="popup-title">选择维修人员</view>
<view class="popup">
<u-checkbox-group @change="checkboxGroupChange">
<u-checkbox v-model="item.checked" v-for="(item, index) in selecUserList" :key="index"
:name="item.id">{{item.name}}</u-checkbox>
</u-checkbox-group>
</view>
<view class="popup-footer">
<view @click="isShowSelecUser = false">取消</view>
<view class="sure" @click="chooseUser">确认</view>
</view>
</u-popup>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
<u-picker mode="time" v-model="datetimeShow" :default-time='datetimeDefaultValue' :params="params" @confirm='chooseDatetime' @cancle='datetimeShow = false'></u-picker>
</view>
</template>
<script setup lang="ts">
import {
onLoad
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as upkeepOrderApi from "@/api/upkeepOrder.js"
import * as sparePartsApi from "@/api/spareParts.js"
import * as deptApi from "@/api/dept.js"
import * as dictApi from "@/api/dict.js"
const { proxy} = getCurrentInstance()
const loading = ref(false)
const type = ref('')
//
const isPopupShow = ref(false)
const sparePartsList = ref([])
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
const singleColumnList = ref([])
const field = ref('')
const selecUserList = ref([])//
const isShowSelecUser = ref(false)
const jxDetailsStatus = ref([])//
const formatDate = ref('')//
const form = ref({
number: '',
name:'',
peoples: null,
estimatedMinutes: '',
actualMinutes: '',
chargePeoples: '',
status: null,
completionTime: '',
engineer: '',
uncompleted: '',
itemNumbers:[]
})
const form1 = ref({
number: "",
name: "",
qty: 0
})
//
const datetimeShow = ref(false)
const params = ref({
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true,
timestamp: true,
})
const datetimeDefaultValue = ref('')
const formatValue = ref('YYYY-MM-DD hh:mm:ss')
const factoryAreaNumber = ref('')
const chooseUserList = ref([])
//
function validateInteger(value){
if (value) {
const integerReg = /^[+]{0,1}(\d+)$/
if (integerReg.test(value)) {
return true
} else {
return false
}
} else {
return false
}
}
//
function submit() {
//
if (form.value.peoples > 100) {
proxy.$modal.showToast('预估人数不得超出100')
return;
}
if (!form.value.actualMinutes) {
proxy.$modal.showToast('请输入实际分钟')
return;
}
if (!validateInteger(form.value.actualMinutes)) {
proxy.$modal.showToast('实际分钟请输入正整数')
return;
}
if (!form.value.chargePeoples) {
proxy.$modal.showToast('请选择负责人')
return;
}
if (!form.value.status) {
proxy.$modal.showToast('请选择完成情况')
return;
}
if (form.value.status == 0) {
if (!form.value.completionTime) {
proxy.$modal.showToast('请选择完成时间')
return;
}
}
if (form.value.status == 1) {
if (!form.value.uncompleted) {
proxy.$modal.showToast('请输入未完成原因')
return;
}
}
if (form.value.id) {
proxy.$modal.confirm('是否修改保养内容').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
upkeepOrderApi.upkeepOrderDetailUpdate(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('修改成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
} else {
proxy.$modal.confirm('是否添加保养内容').then(() => {
proxy.$modal.loading('加载中')
loading.value = true
upkeepOrderApi.upkeepOrderDetailCreate(form.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data) {
proxy.$modal.showToast('添加成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
if(res.msg){
proxy.$modal.showToast(res.msg)
}else{
proxy.$modal.showToast('添加失败')
}
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
})
}
}
//
function reset() {
form.value.actualMinutes =''
form.value.chargePeoples =''
form.value.status =null
form.value.statusTxt =''
form.value.completionTime =''
form.value.engineer =''
form.value.uncompleted =''
form.value.itemNumbers =[]
formatDate.value = ''
}
//
async function getSelecUser() {
let paramsData = {
classType: type.value,
factoryAreaNumber: factoryAreaNumber.value,
flag: 0
}
let arr = []
if (form.value.chargePeoples) {
arr = form.value.chargePeoples.split(',')
}
await deptApi.getSelecUser(paramsData).then(res => {
res.data.forEach(item => {
item.checked = false
arr.forEach(cur => {
if (item.id == cur) {
item.checked = true
}
})
})
selecUserList.value = res.data
}).catch(() => { })
}
//
function openSelecUser() {
isShowSelecUser.value = true
}
function checkboxGroupChange(e) {
chooseUserList.value = e
}
//
function selectFormatCheck(val, array) {
const arr = val.split(',').map(Number)
let str = array.filter(item => arr.includes(item.id)).map(item => item.name).join(',')
return str
}
//
function chooseUser() {
form.value.chargePeoples = chooseUserList.value.join(',')
isShowSelecUser.value = false
}
const whichForm = ref()
//
function openSingleColumn(fieldName, val, list, from) {
if (fieldName == 'deviceNumber' && form.value.id) return;
whichForm.value = from
singleColumnList.value = list
field.value = fieldName
if (val) {
singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)]
} else {
singleColumnDefaultValue.value = []
}
singleColumnShow.value = true
}
//
function chooseSingleColumn(e) {
if(whichForm.value == 'form'){
form.value[field.value] = e[0].value
if(field.value=='status'){
form.value.statusTxt = e[0].label
formatDate.value = ''
}
}else if(whichForm.value == 'form1'){
form1.value[field.value] = e[0].value
if(field.value=='number'){
form1.value.name = e[0].label
}
}
singleColumnShow.value = false
}
//
async function getSparePartsList() {
await sparePartsApi.getSparePartsList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
sparePartsList.value = res.data
}).catch(() => { })
}
//
function open() {
form1.value = {
number: "",
name:'',
qty: 0
}
isPopupShow.value = true
}
//
function addSpare() {
if (!form1.value.number) {
proxy.$modal.showToast('请选择备件')
return;
}
if (!form1.value.qty || form1.value.qty == 0) {
proxy.$modal.showToast('请输入数量')
return;
}
if (form.value.itemNumbers && form.value.itemNumbers.length > 0) {
let arr = form.value.itemNumbers.filter(item => item.number == form1.value.number)
if (arr && arr.length > 0) {
proxy.$modal.showToast('该备件已添加')
return;
}
}
form.value.itemNumbers.push(form1.value)
isPopupShow.value = false
}
//
function delSpareParts(index) {
form.value.itemNumbers.splice(index, 1)
}
function openDatetime(fieldName, val, params, format) {
params.value = params
formatValue.value = format
field.value = fieldName
form.value[field.value] = val ? val : ''
datetimeDefaultValue.value = val ? val : proxy.$time.formatDate()
datetimeShow.value = true
}
//
function chooseDatetime(e) {
let array1 = []
let array2 = []
if (formatValue.value.indexOf('YYYY') > -1) {
array1.push(e.year)
}
if (formatValue.value.indexOf('MM') > -1) {
array1.push(e.month)
}
if (formatValue.value.indexOf('DD') > -1) {
array1.push(e.day)
}
if (formatValue.value.indexOf('hh') > -1) {
array2.push(e.hour)
}
if (formatValue.value.indexOf('mm') > -1) {
array2.push(e.minute)
}
if (formatValue.value.indexOf('ss') > -1) {
array2.push(e.second)
}
let str = array1.join('-') + ' ' + array2.join(':')
formatDate.value = str
form.value[field.value] = e.timestamp*1000
}
onLoad(async(option) => {
if (option.type) type.value = option.type;
if (option.factoryAreaNumber) factoryAreaNumber.value = option.factoryAreaNumber;
if (option.number) form.value.number = option.number;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) {
form.value = JSON.parse(decodeURIComponent(option.data))
form.value.itemNumbers = form.value.items
formatDate.value = form.value.completionTime ? proxy.$time.formatDate(form.value.completionTime) : ''
form.value.statusTxt = form.value.status == 0 ? '完成' :'未完成'
};
jxDetailsStatus.value = await dictApi.getDict('jx_details_status')
await getSelecUser()
await getSparePartsList()
})
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 0rpx 140rpx;
}
.u-form-item{
padding: 20rpx 30rpx;
}
.disabled{
background: #f5f5f5;
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
z-index: 22;
}
.btns {
display: flex;
button {
flex: 1;
}
.sure {
background: #409eff;
color: white;
border-radius: 0px;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
.reset {
background: #F5F5F5;
border-radius: 0px;
&::after {
border-radius: 0px;
}
}
}
.right-button {
background: #409eff;
color: white;
padding: 0rpx 30rpx;
border-radius: 16rpx;
text-align: center;
font-size: 28rpx;
}
.select {
display: flex;
align-items: center;
height: 72rpx;
width: 100%;
.input {
flex: 1;
font-size: 28rpx;
color: #000000;
}
.placeholder {
flex: 1;
font-size: 28rpx;
color: rgb(192, 196, 204);
}
}
.title {
padding: 32rpx 0px;
position: relative;
span {
position: absolute;
left: -16rpx;
color: #fa3534;
padding-top: 6rpx;
}
}
.list {
padding: 0px 30rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
background: #F5F5F5;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
}
}
.dec {
color: #9c9c9c;
padding: 20rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx 30rpx 0px
}
.popup {
width: 600rpx;
padding: 30rpx 60rpx 30rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
::v-deep .u-checkbox-group {
display: grid !important;
}
</style>

484
src/pages/upkeepOrder/detail.vue

@ -0,0 +1,484 @@
<template>
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>保养工单</view>
</view>
<view class="dec">
<view class="dec-item">
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>保养计划单号</view>
<view>{{data.planNumber}}</view>
</view>
<view class="dec-item">
<view>故障类型</view>
<view>{{data.faultTypeName}}</view>
</view>
<view class="dec-item" v-if="data.createTime">
<view>创建时间</view>
<view>{{$time.formatDate(data.createTime)}}</view>
</view>
<view class="dec-item" v-if="data.creator">
<view>创建人员</view>
<view>{{data.creator}}</view>
</view>
<view class="dec-item" v-if="data.receivingTime">
<view>接单时间</view>
<view>{{$time.formatDate(data.receivingTime)}}</view>
</view>
<view class="dec-item" v-if="data.maintenanceName">
<view>维修人员</view>
<view>{{data.maintenanceName}}</view>
</view>
<view class="dec-item" v-if="data.completionTime">
<view>完成时间</view>
<view>{{$time.formatDate(data.completionTime)}}</view>
</view>
</view>
</view>
<div class="line"></div>
<view class="info" style="padding-bottom: 130rpx;">
<view class="tab">
<u-tabs :list="list" :is-scroll="false" bar-height="2" bar-width="250" v-model="current"
@change="change"></u-tabs>
</view>
<view>
<view class="title">
<view>{{changeItem.name}}</view>
</view>
<view class="dec" v-if="current == 0">
<view class="dec-item">
<view>设备编号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>设备名称</view>
<view>{{data.name}}</view>
</view>
<view class="dec-item">
<view>所属厂区</view>
<view>{{data.factoryAreaName}}</view>
</view>
<view class="dec-item">
<view>设备类型</view>
<view>{{data.type == 'DEVICE'?'设备':data.type == 'TECH'?'工艺':'模具'}}</view>
</view>
</view>
<view class="list" v-if="current == 1">
<view class="item " v-for="(item,index) in serviceList" :key="index"
@click="addSubForm('updata',item)">
<view class="item-box">
<view class="spare-title">
<view class="title-txt">
{{item.contents}}
</view>
</view>
<!-- <view class="dec2">
<view>保养部位</view>
<view>{{item.equipmentParts}}</view>
</view> -->
<view class="dec2">
<view>预估人数</view>
<view v-if="item.peoples||item.peoples==0">{{item.peoples}}</view>
</view>
<view class="dec2">
<view>预估分钟</view>
<view v-if='item.estimatedMinutes'>{{item.estimatedMinutes}}分钟</view>
</view>
<view class="dec2">
<view>实际分钟</view>
<view v-if='item.actualMinutes'>{{item.actualMinutes}}分钟</view>
</view>
<view class="dec2">
<view>责任人</view>
<view>{{item.chargePeoplesName}}</view>
</view>
<view class="dec2" >
<view>完成情况</view>
<view>{{item.status===0 || item.status === '0'? '完成':item.status===1 ||item.status === '1'?'未完成':''}}</view>
</view>
<view class="dec2" v-if='item.status === 0 || item.status === "0"'>
<view>完成时间</view>
<view>{{$time.formatDate(item.completionTime)}}</view>
</view>
<view class="dec2">
<view>工程师确认</view>
<view>{{item.engineer}}</view>
</view>
<view class="dec2" v-if="item.status === 1 || item.status === '1'">
<view>未完成原因</view>
<view>{{item.uncompleted}}</view>
</view>
<view class="dec2">
备件
</view>
<view class="items" v-for="(cur,key) in item.items" :key="key">
<view class="items-name">
{{cur.name}}
</view>
<view class="items-dec">
备件编号{{cur.number}}
</view>
<view class="items-dec">
数量{{cur.qty}}
</view>
</view>
</view>
<!-- <u-icon name="minus-circle" color="#aaaaaa" size="60" ></u-icon> -->
</view>
</view>
</view>
</view>
<view class="footer">
<view class="btns">
<u-button type="primary" v-if="data.status == 'PENDING'" @click="orderClick(1)" :loading='loading'
:disabled='loading'>接单</u-button>
<u-button type="primary" v-if="data.status == 'PECEIVED'" @click="orderClick(2)" :loading='loading'
:disabled='loading'>完成</u-button>
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as moldApi from "@/api/mold.js"
import * as upkeepOrderApi from "@/api/upkeepOrder.js"
const { proxy } = getCurrentInstance()
const list = ref([{
name: '设备信息'
}, {
name: '保养内容'
}])
const current = ref(0)
const changeItem = ref({
name: '设备信息',
value: 1
})
const data = ref()
const loading = ref(false)
const type = ref('')
const serviceList = ref([])
const isTrue = ref(false)
function change(index) {
current.value = index
changeItem.value = list.value[current.value]
}
//
function addSubForm(clickType, item) {
if (data.value.status == 'PENDING') {
proxy.$modal.showToast('请先接单')
return
}
if (clickType == 'updata') {
proxy.$tab.navigateTo(
`/pages/upkeepOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}&data=${encodeURIComponent(JSON.stringify(item))}`
)
} else {
proxy.$tab.navigateTo(
`/pages/upkeepOrder/addServiceRecord?type=${data.value.type}&factoryAreaNumber=${data.value.factoryAreaNumber}&number=${data.value.number}`
)
}
}
function orderClick(type) {
if(!serviceList.value || serviceList.value&&serviceList.value.length == 0){
proxy.$modal.showToast('没有保养内容')
return;
}
// if(type == 2){
// isTrue.value = serviceList.value.some(item=>item.items.length == 0)
// if(isTrue.value){
// proxy.$modal.showToast('')
// return;
// }
// }
const paramsData = {
id: data.value.id
}
let tips = data.value.status == 'PENDING' ? '是否接单?' : data.value.status == 'PECEIVED' ? '是否完成?' : ''
proxy.$modal.confirm(tips).then(() => {
proxy.$modal.loading('加载中')
loading.value = true
if(type == 1){
upkeepOrderApi.orderClick(paramsData).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}else if(type == 2){
upkeepOrderApi.orderClickFinish(paramsData).then((res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
loading.value = false
}, 1500)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
}
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}
})
}
//
function getUpkeepOrderDetailList() {
upkeepOrderApi.upkeepOrderDetailList({
number: data.value.number
}).then((res) => {
if (res.data) {
serviceList.value = res.data
}
}).catch(() => { })
}
//
function delService(item) {
proxy.$modal.confirm('确定删除维修内容吗?').then(() => {
proxy.$modal.loading('加载中')
upkeepOrderApi.upkeepOrderDetailDelete(item.id).then((res) => {
proxy.$modal.closeLoading()
getUpkeepOrderDetailList()
}).catch(() => { })
})
}
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.data) {
data.value = JSON.parse(decodeURIComponent(option.data))
}
changeItem.value = list.value[current.value]
})
onShow(() => {
getUpkeepOrderDetailList()
})
</script>
<style lang="scss" scoped>
.detail-container{
min-height: 100vh;
background: white;
}
.line{
background: #f5f5f5;
height: 20rpx;
}
.info {
background: white;
}
.tab {
border-bottom: 1px solid #e4e4e4;
}
.title {
display: flex;
align-items: center;
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
view {
&:nth-child(1) {
flex: 1;
border-left: 10rpx solid #409eff;
padding-left: 20rpx;
font-weight: bold;
}
}
}
.dec {
padding: 30rpx;
.dec-item {
padding-bottom: 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 200rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
}
.dec2 {
padding: 10rpx 30rpx;
display: flex;
view {
&:nth-child(1) {
width: 180rpx;
}
&:nth-child(2) {
color: #888888;
flex: 1;
width: 0px;
word-wrap: break-word;
}
}
}
.items {
margin: 20rpx 30rpx;
border-radius: 12rpx;
background: #F5F5F5;
padding-bottom: 20rpx;
.items-name {
padding: 20rpx;
border-bottom: 1px solid #dedede;
}
.items-dec {
padding: 0px 20rpx;
margin-top: 20rpx;
}
}
.popup-title {
text-align: center;
font-size: 32rpx;
font-weight: bold;
color: #409eff;
padding: 30rpx
}
.popup {
width: 600rpx;
padding: 0rpx 60rpx 0rpx;
}
.popup-footer {
display: flex;
border-top: 1px solid #e4e4e4;
view {
line-height: 100rpx;
flex: 1;
text-align: center;
&.sure {
color: #409eff;
}
}
}
.footer {
position: fixed;
bottom: 0px;
left: 0px;
width: 100%;
background: white;
z-index: 22;
}
.btns {
display: flex;
padding: 20rpx;
box-shadow: 0px -2rpx 20rpx rgba(0, 0, 0, 0.1);
button {
flex: 1;
margin: 0px 10rpx;
}
.sure {
background: #409eff;
color: white;
border-radius: 8rpx;
&::after {
border: 1px solid #409eff;
border-radius: 0px;
}
}
}
.list {
padding: 20rpx;
.item {
display: flex;
margin-bottom: 20rpx;
.item-box {
border-radius: 12rpx;
border: 1px solid #dedede;
border-radius: 12rpx;
flex: 1;
width: 0rpx;
}
.spare-title {
padding: 20rpx 30rpx;
border-bottom: 1px solid #e4e4e4;
display: flex;
.title-txt {
color: #409eff;
font-size: 30rpx;
font-weight: bold;
flex: 1;
}
}
.dec {
color: #9c9c9c;
padding: 0rpx 30rpx 20rpx;
}
}
}
.add-btn {
display: flex;
justify-content: flex-start;
align-items: center;
}
</style>

225
src/pages/upkeepOrder/index.vue

@ -0,0 +1,225 @@
<template>
<!-- 保养工单 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="保养工单">
</u-navbar>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" >
<view class="" @click="itemClick(item,index)">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<u-tag text="待接单" v-if="item.status == 'PENDING'" bg-color='rgba(255,255,255,0)' color='#fe8463' border-color='#fe8463' type="primary" shape='circle'/>
<u-tag text="已撤回" v-else-if="item.status=='REJECTED'" bg-color='rgba(255,255,255,0)' color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle'/>
<u-tag text="已转办" v-else-if="item.status=='TRANSFERRED'" bg-color='rgba(255,255,255,0)' color='#e01f54' border-color='#e01f54' type="success" shape='circle'/>
<u-tag text="已接单" v-else-if="item.status=='PECEIVED'" bg-color='rgba(255,255,255,0)' color='#005eaa' border-color='#005eaa ' type="error" shape='circle'/>
<u-tag text="已验证" v-else-if="item.status=='VERIFIED'" bg-color='rgba(255,255,255,0)' color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle'/>
<u-tag text="已完成" v-else-if="item.status=='COMPLETED'" bg-color='rgba(255,255,255,0)' color='#2ba471' border-color='#2ba471' type="info" shape='circle'/>
</view>
<view class="dec">
保养单号:<span>{{item.number}}</span>
</view>
<view class="dec">
保养计划单号:<span>{{item.planNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="dec">
故障类型:<span>{{item.faultTypeName}}</span>
</view>
</view>
<view class="bottom">
<view class="time" style="flex: 1;">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as upkeepOrderApi from "@/api/upkeepOrder.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
type: '',
})
const status = ref('loadmore') //
const list = ref([])
function itemClick(item, index) {
proxy.$tab.navigateTo(`/pages/upkeepOrder/detail?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
}
function addForm(item) {
proxy.$tab.navigateTo(`/pages/upkeepOrder/addForm?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
}
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await upkeepOrderApi.upkeepOrderPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container{
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.button {
position: absolute;
right: 0rpx;
}
}
}
}
</style>

229
src/pages/upkeepOrder/myOrder.vue

@ -0,0 +1,229 @@
<template>
<!-- 保养工单 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="保养工单">
</u-navbar>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index">
<view class="">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<u-tag text="待接单" v-if="item.status == 'PENDING'" bg-color='rgba(255,255,255,0)' color='#fe8463'
border-color='#fe8463' type="primary" shape='circle' />
<u-tag text="已撤回" v-else-if="item.status=='REJECTED'" bg-color='rgba(255,255,255,0)'
color='#d7d7d7' border-color='#d7d7d7 ' type="warning" shape='circle' />
<u-tag text="已转办" v-else-if="item.status=='TRANSFERRED'" bg-color='rgba(255,255,255,0)'
color='#e01f54' border-color='#e01f54' type="success" shape='circle' />
<u-tag text="已接单" v-else-if="item.status=='PECEIVED'" bg-color='rgba(255,255,255,0)'
color='#005eaa' border-color='#005eaa ' type="error" shape='circle' />
<u-tag text="已验证" v-else-if="item.status=='VERIFIED'" bg-color='rgba(255,255,255,0)'
color='#2EC7C9' border-color='#2EC7C9' type="info" shape='circle' />
<u-tag text="已完成" v-else-if="item.status=='COMPLETED'" bg-color='rgba(255,255,255,0)'
color='#2ba471' border-color='#2ba471' type="info" shape='circle' />
</view>
<view class="dec">
保养单号:<span>{{item.number}}</span>
</view>
<view class="dec">
保养计划单号:<span>{{item.planNumber}}</span>
</view>
<view class="dec">
{{`${item.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${item.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="dec">
故障类型:<span>{{item.faultTypeName}}</span>
</view>
<view class="dec">
完成时间:<span>{{$time.formatDate(item.completionTime)}}</span>
</view>
</view>
<view class="bottom">
<view class="time" style="flex: 1;">
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script setup lang="ts">
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app'
import {
ref,
getCurrentInstance
} from 'vue'
import * as upkeepOrderApi from "@/api/upkeepOrder.js"
const { proxy } = getCurrentInstance()
const params = ref({
pageNo: 1,
pageSize: 10,
flag: 1
})
const status = ref('loadmore') //
const list = ref([])
async function getList() {
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
await upkeepOrderApi.upkeepOrderPage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
proxy.$modal.closeLoading()
})
}
onLoad((option) => {
if (option.type) params.value.type = option.type;
})
onShow(() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'
getList()
})
onReachBottom(() => {
getList()
})
</script>
<style lang="scss" scoped>
.container {
background: #f5f5f5;
min-height: 100vh;
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
word-wrap: break-word;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.button {
position: absolute;
right: 0rpx;
}
}
}
}
</style>
Loading…
Cancel
Save