报废原因管理
This commit is contained in:
parent
add1cf0fd9
commit
12eee67965
|
|
@ -0,0 +1,65 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询二级下拉列表
|
||||
export function getTypeOptionInfo(query) {
|
||||
return request({
|
||||
url: '/material/scrap_reason/levelTwolist',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
// 查询三级下拉列表
|
||||
export function getTypeOptionInfoThree(query) {
|
||||
return request({
|
||||
url: '/material/scrap_reason/levelThreelist',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询报废原因列表
|
||||
export function getReasonList(query) {
|
||||
return request({
|
||||
url: '/material/scrap_reason/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 报废原因管理--新增
|
||||
export function addScrapReason(data) {
|
||||
return request({
|
||||
url: '/material/scrap_reason',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 查询报废原因详情
|
||||
export function getScrapReasonDetail(id) {
|
||||
return request({
|
||||
url: '/material/scrap_reason/'+ id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 报废原因管理--修改
|
||||
export function editScrapReason(data) {
|
||||
return request({
|
||||
url: '/material/scrap_reason/edit',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 报废原因管理--删除
|
||||
export function delScrapReason(data) {
|
||||
return request({
|
||||
url: '/material/scrap_reason/delete/',
|
||||
method: 'post',
|
||||
data: data,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,452 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item prop="keyWord">
|
||||
<el-input
|
||||
v-model="queryParams.keyWord"
|
||||
placeholder="请输入关键字"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
maxlength="20"
|
||||
/>
|
||||
</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
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['warehouse:info:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出数据
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
<!-- <el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['bracelet:construction:export']"
|
||||
>导出数据</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row> -->
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="reasonList"
|
||||
ref="multipleTable"
|
||||
row-key="teamId"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="55" align="center" :reserve-selection="true" /> -->
|
||||
<el-table-column label="序号" align="center" width="80" type="index">
|
||||
<template slot-scope="scope">
|
||||
<span>{{
|
||||
(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="类型" align="center" prop="parentName" sortable show-overflow-tooltip/>
|
||||
<el-table-column label="设备名称" align="center" prop="typeName" sortable show-overflow-tooltip/>
|
||||
<el-table-column label="报废原因" align="center" prop="reason" sortable show-overflow-tooltip/>
|
||||
<el-table-column label="修改人员" align="center" prop="updateBy" sortable show-overflow-tooltip/>
|
||||
<el-table-column label="修改时间" align="center" prop="updateTime" sortable show-overflow-tooltip/>
|
||||
<el-table-column label="备注" align="center" prop="remark" sortable show-overflow-tooltip/>
|
||||
|
||||
<el-table-column label="操作" align="center" width="180">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['warehouse:info:edit']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="danger"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['warehouse:info:remove']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 新增或修改弹窗 -->
|
||||
<el-dialog
|
||||
:title="title"
|
||||
:visible.sync="showDevice"
|
||||
width="600px"
|
||||
append-to-body
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="20">
|
||||
<el-form-item label="类型" prop="parentId">
|
||||
<el-select
|
||||
v-model="form.parentId"
|
||||
placeholder="请选择类型"
|
||||
style="width: 100%;"
|
||||
filterable
|
||||
clearable
|
||||
@change="handleChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in parentOption"
|
||||
:key="item.parentId"
|
||||
:label="item.parentName"
|
||||
:value="item.parentId"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="typeId">
|
||||
<el-select
|
||||
v-model="form.typeId"
|
||||
placeholder="请选择名称"
|
||||
style="width: 100%;"
|
||||
filterable
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in typeOption"
|
||||
:key="item.typeId"
|
||||
:label="item.typeName"
|
||||
:value="item.typeId"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="20">
|
||||
<el-form-item label="报废原因" prop="reason">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:rows="5"
|
||||
placeholder="请输入报废原因"
|
||||
v-model="form.reason"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getListHouse,
|
||||
getHouseDetail,
|
||||
editHouse,
|
||||
addHouse,
|
||||
delHouse,
|
||||
} from "@/api/ma/whHouse";
|
||||
import { downloadFile } from "@/utils/download";
|
||||
import {
|
||||
getReasonList,
|
||||
getTypeOptionInfo,
|
||||
getTypeOptionInfoThree,
|
||||
addScrapReason,
|
||||
getScrapReasonDetail,
|
||||
editScrapReason,
|
||||
delScrapReason,
|
||||
} from "@/api/repair/scrapReason";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
export default {
|
||||
name: "scrapReason",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: false,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
showDevice: false,
|
||||
// 设备树选项
|
||||
deviceOptions: [],
|
||||
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 报废原因表格数据
|
||||
reasonList: [],
|
||||
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
keyWord: undefined,
|
||||
},
|
||||
// 查询参数
|
||||
queryTeam: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
sex: undefined,
|
||||
teamId: undefined,
|
||||
},
|
||||
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "typeName",
|
||||
},
|
||||
//类型和名称下拉框
|
||||
parentOption: [],
|
||||
typeOption: [],
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
parentId: [
|
||||
{
|
||||
required: true,
|
||||
message: "类型不能为空",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
typeId: [
|
||||
{
|
||||
required: true,
|
||||
message: "名称不能为空",
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
reason: [
|
||||
{
|
||||
required: true,
|
||||
message: "报废原因不能为空",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getTypeOption();
|
||||
this.getList();
|
||||
},
|
||||
components: { Treeselect },
|
||||
methods: {
|
||||
/** 查询二级类型下拉框 */
|
||||
getTypeOption() {
|
||||
getTypeOptionInfo().then((response) => {
|
||||
response.data.forEach((item) => {
|
||||
this.parentOption.push({
|
||||
parentId: item.parentId,
|
||||
parentName: item.parentName,
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/** 根据二级查三级类型下拉框 */
|
||||
handleChange() {
|
||||
this.typeOption = [];
|
||||
getTypeOptionInfoThree({parentId:this.form.parentId}).then((response) => {
|
||||
response.data.forEach((item) => {
|
||||
this.typeOption.push({
|
||||
typeId: item.typeId,
|
||||
typeName: item.typeName,
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/** 查询岗位列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
getReasonList(this.queryParams).then((response) => {
|
||||
this.reasonList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.showDevice = true;
|
||||
this.title = "新增";
|
||||
},
|
||||
|
||||
async handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
await getScrapReasonDetail(id).then((response) => {
|
||||
this.form = response.data;
|
||||
});
|
||||
await getTypeOptionInfoThree({parentId:this.form.parentId}).then((response) => {
|
||||
response.data.forEach((item) => {
|
||||
this.typeOption.push({
|
||||
typeId: item.typeId,
|
||||
typeName: item.typeName,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.showDevice = true;
|
||||
this.title = "修改";
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.queryParams.keyWord = null;
|
||||
this.handleQuery();
|
||||
},
|
||||
|
||||
//** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != undefined) {
|
||||
editScrapReason(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.showDevice = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addScrapReason(this.form).then((response) => {
|
||||
if (response.code == 200) {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.showDevice = false;
|
||||
}
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.showDevice = false;
|
||||
this.reset();
|
||||
},
|
||||
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm("是否确认删除数据项?")
|
||||
.then(function () {
|
||||
return delScrapReason({id:id});
|
||||
})
|
||||
.then(() => {
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
|
||||
handleExport() {
|
||||
this.download(
|
||||
"/material/scrap_reason/export",
|
||||
{
|
||||
...this.queryParams,
|
||||
},
|
||||
`报废原因管理_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
},
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.uploadImg {
|
||||
padding-top: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.deviceCode {
|
||||
margin-top: 10px;
|
||||
padding-bottom: 20px;
|
||||
font-size: 18px;
|
||||
}
|
||||
::v-deep.el-table .fixed-width .el-button--mini {
|
||||
width: 60px !important;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
//隐藏图片上传框的css
|
||||
::v-deep.disabled {
|
||||
.el-upload--picture-card {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue