|
|
|
|
@ -8,7 +8,7 @@
|
|
|
|
|
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>仓库类型:
|
|
|
|
|
</div>
|
|
|
|
|
<div class="xy-table-item-content">
|
|
|
|
|
<Select v-model="form.type_id" style="width:500px;" placeholder="请选择仓库类型">
|
|
|
|
|
<Select v-model="form.type_id" style="width:500px;" placeholder="请选择仓库类型" @on-change="handleTypeChange">
|
|
|
|
|
<Option v-for="item in typeList" :key="item.id" :value="item.id">{{ item.name }}</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</div>
|
|
|
|
|
@ -20,8 +20,8 @@
|
|
|
|
|
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>仓库名称:
|
|
|
|
|
</div>
|
|
|
|
|
<div class="xy-table-item-content">
|
|
|
|
|
<Select v-model="form.warehouse_id" style="width:500px;" placeholder="请选择仓库名称">
|
|
|
|
|
<Option v-for="item in warehouseList" :key="item.id" :value="item.id">{{ item.name }}</Option>
|
|
|
|
|
<Select v-model="form.warehouse_id" style="width:500px;" placeholder="请选择仓库名称" :loading="loading">
|
|
|
|
|
<Option v-for="item in warehouseList" :key="item.id" :value="item.id">{{ item.cangkumingcheng }}</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@ -32,17 +32,7 @@
|
|
|
|
|
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>库房名称:
|
|
|
|
|
</div>
|
|
|
|
|
<div class="xy-table-item-content">
|
|
|
|
|
<el-input style="width:500px; font-size:18px;" v-model="form.name" placeholder="请输入库房名称"></el-input>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:beizhu>
|
|
|
|
|
<div class="xy-table-item type-dialog-item">
|
|
|
|
|
<div class="xy-table-item-label">
|
|
|
|
|
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>备注:
|
|
|
|
|
</div>
|
|
|
|
|
<div class="xy-table-item-content">
|
|
|
|
|
<el-input style="width:500px; font-size:18px;" v-model="form.beizhu" placeholder="请输入备注"></el-input>
|
|
|
|
|
<Input v-model="form.name" style="width:500px;" placeholder="请输入库房名称" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
@ -53,6 +43,7 @@
|
|
|
|
|
<script>
|
|
|
|
|
import { saveWarehouseType } from '@/api/system/warehouse'
|
|
|
|
|
import { getStorehouseTypeList } from '@/api/system/storehouseType'
|
|
|
|
|
import { index } from '@/api/system/baseForm'
|
|
|
|
|
import { Message } from 'element-ui'
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
@ -67,11 +58,12 @@ export default {
|
|
|
|
|
type: 'add',
|
|
|
|
|
id: '',
|
|
|
|
|
typeList: [],
|
|
|
|
|
warehouseList: [],
|
|
|
|
|
loading: false,
|
|
|
|
|
form: {
|
|
|
|
|
type_id: '',
|
|
|
|
|
warehouse_id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
beizhu: ''
|
|
|
|
|
name: ''
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
type_id: [{ required: true, message: '请选择仓库类型' }],
|
|
|
|
|
@ -95,6 +87,29 @@ export default {
|
|
|
|
|
Message.error('获取仓库类型列表失败');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async getWarehouseListByType(typeId) {
|
|
|
|
|
try {
|
|
|
|
|
this.loading = true;
|
|
|
|
|
const res = await index({
|
|
|
|
|
table_name: 'materialstorages',
|
|
|
|
|
filter: [{
|
|
|
|
|
key: 'storehouses_id',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: typeId
|
|
|
|
|
}]
|
|
|
|
|
});
|
|
|
|
|
this.warehouseList = res.data;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
Message.error('获取仓库列表失败');
|
|
|
|
|
} finally {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleTypeChange(typeId) {
|
|
|
|
|
this.form.type_id = typeId;
|
|
|
|
|
this.form.warehouse_id = ''; // 清空仓库名称选择
|
|
|
|
|
this.getWarehouseListByType(typeId);
|
|
|
|
|
},
|
|
|
|
|
open(type = 'add', row = null) {
|
|
|
|
|
this.type = type;
|
|
|
|
|
this.isShow = true;
|
|
|
|
|
@ -105,28 +120,27 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
if (type === 'editor' && row) {
|
|
|
|
|
this.id = row.id;
|
|
|
|
|
Object.assign(this.form, {
|
|
|
|
|
type_id: row.type_id || '',
|
|
|
|
|
warehouse_id: row.warehouse_id || '',
|
|
|
|
|
name: row.name || '',
|
|
|
|
|
beizhu: row.remark || ''
|
|
|
|
|
});
|
|
|
|
|
// 设置仓库类型和仓库名称
|
|
|
|
|
this.form.type_id = row.materialstorages.storehouse.id;
|
|
|
|
|
this.form.warehouse_id = row.materialstorages.id;
|
|
|
|
|
this.form.name = row.name || '';
|
|
|
|
|
|
|
|
|
|
// 根据已有的type_id获取对应的仓库列表
|
|
|
|
|
this.getWarehouseListByType(row.materialstorages.storehouse.id);
|
|
|
|
|
} else {
|
|
|
|
|
this.id = '';
|
|
|
|
|
Object.assign(this.form, {
|
|
|
|
|
type_id: '',
|
|
|
|
|
warehouse_id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
beizhu: ''
|
|
|
|
|
name: ''
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
submit() {
|
|
|
|
|
const params = {
|
|
|
|
|
type_id: this.form.type_id,
|
|
|
|
|
warehouse_id: this.form.warehouse_id,
|
|
|
|
|
name: this.form.name,
|
|
|
|
|
remark: this.form.beizhu
|
|
|
|
|
materialstorages_id: this.form.warehouse_id,
|
|
|
|
|
name: this.form.name
|
|
|
|
|
};
|
|
|
|
|
if (this.type === 'editor') {
|
|
|
|
|
params.id = this.id;
|
|
|
|
|
@ -146,17 +160,22 @@ export default {
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
::v-deep .xy-table-item-label {
|
|
|
|
|
min-width: 120px !important;
|
|
|
|
|
min-width: 140px !important;
|
|
|
|
|
width: 140px !important;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
text-align: right;
|
|
|
|
|
padding-right: 20px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
|
|
|
|
.type-dialog-item {
|
|
|
|
|
margin-bottom: 28px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
}
|
|
|
|
|
.xy-table-item-content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
@ -168,4 +187,21 @@ export default {
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
padding: 8px 24px;
|
|
|
|
|
}
|
|
|
|
|
::v-deep .ivu-select,
|
|
|
|
|
::v-deep .ivu-input-wrapper {
|
|
|
|
|
width: 500px;
|
|
|
|
|
}
|
|
|
|
|
::v-deep .xy-dialog-form-item {
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
::v-deep .xy-dialog-form-item .ivu-form-item-error-tip {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
transform: translateY(-50%);
|
|
|
|
|
left: 510px;
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
line-height: 1;
|
|
|
|
|
padding-top: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|