207 lines
6.1 KiB
Vue
207 lines
6.1 KiB
Vue
<template>
|
||
<div >
|
||
<el-row :gutter="0">
|
||
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
|
||
<el-col :span="12">
|
||
<el-form-item label="不计时效日期" prop="noCalcDay">
|
||
<el-date-picker clearable
|
||
v-model="form.noCalcDay"
|
||
type="date"
|
||
value-format="yyyy-MM-dd"
|
||
placeholder="请选择不计时效日期">
|
||
</el-date-picker>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="12">
|
||
<el-form-item label="所属国家" prop="country">
|
||
<el-select v-model="form.country" multiple clearable filterable @change="onCountryChange" placeholder="所属国家" >
|
||
<el-option
|
||
v-for="item in countryIdsOptions"
|
||
:key="item.code"
|
||
:label="item.name"
|
||
:value="item.code"
|
||
:disabled="item.disabled"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="24">
|
||
<el-form-item label="是否启用" prop="status">
|
||
<el-radio-group v-model="form.status">
|
||
<el-radio :label="1">是</el-radio>
|
||
<el-radio :label="0">否</el-radio>
|
||
</el-radio-group>
|
||
</el-form-item>
|
||
</el-col>
|
||
<!--
|
||
<el-col :span="24">
|
||
<el-form-item label="备注" prop="remark">
|
||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="24" v-show="moreInputVisible" > </el-col>
|
||
<el-col :span="24">
|
||
<el-divider content-position="right" @click="handleShowMoreInput" >更多信息[+]</el-divider>
|
||
</el-col>
|
||
-->
|
||
</el-form>
|
||
</el-row>
|
||
<div style="text-align: center;margin-bottom: 10px;">
|
||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||
<el-button @click="cancel">取 消</el-button>
|
||
</div>
|
||
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { listEmisNotCalcAging, getEmisNotCalcAging, delEmisNotCalcAging, addEmisNotCalcAging, updateEmisNotCalcAging } from "@/api/emis/emisNotCalcAging";
|
||
import { listEmisCountry, getEmisCountry, delEmisCountry, addEmisCountry, updateEmisCountry } from "@/api/emis/emisCountry";
|
||
|
||
export default {
|
||
name: "emisNotCalcAgingForm",
|
||
props:{
|
||
id:undefined
|
||
},
|
||
components: { },
|
||
dicts: [
|
||
'sys_normal_disable',
|
||
],
|
||
data() {
|
||
return {
|
||
emisNotCalcAgingOptions: [],
|
||
countryIdsOptions:[],
|
||
// 遮罩层
|
||
loading: true,
|
||
// 表单参数
|
||
form: {},
|
||
// 表单校验
|
||
rules: {
|
||
country: [
|
||
{ required: true, message: "所属国家不能为空", trigger: "blur" }
|
||
],
|
||
noCalcDay: [
|
||
{ required: true, message: "不计时效日期不能为空", trigger: "blur" }
|
||
],
|
||
status: [
|
||
{ required: true, message: "启用状态不能为空", trigger: "blur" }
|
||
],
|
||
}
|
||
};
|
||
},
|
||
watch: {
|
||
"id": {
|
||
handler (newValue, oldValue) {
|
||
this.id = newValue;
|
||
this.initData();
|
||
},
|
||
deep: true
|
||
}
|
||
},
|
||
created() {
|
||
this.initData();
|
||
this.initCountry();
|
||
},
|
||
|
||
methods: {
|
||
initData() {
|
||
this.reset();
|
||
if(this.id !=undefined) {
|
||
this.loading = true;
|
||
getEmisNotCalcAging(this.id).then(response => {
|
||
this.form = response.data;
|
||
if(this.form.country != null && this.form.country != ''){
|
||
this.form.country = this.form.country.split(',')
|
||
}
|
||
this.loading = false;
|
||
});
|
||
}
|
||
},
|
||
onCountryChange() {
|
||
console.log(this.form.country)
|
||
if (this.form.country.includes('-1')) {
|
||
console.log("0000=>"+this.form.country)
|
||
this.countryIdsOptions.map((res) => {
|
||
if(res.code != '-1'){
|
||
res.disabled = true;
|
||
}else{
|
||
res.disabled = false;
|
||
}
|
||
});
|
||
}else{
|
||
console.log("1111=>"+this.form.country)
|
||
this.countryIdsOptions.map((res) => {
|
||
if(res.code == '-1' && this.form.country.length>0){
|
||
res.disabled = true;
|
||
}else{
|
||
res.disabled = false;
|
||
}
|
||
});
|
||
}
|
||
|
||
|
||
// 数组的indexOf方法,会返回当前值在数组中的下标,没有则为-1
|
||
// if(this.form.country!=null && this.form.country!=undefined){
|
||
|
||
// }
|
||
// else {
|
||
// this.countryIdsOptions.map((res) => {
|
||
// res.disabled = false;
|
||
// });
|
||
// }
|
||
},
|
||
initCountry() {
|
||
this.countryIdsOptions = [{'code':'-1','name':'全部国家','nameEn':'ALL'}];
|
||
this.loading = true;
|
||
listEmisCountry(this.queryParams).then(response => {
|
||
this.loading = false;
|
||
this.countryIdsOptions = this.countryIdsOptions.concat(response.rows);
|
||
});
|
||
},
|
||
// 取消按钮
|
||
cancel() {
|
||
this.reset();
|
||
this.$emit("on-cancel");
|
||
},
|
||
// 表单重置
|
||
reset() {
|
||
this.form = {
|
||
id: null,
|
||
country: null,
|
||
countryName: null,
|
||
noCalcDay: null,
|
||
status: null,
|
||
remark: null,
|
||
tenantId: null,
|
||
delFlag: null,
|
||
createBy: null,
|
||
createTime: null,
|
||
updateBy: null,
|
||
updateTime: null
|
||
};
|
||
this.resetForm("form");
|
||
},
|
||
/** 提交按钮 */
|
||
submitForm() {
|
||
this.$refs["form"].validate(valid => {
|
||
if (valid) {
|
||
this.form.country = this.form.country.join(",");
|
||
if (this.form.id != null) {
|
||
updateEmisNotCalcAging(this.form).then(response => {
|
||
this.$modal.msgSuccess("修改成功");
|
||
this.$emit("on-changed");
|
||
});
|
||
} else {
|
||
addEmisNotCalcAging(this.form).then(response => {
|
||
this.$modal.msgSuccess("修改成功");
|
||
this.$emit("on-changed");
|
||
});
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
}
|
||
};
|
||
</script>
|