fix:添加检测项目页面
This commit is contained in:
parent
88852831d9
commit
65e56d1dcf
|
@ -42,6 +42,43 @@ export default {
|
|||
return await http.get(this.url, data);
|
||||
},
|
||||
},
|
||||
testitem: {
|
||||
list: {
|
||||
name: "质检项目",
|
||||
req: async function (data) {
|
||||
return await http.get(`${config.API_URL}/qm/testitem/`, data);
|
||||
},
|
||||
},
|
||||
item: {
|
||||
name: "质检项目",
|
||||
req: async function (id) {
|
||||
return await http.get(`${config.API_URL}/qm/testitem/${id}/`);
|
||||
},
|
||||
},
|
||||
update: {
|
||||
name: "更新",
|
||||
req: async function (id, data) {
|
||||
return await http.put(
|
||||
`${config.API_URL}/qm/testitem/${id}/`,
|
||||
data
|
||||
);
|
||||
},
|
||||
},
|
||||
create: {
|
||||
name: "创建",
|
||||
req: async function (data) {
|
||||
return await http.post(`${config.API_URL}/qm/testitem/`, data);
|
||||
},
|
||||
},
|
||||
delete: {
|
||||
name: "删除",
|
||||
req: async function (id) {
|
||||
return await http.delete(
|
||||
`${config.API_URL}/qm/testitem/${id}/`
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
ftest: {
|
||||
list: {
|
||||
name: "首件检验列表",
|
||||
|
|
|
@ -987,6 +987,16 @@ const routes = [
|
|||
perms: ["mtm"],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: "materials_gx",
|
||||
path: "/mtm/materials_gx",
|
||||
meta: {
|
||||
title: "物料产品",
|
||||
icon: "el-icon-cellphone",
|
||||
perms: ["material_gx"],
|
||||
},
|
||||
component: "mtm/materials_gx",
|
||||
},
|
||||
{
|
||||
name: "materials",
|
||||
path: "/mtm/materials",
|
||||
|
@ -2620,6 +2630,17 @@ const routes = [
|
|||
},
|
||||
component: "enm_base/material",
|
||||
},
|
||||
{
|
||||
path: "/enm_base/testItem",
|
||||
name: "testItem",
|
||||
meta: {
|
||||
title: "检测项目",
|
||||
icon: "el-icon-postcard",
|
||||
type: "menu",
|
||||
perms: ["testitem"],
|
||||
},
|
||||
component: "enm_base/testItem",
|
||||
},
|
||||
{
|
||||
name: "logDetail",
|
||||
path: "/enm_rm/logDetail",
|
||||
|
@ -2977,16 +2998,16 @@ const routes = [
|
|||
// },
|
||||
// "component": "statistics/inm_check.vue"
|
||||
// },
|
||||
// {
|
||||
// "name": "good_check",
|
||||
// "path": "/statistic/good_check",
|
||||
// "meta": {
|
||||
// "title": "成品检验统计",
|
||||
// "icon": "el-icon-DataAnalysis",
|
||||
// "perms": ["statistic_qm"]
|
||||
// },
|
||||
// "component": "statistics/good_check.vue"
|
||||
// },
|
||||
{
|
||||
name: "good_check",
|
||||
path: "/statistic/good_check",
|
||||
meta: {
|
||||
title: "成品检验统计",
|
||||
icon: "el-icon-DataAnalysis",
|
||||
perms: ["statistic_qm"],
|
||||
},
|
||||
component: "statistics/good_check.vue",
|
||||
},
|
||||
// {
|
||||
// "name": "behavior_check",
|
||||
// "path": "/statistic/behavior_check",
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
@click="table_add"
|
||||
v-auth="'material.create'"
|
||||
></el-button>
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
<el-input
|
||||
style="margin-right: 5px"
|
||||
v-model="query.search"
|
||||
placeholder="名称"
|
||||
clearable
|
||||
></el-input>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
@click="handleQuery"
|
||||
></el-button>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main class="nopadding">
|
||||
<scTable ref="table" :apiObj="apiObj" row-key="id">
|
||||
<el-table-column
|
||||
label="#"
|
||||
type="index"
|
||||
width="50"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
label="名称"
|
||||
prop="name"
|
||||
min-width="100"
|
||||
></el-table-column>
|
||||
<el-table-column label="标签" prop="tags">
|
||||
<template #default="scope">
|
||||
<span v-for="item in scope.row.tags" :key="item"
|
||||
>{{ item }}、</span
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="描述"
|
||||
prop="description"
|
||||
min-width="100"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
label="排序"
|
||||
prop="sort"
|
||||
min-width="60"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
align="center"
|
||||
width="140"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
size="small"
|
||||
@click="table_edit(scope.row)"
|
||||
v-auth="'material.update'"
|
||||
type="primary"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
<el-popconfirm
|
||||
title="确定删除吗?"
|
||||
@confirm="roleDel(scope.row, scope.$index)"
|
||||
>
|
||||
<template #reference>
|
||||
<el-button
|
||||
link
|
||||
size="small"
|
||||
v-auth="'material.delete'"
|
||||
type="danger"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</scTable>
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
||||
<save-dialog
|
||||
v-if="dialog.save"
|
||||
ref="saveDialog"
|
||||
@success="handleSaveSuccess"
|
||||
@closed="dialog.save = false"
|
||||
></save-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import saveDialog from "./testItem_form.vue";
|
||||
|
||||
export default {
|
||||
name: "material",
|
||||
components: {
|
||||
saveDialog,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
apiObj: this.$API.qm.testitem.list,
|
||||
search: {
|
||||
keyword: null,
|
||||
},
|
||||
dialog: {
|
||||
save: false,
|
||||
},
|
||||
query: {},
|
||||
types_: {
|
||||
0: "电/水/气",
|
||||
10: "成品",
|
||||
20: "半成品",
|
||||
30: "主要原料",
|
||||
40: "辅助材料",
|
||||
50: "加工工具",
|
||||
60: "辅助工装",
|
||||
70: "办公用品",
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
handleChange(value) {
|
||||
console.log(value);
|
||||
console.log(this.form.belong_dept);
|
||||
},
|
||||
//添加
|
||||
table_add() {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("add");
|
||||
});
|
||||
},
|
||||
//编辑
|
||||
table_edit(row) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("edit").setData(row);
|
||||
});
|
||||
},
|
||||
//删除产品
|
||||
async roleDel(row) {
|
||||
var id = row.id;
|
||||
var res = await this.$API.mtm.material.delete.req(id);
|
||||
if (res.err_msg) {
|
||||
this.$message.error(res.err_msg);
|
||||
} else {
|
||||
this.$refs.table.refresh();
|
||||
this.$message.success("删除成功");
|
||||
}
|
||||
},
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection) {
|
||||
this.selection = selection;
|
||||
},
|
||||
//搜索
|
||||
handleQuery() {
|
||||
this.$refs.table.queryData(this.query);
|
||||
},
|
||||
//本地更新数据
|
||||
handleSaveSuccess() {
|
||||
this.$refs.table.refresh();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.treeMain {
|
||||
width: 100%;
|
||||
height: 280px;
|
||||
overflow: auto;
|
||||
border: 1px solid #dcdfe6;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,185 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="titleMap[mode]"
|
||||
v-model="visible"
|
||||
:size="1000"
|
||||
destroy-on-close
|
||||
@closed="$emit('closed')"
|
||||
>
|
||||
<el-container v-loading="loading">
|
||||
<el-main style="padding: 0 20px 20px 20px">
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
style="padding: 0 10px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="描述">
|
||||
<el-input
|
||||
v-model="form.description"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="排序">
|
||||
<el-input-number
|
||||
v-model="form.sort"
|
||||
clearable
|
||||
></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="标签">
|
||||
<el-button type="primary" @click="addComponent">
|
||||
添加
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<template
|
||||
v-for="(item, $index) in form.tags"
|
||||
:key="$index"
|
||||
>
|
||||
<el-col :md="11" :sm="20">
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="form.tags[$index]"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="1" :sm="2">
|
||||
<div style="text-align: center">
|
||||
<el-icon
|
||||
color="red"
|
||||
@click="delComponent($index)"
|
||||
>
|
||||
<CircleCloseFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-main>
|
||||
<el-footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit"
|
||||
>保存</el-button
|
||||
>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const defaultForm = {
|
||||
name: "",
|
||||
description: "",
|
||||
sort: 1,
|
||||
tags: [""],
|
||||
};
|
||||
export default {
|
||||
emits: ["success", "closed"],
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
mode: "add",
|
||||
titleMap: {
|
||||
add: "新增",
|
||||
edit: "编辑",
|
||||
show: "查看",
|
||||
},
|
||||
//表单数据
|
||||
form: defaultForm,
|
||||
//验证规则
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "请输入名称", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
options: [],
|
||||
processOptions: [],
|
||||
setFiltersVisible: false,
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
addComponent() {
|
||||
this.form.tags.push("");
|
||||
},
|
||||
delComponent(index) {
|
||||
this.form.tags.splice(index, 1);
|
||||
console.log("this.form.tags:", this.form.tags);
|
||||
},
|
||||
//显示
|
||||
open(mode = "add") {
|
||||
this.mode = mode;
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
//表单注入数据
|
||||
setData(data) {
|
||||
Object.assign(this.form, data);
|
||||
},
|
||||
//表单提交方法
|
||||
submit() {
|
||||
let that = this;
|
||||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
that.isSaveing = true;
|
||||
if (that.mode === "add") {
|
||||
that.$API.qm.testitem.create
|
||||
.req(that.form)
|
||||
.then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success", that.form, that.mode);
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
})
|
||||
.catch((res) => {
|
||||
that.isSaveing = false;
|
||||
});
|
||||
} else {
|
||||
res = that.$API.qm.testitem.update
|
||||
.req(that.form.id, that.form)
|
||||
.then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success", that.form, that.mode);
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
})
|
||||
.catch((res) => {
|
||||
that.isSaveing = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//设置过滤项
|
||||
setFilters(filters) {
|
||||
this.selectionFilters = filters;
|
||||
this.setFiltersVisible = true;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
Loading…
Reference in New Issue