BUG 26970

This commit is contained in:
aixianling
2022-01-26 15:11:56 +08:00
parent 602b4f06ef
commit b148035c40
2 changed files with 78 additions and 179 deletions

View File

@@ -211,12 +211,7 @@
v-model="form.partyOrgName" v-model="form.partyOrgName"
> >
<template slot="append"> <template slot="append">
<ai-party <ai-party :instance="instance" size="small" :value="form.partyOrgId" @origin="handlePartyOrgSelect"/>
:instance="instance"
size="small"
:value="form.partyOrgId"
@origin="handlePartyOrgSelect"
/>
</template> </template>
</el-input> </el-input>
</el-form-item> </el-form-item>
@@ -309,13 +304,13 @@
</el-form-item> </el-form-item>
<el-form-item label="任职日期" prop="partyStartDate"> <el-form-item label="任职日期" prop="partyStartDate">
<el-date-picker <el-date-picker
size="small" size="small"
v-model="form.partyStartDate" v-model="form.partyStartDate"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
style="width: 100%" style="width: 100%"
format="yyyy-MM-dd" format="yyyy-MM-dd"
:value-format="'yyyy-MM-dd'" :value-format="'yyyy-MM-dd'"
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@@ -348,7 +343,7 @@
placeholder="请选择流动情况" placeholder="请选择流动情况"
:selectList="dict.getDict('flowStatus')" :selectList="dict.getDict('flowStatus')"
@change="flowStatusChange" @change="flowStatusChange"
></ai-select> />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="流入组织" label="流入组织"
@@ -467,18 +462,19 @@
></ai-select> ></ai-select>
</el-form-item> </el-form-item>
</div> </div>
<el-tabs v-model="activeName"> <el-tabs v-model="activeName" class="cardTabs">
<el-tab-pane label="五星党员" name="五星党员" lazy></el-tab-pane> <el-tab-pane label="五星党员" name="五星党员" lazy/>
<el-tab-pane label="工作信息" name="工作信息" lazy></el-tab-pane> <el-tab-pane label="工作信息" name="工作信息" lazy/>
<el-tab-pane label="违纪信息" name="违纪信息" lazy></el-tab-pane> <el-tab-pane label="违纪信息" name="违纪信息" lazy/>
</el-tabs> </el-tabs>
<div class="add-btn"> <ai-search-bar>
<span></span> <template #right>
<div @click="addForm(activeName)"> <el-button type="text" icon="iconfont iconAdd" @click="addForm(activeName)">添加{{
<i class="iconfont iconAdd"></i> activeName
<span>添加{{ activeName }}</span> }}
</div> </el-button>
</div> </template>
</ai-search-bar>
<ai-table <ai-table
v-if="activeName === '五星党员'" v-if="activeName === '五星党员'"
:border="true" :border="true"
@@ -779,6 +775,7 @@ export default {
props: { props: {
instance: Function, instance: Function,
dict: Object, dict: Object,
selected: Object
}, },
computed: { computed: {
isEdit() { isEdit() {
@@ -882,7 +879,6 @@ export default {
}; };
}, },
created() { created() {
this.initOrg();
this.dict.load( this.dict.load(
"partyStatus", "partyStatus",
"education", "education",
@@ -893,7 +889,12 @@ export default {
"sex", "sex",
"nation" "nation"
); );
this.getInfo(); if (this.isEdit) {
this.getInfo()
} else {
this.initOrg();
}
}, },
methods: { methods: {
flowStatusChange() { flowStatusChange() {
@@ -904,7 +905,7 @@ export default {
this.form.lossTime = '' this.form.lossTime = ''
}, },
initOrg() { initOrg() {
let {oid: partyOrgId, oname: partyOrgName} = this.$route.query; let {id: partyOrgId, name: partyOrgName} = this.selected
this.form.partyOrgId = partyOrgId; this.form.partyOrgId = partyOrgId;
this.form.partyOrgName = partyOrgName; this.form.partyOrgName = partyOrgName;
}, },
@@ -915,85 +916,34 @@ export default {
}, },
getInfo() { getInfo() {
let {id} = this.$route.query; let {id} = this.$route.query;
id && id && this.instance.post(`/app/appparty/detail`, null, {
this.instance
.post(`/app/appparty/detail`, null, {
params: {id}, params: {id},
}) }).then((res) => {
.then((res) => {
if (res?.data) { if (res?.data) {
this.form = { this.form = res.data
...res.data,
};
} }
}); });
}, },
editJob(query, index) {
this.jobForm = {
...query,
date: [query.starTime, query.endTime],
};
this.jobId = index;
this.isShowJobForm = true;
},
editStar(query, index) { editStar(query, index) {
this.starForm = { this.starForm = JSON.parse(JSON.stringify(query));
...query,
};
this.starId = index; this.starId = index;
this.isShowStarForm = true; this.isShowStarForm = true;
}, },
editJob(query, index) {
this.jobForm = JSON.parse(JSON.stringify(query));
this.jobId = index;
this.isShowJobForm = true;
},
editDisciplinary(query, index) { editDisciplinary(query, index) {
this.disciplinaryForm = { this.disciplinaryForm = JSON.parse(JSON.stringify(query));
...query,
};
this.disciplinaryId = index; this.disciplinaryId = index;
this.isShowDisciplinaryForm = true; this.isShowDisciplinaryForm = true;
}, },
idChange(val) { idChange(val) {
if (val.length == 18) { let info = this.$idCardNoUtil.getIdCardInfo(val)
this.IdCard(val); this.form.sex = info.sex || "";
} else { this.form.birthday = info.birthday || "";
this.form.sex = ""; this.form.age = this.$calcAge(val) || "";
this.form.age = "";
this.form.birthday = "";
}
},
IdCard(UUserCard) {
if (UUserCard) {
let arr = [];
let birth =
UUserCard.substring(6, 10) +
"-" +
UUserCard.substring(10, 12) +
"-" +
UUserCard.substring(12, 14) +
" 00:00:00";
arr.push(birth);
if (parseInt(UUserCard.substr(16, 1)) % 2 == 1) {
arr.push("1");
} else {
arr.push("0");
}
const myDate = new Date();
const month = myDate.getMonth() + 1;
const day = myDate.getDate();
let age = myDate.getFullYear() - UUserCard.substring(6, 10) - 1;
if (
UUserCard.substring(10, 12) < month ||
(UUserCard.substring(10, 12) == month &&
UUserCard.substring(12, 14) <= day)
) {
age++;
}
arr.push(age);
this.form.sex = arr[1];
this.form.age = arr[2];
this.form.birthday = arr[0];
}
}, },
checkName(val) { checkName(val) {
for (let i in this.form) { for (let i in this.form) {
@@ -1009,74 +959,46 @@ export default {
} }
this.form.avatarUrl = val.photo; this.form.avatarUrl = val.photo;
}, },
onDisciplinarForm() {
this.$refs.disciplinaryForm.validate((valid) => {
if (valid) {
if (this.disciplinaryId !== "") {
this.$set(
this.form.disciplinaryInfoList,
this.disciplinaryId,
JSON.parse(JSON.stringify(this.disciplinaryForm))
);
} else {
this.form.disciplinaryInfoList.push(
JSON.parse(JSON.stringify(this.disciplinaryForm))
);
}
this.isShowDisciplinaryForm = false;
this.$message.success(
this.disciplinaryId !== "" ? "编辑成功" : "新增成功"
);
}
});
},
onJobForm() { onJobForm() {
this.$refs.jobForm.validate((valid) => { this.$refs.jobForm.validate((valid) => {
if (valid) { if (valid) {
if (this.jobId !== "") { let info = JSON.parse(JSON.stringify({
this.$set( ...this.jobForm,
this.form.workInfoList, starTime: this.jobForm.date[0],
this.jobId, endTime: this.jobForm.date[1],
JSON.parse( }))
JSON.stringify({ if (!!this.jobId) {
...this.jobForm, this.form.workInfoList.splice(this.jobId, 1, info)
starTime: this.jobForm.date[0],
endTime: this.jobForm.date[1],
})
)
);
} else { } else {
this.form.workInfoList.push( this.form.workInfoList.push(info)
JSON.parse(
JSON.stringify({
...this.jobForm,
starTime: this.jobForm.date[0],
endTime: this.jobForm.date[1],
})
)
);
} }
this.isShowJobForm = false; this.isShowJobForm = false;
this.$message.success(this.jobId !== "" ? "编辑成功" : "新增成功");
} }
}); });
}, },
onStarForm() { onStarForm() {
this.$refs.starForm.validate((valid) => { this.$refs.starForm.validate((valid) => {
if (valid) { if (valid) {
if (this.starId !== "") { let info = JSON.parse(JSON.stringify(this.starForm))
this.$set( if (!!this.starId) {
this.form.starList, this.form.starList.splice(this.starId, 1, info)
this.starId,
JSON.parse(JSON.stringify(this.starForm))
);
} else { } else {
this.form.starList.push(JSON.parse(JSON.stringify(this.starForm))); this.form.starList.push(info)
} }
this.isShowStarForm = false; this.isShowStarForm = false;
this.$message.success(this.starId !== "" ? "编辑成功" : "新增成功"); }
});
},
onDisciplinarForm() {
this.$refs.disciplinaryForm.validate((valid) => {
if (valid) {
let info = JSON.parse(JSON.stringify(this.disciplinaryForm))
if (!!this.disciplinaryId) {
this.form.disciplinaryInfoList.splice(this.disciplinaryId, 1, info)
} else {
this.form.disciplinaryInfoList.push(info)
}
this.isShowDisciplinaryForm = false;
} }
}); });
}, },
@@ -1108,9 +1030,8 @@ export default {
confirm() { confirm() {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.instance this.instance.post(`/app/appparty/addOrUpdate`, {
.post(`/app/appparty/addOrUpdate`, { ...this.form
...this.form,
}) })
.then((res) => { .then((res) => {
if (res.code == 0) { if (res.code == 0) {
@@ -1127,12 +1048,10 @@ export default {
this.$router.push({}); this.$router.push({});
}, },
handlePartyOrgSelect(e) { handlePartyOrgSelect(e) {
let {isLeaf, name, id} = e?.[0]; let {isLeaf, name, id} = e?.[0] || {};
if (isLeaf == 1) { if (isLeaf == 1) {
this.form.partyOrgName = name; this.form.partyOrgName = name;
this.form.partyOrgId = id; this.form.partyOrgId = id;
} else {
this.$message.error("请选择党支部");
} }
}, },
}, },
@@ -1160,6 +1079,12 @@ export default {
} }
} }
::v-deep.cardTabs {
.el-tabs__header {
padding: 0;
}
}
.audit-0 { .audit-0 {
color: #ff8822 !important; color: #ff8822 !important;
} }
@@ -1167,30 +1092,5 @@ export default {
.audit-1 { .audit-1 {
color: #2ea222 !important; color: #2ea222 !important;
} }
.add-btn {
display: flex;
align-items: center;
justify-content: space-between;
margin: 10px 0 20px;
div {
display: flex;
align-items: center;
color: #2266ff;
font-size: 14px;
&:hover {
opacity: 0.6;
cursor: pointer;
user-select: none;
}
i {
line-height: 1;
margin-right: 4px;
}
}
}
} }
</style> </style>

View File

@@ -254,8 +254,7 @@ export default {
this.$router.push({query: {id}}) this.$router.push({query: {id}})
}, },
toAdd(id) { toAdd(id) {
let {id: oid, name: oname} = this.selected this.$router.push({query: {id}, hash: "#add"})
this.$router.push({query: {id, oid, oname}, hash: "#add"})
} }
} }
} }