|
@@ -4,7 +4,7 @@
|
|
|
class="allocateBill-basicInfo-modal"
|
|
|
:footer="null"
|
|
|
:maskClosable="false"
|
|
|
- title="新增"
|
|
|
+ :title="isEdit?'编辑':'新增'"
|
|
|
v-model="isShow"
|
|
|
@cancel="isShow = false"
|
|
|
:width="800">
|
|
@@ -18,14 +18,14 @@
|
|
|
:wrapper-col="formItemLayout.wrapperCol"
|
|
|
>
|
|
|
<a-row :gutter="15">
|
|
|
- <a-col :md="12" :sm="24">
|
|
|
+ <a-col :md="12" :sm="24" v-if="!isEdit">
|
|
|
<a-form-model-item label="调往对象" prop="targetType">
|
|
|
<a-radio-group v-model="form.targetType" @change="targetTypeChange">
|
|
|
<a-radio v-for="(item,index) in targetTypeList" :key="index" :value="item.code">{{ item.dispName }}</a-radio>
|
|
|
</a-radio-group>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="12" :sm="24">
|
|
|
+ <a-col :md="12" :sm="24" v-if="!isEdit">
|
|
|
<a-form-model-item label="调往对象名称" :prop="isDealer ? 'targetSn' : 'targetName'">
|
|
|
<a-select
|
|
|
v-if="isDealer"
|
|
@@ -45,22 +45,20 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :md="12" :sm="24">
|
|
|
- <a-form-model-item label="费用类型" prop="costTypeSn">
|
|
|
- <a-select id="allocateBill-basicInfo-costTypeSn" v-model="form.costTypeSn" placeholder="请选择费用类型" allowClear >
|
|
|
- <a-select-option v-for="item in allocateTypeList" :key="item.costTypeSn" :value="item.costTypeSn">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-model-item>
|
|
|
- </a-col>
|
|
|
- <a-col :md="12" :sm="24">
|
|
|
- <a-form-model-item label="调拨类型" prop="allocateTypeSn">
|
|
|
- <a-select id="allocateBill-basicInfo-allocateTypeSn" v-model="form.allocateTypeSn" placeholder="请选择调拨类型" allowClear >
|
|
|
- <a-select-option v-for="item in allocateTypeList" :key="item.allocateTypeSn" :value="item.allocateTypeSn">{{ item.name }}</a-select-option>
|
|
|
- </a-select>
|
|
|
+ <a-form-model-item label="费用/调拨类型" prop="costTypeSn">
|
|
|
+ <a-cascader
|
|
|
+ id="allocateBill-basicInfo-allocateTypeSn"
|
|
|
+ v-model="allocateTypeVal"
|
|
|
+ @change="allocateTypeChange"
|
|
|
+ :options="allocateTypeList"
|
|
|
+ expand-trigger="hover"
|
|
|
+ placeholder="请选择费用/调拨类型"
|
|
|
+ :fieldNames="{ label: 'name', value: 'sn', children: 'sonList' }"/>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :md="12" :sm="24">
|
|
|
<a-form-model-item label="费用归属品牌">
|
|
|
- <ProductBrand id="allocateBill-basicInfo-productBrandSn" v-model="form.productBrandSn" placeholder="请选择费用归属品牌"></ProductBrand>
|
|
|
+ <ProductBrand id="allocateBill-basicInfo-productBrandSn" @change="changeBrand" v-model="form.productBrandSn" placeholder="请选择费用归属品牌"></ProductBrand>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :md="12" :sm="24">
|
|
@@ -80,8 +78,8 @@
|
|
|
:placeholder="['开始时间', '结束时间']" />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
- <a-col :md="12" :sm="24">
|
|
|
- <a-form-model-item label="备注" prop="remark">
|
|
|
+ <a-col :md="24" :sm="24">
|
|
|
+ <a-form-model-item label="备注" prop="remark" :wrapperCol="{ span: 20 }" :labelCol="{ span: 4 }">
|
|
|
<a-textarea id="allocateBill-basicInfo-remark" :maxLength="120" v-model="form.remark" placeholder="请输入备注(最多120个字符)" allowClear />
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
@@ -97,13 +95,12 @@
|
|
|
|
|
|
<script>
|
|
|
import { commonMixin } from '@/utils/mixin'
|
|
|
-import moment from 'moment'
|
|
|
import debounce from 'lodash/debounce'
|
|
|
import { VSelect } from '@/components'
|
|
|
import { allocateBillSave } from '@/api/allocateBill'
|
|
|
import { dealerSubareaScopeList } from '@/api/dealer'
|
|
|
import { getLookUpData } from '@/api/data'
|
|
|
-import { allocateTypeAllList } from '@/api/allocateType'
|
|
|
+import { allocateTypeTreeList } from '@/api/allocateType'
|
|
|
import ProductBrand from '@/views/common/productBrand.js'
|
|
|
import productTypeAll from '@/views/common/productTypeAll.js'
|
|
|
export default {
|
|
@@ -115,7 +112,8 @@ export default {
|
|
|
// 弹框显示状态
|
|
|
type: Boolean,
|
|
|
default: false
|
|
|
- }
|
|
|
+ },
|
|
|
+ detailData: Object
|
|
|
},
|
|
|
data () {
|
|
|
this.fetchUser = debounce(this.fetchUser, 800)
|
|
@@ -123,16 +121,17 @@ export default {
|
|
|
isShow: this.openModal, // 是否打开弹框
|
|
|
spinning: false,
|
|
|
formItemLayout: {
|
|
|
- labelCol: { span: 6 },
|
|
|
- wrapperCol: { span: 18 }
|
|
|
+ labelCol: { span: 8 },
|
|
|
+ wrapperCol: { span: 16 }
|
|
|
},
|
|
|
productType: [],
|
|
|
form: {
|
|
|
targetType: 'DEALER',
|
|
|
targetSn: undefined,
|
|
|
targetName: '',
|
|
|
- costTypeSn: undefined,
|
|
|
- allocateTypeSn: undefined,
|
|
|
+ costTypeSn: '',
|
|
|
+ allocateTypeSn: '',
|
|
|
+ allocateSortSn: '',
|
|
|
productBrandSn: undefined, // 产品品牌
|
|
|
productTypeSn1: '', // 产品一级分类
|
|
|
productTypeSn2: '', // 产品二级分类
|
|
@@ -145,16 +144,17 @@ export default {
|
|
|
rules: {
|
|
|
targetType: [{ required: true, message: '请选择调往对象', trigger: 'change' }],
|
|
|
targetSn: [{ required: true, message: '请选择调往对象名称', trigger: 'change' }],
|
|
|
- costTypeSn: [{ required: true, message: '请选择费用类型', trigger: 'change' }],
|
|
|
- targetName: [{ required: true, message: '请输入调往对象名称', trigger: 'blur' }],
|
|
|
- allocateTypeSn: [{ required: true, message: '请选择调拨类型', trigger: 'change' }]
|
|
|
+ costTypeSn: [{ required: true, message: '请选择费用/调拨类型', trigger: 'change' }],
|
|
|
+ targetName: [{ required: true, message: '请输入调往对象名称', trigger: 'blur' }]
|
|
|
},
|
|
|
fetching: false,
|
|
|
dealerData: [], // 经销商 下拉数据
|
|
|
targetTypeList: [], // 调往对象类型
|
|
|
+ allocateTypeVal: [],
|
|
|
allocateTypeList: [], // 调拨类型
|
|
|
dateFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
- selectPriceDate: ''
|
|
|
+ selectPriceDate: '',
|
|
|
+ isEdit: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -164,18 +164,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- // 不可选日期
|
|
|
- disabledDate (current) {
|
|
|
- // 可选今天以后的时间(包含今天),所选时间跨度最多可为一年
|
|
|
- const minYearVs = moment().subtract(1, 'day') // 今天以后,包含今天
|
|
|
- // // 限制最多只能查一年区间的数据
|
|
|
- if (this.selectPriceDate) {
|
|
|
- const maxYearVs = moment(this.selectPriceDate, 'YYYY-MM-DD HH:mm:ss').add(1, 'years') // 当前选中开始日期后推一年
|
|
|
- return current && current < minYearVs || current && current > maxYearVs
|
|
|
- } else {
|
|
|
- return current && current < minYearVs
|
|
|
- }
|
|
|
- },
|
|
|
// 日期 change
|
|
|
dateChange (date, dateStrings) {
|
|
|
this.selectPriceDate = ''
|
|
@@ -186,11 +174,33 @@ export default {
|
|
|
dateCalendarChange (date, dateStrings) {
|
|
|
this.selectPriceDate = date[0]
|
|
|
},
|
|
|
+ // 调拨类别 change
|
|
|
+ allocateTypeChange (val, opt) {
|
|
|
+ console.log(val, opt, '------------')
|
|
|
+ this.allocateTypeVal = val
|
|
|
+ this.form.costTypeSn = val[0] ? val[0] : ''
|
|
|
+ this.form.allocateTypeSn = val[1] ? val[1] : ''
|
|
|
+ this.form.allocateSortSn = val[2] ? val[2] : ''
|
|
|
+ // 名称
|
|
|
+ this.form.costTypeName = opt[0] ? opt[0].name : ''
|
|
|
+ this.form.allocateTypeName = opt[1] ? opt[1].name : ''
|
|
|
+ this.form.allocateSortName = opt[2] ? opt[2].name : ''
|
|
|
+ },
|
|
|
// 产品分类 change
|
|
|
- changeProductType (val, opt) {
|
|
|
- this.queryParam.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
- this.queryParam.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
- this.queryParam.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
+ changeProductType (val, id, opt) {
|
|
|
+ console.log(val, opt, '------------')
|
|
|
+ this.form.productTypeSn1 = val[0] ? val[0] : ''
|
|
|
+ this.form.productTypeSn2 = val[1] ? val[1] : ''
|
|
|
+ this.form.productTypeSn3 = val[2] ? val[2] : ''
|
|
|
+ // 名称
|
|
|
+ this.form.productTypeName1 = opt[0] ? opt[0].productTypeName : ''
|
|
|
+ this.form.productTypeName2 = opt[1] ? opt[1].productTypeName : ''
|
|
|
+ this.form.productTypeName3 = opt[2] ? opt[2].productTypeName : ''
|
|
|
+ },
|
|
|
+ // 品牌
|
|
|
+ changeBrand (val, id, opt) {
|
|
|
+ console.log(val, opt, '------------')
|
|
|
+ this.form.productBrandName = opt.brandName
|
|
|
},
|
|
|
// 搜索经销商
|
|
|
fetchUser (value) {
|
|
@@ -255,9 +265,9 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- // 调拨类型
|
|
|
+ // 获取调拨类型
|
|
|
getAllocateTypeAllList () {
|
|
|
- allocateTypeAllList().then(res => {
|
|
|
+ allocateTypeTreeList({}).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.allocateTypeList = res.data
|
|
|
} else {
|
|
@@ -276,12 +286,16 @@ export default {
|
|
|
if (!newValue) {
|
|
|
this.$emit('close')
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
+ this.allocateTypeList = []
|
|
|
+ this.allocateTypeVal = []
|
|
|
+ this.productType = []
|
|
|
this.form = {
|
|
|
targetType: 'DEALER',
|
|
|
targetSn: undefined,
|
|
|
- costTypeSn: undefined,
|
|
|
targetName: '',
|
|
|
- allocateTypeSn: undefined,
|
|
|
+ costTypeSn: '',
|
|
|
+ allocateTypeSn: '',
|
|
|
+ allocateSortSn: '',
|
|
|
productBrandSn: undefined, // 产品品牌
|
|
|
productTypeSn1: '', // 产品一级分类
|
|
|
productTypeSn2: '', // 产品二级分类
|
|
@@ -294,6 +308,13 @@ export default {
|
|
|
} else {
|
|
|
this.getTargetTypeList()
|
|
|
this.getAllocateTypeAllList()
|
|
|
+ // 编辑
|
|
|
+ if (this.detailData) {
|
|
|
+ this.isEdit = true
|
|
|
+ this.form = Object.assign(this.form, this.detailData)
|
|
|
+ this.allocateTypeVal = [this.detailData.costTypeSn, this.detailData.allocateTypeSn, this.detailData.allocateSortSn]
|
|
|
+ this.productType = [this.detailData.productTypeSn1, this.detailData.productTypeSn2, this.detailData.productTypeSn3]
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|