|
@@ -11,7 +11,7 @@
|
|
|
<el-input v-model="form.phonenumber"></el-input>
|
|
<el-input v-model="form.phonenumber"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="负责地区" prop="dutyArea">
|
|
<el-form-item label="负责地区" prop="dutyArea">
|
|
|
- <el-select v-model="form.dutyArea" placeholder="请选择负责地区" style="width: 200px;" filterable>
|
|
|
|
|
|
|
+ <el-select v-model="form.dutyArea" placeholder="请选择负责地区" style="width: 200px;" filterable @change="changeDuty">
|
|
|
<el-option v-for="(item,index) in dutyAreaOptions" :key="index" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
|
<el-option v-for="(item,index) in dutyAreaOptions" :key="index" :label="item.dictLabel" :value="item.dictValue"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -26,7 +26,7 @@
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="区" prop="districtId" v-if="form.dutyArea == '3'">
|
|
<el-form-item label="区" prop="districtId" v-if="form.dutyArea == '3'">
|
|
|
- <el-select v-model="form.districtId" placeholder="请选择区" filterable style="width: 200px;">
|
|
|
|
|
|
|
+ <el-select v-model="form.districtId" placeholder="请选择区" filterable style="width: 200px;" @change="changeDistrict">
|
|
|
<el-option v-for="(item, index) in districtDataList" :key="index" :label="item.name" :value="item.id"></el-option>
|
|
<el-option v-for="(item, index) in districtDataList" :key="index" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -45,7 +45,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- import {addTaxUserApi,getTaxInfoByIdApi} from "@/api/admin/tax/tax"
|
|
|
|
|
|
|
+ import {addTaxUserApi,getTaxInfoByIdApi,updateTaxInfoApi} from "@/api/admin/tax/tax"
|
|
|
import {getProvinceDataApi,getRegionChildrenApi} from "@/api/common/common"
|
|
import {getProvinceDataApi,getRegionChildrenApi} from "@/api/common/common"
|
|
|
import {dutyAreaOptions} from '@/utils/dataFormat'
|
|
import {dutyAreaOptions} from '@/utils/dataFormat'
|
|
|
export default {
|
|
export default {
|
|
@@ -62,7 +62,9 @@
|
|
|
cityName: '',
|
|
cityName: '',
|
|
|
districtName: '',
|
|
districtName: '',
|
|
|
dutyAreaOptions: dutyAreaOptions,
|
|
dutyAreaOptions: dutyAreaOptions,
|
|
|
|
|
+ id: undefined,
|
|
|
form: {
|
|
form: {
|
|
|
|
|
+ id: ''
|
|
|
},
|
|
},
|
|
|
rules: {
|
|
rules: {
|
|
|
checkStatus: [
|
|
checkStatus: [
|
|
@@ -77,23 +79,67 @@
|
|
|
methods: {
|
|
methods: {
|
|
|
init(type, id) {
|
|
init(type, id) {
|
|
|
this.open = true
|
|
this.open = true
|
|
|
|
|
+ this.reset()
|
|
|
this.type = type
|
|
this.type = type
|
|
|
this.form.id = id
|
|
this.form.id = id
|
|
|
|
|
+ this.id = id
|
|
|
if(this.type == 'add') {
|
|
if(this.type == 'add') {
|
|
|
this.title = '新增'
|
|
this.title = '新增'
|
|
|
}else if(this.type == 'update') {
|
|
}else if(this.type == 'update') {
|
|
|
this.title = '修改'
|
|
this.title = '修改'
|
|
|
}
|
|
}
|
|
|
- if(this.form.id) {
|
|
|
|
|
- this.getData()
|
|
|
|
|
- }
|
|
|
|
|
- this.resetForm("form");
|
|
|
|
|
this.getProvinceData()
|
|
this.getProvinceData()
|
|
|
|
|
+
|
|
|
|
|
+ setTimeout(() => { // 加延时
|
|
|
|
|
+ if(this.form.id) {
|
|
|
|
|
+ this.getData()
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 50);
|
|
|
|
|
+
|
|
|
|
|
+ // this.resetForm("form");
|
|
|
|
|
+ },
|
|
|
|
|
+ // 表单重置
|
|
|
|
|
+ reset() {
|
|
|
|
|
+ this.form = {
|
|
|
|
|
+ };
|
|
|
|
|
+ this.resetForm("form");
|
|
|
},
|
|
},
|
|
|
getData() {
|
|
getData() {
|
|
|
getTaxInfoByIdApi(this.form.id).then(res => {
|
|
getTaxInfoByIdApi(this.form.id).then(res => {
|
|
|
if(res.code == 200) {
|
|
if(res.code == 200) {
|
|
|
this.form = res.data
|
|
this.form = res.data
|
|
|
|
|
+ //获取parentArea 若长度为2,则为省级,三为市级,四为区级
|
|
|
|
|
+ let arr = res.data.parentArea.split(',')
|
|
|
|
|
+ if(arr.length == 2) {
|
|
|
|
|
+ this.form.provinceId = res.data.scopeId
|
|
|
|
|
+ }else if(arr.length == 3) {
|
|
|
|
|
+ this.form.provinceId = arr[2]
|
|
|
|
|
+ getRegionChildrenApi(this.form.provinceId).then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ this.cityDataList = res.data
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ setTimeout(() => { // 加延时
|
|
|
|
|
+ this.form.cityId = res.data.scopeId
|
|
|
|
|
+ }, 50);
|
|
|
|
|
+
|
|
|
|
|
+ }else if(arr.length == 4) {
|
|
|
|
|
+ this.form.provinceId = arr[2]
|
|
|
|
|
+ getRegionChildrenApi(this.form.provinceId).then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ this.cityDataList = res.data
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ setTimeout(() => { // 加延时
|
|
|
|
|
+ this.form.cityId = arr[3]
|
|
|
|
|
+ getRegionChildrenApi(this.form.cityId).then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ this.districtDataList = res.data
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }, 50);
|
|
|
|
|
+ this.form.districtId = res.data.scopeId
|
|
|
|
|
+ }
|
|
|
let list = []
|
|
let list = []
|
|
|
list = res.data
|
|
list = res.data
|
|
|
if(list.userType == 'GOV_PROV') {
|
|
if(list.userType == 'GOV_PROV') {
|
|
@@ -106,6 +152,13 @@
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ getProvinceData() {
|
|
|
|
|
+ getProvinceDataApi().then(res => {
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ this.provinceDataList = res.data
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
//选择省份
|
|
//选择省份
|
|
|
getCityData() {
|
|
getCityData() {
|
|
|
this.form.cityId = ''
|
|
this.form.cityId = ''
|
|
@@ -115,6 +168,7 @@
|
|
|
this.cityDataList = res.data
|
|
this.cityDataList = res.data
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
},
|
|
},
|
|
|
//选择市
|
|
//选择市
|
|
|
getDistrictData() {
|
|
getDistrictData() {
|
|
@@ -124,13 +178,14 @@
|
|
|
this.districtDataList = res.data
|
|
this.districtDataList = res.data
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
},
|
|
},
|
|
|
- getProvinceData() {
|
|
|
|
|
- getProvinceDataApi().then(res => {
|
|
|
|
|
- if(res.code == 200) {
|
|
|
|
|
- this.provinceDataList = res.data
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ changeDistrict() {
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
|
+ },
|
|
|
|
|
+ //视图更新不够及时
|
|
|
|
|
+ changeDuty() {
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
},
|
|
},
|
|
|
submitForm() {
|
|
submitForm() {
|
|
|
this.$refs.form.validate(valid => {
|
|
this.$refs.form.validate(valid => {
|
|
@@ -172,17 +227,32 @@
|
|
|
this.form.scopeId = this.form.districtId
|
|
this.form.scopeId = this.form.districtId
|
|
|
this.form.userType = 'GOV_DISTRI'
|
|
this.form.userType = 'GOV_DISTRI'
|
|
|
}
|
|
}
|
|
|
- addTaxUserApi(this.form).then(res => {
|
|
|
|
|
- this.disabled = false;
|
|
|
|
|
- if(res.code == 200) {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- message: '新增成功',
|
|
|
|
|
- type: 'success'
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- this.open = false;
|
|
|
|
|
- this.$emit('refreshData');
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ if(this.id) {
|
|
|
|
|
+ updateTaxInfoApi(this.form).then(res => {
|
|
|
|
|
+ this.disabled = false;
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '修改成功',
|
|
|
|
|
+ type: 'success'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ this.open = false;
|
|
|
|
|
+ this.$emit('refreshData');
|
|
|
|
|
+ })
|
|
|
|
|
+ }else {
|
|
|
|
|
+ addTaxUserApi(this.form).then(res => {
|
|
|
|
|
+ this.disabled = false;
|
|
|
|
|
+ if(res.code == 200) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '新增成功',
|
|
|
|
|
+ type: 'success'
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ this.open = false;
|
|
|
|
|
+ this.$emit('refreshData');
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|