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

2
src/pages/deviceReport/index.vue

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

8
src/pages/repairOrder/addServiceRecord.vue

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

199
src/pages/repairOrder/detail.vue

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

5
src/pages/repairOrder/index.vue

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

18
src/store/modules/user.js

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

3
src/utils/constant.js

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

2
src/utils/storage.js

@ -4,7 +4,7 @@ import constant from './constant'
let storageKey = 'storage_data' 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) || {} let storageData = uni.getStorageSync(storageKey) || {}

Loading…
Cancel
Save