Browse Source

设备报修和维修工单测试

master
zhang_li 9 months ago
parent
commit
1b98d15857
  1. 8
      src/pages/deviceReport/addForm.vue
  2. 2
      src/pages/deviceReport/index.vue
  3. 15
      src/pages/repairOrder/addForm.vue
  4. 8
      src/pages/repairOrder/addServiceRecord.vue
  5. 233
      src/pages/repairOrder/detail.vue
  6. 5
      src/pages/repairOrder/index.vue
  7. 18
      src/store/modules/user.js
  8. 3
      src/utils/constant.js
  9. 2
      src/utils/storage.js

8
src/pages/deviceReport/addForm.vue

@ -28,13 +28,13 @@
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
</u-form-item>
<u-form-item :label="`${type=='DEVICE'||type == 'THEN'?'设备' : '模具'}`" prop="deviceNumber" required>
<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.deviceNumber'>
{{selectFormat(form.deviceNumber,deviceList)}}
</view>
<view class="placeholder" v-else>
{{`请选择${type=='DEVICE'||type == 'THEN'?'设备' : '模具'}`}}
{{`请选择${type=='DEVICE'||type == 'TECH'?'设备' : '模具'}`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28"></u-icon>
</view>
@ -124,7 +124,7 @@
},
// /
getDetailsByNumber() {
if (this.type == 'DEVICE'||this.type == 'THEN') {
if (this.type == 'DEVICE'||this.type == 'TECH') {
deviceApi.getDeviceByFactoryAreaNumber(this.form.factoryAreaNumber).then((res) => {
if (res.data && res.data.length > 0) {
res.data.map(item => {
@ -162,7 +162,7 @@
return;
}
if (!this.form.deviceNumber) {
this.$modal.showToast(`请选择${this.type=='DEVICE'||this.type=='THEN'?'设备' : '模具'}`)
this.$modal.showToast(`请选择${this.type=='DEVICE'||this.type=='TECH'?'设备' : '模具'}`)
return;
}
if (!this.form.receiverType) {

2
src/pages/deviceReport/index.vue

@ -22,7 +22,7 @@
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
类型:<span>{{item.type=='DEVICE'?'设备':item.type=='THEN'?'工艺':'模具'}}</span>
类型:<span>{{item.type=='DEVICE'?'设备':item.type=='TECH'?'工艺':'模具'}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>

15
src/pages/repairOrder/addForm.vue

@ -16,13 +16,13 @@
<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="deviceNumber" required>
<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=='DEVICE'||type == 'TECH'?'设备' : '模具'}名称`}}
</view>
<u-icon name="arrow-right" color="#aaaaaa" size="28" v-if="!form.id"></u-icon>
</view>
@ -107,7 +107,7 @@
return;
}
if (!this.form.deviceNumber) {
this.$modal.showToast(`请选择${this.type=='DEVICE'?'设备' : '模具'}名称`)
this.$modal.showToast(`请选择${this.type=='DEVICE'||this.type == 'TECH'?'设备' : '模具'}名称`)
return;
}
if (!this.form.factoryAreaName) {
@ -125,8 +125,7 @@
deviceNumber: this.form.deviceNumber,
factoryAreaNumber: this.form.factoryAreaNumber,
classes: this.form.classes,
faultType: this.form.faultType,
type: this.type
faultType: this.form.faultType
}
if (this.form.id) {
this.$modal.confirm('是否修改维修工单').then(() => {
@ -176,10 +175,9 @@
//
reset() {
if (this.form.id) {
this.form.classes = '';
this.form.faultType = ''
this.form.classes = undefined;
this.form.faultType = undefined
} else {
this.form = {}
}
},
@ -209,7 +207,6 @@
this.form[this.field] = e[0].value
if (this.field == 'deviceNumber') {
this.choosesingleColumnItem = this.singleColumnList.filter(item => item.number == e[0].value)
console.log(this.choosesingleColumnItem)
this.form.factoryAreaName = this.choosesingleColumnItem[0].factoryAreaName
this.form.factoryAreaNumber = this.choosesingleColumnItem[0].factoryAreaNumber
this.form.deviceName = this.choosesingleColumnItem[0].name

8
src/pages/repairOrder/addServiceRecord.vue

@ -75,7 +75,7 @@
</view>
</u-form-item>
<u-form-item label="数量" prop="qty" required>
<u-input v-model="form1.qty" type="number" placeholder="请输入故障描述" />
<u-input v-model="form1.qty" type="number" placeholder="请输入数量" />
</u-form-item>
</u-form>
</view>
@ -127,7 +127,7 @@
selecUserList: [], //
isShowSelecUser: false,
form: {
maintenanceNumber: '',
number: '',
describes: '',
describes1: '',
workOut: '',
@ -311,7 +311,7 @@
this.$modal.showToast('请选择备件')
return;
}
if (!this.form1.qty) {
if (!this.form1.qty||this.form1.qty ==0) {
this.$modal.showToast('请输入数量')
return;
}
@ -336,7 +336,7 @@
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.number) this.form.number = option.number;
if (option.data && JSON.parse(decodeURIComponent(option.data)) && JSON.parse(decodeURIComponent(option
.data)).id) {
this.form = JSON.parse(decodeURIComponent(option.data))

233
src/pages/repairOrder/detail.vue

@ -4,7 +4,9 @@
<view class="info">
<view class="title">
<view>维修工单</view>
<view @click="transfer" v-if="data.status == 'PECEIVED' && (!serviceList || serviceList && serviceList.length == 0)">转办</view>
<view @click="transfer"
v-if="data.status == 'PECEIVED' && (!serviceList || serviceList && serviceList.length == 0)">转办
</view>
</view>
<view class="dec">
<view class="dec-item">
@ -24,34 +26,34 @@
<view>{{data.faultTypeName}}</view>
</view>
<view class="dec-item">
<view class="dec-item" v-if="data.createTime">
<view>创建时间</view>
<view>{{deviceInfo.typeName}}</view>
<view>{{$time.formatDate(data.createTime)}}</view>
</view>
<view class="dec-item">
<view class="dec-item" v-if="data.creator">
<view>创建人员</view>
<view>{{deviceInfo.typeName}}</view>
<view>{{data.creator}}</view>
</view>
<view class="dec-item">
<view class="dec-item" v-if="data.receivingTime">
<view>接单时间</view>
<view>{{deviceInfo.typeName}}</view>
<view>{{$time.formatDate(data.receivingTime)}}</view>
</view>
<view class="dec-item">
<view class="dec-item" v-if="data.maintenanceName">
<view>接单人员</view>
<view>{{deviceInfo.maintenanceName}}</view>
<view>{{data.maintenanceName}}</view>
</view>
<view class="dec-item">
<view class="dec-item" v-if="data.completionTime">
<view>完成时间</view>
<view>{{deviceInfo.typeName}}</view>
<view>{{$time.formatDate(data.completionTime)}}</view>
</view>
<view class="dec-item">
<view class="dec-item" v-if="data.verifyTime">
<view>验证时间</view>
<view>{{deviceInfo.typeName}}</view>
<view>{{$time.formatDate(data.verifyTime)}}</view>
</view>
<view class="dec-item">
<view class="dec-item" v-if="data.verifyer">
<view>验证人员</view>
<view>{{deviceInfo.typeName}}</view>
<view>{{data.verifyer}}</view>
</view>
</view>
</view>
@ -66,25 +68,25 @@
<view class="title">
<view>{{changeItem.name}}</view>
</view>
<view class="dec" v-if="current == 0">
<view class="dec" v-if="changeItem.value == 1">
<view class="dec-item">
<view>设备编号</view>
<view>{{deviceInfo.number}}</view>
<view>{{data1.deviceNumber}}</view>
</view>
<view class="dec-item">
<view>设备名称</view>
<view>{{deviceInfo.name}}</view>
<view>{{data1.name}}</view>
</view>
<view class="dec-item">
<view>所属厂区</view>
<view>{{deviceInfo.factoryAreaName}}</view>
<view>{{data1.factoryAreaName}}</view>
</view>
<view class="dec-item">
<view>设备类型</view>
<view>{{deviceInfo.typeName}}</view>
<view>{{data1.type == 'DEVICE'?'设备':data1.type == 'TECH'?'工艺':'模具'}}</view>
</view>
</view>
<view class="dec" v-if="current == 1">
<view class="dec" v-if="changeItem.value == 2">
<view class="dec-item">
<view>报修单号</view>
<view>{{data1.number}}</view>
@ -101,15 +103,13 @@
<view>报修时间</view>
<view>{{data1.describes}}</view>
</view>
<view class="dec-item">
<!-- <view>图片</view> -->
<view class="images">
{{data1.filePathList}}
<image :src="cur" mode="" v-for="(cur,key) in data1.filePathList" :key='key' @click="previewImage(key,data1.filePathList)"></image>
</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="current == 2">
<view class="list" v-if="changeItem.value == 3">
<view class="item " v-for="(item,index) in serviceList" :key="index"
@click="addSubForm('updata',item)">
<view class="item-box">
@ -117,7 +117,7 @@
<view class="title-txt">
{{item.describes}}
</view>
<u-icon name="trash" color="#aaaaaa" size="40"
<u-icon name="trash" color="#aaaaaa" size="40" v-if="(data.status == 'PENDING' || data.status == 'PECEIVED')&& $store.state.user.post.code == 'worker'"
@click.native.stop="delService(item)"></u-icon>
</view>
<view class="dec2">
@ -149,7 +149,8 @@
</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')&& $store.state.user.post == 'worker'" >
<view class="add-btn"
v-if="(data.status == 'PENDING' || data.status == 'PECEIVED')&& $store.state.user.post.code == 'worker'">
<u-button type="primary" @click="addSubForm('creat')"><u-icon name="plus-circle" color="#ffffff"
size="36"></u-icon>添加维修内容</u-button>
</view>
@ -157,13 +158,15 @@
</view>
</view>
<view class="footer">
<view class="btns">
<u-button type="primary" v-if="data.status == 'PENDING'&& $store.state.user.post.code == 'worker'" @click="orderClick(1)" :loading='loading'
:disabled='loading'>接单</u-button>
<u-button type="primary" v-if="data.status == 'PECEIVED'&& $store.state.user.post.code == 'worker'" @click="orderClickSuccess()" :loading='loading'
<view class="btns" v-if="data.status == 'PENDING'&& $store.state.user.post.code == 'worker'">
<u-button type="primary" @click="orderClick(1)" :loading='loading' :disabled='loading'>接单</u-button>
</view>
<view class="btns" v-if="data.status == 'PECEIVED'&& $store.state.user.post.code == 'worker'">
<u-button type="primary" @click="orderClickSuccess()" :loading='loading'
:disabled='loading'>完成</u-button>
<u-button type="primary" v-if="data.status == 'COMPLETED'&& $store.state.user.post.code == 'engineer'" @click="orderClick(3)" :loading='loading'
:disabled='loading'>验证完结</u-button>
</view>
<view class="btns" v-if="data.status == 'COMPLETED'&& $store.state.user.post.code == 'engineer'">
<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>
@ -171,8 +174,7 @@
<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-group v-model="result" @change="radioGroupChange">
<u-radio v-for="(item, index) in orderCompleteResult" :key="index" :name="item.value">
{{item.label}}
</u-radio>
@ -188,7 +190,6 @@
</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"
@ -196,24 +197,30 @@
data() {
return {
list: [{
name: '设备信息'
name: '设备信息',
value: 1
}, {
name: '报修信息'
name: '报修信息',
value: 2
}, {
name: '维修内容'
name: '维修内容',
value: 3
}],
current: 0,
changeItem: '',
changeItem: {
name: '设备信息',
value: 1
},
data: '', //
loading: false,
type: "",
deviceInfo: '', //
serviceList: [], //
//
isShowSuccess:false,
orderCompleteResult:[],//
result:'TEMPORARILY',
data1:''
isShowSuccess: false,
orderCompleteResult: [], //
result: 'TEMPORARILY',
data1: ''
}
},
methods: {
@ -224,7 +231,7 @@
},
//
addSubForm(clickType, item) {
if(this.data.status == 'PENDING'){
if (this.data.status == 'PENDING') {
this.$modal.showToast('请先接单')
return
}
@ -246,56 +253,56 @@
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'?'设备' : '模具'}`)
}
})
}
},
//
orderClickSuccess(){
orderClickSuccess() {
//
if (this.data.status == 'PECEIVED') {
console.log(this.$store.state.user.id)
console.log(this.data)
if (this.$store.state.user.id != this.data.maintenance) {
this.$modal.showToast('当前人员与接单人员不一致')
return;
}
if (!this.serviceList || this.serviceList && this.serviceList.length == 0) {
this.$modal.showToast('请添加维修内容')
return;
}
if (!this.data.classesName || !this.data.faultTypeName) {
this.$modal.showToast('请完善班次和故障类型')
return;
}
}
this.isShowSuccess = true
},
radioGroupChange(e){
radioGroupChange(e) {
console.log(e)
this.result = e
},
sure(){
sure() {
this.isShowSuccess = false
this.orderClick(2)
},
// APP
orderClick(type) {
if(this.data.status == 'PECEIVED'){
if(!this.serviceList || this.serviceList&&this.serviceList.length == 0){
this.$modal.showToast('请添加维修内容')
//
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 data = {
number: this.data.number,
status: this.data.status,
id: this.data.id,
result:type == 2? this.result :'',
result: type == 2 ? this.result : '',
requestNumber: ''
}
let tips = this.data.status == 'PENDING' ? '是否接单?' : this.data.status == 'PECEIVED' ? '是否完成?' : this.data
@ -328,7 +335,7 @@
}).then((res) => {
if (res.data) {
this.data1 = res.data
console.log(this.data1 )
console.log(this.data1)
}
})
},
@ -352,23 +359,23 @@
})
})
},
transfer(){
transfer() {
this.$tab.navigateTo(`/pages/repairOrder/transfer?type=${this.type}&id=${this.data.id}`)
},
previewImage(current,array){
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);
}
}
});
urls: array,
current: current,
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function(data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function(err) {
console.log(err.errMsg);
}
}
});
}
},
async onLoad(option) {
@ -377,30 +384,49 @@
this.data = JSON.parse(decodeURIComponent(option.data))
}
console.log(this.data)
this.changeItem = this.list[this.current]
this.orderCompleteResult = await dictApi.getDict('order_complete_result')
this.data.maintenance = uni.getStorageSync('user').nickname
},
onShow() {
this.getDetailsByNumber()
this.getDeviceRepairDetailsByNumber()
if (this.data.requestNumber) {
this.getDeviceRepairDetailsByNumber()
this.list = [{
name: '设备信息',
value: 1
}, {
name: '报修信息',
value: 2
}, {
name: '维修内容',
value: 3
}]
} else {
this.list = [{
name: '设备信息',
value: 1
}, {
name: '维修内容',
value: 3
}]
}
this.getRepairOrderDetaiList()
}
}
</script>
<style lang="scss" scoped>
.detail-container{
.detail-container {
min-height: 100vh;
background: white;
}
.line{
.line {
background: #f5f5f5;
height: 20rpx;
}
.info {
background: white;
}
@ -589,14 +615,17 @@
justify-content: flex-start;
align-items: center;
}
::v-deep .u-radio-group {
display: grid !important;
padding-bottom: 20rpx;
}
.images{
.images {
display: flex;
width: 100%;
image{
image {
width: 30%;
margin-right: 20rpx;
height: 200rpx;

5
src/pages/repairOrder/index.vue

@ -26,7 +26,7 @@
工单单号:<span>{{item.number}}</span>
</view>
<view class="dec">
类型:<span>{{item.type=='DEVICE'?'设备':item.type=='THEN'?'工艺':'模具'}}</span>
类型:<span>{{item.type=='DEVICE'?'设备':item.type=='TECH'?'工艺':'模具'}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
@ -48,7 +48,7 @@
<view class="time" style="flex: 1;">
{{`${$time.formatDate(item.createTime)}`}}
</view>
<view class="status" v-if=" $store.state.user.post.code == 'worker'">
<view class="status" v-if=" $store.state.user.post.code == 'worker'&&item.status=='PECEIVED'">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;" @click="addForm(item)">编辑</u-button>
</view>
@ -83,6 +83,7 @@
this.$tab.navigateTo(`/pages/repairOrder/screen?type=${this.params.type}`)
},
itemClick(item, index) {
console.log(33,item)
this.$tab.navigateTo(`/pages/repairOrder/detail?type=${this.params.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
},
addForm(item) {

18
src/store/modules/user.js

@ -16,19 +16,20 @@ const baseUrl = config.baseUrl
const user = {
state: {
id: 0, // 用户编号
id: storage.get(constant.id), // 用户编号
name: storage.get(constant.name),
avatar: storage.get(constant.avatar),
roles: storage.get(constant.roles),
permissions: storage.get(constant.permissions),
role:storage.get(constant.role),
post:storage.get(constant.post),
classType:storage.get(constant.classType),
dept:storage.get(constant.dept),
},
mutations: {
SET_ID: (state, id) => {
state.id = id
storage.set(constant.id, id)
},
SET_NAME: (state, name) => {
state.name = name
@ -50,9 +51,9 @@ const user = {
state.role = role
storage.set(constant.role, role)
},
SET_CLASSTYPE: (state, classType) => {
state.classType = classType
storage.set(constant.classType, classType)
SET_DEPT: (state, dept) => {
state.dept = dept
storage.set(constant.dept, dept)
},
SET_POST: (state, post) => {
state.post = post
@ -106,8 +107,6 @@ const user = {
commit('SET_ROLES', ['ROLE_DEFAULT'])
commit('SET_ROLE','')
}
commit('SET_NAME', nickname)
commit('SET_AVATAR', avatar)
resolve(res)
}).catch(error => {
reject(error)
@ -122,7 +121,10 @@ const user = {
return new Promise((resolve, reject) => {
getInfo().then(res => {
res = res.data; // 读取 data 数据
commit('SET_CLASSTYPE', res.dept.classType)
commit('SET_ID', res.id)
commit('SET_NAME', res.nickname)
commit('SET_AVATAR', res.avatar)
commit('SET_DEPT', res.dept)
if (res.posts && res.posts.length > 0) {
commit('SET_POST', res.posts.filter(item => item.code == 'worker' || item.code == 'engineer')[0])
} else {

3
src/utils/constant.js

@ -1,10 +1,11 @@
const constant = {
avatar: 'vuex_avatar',
id: 'vuex_id',
name: 'vuex_name',
roles: 'vuex_roles',
permissions: 'vuex_permissions',
role: 'vuex_role',
classType: 'vuex_classType',
dept: 'vuex_dept',
post: 'vuex_post',
}

2
src/utils/storage.js

@ -4,7 +4,7 @@ import constant from './constant'
let storageKey = 'storage_data'
// 存储节点变量名
let storageNodeKeys = [constant.avatar, constant.name, constant.roles, constant.permissions, constant.role, constant.classType,constant.post]
let storageNodeKeys = [constant.avatar, constant.id, constant.name, constant.roles, constant.permissions, constant.role, constant.dept,constant.post]
// 存储的数据
let storageData = uni.getStorageSync(storageKey) || {}

Loading…
Cancel
Save