增加单位
This commit is contained in:
@@ -48,7 +48,6 @@ export default {
|
||||
},
|
||||
selected(val) {
|
||||
this.$emit('input', val);
|
||||
this.$emit('change', val);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -61,7 +60,9 @@ export default {
|
||||
});
|
||||
},
|
||||
onChange(val) {
|
||||
this.$emit('change', val);
|
||||
// 通过val找到item
|
||||
const product = this.productOptions.find(p => p.productId === val);
|
||||
this.$emit('change', product);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 订单信息展示区域 -->
|
||||
<el-descriptions title="订单信息" class="margin-top mb8" :column="4" size="medium" border v-if="orderInfo">
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
订单编号
|
||||
</template>
|
||||
{{ orderInfo.orderCode }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item>
|
||||
<template slot="label">
|
||||
订单状态
|
||||
</template>
|
||||
<dict-tag :options="dict.type.order_status" :value="orderInfo.orderStatus"/>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
@@ -7,6 +23,7 @@
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
:disabled="!canEdit"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
@@ -16,7 +33,7 @@
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
:disabled="single || !canEdit"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
@@ -26,7 +43,7 @@
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
:disabled="multiple || !canEdit"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
@@ -42,10 +59,10 @@
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="orderDetailList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column type="selection" width="55" align="center" :selectable="canEdit" />
|
||||
<!-- <el-table-column label="明细ID" align="center" prop="detailId" v-if="false"/>
|
||||
<el-table-column label="订单ID" align="center" prop="orderId" /> -->
|
||||
<el-table-column label="原材料" align="center">
|
||||
<el-table-column label="产品" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.productName }}<span v-if="scope.row.productCode">({{ scope.row.productCode }})</span>
|
||||
</template>
|
||||
@@ -59,12 +76,14 @@
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
:disabled="!canEdit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
:disabled="!canEdit"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
@@ -85,16 +104,14 @@
|
||||
<!-- <el-form-item label="订单ID" prop="orderId">
|
||||
<el-input v-model="form.orderId" placeholder="请输入订单ID" :disabled="true" />
|
||||
</el-form-item> -->
|
||||
<el-table-column label="产品" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.productName }}<span v-if="scope.row.productCode">({{ scope.row.productCode }})</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-form-item label="产品" prop="productId">
|
||||
<ProductSelect v-model="form.productId" placeholder="请选择产品" @change="onProductChange" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入产品数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入单位" />
|
||||
<el-input v-model="form.unit" placeholder="单位" :disabled="true" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
@@ -110,10 +127,13 @@
|
||||
|
||||
<script>
|
||||
import { listOrderDetail, getOrderDetail, delOrderDetail, addOrderDetail, updateOrderDetail } from "@/api/wms/orderDetail";
|
||||
import { getOrder } from "@/api/wms/order";
|
||||
import ProductSelect from '@/components/KLPService/ProductSelect';
|
||||
import { EOrderStatus } from "@/utils/enums";
|
||||
|
||||
export default {
|
||||
name: "OrderDetailPanel",
|
||||
dicts: ['order_status'],
|
||||
props: {
|
||||
orderId: {
|
||||
type: [String, Number],
|
||||
@@ -129,8 +149,11 @@ export default {
|
||||
multiple: true,
|
||||
total: 0,
|
||||
orderDetailList: [],
|
||||
orderInfo: null, // 订单信息
|
||||
title: "",
|
||||
open: false,
|
||||
// 订单状态枚举
|
||||
EOrderStatus,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@@ -150,7 +173,8 @@ export default {
|
||||
{ required: true, message: "产品ID不能为空", trigger: "blur" }
|
||||
],
|
||||
quantity: [
|
||||
{ required: true, message: "产品数量不能为空", trigger: "blur" }
|
||||
{ required: true, message: "产品数量不能为空", trigger: "blur" },
|
||||
{ pattern: /^[1-9]\d*$/, message: "产品数量必须为正整数", trigger: "blur" }
|
||||
],
|
||||
unit: [
|
||||
{ required: true, message: "单位不能为空", trigger: "blur" }
|
||||
@@ -158,17 +182,35 @@ export default {
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否可以编辑(订单状态为新建时才能编辑)
|
||||
canEdit() {
|
||||
return this.orderInfo && this.orderInfo.orderStatus === EOrderStatus.NEW;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
orderId(newVal) {
|
||||
this.queryParams.orderId = newVal;
|
||||
this.form.orderId = newVal;
|
||||
this.getOrderInfo();
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getOrderInfo();
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
// 获取订单信息
|
||||
getOrderInfo() {
|
||||
if (this.orderId) {
|
||||
getOrder(this.orderId).then(response => {
|
||||
this.orderInfo = response.data;
|
||||
}).catch(() => {
|
||||
this.orderInfo = null;
|
||||
});
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listOrderDetail(this.queryParams).then(response => {
|
||||
@@ -203,11 +245,19 @@ export default {
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
handleAdd() {
|
||||
if (!this.canEdit) {
|
||||
this.$modal && this.$modal.msgError("当前订单状态不允许新增明细");
|
||||
return;
|
||||
}
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加订单明细";
|
||||
},
|
||||
handleUpdate(row) {
|
||||
if (!this.canEdit) {
|
||||
this.$modal && this.$modal.msgError("当前订单状态不允许修改明细");
|
||||
return;
|
||||
}
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const detailId = row.detailId || this.ids
|
||||
@@ -218,6 +268,13 @@ export default {
|
||||
this.title = "修改订单明细";
|
||||
});
|
||||
},
|
||||
onProductChange(product) {
|
||||
if (product) {
|
||||
this.form.unit = product.unit;
|
||||
} else {
|
||||
this.form.unit = undefined;
|
||||
}
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
@@ -243,6 +300,10 @@ export default {
|
||||
});
|
||||
},
|
||||
handleDelete(row) {
|
||||
if (!this.canEdit) {
|
||||
this.$modal && this.$modal.msgError("当前订单状态不允许删除明细");
|
||||
return;
|
||||
}
|
||||
const detailIds = row.detailId || this.ids;
|
||||
this.$modal && this.$modal.confirm('是否确认删除订单明细编号为"' + detailIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
@@ -267,3 +328,6 @@ export default {
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
|
||||
@@ -127,6 +127,7 @@
|
||||
<el-table-column label="厚度" align="center" prop="thickness" />
|
||||
<el-table-column label="宽度" align="center" prop="width" />
|
||||
<el-table-column label="内径" align="center" prop="innerDiameter" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||
<el-table-column label="是否启用" align="center" prop="isEnabled">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.common_swicth" :value="scope.row.isEnabled"/>
|
||||
@@ -180,6 +181,11 @@
|
||||
<el-input v-model="form.owner" placeholder="请输入负责人" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-divider>分类信息</el-divider>
|
||||
@@ -365,6 +371,7 @@ export default {
|
||||
width: undefined,
|
||||
innerDiameter: undefined,
|
||||
isEnabled: undefined,
|
||||
unit: undefined,
|
||||
delFlag: undefined,
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
<el-table-column label="主键ID" align="center" prop="rawMaterialId" v-if="true"/>
|
||||
<el-table-column label="原材料编号" align="center" prop="rawMaterialCode" />
|
||||
<el-table-column label="原材料名称" align="center" prop="rawMaterialName" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||
<el-table-column label="钢种/牌号" align="center" prop="steelGrade" />
|
||||
<el-table-column label="目标冷轧牌号" align="center" prop="targetColdGrade" />
|
||||
<el-table-column label="基础材质分类" align="center">
|
||||
@@ -170,6 +171,9 @@
|
||||
<el-form-item label="原材料名称" prop="rawMaterialName">
|
||||
<el-input v-model="form.rawMaterialName" placeholder="请输入原材料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="钢种/牌号" prop="steelGrade">
|
||||
<el-input v-model="form.steelGrade" placeholder="请输入钢种/牌号" />
|
||||
</el-form-item>
|
||||
@@ -339,6 +343,7 @@ export default {
|
||||
headTailCutFlag: undefined,
|
||||
inspectionResult: undefined,
|
||||
isEnabled: undefined,
|
||||
unit: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@@ -392,6 +397,9 @@ export default {
|
||||
isEnabled: [
|
||||
{ required: true, message: "是否启用不能为空", trigger: "blur" }
|
||||
],
|
||||
unit: [
|
||||
{ required: true, message: "计量单位不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
paramDialogVisible: false,
|
||||
paramRow: null,
|
||||
@@ -446,7 +454,8 @@ export default {
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined
|
||||
updateBy: undefined,
|
||||
unit: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||
v-hasPermi="['wms:stock:add']">新增</el-button>
|
||||
</el-col>
|
||||
@@ -46,7 +46,7 @@
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['wms:stock:remove']">删除</el-button>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||
v-hasPermi="['wms:stock:export']">导出</el-button>
|
||||
@@ -68,14 +68,14 @@
|
||||
<el-table-column label="单位" align="center" prop="unit" />
|
||||
<el-table-column label="批次号" align="center" prop="batchNo" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['wms:stock:edit']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['wms:stock:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
|
||||
Reference in New Issue
Block a user