fix:销售订单中添加产品搜索
This commit is contained in:
parent
8a1c7cb11e
commit
55fb2b925c
|
@ -52,7 +52,7 @@
|
|||
>
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.material_">
|
||||
{{ scope.row.material_.name }}</span
|
||||
{{ scope.row.material_.full_name }}</span
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -81,14 +81,14 @@
|
|||
width="100px"
|
||||
>
|
||||
<template #default="scope">
|
||||
<el-link
|
||||
<!-- <el-link
|
||||
type="primary"
|
||||
@click="table_edit(scope.row)"
|
||||
v-auth="'order.update'"
|
||||
>
|
||||
编辑
|
||||
</el-link>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
</el-link> -->
|
||||
<!-- <el-divider direction="vertical"></el-divider> -->
|
||||
<el-link
|
||||
type="danger"
|
||||
@click="table_del(scope.row)"
|
||||
|
@ -186,6 +186,7 @@ export default {
|
|||
.req(row.id)
|
||||
.then((res) => {
|
||||
this.$message.success("删除成功");
|
||||
this.$refs.table.refresh();
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
|
@ -1,27 +1,57 @@
|
|||
<template>
|
||||
<el-dialog :title="titleMap[mode]" v-model="visible" :size="1000" destroy-on-close @closed="$emit('closed')">
|
||||
<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-width="110px">
|
||||
<el-form
|
||||
ref="dialogForm"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
label-width="110px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="所需产品" prop="material">
|
||||
<el-select v-model="form.material" placeholder="所需产品" clearable style="width:100%">
|
||||
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
<el-select
|
||||
v-model="form.material"
|
||||
placeholder="所需产品"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.id"
|
||||
:label="item.full_name"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="所需数量">
|
||||
<el-input-number v-model="form.count" :precision="0" :min="1" controls-position="right" placeholder="所需数量"
|
||||
style="width:100%" />
|
||||
<el-input-number
|
||||
v-model="form.count"
|
||||
:precision="0"
|
||||
:min="1"
|
||||
controls-position="right"
|
||||
placeholder="所需数量"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-main>
|
||||
<el-footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">保存</el-button>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit"
|
||||
>保存</el-button
|
||||
>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
|
@ -31,7 +61,7 @@
|
|||
export default {
|
||||
emits: ["success", "closed"],
|
||||
props: {
|
||||
orderId: { type: String, default: '' },
|
||||
orderId: { type: String, default: "" },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -44,7 +74,13 @@ export default {
|
|||
},
|
||||
form: {},
|
||||
rules: {
|
||||
material: [{ required: true, message: "请选择所需产品", trigger: "blur" }],
|
||||
material: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择所需产品",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
|
@ -63,9 +99,11 @@ export default {
|
|||
return this;
|
||||
},
|
||||
getList() {
|
||||
this.$API.mtm.material.list.req({ page: 0, type: 10 }).then(res => {
|
||||
this.$API.mtm.material.list
|
||||
.req({ page: 0, type: 10 })
|
||||
.then((res) => {
|
||||
this.options = res;
|
||||
})
|
||||
});
|
||||
},
|
||||
//提交
|
||||
submit() {
|
||||
|
@ -73,22 +111,14 @@ export default {
|
|||
if (valid) {
|
||||
this.isSaveing = true;
|
||||
this.form.order = this.orderId;
|
||||
try {
|
||||
var res;
|
||||
if (this.mode == "add") {
|
||||
res = await this.$API.sam.orderitem.create.req(this.form);
|
||||
} else if (this.mode == "edit") {
|
||||
res = await this.$API.sam.orderitem.update.req(this.form.id, this.form);
|
||||
}
|
||||
this.$API.sam.orderitem.create
|
||||
.req(this.form)
|
||||
.then((res) => {
|
||||
this.isSaveing = false;
|
||||
this.$emit("success", this.form, this.mode);
|
||||
this.visible = false;
|
||||
this.$message.success("操作成功");
|
||||
} catch (err) {
|
||||
//可以处理校验错误
|
||||
this.isSaveing = false;
|
||||
return err;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue