update - 设备台账页面

master
yinq 8 months ago
parent f96210b377
commit 63c137c475

@ -42,3 +42,12 @@ export function delDeviceLedger(objId) {
method: 'delete'
})
}
// 查询设备台账列表
export function getDeviceCode(query) {
return request({
url: '/base/deviceLedger/getDeviceCode',
method: 'get',
params: query
})
}

@ -1,14 +1,42 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="设备编号" prop="deviceCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.deviceCode"-->
<!-- placeholder="请输入设备编号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="设备编号" prop="deviceCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.deviceCode"-->
<!-- placeholder="请输入设备编号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="所属产线" prop="productLineCode">
<el-select v-model="queryParams.productLineCode" placeholder="请选择所属产线" clearable>
<el-option
v-for="item in productLineList"
:key="item.productLineCode"
:label="item.productLineName"
:value="item.productLineCode"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="班组" prop="teamCode" clearable>
<el-select v-model="form.teamCode" placeholder="请输入班组">
<el-option
v-for="item in teamMemberList"
:key="item.teamCode"
:label="item.teamName"
:value="item.teamCode"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备型号" prop="deviceModel">
<el-input
v-model="queryParams.deviceModel"
placeholder="请输入设备型号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
@ -37,22 +65,6 @@
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="使用部门" prop="usedDepartment">-->
<!-- <el-input-->
<!-- v-model="queryParams.usedDepartment"-->
<!-- placeholder="请输入使用部门"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="所属工位" prop="productLineCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.productLineCode"-->
<!-- placeholder="请输入所属工位"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -68,7 +80,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['base:deviceLedger:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -79,7 +92,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['base:deviceLedger:edit']"
>修改</el-button>
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -90,7 +104,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['base:deviceLedger:remove']"
>删除</el-button>
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@ -100,30 +115,33 @@
size="mini"
@click="handleExport"
v-hasPermi="['base:deviceLedger:export']"
>导出</el-button>
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="deviceLedgerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键标识" align="center" prop="objId" v-if="columns[0].visible"/>
<el-table-column label="资产编号" align="center" prop="assetCode" v-if="columns[19].visible"/>
<el-table-column label="设备编号" align="center" prop="deviceCode" v-if="columns[1].visible"/>
<el-table-column label="设备名称" align="center" prop="deviceName" v-if="columns[2].visible"/>
<el-table-column label="设备型号" align="center" prop="deviceModel" v-if="columns[3].visible"/>
<el-table-column label="设备名称" align="center" prop="deviceName" v-if="columns[2].visible" width="150"/>
<el-table-column label="设备型号" align="center" prop="deviceModel" v-if="columns[3].visible" width="180"/>
<el-table-column label="设备类型" align="center" prop="deviceType" v-if="columns[4].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.device_type" :value="scope.row.deviceType"/>
</template>
</el-table-column>
<el-table-column label="设备位置" align="center" prop="deviceAddress" v-if="columns[5].visible"/>
<el-table-column label="IP地址" align="center" prop="deviceAddress" v-if="columns[5].visible" width="130"/>
<el-table-column label="设备状态" align="center" prop="deviceStatus" v-if="columns[6].visible">
<template slot-scope="scope">
<dict-tag :options="dict.type.device_status" :value="scope.row.deviceStatus"/>
</template>
</el-table-column>
<el-table-column label="所属班组" align="center" prop="teamName" v-if="columns[18].visible" width="120"/>
<el-table-column label="使用部门" align="center" prop="usedDepartment" v-if="columns[7].visible"/>
<el-table-column label="所属工位" align="center" prop="productLineCode" v-if="columns[8].visible"/>
<el-table-column label="所属产线" align="center" prop="productLineName" v-if="columns[8].visible"/>
<el-table-column label="成本中心" align="center" prop="costCenter" v-if="columns[14].visible"/>
<el-table-column label="生产厂商" align="center" prop="manufacturer" v-if="columns[15].visible"/>
<el-table-column label="启用日期" align="center" prop="enableDate" width="180" v-if="columns[16].visible">
@ -148,7 +166,7 @@
<span>{{ parseTime(scope.row.updatedTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
@ -156,14 +174,16 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['base:deviceLedger:edit']"
>修改</el-button>
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['base:deviceLedger:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -177,17 +197,33 @@
/>
<!-- 添加或修改设备台账对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="设备编号" prop="deviceCode">
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" />
<el-input v-model="form.deviceCode" placeholder="请输入设备编号" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="资产编号" prop="assetCode">
<el-input
v-model="queryParams.assetCode"
placeholder="请输入资产编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
<el-input v-model="form.deviceName" placeholder="请输入设备名称"/>
</el-form-item>
<el-form-item label="设备型号" prop="deviceModel">
<el-input v-model="form.deviceModel" placeholder="请输入设备型号" />
<el-input v-model="form.deviceModel" placeholder="请输入设备型号"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="form.deviceType" placeholder="请选择设备类型">
<el-option
@ -198,37 +234,38 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="设备位置" prop="deviceAddress">
<el-input v-model="form.deviceAddress" placeholder="请输入设备位置" />
</el-form-item>
<el-form-item label="设备状态" prop="deviceStatus">
<el-radio-group v-model="form.deviceStatus">
<el-radio
v-for="dict in dict.type.device_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
<el-form-item label="IP地址" prop="deviceAddress">
<el-input v-model="form.deviceAddress" placeholder="请输入IP地址"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="使用部门" prop="usedDepartment">
<el-input v-model="form.usedDepartment" placeholder="请输入使用部门" />
<el-input v-model="form.usedDepartment" placeholder="请输入使用部门"/>
</el-form-item>
<el-form-item label="成本中心" prop="costCenter">
<el-input v-model="form.costCenter" placeholder="请输入成本中心" />
<el-input v-model="form.costCenter" placeholder="请输入成本中心"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="生产厂商" prop="manufacturer">
<el-input v-model="form.manufacturer" placeholder="请输入生产厂商" />
<el-input v-model="form.manufacturer" placeholder="请输入生产厂商"/>
</el-form-item>
<el-form-item label="启用日期" prop="enableDate">
<el-date-picker clearable
v-model="form.enableDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择启用日期">
placeholder="请选择启用日期"
>
</el-date-picker>
</el-form-item>
<el-form-item label="所属工位">
<el-select v-model="form.productLineCode" placeholder="请选择所属工位">
</el-col>
<el-col :span="12">
<el-form-item label="所属产线">
<el-select v-model="form.productLineCode" placeholder="请选择所属产线">
<el-option
v-for="item in productLineList"
:key="item.productLineCode"
@ -237,8 +274,20 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="所属工厂">
<el-select v-model="form.factoryCode" placeholder="请选择所属工厂">
<el-form-item label="班组">
<el-select v-model="form.teamCode" placeholder="请输入班组">
<el-option
v-for="item in teamMemberList"
:key="item.teamCode"
:label="item.teamName"
:value="item.teamCode"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工厂名称">
<el-select v-model="form.factoryCode" placeholder="请选择工厂名称">
<el-option
v-for="item in factoryList"
:key="item.factoryCode"
@ -247,15 +296,27 @@
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="启用标识" prop="isFlag">-->
<!-- <el-radio-group v-model="form.isFlag">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.is_flag"-->
<!-- :key="dict.value"-->
<!-- :label="parseInt(dict.value)"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
</el-col>
</el-row>
<el-form-item label="设备状态" prop="deviceStatus">
<el-radio-group v-model="form.deviceStatus">
<el-radio
v-for="dict in dict.type.device_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="启用标识" prop="isFlag">-->
<!-- <el-radio-group v-model="form.isFlag">-->
<!-- <el-radio-->
<!-- v-for="dict in dict.type.is_flag"-->
<!-- :key="dict.value"-->
<!-- :label="parseInt(dict.value)"-->
<!-- >{{dict.label}}</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -266,13 +327,20 @@
</template>
<script>
import { listDeviceLedger, getDeviceLedger, delDeviceLedger, addDeviceLedger, updateDeviceLedger } from "@/api/base/deviceLedger";
import { findFactoryList } from "@/api/base/factory";
import { findProductLineList } from "@/api/base/productLine";
import {
listDeviceLedger,
getDeviceLedger,
delDeviceLedger,
addDeviceLedger,
updateDeviceLedger, getDeviceCode
} from '@/api/base/deviceLedger'
import { findFactoryList } from '@/api/base/factory'
import { findProductLineList } from '@/api/base/productLine'
import { getTeamMemberList } from '@//api/base/teamMembers'
export default {
name: "DeviceLedger",
dicts: ['device_status', 'is_flag','device_type'],
name: 'DeviceLedger',
dicts: ['device_status', 'is_flag', 'device_type'],
data() {
return {
//
@ -290,9 +358,11 @@ export default {
//
deviceLedgerList: [],
//
title: "",
title: '',
//
open: false,
//
teamMemberList: [],
//
queryParams: {
pageNum: 1,
@ -317,18 +387,17 @@ export default {
//
form: {},
//
rules: {
},
rules: {},
columns: [
{ key: 0, label: `主键标识`, visible: false },
{ key: 1, label: `设备编号`, visible: true },
{ key: 2, label: `设备名称`, visible: true },
{ key: 3, label: `设备型号`, visible: true },
{ key: 4, label: `设备类型`, visible: true },
{ key: 5, label: `设备位置`, visible: true },
{ key: 5, label: `IP地址`, visible: true },
{ key: 6, label: `设备状态`, visible: true },
{ key: 7, label: `使用部门`, visible: true },
{ key: 8, label: `所属工位`, visible: true },
{ key: 8, label: `所属产线`, visible: true },
{ key: 9, label: `启用标识`, visible: false },
{ key: 10, label: `创建人`, visible: false },
{ key: 11, label: `创建时间`, visible: false },
@ -337,37 +406,42 @@ export default {
{ key: 14, label: `成本中心`, visible: true },
{ key: 15, label: `生产厂商`, visible: true },
{ key: 16, label: `启用日期`, visible: true },
{ key: 17, label: `所属工厂`, visible: true },
{ key: 17, label: `工厂名称`, visible: true },
{ key: 18, label: `所属班组`, visible: true },
{ key: 19, label: `资产编号`, visible: true }
],
// 线
productLineList: [],
//
factoryList: [],
};
factoryList: []
}
},
created() {
this.getList();
findProductLineList().then(response => {
this.productLineList = response.data;
});
this.getList()
findProductLineList({ productLineType: 1 }).then(response => {
this.productLineList = response.data
})
findFactoryList().then(response => {
this.factoryList = response.data;
});
this.factoryList = response.data
})
},
methods: {
/** 查询设备台账列表 */
getList() {
this.loading = true;
this.loading = true
listDeviceLedger(this.queryParams).then(response => {
this.deviceLedgerList = response.rows;
this.total = response.total;
this.loading = false;
});
this.deviceLedgerList = response.rows
this.total = response.total
this.loading = false
})
getTeamMemberList({ classes: 1 }).then(response => {
this.teamMemberList = response.data
})
},
//
cancel() {
this.open = false;
this.reset();
this.open = false
this.reset()
},
//
reset() {
@ -380,80 +454,86 @@ export default {
deviceAddress: null,
deviceStatus: 0,
usedDepartment: null,
productLineCode: null,
productLineCode: 'CX_02',
costCenter: null,
manufacturer: null,
factoryCode: null,
factoryCode: '1301',
enableDate: null,
isFlag: 0,
createdBy: null,
createdTime: null,
updatedBy: null,
updatedTime: null
};
this.resetForm("form");
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.resetForm('queryForm')
this.handleQuery()
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.objId)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加设备台账";
this.reset()
getDeviceCode().then(res => {
this.form.deviceCode = res.msg
this.open = true
this.title = '添加设备台账'
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.reset()
const objId = row.objId || this.ids
getDeviceLedger(objId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改设备台账";
});
this.form = response.data
this.open = true
this.title = '修改设备台账'
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.objId != null) {
updateDeviceLedger(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
} else {
addDeviceLedger(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
}
}
});
})
},
/** 删除按钮操作 */
handleDelete(row) {
const objIds = row.objId || this.ids;
const objIds = row.objId || this.ids
this.$modal.confirm('是否确认删除设备台账编号为"' + objIds + '"的数据项?').then(function() {
return delDeviceLedger(objIds);
return delDeviceLedger(objIds)
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
})
},
/** 导出按钮操作 */
handleExport() {
@ -462,5 +542,5 @@ export default {
}, `deviceLedger_${new Date().getTime()}.xlsx`)
}
}
};
}
</script>

Loading…
Cancel
Save