Compare commits

..

3 Commits

Author SHA1 Message Date
4323982b89 Merge pull request 'projects/mes-dy' (#118) from projects/mes-dy into projects/mes-test
Reviewed-on: #118
2023-11-28 09:01:37 +08:00
helloDy
c76078214e Merge branch 'projects/mes-test' into projects/mes-dy 2023-11-27 20:42:33 +08:00
helloDy
b527589e0f ui 2023-11-27 20:41:45 +08:00
20 changed files with 513 additions and 360 deletions

View File

@ -1,7 +1,7 @@
/*
* @Author: Do not edit
* @Date: 2023-10-21 11:50:46
* @LastEditTime: 2023-10-26 20:06:29
* @LastEditTime: 2023-11-27 17:54:28
* @LastEditors: DY
* @Description:
*/
@ -110,3 +110,11 @@ export function deleteMaterialPBDet(id) {
method: 'delete'
})
}
// 获得产品Bom详细
export function getMaterialPBDet(id) {
return request({
url: '/base/material-product-bom-det/get?id=' + id,
method: 'get'
})
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="1_基础资料" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="1-1工厂信息" transform="translate(-1834.000000, -253.000000)">
<g id="icon/界面内/编辑" transform="translate(1834.000000, 253.000000)">
<rect id="矩形" x="0" y="0" width="16" height="16"></rect>
<g id="常用购票人编辑32" fill-rule="nonzero">
<rect id="矩形" fill="#000000" opacity="0" x="0" y="0" width="16" height="16"></rect>
<path d="M13.5,7.8285 C13.5,7.55235763 13.7238576,7.3285 14,7.3285 C14.2761424,7.3285 14.5,7.55235763 14.5,7.8285 L14.5,12 C14.5,13.3807119 13.3807119,14.5 12,14.5 L4,14.5 C2.61928813,14.5 1.5,13.3807119 1.5,12 L1.5,4 C1.5,2.61928813 2.61928813,1.5 4,1.5 L8.759,1.5 C8.9376328,1.5 9.10269631,1.59529946 9.19201271,1.75 C9.28132911,1.90470054 9.28132911,2.09529946 9.19201271,2.25 C9.10269631,2.40470054 8.9376328,2.5 8.759,2.5 L4,2.5 C3.17157288,2.5 2.5,3.17157288 2.5,4 L2.5,12 C2.5,12.8284271 3.17157288,13.5 4,13.5 L12,13.5 C12.8284271,13.5 13.5,12.8284271 13.5,12 L13.5,7.8285 Z M13.284,2.312 C13.4738226,2.11757837 13.784168,2.11034095 13.9828473,2.2957025 C14.1815266,2.48106405 14.1958051,2.79116533 14.015,2.994 L8.56,8.845 C8.43817243,8.97566989 8.25588756,9.03141962 8.08181033,8.9912488 C7.90773311,8.95107798 7.76830999,8.82108951 7.71606033,8.65024879 C7.66381067,8.47940808 7.70667243,8.29366989 7.8285,8.163 L13.284,2.312 Z" id="形状" stroke="#0B58FF" stroke-width="0.1" fill="#0B58FF"></path>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-25 11:25:23
* @LastEditTime: 2023-11-27 20:12:00
* @Description:
-->
<template>
@ -11,7 +11,7 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="100px">
label-width="90px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="原料名称" prop="name">

View File

@ -29,7 +29,7 @@
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
width="45%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>

View File

@ -2,14 +2,14 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-27 09:23:56
* @LastEditTime: 2023-11-27 20:07:09
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
:wrapper-closable="isdetail"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">
@ -114,14 +114,6 @@
</el-row>
</el-form>
</div>
<div class="drawer-body__footer">
<el-button v-if="!idAttrShow" @click="goback()">取消</el-button>
<el-button v-else :disabled="isdetail" @click="init(dataForm.id)">重置</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title
@ -158,14 +150,16 @@
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
<div class="drawer-body__footer">
<el-button type="primary" @click="goback()">关闭</el-button>
</div>
</div>
</div>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button @click="goback()">取消</el-button>
<el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
<attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@ -270,11 +264,7 @@ export default {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.attrName
? '[名称=' + raw.data.attrName + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
`是否确认删除属性名为"${raw.data.name}"的数据项?`,
'提示',
{
confirmButtonText: '确定',

View File

@ -84,18 +84,18 @@ export default {
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:core-product:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:core-product:detail`)
? {
type: 'detail',
btnName: '查看详情',
}
: undefined,
this.$auth.hasPermi(`base:core-product:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:core-product:delete`)
? {
type: 'delete',
@ -141,6 +141,27 @@ export default {
},
created() {},
methods: {
//
deleteHandle(id, name, index) {
this.$confirm(`是否确认删除产品名称为"${name}"的数据项`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
},
//
otherMethods(val) {
if (val.type === 'detail') {

View File

@ -105,7 +105,7 @@ export default {
formConfig: [
{
type: 'input',
label: '关键字',
label: '供应商',
placeholder: '供应商名称',
param: 'name',
},

View File

@ -1,21 +1,19 @@
<template>
<el-form ref="dataForm" :rules="rules" label-width="130px" :model="dataForm">
<el-row>
<el-col :span='12'>
<el-form ref="dataForm" :rules="rules" label-width="130px" :model="dataForm" label-position="top">
<el-row :gutter="20">
<el-col :span='8'>
<el-form-item label="工单名称" prop="name">
<el-input v-model="dataForm.name"></el-input>
<el-input v-model="dataForm.name" placeholder="请输入工单名称"></el-input>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-col :span='8'>
<el-form-item label="工单编码" prop="code">
<el-input v-model="dataForm.code" disabled></el-input>
<el-input v-model="dataForm.code" disabled placeholder="请输入工单编码"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-col :span='8'>
<el-form-item label="产品名称" prop="planProductId">
<el-select v-model="dataForm.planProductId" placeholder="请选择" style="width: 100%;" @change="selectProduct">
<el-select v-model="dataForm.planProductId" placeholder="请选择产品" style="width: 100%;" @change="selectProduct">
<el-option
v-for="item in productList"
:key="item.id"
@ -25,52 +23,50 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
</el-row>
<el-row :gutter="20">
<el-col :span='8'>
<el-form-item label="产品规格" prop="specifications">
<el-input v-model="dataForm.specifications" />
<el-input v-model="dataForm.specifications" placeholder="请输入产品规格" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-col :span='8'>
<el-form-item label="计划开始时间">
<el-date-picker
v-model="dataForm.planStartTime"
type="datetime"
value-format="timestamp"
style="width: 100%;"
placeholder="选择日期">
placeholder="请选择计划开始时间">
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-col :span='8'>
<el-form-item label="计划完成时间">
<el-date-picker
v-model="dataForm.planFinishTime"
type="datetime"
value-format="timestamp"
style="width: 100%;"
placeholder="选择日期">
placeholder="请选择计划完成时间">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-row :gutter="20">
<el-col :span='8'>
<el-form-item label="计划投入数量" prop="planAssignQuantity">
<el-input-number v-model="dataForm.planAssignQuantity" :min="0" :max="9999999999999" style="width: 100%;"></el-input-number>
<el-input-number v-model="dataForm.planAssignQuantity" :min="0" :max="9999999999999" style="width: 100%;" placeholder="请输入计划投入数量"></el-input-number>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-col :span='8'>
<el-form-item label="计划生产数量" prop="planQuantity">
<el-input-number v-model="dataForm.planQuantity" :min="0" :max="9999999999999" style="width: 100%;"></el-input-number>
<el-input-number v-model="dataForm.planQuantity" :min="0" :max="9999999999999" style="width: 100%;" placeholder="请输入计划生产数量"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-col :span='8'>
<el-form-item label="关联工艺" prop="processFlowId">
<el-select v-model="dataForm.processFlowId" placeholder="请选择工艺" clearable filterable style="width: 100%;" @change="processFlowIdChange">
<el-select v-model="dataForm.processFlowId" placeholder="请选择关联工艺" clearable filterable style="width: 100%;" @change="processFlowIdChange">
<el-option
v-for="item in processFlowList"
:key="item.id"
@ -80,19 +76,23 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
</el-row>
<el-row :gutter="20">
<el-col :span='8'>
<el-form-item label="物料计算方式" prop="materialMethod">
<el-radio-group v-model="dataForm.materialMethod" @change="materialMethodChange">
<!-- <el-radio-group v-model="dataForm.materialMethod" @change="materialMethodChange">
<el-radio :label="1">产品基础BOM</el-radio>
<el-radio :label="2">工艺扩展BOM</el-radio>
</el-radio-group>
</el-radio-group> -->
<el-select v-model="dataForm.materialMethod" placeholder="请选择物料计算方式" style="width: 100%;" @change="materialMethodChange">
<el-option key="1" label="产品基础BOM" :value="1" />
<el-option key="2" label="工艺扩展BOM" :value="2" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-col :span='8'>
<el-form-item label="优先级" prop="priority">
<el-select v-model="dataForm.priority" placeholder="请选择" style="width: 100%;">
<el-select v-model="dataForm.priority" placeholder="请选择优先级" style="width: 100%;">
<el-option
v-for="item in getDictDatas(DICT_TYPE.ORDER_PRIORITY)"
:key="item.value"
@ -102,9 +102,9 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-col :span='8'>
<el-form-item label="工单类型" prop="type">
<el-select v-model="dataForm.type" placeholder="请选择" style="width: 100%;">
<el-select v-model="dataForm.type" placeholder="请选择工单类型" style="width: 100%;">
<el-option
v-for="item in workOrderTypeList"
:key="item.id"
@ -115,10 +115,10 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span='12'>
<el-row :gutter="20">
<el-col :span='8'>
<el-form-item label="关联产线" prop="productLineIds">
<el-select v-model="dataForm.productLineIds" placeholder="请选择" multiple style="width: 100%;">
<el-select v-model="dataForm.productLineIds" placeholder="请选择关联产线" multiple style="width: 100%;">
<el-option
v-for="item in productLineList"
:key="item.id"
@ -128,9 +128,9 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-col :span='8'>
<el-form-item label="负责人" prop="workers">
<el-input v-model="dataForm.workers"></el-input>
<el-input v-model="dataForm.workers" placeholder="请输入负责人"></el-input>
</el-form-item>
</el-col>
</el-row>

View File

@ -65,7 +65,8 @@ const tableProps = [
{
prop: 'createTime',
label: '创建时间',
filter: parseTime
filter: parseTime,
'show-overflow-tooltip': true
},
{
prop: 'name',
@ -127,48 +128,10 @@ export default {
allocationVisible: false,
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:core-work-order:update`)
? {
type: 'edit',
btnName: '编辑',
showParam: {
type: '&',
data: [
{
name: 'status',
type: 'equal',
value: 1
}
]
}
}
: undefined,
this.$auth.hasPermi(`base:core-work-order:detail`)
? {
type: 'detail',
btnName: '查看详情',
}
: undefined,
this.$auth.hasPermi(`base:core-work-order:delete`)
? {
type: 'delete',
btnName: '删除',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 1
}
]
}
}
: undefined,
this.$auth.hasPermi(`base:core-work-order:material`)
? {
type: 'material',
btnName: '预使用原料信息',
btnName: '原料信息',
}
: undefined,
{
@ -246,7 +209,45 @@ export default {
}
]
}
},
this.$auth.hasPermi(`base:core-work-order:detail`)
? {
type: 'detail',
btnName: '查看详情',
}
: undefined,
this.$auth.hasPermi(`base:core-work-order:update`)
? {
type: 'edit',
btnName: '编辑',
showParam: {
type: '&',
data: [
{
name: 'status',
type: 'equal',
value: 1
}
]
}
}
: undefined,
this.$auth.hasPermi(`base:core-work-order:delete`)
? {
type: 'delete',
btnName: '删除',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 1
}
]
}
}
: undefined
].filter((v)=>v),
tableData: [],
formConfig: [

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-27 09:36:44
* @LastEditTime: 2023-11-27 15:26:12
* @Description:
-->
<template>
@ -120,6 +120,7 @@
</el-row>
</el-form>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title
style="margin: 16px 0; padding-left: 8px"
@ -158,11 +159,9 @@
<div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button> -->
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</div>
<attr-add
@ -293,11 +292,7 @@ export default {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.attrName
? '[名称=' + raw.data.attrName + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
`是否确认删除属性名为"${raw.data.attrName}"的数据项?`,
'提示',
{
confirmButtonText: '确定',
@ -362,6 +357,29 @@ export default {
}
}
});
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false
this.$emit("refreshDataList");
});
return;
}
//
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.idAttrShow = true
this.$emit("refreshDataList");
});
});
},
goback() {
this.$emit('refreshDataList');

View File

@ -1,7 +1,7 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'35%'"
:width="'30%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
@ -17,7 +17,7 @@
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
label-width="70px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="属性名" prop="attrName">
<el-input

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-06 19:55:59
* @LastEditTime: 2023-11-27 15:10:20
* @Description:
-->
<template>
@ -18,7 +18,8 @@
<el-select
v-model="dataForm.materialId"
placeholder="请选择物料"
@change="setMaterialCode">
@change="setMaterialCode"
style="width: 100%">
<el-option
v-for="dict in materialList"
:key="dict.id"

View File

@ -29,7 +29,7 @@
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>

View File

@ -2,14 +2,14 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-25 19:10:12
* @LastEditTime: 2023-11-27 19:50:36
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
:wrapper-closable="isdetail"
class="drawer"
size="70%">
<small-title slot="title" :no-padding="true">
@ -25,7 +25,7 @@
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="产品名称" prop="productId">
<el-select
v-model="dataForm.productId"
@ -42,15 +42,17 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="产品BOM编码" prop="code">
<el-input v-model="dataForm.code" :disabled="isdetail" placeholder="请输入产品Bom编码" />
</el-form-item>
</el-col>
</el-row>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="attr-list" v-if="idAttrShow">
@ -60,92 +62,26 @@
BOM明细
</small-title>
<!-- <base-table
<div v-if="!isdetail" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">添加</el-button>
</span>
</template>
</div>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:add-button-show="isdetail ? null : '添加属性'"
@emitButtonClick="addNew()"
:table-data="materialAttrList">
:table-data="tableData">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="120"
:width="90"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table> -->
<el-button v-show="!isdetail" type="success" size="small" style="float: right" @click="addRow()">添加一行</el-button>
<el-table
:data="tableData"
style="width: 100%">
<el-table-column type="index" label="序号" />
<el-table-column prop="createTime" label="添加时间">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="materialId" label="物料名称*">
<template slot-scope="scope">
<el-select
v-model="scope.row.materialId"
filterable
clearable
:disabled="!scope.row.isEdit"
placeholder="请选择物料"
@change="setCode(scope.row)">
<el-option
v-for="dict in materialList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
<span v-if="scope.row.isShow" style="color: red">物料不可为空</span>
</template>
</el-table-column>
<el-table-column prop="materialCode" label="物料编码" />
<el-table-column prop="mUnit" label="单位" />
<el-table-column prop="num" label="数量*">
<template slot-scope="scope">
<el-input v-model.number="scope.row.num" :disabled="!scope.row.isEdit" @input="changeNum(scope.row)"></el-input>
<span v-if="scope.row.isNum" style="color: red">数量不可为空</span>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注">
<template slot-scope="scope">
<el-input v-model="scope.row.remark" :disabled="!scope.row.isEdit"></el-input>
</template>
</el-table-column>
<el-table-column v-if="!isdetail" label="操作">
<template slot-scope="scope">
<el-tooltip v-if="!scope.row.isEdit" placement="top" content="编辑">
<el-button
type="text"
:style="{color:'#0B58FF'}"
size="mini"
@click="edit(scope.row)"
>
<!-- 此处的icon的名字命名为'table_'加上按钮的type -->
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="edit" />
<!-- <span>{{ item.btnName | i18nFilter }}</span> -->
</el-button>
</el-tooltip>
<el-button v-else type="text" size="small" @click="saveData(scope.row)">保存</el-button>
<el-tooltip placement="top" content="删除">
<el-button
type="text"
:style="{color:'#FF5454'}"
size="mini"
@click="deleteDetail(scope.row)"
>
<!-- 此处的icon的名字命名为'table_'加上按钮的type -->
<svg-icon style="width: 18px; height: 18px" class="item-icon" icon-class="table_delete" />
<!-- <span>{{ item.btnName | i18nFilter }}</span> -->
</el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
@ -155,20 +91,17 @@
@pagination="getList" />
</div>
<div class="drawer-body__footer">
<el-button style="" @click="goback()">{{ isdetail ? '关闭' : '取消' }}</el-button>
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑
</el-button> -->
<el-button v-if="!isdetail" type="primary" @click="dataFormSubmit()">确定</el-button>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</div>
<!-- <attr-add
<attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:material-id="dataForm.id"
@refreshDataList="getList" /> -->
:bom-id="dataForm.id"
@refreshDataList="getList" />
</el-drawer>
</template>
@ -179,7 +112,8 @@ import { getMaterialList } from "@/api/base/material";
import { listData } from "@/api/system/dict/data";
import SmallTitle from '../material/SmallTitle';
import { parseTime } from '../../core/mixins/code-filter';
// import attrAdd from './attr-add';
import attrAdd from './attr-add';
import { publicFormatter } from '@/utils/dict';
const tableBtn = [
{
@ -198,18 +132,31 @@ const tableProps = [
filter: parseTime,
},
{
prop: 'attrName',
label: '属性名',
prop: 'materialName',
label: '物料名称',
},
{
prop: 'attrValue',
label: '属性值',
prop: 'materialCode',
label: '物料编码',
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('unit_dict'),
},
{
prop: 'num',
label: '数量',
},
{
prop: 'remark',
label: '备注',
}
];
export default {
mixins: [basicAdd],
components: { SmallTitle },
components: { SmallTitle, attrAdd },
data() {
return {
tableBtn,
@ -235,7 +182,6 @@ export default {
},
productList: [],
materialAttrList: [],
materialList: [],
tableData: [],
unitList: [],
visible: false,
@ -250,13 +196,42 @@ export default {
this.getDict()
},
methods: {
handleClick(raw) {
if (raw.type === 'delete') {
this.deleteDetail(raw.data);
} else {
this.addNew(raw.data.id);
}
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
//
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
// this.visible = false;
this.idAttrShow = true;
this.dataForm.id = response.data
this.$emit("refreshDataList");
});
});
},
async getDict() {
//
const proRes = await getProList();
this.productList = proRes.data;
//
const res = await getMaterialList();
this.materialList = res.data;
//
const unitRes = await listData({
pageNo: 1,
@ -276,8 +251,7 @@ export default {
},
deleteDetail(raw) {
this.$confirm(
`确定删除关于物料编码为${
raw.materialCode}的数据?`,
`是否确认删除物料名称为"${raw.materialName}"的数据项?`,
'提示',
{
confirmButtonText: '确定',
@ -299,88 +273,13 @@ export default {
})
.catch(() => {});
},
changeNum(row) {
if (row.num !== '') {
row.isNum = false
} else {
row.isNum = true
}
},
setCode(row) {
if (row.materialId) {
row.isShow = false
const tempM = this.materialList.filter(item => {
if (row.materialId === item.id) {
row.materialCode = item.code
}
return row.materialId === item.id
})
if (tempM[0].unit) {
this.unitList.filter(u => {
if (tempM[0].unit === u.value) {
row.unit = u.value
row.mUnit = u.label
}
})
} else {
row.unit = null
row.mUnit = ''
}
} else {
row.isShow = true
row.unit = null
row.mUnit = ''
}
// row.materialCode = tempList[0].code
// row.unit = tempList[0].unit
},
edit(row) {
row.isEdit = true
},
saveData(row) {
if (row.materialId) {
// this.$refs['dataForm'].validate((valid) => {
// if (valid) {
//
if (row.id) {
updateMaterialPBDet({
...row
}).then((response) => {
this.$modal.msgSuccess('修改成功');
// this.visible = false;
this.getList();
});
return;
}
//
createMaterialPBDet({
...row
}).then((response) => {
this.$modal.msgSuccess('新增成功');
// this.visible = false;
this.getList();
});
} else {
this.$message.warning('请选择物料!')
}
// }
// });
},
getList() {
// Bom
getProBomList({
...this.listQuery,
bomId: this.dataForm.id
}).then((response) => {
this.tableData = response.data.records.map(item => {
this.unitList.filter(u => {
if (item.unit === u.value) {
item.mUnit = u.label
}
})
item.isEdit = false
return item
});
this.tableData = response.data.records
this.listQuery.total = response.data.total;
});
},
@ -476,7 +375,7 @@ export default {
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 30vh;
max-height: 20vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
@ -492,4 +391,12 @@ export default {
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: -40px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
</style>

View File

@ -0,0 +1,197 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'40%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="80px"
@keyup.enter.native="dataFormSubmit()">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="物料名称" prop="materialId">
<el-select
v-model="dataForm.materialId"
placeholder="请选择物料"
clearable
filterable
@change="setCode"
style="width: 100%"
>
<el-option
v-for="dict in materialList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="dataForm.materialCode"
clearable
disabled
placeholder="请输入物料编码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="单位" prop="unit">
<el-select
v-model="dataForm.unit"
style="width: 100%"
disabled
placeholder="请选择单位">
<el-option
v-for="dict in getDictDatas(DICT_TYPE.UNIT_DICT)"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="数量" prop="num">
<el-input-number v-model="dataForm.num" controls-position="right" clearable placeholder="请输入数量" style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import { getMaterialList } from '@/api/base/material';
import { createMaterialPBDet, updateMaterialPBDet, getMaterialPBDet } from "@/api/base/materialProductBom";
export default {
props: {
bomId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
dataForm: {
id: undefined,
materialId: '',
num: 0,
materialCode: undefined,
unit: undefined,
remark: '',
},
materialList: [],
dataRule: {
materialId: [{ required: true, message: '物料名称不能为空', trigger: 'change' }],
num: [{ required: true, message: '数量不能为空', trigger: 'blur' }]
},
};
},
mounted() {
this.getDict()
},
methods: {
async getDict() {
//
const res = await getMaterialList();
this.materialList = res.data;
},
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getMaterialPBDet(this.dataForm.id).then((res) => {
this.dataForm = res.data
this.setCode()
});
}
});
},
setCode() {
const tempMaterial = this.materialList.filter(item =>{
return item.id === this.dataForm.materialId
})
this.dataForm.materialCode = tempMaterial[0]?.code
this.dataForm.unit = tempMaterial[0].unit === undefined ? undefined : String(tempMaterial[0]?.unit)
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updateMaterialPBDet({
...this.dataForm,
bomId: this.bomId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createMaterialPBDet({
...this.dataForm,
bomId: this.bomId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@ -13,7 +13,7 @@
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="220"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
@ -68,24 +68,24 @@ export default {
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`base:material-product-bom:queryMaterial`)
? {
type: 'detail',
btnName: '查看物料',
}
: undefined,
this.$auth.hasPermi(`base:material-product-bom:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`base:material-product-bom:queryMaterial`)
? {
type: 'search',
btnName: '查看物料',
}
: undefined,
this.$auth.hasPermi(`base:material-product-bom:editMaterial`)
? {
type: 'editMaterial',
btnName: '编辑物料',
}
: undefined,
// this.$auth.hasPermi(`base:material-product-bom:editMaterial`)
// ? {
// type: 'editMaterial',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi(`base:material-product-bom:delete`)
? {
type: 'delete',
@ -123,7 +123,7 @@ export default {
created() {},
methods: {
otherMethods(val) {
if (val.type === 'search') {
if (val.type === 'detail') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-22 10:40:08
* @LastEditTime: 2023-11-27 19:57:23
* @Description:
-->
<template>
@ -11,9 +11,10 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
label-width="80px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="物料名称" prop="materialId">
<el-select
v-model="dataForm.materialId"
@ -21,6 +22,7 @@
clearable
filterable
@change="setCode"
style="width: 100%"
>
<el-option
v-for="dict in materialList"
@ -30,7 +32,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="物料编码" prop="materialCode">
<el-input
v-model="dataForm.materialCode"
@ -39,15 +41,14 @@
placeholder="请输入物料编码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="批次号" prop="materialDateId">
<el-select
v-model="dataForm.materialDateId"
clearable
filterable
placeholder="请选择物料批次"
style="width: 100%"
>
<el-option
v-for="dict in materialDateList"
@ -57,13 +58,16 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="使用设备" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
clearable
filterable
placeholder="请选择使用设备">
placeholder="请选择使用设备"
style="width: 100%">
<el-option
v-for="dict in eqList"
:key="dict.id"
@ -72,9 +76,7 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="使用时间" prop="useTime">
<el-date-picker
v-model="dataForm.useTime"
@ -84,14 +86,15 @@
placeholder="选择日期时间" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="操作员" prop="userNames">
<el-select
v-model="dataForm.userNames"
clearable
filterable
multiple
placeholder="请选择操作员">
placeholder="请选择操作员"
style="width: 100%">
<el-option
v-for="dict in workersList"
:key="dict.id"
@ -102,12 +105,12 @@
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="使用数量" prop="num">
<el-input-number v-model="dataForm.num" clearable placeholder="请输入使用数量" />
<el-input-number v-model="dataForm.num" clearable controls-position="right" placeholder="请输入使用数量" style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="数据来源" prop="source">
<el-select
v-model="dataForm.source"
@ -121,10 +124,12 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" clearable placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
@ -237,13 +242,8 @@ export default {
this.dataForm.source = response.data.source
this.dataForm.remark = response.data.remark
this.dataForm.userNames = response.data.userName.split(',')
console.log('打印', this.dataForm)
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
} else {}
});
},
setCode() {

View File

@ -29,7 +29,7 @@
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
width="60%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-24 18:38:22
* @LastEditTime: 2023-11-27 10:48:55
* @Description:
-->
<template>
@ -176,11 +176,7 @@ export default {
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.attrName
? '[名称=' + raw.data.attrName + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
`是否确认删除巡检项目名称为"${raw.data.program}"的数据项?`,
'提示',
{
confirmButtonText: '确定',

View File

@ -1,8 +1,8 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zhp
* @LastEditTime: 2023-11-23 09:20:12
* @LastEditors: DY
* @LastEditTime: 2023-11-27 16:37:17
* @Description:
-->
<template>
@ -53,7 +53,7 @@
</el-form-item>
</el-form>
</div>
<div v-if="isdetail" class="drawer-body__footer">
<div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button v-if="isdetail" type="primary" @click="goEdit()">
编辑