378 lines
11 KiB
Vue
378 lines
11 KiB
Vue
<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-input
|
||
v-model="query.request_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.status"
|
||
clearable
|
||
size="mini"
|
||
placeholder="请选择"
|
||
class="filter-item"
|
||
@change="hand"
|
||
>
|
||
<el-option
|
||
v-for="item in statusList"
|
||
: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"
|
||
@click="repair"
|
||
>
|
||
维修
|
||
</el-button>
|
||
<el-button
|
||
slot="right"
|
||
class="filter-item"
|
||
type="success"
|
||
icon="el-icon-position"
|
||
size="mini"
|
||
@click="notRepair"
|
||
>
|
||
不维修
|
||
</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 fixed="left" type="selection" min-width="35" />
|
||
<el-table-column fixed="left" prop="request_code" min-width="120px" label="报修单号" />
|
||
<el-table-column fixed="left" prop="path" label="故障图片" min-width="70">
|
||
<template slot-scope="scope">
|
||
<el-button type="primary" icon="el-icon-folder-opened" circle @click="Picconfirm(scope.$index, scope.row)" />
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column fixed="left" prop="device_code" label="设备编码" min-width="85" />
|
||
<el-table-column fixed="left" prop="device_name" label="设备名称" min-width="150" />
|
||
<el-table-column fixed="left" prop="extend_code" label="设备自编码" min-width="100" />
|
||
<el-table-column fixed="left" prop="device_faultclass_name" label="故障分类" min-width="145" />
|
||
<el-table-column fixed="left" prop="fault_level" label="故障等级" :formatter="formaLevelName" min-width="70" />
|
||
<el-table-column fixed="left" prop="status" label="状态" :formatter="formatStatusName" min-width="70" />
|
||
<el-table-column fixed="left" prop="is_passed" label="是否通过" :formatter="formatPassedName" min-width="70" />
|
||
<el-table-column prop="fault_desc" label="故障描述" min-width="150" />
|
||
<el-table-column prop="remark" label="备注" min-width="200" />
|
||
<el-table-column prop="fault_time" label="故障时间" min-width="140" />
|
||
<el-table-column prop="create_name" label="创建人" min-width="90" />
|
||
<el-table-column prop="create_time" label="创建时间" min-width="140" />
|
||
<el-table-column prop="process_name" label="处理人" min-width="90" />
|
||
<el-table-column prop="process_time" label="处理时间" min-width="140" />
|
||
</el-table>
|
||
<!--分页组件-->
|
||
<pagination />
|
||
</div>
|
||
<PicDialog ref="child" :dialog-show.sync="PicDialog" />
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import crudDevicerepairrequest from '@/api/wms/sb/devicerepairrequest'
|
||
import CRUD, { presenter, header, form, 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 DateRangePicker from '@/components/DateRangePicker'
|
||
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 PicDialog from '@/views/wms/sb/repair/devicerepairrequest/PicDialog'
|
||
|
||
const defaultForm = { request_id: null, request_code: null, devicerecord_id: null, fault_time: null, device_faultclass_id: null, fault_desc: null, fault_level: null, remark: null, status: null, create_id: null, create_name: null, create_time: null, is_passed: null, process_id: null, process_name: null, process_time: null, finish_id: null, finish_name: null, finish_time: null, is_delete: null, sysdeptid: null, syscompanyid: null }
|
||
export default {
|
||
name: 'Devicerepairrequest',
|
||
components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker, Treeselect, PicDialog },
|
||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||
dicts: ['EM_FAULT_LEVEL'],
|
||
cruds() {
|
||
return CRUD({
|
||
title: '设备报修处理',
|
||
url: 'api/devicerepairrequest',
|
||
idField: 'request_id',
|
||
sort: 'request_id,desc',
|
||
crudMethod: { ...crudDevicerepairrequest },
|
||
optShow: {
|
||
add: false,
|
||
edit: false,
|
||
del: false,
|
||
download: false,
|
||
reset: true
|
||
}
|
||
})
|
||
},
|
||
data() {
|
||
return {
|
||
classes: [],
|
||
checkrows: [],
|
||
class_idStr: null,
|
||
materOpt_code: '23',
|
||
statusList: [
|
||
{ 'label': '生成', 'value': '01' },
|
||
{ 'label': '维修中', 'value': '02' },
|
||
{ 'label': '完毕', 'value': '03' }
|
||
],
|
||
PicDialog: 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()
|
||
},
|
||
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
|
||
})
|
||
})
|
||
},
|
||
formaLevelName(row) {
|
||
return this.dict.label.EM_FAULT_LEVEL[row.fault_level]
|
||
},
|
||
formatStatusName(row, cloum) {
|
||
if (row.status === '01') {
|
||
return '生成'
|
||
} else if (row.status === '02') {
|
||
return '维修中'
|
||
} else if (row.status === '99') {
|
||
return '完毕'
|
||
}
|
||
},
|
||
formatPassedName(row, cloum) {
|
||
if (row.is_passed === '0') {
|
||
return '否'
|
||
} else if (row.is_passed === '1') {
|
||
return '是'
|
||
}
|
||
},
|
||
repair() {
|
||
this.checkrows = this.$refs.table.selection
|
||
if(this.checkrows.length === 0 ){
|
||
this.crud.notify('请勾选需要操作的记录!')
|
||
return false
|
||
}
|
||
crudDevicerepairrequest.repair({ rows: this.checkrows}).then(res => {
|
||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||
this.crud.toQuery()
|
||
})
|
||
},
|
||
notRepair() {
|
||
this.checkrows = this.$refs.table.selection
|
||
if(this.checkrows.length === 0 ){
|
||
this.crud.notify('请勾选需要操作的记录!')
|
||
return false
|
||
}
|
||
crudDevicerepairrequest.notRepair({ rows: this.checkrows}).then(res => {
|
||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||
this.crud.toQuery()
|
||
})
|
||
},
|
||
Picconfirm(index, row) {
|
||
debugger
|
||
this.$refs.child.setForm(row.request_code)
|
||
this.PicDialog = true
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||
::v-deep {
|
||
|
||
.vue-treeselect__menu {
|
||
|
||
overflow-x: auto !important;
|
||
|
||
width: 300px;
|
||
|
||
max-height: 300px !important;
|
||
|
||
}
|
||
|
||
.vue-treeselect__label {
|
||
|
||
overflow: unset;
|
||
|
||
text-overflow: unset;
|
||
|
||
}
|
||
|
||
.vue-treeselect__control {
|
||
|
||
height: 20px !important;
|
||
|
||
}
|
||
|
||
.vue-treeselect__multi-value-item-container,
|
||
|
||
.vue-treeselect--has-value .vue-treeselect__multi-value {
|
||
|
||
height: 30px;
|
||
|
||
line-height: 24px;
|
||
|
||
padding: 0;
|
||
|
||
}
|
||
|
||
.vue-treeselect__limit-tip,
|
||
|
||
.vue-treeselect--searchable.vue-treeselect--multi.vue-treeselect--has-value
|
||
|
||
.vue-treeselect__input-container {
|
||
|
||
padding-top: 0;
|
||
|
||
}
|
||
|
||
.vue-treeselect--has-value .vue-treeselect__multi-value {
|
||
|
||
// margin-bottom: 15px;
|
||
|
||
}
|
||
|
||
.vue-treeselect__placeholder,
|
||
|
||
.vue-treeselect__single-value {
|
||
|
||
height: 28px;
|
||
|
||
line-height: 32px;
|
||
|
||
font-size: small;
|
||
|
||
color: "#CCCFD6";
|
||
|
||
|
||
}
|
||
|
||
.vue-treeselect--has-value .vue-treeselect__input {
|
||
|
||
height: 18px !important;
|
||
|
||
line-height: 18px !important;
|
||
|
||
}
|
||
|
||
.vue-treeselect div,
|
||
|
||
.vue-treeselect span {
|
||
|
||
box-sizing: content-box;
|
||
|
||
}
|
||
|
||
// 选中后的溢出隐藏
|
||
|
||
.vue-treeselect__multi-value-label {
|
||
|
||
display: block;
|
||
|
||
width: 140px;
|
||
|
||
overflow: hidden;
|
||
|
||
white-space: nowrap;
|
||
|
||
text-overflow: ellipsis;
|
||
|
||
}
|
||
|
||
.vue-treeselect__value-container {
|
||
|
||
display: block;
|
||
|
||
height: 32px;
|
||
|
||
}
|
||
|
||
}
|
||
</style>
|