Browse Source

维修工单,检修工单

master
zhang_li 10 months ago
parent
commit
a275a734dd
  1. 10
      api/dept.js
  2. 75
      api/overhaulOrder.js
  3. 48
      api/repairOrder.js
  4. 10
      api/spareParts.js
  5. 9
      api/user.js
  6. 1
      config.js
  7. 46
      pages.json
  8. 13
      pages/index.vue
  9. 293
      pages/mine/changePassword.vue
  10. 5
      pages/mine/index.vue
  11. 325
      pages/overhaulOrder/addForm.vue
  12. 507
      pages/overhaulOrder/addServiceRecord.vue
  13. 482
      pages/overhaulOrder/detail.vue
  14. 251
      pages/overhaulOrder/index.vue
  15. 226
      pages/overhaulOrder/myRepairOrder.vue
  16. 400
      pages/overhaulOrder/transfer.vue
  17. 19
      pages/repairOrder/addForm.vue
  18. 506
      pages/repairOrder/addServiceRecord.vue
  19. 338
      pages/repairOrder/detail.vue
  20. 261
      pages/repairOrder/screen.vue
  21. 400
      pages/repairOrder/transfer.vue
  22. 6
      plugins/tab.js

10
api/dept.js

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 获取人员列表
export function getSelecUser(params) {
return request({
url: '/system/dept/selecUserByType',
'method': 'GET',
params
})
}

75
api/overhaulOrder.js

@ -0,0 +1,75 @@
import request from '@/utils/request'
// 添加工单
export function overhaulOrderCreate(data) {
return request({
url: '/eam/device-inspection-main/create',
'method': 'POST',
data
})
}
// 编辑工单
export function overhaulOrderUpdate(data) {
return request({
url: '/eam/device-inspection-main/update',
'method': 'PUT',
data
})
}
// 报修列表
export function overhaulOrderPage(params) {
return request({
url: '/eam/device-inspection-main/getAppPage',
'method': 'GET',
params
})
}
// 操作工单
export function orderClick(params) {
return request({
url: '/eam/device-maintenance-main/orderClick',
'method': 'GET',
params
})
}
// 添加维修工单子项维修内容
export function repairOrderDetailCreate(data) {
return request({
url: '/eam/device-maintenance-detail/create',
'method': 'POST',
data
})
}
// 编辑维修工单子项维修内容
export function repairOrderDetailUpdate(data) {
return request({
url: '/eam/device-maintenance-detail/update',
'method': 'PUT',
data
})
}
// 获得维修工单子列表
export function repairOrderDetailList(params) {
return request({
url: '/eam/device-maintenance-detail/selectListByNumber',
'method': 'GET',
params
})
}
// 删除维修工单子
export function repairOrderDetailDelete(id) {
return request({
url: '/eam/device-maintenance-detail/delete?id='+id,
'method': 'DELETE'
})
}
//转办
export function transfer(params) {
return request({
url: '/eam/device-maintenance-main/turnTo',
'method': 'GET',
params
})
}

48
api/repairOrder.js

@ -33,4 +33,52 @@ export function orderClick(params) {
params
})
}
// 添加维修工单子项维修内容
export function repairOrderDetailCreate(data) {
return request({
url: '/eam/device-maintenance-detail/create',
'method': 'POST',
data
})
}
// 编辑维修工单子项维修内容
export function repairOrderDetailUpdate(data) {
return request({
url: '/eam/device-maintenance-detail/update',
'method': 'PUT',
data
})
}
// 获得维修工单子列表
export function repairOrderDetailList(params) {
return request({
url: '/eam/device-maintenance-detail/selectListByNumber',
'method': 'GET',
params
})
}
// 删除维修工单子
export function repairOrderDetailDelete(id) {
return request({
url: '/eam/device-maintenance-detail/delete?id='+id,
'method': 'DELETE'
})
}
//转办
export function transfer(params) {
return request({
url: '/eam/device-maintenance-main/turnTo',
'method': 'GET',
params
})
}
// 获取采取临时措施的维修工单
export function repairOrderList(params) {
return request({
url: '/eam/device-maintenance-main/getList',
'method': 'GET',
params
})
}

10
api/spareParts.js

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 获取备件列表
export function getSparePartsList(params) {
return request({
url: '/eam/item/getListByNumber',
'method': 'GET',
params
})
}

9
api/user.js

@ -0,0 +1,9 @@
import request from '@/utils/request'
// 用户密码重置
export function updateUserPassword(data){
return request({
url: '/system/user/profile/update-password',
'method': 'PUT',
data
})
}

1
config.js

@ -1,5 +1,6 @@
// 应用全局配置
module.exports = {
// http://192.168.0.165:1208
baseUrl: process.env.NODE_ENV === 'development' ? 'http://192.168.0.165:12080' : 'http://api-dashboard.yudao.iocoder.cn',
baseApi:process.env.NODE_ENV === 'development' ? '/admin-api' : '/api/admin-api',
// 应用信息

46
pages.json

@ -69,25 +69,59 @@
"navigationBarTextStyle": "white"
}
},{
"path": "pages/repairOrder/screen",
"path": "pages/repairOrder/detail",
"style": {
"navigationBarTitleText": "筛选",
"navigationBarTitleText": "维修工单详情",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/repairOrder/detail",
"path": "pages/repairOrder/myRepairOrder",
"style": {
"navigationBarTitleText": "维修工单详情",
"navigationBarTitleText": "维修工单",
"navigationStyle": "custom"
}
},{
"path": "pages/repairOrder/addServiceRecord",
"style": {
"navigationBarTitleText": "添加维修记录",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
},{
"path": "pages/repairOrder/myRepairOrder",
"path": "pages/repairOrder/transfer",
"style": {
"navigationBarTitleText": "维修工单",
"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/mine/changePassword",
"style": {
"navigationBarTitleText": "修改密码",
"navigationBarBackgroundColor": "#409eff",
"navigationBarTextStyle": "white"
}
}],
"tabBar": {
"color": "#8f9bb3",

13
pages/index.vue

@ -13,15 +13,15 @@
<view class="top-box">
<view class="number">
<view class="number-item">
<view>32</view>
<view>{{counts.allCount}}</view>
<view>设备总数</view>
</view>
<view class="number-item">
<view>32</view>
<view>{{counts.breakDownCount}}</view>
<view>故障中设备</view>
</view>
<view class="number-item">
<view>32</view>
<view>{{counts.repairCount}}</view>
<view>已报修设备</view>
</view>
</view>
@ -57,7 +57,7 @@
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/workOrderList/index?type=3')">
<view class="icon-item" @click="open('/pages/overhaulOrder/index?type=DEVICE')">
<image src="../static/images/icon3.svg" mode=""></image>
<view>检修工单</view>
</view>
@ -90,7 +90,7 @@
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/overhaulWorkOrderList/index')">
<view class="icon-item" @click="open('/pages/overhaulOrder/index?type=MOLD')">
<image src="../static/images/icon2.svg" mode=""></image>
<view>检修工单</view>
</view>
@ -135,7 +135,7 @@
data() {
return {
bgOpacity: 0,
counts:''
}
},
@ -156,6 +156,7 @@
getCounts() {
getCounts().then(res => {
console.log((res))
this.counts = res.data
})
},
},

293
pages/mine/changePassword.vue

@ -1,149 +1,158 @@
<template>
<view>
<view class="box">
<view class="item">
<!-- <image src="../../static/icon/user_password_icon_blue.png"></image> -->
<view class="item2 padd35">
<input type="text" v-model="old_password" placeholder="请输入原密码" />
</view>
</view>
<view class="item">
<!-- <image src="../../static/icon/user_password_icon_red.png"></image> -->
<view class="item2 padd35">
<input type="text" v-model="newpassword" placeholder="请输入新密码" />
</view>
</view>
<view class="item">
<!-- <image src="../../static/icon/user_password_icon.png"></image> -->
<view class="item2 padd35">
<input type="text" v-model="confirmpassword" placeholder="请确认新密码" />
</view>
</view>
</view>
<view class="btn" @click="submit">确认</view>
</view>
<view>
<view class="box">
<view class="item">
<!-- <image src="../../static/icon/user_password_icon_blue.png"></image> -->
<view class="item2 padd35">
<input type="text" v-model="oldPassword" placeholder="请输入原密码" />
</view>
</view>
<view class="item">
<!-- <image src="../../static/icon/user_password_icon_red.png"></image> -->
<view class="item2 padd35">
<input type="text" v-model="newPassword" placeholder="请输入新密码" />
</view>
</view>
<view class="item">
<!-- <image src="../../static/icon/user_password_icon.png"></image> -->
<view class="item2 padd35">
<input type="text" v-model="confirmPassword" placeholder="请确认新密码" />
</view>
</view>
</view>
<view class="btn" @click="submit">确认</view>
</view>
</template>
<script>
export default {
data() {
return {
newpassword: "",
old_password: "",
confirmpassword: "",
}
},
onLoad() {
},
onShow() {
},
methods: {
submit() {
if(!this.old_password){
this.$toast('请输入原密码');
return;
}
if(!this.newpassword){
this.$toast('请输入新密码');
return;
}
if(!this.confirmpassword){
this.$toast('请确认新密码');
return;
}
if(this.confirmpassword != this.newpassword){
this.$toast('两次输入的密码不一致,请重新输入');
return;
}
this.$ajax('editpassword', {
userToken: this.$getSync('userToken'),
newpassword:this.newpassword,
old_password:this.old_password,
confirmpassword:this.confirmpassword,
}).then(ret => {
this.$closeLoading()
if (ret.status == 0) {
this.$alert('修改成功',()=>{
this.$backT()
})
} else {
this.$toast(ret.message);
}
});
},
}
}
import * as userApi from "@/api/user.js"
export default {
data() {
return {
newPassword: "",
oldPassword: "",
confirmPassword: "",
}
},
onLoad() {
},
onShow() {
},
methods: {
submit() {
if (!this.oldPassword) {
this.$modal.showToast('请输入原密码');
return;
}
if (!this.newPassword) {
this.$modal.showToast('请输入新密码');
return;
}
if (!this.confirmPassword) {
this.$modal.showToast('请确认新密码');
return;
}
if (this.confirmPassword != this.newPassword) {
this.$modal.showToast('两次输入的密码不一致,请重新输入');
return;
}
this.$modal.confirm('是否修改密码').then(() => {
this.$modal.loading('加载中')
this.loading = true
userApi.updateUserPassword({
newPassword: this.newPassword,
oldPassword: this.oldPassword,
}).then(res => {
if (res.data) {
this.$modal.showToast('修改成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('修改失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #f8f9fb;
}
.box {
width: 94vw;
margin: 20rpx auto;
border-radius: 20rpx;
overflow: hidden;
}
.item {
background-color: #FFFFFF;
padding: 0rpx 30rpx;
display: flex;
align-items: center;
image {
width: 44rpx;
height: 44rpx;
margin-right: 30rpx;
}
.item2 {
display: flex;
align-items: center;
justify-content: space-between;
flex: 1;
border-bottom: 1rpx solid #efefef;
padding: 25rpx 0rpx;
input {
font-size: 28rpx;
}
view {
color: #1a4f9f;
border: 1rpx solid #1a4f9f;
font-size: 30rpx;
border-radius: 50rpx;
padding: 10rpx 18rpx;
}
}
}
.btn {
width: calc(100vw - 80rpx);
position: fixed;
bottom: 200rpx;
left: 40rpx;
background-color: rgb(64, 158, 255);
color: #FFFFFF;
height: 90rpx;
line-height: 90rpx;
text-align: center;
border-radius: 50rpx;
font-size: 32rpx;
}
.noborder {
border-bottom: none !important;
}
.padd35 {
padding: 35rpx 0 !important;
}
</style>
page {
background-color: #f8f9fb;
}
.box {
width: 94vw;
margin: 20rpx auto;
border-radius: 20rpx;
overflow: hidden;
}
.item {
background-color: #FFFFFF;
padding: 0rpx 30rpx;
display: flex;
align-items: center;
image {
width: 44rpx;
height: 44rpx;
margin-right: 30rpx;
}
.item2 {
display: flex;
align-items: center;
justify-content: space-between;
flex: 1;
border-bottom: 1rpx solid #efefef;
padding: 25rpx 0rpx;
input {
font-size: 28rpx;
}
view {
color: #1a4f9f;
border: 1rpx solid #1a4f9f;
font-size: 30rpx;
border-radius: 50rpx;
padding: 10rpx 18rpx;
}
}
}
.btn {
width: calc(100vw - 80rpx);
position: fixed;
bottom: 200rpx;
left: 40rpx;
background-color: rgb(64, 158, 255);
color: #FFFFFF;
height: 90rpx;
line-height: 90rpx;
text-align: center;
border-radius: 50rpx;
font-size: 32rpx;
}
.noborder {
border-bottom: none !important;
}
.padd35 {
padding: 35rpx 0 !important;
}
</style>

5
pages/mine/index.vue

@ -56,7 +56,7 @@
</view>
<view class="menu-list">
<view class="list-cell list-cell-arrow" @click="handleToEditInfo">
<view class="list-cell list-cell-arrow" @click="handleEditPassword">
<view class="menu-item-box">
<u-icon name="lock" color="#2979ff" size="32"></u-icon>
<view style="margin-left: 10rpx;">修改密码</view>
@ -129,6 +129,9 @@
handleLogin() {
this.$tab.navigateTo('/pages/login/index')
},
handleEditPassword(){
this.$tab.navigateTo('/pages/mine/changePassword')
}
},
onShow() {
if (getAccessToken()) {

325
pages/overhaulOrder/addForm.vue

@ -0,0 +1,325 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" 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="maintenanceNumber">
<view class="select" @click="openSingleColumn('maintenanceNumber',form.maintenanceNumber,repairOrderList)">
<view class="input" v-if='form.maintenanceNumber'>
{{selectFormat(form.maintenanceNumber,repairOrderList)}}
</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">
<u-input v-model="form.deviceName" :placeholder="`请输入${type=='DEVICE'?'设备' : '模具'}名称`" disabled />
</u-form-item>
<u-form-item label="所属厂区" prop="factoryAreaName">
<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'>
{{selectFormat(form.faultType,faultType)}}
</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>
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"
export default {
data() {
return {
loading: false,
type: "",
form: {
id: '',
describes: "",
maintenanceNumber: '',
faultType: ''
},
repairOrderList: [], //
singleColumnShow: false,
singleColumnDefaultValue: [],
singleColumnList: [],
field: '',
faultType: [], //
}
},
methods: {
//
submit() {
//
if (!this.form.describes) {
this.$modal.showToast('请输入故障描述')
return;
}
if (!this.form.faultType) {
this.$modal.showToast('请选择故障类型')
return;
}
const data = {
id: this.form && this.form.id ? this.form.id : '',
describes: this.form.describes,
maintenanceNumber: this.form.maintenanceNumber,
faultType: this.form.faultType,
}
if (this.form.id) {
this.$modal.confirm('是否修改检修工单').then(() => {
this.$modal.loading('加载中')
this.loading = true
overhaulOrderApi.overhaulOrderUpdate(data).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('修改成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
} else {
this.$modal.confirm('是否添加检修工单').then(() => {
this.$modal.loading('加载中')
this.loading = true
overhaulOrderApi.overhaulOrderCreate(data).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('添加成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
}
},
//
reset() {
if (this.form.id) {
this.form.classes = '';
this.form.faultType = ''
} else {
this.form = {}
}
},
//
selectFormat(val, array) {
if(array.length>0){
let str = array.filter(item => item.value == val)[0].label
return str
}else{
return ''
}
},
//
openSingleColumn(field, val, list) {
if (field == 'maintenanceNumber' && this.form.id) return;
this.singleColumnList = list
this.field = field
if (val) {
this.singleColumnDefaultValue = [list.findIndex(item => item.value == val)]
} else {
this.singleColumnDefaultValue = []
}
this.singleColumnShow = true
},
//
chooseSingleColumn(e) {
console.log(e[0])
this.form[this.field] = e[0].value
if (this.field == 'maintenanceNumber') {
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value)
this.form.deviceName = this.choosesingleColumnItem[0].name
this.form.factoryAreaName = this.choosesingleColumnItem[0].factoryAreaName
this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber
// this.form.deviceNumber = e[0].value
}
this.singleColumnShow = false
this.$emit('singleColumn', this.field, this.form[this.field])
this.$forceUpdate()
},
//
async getRepairOrderList() {
await repairOrderApi.repairOrderList({
type:this.type,
result:'TEMPORARILY'
}).then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.describes
})
this.repairOrderList = res.data
})
},
},
async onLoad(option) {
if (option.type) this.type = option.type;
if (option.data) {
let data = JSON.parse(decodeURIComponent(option.data))
this.form = {
id: data.id,
describes: data.describes,
maintenanceNumber: data.maintenanceNumber,
deviceName: data.name,
factoryAreaName: data.factoryAreaName,
faultType: data.faultType,
}
};
await this.getRepairOrderList()
this.faultType = await dictApi.getDict('fault_type')
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.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>

507
pages/overhaulOrder/addServiceRecord.vue

@ -0,0 +1,507 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" 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">
{{selectFormat(item.number,sparePartsList)}}
</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="form1" 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'>
{{selectFormat(form1.number,sparePartsList)}}
</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"></u-select>
</view>
</template>
<script>
import * as repairOrderApi from "@/api/repairOrder.js"
import * as sparePartsApi from "@/api/spareParts.js"
import * as deptApi from "@/api/dept.js"
export default {
data() {
return {
loading: false,
type: "",
//
isPopupShow: false,
sparePartsList: [],
//
singleColumnShow: false,
singleColumnDefaultValue: [],
singleColumnList: [],
field: '',
//
selecUserList: [], //
isShowSelecUser: false,
form: {
maintenanceNumber: '',
describes: '',
describes1: '',
workOut: '',
maintenances: '',
itemNUmbers: [],
},
form1: {
number: "",
qty: ''
},
}
},
methods: {
//
submit() {
//
if (!this.form.describes) {
this.$modal.showToast('请输入故障描述')
return;
}
if (!this.form.describes1) {
this.$modal.showToast(`请输入故障真因`)
return;
}
if (!this.form.workOut) {
this.$modal.showToast('请输入解决措施')
return;
}
if (!this.form.maintenances) {
this.$modal.showToast('请选择维修人员')
return;
}
if (this.form.itemNUmbers.length === 0) {
this.$modal.showToast('请选择备件')
return;
}
console.log(this.form)
if (this.form.id) {
this.$modal.confirm('是否修改维修内容').then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.repairOrderDetailUpdate(this.form).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('修改成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
} else {
this.$modal.confirm('是否添加维修内容').then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.repairOrderDetailCreate(this.form).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('添加成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
}
},
//
reset() {
if (this.form.id) {
this.form.classes = '';
this.form.faultType = ''
} else {
this.form = {}
}
},
//
async getSelecUser() {
let data = {
classType: this.type,
factoryAreaNumber: this.factoryAreaNumber,
flag: 1
}
let arr = []
if (this.form.maintenances) {
arr = this.form.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
}
})
})
this.selecUserList = res.data
})
},
//
openSelecUser() {
this.isShowSelecUser = true
},
checkboxGroupChange(e) {
this.chooseUserList = e
},
//
selectFormatCheck(val, array) {
const arr = val.split(',')
let str = array.filter(item => arr.includes(item.id)).map(item => item.name).join(',')
return str
},
//
chooseUser() {
this.form.maintenances = this.chooseUserList.join(',')
this.isShowSelecUser = false
},
selectFormat(val, array) {
let str = array.filter(item => item.value == val)[0].label
return str
},
//
openSingleColumn(field, val, list) {
if (field == 'deviceNumber' && this.form.id) return;
this.singleColumnList = list
this.field = field
if (val) {
this.singleColumnDefaultValue = [list.findIndex(item => item.value == val)]
} else {
this.singleColumnDefaultValue = []
}
this.singleColumnShow = true
},
//
chooseSingleColumn(e) {
console.log(e[0])
this.form1[this.field] = e[0].value
this.singleColumnShow = false
this.$emit('singleColumn', this.field, this.form[this.field])
this.$forceUpdate()
},
//
async getSparePartsList() {
await sparePartsApi.getSparePartsList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
this.sparePartsList = res.data
})
},
//
open() {
this.form1 = {
number: "",
qty: ''
}
this.isPopupShow = true
},
//
addSpare() {
if (!this.form1.number) {
this.$modal.showToast('请选择备件')
return;
}
if (!this.form1.qty) {
this.$modal.showToast('请输入数量')
return;
}
if (this.form.itemNUmbers && this.form.itemNUmbers.length > 0) {
let arr = this.form.itemNUmbers.filter(item => item.number == this.form1.number)
if (arr && arr.length > 0) {
this.$modal.showToast('该备件已添加')
return;
}
}
this.form.itemNUmbers.push(this.form1)
this.isPopupShow = false
},
//
delSpareParts(index) {
this.form.itemNUmbers.splice(index, 1)
}
},
async onLoad(option) {
console.log(option)
if (option.type) this.type = option.type;
if (option.factoryAreaNumber) this.factoryAreaNumber = option.factoryAreaNumber;
if (option.number) this.form.maintenanceNumber = option.number;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) {
this.form = JSON.parse(decodeURIComponent(option.data))
this.$set(this.form,'itemNUmbers',this.form.items)
};
await this.getSelecUser()
await this.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>

482
pages/overhaulOrder/detail.vue

@ -0,0 +1,482 @@
<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>
<view class="dec-item">
<view>班次</view>
<view>{{data.classesName}}</view>
</view>
<view class="dec-item">
<view>故障类型</view>
<view>{{data.faultTypeName}}</view>
</view>
<view class="dec-item">
<view>维修工</view>
<view>{{data.maintenance}}</view>
</view>
</view>
</view>
<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>{{deviceInfo.number}}</view>
</view>
<view class="dec-item">
<view>设备名称</view>
<view>{{deviceInfo.name}}</view>
</view>
<view class="dec-item">
<view>所属厂区</view>
<view>{{deviceInfo.factoryAreaName}}</view>
</view>
<view class="dec-item">
<view>设备类型</view>
<view>{{deviceInfo.typeName}}</view>
</view>
</view>
<view class="dec" v-if="current == 1">
<view class="dec-item">
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>报修描述</view>
<view>{{data.describes}}</view>
</view>
<view class="dec-item">
<view>维修工</view>
<view>{{data.maintenance}}</view>
</view>
</view>
<view class="list" v-if="current == 2">
<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.describes}}
</view>
<u-icon name="trash" color="#aaaaaa" size="40"
@click.native.stop="delService(item)"></u-icon>
</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="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 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">
<u-button type="primary" v-if="data.status == 'PENDING'" @click="orderClick()" :loading='loading'
:disabled='loading'>接单</u-button>
<u-button type="primary" v-if="data.status == 'PECEIVED'" @click="orderClick()" :loading='loading'
:disabled='loading'>完成</u-button>
<u-button type="primary" v-if="data.status == 'COMPLETED'" @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>
import Form from '@/components/form/index.vue'
import SparePartsCard from '@/components/sparePartsCard/index.vue'
import * as deviceApi from "@/api/device.js"
import * as moldApi from "@/api/mold.js"
import * as repairOrderApi from "@/api/repairOrder.js"
export default {
components: {
Form,
SparePartsCard
},
data() {
return {
list: [{
name: '设备信息'
}, {
name: '报修信息'
}, {
name: '维修内容'
}],
current: 0,
changeItem: '',
data: '', //
loading: false,
type: "",
deviceInfo: '', //
serviceList: [], //
}
},
methods: {
change(index) {
console.log("index", index);
this.current = index
this.changeItem = this.list[this.current]
},
//
addSubForm(clickType, item) {
if(this.data.status == 'PENDING'){
this.$modal.showToast('请先接单')
return
}
if (clickType == 'updata') {
this.$tab.navigateTo(
`/pages/repairOrder/addServiceRecord?type=${this.type}&factoryAreaNumber=${this.data.factoryAreaNumber}&number=${this.data.number}&data=${encodeURIComponent(JSON.stringify(item))}`
)
} else {
this.$tab.navigateTo(
`/pages/repairOrder/addServiceRecord?type=${this.type}&factoryAreaNumber=${this.data.factoryAreaNumber}&number=${this.data.number}`
)
}
},
//
addSpare() {
},
//
cancle() {
this.isPopupShow = false
},
// /
getDetailsByNumber() {
const data = {
number: this.data.deviceNumber,
id: ''
}
if (this.type == 'DEVICE') {
deviceApi.getDeviceDetailsByNumber(data).then((res) => {
if (res.data) {
this.deviceInfo = res.data
} else {
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`)
}
})
} else if (this.type == 'MOLD') {
moldApi.getMoldDetailsByNumber(data).then((res) => {
if (res.data) {
this.deviceInfo = res.data
} else {
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`)
}
})
}
},
// APP
orderClick() {
const data = {
number: this.data.number,
status: this.data.status,
id: this.data.id,
requestNumber: ''
}
let tips = this.data.status == 'PENDING' ? '是否接单?' : this.data.status == 'PECEIVED' ? '是否完成?' : this.data
.status == 'COMPLETED' ? '是否验证完结?' : ''
this.$modal.confirm(tips).then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.orderClick(data).then((res) => {
if (res.data) {
this.$modal.showToast('操作成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('操作失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
},
//
getRepairOrderDetaiList() {
repairOrderApi.repairOrderDetailList({
number: this.data.number
}).then((res) => {
if (res.data) {
this.serviceList = res.data
}
})
},
//
delService(item) {
console.log(222)
this.$modal.confirm('确定删除维修内容吗?').then(() => {
this.$modal.loading('加载中')
repairOrderApi.repairOrderDetailDelete(item.id).then((res) => {
this.$modal.closeLoading()
this.getRepairOrderDetaiList()
})
})
},
//
transfer() {
this.$tab.navigateTo(`/pages/repairOrder/transfer?type=${this.type}&id=${this.data.id}`)
}
},
onLoad(option) {
if (option.type) this.type = option.type;
if (option.data) {
this.data = JSON.parse(decodeURIComponent(option.data))
}
this.changeItem = this.list[this.current]
},
onShow() {
this.getDetailsByNumber()
this.getRepairOrderDetaiList()
}
}
</script>
<style lang="scss" scoped>
.info {
background: white;
margin-bottom: 20rpx;
}
.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;
}
</style>

251
pages/overhaulOrder/index.vue

@ -0,0 +1,251 @@
<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">
维修工单:<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>
import * as overhaulOrderApi from "@/api/overhaulOrder.js"
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: ''
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
screen() {
this.$tab.navigateTo(`/pages/overhaulOrder/screen?type=${this.params.type}`)
},
itemClick(item, index) {
this.$tab.navigateTo(`/pages/overhaulOrder/detail?type=${this.params.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
},
addForm(item) {
this.$tab.navigateTo(`/pages/overhaulOrder/addForm?type=${this.params.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
},
//
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
overhaulOrderApi.overhaulOrderPage(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'
}
})
},
//
cancle(item) {
this.$modal.confirm('确定撤销报修吗?').then(() => {
this.$modal.loading('加载中')
deviceApi.rejected(item.id).then((res) => {
this.$modal.closeLoading()
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
})
})
}
},
onLoad(option) {
if (option.type) this.params.type = option.type;
},
onShow() {
uni.$on('screen',(data)=>{
console.log(data)
this.params = {...this.params,...data}
})
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onUnload() {
uni.$off('screen')
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.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;
}
}
}
.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>

226
pages/overhaulOrder/myRepairOrder.vue

@ -0,0 +1,226 @@
<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="itemClick(item,index)">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<view class="time">
2023-12-12 08:00:00
</view>
</view>
<view class="dec">
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
设备编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
设备名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="bottom">
<view class="status">
<u-tag text="已报修" v-if="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>
import * as repairOrderApi from "@/api/repairOrder.js"
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: 'DEVICE',
flag:1
},
status: 'loadmore', //
list: [],
}
},
methods: {
//
screen() {
this.$tab.navigateTo(`/pages/deviceReport/screen?type=${this.type}`)
},
itemClick(item, index) {
this.$tab.navigateTo(`/pages/workOrderList/detail?type=${this.type}`)
},
addForm() {
this.$tab.navigateTo(`/pages/deviceReport/addForm?type=${this.params.type}`)
},
//
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
repairOrderApi.repairOrderPage(this.params).then((res) => {
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
//
cancle(item){
this.$modal.confirm('确定撤销报修吗?').then(()=>{
deviceApi.rejected(item.id).then((res) => {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
})
})
}
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.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;
}
.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;
.status {
flex: 1;
}
.button{
position: absolute;
right: 0rpx;
}
}
}
}
</style>

400
pages/overhaulOrder/transfer.vue

@ -0,0 +1,400 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="类型" prop="receiverType" required>
<view class="select" @click="openSingleColumn('receiverType',form.receiverType,deviceMoldType)">
<view class="input" v-if='form.receiverType'>
{{selectFormat(form.receiverType,deviceMoldType)}}
</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'?'设备' : '模具'}名称`" prop="deviceNumber" required>
<view class="select" @click="openSingleColumn('deviceNumber',form.deviceNumber,deviceList)">
<view class="input" v-if='form.deviceNumber'>
{{selectFormat(form.deviceNumber,deviceList)}}
</view>
<view class="placeholder" v-else>
{{`请选择${type=='DEVICE'?'设备' : '模具'}名称`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</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"></u-select>
</view>
</template>
<script>
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"
export default {
data() {
return {
loading: false,
type: "",
deviceMoldType: [], //
form: {
id: '',
receiverType: "",
deviceNumber: '',
deviceName: '',
receiverUserId: '',
},
deviceList: [], //
singleColumnShow: false,
singleColumnDefaultValue: [],
singleColumnList: [],
field: '',
//
selecUserList: [], //
isShowSelecUser: false,
}
},
methods: {
//
submit() {
//
if (!this.form.receiverType) {
this.$modal.showToast('请选择类型')
return;
}
if (!this.form.deviceNumber) {
this.$modal.showToast(`请选择${this.type=='DEVICE'?'设备' : '模具'}名称`)
return;
}
if (!this.form.receiverUserId) {
this.$modal.showToast('请选择维修人员')
return;
}
const data = {
id: this.form && this.form.id ? this.form.id : '',
receiverType: this.form.receiverType,
deviceNumber: this.form.deviceNumber,
receiverUserId: this.form.receiverUserId,
}
this.$modal.confirm('是否转办维修工单').then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.transfer(data).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('转办成功')
setTimeout(() => {
this.$tab.navigateBack(2)
this.loading = false
}, 1500)
} else {
this.$modal.showToast('转办失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
},
//
reset() {
if (this.form.id) {
this.form.receiverType = "";
this.form.deviceNumber = '';
this.form.deviceName = '';
this.form.receiverUserId = '';
} else {
this.form = {}
}
},
//
selectFormat(val, array) {
let str = array.filter(item => item.value == val)[0].label
return str
},
//
openSingleColumn(field, val, list) {
this.singleColumnList = list
this.field = field
if (val) {
this.singleColumnDefaultValue = [list.findIndex(item => item.value == val)]
} else {
this.singleColumnDefaultValue = []
}
this.singleColumnShow = true
},
//
chooseSingleColumn(e) {
console.log(e[0])
this.form[this.field] = e[0].value
if (this.field == 'receiverType') {
this.type = this.form[this.field]
this.form.deviceName = ''
this.form.deviceNumber = ''
this.getDeviceList()
} else if (this.field == 'deviceNumber') {
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value)
this.form.factoryAreaName = this.choosesingleColumnItem[0].factoryAreaName
this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber
this.getSelecUser()
}
this.singleColumnShow = false
this.$emit('singleColumn', this.field, this.form[this.field])
this.$forceUpdate()
},
// /
async getDeviceList() {
if (this.type == 'DEVICE') {
await deviceApi.deviceList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
this.deviceList = res.data
})
} else if (this.type == 'MOLD') {
await moldApi.moldList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
this.deviceList = res.data
})
}
},
//
async getSelecUser() {
let data = {
classType: this.type,
factoryAreaNumber: this.form.factoryAreaNumber,
flag: 1
}
let arr = []
if (this.form.maintenances) {
arr = this.form.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
}
})
})
this.selecUserList = res.data
})
},
//
openSelecUser(field) {
this.field = field
this.isShowSelecUser = true
},
radioGroupChange(field, e, list) {
this.chooseUserInfo = e
},
//
selectFormatRadin(val, array) {
let str = array.filter(item => item.id == val)[0].name
return str
},
//
chooseUser() {
this.form[this.field] = this.chooseUserInfo
this.isShowSelecUser = false
},
},
async onLoad(option) {
if (option.type) this.type = option.type;
if (option.id) this.form.id = option.id;
this.deviceMoldType = await dictApi.getDict('device_mold_type')
this.deviceMoldType = this.deviceMoldType.filter(item => item.value != this.type)
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.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>

19
pages/repairOrder/addForm.vue

@ -3,7 +3,7 @@
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="故障描述" prop="describes" required>
<u-input v-model="form.describes" placeholder="请输入故障描述" :disabled="form&&form.id" />
<u-input v-model="form.describes" placeholder="请输入故障描述" :disabled="form&&form.id?true:false" />
</u-form-item>
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}名称`" prop="deviceNumber" required>
<view class="select" @click="openSingleColumn('deviceNumber',form.deviceNumber,deviceList)">
@ -93,7 +93,7 @@
this.$modal.showToast('请输入故障描述')
return;
}
if (!this.form.deviceName) {
if (!this.form.deviceNumber) {
this.$modal.showToast(`请选择${this.type=='DEVICE'?'设备' : '模具'}名称`)
return;
}
@ -105,10 +105,6 @@
this.$modal.showToast('请选择班次')
return;
}
if (!this.form.classes) {
this.$modal.showToast('请选择班次')
return;
}
const data = {
id: this.form && this.form.id ? this.form.id : '',
describes: this.form.describes,
@ -175,8 +171,12 @@
},
//
selectFormat(val, array) {
let str = array.filter(item => item.value == val)[0].label
return str
if(array.length>0){
let str = array.filter(item => item.value == val)[0].label
return str
}else{
return ''
}
},
//
openSingleColumn(field, val, list) {
@ -192,7 +192,6 @@
},
//
chooseSingleColumn(e) {
console.log(e[0])
this.form[this.field] = e[0].value
if (this.field == 'deviceNumber') {
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value)
@ -237,7 +236,7 @@
deviceName: data.name,
factoryAreaName: data.factoryAreaName,
factoryAreaNumber: data.factoryAreaNumber,
classes: data.classes ? data.classes : '0',
classes: data.classes ? data.classes : '',
faultType: data.faultType,
// faultTypeName:data.faultTypeName,
}

506
pages/repairOrder/addServiceRecord.vue

@ -0,0 +1,506 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" 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">
{{selectFormat(item.number,sparePartsList)}}
</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="form1" 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'>
{{selectFormat(form1.number,sparePartsList)}}
</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"></u-select>
</view>
</template>
<script>
import * as repairOrderApi from "@/api/repairOrder.js"
import * as sparePartsApi from "@/api/spareParts.js"
import * as deptApi from "@/api/dept.js"
export default {
data() {
return {
loading: false,
type: "",
//
isPopupShow: false,
sparePartsList: [],
//
singleColumnShow: false,
singleColumnDefaultValue: [],
singleColumnList: [],
field: '',
//
selecUserList: [], //
isShowSelecUser: false,
form: {
maintenanceNumber: '',
describes: '',
describes1: '',
workOut: '',
maintenances: '',
itemNUmbers: [],
},
form1: {
number: "",
qty: ''
},
}
},
methods: {
//
submit() {
//
if (!this.form.describes) {
this.$modal.showToast('请输入故障描述')
return;
}
if (!this.form.describes1) {
this.$modal.showToast(`请输入故障真因`)
return;
}
if (!this.form.workOut) {
this.$modal.showToast('请输入解决措施')
return;
}
if (!this.form.maintenances) {
this.$modal.showToast('请选择维修人员')
return;
}
if (this.form.itemNUmbers.length === 0) {
this.$modal.showToast('请选择备件')
return;
}
console.log(this.form)
if (this.form.id) {
this.$modal.confirm('是否修改维修内容').then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.repairOrderDetailUpdate(this.form).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('修改成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
} else {
this.$modal.confirm('是否添加维修内容').then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.repairOrderDetailCreate(this.form).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('添加成功')
setTimeout(() => {
this.$tab.navigateBack()
this.loading = false
}, 1500)
} else {
this.$modal.showToast('添加失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
}
},
//
reset() {
if (this.form.id) {
this.form.classes = '';
this.form.faultType = ''
} else {
this.form = {}
}
},
//
async getSelecUser() {
let data = {
classType: this.type,
factoryAreaNumber: this.factoryAreaNumber,
flag: 1
}
let arr = []
if (this.form.maintenances) {
arr = this.form.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
}
})
})
this.selecUserList = res.data
})
},
//
openSelecUser() {
this.isShowSelecUser = true
},
checkboxGroupChange(e) {
this.chooseUserList = e
},
//
selectFormatCheck(val, array) {
const arr = val.split(',')
let str = array.filter(item => arr.includes(item.id)).map(item => item.name).join(',')
return str
},
//
chooseUser() {
this.form.maintenances = this.chooseUserList.join(',')
this.isShowSelecUser = false
},
selectFormat(val, array) {
let str = array.filter(item => item.value == val)[0].label
return str
},
//
openSingleColumn(field, val, list) {
if (field == 'deviceNumber' && this.form.id) return;
this.singleColumnList = list
this.field = field
if (val) {
this.singleColumnDefaultValue = [list.findIndex(item => item.value == val)]
} else {
this.singleColumnDefaultValue = []
}
this.singleColumnShow = true
},
//
chooseSingleColumn(e) {
console.log(e[0])
this.form1[this.field] = e[0].value
this.singleColumnShow = false
this.$emit('singleColumn', this.field, this.form[this.field])
this.$forceUpdate()
},
//
async getSparePartsList() {
await sparePartsApi.getSparePartsList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
this.sparePartsList = res.data
})
},
//
open() {
this.form1 = {
number: "",
qty: ''
}
this.isPopupShow = true
},
//
addSpare() {
if (!this.form1.number) {
this.$modal.showToast('请选择备件')
return;
}
if (!this.form1.qty) {
this.$modal.showToast('请输入数量')
return;
}
if (this.form.itemNUmbers && this.form.itemNUmbers.length > 0) {
let arr = this.form.itemNUmbers.filter(item => item.number == this.form1.number)
if (arr && arr.length > 0) {
this.$modal.showToast('该备件已添加')
return;
}
}
this.form.itemNUmbers.push(this.form1)
this.isPopupShow = false
},
//
delSpareParts(index) {
this.form.itemNUmbers.splice(index, 1)
}
},
async onLoad(option) {
if (option.type) this.type = option.type;
if (option.factoryAreaNumber) this.factoryAreaNumber = option.factoryAreaNumber;
if (option.number) this.form.maintenanceNumber = option.number;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) {
this.form = JSON.parse(decodeURIComponent(option.data))
this.$set(this.form,'itemNUmbers',this.form.items)
};
await this.getSelecUser()
await this.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>

338
pages/repairOrder/detail.vue

@ -4,27 +4,27 @@
<view class="info">
<view class="title">
<view>维修工单</view>
<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>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>报修描述</view>
<view>报修描述</view>
<view>{{data.describes}}</view>
</view>
<view class="dec-item">
<view>班次</view>
<view>班次</view>
<view>{{data.classesName}}</view>
</view>
<view class="dec-item">
<view>故障类型</view>
<view>故障类型</view>
<view>{{data.faultTypeName}}</view>
</view>
<view class="dec-item">
<view>维修工</view>
<view>维修工</view>
<view>{{data.maintenance}}</view>
</view>
</view>
@ -41,74 +41,121 @@
</view>
<view class="dec" v-if="current == 0">
<view class="dec-item">
<view>设备编号</view>
<view>设备编号</view>
<view>{{deviceInfo.number}}</view>
</view>
<view class="dec-item">
<view>设备名称</view>
<view>设备名称</view>
<view>{{deviceInfo.name}}</view>
</view>
<view class="dec-item">
<view>所属厂区</view>
<view>所属厂区</view>
<view>{{deviceInfo.factoryAreaName}}</view>
</view>
<view class="dec-item">
<view>设备类型</view>
<view>设备类型</view>
<view>{{deviceInfo.typeName}}</view>
</view>
</view>
<view class="dec" v-if="current == 1">
<view class="dec-item">
<view>工单单号</view>
<view>工单单号</view>
<view>{{data.number}}</view>
</view>
<view class="dec-item">
<view>报修描述</view>
<view>报修描述</view>
<view>{{data.describes}}</view>
</view>
<view class="dec-item">
<view>维修工</view>
<view>维修工</view>
<view>{{data.maintenance}}</view>
</view>
</view>
<view class="dec" v-if="current == 2">
<SparePartsCard :subForm='subForm' :data='data' @addSubForm='addSubForm'
@delSubFormItem='delSubFormItem'>
</SparePartsCard>
<view class="list" v-if="current == 2">
<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.describes}}
</view>
<u-icon name="trash" color="#aaaaaa" size="40"
@click.native.stop="delService(item)"></u-icon>
</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="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 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">
<u-button type="primary" v-if="data.status == 'PENDING'" @click="orderClick()" :loading='loading' :disabled='loading'>接单</u-button>
<u-button type="primary" v-if="data.status == 'PECEIVED'" @click="orderClick()" :loading='loading' :disabled='loading'>完成</u-button>
<u-button type="primary" v-if="data.status == 'COMPLETED'" @click="orderClick()" :loading='loading' :disabled='loading'>验证完结</u-button>
<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="orderClickSuccess()" :loading='loading'
:disabled='loading'>完成</u-button>
<u-button type="primary" v-if="data.status == 'COMPLETED'" @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="isPopupShow" mode="center" border-radius="14">
<view class="popup-title">添加记录</view>
<!-- 完成类型 -->
<u-popup v-model="isShowSuccess" mode="center" border-radius="14">
<view class="popup-title">完成类型</view>
<view class="popup">
<Form :form='subForm' :data='data' ref="form2"></Form>
<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="cancle">取消</view>
<view class="sure" @click="addSpare">确认</view>
<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>
</view>
</template>
<script>
import Form from '@/components/form/index.vue'
import SparePartsCard from '@/components/sparePartsCard/index.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"
export default {
components: {
Form,
SparePartsCard
},
data() {
return {
list: [{
@ -116,7 +163,7 @@
}, {
name: '报修信息'
}, {
name: '维修记录'
name: '维修内容'
}],
current: 0,
changeItem: '',
@ -124,54 +171,11 @@
loading: false,
type: "",
deviceInfo: '', //
isPopupShow: false,
subForm: {
formLabel: '',
formField: 'subList',
required: true,
isShowButton: true,
disabled: false,
visible: true,
loading: false,
labelWidth: '180rpx',
border: true,
errorType: ['toast'],
formData: [{
type: 'singleColumn',
field: 'name',
label: '模具',
disabled: false,
required: true,
span: 12,
list: [{
label: '类型1',
value: 1
}, {
label: '类型2',
value: 2
}, {
label: '类型3',
value: 3
}]
}, {
type: 'text',
field: 'stork',
label: '库存',
disabled: false,
required: true,
isList: true,
span: 6
}, {
type: 'text',
field: 'number',
label: '数量',
disabled: false,
required: true,
isList: true,
span: 6
}],
},
serviceList: [], //
//
isShowSuccess:false,
orderCompleteResult:[],//
result:'TEMPORARILY'
}
},
methods: {
@ -181,9 +185,20 @@
this.changeItem = this.list[this.current]
},
//
addSubForm() {
console.log(5)
this.isPopupShow = true
addSubForm(clickType, item) {
if(this.data.status == 'PENDING'){
this.$modal.showToast('请先接单')
return
}
if (clickType == 'updata') {
this.$tab.navigateTo(
`/pages/repairOrder/addServiceRecord?type=${this.type}&factoryAreaNumber=${this.data.factoryAreaNumber}&number=${this.data.number}&data=${encodeURIComponent(JSON.stringify(item))}`
)
} else {
this.$tab.navigateTo(
`/pages/repairOrder/addServiceRecord?type=${this.type}&factoryAreaNumber=${this.data.factoryAreaNumber}&number=${this.data.number}`
)
}
},
//
addSpare() {
@ -197,26 +212,49 @@
getDetailsByNumber() {
const data = {
number: this.data.deviceNumber,
type: this.type,
id: ''
}
deviceApi.getDetailsByNumber(data).then((res) => {
if (res.data) {
this.deviceInfo = res.data
} else {
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`)
}
})
if (this.type == 'DEVICE') {
deviceApi.getDeviceDetailsByNumber(data).then((res) => {
if (res.data) {
this.deviceInfo = res.data
} else {
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`)
}
})
} else if (this.type == 'MOLD') {
moldApi.getMoldDetailsByNumber(data).then((res) => {
if (res.data) {
this.deviceInfo = res.data
} else {
this.$modal.showToast(`找不到该${this.type=='DEVICE'?'设备' : '模具'}`)
}
})
}
},
//
orderClickSuccess(){
this.isShowSuccess = true
},
radioGroupChange(e){
console.log(e)
this.result = e
},
sure(){
this.isShowSuccess = false
this.orderClick(2)
},
// APP
orderClick() {
orderClick(type) {
const data = {
number: this.data.number,
status: this.data.status,
id: this.data.id,
result:type == 2? this.result :'',
requestNumber: ''
}
let tips = this.data.status == 'PENDING' ? '是否接单?' : this.data.status == 'PECEIVED'?'是否完成?' : this.data.status == 'COMPLETED'?'是否验证完结?':''
let tips = this.data.status == 'PENDING' ? '是否接单?' : this.data.status == 'PECEIVED' ? '是否完成?' : this.data
.status == 'COMPLETED' ? '是否验证完结?' : ''
this.$modal.confirm(tips).then(() => {
this.$modal.loading('加载中')
this.loading = true
@ -236,18 +274,44 @@
this.loading = false
})
})
},
//
getRepairOrderDetaiList() {
repairOrderApi.repairOrderDetailList({
number: this.data.number
}).then((res) => {
if (res.data) {
this.serviceList = res.data
}
})
},
//
delService(item) {
console.log(222)
this.$modal.confirm('确定删除维修内容吗?').then(() => {
this.$modal.loading('加载中')
repairOrderApi.repairOrderDetailDelete(item.id).then((res) => {
this.$modal.closeLoading()
this.getRepairOrderDetaiList()
})
})
}
},
},
onLoad(option) {
async onLoad(option) {
if (option.type) this.type = option.type;
if (option.data) {
this.data = JSON.parse(decodeURIComponent(option.data))
}
this.changeItem = this.list[this.current]
this.orderCompleteResult = await dictApi.getDict('order_complete_result')
},
onShow() {
this.getDetailsByNumber()
this.getRepairOrderDetaiList()
}
}
</script>
@ -294,11 +358,50 @@
&: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;
@ -360,4 +463,51 @@
}
}
}
.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;
}
</style>

261
pages/repairOrder/screen.vue

@ -1,261 +0,0 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="故障描述" prop="describes">
<u-input v-model="form.describes" placeholder="请输入故障描述" />
</u-form-item>
<u-form-item :label="`${type=='DEVICE'?'设备' : '模具'}名称`" prop="deviceName">
<view class="select" @click="openSingleColumn('deviceName',form.deviceName,deviceList)">
<view class="input" v-if='form.deviceName'>
{{selectFormat(form.deviceName,deviceList)}}
</view>
<view class="placeholder" v-else>
{{`请输入${type=='DEVICE'?'设备' : '模具'}名称`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item label="所属厂区" prop="factoryAreaName">
<u-input v-model="form.factoryAreaName" placeholder="请输入所属厂区" disabled />
</u-form-item>
<u-form-item label="班次" prop="classes">
<view class="select" @click="openSingleColumn('classes',form.classes,maintenanceShift)">
<view class="input" v-if='form.classes'>
{{selectFormat(form.classes,maintenanceShift)}}
</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" >
<view class="select" @click="openSingleColumn('faultType',form.faultType,faultType)">
<view class="input" v-if='form.faultType'>
{{selectFormat(form.faultType,faultType)}}
</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>
import * as deviceApi from "@/api/device.js"
import * as dictApi from "@/api/dict.js"
import * as repairOrderApi from "@/api/repairOrder.js"
export default {
data() {
return {
loading:false,
type:"",
form: {
describes: "",
deviceNumber: '',
deviceName: '',
factoryAreaName: '',
factoryAreaNumber: '',
classes:'',
faultType:''
},
deviceList:[],//
singleColumnShow:false,
singleColumnDefaultValue:[],
singleColumnList:[],
field:'',
maintenanceShift:[],//
faultType:[],//
}
},
methods: {
//
submit() {
const data = {
describes: this.form.describes,
deviceNumber: this.form.deviceNumber,
factoryAreaNumber: this.form.factoryAreaNumber,
classes:this.form.classes,
faultType:this.form.faultType,
type: this.type
}
uni.$emit('screen',data)
this.$tab.navigateBack()
},
//
reset() {
console.log('表单数据信息1:', this.data);
this.form = {}
},
//
selectFormat(val,array){
let str = array.filter(item=>item.value == val)[0].label
return str
},
//
openSingleColumn(field,val,list){
this.singleColumnList = list
this.field = field
if(val){
this.singleColumnDefaultValue = [list.findIndex(item=>item.value==val)]
}else{
this.singleColumnDefaultValue = []
}
this.singleColumnShow = true
},
//
chooseSingleColumn(e){
console.log( e[0])
this.form[this.field] = e[0].value
if(this.field == 'deviceName'){
this.choosesingleColumnItem = this.singleColumnList.filter(item=>item.number == e[0].value)
this.form.factoryAreaName = this.choosesingleColumnItem[0].factoryAreaName
this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber
this.form.deviceNumber = e[0].value
}
this.singleColumnShow = false
this.$emit('singleColumn',this.field,this.form[this.field])
this.$forceUpdate()
},
//
getDeviceList(){
deviceApi.deviceList({
type:this.type,
id:''
}).then(res=>{
res.data.map(item=>{
item.value = item.number
item.label = item.name
})
this.deviceList = res.data
})
},
},
async onLoad(option) {
if (option.type) this.type = option.type;
this.getDeviceList()
this.maintenanceShift = await dictApi.getDict('maintenance_shift')
this.faultType = await dictApi.getDict('fault_type')
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.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>

400
pages/repairOrder/transfer.vue

@ -0,0 +1,400 @@
<template>
<!-- 添加维修工单 -->
<view class="add-form-container">
<u-form :model="form" ref="form1" label-width="160rpx">
<u-form-item label="类型" prop="receiverType" required>
<view class="select" @click="openSingleColumn('receiverType',form.receiverType,deviceMoldType)">
<view class="input" v-if='form.receiverType'>
{{selectFormat(form.receiverType,deviceMoldType)}}
</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'?'设备' : '模具'}名称`" prop="deviceNumber" required>
<view class="select" @click="openSingleColumn('deviceNumber',form.deviceNumber,deviceList)">
<view class="input" v-if='form.deviceNumber'>
{{selectFormat(form.deviceNumber,deviceList)}}
</view>
<view class="placeholder" v-else>
{{`请选择${type=='DEVICE'?'设备' : '模具'}名称`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</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"></u-select>
</view>
</template>
<script>
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"
export default {
data() {
return {
loading: false,
type: "",
deviceMoldType: [], //
form: {
id: '',
receiverType: "",
deviceNumber: '',
deviceName: '',
receiverUserId: '',
},
deviceList: [], //
singleColumnShow: false,
singleColumnDefaultValue: [],
singleColumnList: [],
field: '',
//
selecUserList: [], //
isShowSelecUser: false,
}
},
methods: {
//
submit() {
//
if (!this.form.receiverType) {
this.$modal.showToast('请选择类型')
return;
}
if (!this.form.deviceNumber) {
this.$modal.showToast(`请选择${this.type=='DEVICE'?'设备' : '模具'}名称`)
return;
}
if (!this.form.receiverUserId) {
this.$modal.showToast('请选择维修人员')
return;
}
const data = {
id: this.form && this.form.id ? this.form.id : '',
receiverType: this.form.receiverType,
deviceNumber: this.form.deviceNumber,
receiverUserId: this.form.receiverUserId,
}
this.$modal.confirm('是否转办维修工单').then(() => {
this.$modal.loading('加载中')
this.loading = true
repairOrderApi.transfer(data).then((res) => {
this.$modal.closeLoading()
if (res.data) {
this.$modal.showToast('转办成功')
setTimeout(() => {
this.$tab.navigateBack(2)
this.loading = false
}, 1500)
} else {
this.$modal.showToast('转办失败')
this.loading = false
}
}).catch(() => {
this.$modal.closeLoading()
this.loading = false
})
})
},
//
reset() {
if (this.form.id) {
this.form.receiverType = "";
this.form.deviceNumber = '';
this.form.deviceName = '';
this.form.receiverUserId = '';
} else {
this.form = {}
}
},
//
selectFormat(val, array) {
let str = array.filter(item => item.value == val)[0].label
return str
},
//
openSingleColumn(field, val, list) {
this.singleColumnList = list
this.field = field
if (val) {
this.singleColumnDefaultValue = [list.findIndex(item => item.value == val)]
} else {
this.singleColumnDefaultValue = []
}
this.singleColumnShow = true
},
//
chooseSingleColumn(e) {
console.log(e[0])
this.form[this.field] = e[0].value
if (this.field == 'receiverType') {
this.type = this.form[this.field]
this.form.deviceName = ''
this.form.deviceNumber = ''
this.getDeviceList()
} else if (this.field == 'deviceNumber') {
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value)
this.form.factoryAreaName = this.choosesingleColumnItem[0].factoryAreaName
this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber
this.getSelecUser()
}
this.singleColumnShow = false
this.$emit('singleColumn', this.field, this.form[this.field])
this.$forceUpdate()
},
// /
async getDeviceList() {
if (this.type == 'DEVICE') {
await deviceApi.deviceList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
this.deviceList = res.data
})
} else if (this.type == 'MOLD') {
await moldApi.moldList().then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
this.deviceList = res.data
})
}
},
//
async getSelecUser() {
let data = {
classType: this.type,
factoryAreaNumber: this.form.factoryAreaNumber,
flag: 1
}
let arr = []
if (this.form.maintenances) {
arr = this.form.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
}
})
})
this.selecUserList = res.data
})
},
//
openSelecUser(field) {
this.field = field
this.isShowSelecUser = true
},
radioGroupChange(field, e, list) {
this.chooseUserInfo = e
},
//
selectFormatRadin(val, array) {
let str = array.filter(item => item.id == val)[0].name
return str
},
//
chooseUser() {
this.form[this.field] = this.chooseUserInfo
this.isShowSelecUser = false
},
},
async onLoad(option) {
if (option.type) this.type = option.type;
if (option.id) this.form.id = option.id;
this.deviceMoldType = await dictApi.getDict('device_mold_type')
this.deviceMoldType = this.deviceMoldType.filter(item => item.value != this.type)
}
}
</script>
<style lang="scss" scoped>
.add-form-container {
min-height: calc(100vh - 140rpx);
background: white;
padding: 0px 30rpx 140rpx;
}
.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>

6
plugins/tab.js

@ -24,7 +24,9 @@ export default {
})
},
// 关闭当前页面,返回上一页面或多级页面
navigateBack() {
return uni.navigateBack()
navigateBack(level) {
return uni.navigateBack({
delta:level
})
}
}

Loading…
Cancel
Save