This commit is contained in:
libing 2024-01-14 21:16:36 +08:00
parent b76d6cd98f
commit 9384d4d48a

View File

@ -164,13 +164,12 @@
</el-col>
<el-col :span="12">
<el-form-item label="所属国家" prop="country">
<el-select v-model="form.country" multiple placeholder="请输入所属国家,可能多个国家,逗号隔开" >
<el-select v-model="form.country" multiple @change="hideOther" placeholder="请输入所属国家,可能多个国家,逗号隔开" >
<el-option
v-for="item in countryIdsOptions"
:key="item.label"
:label="item.label"
:value="item.label"
:disabled="item.status == 1"
/>
</el-select>
</el-form-item>
@ -318,6 +317,19 @@ export default {
this.getCountryList();
},
methods: {
hideOther() {
// 数组的indexOf方法,会返回当前值在数组中的下标,没有则为-1
if (this.form.country.indexOf("全部国家") == "-1") {
this.countryIdsOptions.map((res) => {
res.disabled = false;
});
} else {
this.countryIdsOptions.map((res) => {
res.disabled = true;
});
this.form.country = ["全部国家"];
}
},
handleStatusChange(row) {
let text = row.status === "0" ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '不计算时效吗?').then(function() {
@ -359,6 +371,7 @@ export default {
this.countryIdsOptions = [];
var cTree={"id":"","label":"国家列表","children":[]};
cTree.children.push({"id":40,"label":"中国"});
this.countryIdsOptions.push({"value":0,"label":"全部国家"})
this.countryIdsOptions.push({"value":40,"label":"中国"})
//var lastContinentId = -1;
response.rows.forEach(item =>{
@ -449,6 +462,8 @@ export default {
this.reset();
const id = row.id || this.ids
getEmisNotCalcAging(id).then(response => {
var arr = response.data.country.split(",");
response.data.country = arr;
this.form = response.data;
this.open = true;
this.title = "修改";
@ -470,6 +485,14 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
var country = "";
this.form.country.map((res) => {
country+=res+",";
});
if (country.charAt(country.length - 1) === ",") {
country = country.slice(0, -1);
}
this.form.country = country;
if (this.form.id != null) {
updateEmisNotCalcAging(this.form).then(response => {
this.$modal.msgSuccess("修改成功");