4 changed files with 1459 additions and 6 deletions
@ -0,0 +1,609 @@ |
|||
<template> |
|||
<div> |
|||
<div |
|||
class="dialog-h-content scroll-h" |
|||
:class="{ 'visiual-form': source === 'visiual' }" |
|||
> |
|||
<el-form |
|||
ref="ref_add_form" |
|||
:inline="true" |
|||
:model="formData" |
|||
:rules="dataRule" |
|||
class="div_form" |
|||
> |
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">所属组织: </span> |
|||
<span>{{ formData.agencyName || "--" }}</span> |
|||
</div> |
|||
<el-form-item label="所属组织" prop="agencyId" label-width="100px" v-else> |
|||
<el-cascader class="u-item-width-normal" |
|||
ref="myCascader" |
|||
v-model="agencyIdTemp" |
|||
:options="orgOptions" |
|||
:props="orgOptionProps" |
|||
:show-all-levels="false" |
|||
@change="handleChangeAgency" |
|||
clearable> |
|||
</el-cascader> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">姓名: </span> |
|||
<span>{{ formData.name || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="姓名" prop="name" v-else> |
|||
<el-input |
|||
v-model="formData.name" |
|||
placeholder="请输入" |
|||
clearable |
|||
></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">性别: </span> |
|||
<span>{{ |
|||
formData.gender |
|||
? formData.gender == "1" |
|||
? "男" |
|||
: formData.gender == "2" |
|||
? "女" |
|||
: "--" |
|||
: "--" |
|||
}}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="性别" v-else> |
|||
<el-select v-model="formData.gender" clearable> |
|||
<el-option |
|||
v-for="item in genderList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">出生日期: </span> |
|||
<span>{{formData.birthday||'--'}}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="出生日期" v-else> |
|||
<el-date-picker |
|||
v-model="formData.birthday" |
|||
type="date" |
|||
value-format="yyyy-MM-dd HH:mm:ss" |
|||
placeholder="选择日期" |
|||
style="width: 202px" |
|||
clearable |
|||
> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">民族: </span> |
|||
<span>{{ formData.nationName || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="民族" v-else> |
|||
<el-select v-model="formData.nation" clearable> |
|||
<el-option |
|||
v-for="item in dicts.nationList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">证件号: </span> |
|||
<span>{{ formData.idNum || "--" }}</span> |
|||
</div> |
|||
<el-form-item |
|||
label-width="100px" |
|||
label="证件号" |
|||
prop="idNum" |
|||
v-else |
|||
> |
|||
<el-input |
|||
v-model="formData.idNum" |
|||
placeholder="请输入" |
|||
clearable |
|||
></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">联系电话: </span> |
|||
<span>{{ formData.mobile || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="联系电话" v-else> |
|||
<el-input |
|||
v-model="formData.mobile" |
|||
placeholder="请输入" |
|||
clearable |
|||
></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">文化程度: </span> |
|||
<span>{{ cultureLevelName(formData.cultureLevel) }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="文化程度" v-else> |
|||
<el-select v-model="formData.cultureLevel" clearable> |
|||
<el-option |
|||
v-for="item in dicts.educationList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">是否党员: </span> |
|||
<span>{{ |
|||
formData.isParty != null |
|||
? formData.isParty == 1 |
|||
? "是" |
|||
: formData.gender == 2 |
|||
? "否" |
|||
: "--" |
|||
: "--" |
|||
}}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="是否党员" v-else> |
|||
<el-select v-model="formData.isParty" clearable> |
|||
<el-option |
|||
v-for="item in binaryOptionList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">岗位类型: </span> |
|||
<span>{{ formData.postTypes }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="岗位类型" prop="postTypes" v-else> |
|||
<el-select v-model="formData.postTypes" clearable> |
|||
<el-option |
|||
v-for="item in dicts.public_welfare_post_type" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
</el-col> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">入职时间: </span> |
|||
<span>{{formData.hireDate||'--'}}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="入职时间" v-else> |
|||
<el-date-picker |
|||
v-model="formData.hireDate" |
|||
type="date" |
|||
value-format="yyyy-MM-dd HH:mm:ss" |
|||
placeholder="选择日期" |
|||
style="width: 202px" |
|||
clearable |
|||
> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
</el-row> |
|||
|
|||
|
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">现居地址: </span> |
|||
<span>{{ formData.currentResidence || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="现居地址" class="wd-wr" v-else> |
|||
<el-input |
|||
v-model="formData.currentResidence" |
|||
placeholder="请输入" |
|||
clearable |
|||
></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">兴趣特长: </span> |
|||
<span>{{ formData.hobbyCodes || "--" }}</span> |
|||
</div> |
|||
|
|||
<el-form-item label-width="100px" label="兴趣特长" v-else class="wd-wr"> |
|||
<el-checkbox-group size="small" |
|||
v-model="formData.hobbyCodes"> |
|||
<el-checkbox v-for="items in dicts.SPECIAL_SKILL" |
|||
:label="items.value" |
|||
:key="items.value" |
|||
:value="items.value">{{items.label}}</el-checkbox> |
|||
</el-checkbox-group> |
|||
</el-form-item> |
|||
</el-col> |
|||
|
|||
|
|||
</el-row> |
|||
|
|||
<el-row> |
|||
<el-col :span="12"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">兴趣描述: </span> |
|||
<span>{{ formData.interestDesc || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="兴趣描述" v-else> |
|||
<el-input |
|||
v-model="formData.interestDesc" |
|||
placeholder="请输入" |
|||
clearable |
|||
></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
|
|||
|
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">备注: </span> |
|||
<span>{{ formData.remark || "--" }}</span> |
|||
</div> |
|||
<el-form-item label-width="100px" label="备注" class="wd-wr" v-else> |
|||
<el-input |
|||
v-model="formData.remark" |
|||
placeholder="请输入" |
|||
clearable |
|||
></el-input> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<el-row> |
|||
<el-col :span="24"> |
|||
<div class="info-prop" v-if="formType == 'detail'"> |
|||
<span class="info-title-2">管理范围: </span> |
|||
<span>{{ formData.manageScopes || "--" }}</span> |
|||
</div> |
|||
<el-form-item label="管理范围" prop="agencyId" label-width="100px" v-else> |
|||
<el-cascader class="u-item-width-normal" |
|||
ref="myCascader" |
|||
v-model="formData.manageScopes" |
|||
:options="orgOptions" |
|||
:props="orgOptionProps" |
|||
:show-all-levels="false" |
|||
clearable> |
|||
</el-cascader> |
|||
</el-form-item> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
</div> |
|||
<div class="div_btn"> |
|||
<el-button size="small" @click="handleCancle">取 消</el-button> |
|||
<el-button |
|||
size="small" |
|||
type="primary" |
|||
:disabled="btnDisable" |
|||
@click="handleComfirm" |
|||
>确 定</el-button |
|||
> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { Loading } from "element-ui"; // 引入Loading服务 |
|||
import { requestPost, requestGet } from "@/js/dai/request"; |
|||
import nextTick from "dai-js/tools/nextTick"; |
|||
import { genderList, binaryOptionList } from "@/js/columns/constants"; |
|||
|
|||
let loading; // 加载动画 |
|||
|
|||
export default { |
|||
props: { |
|||
source: { |
|||
//展示来源:manage 管理平台 visiual 可视化平台 |
|||
type: String, |
|||
default: "manage", |
|||
}, |
|||
}, |
|||
|
|||
data() { |
|||
let orgOptionProps = { |
|||
multiple: false, |
|||
value: 'agencyId', |
|||
label: 'agencyName', |
|||
children: 'subAgencyList', |
|||
checkStrictly: true |
|||
} |
|||
return { |
|||
formType:'', |
|||
btnDisable: false, |
|||
// 不要证件类型 把本地户籍改成是否党员是否党员 |
|||
formData: { |
|||
hobbyCodes:[], |
|||
agencyId: "", |
|||
name: "", |
|||
mobile: "", |
|||
gender: "", |
|||
idType: "", |
|||
idNum: "", |
|||
birthday: "", |
|||
nation: "", |
|||
placeOfDomicile: "", |
|||
cultureLevel: "", |
|||
marriage: "", |
|||
interestDesc: "", |
|||
remark: "", |
|||
postTypes: [], |
|||
manageScopes: [], |
|||
hireDate:'', |
|||
isParty:null |
|||
}, |
|||
agencyIdTemp:[], |
|||
orgOptionProps , |
|||
orgOptions: [], |
|||
genderList, |
|||
binaryOptionList, |
|||
dataRule: { |
|||
name: [{ required: true, message: "姓名不能为空", trigger: "bulr" }], |
|||
idNum: [{ required: true, message: "证件号不能为空", trigger: "bulr" }], |
|||
|
|||
idType: [ |
|||
{ required: true, message: "证件类型不能为空", trigger: "bulr" }, |
|||
], |
|||
postTypes:[ |
|||
{ required: true, message: "岗位类型不能为空", trigger: "bulr" }, |
|||
], |
|||
agencyId:[ |
|||
{ required: true, message: "所属组织不能为空", trigger: "bulr" }, |
|||
], |
|||
manageScopes:[ |
|||
{ required: true, message: "管理范围不能为空", trigger: "bulr" }, |
|||
] |
|||
}, |
|||
scopeId: "", |
|||
|
|||
dicts: { |
|||
nationList: [], |
|||
educationList: [], |
|||
public_welfare_post_type:[], |
|||
SPECIAL_SKILL:[] |
|||
}, |
|||
}; |
|||
}, |
|||
|
|||
watch: {}, |
|||
|
|||
components: {}, |
|||
created() { |
|||
this.getDicts(); |
|||
this.getOrgTreeList() |
|||
}, |
|||
async mounted() { |
|||
this.startLoading(); |
|||
await this.endLoading(); |
|||
}, |
|||
|
|||
methods: { |
|||
async initForm(type, row) { |
|||
this.formType = type; |
|||
this.scopeId = row.categorizedResiId; |
|||
await this.getDetail(this.scopeId); |
|||
}, |
|||
async getDetail(categorizedResiId) { |
|||
const url = `/actual/base/residentPartyMemberInfo/detail/${categorizedResiId}`; |
|||
const { data, code, msg } = await requestGet(url); |
|||
if (code === 0) { |
|||
this.formData = { ...data }; |
|||
await this.setAgencyIdFromLastLayerId(data.agencyId) |
|||
console.log(this.agencyIdTemp); |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
async handleComfirm() { |
|||
this.$refs["ref_add_form"].validate(async (valid) => { |
|||
if (!valid) { |
|||
return false; |
|||
} |
|||
const url = |
|||
this.formType === "edit" |
|||
? "/actual/base/resiCategorized/publicWelfarePost/update" |
|||
: "/actual/base/resiCategorized/publicWelfarePost/create"; |
|||
|
|||
const { data, code, msg } = await requestPost(url, this.formData); |
|||
if (code === 0) { |
|||
this.$message.success(this.formType == 'add'?"添加成功":'修改成功'); |
|||
this.resetData(); |
|||
this.$emit("handleComfirm"); |
|||
} else if (code >= 8000) { |
|||
this.$message.error(msg); |
|||
} |
|||
}); |
|||
}, |
|||
async getDicts() { |
|||
try { |
|||
const requests = [ |
|||
this.$http.post("sys/dict/data/nation", { |
|||
formCode: "resi_base_info", |
|||
}), |
|||
this.$http.post("sys/dict/data/education", { |
|||
formCode: "resi_base_info", |
|||
}), |
|||
this.$http.post("sys/dict/data/dictlist", { |
|||
dictType: "public_welfare_post_type", |
|||
}), |
|||
this.$http.post("sys/dict/data/dictlist", { |
|||
dictType: "SPECIAL_SKILL", |
|||
}), |
|||
|
|||
]; |
|||
const dictKeys = [ |
|||
"nationList", |
|||
"educationList", |
|||
"public_welfare_post_type", |
|||
'SPECIAL_SKILL' |
|||
]; // 对应的键名 |
|||
|
|||
const results = await Promise.all(requests); |
|||
results.forEach((result, index) => { |
|||
if (result.data.code === 0) { |
|||
this.dicts[dictKeys[index]].push(...result.data.data); |
|||
} else { |
|||
console.log(`获取${dictKeys[index]}失败: ${result.data.msg}`); |
|||
} |
|||
}); |
|||
} catch (error) { |
|||
console.log("获取字典失败: ", error); |
|||
} |
|||
}, |
|||
cultureLevelName(val) { |
|||
let filtered = this.dicts.educationList.filter( |
|||
(item) => item.value == val |
|||
); |
|||
let str = filtered.length > 0 ? filtered[0].label : null; |
|||
return str ? str : "--"; |
|||
}, |
|||
handleCancle() { |
|||
this.resetData(); |
|||
this.$emit("handleClose"); |
|||
}, |
|||
|
|||
resetData() { |
|||
this.formData = {}; |
|||
}, |
|||
getOrgTreeList () { |
|||
this.$http |
|||
.post('/gov/org/customeragency/agencygridtree', {}) |
|||
.then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
return this.$message.error(res.msg) |
|||
} else { |
|||
console.log('获取组织树成功', res.data) |
|||
this.orgOptions = [] |
|||
this.orgOptions.push(res.data) |
|||
} |
|||
}) |
|||
.catch(() => { |
|||
return this.$message.error('网络错误') |
|||
}) |
|||
}, |
|||
findPathInOptions(agencyId, options) { |
|||
console.log(agencyId,options); |
|||
for (let i = 0; i < options.length; i++) { |
|||
console.log(options[i]); |
|||
if (options[i].agencyId === agencyId) { |
|||
console.log(agencyId); |
|||
return [agencyId]; |
|||
} else if (options[i].subAgencyList) { |
|||
const pathFromChild = this.findPathInOptions(agencyId, options[i].subAgencyList |
|||
); |
|||
if (pathFromChild.length) { |
|||
return [options[i].agencyId].concat(pathFromChild); |
|||
} |
|||
} |
|||
} |
|||
return []; |
|||
}, |
|||
|
|||
async setAgencyIdFromLastLayerId(lastLayerId) { |
|||
console.log(lastLayerId,'事件'); |
|||
this.agencyIdTemp = await this.findPathInOptions(lastLayerId, this.orgOptions); |
|||
}, |
|||
handleChangeAgency(val){ |
|||
this.formData.agencyId = val[val.length -1] |
|||
console.log(this.formData.agencyId); |
|||
}, |
|||
// 开启加载动画 |
|||
startLoading() { |
|||
loading = Loading.service({ |
|||
lock: true, // 是否锁定 |
|||
text: "正在加载……", // 加载中需要显示的文字 |
|||
background: "rgba(0,0,0,.7)", // 背景颜色 |
|||
}); |
|||
}, |
|||
// 结束加载动画 |
|||
endLoading() { |
|||
if (loading) { |
|||
loading.close(); |
|||
} |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
@import "@/assets/scss/modules/management/form-main.scss"; |
|||
@import "@/assets/scss/modules/visual/a_customize.scss"; |
|||
@import "@/assets/scss/modules/management/detail-main.scss"; |
|||
|
|||
.form-item::v-deep .el-form-item__label { |
|||
color: #fff; |
|||
} |
|||
.form-item { |
|||
.el-radio { |
|||
color: #fff; |
|||
} |
|||
.el-checkbox { |
|||
color: #fff; |
|||
} |
|||
} |
|||
|
|||
.wd-wr { |
|||
width: 100%; |
|||
/deep/ .el-form-item__content { |
|||
width: calc(100% - 148px); |
|||
} |
|||
} |
|||
.info-prop { |
|||
margin-top: 29px; |
|||
.info-title-2 { |
|||
width: 100px; |
|||
text-align: right; |
|||
display: inline-block; |
|||
padding-right: 10px; |
|||
} |
|||
} |
|||
</style> |
|||
|
|||
|
|||
|
@ -0,0 +1,790 @@ |
|||
<template> |
|||
<div class="g-main"> |
|||
<div> |
|||
<div class="m-search"> |
|||
<el-form |
|||
:inline="true" |
|||
:model="formData" |
|||
ref="ref_searchform" |
|||
:label-width="'100px'" |
|||
> |
|||
<el-form-item label="姓名"> |
|||
<el-input |
|||
v-model="formData.name" |
|||
placeholder="请输入" |
|||
size="small" |
|||
class="u-item-width-normal" |
|||
clearable |
|||
></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="性别"> |
|||
<el-select |
|||
v-model="formData.gender" |
|||
placeholder="请输入" |
|||
size="small" |
|||
class="u-item-width-normal" |
|||
clearable |
|||
> |
|||
<el-option |
|||
v-for="item in genderList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="年龄"> |
|||
<el-date-picker |
|||
v-model="formData.birthdayStart" |
|||
type="date" |
|||
size="small" |
|||
class="u-item-width-daterange" |
|||
value-format="yyyy-MM-dd" |
|||
placeholder="开始日期" |
|||
:picker-options="startPickerOptions" |
|||
> |
|||
</el-date-picker> |
|||
<span class="u-data-tag">至</span> |
|||
<el-date-picker |
|||
v-model="formData.birthdayEnd" |
|||
type="date" |
|||
size="small" |
|||
value-format="yyyy-MM-dd" |
|||
class="u-item-width-daterange u-data-tag" |
|||
placeholder="结束日期" |
|||
:picker-options="endPickerOptionsBirthday" |
|||
> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<el-form-item label="证件号"> |
|||
<el-input |
|||
v-model="formData.idNum" |
|||
placeholder="请输入" |
|||
size="small" |
|||
class="u-item-width-normal" |
|||
clearable |
|||
></el-input> |
|||
</el-form-item> |
|||
<el-form-item label="文化程度"> |
|||
<el-select |
|||
v-model="formData.cultureLevel" |
|||
placeholder="请选择" |
|||
size="small" |
|||
class="u-item-width-normal" |
|||
clearable |
|||
> |
|||
<el-option |
|||
v-for="item in dicts.educationList" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label-width="100px" label="岗位类型" prop="postTypes" > |
|||
<el-select v-model="formData.postTypes" clearable size="small" class="u-item-width-normal"> |
|||
<el-option |
|||
v-for="item in dicts.public_welfare_post_type" |
|||
:key="item.value" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="入职时间"> |
|||
<el-date-picker |
|||
v-model="formData.hireDateFrom" |
|||
type="date" |
|||
size="small" |
|||
class="u-item-width-daterange" |
|||
value-format="yyyy-MM-dd" |
|||
placeholder="开始日期" |
|||
:picker-options="startPickerOptions" |
|||
> |
|||
</el-date-picker> |
|||
<span class="u-data-tag">至</span> |
|||
<el-date-picker |
|||
v-model="formData.hireDateEnd" |
|||
type="date" |
|||
size="small" |
|||
value-format="yyyy-MM-dd" |
|||
class="u-item-width-daterange u-data-tag" |
|||
placeholder="结束日期" |
|||
:picker-options="endPickerOptionsBirthday" |
|||
> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
<el-row type="flex"> |
|||
<el-col :span="24" align="right"> |
|||
<el-button |
|||
style="margin-left: 30px" |
|||
size="small" |
|||
type="primary " |
|||
@click="handleSearch" |
|||
>查询</el-button |
|||
> |
|||
<el-button |
|||
style="margin-left: 10px" |
|||
is-plain |
|||
class="diy-button--white el-button--default" |
|||
size="small" |
|||
@click="resetSearch" |
|||
>重置</el-button |
|||
> |
|||
</el-col> |
|||
</el-row> |
|||
</el-form> |
|||
</div> |
|||
|
|||
<div class="m-table"> |
|||
<div class="div_btn"> |
|||
<div class="div_btn_left"> |
|||
<el-button |
|||
size="small" |
|||
@click="handleAdd" |
|||
type="primary" |
|||
icon="el-icon-plus" |
|||
>新增</el-button |
|||
> |
|||
</div> |
|||
<el-button |
|||
@click="handleExport" |
|||
type="primary" |
|||
size="small" |
|||
class="diy-button--white el-button--default" |
|||
>导出</el-button |
|||
> |
|||
<el-button |
|||
@click="onDeleteBatch" |
|||
style="margin: 0 10px" |
|||
size="small" |
|||
type="primary" |
|||
> |
|||
批量删除 |
|||
</el-button> |
|||
<el-upload |
|||
:headers="$getElUploadHeaders()" |
|||
ref="upload" |
|||
class="upload-btn" |
|||
action="uploadUlr" |
|||
:limit="1" |
|||
:accept="'.xls,.xlsx'" |
|||
:with-credentials="true" |
|||
:show-file-list="false" |
|||
:auto-upload="true" |
|||
:before-upload="beforeExcelUpload" |
|||
:http-request="uploadHttpRequest" |
|||
> |
|||
<el-button |
|||
type="primary" |
|||
size="small" |
|||
class="diy-button--white el-button--default" |
|||
:loading="importLoading" |
|||
>导入</el-button |
|||
> |
|||
</el-upload> |
|||
<el-button |
|||
style="margin-left: 10px" |
|||
class="diy-button--blue" |
|||
size="small" |
|||
@click="handleExportModule('room')" |
|||
>下载模板</el-button |
|||
> |
|||
</div> |
|||
|
|||
<el-table |
|||
:data="tableData" |
|||
border |
|||
v-loading="tableLoading" |
|||
class="m-table-item" |
|||
style="width: 100%" |
|||
:height="maxTableHeight" |
|||
@selection-change="onMultiSelection" |
|||
> |
|||
<el-table-column |
|||
type="selection" |
|||
fixed="left" |
|||
align="center" |
|||
width="50" |
|||
/> |
|||
<el-table-column |
|||
label="序号" |
|||
fixed="left" |
|||
type="index" |
|||
align="center" |
|||
width="50" |
|||
/> |
|||
|
|||
<el-table-column |
|||
prop="name" |
|||
align="center" |
|||
width="100" |
|||
label="姓名" |
|||
:show-overflow-tooltip="true" |
|||
> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
prop="mobile" |
|||
align="center" |
|||
width="150" |
|||
label="联系电话" |
|||
:show-overflow-tooltip="true" |
|||
> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="idNum" |
|||
align="center" |
|||
width="200" |
|||
label="证件号" |
|||
:show-overflow-tooltip="true" |
|||
> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="genderName" |
|||
align="center" |
|||
width="80" |
|||
label="性别" |
|||
:show-overflow-tooltip="true" |
|||
> |
|||
<template slot-scope="scope"> |
|||
<span>{{ scope.row.gender?scope.row.gender == "1" ? "男":scope.row.gender == "2"?"女" :'--':"--" }}</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="currentResidence" |
|||
align="center" |
|||
width="100" |
|||
label="居住地址" |
|||
:show-overflow-tooltip="true" |
|||
> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="postTypeNames" |
|||
align="center" |
|||
width="100" |
|||
label="岗位类型" |
|||
:show-overflow-tooltip="true" |
|||
> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="hireDate" |
|||
align="center" |
|||
width="100" |
|||
label="岗位类型" |
|||
:show-overflow-tooltip="true" |
|||
> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="remark" |
|||
align="center" |
|||
label="备注" |
|||
:show-overflow-tooltip="true" |
|||
> |
|||
</el-table-column> |
|||
|
|||
<el-table-column |
|||
fixed="right" |
|||
label="操作" |
|||
align="center" |
|||
width="220" |
|||
> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
@click="handleDetail(scope.row)" |
|||
type="text" |
|||
size="small" |
|||
>查看</el-button |
|||
> |
|||
<el-button |
|||
@click="handleEdit(scope.row)" |
|||
type="text" |
|||
size="small" |
|||
>编辑</el-button |
|||
> |
|||
|
|||
<el-button @click="handleDel(scope.row)" type="text" size="small" |
|||
>删除</el-button |
|||
> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<div> |
|||
<el-pagination |
|||
@size-change="handleSizeChange" |
|||
@current-change="handleCurrentChange" |
|||
:current-page.sync="pageNo" |
|||
:page-sizes="[20, 50, 100, 200]" |
|||
:page-size="parseInt(pageSize)" |
|||
layout="sizes, prev, pager, next, total" |
|||
:total="total" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<el-dialog |
|||
v-if="showAdd" |
|||
:visible.sync="showAdd" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="addDiaTitle" |
|||
:modal-append-to-body="false" |
|||
width="720px" |
|||
top="5vh" |
|||
class="dialog-h" |
|||
@closed="showAdd = false" |
|||
> |
|||
<add-form |
|||
ref="ref_add_form" |
|||
@handleComfirm="handleComfirm" |
|||
@handleClose="handleClose" |
|||
></add-form> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { genderList, binaryOptionList } from "@/js/columns/constants"; |
|||
import nextTick from "dai-js/tools/nextTick"; |
|||
import { mapGetters } from "vuex"; |
|||
import axios from "axios"; |
|||
import addForm from "./addForm"; |
|||
// import detailForm from "./detailForm"; |
|||
// import editForm from "./editForm"; |
|||
|
|||
export default { |
|||
components: { addForm, }, |
|||
|
|||
data() { |
|||
let endDisabledDate = (time) => { |
|||
//这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
let nowData = Date.now(); |
|||
if (this.formData.serviceTimeStart) { |
|||
let serviceTimeStart = new Date(this.formData.serviceTimeStart); |
|||
return ( |
|||
time.getTime() < serviceTimeStart - 24 * 60 * 60 * 1000 || |
|||
time.getTime() === serviceTimeStart - 24 * 60 * 60 * 1000 |
|||
); |
|||
} else { |
|||
return time.getTime() > nowData || time.getTime() === nowData; |
|||
} |
|||
}; |
|||
// let startDisabledDate = (time) => { |
|||
// //这个关键属性我们一定要写在data的里面并且return的外面,这是动态改变区间的关键 |
|||
// let nowData = Date.now() - 24 * 60 * 60 * 1000; |
|||
// return time.getTime() < nowData; |
|||
// }; |
|||
|
|||
return { |
|||
tableLoading: false, |
|||
user: {}, |
|||
agencyId: "", |
|||
searchH: 170, |
|||
tableData: [], |
|||
genderList, |
|||
binaryOptionList, |
|||
formData: { |
|||
name: "", |
|||
idNum: "", |
|||
gender: "", |
|||
birthdayStart: "", |
|||
birthdayEnd: "", |
|||
cultureLevel: "", |
|||
postType: "", |
|||
hireDateFrom: "", |
|||
hireDateEnd: "" |
|||
}, |
|||
pageNo: 1, |
|||
pageSize: window.localStorage.getItem("pageSize") || 20, |
|||
total: 1, |
|||
endPickerOptions: { |
|||
disabledDate: endDisabledDate, |
|||
}, |
|||
startPickerOptions: { |
|||
// disabledDate: startDisabledDate |
|||
}, |
|||
|
|||
showAdd: false, |
|||
showEdit: false, |
|||
showDetail: false, |
|||
formType: "add", |
|||
addDiaTitle: "新增", |
|||
detailDiaTitle: "详情", |
|||
|
|||
multiSelection: [], // 多选结果 |
|||
importLoading: false, |
|||
|
|||
dicts: { |
|||
educationList: [], |
|||
nationList: [], |
|||
public_welfare_post_type:[] |
|||
}, //字典对象 |
|||
importCode:[], |
|||
dataList:[] |
|||
}; |
|||
}, |
|||
computed: { |
|||
maxTableHeight() { |
|||
const h = this.clientHeight - this.searchH - 330 + this.iframeHeight; |
|||
const _h = this.clientHeight - 330 - this.searchH; |
|||
return this.$store.state.inIframe ? h : _h; |
|||
}, |
|||
...mapGetters(["clientHeight", "iframeHeight"]), |
|||
}, |
|||
watch: {}, |
|||
async created() { |
|||
await this.getDicts(); |
|||
}, |
|||
mounted() { |
|||
console.log(this.$store.state); |
|||
this.user = this.$store.state.user; |
|||
this.agencyId = this.user.agencyId; |
|||
this.getTableData(); |
|||
}, |
|||
methods: { |
|||
// --------------------------------------字典------------------------------------------ |
|||
async getDicts() { |
|||
try { |
|||
const requests = [ |
|||
this.$http.post("sys/dict/data/nation", { |
|||
formCode: "resi_base_info", |
|||
}), |
|||
this.$http.post("sys/dict/data/education", { |
|||
formCode: "resi_base_info", |
|||
}), |
|||
this.$http.post("sys/dict/data/education", { |
|||
formCode: "public_welfare_post_type", |
|||
}), |
|||
|
|||
]; |
|||
const dictKeys = ["nationList", "educationList",'public_welfare_post_type']; // 对应的键名 |
|||
|
|||
const results = await Promise.all(requests); |
|||
results.forEach((result, index) => { |
|||
if (result.data.code === 0) { |
|||
this.dicts[dictKeys[index]].push(...result.data.data); |
|||
} else { |
|||
console.log(`获取${dictKeys[index]}失败: ${result.data.msg}`); |
|||
} |
|||
}); |
|||
} catch (error) { |
|||
console.log("获取字典失败: ", error); |
|||
} |
|||
}, |
|||
|
|||
binaryText(value){ |
|||
let text = '' |
|||
text = this.binaryOptionList.filter(item=>item.value == value)[0].label |
|||
return text || "--" |
|||
}, |
|||
// ------------------------------------事件------------------------------------------ |
|||
checkNumberInput(){ |
|||
if (isNaN(this.formData.retirementAmount)) { |
|||
this.$message.error('请输入数字'); |
|||
this.formData.retirementAmount = ''; |
|||
} else { |
|||
this.formData.retirementAmount = parseFloat(this.formData.retirementAmount); |
|||
} |
|||
}, |
|||
// 导入 |
|||
beforeExcelUpload(file) { |
|||
console.log("file", file); |
|||
const isType = file.type === "application/vnd.ms-excel"; |
|||
const isTypeComputer = |
|||
file.type === |
|||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; |
|||
const fileType = isType || isTypeComputer; |
|||
const isLt1M = file.size / 1024 / 1024 < 10; |
|||
if (!fileType) { |
|||
this.$message.error("上传文件只能是xls/xlsx格式!"); |
|||
} |
|||
|
|||
if (!isLt1M) { |
|||
this.$message.error("上传文件大小不能超过 10MB!"); |
|||
} |
|||
return fileType && isLt1M; |
|||
}, |
|||
|
|||
async uploadHttpRequest(file) { |
|||
this.$message({ |
|||
showClose: true, |
|||
dangerouslyUseHTMLString: true, |
|||
message: |
|||
"导入中,请到系统管理-<a id='clickA' style='cursor: pointer;'>导入记录</a>中查看进度", |
|||
duration: 3000, |
|||
}); |
|||
let than = this; |
|||
document.getElementById("clickA").addEventListener("click", function () { |
|||
than.$router.replace("/main/importRecord-index"); |
|||
}); |
|||
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|||
formData.append("file", file.file); //添加文件对象 |
|||
formData.append("fileMode",'SUBSISTENCE_ALLOWANCE'); |
|||
await this.$http |
|||
.post("/actual/base/importExcelData/extractExcelHead", formData) |
|||
.then((res) => { |
|||
const { metaListData, fileCode, msg } = res.data.data; |
|||
this.dataList = metaListData; |
|||
// 相等于在for循环中写filter过滤,这样写能够以 O(1) 的时间复杂度获取 itemGroupId 匹配的元素。 |
|||
this.importCode = fileCode; |
|||
this.handleComfirmUpload() |
|||
}) |
|||
.catch((err) => { |
|||
console.log("失败", err); |
|||
file.onError(); //上传失败的文件会从文件列表中删除 |
|||
// this.$message.error('导入失败') |
|||
});// |
|||
}, |
|||
async handleComfirmUpload () { |
|||
this.importLoading = true; |
|||
this.importBtnTitle = "正在上传中..."; |
|||
const { importOption, importCode, dataList } = this; |
|||
const formData = new FormData(); |
|||
formData.append("columnMateJson", JSON.stringify(dataList)); |
|||
formData.append("fileCode", importCode); |
|||
await this.$http |
|||
.post("/actual/base/importExcelData/importResiHouseExcel", formData) |
|||
.then((res) => { |
|||
console.log("res-up", res); |
|||
if (res.data.code == 0 && res.data.msg == "success") { |
|||
this.getTableData(); |
|||
} else this.$message.error(res.data.msg); |
|||
}) |
|||
.catch((err) => { |
|||
console.log("失败", err); |
|||
file.onError(); //上传失败的文件会从文件列表中删除 |
|||
}); |
|||
this.importLoading = false; |
|||
this.importBtnTitle = "导入"; |
|||
}, |
|||
// 搜索事件 |
|||
handleSearch(val) { |
|||
console.log(this.formData); |
|||
this.pageNo = 1; |
|||
this.getTableData(); |
|||
}, |
|||
|
|||
// 调出新增组件 |
|||
async handleAdd() { |
|||
this.addDiaTitle = "新增"; |
|||
this.formType = "add"; |
|||
this.showAdd = true; |
|||
}, |
|||
// 查看详情触发事件 |
|||
async handleDetail(row) { |
|||
this.addDiaTitle = "详情"; |
|||
this.formType = "detail"; |
|||
this.showAdd = true; |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_add_form.initForm("detail", row); |
|||
}); |
|||
}, |
|||
|
|||
// 编辑触发事件 |
|||
async handleEdit(row) { |
|||
this.showAdd = true; |
|||
this.$nextTick(() => { |
|||
this.$refs.ref_add_form.initForm("edit", row); |
|||
}); |
|||
}, |
|||
// 新增弹出框组件取消事件 |
|||
handleClose() { |
|||
this.formType = ""; |
|||
this.showAdd = false; |
|||
this.showEdit = false; |
|||
}, |
|||
// 新增弹出框组件确定事件 |
|||
handleComfirm() { |
|||
this.handleClose(); |
|||
this.pageNo = 1; |
|||
this.getTableData(); |
|||
}, |
|||
// 删除触发事件 |
|||
async handleDel(row) { |
|||
this.$confirm("确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning", |
|||
}) |
|||
.then(() => { |
|||
this.cancelFuwu([row.categorizedResiId]); |
|||
}) |
|||
.catch((err) => { |
|||
if (err == "cancel") { |
|||
// this.$message({ |
|||
// type: "info", |
|||
// message: "已取消删除" |
|||
// }); |
|||
} |
|||
}); |
|||
}, |
|||
// 删除处理 |
|||
async cancelFuwu(id) { |
|||
const url = "/actual/base/resiCategorized/publicWelfarePost/deleteBatch"; |
|||
const { data, code, msg } = await requestPost(url, id); |
|||
if (code === 0) { |
|||
this.$message.success("删除成功!"); |
|||
this.getTableData(); |
|||
} else { |
|||
this.$message.error("操作失败!"); |
|||
} |
|||
}, |
|||
// 获取列表 |
|||
async getTableData() { |
|||
this.tableLoading = true; |
|||
const url = "/actual/base/resiCategorized/publicWelfarePost/page"; |
|||
|
|||
const { pageSize, pageNo, formData } = this; |
|||
const { data, code, msg } = await requestPost(url, { |
|||
pageSize, |
|||
pageNo, |
|||
...formData, |
|||
}); |
|||
this.tableLoading = false; |
|||
if (code === 0) { |
|||
this.total = data.total || 0; |
|||
this.tableData = data.list; |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
|
|||
// 导出 |
|||
async handleExport() { |
|||
const url = "/actual/base/resiCategorized/publicWelfarePost/export"; |
|||
const { pageSize, pageNo, formData } = this; |
|||
axios({ |
|||
url: window.SITE_CONFIG["apiURL"] + url, |
|||
method: "post", |
|||
data: { |
|||
pageSize, |
|||
pageNo, |
|||
...formData, |
|||
}, |
|||
responseType: "blob", |
|||
}) |
|||
.then((res) => { |
|||
let fileName = window.decodeURI( |
|||
res.headers["content-disposition"].split(";")[1].split("=")[1] |
|||
); |
|||
console.log("filename", fileName); |
|||
let blob = new Blob([res.data], { |
|||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
|||
}); |
|||
var url = window.URL.createObjectURL(blob); |
|||
var aLink = document.createElement("a"); |
|||
aLink.style.display = "none"; |
|||
aLink.href = url; |
|||
aLink.setAttribute("download", fileName); |
|||
document.body.appendChild(aLink); |
|||
aLink.click(); |
|||
document.body.removeChild(aLink); //下载完成移除元素 |
|||
window.URL.revokeObjectURL(url); //释放掉blob对象 |
|||
}) |
|||
.catch((err) => { |
|||
console.log("获取导出情失败", err); |
|||
return this.$message.error("网络错误"); |
|||
}); |
|||
}, |
|||
// 下载模板 |
|||
async handleExportModule() { |
|||
let url = "/actual/base/resiCategorized/publicWelfarePost/downloadImportTemplate"; |
|||
let params = {}; |
|||
await this.$http({ |
|||
method: "get", |
|||
url, |
|||
responseType: "blob", |
|||
data: params, |
|||
}) |
|||
.then((res) => { |
|||
console.log("res----dddd", res); |
|||
// this.download(res.data, title + '.xls') |
|||
if (res.headers["content-disposition"]) { |
|||
let fileName = window.decodeURI( |
|||
res.headers["content-disposition"].split(";")[1].split("=")[1] |
|||
); |
|||
console.log("filename", fileName); |
|||
let blob = new Blob([res.data], { |
|||
type: "application/vnd.ms-excel", |
|||
}); |
|||
var url = window.URL.createObjectURL(blob); |
|||
var aLink = document.createElement("a"); |
|||
aLink.style.display = "none"; |
|||
aLink.href = url; |
|||
aLink.setAttribute("download", fileName); |
|||
document.body.appendChild(aLink); |
|||
aLink.click(); |
|||
document.body.removeChild(aLink); //下载完成移除元素 |
|||
window.URL.revokeObjectURL(url); //释放掉blob对象 |
|||
} else this.$message.error("下载失败"); |
|||
}) |
|||
.catch((err) => { |
|||
console.log("err", err); |
|||
return this.$message.error("网络错误"); |
|||
}); |
|||
}, |
|||
// 分页 |
|||
handleSizeChange(val) { |
|||
this.pageSize = val; |
|||
window.localStorage.setItem("pageSize", val); |
|||
this.getTableData(); |
|||
}, |
|||
|
|||
// 分页 |
|||
handleCurrentChange(val) { |
|||
this.pageNo = val; |
|||
this.getTableData(); |
|||
}, |
|||
// 重置 |
|||
resetSearch() { |
|||
this.formData = {}; |
|||
|
|||
this.pageNo = 1; |
|||
this.getTableData(); |
|||
}, |
|||
// 多选事件 |
|||
onMultiSelection(rows) { |
|||
this.multiSelection = rows; |
|||
}, |
|||
|
|||
// 批量删除 |
|||
onDeleteBatch() { |
|||
if (this.multiSelection.length == 0) { |
|||
this.$message.warning("请先选中至少一项"); |
|||
return; |
|||
} |
|||
|
|||
this.$confirm("删除之后无法恢复,确认删除?", "提示", { |
|||
confirmButtonText: "确定", |
|||
cancelButtonText: "取消", |
|||
type: "warning", |
|||
}) |
|||
.then(() => { |
|||
this.cancelFuwu(this.multiSelection.map((e) => e.categorizedResiId)); |
|||
}) |
|||
.catch((err) => { |
|||
console.error(err); |
|||
this.$message.error("删除失败"); |
|||
}); |
|||
}, |
|||
}, |
|||
|
|||
props: {}, |
|||
}; |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/assets/scss/buttonstyle.scss"; |
|||
@import "@/assets/scss/modules/management/list-main.scss"; |
|||
@import "@/assets/scss/modules/shequzhili/event-info.scss"; |
|||
.div_btn_left > * { |
|||
margin-right: 10px; |
|||
} |
|||
</style> |
|||
|
|||
|
Loading…
Reference in new issue