更新
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-22 15:01:55
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-10-07 14:39:56
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-drawer
|
||||
:visible.sync="visible"
|
||||
:show-close="false"
|
||||
:destroy-on-close="true"
|
||||
:wrapper-closable="false"
|
||||
class="drawer"
|
||||
size="60%">
|
||||
@@ -18,31 +26,28 @@
|
||||
@keyup.enter.native="dataFormSubmit">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="仓库编码" prop="code">
|
||||
<el-form-item label="仓库编码" prop="warehouseCode">
|
||||
<el-input
|
||||
v-model="dataForm.code"
|
||||
v-model="dataForm.warehouseCode"
|
||||
readonly
|
||||
:disabled="isdetail"
|
||||
placeholder="请输入仓库编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="仓库名" prop="name">
|
||||
<el-form-item label="仓库名" prop="warehouseName">
|
||||
<el-input
|
||||
v-model="dataForm.name"
|
||||
v-model="dataForm.warehouseName"
|
||||
readonly
|
||||
:disabled="isdetail"
|
||||
placeholder="请输入仓库名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工序" prop="processId">
|
||||
<el-form-item label="工序" prop="process">
|
||||
<el-select
|
||||
v-model="dataForm.processId"
|
||||
v-model="dataForm.process"
|
||||
style="width: 100%"
|
||||
:disabled="isdetail"
|
||||
placeholder="请选择工序">
|
||||
<el-option
|
||||
v-for="item in processArr"
|
||||
@@ -59,20 +64,20 @@
|
||||
style="margin: 16px 0; padding-left: 8px"
|
||||
:no-padding="true">
|
||||
产品信息
|
||||
<el-alert title="产品信息新增和修改后,需点击最下方保存按钮确定修改" type="warning" show-icon></el-alert>
|
||||
</small-title>
|
||||
|
||||
<div class="attr-list">
|
||||
<base-table
|
||||
:table-props="
|
||||
propType === 1 ? [...tableProps, ...tableProps1] : tableProps
|
||||
"
|
||||
:table-props="tableProps"
|
||||
:page="listQuery.pageNo"
|
||||
:limit="listQuery.pageSize"
|
||||
:add-button-show="addButtonShow"
|
||||
@emitButtonClick="addNew"
|
||||
@emitFun="inputChange"
|
||||
:height="400"
|
||||
:table-data="productAttributeList">
|
||||
<method-btn
|
||||
v-if="!isdetail"
|
||||
slot="handleBtn"
|
||||
:width="120"
|
||||
label="操作"
|
||||
@@ -85,47 +90,30 @@
|
||||
|
||||
<div style="position: absolute; bottom: 24px; right: 24px">
|
||||
<el-button style="margin-right: 10px" @click="goback()">返回</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button>
|
||||
<span v-if="!isdetail">
|
||||
<span>
|
||||
<el-button type="primary" @click="dataFormSubmit()">保存</el-button>
|
||||
<!-- <el-button
|
||||
v-if="dataForm.id && !isdetail"
|
||||
type="primary"
|
||||
@click="addNew()">
|
||||
添加属性
|
||||
</el-button> -->
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<product-attr-add
|
||||
v-if="addOrUpdateVisible"
|
||||
ref="addOrUpdate"
|
||||
:warehouse-id="dataForm.id"
|
||||
@refreshDataList="getList" />
|
||||
:warehouse-id="dataForm.warehouseId"
|
||||
@refreshDataList="addList" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
updateProduct,
|
||||
} from '@/api/core/base/product';
|
||||
|
||||
import {
|
||||
getWarehouseStorehouseGoodsSpecificationPage,
|
||||
deleteWarehouseStorehouseGoodsSpecification,
|
||||
} from '@/api/asrs/warehouseStorehouseGoodsSpecification';
|
||||
import { getWarehouseStorehouseGoodsSpecificationPage } from '@/api/asrs/warehouseStorehouseGoodsSpecification';
|
||||
import { updateWarehouseStorehouse } from '@/api/asrs/warehouseStorehouse';
|
||||
import productAttrAdd from './attr-add';
|
||||
import inputArea from '../mixins/inputArea';
|
||||
import selectQuality from '../mixins/selectQuality';
|
||||
import { parseTime } from '../mixins/code-filter';
|
||||
import codeFilter from '../mixins/code-filter';
|
||||
import SmallTitle from './SmallTitle';
|
||||
|
||||
const tableBtn = [
|
||||
{
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
},
|
||||
{
|
||||
type: 'delete',
|
||||
btnName: '删除',
|
||||
@@ -141,30 +129,27 @@ const tableProps = [
|
||||
label: '产品编码',
|
||||
},
|
||||
{
|
||||
prop: 'goodSpecificationName1',
|
||||
prop: 'specification',
|
||||
label: '产品规格',
|
||||
align: 'center',
|
||||
filter: codeFilter('specification'),
|
||||
},
|
||||
{
|
||||
prop: 'number',
|
||||
label: '数量',
|
||||
subcomponent: inputArea,
|
||||
},
|
||||
{
|
||||
prop: 'quality',
|
||||
label: '品质',
|
||||
align: 'center',
|
||||
filter: codeFilter('quality'),
|
||||
subcomponent: selectQuality,
|
||||
},
|
||||
{
|
||||
prop: 'cureTime',
|
||||
label: '需要熟化时间(小时)',
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
|
||||
const tableProps1 = [
|
||||
{
|
||||
prop: 'number',
|
||||
label: '数量',
|
||||
align: 'center',
|
||||
},
|
||||
];
|
||||
const processArr = [
|
||||
{
|
||||
name: '开始',
|
||||
@@ -189,58 +174,35 @@ const processArr = [
|
||||
];
|
||||
export default {
|
||||
components: { productAttrAdd, SmallTitle },
|
||||
props: {
|
||||
propType: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
addOrUpdateVisible: false,
|
||||
tableBtn,
|
||||
tableProps,
|
||||
tableProps1,
|
||||
productAttributeList: [],
|
||||
addButtonShow: '新增',
|
||||
processArr,
|
||||
dataForm: {
|
||||
id: null,
|
||||
name: '',
|
||||
code: '',
|
||||
processId: '',
|
||||
warehouseName: '',
|
||||
warehouseCode: '',
|
||||
process: '',
|
||||
},
|
||||
listQuery: {
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 0,
|
||||
},
|
||||
dataRule: {
|
||||
// name: [
|
||||
// {
|
||||
// required: true,
|
||||
// message: '产品名称不能为空',
|
||||
// trigger: 'blur',
|
||||
// },
|
||||
// ],
|
||||
},
|
||||
isdetail: false,
|
||||
dataRule: {},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
this.productAttributeList.splice(0);
|
||||
},
|
||||
init(val, isdetail) {
|
||||
console.log(val)
|
||||
this.dataForm.name = val.warehouseName
|
||||
this.dataForm.code = val.warehouseCode
|
||||
this.dataForm.processId = val.process
|
||||
let id = val.id
|
||||
init(val) {
|
||||
this.dataForm = val;
|
||||
this.initData();
|
||||
this.isdetail = isdetail || false;
|
||||
this.dataForm.id = id || null;
|
||||
this.visible = true;
|
||||
|
||||
this.$nextTick(() => {
|
||||
@@ -263,9 +225,24 @@ export default {
|
||||
};
|
||||
getWarehouseStorehouseGoodsSpecificationPage(params).then((response) => {
|
||||
this.productAttributeList = response.data.list;
|
||||
this.listQuery.total = response.data.total;
|
||||
});
|
||||
},
|
||||
inputChange(data) {
|
||||
switch (data.sType) {
|
||||
case 1:
|
||||
this.productAttributeList[data._pageIndex - 1][data.prop] =
|
||||
data[data.prop];
|
||||
break;
|
||||
case 2:
|
||||
this.productAttributeList[data._pageIndex - 1][data.prop] =
|
||||
data.string ? data.string.split('+')[0] : '';
|
||||
this.productAttributeList[data._pageIndex - 1][data.prop + 'Name'] =
|
||||
data.string ? data.string.split('+')[1] : '';
|
||||
break;
|
||||
default:
|
||||
console.log(val);
|
||||
}
|
||||
},
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
@@ -282,29 +259,26 @@ export default {
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
deleteWarehouseStorehouseGoodsSpecification(raw.data.id).then(({ data }) => {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getList();
|
||||
},
|
||||
});
|
||||
});
|
||||
this.productAttributeList.splice(raw.data._pageIndex - 1, 1);
|
||||
})
|
||||
.catch(() => {});
|
||||
} else {
|
||||
this.addNew(raw.data.id);
|
||||
this.addNew(raw.data._pageIndex);
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.productAttributeList.forEach((item) => {
|
||||
item.id = '';
|
||||
item.warehouseStorehouseId = this.dataForm.id
|
||||
item.warehouseId = '';
|
||||
});
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.dataForm.list = this.productAttributeList;
|
||||
// 修改的提交
|
||||
if (this.dataForm.id) {
|
||||
updateProduct(this.dataForm).then((response) => {
|
||||
updateWarehouseStorehouse(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
@@ -314,16 +288,16 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
goEdit() {
|
||||
this.isdetail = false;
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
addNew(index) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id);
|
||||
this.$refs.addOrUpdate.init(index);
|
||||
});
|
||||
},
|
||||
addList(data) {
|
||||
this.productAttributeList.push(data.productInfo);
|
||||
},
|
||||
goback() {
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
|
||||
@@ -19,17 +19,18 @@
|
||||
:rules="dataRule"
|
||||
label-width="100px"
|
||||
@keyup.enter.native="dataFormSubmit()">
|
||||
<el-form-item label="产品" prop="productId">
|
||||
<el-form-item label="产品" prop="productInfo">
|
||||
<el-select
|
||||
v-model="dataForm.productId"
|
||||
v-model="dataForm.productInfo"
|
||||
style="width: 100%"
|
||||
@change="setProduct"
|
||||
filterable
|
||||
value-key="id"
|
||||
placeholder="请选择产品">
|
||||
<el-option
|
||||
v-for="item in productArr"
|
||||
:key="item.id"
|
||||
:label="item.goodSpecificationName"
|
||||
:value="item.id" />
|
||||
:value="item" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -42,7 +43,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { createWarehouseStorehouseGoodsSpecification } from '@/api/asrs/warehouseStorehouseGoodsSpecification';
|
||||
import { getGoodSpecificationPage } from '@/api/asrs/goodSpecification';
|
||||
|
||||
export default {
|
||||
@@ -56,52 +56,52 @@ export default {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
productId: '',
|
||||
value: '',
|
||||
index: -1,
|
||||
productInfo: '',
|
||||
},
|
||||
productArr: [],
|
||||
dataRule: {
|
||||
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
|
||||
productId: [
|
||||
{ required: true, message: '产品不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
init(id) {
|
||||
this.dataForm.id = id || '';
|
||||
init(index) {
|
||||
if (index >= 0) {
|
||||
this.dataForm.index = index;
|
||||
}
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
const params = {
|
||||
pageSize: 100,
|
||||
pageNo: 1,
|
||||
warehouseId: this.warehouseId,
|
||||
};
|
||||
getGoodSpecificationPage(params).then((response) => {
|
||||
this.productArr = response.data.list;
|
||||
});
|
||||
});
|
||||
},
|
||||
setProduct(val) {
|
||||
let data = this.productArr.find((item) => {
|
||||
return (item.id === val);
|
||||
});
|
||||
const { id, ...newData } = data;
|
||||
this.dataForm.value = newData;
|
||||
this.dataForm.value.goodSpecificationId = id;
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
// 添加的提交
|
||||
createWarehouseStorehouseGoodsSpecification({
|
||||
...this.dataForm.value,
|
||||
warehouseStorehouseId: this.warehouseId,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('添加成功');
|
||||
this.dataForm.productInfo.goodSpecificationId =
|
||||
this.dataForm.productInfo.id;
|
||||
// 修改的提交
|
||||
if (this.dataForm.index >= 0) {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
this.$emit('refreshDataList', this.dataForm);
|
||||
return;
|
||||
}
|
||||
// 添加的提交
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList', this.dataForm);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@@ -62,7 +62,7 @@
|
||||
v-hasPermi="[
|
||||
'asrs:warehouse-storehouse-goods-specification:update',
|
||||
]">
|
||||
编辑
|
||||
<span class="iconfont icon-edit primary-color"></span>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@@ -62,7 +62,7 @@
|
||||
v-hasPermi="[
|
||||
'asrs:warehouse-storehouse-goods-specification:update',
|
||||
]">
|
||||
编辑
|
||||
<span class="iconfont icon-edit primary-color"></span>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2023-09-22 15:36:40
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2023-09-26 15:59:57
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="tableInner">
|
||||
<el-input v-model="list[itemProp]" @blur="changeInput" />
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "InputArea",
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
itemProp: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: this.injectData,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
changeInput() {
|
||||
this.list.sType = 1
|
||||
this.$emit("emitData", this.list,1);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.tableInner >>> .el-input__inner {
|
||||
color: #409EFF;
|
||||
border: 1px rgb(232, 231, 231) solid;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="tableInner">
|
||||
<el-select v-model="list[itemProp]" @change="changeInput">
|
||||
<el-option
|
||||
v-for="item in QArr"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"></el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'InputArea',
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
itemProp: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
list: this.injectData,
|
||||
QArr: [
|
||||
{
|
||||
name: 'A',
|
||||
id: 0,
|
||||
},
|
||||
{
|
||||
name: 'B',
|
||||
id: 1,
|
||||
},
|
||||
{
|
||||
name: 'C',
|
||||
id: 2,
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
changeInput() {
|
||||
this.list.sType = 1;
|
||||
this.$emit('emitData', this.list);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.tableInner >>> .el-input__inner {
|
||||
color: #409EFF;
|
||||
border: 1px rgb(232, 231, 231) solid;
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
height: 30px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user