This commit is contained in:
shilixia 2021-09-14 14:56:17 +08:00
parent 74af9283f7
commit cb2beb1d3e
5 changed files with 216 additions and 63 deletions

View File

@ -4,7 +4,7 @@
<div> <div>
<el-input <el-input
v-model="listQuery.search" v-model="listQuery.search"
placeholder="设备名称/设备型号" placeholder="设备名称/设备编号/备注"
style="width: 300px" style="width: 300px"
class="filter-item" class="filter-item"
@keyup.enter.native="handleFilter" @keyup.enter.native="handleFilter"
@ -41,24 +41,34 @@
max-height="600" max-height="600"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="设备名称"> <el-table-column label="设备编号">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="设备编号"> <el-table-column label="管理类别">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ mgmtype_[scope.row.mgmtype] }}</template>
</el-table-column>
<el-table-column label="校/检方式">
<template slot-scope="scope">{{ waytype_[scope.row.way] }}</template>
</el-table-column>
<el-table-column label="标准/依据">
<template slot-scope="scope">{{ scope.row.standard }}</template>
</el-table-column>
<el-table-column label="校/检周期">
<template slot-scope="scope">{{ scope.row.cycle }}</template>
</el-table-column>
<el-table-column label="设备名称">
<template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="型号规格"> <el-table-column label="型号规格">
<template slot-scope="scope">{{ scope.row.model }}</template> <template slot-scope="scope">{{ scope.row.model }}</template>
</el-table-column> </el-table-column>
<el-table-column label="类型">
<template slot-scope="scope">{{ type_[scope.row.type] }}</template> <el-table-column label="生产厂家">
<template slot-scope="scope">{{ scope.row.factory }}</template>
</el-table-column> </el-table-column>
<el-table-column label="购置日期"> <el-table-column label="使用类别">
<template slot-scope="scope">{{ scope.row.buy_date }}</template> <template slot-scope="scope">{{ usetype_[scope.row.way] }}</template>
</el-table-column>
<el-table-column label="所属部门">
<template slot-scope="scope" v-if="scope.row.belong_dept_">{{ scope.row.belong_dept_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="保管人"> <el-table-column label="保管人">
<template slot-scope="scope" v-if="scope.row.keeper_">{{ scope.row.keeper_.username }}</template> <template slot-scope="scope" v-if="scope.row.keeper_">{{ scope.row.keeper_.username }}</template>
@ -66,17 +76,15 @@
<el-table-column label="存放位置"> <el-table-column label="存放位置">
<template slot-scope="scope">{{ scope.row.place }}</template> <template slot-scope="scope">{{ scope.row.place }}</template>
</el-table-column> </el-table-column>
<el-table-column label="任务备注"> <el-table-column label="备注">
<template slot-scope="scope">{{ scope.row.description }}</template> <template slot-scope="scope">{{ scope.row.description }}</template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="操作" label="操作"
width="220px" width="120px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
@ -132,16 +140,17 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="生产厂家" prop="factory"> <el-form-item label="标准/依据" prop="standard">
<el-input v-model="equipment.factory" placeholder="生产厂商及国别" /> <el-input v-model="equipment.standard" placeholder="溯源标准或依据" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="12">
<el-form-item label="校/检状态" prop="statedm">
<el-form-item label="状态" prop="state"> <el-select style="width: 100%" v-model="equipment.statedm" placeholder="请选择">
<el-select style="width: 100%" v-model="equipment.state" placeholder="请选择">
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
@ -150,8 +159,20 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="管理类别" prop="mgmtype">
<el-select style="width: 100%" v-model="equipment.mgmtype" placeholder="请选择">
<el-option
v-for="item in mgmoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="存放位置" prop="place"> <el-form-item label="存放位置" prop="place">
@ -180,6 +201,50 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="12">
<el-form-item label="校/检方式" prop="way">
<el-select style="width: 100%" v-model="equipment.way" placeholder="请选择">
<el-option
v-for="item in wayoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="存放位置" prop="place">
<el-input v-model="equipment.place" placeholder="存放位置" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="使用类别" prop="usetype">
<el-select style="width: 100%" v-model="equipment.usetype" placeholder="请选择">
<el-option
v-for="item in useoptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="校/检周期" prop="cycle">
<el-input v-model="equipment.cycle" placeholder="校准或检定周期" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="生产厂家" prop="factory">
<el-input v-model="equipment.factory" placeholder="生产厂商及国别" />
</el-form-item>
<el-form-item label="备注" prop="description"> <el-form-item label="备注" prop="description">
<el-input <el-input
type="textarea" type="textarea"
@ -196,7 +261,6 @@
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button> <el-button type="danger" @click="dialogVisible = false">取消</el-button>
@ -226,21 +290,64 @@ export default {
equipmentList: { equipmentList: {
count: 0, count: 0,
}, },
type_: { mgmtype_: {
'1':'生产设备', '1':'A',
'2':'检验工具', '2':'B',
'3':'C',
}, },
mgmoptions: [{
options: [{
value: 0,
label: '运转正常'
}, {
value: 1, value: 1,
label: '停用' label: 'A'
}, { }, {
value: 2, value: 2,
label: '报废' label: 'B'
},
{
value: 3,
label: 'C'
}],
waytype_: {
'1':'外检',
'2':'自检',
},
wayoptions: [{
value: 1,
label: '外检'
}, {
value: 2,
label: '自检'
}],
usetype_:{
'1':'专用',
'2':'公用',
},
useoptions: [{
value: 1,
label: '专用'
}, {
value: 2,
label: '公用'
}],
options: [{
value: 0,
label: '合格'
}, {
value: 1,
label: '准用'
}, {
value: 2,
label: '限用'
},
{
value: 3,
label: '禁用'
}, {
value: 4,
label: '停用'
}, {
value: 5,
label: '封存'
}], }],
listQuery: { listQuery: {
page: 1, page: 1,
@ -273,6 +380,7 @@ export default {
//设备列表 //设备列表
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.listQuery.type=2;
getpEquipmentList(this.listQuery).then((response) => { getpEquipmentList(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.equipmentList = response.data; this.equipmentList = response.data;
@ -351,7 +459,7 @@ export default {
} }
}); });
} else { } else {
this.equipment.type=1; this.equipment.type=2;
createEquipment(this.equipment).then((res) => { createEquipment(this.equipment).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getList(); this.getList();

View File

@ -4,7 +4,7 @@
<div> <div>
<el-input <el-input
v-model="listQuery.search" v-model="listQuery.search"
placeholder="设备名称/设备型号" placeholder="设备名称/设备编号/备注"
style="width: 300px" style="width: 300px"
class="filter-item" class="filter-item"
@keyup.enter.native="handleFilter" @keyup.enter.native="handleFilter"
@ -51,14 +51,23 @@
<el-table-column label="型号规格"> <el-table-column label="型号规格">
<template slot-scope="scope">{{ scope.row.model }}</template> <template slot-scope="scope">{{ scope.row.model }}</template>
</el-table-column> </el-table-column>
<el-table-column label="类型"> <el-table-column label="生产厂及国别">
<template slot-scope="scope">{{ type_[scope.row.type] }}</template> <template slot-scope="scope">{{ scope.row.factory }}</template>
</el-table-column>
<el-table-column label="生产日期">
<template slot-scope="scope">{{ scope.row.production_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="购置日期"> <el-table-column label="购置日期">
<template slot-scope="scope">{{ scope.row.buy_date }}</template> <template slot-scope="scope">{{ scope.row.buy_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="所属部门"> <el-table-column label="数量">
<template slot-scope="scope" v-if="scope.row.belong_dept_">{{ scope.row.belong_dept_.name }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
<el-table-column label="状态">
<template slot-scope="scope">{{ state_[scope.row.state] }}</template>
</el-table-column>
<el-table-column label="技术指标">
<template slot-scope="scope">{{ scope.row.parameter }}</template>
</el-table-column> </el-table-column>
<el-table-column label="保管人"> <el-table-column label="保管人">
<template slot-scope="scope" v-if="scope.row.keeper_">{{ scope.row.keeper_.username }}</template> <template slot-scope="scope" v-if="scope.row.keeper_">{{ scope.row.keeper_.username }}</template>
@ -66,17 +75,15 @@
<el-table-column label="存放位置"> <el-table-column label="存放位置">
<template slot-scope="scope">{{ scope.row.place }}</template> <template slot-scope="scope">{{ scope.row.place }}</template>
</el-table-column> </el-table-column>
<el-table-column label="任务备注"> <el-table-column label="备注">
<template slot-scope="scope">{{ scope.row.description }}</template> <template slot-scope="scope">{{ scope.row.description }}</template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="操作" label="操作"
width="220px" width="120px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
@ -259,21 +266,24 @@ export default {
equipmentList: { equipmentList: {
count: 0, count: 0,
}, },
type_: { state_:{
'1':'生产设备', 0:'完好',
'2':'检验工具', 1:'限用',
2:'在修',
}, 3:'禁用',
},
options: [{ options: [{
value: 0, value: 0,
label: '运转正常' label: '完好'
}, { }, {
value: 1, value: 1,
label: '' label: ''
}, { }, {
value: 2, value: 2,
label: '报废' label: '在修'
}, {
value: 3,
label: '禁用'
}], }],
listQuery: { listQuery: {
page: 1, page: 1,
@ -306,6 +316,7 @@ export default {
//设备列表 //设备列表
getList() { getList() {
this.listLoading = true; this.listLoading = true;
this.listQuery.type=1;
getpEquipmentList(this.listQuery).then((response) => { getpEquipmentList(this.listQuery).then((response) => {
if (response.data) { if (response.data) {
this.equipmentList = response.data; this.equipmentList = response.data;

View File

@ -0,0 +1,23 @@
# Generated by Django 3.2.6 on 2021-09-14 05:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('em', '0005_auto_20210914_1049'),
]
operations = [
migrations.AddField(
model_name='equipment',
name='statedm',
field=models.IntegerField(choices=[(0, '合格'), (1, '准用'), (2, '限用'), (3, '禁用'), (4, '停用'), (5, '封存')], default=0, verbose_name='设备状态'),
),
migrations.AlterField(
model_name='equipment',
name='state',
field=models.CharField(choices=[(0, '完好'), (1, '限用'), (2, '在修'), (3, '禁用')], default=0, max_length=11, verbose_name='设备状态'),
),
]

View File

@ -15,10 +15,20 @@ class Equipment(CommonBModel):
设备台账信息 设备台账信息
""" """
state_choices = ( state_choices = (
(1, '运转正常'), (0, '完好'),
(0, '停用'), (1, '限用'),
(2, '报废') (2, '在修'),
(3, '禁用')
) )
statedm_choices = (
(0, '合格'),
(1, '准用'),
(2, '限用'),
(3, '禁用'),
(4, '停用'),
(5, '封存')
)
type_choices = ( type_choices = (
(1, '生产设备'), (1, '生产设备'),
(2, '检验工具') (2, '检验工具')
@ -44,7 +54,7 @@ class Equipment(CommonBModel):
factory = models.CharField('生产厂', max_length=50, null=True, blank=True) factory = models.CharField('生产厂', max_length=50, null=True, blank=True)
production_date = models.DateField('生产日期', null=True, blank=True) production_date = models.DateField('生产日期', null=True, blank=True)
buy_date = models.DateField('购置日期', null=True, blank=True) buy_date = models.DateField('购置日期', null=True, blank=True)
state = models.CharField('设备状态', max_length=11, choices=state_choices, default=1) state = models.CharField('设备状态', max_length=11, choices=state_choices, default=0)
parameter = models.TextField('技术参数', null=True, blank=True) parameter = models.TextField('技术参数', null=True, blank=True)
place = models.CharField('存放位置', max_length=50, null=True, blank=True) place = models.CharField('存放位置', max_length=50, null=True, blank=True)
count = models.IntegerField('数量', default=0) count = models.IntegerField('数量', default=0)
@ -56,6 +66,7 @@ class Equipment(CommonBModel):
standard = models.CharField('溯源标准或依据', max_length=200, blank=True, null=True)#监视,测量设备 standard = models.CharField('溯源标准或依据', max_length=200, blank=True, null=True)#监视,测量设备
cycle = models.IntegerField('校准或检定周期', default=0)#监视,测量设备 cycle = models.IntegerField('校准或检定周期', default=0)#监视,测量设备
usetype = models.IntegerField('使用类别', choices=usetype_choices, default=1)#监视,测量设备 usetype = models.IntegerField('使用类别', choices=usetype_choices, default=1)#监视,测量设备
statedm = models.IntegerField('设备状态', choices=statedm_choices, default=0)#监视,测量设备
class Meta: class Meta:
verbose_name = '设备信息' verbose_name = '设备信息'

View File

@ -15,7 +15,7 @@ class EquipmentViewSet(CreateUpdateModelAMixin, OptimizationMixin, ModelViewSet)
'put': 'equipment_update', 'delete': 'equipment_delete'} 'put': 'equipment_update', 'delete': 'equipment_delete'}
queryset = Equipment.objects.all() queryset = Equipment.objects.all()
serializer_class = EquipmentSerializer serializer_class = EquipmentSerializer
search_fields = ['number', 'name', 'place'] search_fields = ['number', 'name','description']
filterset_fields = ['belong_dept', 'keeper'] filterset_fields = ['belong_dept', 'keeper', 'type']
ordering_fields = ['create_time'] ordering_fields = ['create_time']
ordering = ['-create_time'] ordering = ['-create_time']