更新
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<el-drawer
|
||||
:visible.sync="visible"
|
||||
:show-close="false"
|
||||
:destroy-on-close="true"
|
||||
:wrapper-closable="false"
|
||||
class="drawer"
|
||||
size="60%">
|
||||
@@ -22,7 +23,6 @@
|
||||
<el-input
|
||||
v-model="dataForm.code"
|
||||
readonly
|
||||
:disabled="isdetail"
|
||||
placeholder="请输入仓库编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -31,7 +31,6 @@
|
||||
<el-input
|
||||
v-model="dataForm.name"
|
||||
readonly
|
||||
:disabled="isdetail"
|
||||
placeholder="请输入仓库名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -42,7 +41,6 @@
|
||||
<el-select
|
||||
v-model="dataForm.processId"
|
||||
style="width: 100%"
|
||||
:disabled="isdetail"
|
||||
placeholder="请选择工序">
|
||||
<el-option
|
||||
v-for="item in processArr"
|
||||
@@ -59,20 +57,22 @@
|
||||
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
|
||||
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,25 +85,16 @@
|
||||
|
||||
<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>
|
||||
|
||||
@@ -117,15 +108,13 @@ import {
|
||||
deleteWarehouseStorehouseGoodsSpecification,
|
||||
} from '@/api/asrs/warehouseStorehouseGoodsSpecification';
|
||||
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,35 +130,27 @@ const tableProps = [
|
||||
label: '产品编码',
|
||||
},
|
||||
{
|
||||
prop: 'goodSpecificationName1',
|
||||
prop: 'specification',
|
||||
label: '产品规格',
|
||||
align: 'center',
|
||||
filter: codeFilter('specification'),
|
||||
},
|
||||
{
|
||||
prop: 'number',
|
||||
label: '数量',
|
||||
align: 'center',
|
||||
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: '开始',
|
||||
@@ -194,19 +175,12 @@ 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,
|
||||
@@ -230,21 +204,15 @@ export default {
|
||||
// },
|
||||
// ],
|
||||
},
|
||||
isdetail: false,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
this.productAttributeList.splice(0);
|
||||
},
|
||||
init(val, isdetail) {
|
||||
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(() => {
|
||||
@@ -270,6 +238,22 @@ export default {
|
||||
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(
|
||||
@@ -286,27 +270,24 @@ 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) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
@@ -318,16 +299,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,9 +56,8 @@ export default {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: 0,
|
||||
productId: '',
|
||||
value: '',
|
||||
index: -1,
|
||||
productInfo: '',
|
||||
},
|
||||
productArr: [],
|
||||
dataRule: {
|
||||
@@ -67,41 +66,39 @@ export default {
|
||||
};
|
||||
},
|
||||
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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
ref="dataList">
|
||||
<el-table-column type="expand">
|
||||
<template slot-scope="scope">
|
||||
<product :warehouse-id="scope.row.id" :prop-type="2"></product>
|
||||
<product :warehouse-id="scope.row.id"></product>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="warehouseName" label="仓库名"></el-table-column>
|
||||
@@ -55,7 +55,7 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@@ -67,7 +67,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
v-else-if="scope.row.warehouseStorehouseState === 1"
|
||||
v-if="scope.row.warehouseStorehouseState === 2"
|
||||
type="text"
|
||||
@click="handleClick({ data: scope.row, type: 'out' })"
|
||||
v-hasPermi="['asrs:warehouse-storehouse-storage:update']">
|
||||
@@ -75,7 +75,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
v-else-if="scope.row.warehouseStorehouseState === 2"
|
||||
v-if="scope.row.warehouseStorehouseState === 2"
|
||||
type="text"
|
||||
@click="handleClick({ data: scope.row, type: 'move' })"
|
||||
v-hasPermi="['asrs:warehouse-storehouse-storage:update']">
|
||||
@@ -211,23 +211,6 @@ export default {
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '重置',
|
||||
name: 'reset',
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:factory:create') ? 'separate' : '',
|
||||
// },
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
|
||||
// btnName: '导出',
|
||||
// name: 'export',
|
||||
// color: 'warning',
|
||||
// },
|
||||
],
|
||||
};
|
||||
},
|
||||
@@ -255,6 +238,7 @@ export default {
|
||||
case 'reset':
|
||||
this.$refs.searchBarForm.resetForm();
|
||||
this.listQuery = {
|
||||
warehouseId:'1696803324030865409',
|
||||
pageSize: 10,
|
||||
pageNo: 1,
|
||||
total: 1,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
ref="dataList">
|
||||
<el-table-column type="expand">
|
||||
<template slot-scope="scope">
|
||||
<product :warehouse-id="scope.row.id" :prop-type="2"></product>
|
||||
<product :warehouse-id="scope.row.id"></product>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="warehouseName" label="仓库名"></el-table-column>
|
||||
@@ -55,7 +55,7 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center">
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
@@ -67,7 +67,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
v-else-if="scope.row.warehouseStorehouseState === 1"
|
||||
v-if="scope.row.warehouseStorehouseState === 2"
|
||||
type="text"
|
||||
@click="handleClick({ data: scope.row, type: 'out' })"
|
||||
v-hasPermi="['asrs:warehouse-storehouse-storage:update']">
|
||||
@@ -75,7 +75,7 @@
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
v-else-if="scope.row.warehouseStorehouseState === 2"
|
||||
v-if="scope.row.warehouseStorehouseState === 2"
|
||||
type="text"
|
||||
@click="handleClick({ data: scope.row, type: 'move' })"
|
||||
v-hasPermi="['asrs:warehouse-storehouse-storage:update']">
|
||||
@@ -212,23 +212,6 @@ export default {
|
||||
name: 'search',
|
||||
color: 'primary',
|
||||
},
|
||||
{
|
||||
type: 'separate',
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '重置',
|
||||
name: 'reset',
|
||||
},
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:factory:create') ? 'separate' : '',
|
||||
// },
|
||||
// {
|
||||
// type: this.$auth.hasPermi('base:factory:export') ? 'button' : '',
|
||||
// btnName: '导出',
|
||||
// name: 'export',
|
||||
// color: 'warning',
|
||||
// },
|
||||
],
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user