第三阶段代码
This commit is contained in:
@@ -0,0 +1,216 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="保养单执行"
|
||||
append-to-body
|
||||
:visible.sync="dialogVisible"
|
||||
fullscreen
|
||||
:before-close="handleClose"
|
||||
destroy-on-close
|
||||
@close="close"
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span />
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<el-button icon="el-icon-check" size="mini" type="primary" @click="submitMain">保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="close">关闭</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="120px" label-suffix=":">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="单据号" prop="maint_code">
|
||||
<el-input v-model="form.maint_code" style="width: 200px;" disabled placeholder="系统自动生成" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="业务日期" prop="plan_start_date">
|
||||
<el-date-picker v-model="form.plan_start_date" type="date" placeholder="选择日期" style="width: 200px" value-format="yyyy-MM-dd" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="保养类型" prop="maintenancecycle">
|
||||
<el-select
|
||||
v-model="form.maintenancecycle"
|
||||
disabled
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.EM_DEVICE_BY_INVTYPE"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备档案" prop="devicerecord_id">
|
||||
<el-input v-model="form.devicerecord_id" :disabled="true" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="保养人" prop="update_optname">
|
||||
<el-input v-model="form.update_optname" style="width: 200px;"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="16">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" style="width: 580px;" rows="2" type="textarea" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<div class="crud-opts2">
|
||||
<span class="role-span">项目明细</span>
|
||||
</div>
|
||||
|
||||
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table2"
|
||||
:data="form.tableData"
|
||||
style="width: 100%;"
|
||||
max-height="500"
|
||||
border
|
||||
:highlight-current-row="true"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="maint_item_code" label="保养项目编号" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="maint_item_name" label="保养项目名称" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="item_level" label="保养等级" align="center" :formatter="formatLevel" />
|
||||
<el-table-column show-overflow-tooltip prop="contents" label="保养内容" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="requirement" label="要求" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="dtl_remark" label="备注" align="center" />
|
||||
<el-table-column prop="isfinish" label="是否完成" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.isfinish"
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.IS_OR_NOT"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
|
||||
import CRUD, { crud } from '@crud/crud'
|
||||
import crudDevicemaintenancemst from '@/api/wms/sb/devicemaintenancemst'
|
||||
export default {
|
||||
name: 'ExecuteDialog',
|
||||
dicts: ['EM_DEVICE_BY_INVTYPE', 'IS_OR_NOT'],
|
||||
mixins: [crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
this.form = this.openParam.form
|
||||
this.form.tableData = this.openParam.tableData
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {
|
||||
tableData: []
|
||||
},
|
||||
dialogVisible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
},
|
||||
formatLevel(row, cloum) {
|
||||
if (row.item_level === '01') {
|
||||
return '日常'
|
||||
} else if (row.item_level === '02') {
|
||||
return '一级'
|
||||
} else if (row.item_level === '03') {
|
||||
return '二级'
|
||||
}
|
||||
},
|
||||
submitMain() {
|
||||
const data = this.form
|
||||
if (this.form.update_optname === '') {
|
||||
return this.crud.notify('保养人不能为空', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
crudDevicemaintenancemst.submitMain(data).then(res => {
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
this.dialogVisible = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.crud-opts2 {
|
||||
padding: 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .el-dialog__title2 {
|
||||
line-height: 24px;
|
||||
font-size:20px;
|
||||
color:#303133;
|
||||
}
|
||||
|
||||
.crud-opts2 .role-span {
|
||||
padding: 10px 0px 10px 0px;
|
||||
}
|
||||
.crud-opts2 .crud-opts-form {
|
||||
padding: 10px 0px 0px 20px;
|
||||
}
|
||||
|
||||
.input-with-select {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
</style>
|
||||
305
mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/index.vue
Normal file
305
mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/index.vue
Normal file
@@ -0,0 +1,305 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="110px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="设备类别">
|
||||
<treeselect
|
||||
v-model="query.material_type_id"
|
||||
:load-options="loadClass"
|
||||
:options="classes"
|
||||
style="width: 200px;"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备">
|
||||
<el-input
|
||||
v-model="query.device_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入设备编码、名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="保养类型">
|
||||
<el-select
|
||||
v-model="query.maintenancecycle"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.EM_DEVICE_BY_INVTYPE"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单据编码">
|
||||
<el-input
|
||||
v-model="query.maint_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入单据编码、名称"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="日期">
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select
|
||||
v-model="query.invstatus"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请选择"
|
||||
class="filter-item"
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.EM_DEVICE_BY_INVSTATUS"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@click="startMaintain"
|
||||
>
|
||||
开始保养
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@click="executeMaintain"
|
||||
>
|
||||
保养执行
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@click="endMaintain"
|
||||
>
|
||||
结束保养
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="crud.selections.length !== 1"
|
||||
@click="confirmMaintain"
|
||||
>
|
||||
保养确认
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-if="false" prop="maint_id" label="保养单标识" />
|
||||
<el-table-column prop="maint_code" label="保养单号" width="120px" show-overflow-tooltip />
|
||||
<el-table-column prop="device_code" label="设备编码" show-overflow-tooltip />
|
||||
<el-table-column prop="device_name" label="设备名称" show-overflow-tooltip />
|
||||
<el-table-column prop="invstatus" label="单据状态" show-overflow-tooltip :formatter="formatInvsName" />
|
||||
<el-table-column prop="maintenancecycle" label="单据类型" :formatter="formatMainName" />
|
||||
<el-table-column prop="plan_start_date" label="计划保养日期" width="150px" />
|
||||
<el-table-column prop="input_optname" label="创建人" />
|
||||
<el-table-column prop="input_time" label="创建时间" width="150px" />
|
||||
<el-table-column prop="update_optname" label="保养人" />
|
||||
<el-table-column prop="real_start_date" label="开始时间" width="150px" />
|
||||
<el-table-column prop="real_end_date" label="结束时间" width="150px" />
|
||||
<el-table-column prop="confirm_optname" label="确认人" />
|
||||
<el-table-column prop="confirm_time" label="确认时间" width="150px" />
|
||||
<el-table-column prop="audit_optname" label="审核人" />
|
||||
<el-table-column prop="audit_time" label="审核时间" width="150px" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<ExecuteDialog :dialog-show.sync="executeDialog" :open-param="openParam" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudDevicemaintenancemst from '@/api/wms/sb/devicemaintenancemst'
|
||||
import CRUD, { presenter, header, crud } 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 crudClassstandard from '@/api/wms/basedata/master/classstandard'
|
||||
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 ExecuteDialog from '@/views/wms/sb/upkeep/devicemaintenancepa/ExecuteDialog'
|
||||
|
||||
export default {
|
||||
name: 'Devicemaintenancepa',
|
||||
dicts: ['EM_DEVICE_BY_INVSTATUS', 'EM_DEVICE_BY_INVTYPE'],
|
||||
components: { ExecuteDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '保养单填报',
|
||||
url: 'api/devicemaintenancemst',
|
||||
idField: 'maint_id',
|
||||
sort: 'maint_id,desc',
|
||||
crudMethod: { ...crudDevicemaintenancemst },
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
classes: [],
|
||||
class_idStr: null,
|
||||
materOpt_code: '23',
|
||||
openParam: null,
|
||||
executeDialog: false,
|
||||
permission: {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const param = {
|
||||
'materOpt_code': this.materOpt_code
|
||||
}
|
||||
crudMaterialbase.getMaterOptType(param).then(res => {
|
||||
this.class_idStr = res.class_idStr
|
||||
this.crud.query.class_idStr = this.class_idStr
|
||||
this.crud.toQuery()
|
||||
this.queryClassId()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
formatInvsName(row, cloum) {
|
||||
return this.dict.label.EM_DEVICE_BY_INVSTATUS[row.invstatus]
|
||||
},
|
||||
formatMainName(row, cloum) {
|
||||
return this.dict.label.EM_DEVICE_BY_INVTYPE[row.maintenancecycle]
|
||||
},
|
||||
loadClass({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
},
|
||||
queryClassId() {
|
||||
const param = {
|
||||
'class_idStr': this.class_idStr
|
||||
}
|
||||
crudClassstandard.queryClassById(param).then(res => {
|
||||
this.classes = res.content.map(obj => {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
startMaintain() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
const data = _selectData[0]
|
||||
if (data.invstatus !== '02') {
|
||||
return this.crud.notify('只能对提交状态的单据开始', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
crudDevicemaintenancemst.startMaintain(data).then(res => {
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
endMaintain() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
const data = _selectData[0]
|
||||
if (data.invstatus !== '03') {
|
||||
return this.crud.notify('只能对开始状态的单据结束', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
crudDevicemaintenancemst.endMaintain(data).then(res => {
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
executeMaintain() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
const data = _selectData[0]
|
||||
if (data.invstatus !== '03') {
|
||||
return this.crud.notify('只能对开始状态的单据执行', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
crudDevicemaintenancemst.getDtl(data).then(res => {
|
||||
this.openParam = {
|
||||
'form': data,
|
||||
'tableData': res
|
||||
}
|
||||
this.executeDialog = true
|
||||
})
|
||||
},
|
||||
confirmMaintain() {
|
||||
const _selectData = this.$refs.table.selection
|
||||
const data = _selectData[0]
|
||||
if (data.invstatus !== '04') {
|
||||
return this.crud.notify('只能对结束状态的单据确认', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
}
|
||||
crudDevicemaintenancemst.confirmMaintain(data).then(res => {
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user