|
|
@@ -13,6 +13,11 @@
|
|
|
<el-option v-for="item in roles" :key="item.ID" :label="item.ROLE_NAME" :value="item.ID" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item :label="$t('transportationConfig.countryName')"><!-- 国家 -->
|
|
|
+ <el-select v-model="form.countryId" multiple :placeholder="$t('Administrator.pleaseSelectCountry')">
|
|
|
+ <el-option v-for="item in countries" :key="item.ID" :label="item.NAME" :value="item.ID" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item :label="$t('Administrator.password')"><!-- 密码 -->
|
|
|
<el-input v-model="form.password" type="password" />
|
|
|
</el-form-item>
|
|
|
@@ -46,6 +51,8 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { adminAddAndEditAndChangePassword, adminAdd, adminEdit } from '@/api/filter'
|
|
|
+import {getCountries} from "@/api/site";
|
|
|
+import {isArray} from "@/utils/validate";
|
|
|
export default {
|
|
|
name: 'RoleAdd',
|
|
|
data() {
|
|
|
@@ -59,12 +66,14 @@ export default {
|
|
|
bindIp: '',
|
|
|
roleId: null,
|
|
|
password: null,
|
|
|
- surePassword: null
|
|
|
+ surePassword: null,
|
|
|
+ countryId: []
|
|
|
},
|
|
|
loading: true,
|
|
|
submitButtonStat: false,
|
|
|
isEdit: false,
|
|
|
- roles: null
|
|
|
+ roles: null,
|
|
|
+ countries: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -112,6 +121,7 @@ export default {
|
|
|
} else {
|
|
|
this.loading = false
|
|
|
}
|
|
|
+ this.getCountries()
|
|
|
},
|
|
|
methods: {
|
|
|
onSubmit() {
|
|
|
@@ -122,6 +132,16 @@ export default {
|
|
|
} else if (this.$route.name === 'admin_change-password') {
|
|
|
path = 'admin/change-password'
|
|
|
}
|
|
|
+
|
|
|
+ console.log(this.form.countryId)
|
|
|
+ if (!(isArray(this.form.countryId) && this.form.countryId.length > 0)){
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('Administrator.pleaseSelectCountry'),
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ this.submitButtonStat = false
|
|
|
+ return false;
|
|
|
+ }
|
|
|
adminAddAndEditAndChangePassword(path, this.form).then(response => {
|
|
|
this.submitButtonStat = false
|
|
|
console.log(response)
|
|
|
@@ -138,7 +158,14 @@ export default {
|
|
|
type: 'error'
|
|
|
})
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+ getCountries(){
|
|
|
+ getCountries().then(response => {
|
|
|
+ this.countries = response
|
|
|
+ }).catch(err => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -162,7 +189,7 @@ export default {
|
|
|
/deep/ .el-form-item__label {
|
|
|
width:150px !important;
|
|
|
}
|
|
|
- /deep/ .el-input__inner {
|
|
|
+ /deep/ .el-input__inner {
|
|
|
width: 150px;
|
|
|
}
|
|
|
/* .el-input {
|