原料出入库记录加撤销

This commit is contained in:
shijing 2024-03-27 16:04:50 +08:00
parent ad80db57fa
commit f88932b304
1 changed files with 253 additions and 154 deletions

View File

@ -1,161 +1,260 @@
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-button type="primary" @click="add('do_out')" v-auth="'mio.do'">生产领料</el-button> <el-button
<el-button type="primary" @click="add('pur_in')" v-auth="'mio.pur'">采购入库</el-button> type="primary"
<el-select v-model="query.type" clearable style="width: 120px; margin-left: 2px" placeholder="出入库类型" @click="add('do_out')"
@change="handleQuery"> v-auth="'mio.do'"
<el-option v-for="item in cateOptions" :key="item.id" :label="item.name" :value="item.id"></el-option> >生产领料</el-button
</el-select> >
<el-select v-model="query.state" clearable style="width: 120px; margin-left: 2px" placeholder="状态" <el-button
@change="handleQuery"> type="primary"
<el-option v-for="item in stateOptions" :key="item.id" :label="item.name" :value="item.id"></el-option> @click="add('pur_in')"
</el-select> v-auth="'mio.pur'"
</div> >采购入库</el-button
<div class="right-panel"> >
<el-input v-model="query.search" placeholder="编号" clearable style="margin-right: 5px;"></el-input> <el-select
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button> v-model="query.type"
</div> clearable
</el-header> style="width: 120px; margin-left: 2px"
<el-main class="nopadding"> placeholder="出入库类型"
<scTable ref="table" :apiObj="apiObj" row-key="id" :params="params" :query="query" stripe> @change="handleQuery"
<el-table-column type="index" width="50" /> >
<el-table-column label="记录编号" prop="number"></el-table-column> <el-option
<el-table-column label="出/入库类型"> v-for="item in cateOptions"
<template #default="scope"> :key="item.id"
{{ typeDict[scope.row.type] }} :label="item.name"
</template> :value="item.id"
</el-table-column> ></el-option>
<el-table-column label="记录状态"> </el-select>
<template #default="scope"> <el-select
{{ stateDict[scope.row.state] }} v-model="query.state"
</template> clearable
</el-table-column> style="width: 120px; margin-left: 2px"
<el-table-column label="出/入库日期" prop="inout_date"> placeholder="状态"
</el-table-column> @change="handleQuery"
<el-table-column label="执行车间" prop="belong_dept_name"> >
</el-table-column> <el-option
<el-table-column label="创建人" prop="create_by_name"> v-for="item in stateOptions"
</el-table-column> :key="item.id"
<el-table-column label="创建时间" prop="create_time"> :label="item.name"
</el-table-column> :value="item.id"
<el-table-column label="操作" fixed="right" align="center" width="150px"> ></el-option>
<template #default="scope"> </el-select>
<el-button link type="primary" @click="table_detail(scope.row)"> </div>
查看 <div class="right-panel">
</el-button> <el-input
<el-button link type="primary" @click="table_submit(scope.row)" v-auth="'mio.submit'" v-model="query.search"
v-if="scope.row.state == 10"> placeholder="编号"
提交 clearable
</el-button> style="margin-right: 5px"
<el-button link type="danger" @click="table_del(scope.row)" v-auth="'mio.delete'" ></el-input>
v-if="scope.row.state == 10"> <el-button
删除 type="primary"
</el-button> icon="el-icon-search"
</template> @click="handleQuery"
</el-table-column> ></el-button>
</scTable> </div>
</el-main> </el-header>
</el-container> <el-main class="nopadding">
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" <scTable
@closed="dialog.save = false"></save-dialog> 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>
</template> </template>
<script> <script>
import saveDialog from "./mio_form.vue"; import saveDialog from "./mio_form.vue";
export default { export default {
name: "mio", name: "mio",
components: { components: {
saveDialog saveDialog,
}, },
data() { data() {
return { return {
stateDict: { stateDict: {
10: '创建中', 10: "创建中",
20: '已提交' 20: "已提交",
}, },
stateOptions: [ stateOptions: [
{ id: 10, name: '创建中' }, { id: 10, name: "创建中" },
{ id: 20, name: '已提交' }, { id: 20, name: "已提交" },
], ],
typeDict: { typeDict: {
'do_out': '生产领料', do_out: "生产领料",
'pur_in': '采购入库' pur_in: "采购入库",
}, },
cateOptions: [ cateOptions: [
{ id: 'do_out', name: '生产领料' }, { id: "do_out", name: "生产领料" },
{ id: 'pur_in', name: '采购入库' } { id: "pur_in", name: "采购入库" },
], ],
dialog: { dialog: {
save: false, save: false,
}, },
query: { query: {},
params: {
}, type__in: "pur_in,do_out",
params: { materials__type: 30,
type__in: 'pur_in,do_out', },
materials__type: 30 form: {},
}, apiObj: this.$API.inm.mio.list,
form: { selection: [],
};
}, },
apiObj: this.$API.inm.mio.list, methods: {
selection: [], //
}; add(type) {
}, this.dialog.save = true;
methods: { this.$nextTick(() => {
// this.$refs.saveDialog.open("add", type);
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_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: "mainso" },
table_detail(row) { });
this.$router.push({ },
name: "mioitem", //
query: { mio: row.id, type: row.type, cate: 'mainso' } table_del(row) {
this.$confirm(`确定删除吗?`, "提示", {
}); type: "warning",
}, })
// .then(() => {
table_del(row) { this.$API.inm.mio.delete
this.$confirm(`确定删除吗?`, "提示", { .req(row.id)
type: "warning", .then((res) => {
}).then(() => { this.$message.success("删除成功");
this.$API.inm.mio.delete.req(row.id).then((res) => { this.$refs.table.refresh();
this.$message.success("删除成功"); return res;
this.$refs.table.refresh(); })
return res; .catch((err) => {
}).catch((err) => { return err;
return err; });
}); })
}).catch(() => { }); .catch(() => {});
}, },
table_submit(row) { revert(row) {
this.$API.inm.mio.submit.req(row.id).then(res => { this.$confirm(`确定撤销该操作吗?`, "提示", {
this.$message.success("提交成功"); type: "warning",
this.$refs.table.refresh() })
}) .then(() => {
}, this.$API.inm.mio.revert
handleQuery() { .req(row.id)
this.$refs.table.queryData(this.query) .then((res) => {
}, this.$message.success("撤销成功");
resetQuery() { this.$refs.table.refresh();
this.query = {}; return res;
}, })
handleSaveSuccess() { .catch((err) => {
this.$refs.table.refresh() 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>