This commit is contained in:
2023-04-10 11:16:58 +08:00
parent 6d1252502f
commit 8a867e704d
9 changed files with 67 additions and 124 deletions

View File

@@ -11,14 +11,11 @@ export const getDevice = () => post('api/produceshiftorder/getDeviceList', {
}) })
// 2.工单管理 // 2.工单管理
export const getTable = (code, val, d1, d2, is, ids, qc) => post('api/produceshiftorder/getTable', { export const getTable = (code, val, d1, d2) => post('api/produceshiftorder/getOrderList', {
device_code: code, device_code: code,
key_value: val, key_value: val,
order_date1: d1, realproducestart_date: d1,
order_date2: d2, realproduceend_date: d2
is_finished: is,
is_producted: ids,
is_qc: qc
}) })
// 3.设备开工 // 3.设备开工

View File

@@ -150,7 +150,7 @@ export default {
async loginApi () { async loginApi () {
try { try {
let res = await handLogin(this.loginname, encrypt(this.password)) let res = await handLogin(this.loginname, encrypt(this.password))
this.$store.dispatch('setUserInfo', JSON.stringify(res.user.user)) this.$store.dispatch('saveUserInfo', JSON.stringify(res.user.user))
this.$store.dispatch('saveToken', res.token) this.$store.dispatch('saveToken', res.token)
this.$router.push('/home') this.$router.push('/home')
this.disabled = false this.disabled = false

View File

@@ -18,10 +18,10 @@
<i v-show="closeIcon1" class="iconfont close_icon" @click="clearData(1)"></i> <i v-show="closeIcon1" class="iconfont close_icon" @click="clearData(1)"></i>
</div> </div>
<div class="fr mgt10"> <div class="fr mgt10">
<button class="mgr5 button--primary" @click="toSearch">&nbsp;&nbsp;</button> <button class="mgr5 button--primary" @click="getDatas">&nbsp;&nbsp;</button>
<button class="button--primary" :disabled="disabled1" @click="_openStart">开工</button> <button class="button--primary" :class="{'button--defalut': !pkId}" :disabled="disabled1" @click="_openStart">开工</button>
<button class="button--primary" :disabled="disabled2" @click="addProduce">报工</button> <button class="button--primary" :class="{'button--defalut': !pkId}" :disabled="disabled2" @click="_saveReport">报工</button>
<button class="button--primary" :disabled="disabled3" @click="addProduce">完工</button> <button class="button--primary" :class="{'button--defalut': !pkId}" :disabled="disabled3" @click="_tofinish">完工</button>
</div> </div>
</div> </div>
<table class="filter-table"> <table class="filter-table">
@@ -32,24 +32,24 @@
<th width="9%">物料名称</th> <th width="9%">物料名称</th>
<th width="8%">工序</th> <th width="8%">工序</th>
<th width="9%">工单状态</th> <th width="9%">工单状态</th>
<th width="10%">生产数量</th> <th width="10%">计划数量</th>
<th width="9%">上报残次数</th> <th width="9%">实际数量</th>
<th width="9%">本次加工</th> <th width="9%">报工数量</th>
<th width="13%">开始时间</th> <th width="13%">开始时间</th>
<th width="13%">结束时间</th> <th width="13%">结束时间</th>
</tr> </tr>
<tr v-for="e in datas" :key="e.pk_id" @click="toRadio(e)"> <tr v-for="e in dataList" :key="e.workorder_id" @click="toRadio(e)">
<td> <td>
<button class="iconfont select_icon" :class="pkId === e.pk_id ? 'selected_icon' : 'unselect_icon'"></button> <button class="iconfont select_icon" :class="pkId === e.workorder_id ? 'selected_icon' : 'unselect_icon'"></button>
</td> </td>
<td>{{e.produceorder_code}}</td> <td>{{e.workorder_code}}</td>
<td>{{e.shift_type_scode_name}}</td> <td>{{e.shift_type_scode}}</td>
<td>{{e.material_name}}</td> <td>{{e.material_name}}</td>
<td>{{e.workprocedure_name}}</td> <td>{{e.workprocedure_name}}</td>
<td>{{['未生产','生产中','生产完成','已报工'][Number(e.order_status)]}}</td> <td>{{['创建','下发','生产中','暂停', '完成'][Number(e.order_status) - 1]}}</td>
<td>{{e.produce_qty}}</td> <td>{{e.plan_qty}}</td>
<td>{{e.unqualified_qty}}</td> <td>{{e.real_qty}}</td>
<td>{{e.this_qty}}</td> <td>{{e.report_qty}}</td>
<td>{{e.realproducestart_date}}</td> <td>{{e.realproducestart_date}}</td>
<td>{{e.realproduceend_date}}</td> <td>{{e.realproduceend_date}}</td>
</tr> </tr>
@@ -75,7 +75,7 @@ export default {
value1: [new Date(), new Date()], value1: [new Date(), new Date()],
deviceCode: this.$route.query.code, deviceCode: this.$route.query.code,
keyValue: '', keyValue: '',
datas: [], dataList: [],
pkId: '', pkId: '',
pkObj: {}, pkObj: {},
disabled1: false, disabled1: false,
@@ -86,9 +86,6 @@ export default {
computed: { computed: {
closeIcon1 () { closeIcon1 () {
return this.keyValue !== '' return this.keyValue !== ''
},
closeIcon2 () {
return this.produceQty !== ''
} }
}, },
created () { created () {
@@ -106,30 +103,12 @@ export default {
} }
}, },
async getDatas () { async getDatas () {
let res = await getTable(this.$route.query.code, this.keyValue, this.value1 !== null ? dateFtt(this.value1[0]) : '', this.value1 !== null ? dateFtt(this.value1[1]) : '', '0', '', '0') let res = await getTable(this.$route.query.code, this.keyValue, this.value1 !== null ? dateFtt(this.value1[0]) : '', this.value1 !== null ? dateFtt(this.value1[1]) : '')
this.datas = [...res] this.dataList = [...res.content]
},
toSearch () {
this.getDatas()
}, },
toRadio (e) { toRadio (e) {
this.pkId = this.pkId === e.pk_id ? '' : e.pk_id this.pkId = this.pkId === e.workorder_id ? '' : e.workorder_id
this.pkObj = this.pkId === e.pk_id ? e : {} this.pkObj = this.pkId === e.workorder_id ? e : {}
},
closeModalCall () {
this.mdShow = false
},
comfirmCall () {
this.disabled = true
if (this.produceQty === '' || this.produceQty === null) {
this.toast('请输入追加数量')
this.disabled = false
return
}
this.addProduceData()
},
addProduce () {
this.mdShow = true
}, },
async _openStart () { async _openStart () {
this.disabled1 = true this.disabled1 = true
@@ -139,9 +118,11 @@ export default {
return return
} }
try { try {
let res = await openStart() let res = await openStart(this.pkId, this.deviceCode)
this.toast(res.desc) this.toast(res.message)
this.disabled1 = false this.disabled1 = false
this.pkId = ''
this.pkObj = {}
this.getDatas() this.getDatas()
} catch (e) { } catch (e) {
this.disabled1 = false this.disabled1 = false
@@ -155,9 +136,11 @@ export default {
return return
} }
try { try {
let res = await saveReport() let res = await saveReport(this.pkId, this.pkObj.report_qty)
this.toast(res.desc) this.toast(res.message)
this.disabled2 = false this.disabled2 = false
this.pkId = ''
this.pkObj = {}
this.getDatas() this.getDatas()
} catch (e) { } catch (e) {
this.disabled2 = false this.disabled2 = false
@@ -171,8 +154,8 @@ export default {
return return
} }
try { try {
let res = await tofinish() let res = await tofinish(this.pkObj)
this.toast(res.desc) this.toast(res.message)
this.disabled3 = false this.disabled3 = false
this.getDatas() this.getDatas()
} catch (e) { } catch (e) {

View File

@@ -2,25 +2,22 @@
<div> <div>
<section class="content"> <section class="content">
<div class="device-status"> <div class="device-status">
<button class="fl mgt10 mgl10 button--primary" @click="toIfWork">设备开/完工</button>
<p><span class="icon red"></span><span class="txt">有任务</span></p> <p><span class="icon red"></span><span class="txt">有任务</span></p>
<p><span class="icon green"></span><span class="txt">生产中</span></p> <p><span class="icon green"></span><span class="txt">生产中</span></p>
<p><span class="icon blue"></span><span class="txt">停机</span></p> <p><span class="icon blue"></span><span class="txt">停机</span></p>
<p><span class="icon white"></span><span class="txt">待机</span></p> <p><span class="icon white"></span><span class="txt">待机</span></p>
</div> </div>
<div class="list-box"> <div class="list-box">
<div class="device" <div class="device" v-for="e in dataList" :key="e.device_code" :class="{bg1:e.is_run=='1',bg2:e.is_run=='0'}" @click="toOperation(e)"
:class="{bg1:item.is_run=='1',bg2:item.is_run=='0'}"
v-for="(item, index) in list" :key="index"
@click="toOperation(item)"
> >
<div class="device-top"><div class="img"><img v-show="item.device_icon" :src="item.imgurl" alt=""></div></div> <div class="device-top">
<div class="fl icon" :class="{blue:item.device_status=='3',red:item.device_status=='2',green:item.device_status=='1',white:item.device_status=='0'}"></div> <div class="img"><img v-show="e.device_icon" :src="e.imgurl" alt=""></div></div>
<div class="fl desc"> <div class="fl icon" :class="['white', 'green', 'red', 'blue'][Number(e.device_status)]"></div>
<p class="device_name">{{item.device_name}}</p> <div class="fl desc">
<p class="ellipsis">任务数: {{item.job_count}}</p> <p class="device_name">{{e.deviceName}}</p>
<p class="ellipsis">工单: {{item.produceorder_code}}</p> <p class="ellipsis">任务数: {{e.job_count}}</p>
</div> <p class="ellipsis">工单: {{e.workorderCode}}</p>
</div>
</div> </div>
</div> </div>
<Back></Back> <Back></Back>
@@ -40,7 +37,7 @@ export default {
data () { data () {
return { return {
timer: null, timer: null,
list: [] dataList: []
} }
}, },
mounted () { mounted () {
@@ -51,29 +48,21 @@ export default {
refresh () { refresh () {
this.timer = setInterval(() => { this.timer = setInterval(() => {
this.getList() this.getList()
}, 30000) }, 3000)
}, },
async getList () { async getList () {
let res = await getDevice() let res = await getDevice()
let newArr = [] let newArr = []
res.map(el => { res.map(el => {
newArr.push(Object.assign({}, el, {imgurl: this.$store.getters.imgBaseUrl + el.device_icon})) newArr.push(Object.assign({}, el, {imgurl: this.$store.getters.imgBaseUrl + '/' + el.device_icon}))
}) })
this.list = [...newArr] this.dataList = [...newArr]
// this.$store.dispatch('getIsProplan', res.result.is_productonplan)
}, },
toIfWork () { toOperation (e) {
// this.$router.push('/ifwork') if (e.is_run === '1') {
},
toOperation (item) {
if (item.is_run === '1') {
// let obj = {
// code: item.device_code
// }
// this.$store.dispatch('setDevice', obj)
this.$router.push({ this.$router.push({
path: '/workordermanage', path: '/workordermanage',
query: {code: item.device_code} query: {code: e.deviceCode}
}) })
} }
} }
@@ -161,7 +150,9 @@ export default {
line-height .25rem line-height .25rem
p p
font-size .13rem font-size .13rem
color #fff
.device_name .device_name
max-height .5rem max-height .5rem
overflow hidden overflow hidden
color #fff
</style> </style>

View File

@@ -2,9 +2,8 @@
<div> <div>
<header> <header>
<div class="left-box"> <div class="left-box">
<button class="fl logo iconfont dropdown_icon" ref="logo" @click="getInfo">登录人员 {{this.$store.getters.userName}}</button> <button class="fl logo iconfont dropdown_icon" ref="logo" @click="getInfo">登录人员 {{userName}}</button>
<ul class="drift dropdown-ul" id="dropdown-ul" :style="{'height': drift+'rem','width' : cwidth + 'px'}"> <ul class="drift dropdown-ul" id="dropdown-ul" :style="{'height': drift+'rem','width' : cwidth + 'px'}">
<li>部门: {{this.$store.getters.deptName}}</li>
<li @click="exit">退出</li> <li @click="exit">退出</li>
</ul> </ul>
</div> </div>
@@ -22,6 +21,7 @@ export default {
name: 'homeset', name: 'homeset',
data () { data () {
return { return {
userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
timer: null, timer: null,
time: '', time: '',
date: '', date: '',
@@ -36,10 +36,10 @@ export default {
methods: { methods: {
getInfo () { getInfo () {
this.cwidth = this.$refs.logo.clientWidth this.cwidth = this.$refs.logo.clientWidth
this.drift = this.drift === 0 ? 1 : 0 this.drift = this.drift === 0 ? 0.5 : 0
}, },
exit () { exit () {
this.$store.dispatch('setSignOut') this.$store.dispatch('delUserInfo')
this.$router.push('/login') this.$router.push('/login')
}, },
updateTime () { updateTime () {

View File

@@ -88,9 +88,9 @@
padding 0 .1rem padding 0 .1rem
border-radius 5px border-radius 5px
.button--defalut .button--defalut
color #606266 color #fff
border 1px solid #dcdfe6 border 1px solid #c9c9c9
background-color #fff background-color #c9c9c9
/**header*/ /**header*/
header header
@@ -101,6 +101,7 @@ header
.header-tip .header-tip
line-height .6rem line-height .6rem
font-size .2rem font-size .2rem
color #fff
.header-btn .header-btn
margin-top .15rem margin-top .15rem
@@ -219,4 +220,7 @@ input::-webkit-input-placeholder
.el-select-dropdown__item .el-select-dropdown__item
height .26rem !important height .26rem !important
line-height .26rem !important line-height .26rem !important
font-size .16rem !important font-size .16rem !important
.el-input__inner
height .3rem
line-height .3rem

View File

@@ -1,8 +1,8 @@
import * as types from '../types' import * as types from '../types'
import { getStore, setStore } from '@config/utils.js' import { getStore, setStore } from '@config/utils.js'
const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.107:8080/hlapp' : 'http://192.168.81.100:8081/hl_nlapp' const baseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.171:8018' : 'http://192.168.81.171:8018'
const imgBaseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.100/' : 'http://192.168.81.107/' const imgBaseUrl = process.env.NODE_ENV === 'development' ? 'http://192.168.81.171:8018' : 'http://192.168.81.171:8018'
const state = { const state = {
baseUrl: getStore('baseUrl') || baseUrl, baseUrl: getStore('baseUrl') || baseUrl,
imgBaseUrl: getStore('imgBaseUrl') || imgBaseUrl, imgBaseUrl: getStore('imgBaseUrl') || imgBaseUrl,

View File

@@ -2,10 +2,6 @@ import * as types from '../types'
import { getStore, setStore } from '@config/utils.js' import { getStore, setStore } from '@config/utils.js'
const state = { const state = {
accountId: getStore('accountId') || '',
accountName: getStore('accountName') || '',
userName: getStore('userName') || '',
deptName: getStore('deptName') || '',
userInfo: getStore('userInfo') ? getStore('userInfo') : '', userInfo: getStore('userInfo') ? getStore('userInfo') : '',
saveToken: getStore('saveToken') || '' saveToken: getStore('saveToken') || ''
} }
@@ -20,26 +16,13 @@ const getters = {
} }
const actions = { const actions = {
setUserInfo ({ commit }, res) {
setStore('accountId', res.account_id)
setStore('accountName', res.account_name)
setStore('userName', res.user_name)
setStore('deptName', res.dept_name)
commit(types.SET_USER_INFO, res)
},
setSignOut ({ commit }) {
localStorage.removeItem('accountId')
localStorage.removeItem('accountName')
localStorage.removeItem('userName')
localStorage.removeItem('deptName')
commit(types.SET_SIGN_OUT)
},
saveUserInfo ({commit}, res) { saveUserInfo ({commit}, res) {
setStore('userInfo', res) setStore('userInfo', res)
commit(types.SAVE_USER_INFO, res) commit(types.SAVE_USER_INFO, res)
}, },
delUserInfo ({commit}, res) { delUserInfo ({commit}, res) {
localStorage.removeItem('userInfo') localStorage.removeItem('userInfo')
localStorage.removeItem('saveToken')
commit(types.DEL_USER_INFO, res) commit(types.DEL_USER_INFO, res)
}, },
saveToken ({commit}, res) { saveToken ({commit}, res) {
@@ -49,23 +32,10 @@ const actions = {
} }
const mutations = { const mutations = {
[types.SET_USER_INFO] (state, res) {
state.accountId = res.account_id
state.accountName = res.account_name
state.userName = res.user_name
state.deptName = res.dept_name
},
[types.SET_SIGN_OUT] (state) {
state.accountId = ''
state.accountName = ''
state.userName = ''
state.deptName = ''
},
[types.SAVE_USER_INFO] (state, res) { [types.SAVE_USER_INFO] (state, res) {
state.userInfo = res state.userInfo = res
}, },
[types.DEL_USER_INFO] (state, res) { [types.DEL_USER_INFO] (state, res) {
state.userInfo = res
}, },
[types.SAVE_TOKEN] (state, res) { [types.SAVE_TOKEN] (state, res) {
state.saveToken = res state.saveToken = res

View File

@@ -9,8 +9,6 @@ export const COM_SHOW_ALERT = 'COM_SHOW_ALERT'
export const COM_ALERT_MSG = 'COM_ALERT_MSG' export const COM_ALERT_MSG = 'COM_ALERT_MSG'
// 用户 // 用户
export const SET_USER_INFO = 'SET_USER_INFO'
export const SET_SIGN_OUT = 'SET_SIGN_OUT'
export const SAVE_USER_INFO = 'SAVE_USER_INFO' export const SAVE_USER_INFO = 'SAVE_USER_INFO'
export const DEL_USER_INFO = 'DEL_USER_INFO' export const DEL_USER_INFO = 'DEL_USER_INFO'
export const SAVE_TOKEN = 'SAVE_TOKEN' export const SAVE_TOKEN = 'SAVE_TOKEN'