|
@@ -1,7 +1,7 @@
|
|
<template>
|
|
<template>
|
|
<div class="productInfoEdit-wrap">
|
|
<div class="productInfoEdit-wrap">
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
<a-spin :spinning="spinning" tip="Loading...">
|
|
- <a-page-header :ghost="false" :backIcon="false" class="productInfoEdit-back">
|
|
|
|
|
|
+ <a-page-header :ghost="false" :backIcon="false" class="productInfoEdit-back" v-if="pageType=='pages'">
|
|
<!-- 自定义的二级文字标题 -->
|
|
<!-- 自定义的二级文字标题 -->
|
|
<template slot="subTitle">
|
|
<template slot="subTitle">
|
|
<a id="productInfoEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
|
|
<a id="productInfoEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
|
|
@@ -21,7 +21,6 @@
|
|
id="productInfoEdit-name"
|
|
id="productInfoEdit-name"
|
|
:maxLength="100"
|
|
:maxLength="100"
|
|
v-model.trim="form.name"
|
|
v-model.trim="form.name"
|
|
- @change="filterEmpty"
|
|
|
|
placeholder="请输入产品名称(最多100个字符)"
|
|
placeholder="请输入产品名称(最多100个字符)"
|
|
ref="name"
|
|
ref="name"
|
|
@keydown.enter.native="nextFocus('name', 'code', $event)"
|
|
@keydown.enter.native="nextFocus('name', 'code', $event)"
|
|
@@ -31,7 +30,7 @@
|
|
<a-input
|
|
<a-input
|
|
id="productInfoEdit-code"
|
|
id="productInfoEdit-code"
|
|
:maxLength="100"
|
|
:maxLength="100"
|
|
- :disabled="!!$route.params.id"
|
|
|
|
|
|
+ :disabled="isEdit"
|
|
v-model.trim="form.code"
|
|
v-model.trim="form.code"
|
|
placeholder="请输入产品编码(最多100个字符)"
|
|
placeholder="请输入产品编码(最多100个字符)"
|
|
ref="code"
|
|
ref="code"
|
|
@@ -42,7 +41,7 @@
|
|
<a-input
|
|
<a-input
|
|
id="productInfoEdit-origCode"
|
|
id="productInfoEdit-origCode"
|
|
:maxLength="200"
|
|
:maxLength="200"
|
|
- :disabled="!!$route.params.id"
|
|
|
|
|
|
+ :disabled="isEdit"
|
|
v-model.trim="form.origCode"
|
|
v-model.trim="form.origCode"
|
|
placeholder="请输入原厂编码(最多200个字符,多个编码用逗号隔开)"
|
|
placeholder="请输入原厂编码(最多200个字符,多个编码用逗号隔开)"
|
|
ref="origCode"
|
|
ref="origCode"
|
|
@@ -75,7 +74,7 @@
|
|
id="productInfoEdit-productBrand"
|
|
id="productInfoEdit-productBrand"
|
|
v-model="form.productBrandSn"
|
|
v-model="form.productBrandSn"
|
|
placeholder="请输入名称或拼音查询,如果没有请点击 '+' 新增"
|
|
placeholder="请输入名称或拼音查询,如果没有请点击 '+' 新增"
|
|
- :disabled="!!$route.params.id"
|
|
|
|
|
|
+ :disabled="isEdit"
|
|
:filter-option="false"
|
|
:filter-option="false"
|
|
:not-found-content="fetching ? undefined : null"
|
|
:not-found-content="fetching ? undefined : null"
|
|
@search="fetchUser"
|
|
@search="fetchUser"
|
|
@@ -89,7 +88,7 @@
|
|
<a-button
|
|
<a-button
|
|
v-if="$hasPermissions('B_product_dealerProductBrand_add')"
|
|
v-if="$hasPermissions('B_product_dealerProductBrand_add')"
|
|
@click="openModal=true"
|
|
@click="openModal=true"
|
|
- :disabled="!!$route.params.id"
|
|
|
|
|
|
+ :disabled="isEdit"
|
|
icon="plus"
|
|
icon="plus"
|
|
size="small"
|
|
size="small"
|
|
id="productInfoEdit-add-btn"
|
|
id="productInfoEdit-add-btn"
|
|
@@ -97,7 +96,7 @@
|
|
</a-form-model-item>
|
|
</a-form-model-item>
|
|
<a-form-model-item label="产品分类" prop="productType">
|
|
<a-form-model-item label="产品分类" prop="productType">
|
|
<a-cascader
|
|
<a-cascader
|
|
- :disabled="!!$route.params.id"
|
|
|
|
|
|
+ :disabled="isEdit"
|
|
@change="changeProductType"
|
|
@change="changeProductType"
|
|
expand-trigger="hover"
|
|
expand-trigger="hover"
|
|
:options="productTypeList"
|
|
:options="productTypeList"
|
|
@@ -170,6 +169,17 @@ export default {
|
|
name: 'ProductInfoEdit',
|
|
name: 'ProductInfoEdit',
|
|
components: { STable, VSelect, productBrandEditModal },
|
|
components: { STable, VSelect, productBrandEditModal },
|
|
mixins: [commonMixin],
|
|
mixins: [commonMixin],
|
|
|
|
+ props: {
|
|
|
|
+ pageType: { // 页面表现形式,pages 新页签打开的页面,modal 弹框里的页面
|
|
|
|
+ type: String,
|
|
|
|
+ default: 'pages'
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ isEdit () {
|
|
|
|
+ return this.pageType == 'pages' ? !!this.$route.params.id : false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
spinning: false,
|
|
spinning: false,
|
|
@@ -256,21 +266,28 @@ export default {
|
|
handleSubmit (e) {
|
|
handleSubmit (e) {
|
|
e.preventDefault()
|
|
e.preventDefault()
|
|
const _this = this
|
|
const _this = this
|
|
- if (!this.form.productTypeSn3) {
|
|
|
|
- this.$message.warning('产品分类未选到第三级,请修改后再提交!')
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
this.$refs.ruleForm.validate(valid => {
|
|
this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
const form = JSON.parse(JSON.stringify(_this.form))
|
|
const form = JSON.parse(JSON.stringify(_this.form))
|
|
- form.id = _this.$route.params.id ? _this.$route.params.id : undefined
|
|
|
|
|
|
+ if (!form.productTypeSn3) {
|
|
|
|
+ this.$message.warning('产品分类未选到第三级,请修改后再提交!')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ // 编辑
|
|
|
|
+ if (this.isEdit) {
|
|
|
|
+ form.id = _this.$route.params.id ? _this.$route.params.id : undefined
|
|
|
|
+ }
|
|
delete form.productType
|
|
delete form.productType
|
|
_this.spinning = true
|
|
_this.spinning = true
|
|
dealerProductSave(form).then(res => {
|
|
dealerProductSave(form).then(res => {
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
_this.$message.success(res.message)
|
|
_this.$message.success(res.message)
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
- _this.$router.push({ path: '/productManagement/productInfo/list' })
|
|
|
|
|
|
+ if (_this.pageType == 'pages') {
|
|
|
|
+ _this.$router.push({ path: '/productManagement/productInfo/list' })
|
|
|
|
+ } else {
|
|
|
|
+ _this.$emit('saveOk', form)
|
|
|
|
+ }
|
|
_this.spinning = false
|
|
_this.spinning = false
|
|
}, 1000)
|
|
}, 1000)
|
|
} else {
|
|
} else {
|