|
@@ -20,6 +20,10 @@
|
|
@change="selectChangeType"
|
|
@change="selectChangeType"
|
|
:range="typeList"
|
|
:range="typeList"
|
|
:range-key="'name'"
|
|
:range-key="'name'"
|
|
|
|
+ :value="
|
|
|
|
+ formData.type &&
|
|
|
|
+ typeList.findIndex((item) => item.id == formData.type.id)
|
|
|
|
+ "
|
|
>
|
|
>
|
|
<view class="select">
|
|
<view class="select">
|
|
{{
|
|
{{
|
|
@@ -47,6 +51,10 @@
|
|
@change="selectChangeIndustry"
|
|
@change="selectChangeIndustry"
|
|
:range="industryList"
|
|
:range="industryList"
|
|
:range-key="'name'"
|
|
:range-key="'name'"
|
|
|
|
+ :value="
|
|
|
|
+ formData.industry &&
|
|
|
|
+ typeList.findIndex((item) => item.id == formData.industry.id)
|
|
|
|
+ "
|
|
>
|
|
>
|
|
<view class="select">
|
|
<view class="select">
|
|
{{
|
|
{{
|
|
@@ -68,6 +76,7 @@
|
|
@change="selectChangeLocation"
|
|
@change="selectChangeLocation"
|
|
:range="locationList"
|
|
:range="locationList"
|
|
:range-key="'name'"
|
|
:range-key="'name'"
|
|
|
|
+ :value="locationIndex"
|
|
>
|
|
>
|
|
<view class="select">
|
|
<view class="select">
|
|
{{
|
|
{{
|
|
@@ -97,7 +106,11 @@
|
|
v-show="!formData.type || (formData.type && formData.type.id != 7)"
|
|
v-show="!formData.type || (formData.type && formData.type.id != 7)"
|
|
required
|
|
required
|
|
>
|
|
>
|
|
- <picker @change="selectChangeVersion" :range="versionList">
|
|
|
|
|
|
+ <picker
|
|
|
|
+ @change="selectChangeVersion"
|
|
|
|
+ :range="versionList"
|
|
|
|
+ :value="formData.version && formData.version - 1"
|
|
|
|
+ >
|
|
<view class="select">
|
|
<view class="select">
|
|
{{ versionList[this.formData.version - 1] }}
|
|
{{ versionList[this.formData.version - 1] }}
|
|
</view>
|
|
</view>
|
|
@@ -218,6 +231,7 @@ export default {
|
|
versionList,
|
|
versionList,
|
|
provinces,
|
|
provinces,
|
|
locationList: [provinces, []],
|
|
locationList: [provinces, []],
|
|
|
|
+ locationIndex: [0, 0],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -277,6 +291,22 @@ export default {
|
|
code.location = form.location.code;
|
|
code.location = form.location.code;
|
|
code.name = form.name;
|
|
code.name = form.name;
|
|
code.version = form.version;
|
|
code.version = form.version;
|
|
|
|
+
|
|
|
|
+ const searchLocation = (list, name) => {
|
|
|
|
+ for (let i = 0; i < list.length; ++i) {
|
|
|
|
+ if (list[i].children) {
|
|
|
|
+ let childrenIndex = searchLocation(list[i].children, name);
|
|
|
|
+ if (childrenIndex[0] != -1) return [i, childrenIndex[0]];
|
|
|
|
+ } else {
|
|
|
|
+ if (list[i].name == name) return [i, 0];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return [-1, -1];
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ this.locationIndex = searchLocation(this.provinces, current.location);
|
|
|
|
+ if (this.provinces[this.locationIndex[0]].children)
|
|
|
|
+ this.locationList[1] = this.provinces[this.locationIndex[0]].children;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -318,16 +348,19 @@ export default {
|
|
this.binddata("version", e.target.value);
|
|
this.binddata("version", e.target.value);
|
|
},
|
|
},
|
|
bindChangeLocationColumn(e) {
|
|
bindChangeLocationColumn(e) {
|
|
- e.target.column == 0 &&
|
|
|
|
- (this.locationList[1] = this.provinces[e.target.value].children || []);
|
|
|
|
|
|
+ if (e.target.column == 0) {
|
|
|
|
+ this.locationList[1] = this.provinces[e.target.value].children || [];
|
|
|
|
+ this.locationIndex = [e.target.value, 0];
|
|
|
|
+ }
|
|
},
|
|
},
|
|
selectChangeLocation(e) {
|
|
selectChangeLocation(e) {
|
|
let multiIndex = e.target.value;
|
|
let multiIndex = e.target.value;
|
|
|
|
+ this.locationIndex = multiIndex;
|
|
// let location = this.formData.location;
|
|
// let location = this.formData.location;
|
|
// let locationCode = this.formData.code.location;
|
|
// let locationCode = this.formData.code.location;
|
|
- let location = provinces[multiIndex[0]].children
|
|
|
|
- ? provinces[multiIndex[0]].children[multiIndex[1]]
|
|
|
|
- : provinces[multiIndex[0]];
|
|
|
|
|
|
+ let location = this.provinces[multiIndex[0]].children
|
|
|
|
+ ? this.provinces[multiIndex[0]].children[multiIndex[1]]
|
|
|
|
+ : this.provinces[multiIndex[0]];
|
|
location.code =
|
|
location.code =
|
|
location.code.length == 4 ? location.code.substr(1) : location.code;
|
|
location.code.length == 4 ? location.code.substr(1) : location.code;
|
|
this.formData.location = location;
|
|
this.formData.location = location;
|