fix:出入库记录可编辑
This commit is contained in:
parent
f88932b304
commit
8d10e15d12
|
@ -88,6 +88,14 @@ export default {
|
|||
data);
|
||||
}
|
||||
},
|
||||
update: {
|
||||
name: "更新",
|
||||
req: async function(id, data){
|
||||
return await http.put(
|
||||
`${config.API_URL}/inm/mio/${id}/`,
|
||||
data);
|
||||
}
|
||||
},
|
||||
delete: {
|
||||
name: "删除",
|
||||
req: async function(id){
|
||||
|
@ -131,6 +139,14 @@ export default {
|
|||
data);
|
||||
}
|
||||
},
|
||||
update: {
|
||||
name: "更新",
|
||||
req: async function(id, data){
|
||||
return await http.put(
|
||||
`${config.API_URL}/inm/mioitem/${id}/`,
|
||||
data);
|
||||
}
|
||||
},
|
||||
delete: {
|
||||
name: "删除",
|
||||
req: async function(id){
|
||||
|
|
|
@ -1,177 +1,268 @@
|
|||
<template>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button type="primary" @click="add('do_in')" v-auth="'mio.do'">生产入库</el-button>
|
||||
<el-button type="primary" @click="add('do_out')" v-auth="'mio.do'">生产领料</el-button>
|
||||
<el-select v-model="query.type" clearable style="width: 120px; margin-left: 2px" placeholder="出入库类型"
|
||||
@change="handleQuery">
|
||||
<el-option v-for="item in cateOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="query.state" clearable style="width: 120px; margin-left: 2px" placeholder="状态"
|
||||
@change="handleQuery">
|
||||
<el-option v-for="item in stateOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
<el-input v-model="query.search" placeholder="编号" clearable style="margin-right: 5px;"></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" :params="params" :query="query" stripe>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="记录编号" prop="number"></el-table-column>
|
||||
<el-table-column label="出/入库类型">
|
||||
<template #default="scope">
|
||||
{{ typeDict[scope.row.type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="记录状态">
|
||||
<template #default="scope">
|
||||
{{ stateDict[scope.row.state] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出/入库日期" prop="inout_date">
|
||||
</el-table-column>
|
||||
<el-table-column label="执行车间" prop="belong_dept_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人" prop="create_by_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="create_time">
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="150px">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="table_detail(scope.row)">
|
||||
查看
|
||||
</el-button>
|
||||
<el-button link type="primary" @click="table_submit(scope.row)" v-auth="'mio.submit'"
|
||||
v-if="scope.row.state == 10">
|
||||
提交
|
||||
</el-button>
|
||||
<el-button link type="danger" @click="table_del(scope.row)" v-auth="'mio.delete'"
|
||||
v-if="scope.row.state == 10">
|
||||
删除
|
||||
</el-button>
|
||||
<el-button link type="warning" @click="revert(scope.row)" v-auth="'mio.submit'" v-if="scope.row.state == 20">
|
||||
撤销
|
||||
</el-button>
|
||||
</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>
|
||||
<el-container>
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="add('do_in')"
|
||||
v-auth="'mio.do'"
|
||||
>生产入库</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="add('do_out')"
|
||||
v-auth="'mio.do'"
|
||||
>生产领料</el-button
|
||||
>
|
||||
<el-select
|
||||
v-model="query.type"
|
||||
clearable
|
||||
style="width: 120px; margin-left: 2px"
|
||||
placeholder="出入库类型"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in cateOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
<el-select
|
||||
v-model="query.state"
|
||||
clearable
|
||||
style="width: 120px; margin-left: 2px"
|
||||
placeholder="状态"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stateOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
placeholder="编号"
|
||||
clearable
|
||||
style="margin-right: 5px"
|
||||
></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"
|
||||
:params="params"
|
||||
:query="query"
|
||||
stripe
|
||||
>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column
|
||||
label="记录编号"
|
||||
prop="number"
|
||||
></el-table-column>
|
||||
<el-table-column label="出/入库类型">
|
||||
<template #default="scope">
|
||||
{{ typeDict[scope.row.type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="记录状态">
|
||||
<template #default="scope">
|
||||
{{ stateDict[scope.row.state] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出/入库日期" prop="inout_date">
|
||||
</el-table-column>
|
||||
<el-table-column label="执行车间" prop="belong_dept_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="创建人" prop="create_by_name">
|
||||
</el-table-column>
|
||||
<el-table-column label="创建时间" prop="create_time">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
fixed="right"
|
||||
align="center"
|
||||
width="150px"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="table_detail(scope.row)"
|
||||
>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="table_edit(scope.row)"
|
||||
v-if="scope.row.state == 10"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="table_submit(scope.row)"
|
||||
v-auth="'mio.submit'"
|
||||
v-if="scope.row.state == 10"
|
||||
>
|
||||
提交
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="table_del(scope.row)"
|
||||
v-auth="'mio.delete'"
|
||||
v-if="scope.row.state == 10"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
@click="revert(scope.row)"
|
||||
v-auth="'mio.submit'"
|
||||
v-if="scope.row.state == 20"
|
||||
>
|
||||
撤销
|
||||
</el-button>
|
||||
</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 "./mio_form.vue";
|
||||
|
||||
export default {
|
||||
name: "mio",
|
||||
components: {
|
||||
saveDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
stateDict: {
|
||||
10: '创建中',
|
||||
20: '已提交'
|
||||
},
|
||||
stateOptions: [
|
||||
{ id: 10, name: '创建中' },
|
||||
{ id: 20, name: '已提交' },
|
||||
],
|
||||
typeDict: {
|
||||
'do_out': '生产领料',
|
||||
'do_in': '生产入库',
|
||||
},
|
||||
cateOptions: [
|
||||
{ id: 'do_out', name: '生产领料' },
|
||||
{ id: 'do_in', name: '生产入库' },
|
||||
],
|
||||
dialog: {
|
||||
save: false,
|
||||
},
|
||||
query: {
|
||||
|
||||
},
|
||||
params: {
|
||||
type__in: 'do_in,do_out',
|
||||
materials__type: 20
|
||||
},
|
||||
form: {
|
||||
|
||||
},
|
||||
apiObj: this.$API.inm.mio.list,
|
||||
selection: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
//添加
|
||||
add(type) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("add", type);
|
||||
});
|
||||
},
|
||||
//编辑
|
||||
table_edit(row) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("edit", type).setData(row);
|
||||
});
|
||||
},
|
||||
//查看
|
||||
table_detail(row) {
|
||||
this.$router.push({
|
||||
name: "mioitem",
|
||||
query: { mio: row.id, type: row.type, cate: 'halfgood' }
|
||||
|
||||
});
|
||||
},
|
||||
//删除
|
||||
table_del(row) {
|
||||
this.$confirm(`确定删除吗?`, "提示", {
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
this.$API.inm.mio.delete.req(row.id).then((res) => {
|
||||
this.$message.success("删除成功");
|
||||
this.$refs.table.refresh();
|
||||
return res;
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
revert(row) {
|
||||
this.$confirm(`确定撤销该操作吗?`, "提示", {
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
this.$API.inm.mio.revert.req(row.id).then((res) => {
|
||||
this.$message.success("撤销成功");
|
||||
this.$refs.table.refresh();
|
||||
return res;
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}).catch(() => { });
|
||||
},
|
||||
table_submit(row) {
|
||||
this.$API.inm.mio.submit.req(row.id).then(res => {
|
||||
this.$message.success("提交成功");
|
||||
this.$refs.table.refresh()
|
||||
})
|
||||
},
|
||||
handleQuery() {
|
||||
this.$refs.table.queryData(this.query)
|
||||
},
|
||||
resetQuery() {
|
||||
this.query = {};
|
||||
},
|
||||
handleSaveSuccess() {
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
},
|
||||
name: "mio",
|
||||
components: {
|
||||
saveDialog,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
stateDict: {
|
||||
10: "创建中",
|
||||
20: "已提交",
|
||||
},
|
||||
stateOptions: [
|
||||
{ id: 10, name: "创建中" },
|
||||
{ id: 20, name: "已提交" },
|
||||
],
|
||||
typeDict: {
|
||||
do_out: "生产领料",
|
||||
do_in: "生产入库",
|
||||
},
|
||||
cateOptions: [
|
||||
{ id: "do_out", name: "生产领料" },
|
||||
{ id: "do_in", name: "生产入库" },
|
||||
],
|
||||
dialog: {
|
||||
save: false,
|
||||
},
|
||||
query: {},
|
||||
params: {
|
||||
type__in: "do_in,do_out",
|
||||
materials__type: 20,
|
||||
},
|
||||
form: {},
|
||||
apiObj: this.$API.inm.mio.list,
|
||||
selection: [],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
//添加
|
||||
add(type) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("add", type);
|
||||
});
|
||||
},
|
||||
//编辑
|
||||
table_edit(row) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("edit", row.type).setData(row);
|
||||
});
|
||||
},
|
||||
//查看
|
||||
table_detail(row) {
|
||||
this.$router.push({
|
||||
name: "mioitem",
|
||||
query: { mio: row.id, type: row.type, cate: "halfgood" },
|
||||
});
|
||||
},
|
||||
//删除
|
||||
table_del(row) {
|
||||
this.$confirm(`确定删除吗?`, "提示", {
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.$API.inm.mio.delete
|
||||
.req(row.id)
|
||||
.then((res) => {
|
||||
this.$message.success("删除成功");
|
||||
this.$refs.table.refresh();
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
return err;
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
revert(row) {
|
||||
this.$confirm(`确定撤销该操作吗?`, "提示", {
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
this.$API.inm.mio.revert
|
||||
.req(row.id)
|
||||
.then((res) => {
|
||||
this.$message.success("撤销成功");
|
||||
this.$refs.table.refresh();
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
return err;
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
table_submit(row) {
|
||||
this.$API.inm.mio.submit.req(row.id).then((res) => {
|
||||
this.$message.success("提交成功");
|
||||
this.$refs.table.refresh();
|
||||
});
|
||||
},
|
||||
handleQuery() {
|
||||
this.$refs.table.queryData(this.query);
|
||||
},
|
||||
resetQuery() {
|
||||
this.query = {};
|
||||
},
|
||||
handleSaveSuccess() {
|
||||
this.$refs.table.refresh();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -103,6 +103,14 @@
|
|||
>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="table_edit(scope.row)"
|
||||
v-if="scope.row.state == 10"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
|
@ -193,7 +201,7 @@ export default {
|
|||
table_edit(row) {
|
||||
this.dialog.save = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.saveDialog.open("edit", type).setData(row);
|
||||
this.$refs.saveDialog.open("edit", row.type).setData(row);
|
||||
});
|
||||
},
|
||||
//查看
|
||||
|
|
|
@ -248,9 +248,7 @@ export default {
|
|||
open(mode = "add", type = "") {
|
||||
this.mode = mode;
|
||||
this.form.type = type;
|
||||
if (mode == "add") {
|
||||
this.init();
|
||||
}
|
||||
this.init();
|
||||
this.visible = true;
|
||||
return this;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue