|
@@ -16,12 +16,6 @@
|
|
|
:label-col="formItemLayout.labelCol"
|
|
|
:wrapper-col="formItemLayout.wrapperCol"
|
|
|
>
|
|
|
- <a-form-model-item label="供应商" v-if="pageType=='modal'">
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- v-model.trim="formData.supplierName"
|
|
|
- />
|
|
|
- </a-form-model-item>
|
|
|
<a-form-model-item label="产品名称" prop="name">
|
|
|
<a-input
|
|
|
id="productInfoEdit-name"
|
|
@@ -178,6 +172,9 @@
|
|
|
ref="putQty"
|
|
|
allowClear />
|
|
|
</a-form-model-item>
|
|
|
+ <a-form-model-item label="仓库仓位" v-if="pageType=='modal'" prop="warehouse">
|
|
|
+ <Warehouse id="productInfoEdit-warehouse" ref="warehouse" @change="warehouseChange" v-model="form.warehouse"></Warehouse>
|
|
|
+ </a-form-model-item>
|
|
|
<a-form-model-item :wrapper-col="{ span: 12, offset: 6 }" style="text-align: center;">
|
|
|
<a-button
|
|
|
type="primary"
|
|
@@ -185,7 +182,14 @@
|
|
|
@click="handleSubmit"
|
|
|
size="large"
|
|
|
id="productInfoEdit-btn-submit"
|
|
|
- style="padding: 0 60px;">保存</a-button>
|
|
|
+ style="padding: 0 50px;">保存</a-button>
|
|
|
+ <a-button
|
|
|
+ type="default"
|
|
|
+ :loading="saveing"
|
|
|
+ @click="handleBack"
|
|
|
+ size="large"
|
|
|
+ id="productInfoEdit-btn-cansel"
|
|
|
+ style="padding: 0 50px;margin-left: 30px;">取消</a-button>
|
|
|
</a-form-model-item>
|
|
|
</a-form-model>
|
|
|
<!-- 新增/编辑产品品牌 -->
|
|
@@ -199,12 +203,13 @@
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import productBrandEditModal from '../productBrand/editModal.vue'
|
|
|
+import Warehouse from '@/views/common/warehouse.js'
|
|
|
import { dealerProductBrandQuery } from '@/api/dealerProductBrand'
|
|
|
import { dealerProductTypeList } from '@/api/dealerProductType'
|
|
|
import { dealerProductSave, dealerProductDetail } from '@/api/dealerProduct'
|
|
|
export default {
|
|
|
name: 'ProductInfoEdit',
|
|
|
- components: { STable, VSelect, productBrandEditModal },
|
|
|
+ components: { STable, VSelect, productBrandEditModal, Warehouse },
|
|
|
mixins: [commonMixin],
|
|
|
props: {
|
|
|
pageType: { // 页面表现形式,pages 新页签打开的页面,modal 弹框里的页面
|
|
@@ -227,6 +232,11 @@ export default {
|
|
|
return this.pageType == 'pages' ? !!this.$route.params.id : false
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ paramsData (newValue, oldValue) {
|
|
|
+ this.formData = newValue
|
|
|
+ }
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
spinning: false,
|
|
@@ -247,7 +257,8 @@ export default {
|
|
|
terminalPrice: '', // 终端价
|
|
|
carOwnersPrice: '', // 车主价
|
|
|
putCost: '',
|
|
|
- putQty: ''
|
|
|
+ putQty: '',
|
|
|
+ warehouse: []
|
|
|
},
|
|
|
rules: {
|
|
|
name: [
|
|
@@ -267,6 +278,9 @@ export default {
|
|
|
],
|
|
|
putQty: [
|
|
|
{ required: true, type: 'number', message: '请输入数量', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ warehouse: [
|
|
|
+ { required: true, message: '请选择仓库仓位', trigger: 'blur' }
|
|
|
]
|
|
|
},
|
|
|
fetching: false,
|
|
@@ -276,6 +290,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ warehouseChange () {
|
|
|
+ this.$refs.ruleForm.clearValidate('warehouse')
|
|
|
+ },
|
|
|
// 搜索品牌
|
|
|
fetchUser (value) {
|
|
|
console.log('fetching user', value)
|
|
@@ -386,7 +403,11 @@ export default {
|
|
|
},
|
|
|
// 返回
|
|
|
handleBack () {
|
|
|
- this.$router.push({ path: '/productManagement/productInfo/list' })
|
|
|
+ if (this.pageType == 'pages') {
|
|
|
+ this.$router.push({ path: '/productManagement/productInfo/list' })
|
|
|
+ } else {
|
|
|
+ this.$emit('cansel')
|
|
|
+ }
|
|
|
},
|
|
|
// 产品品牌 列表
|
|
|
getProductBrand (val) {
|
|
@@ -426,6 +447,9 @@ export default {
|
|
|
// 如果是其它页面新建产品
|
|
|
if (this.pageType == 'modal') {
|
|
|
this.form = Object.assign(this.form, this.formData)
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.warehouse.setDefaultVal()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
},
|