工单作业、工单查询、报工查询

This commit is contained in:
2023-05-25 13:41:11 +08:00
parent d29959513d
commit 934ff5186d
10 changed files with 621 additions and 118 deletions

View File

@@ -6,21 +6,21 @@
<div class="filter_label">设备</div>
<div class="filter-input-wrap">
<el-select v-model="value" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
<el-option
v-for="item in options"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code">
</el-option>
</el-select>
</div>
</div>
</div>
<div class="wrap-buttons">
<button class="button button--primary" @click="getDatas">查询</button>
<button class="button button--primary" :disabled="disabled1" @click="_openStart">开工</button>
<button class="button button--primary" :disabled="disabled2" @click="_saveReport">报工</button>
<button class="button button--primary" :disabled="disabled3" @click="_tofinish">强制完成</button>
<button class="button button--primary" :class="{'button--defalut': pkId === ''}" :disabled="disabled1" @click="_openStart">开工</button>
<button class="button button--primary" :class="{'button--defalut': pkId === ''}" :disabled="disabled2" @click="_saveReport">报工</button>
<button class="button button--primary" :class="{'button--defalut': pkId === ''}" :disabled="disabled3" @click="showDialog">强制完成</button>
</div>
</div>
<div class="grid_wraper">
@@ -40,63 +40,136 @@
</tr>
<tr v-for="e in dataList" :key="e.workorder_id">
<td>
<button class="iconfont select_icon" :class="pkId === e.workorder_id ? 'selected_icon' : 'unselect_icon'" @click="toRadio(e)"></button>
<button class="iconfont select_icon" :class="{'selected_icon': pkId === e.workorder_id}" @click="toRadio(e)"></button>
</td>
<td>{{e.create_time}}</td>
<td>{{e.workorder_code}}</td>
<td>{{e.shift_type_scode_name}}</td>
<td>{{e.material_name}}</td>
<td>{{['创建','下发','生产中','暂停', '完成'][Number(e.workorder_status) - 1]}}</td>
<td>{{e.device_code}}</td>
<td>{{e.material_spec}}</td>
<td>{{e.workprocedure_name}}</td>
<td>{{['创建','下发','生产中','暂停', '完成'][Number(e.order_status) - 1]}}</td>
<td>{{e.plan_qty}}</td>
<td>{{e.real_qty}}</td>
<td>
</td>
<td>{{e.realproducestart_date}}</td>
<td>{{e.realproduceend_date}}</td>
<td>{{ e.report_qty }}</td>
<td>{{ e.real_qty }}</td>
<td>{{ e.realproducestart_date }}</td>
</tr>
</table>
</div>
<jxDialog
ref="child"
title="提示"
@toSure="toSureDialog"
>
<div class="form_wraper">当前操作为强制确认确定继续操作吗</div>
</jxDialog>
</div>
</template>
<script>
import { deviceList, getTable, openStart, tofinish, saveReport } from '../../../config/getData2.js'
import jxDialog from '@components/dialog.vue'
import {accSubtract} from '@config/utils.js'
export default {
components: {
jxDialog
},
data () {
return {
options: [{
value: '选项1',
label: '超级管理员'
}, {
value: '选项2',
label: '系统管理员'
}, {
value: '选项3',
label: '普通用户'
}, {
value: '选项4',
label: '开发人员'
}],
options: [],
value: '',
disabled1: false,
disabled2: false,
disabled3: false,
dataList: [{workorder_id: '1'}, {workorder_id: '2'}],
dataList: [],
pkId: '',
pkObj: {}
}
},
created () {
this._deviceList()
},
methods: {
getDatas () {
async _deviceList () {
let res = await deviceList()
if (res.code === 200) {
this.options = [...res.content]
}
},
_openStart () {
async getDatas () {
let res = await getTable(this.value)
res.content.map(el => {
let qty = '0'
if (Number(accSubtract(el.plan_qty, el.real_qty)) > 0) {
qty = accSubtract(el.plan_qty, el.real_qty)
}
this.$set(el, 'report_qty', qty)
})
this.dataList = [...res.content]
},
_saveReport () {
// 开工
async _openStart () {
this.disabled1 = true
if (!this.pkId) {
this.toast('请选择一行')
this.disabled1 = false
return
}
try {
let res = await openStart(this.pkId, this.value)
this.toast(res.message)
this.disabled1 = false
this.pkId = ''
this.pkObj = {}
this.getDatas()
} catch (e) {
this.disabled1 = false
}
},
_tofinish () {
// 报工
async _saveReport () {
this.disabled2 = true
if (!this.pkId) {
this.toast('请选择一行')
this.disabled2 = false
return
}
try {
let res = await saveReport(this.pkId, this.pkObj.report_qty, this.pkObj.nok_qty, this.pkObj.repare_qty)
this.toast(res.message)
this.disabled2 = false
this.pkId = ''
this.pkObj = {}
this.getDatas()
} catch (e) {
this.disabled2 = false
}
},
showDialog () {
if (!this.pkId) {
this.toast('请选择一行')
return
}
this.$refs.child.active = true
},
// 完工
async _tofinish () {
this.$refs.child.disabled = true
this.disabled3 = true
try {
let res = await tofinish(this.pkObj)
this.toast(res.message)
this.disabled3 = false
this.$refs.child.active = false
this.$refs.child.disabled = false
this.getDatas()
} catch (e) {
this.disabled3 = false
this.$refs.child.active = false
this.$refs.child.disabled = false
}
},
toSureDialog () {
this._tofinish()
},
toRadio (e) {
this.pkId = this.pkId === e.workorder_id ? '' : e.workorder_id