fix:小问题修改

This commit is contained in:
shijing 2024-07-24 15:01:59 +08:00
parent 029d881774
commit 75a0dc33ce
5 changed files with 219 additions and 118 deletions

View File

@ -48,11 +48,12 @@
<el-select <el-select
v-model="form.material" v-model="form.material"
style="width: 100%" style="width: 100%"
filterable
> >
<el-option <el-option
v-for="item in materials" v-for="item in materials"
:key="item.id" :key="item.id"
:label="item.name" :label="item.full_name"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>

View File

@ -1,121 +1,175 @@
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'supplier.create'">新增</el-button> <el-button
</div> type="primary"
<div class="right-panel"> icon="el-icon-plus"
@click="add"
<el-input v-model="query.search" placeholder="名称" clearable style="margin-right: 5px;"></el-input> v-auth="'supplier.create'"
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button> >新增</el-button
</div> >
</el-header> </div>
<el-main class="nopadding"> <div class="right-panel">
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query"> <el-input
<el-table-column type="index" width="50" /> v-model="query.search"
<el-table-column label="供应商名称" prop="name" show-overflow-tooltip> placeholder="名称"
</el-table-column> clearable
<el-table-column label="联系人" prop="contact"> style="margin-right: 5px"
</el-table-column> ></el-input>
<el-table-column label="联系方式" prop="contact_phone"> <el-button
</el-table-column> type="primary"
<el-table-column label="地址" prop="address" show-overflow-tooltip> icon="el-icon-search"
</el-table-column> @click="handleQuery"
<el-table-column label="操作" fixed="right" align="center" width="120px"> ></el-button>
<template #default="scope"> </div>
<el-button link type="primary" @click="table_edit(scope.row)" v-auth="'supplier.update'"> </el-header>
编辑 <el-main class="nopadding">
</el-button> <scTable
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row)" v-auth="'supplier.delete'"> ref="table"
<template #reference> :apiObj="apiObj"
<el-button link type="danger">删除</el-button> row-key="id"
</template> stripe
</el-popconfirm> :params="query"
</template> >
</el-table-column> <el-table-column type="index" width="50" />
</scTable> <el-table-column
</el-main> label="供应商名称"
</el-container> prop="name"
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" show-overflow-tooltip
@closed="dialog.save = false"></save-dialog> >
</el-table-column>
<el-table-column label="联系人" prop="contact">
</el-table-column>
<el-table-column label="联系方式" prop="contact_phone">
</el-table-column>
<el-table-column
label="地址"
prop="address"
show-overflow-tooltip
>
</el-table-column>
<el-table-column label="是否外协" prop="can_outsource">
<template #default="scope">
<el-tag v-if="scope.row.can_outsource" type="success"
></el-tag
>
<el-tag v-else type="waring"></el-tag>
</template>
</el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="120px"
>
<template #default="scope">
<el-button
link
type="primary"
@click="table_edit(scope.row)"
v-auth="'supplier.update'"
>
编辑
</el-button>
<el-popconfirm
title="确定删除吗?"
@confirm="table_del(scope.row)"
v-auth="'supplier.delete'"
>
<template #reference>
<el-button link 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> </template>
<script> <script>
import saveDialog from "./supplier_form.vue"; import saveDialog from "./supplier_form.vue";
export default { export default {
name: "rparty", name: "rparty",
components: { components: {
saveDialog, saveDialog,
}, },
data() { data() {
return { return {
dialog: { dialog: {
save: false, save: false,
}, },
apiObj: this.$API.pum.supplier.list, apiObj: this.$API.pum.supplier.list,
query: { query: {
page: 1, page: 1,
page_size: 20, page_size: 20,
type: 10 type: 10,
}, },
selection: [], selection: [],
state_: { state_: {
10: '完好', 10: "完好",
20: '限用', 20: "限用",
30: '在修', 30: "在修",
40: '禁用', 40: "禁用",
}, },
}; };
}, },
methods: { methods: {
// //
add() { add() {
this.dialog.save = true; this.dialog.save = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open("add"); this.$refs.saveDialog.open("add");
}); });
}, },
// //
table_edit(row) { table_edit(row) {
this.dialog.save = true; this.dialog.save = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row); this.$refs.saveDialog.open("edit").setData(row);
}); });
}, },
// //
table_show(row) { table_show(row) {
this.dialog.save = true; this.dialog.save = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row); this.$refs.saveDialog.open("show").setData(row);
}); });
}, },
// //
async table_del(row) { async table_del(row) {
this.$API.pum.supplier.delete this.$API.pum.supplier.delete
.req(row.id) .req(row.id)
.then((res) => { .then((res) => {
this.$message.success("删除成功"); this.$message.success("删除成功");
this.$refs.table.refresh(); this.$refs.table.refresh();
return res; return res;
}) })
.catch((err) => { .catch((err) => {
return err; return err;
}); });
}, },
// //
handleSaveSuccess(data, mode) { handleSaveSuccess(data, mode) {
if (mode == "add") { if (mode == "add") {
this.$refs.table.refresh(); this.$refs.table.refresh();
} else if (mode == "edit") { } else if (mode == "edit") {
this.$refs.table.refresh(); this.$refs.table.refresh();
} }
}, },
handleQuery() { handleQuery() {
this.$refs.table.queryData(this.query) this.$refs.table.queryData(this.query);
}, },
resetQuery() { resetQuery() {
this.query = {}; this.query = {};
}, },
}, },
}; };
</script> </script>

View File

@ -188,6 +188,7 @@
ref="saveDialog" ref="saveDialog"
:mlog="mlogId" :mlog="mlogId"
:mgroup="mgroup" :mgroup="mgroup"
:materialIn="materialIn"
@success="handleSaveSuccess" @success="handleSaveSuccess"
@closed="dialog.save = false" @closed="dialog.save = false"
> >
@ -330,6 +331,7 @@ export default {
that.$API.wpm.mlog.item.req(that.mlogId).then((res) => { that.$API.wpm.mlog.item.req(that.mlogId).then((res) => {
that.mlogItem = res; that.mlogItem = res;
that.mgroup = res.mgroup; that.mgroup = res.mgroup;
that.materialIn = res.material_in;
that.belongDeptId = res.belong_dept; that.belongDeptId = res.belong_dept;
}); });
}, },

View File

@ -130,6 +130,26 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24">
<el-form-item label="生产类型" prop="mtype">
<el-select
v-model="form.mtype"
placeholder="生产类型"
clearable
:disabled="mode == 'edit'"
style="width: 100%"
>
<el-option
label="自产"
value="10"
></el-option>
<el-option
label="外协"
value="20"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24"> <el-col :md="12" :sm="24">
<el-form-item label="备注"> <el-form-item label="备注">
<el-input <el-input
@ -200,6 +220,13 @@ export default {
trigger: "blur", trigger: "blur",
}, },
], ],
mtype: [
{
required: true,
message: "请选择生产类型",
trigger: "blur",
},
],
}, },
visible: false, visible: false,
isSaveing: false, isSaveing: false,

View File

@ -26,10 +26,10 @@
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.id" :key="item.id"
:label="item.material_out_name" :label="item.number"
:value="item.id" :value="item.id"
> >
<span>{{ item.material_out_name }}</span> <!-- <span>{{ item.material_out_name }}</span>/ -->
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -46,6 +46,15 @@
:label="item.batch" :label="item.batch"
:value="item.id" :value="item.id"
> >
<div
style="
display: flex;
justify-content: space-between;
"
>
<span>{{ item.batch }}</span
><span>{{ item.count }}</span>
</div>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -86,6 +95,10 @@ export default {
type: String, type: String,
default: "", default: "",
}, },
materialIn: {
type: String,
default: "",
},
}, },
emits: ["success", "closed"], emits: ["success", "closed"],
data() { data() {
@ -142,7 +155,11 @@ export default {
getMaterial() { getMaterial() {
let that = this; let that = this;
this.$API.wpm.wmaterial.list this.$API.wpm.wmaterial.list
.req({ mgroupx: that.mgroup, page: 0 }) .req({
mgroupx: that.mgroup,
material: that.materialIn,
page: 0,
})
.then((res) => { .then((res) => {
that.materialOptions = res; that.materialOptions = res;
}); });