代码更新

This commit is contained in:
2022-07-22 11:27:44 +08:00
parent d2a88b9a6f
commit 369a070a81
9 changed files with 344 additions and 28 deletions

View File

@@ -264,22 +264,29 @@ export default {
return this.dict.label.DEVICE_ATTRIBUTE_SCODE[row.device_type]
},
scrap() {
const _selectData = this.$refs.table.selection
const data = _selectData[0]
// if (data.status !== '10') {
// return this.crud.notify('设备未启用或不存在', CRUD.NOTIFICATION_TYPE.INFO)
// }
if (data.device_is_delete === '1') {
return this.crud.notify('设备不存在或被删除', CRUD.NOTIFICATION_TYPE.INFO)
}
if (data.status === '10' || data.status === '11') {
crudDevicescrap.scrap(data).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
} else {
return this.crud.notify('设备状态不正确,需启动设备或完成维修单及保养单', CRUD.NOTIFICATION_TYPE.INFO)
}
const msg = '是否继续'
this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const _selectData = this.$refs.table.selection
const data = _selectData[0]
// if (data.status !== '10') {
// return this.crud.notify('设备未启用或不存在', CRUD.NOTIFICATION_TYPE.INFO)
// }
if (data.device_is_delete === '1') {
return this.crud.notify('设备不存在或被删除', CRUD.NOTIFICATION_TYPE.INFO)
}
if (data.status === '10' || data.status === '11') {
crudDevicescrap.scrap(data).then(res => {
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
})
} else {
return this.crud.notify('设备状态不正确,需启动设备或完成维修单及保养单', CRUD.NOTIFICATION_TYPE.INFO)
}
})
},
downloadWord() {
const msg = '是否继续'

View File

@@ -0,0 +1,191 @@
<template>
<el-dialog
title="明细"
append-to-body
:visible.sync="dialogVisible"
fullscreen
:before-close="handleClose"
destroy-on-close
@close="close"
@open="open"
>
<div class="head-container">
<el-form
size="mini"
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="日期">
<!-- <date-range-picker v-model="dtlFrom.createTime" class="date-item" />-->
<div>
<el-input
v-model="dtlFrom.startTime"
disabled
style="width: 100px"
size="mini"
/> --
<el-input
v-model="dtlFrom.endTime"
disabled
style="width: 100px"
size="mini"
/>
</div>
</el-form-item>
<el-form-item label="设备">
<el-input
v-model="dtlFrom.device_name"
disabled
size="mini"
/>
</el-form-item>
<el-form-item label="oee指标">
<el-input
v-model="dtlFrom.oee_value"
disabled
size="mini"
/>
</el-form-item>
</el-form>
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-check"
size="mini"
@click="downdtl"
>
导出Excel
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
size="mini"
@selection-change="crud.selectionChangeHandler"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column show-overflow-tooltip prop="run_date" label="日期" />
<el-table-column show-overflow-tooltip prop="device_code" label="设备编码" />
<el-table-column show-overflow-tooltip prop="device_name" label="设备名称" />
<el-table-column show-overflow-tooltip prop="run_times" label="工作时间(分钟)" />
<el-table-column show-overflow-tooltip prop="prepare_times" label="准备时间(分钟)" />
<el-table-column show-overflow-tooltip prop="error_times" label="故障时间(分钟)" />
<el-table-column show-overflow-tooltip prop="adjust_times" label="工装调整时间(分钟)" />
<el-table-column show-overflow-tooltip prop="product_qty" label="生产总量" />
<el-table-column show-overflow-tooltip prop="nok_qty" label="不合格数" />
<el-table-column show-overflow-tooltip prop="theory_beat" label="理论生产节拍(分钟)" />
<el-table-column show-overflow-tooltip prop="oee_value" label="OEE指标" />
</el-table>
<!--分页组件-->
<pagination />
</div>
</el-dialog>
</template>
<script>
import CRUD, { crud, presenter, header } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker'
import crudDeviceooestat from '@/api/wms/sb/deviceooestat'
import { download } from '@/api/data'
import { downloadFile } from '@/utils'
export default {
name: 'DtlShowDialog',
components: { rrOperation, crudOperation, udOperation, pagination, DateRangePicker },
mixins: [presenter(), header(), crud()],
cruds() {
return CRUD({
url: 'api/deviceooestat/queryDtl',
idField: 'request_id',
sort: 'request_id,desc',
crudMethod: { ... crudDeviceooestat },
optShow: {
add: false,
edit: false,
del: false,
download: false,
reset: false
}
})
},
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: Object
}
},
data() {
return {
dialogVisible: false,
dtlFrom: {}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
methods: {
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done()
})
.catch(_ => {
})
},
close() {
debugger
this.dtlFrom = {}
this.$emit('update:dialogShow', false)
},
open() {
debugger
this.dtlFrom = this.openParam.dtlFrom
if (this.openParam.time !== null) {
this.dtlFrom.startTime = this.openParam.time.startTime
this.dtlFrom.endTime = this.openParam.time.endTime
}
this.crud.query.startTime = this.dtlFrom.startTime
this.crud.query.endTime = this.dtlFrom.endTime
this.crud.query.devicerecord_id = this.dtlFrom.devicerecord_id
this.crud.toQuery()
},
downdtl() {
if (this.currentRow !== null) {
crud.downloadLoading = true
download('/api/deviceooestat/download', this.crud.query).then(result => {
downloadFile(result, 'oee指标统计', 'xlsx')
crud.downloadLoading = false
}).catch(() => {
crud.downloadLoading = false
})
}
}
}
}
</script>
<style scoped>
</style>

View File

@@ -12,7 +12,7 @@
label-suffix=":"
>
<el-form-item label="统计日期">
<date-range-picker v-model="query.createTime" class="date-item" value-format="yyyy-MM-dd"/>
<date-range-picker v-model="query.createTime" class="date-item" @change="changeTime" value-format="yyyy-MM-dd"/>
</el-form-item>
<el-form-item label="设备类别">
<treeselect
@@ -53,7 +53,11 @@
<el-table-column v-if="false" prop="runrecord_id" label="记录标识" />
<el-table-column prop="dept_name" label="使用部门" />
<el-table-column prop="class_name" label="设备类型" />
<el-table-column prop="device_code" label="设备编码" />
<el-table-column prop="device_code" label="设备编码">
<template slot-scope="scope">
<el-link type="warning" @click="openDtl(scope.row)">{{ scope.row.device_code }}</el-link>
</template>
</el-table-column>
<el-table-column prop="device_name" label="设备名称" width="120px" show-overflow-tooltip />
<el-table-column prop="run_times" label="工作时间(分钟)" width="120px" />
<el-table-column prop="prepare_times" label="准备时间(分钟)" width="120px" />
@@ -67,6 +71,7 @@
<!--分页组件-->
<pagination />
</div>
<DtlDialog :dialog-show.sync="openDtldialog" :open-param="openParam" />
</div>
</template>
@@ -82,11 +87,12 @@ import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
import DateRangePicker from '@/components/DateRangePicker'
import DtlDialog from '@/views/wms/sb/stat/deviceooestat/DtlDialog'
const defaultForm = { runrecord_id: null, devicerecord_id: null, run_date: null, run_times: null, prepare_times: null, error_times: null, adjust_times: null, product_qty: null, nok_qty: null, oee_value: null, remark: null, create_id: null, create_name: null, create_time: null }
export default {
name: 'Deviceooestat',
components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker },
components: { DtlDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
@@ -108,8 +114,11 @@ export default {
return {
classes: [],
class_idStr: null,
openParam: null,
changeTimeAge: null,
materOpt_code: '23',
deviceDialog: false,
openDtldialog: false,
permission: {
}
}
@@ -160,6 +169,24 @@ export default {
return obj
})
})
},
openDtl(row) {
if (!this.changeTimeAge) {
return this.crud.notify('请选择日期', CRUD.NOTIFICATION_TYPE.INFO)
}
this.openParam = {
'dtlFrom': row,
'time': this.changeTimeAge
}
this.openDtldialog = true
},
changeTime(val) {
debugger
this.changeTimeAge = {
'startTime': val[0],
'endTime': val[1]
}
this.crud.toQuery()
}
}
}