This commit is contained in:
@jyuhsin
2025-09-24 20:00:07 +08:00
parent 45888897b4
commit 5730478c79
2 changed files with 389 additions and 61 deletions
@@ -1,19 +1,167 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.search-other {
display: flex;
align-items: center;
margin-top: 20px;
}
.search-other-label {
width: 90px;
min-width: 90px;
color: rgb(100, 100, 100);
margin-right: 10px;
flex-shrink: 0;
}
.search-other > div {
display: flex;
flex-wrap: wrap;
align-items: center;
margin-bottom: -6px;
}
.search-other .el-tag {
margin-right: 10px;
margin-bottom: 6px;
cursor: pointer;
}
.search-other .el-link {
margin-bottom: 6px;
margin-right: 10px;
}
.popover-container {
display: flex;
align-items: center;
line-height: 22px;
}
.popover-icon {
margin-right: 6px;
}
.popover-icon-waning {
color: #e6a23c;
font-size: 24px !important;
font-family: element-icons !important;
}
.popover-icon-waning:before {
content: "\e7a3";
}
.popover-footer {
text-align: right;
margin-top: 20px;
}
.el-popover__reference:nth-of-type(1) {
margin-left: 10px;
margin-right: 5px;
}
</style>
<div id="app">
<guava ref="guava">
<el-card shadow="never">
<common-query ref="commonQueryRef" @search="search"></common-query>
</el-card>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="工号开头">
<el-input v-model="pageForm.startLoginNames" maxLength="100"
placeholder="多个请用英文逗号分隔"></el-input>
</search-item>
<search-item label="工号结尾">
<el-input v-model="pageForm.endLoginNames" maxLength="100"
placeholder="多个请用英文逗号分隔"></el-input>
</search-item>
</search>
<div class="search-other mt20">
<div class="search-other-label">人员类型</div>
<div>
<el-tag
style="margin-right: 10px;cursor: pointer"
v-for="item in dict.type.USER_PERSON_TYPE"
:key="item.code"
:type="item.name"
:effect="pageForm.personTypes.includes(item.name)?'dark':'plain'"
@click="tagClick('personTypes',item.name)">
{{ item.name }}
</el-tag>
<el-link type="danger"
v-if="dict.type.USER_PERSON_TYPE?.length && pageForm.personTypes.length"
:underline="false"
@click="pageForm.personTypes=[]; doSearch()">清空
</el-link>
<el-link :underline="false"
@click="pageForm.personTypes = dict.type.USER_PERSON_TYPE?.map(p=>p.code); doSearch()"
type="success">全部
</el-link>
</div>
</div>
<div class="search-other mt20">
<div class="search-other-label">在职状态</div>
<div>
<el-tag
style="margin-right: 10px;cursor: pointer"
v-for="item in dict.type.USER_STATE"
:key="item.code"
:type="item.name"
:effect="pageForm.userStates.includes(item.name)?'dark':'plain'"
@click="tagClick('userStates',item.name)">
{{ item.name }}
</el-tag>
<el-link type="danger"
v-if="dict.type.USER_STATE?.length && pageForm.userStates.length"
:underline="false"
@click="pageForm.userStates=[]; doSearch()">清空
</el-link>
<el-link :underline="false"
@click="pageForm.userStates = dict.type.USER_STATE?.map(p=>p.code); doSearch()"
type="success">全部
</el-link>
</div>
</div>
</el-card>
<el-card shadow="never" class="mt10">
<table-tool label="数据列表"></table-tool>
<table-tool label="数据列表">
<el-button size="mini" icon="el-icon-s-tools" type="primary" @click="onBirthday">根据身份证设置生日</el-button>
<el-popover
v-for="item in popoverConfigs"
:key="item.text"
placement="left"
width="360"
title="温馨提醒"
v-model="item.visible">
<div class="popover-container">
<div class='popover-icon popover-icon-waning'></div>
<div>
<p>
<i class='el-icon-s-help' style='margin-right: 6px;'></i>
<span>如果先清空已有数据,后更新,请选择</span>
<span style='color: red'>更新</span>
<span style='font-weight: bolder'>(这将清空目前所有的会员,请谨慎操作!)</span>
</p>
<p class="mt5">
<i class='el-icon-s-help' style='margin-right: 6px;'></i>
<span>如果追加或更新数据,请选择</span>
<span style='color: red'>追加</span>
</p>
</div>
</div>
<div class="popover-footer">
<el-button size="mini" type="text" @click="item.visible = false">取消</el-button>
<el-button type="warning" size="mini" @click="handlePopoverAction(item, true)">追加</el-button>
<el-button type="primary" size="mini" @click="handlePopoverAction(item, false)">更新</el-button>
</div>
<el-button slot="reference" size="mini" icon="el-icon-s-tools" type="primary">{{ item.text }}</el-button>
</el-popover>
</table-tool>
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" ref="table" row-key="id" style="width: 100%">
<el-table-column :index="indexMethod" align="center" header-align="center"
label="序号" type="index" width="80px"></el-table-column>
<el-table-column :label="column.label"
:prop="column.prop"
:key="column.prop"
:sortable="column.sortable"
:width="column.width"
header-align="center"
@@ -21,28 +169,39 @@ layout("/layouts/platform.html"){
show-overflow-tooltip
v-for="column in tableColumns">
</el-table-column>
<el-table-column label="操作" fixed="right" width="200px">
<el-table-column label="操作" fixed="right" width="100">
<template slot-scope="{row}">
<el-button @click="openView(row)" size="mini" type="primary">查看</el-button>
<el-button @click="singleMake(row)" size="mini" type="primary">设置为会员</el-button>
<el-button @click="onView(row)" size="mini" type="primary">查看</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
<template #view>
<member-info ref="memberInfoRef"></member-info>
</template>
</guava>
</div>
<script>
<!--#include("../../common/info/memberInfo.js"){}#-->
<!--#include("../common/commonQuery.js"){}#-->
new Vue({
el: "#app",
store,
mixins: [initTableMixins],
components: {
'member-info': MEMBER_INFO,
'common-query': COMMON_QUERY,
},
dicts: ['USER_PERSON_TYPE', 'USER_STATE'],
data() {
return {
pageForm: {},
visible: false,
pageForm: {
personTypes: [],
userStates: [],
},
tableColumns: [
{ prop: "loginName", label: "工号", sortable: true },
{ prop: "userName", label: "姓名", sortable: true },
@@ -52,16 +211,95 @@ layout("/layouts/platform.html"){
{ prop: "preparedBy", label: "编制类型", sortable: true },
{ prop: "unionName", label: "所属工会", sortable: true },
{ prop: "unitName", label: "所属单位", sortable: true },
]
],
personTypeOptions: [],
popoverConfigs: [
{text: '设置会员', func: this.onMember, visible: false},
{text: '设置福利会员', func: this.onWelfare, visible: false},
],
}
},
methods: {
handlePopoverAction(item, isAppend) {
item.func(isAppend)
item.visible = false
document.activeElement.blur()
},
onBirthday() {
this.$confirm("您确定要根据身份证号设置出生日期吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$axios.post("/platform/member/info/dataManage/setBirthdayByIdCard").then((res) => {
if (res.code === 0) {
this.pageData()
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
})
})
},
onMember(append) {
const pageForm = clone(this.pageForm)
pageForm.personTypes = JSON.stringify(pageForm.personTypes)
pageForm.userStates = JSON.stringify(pageForm.userStates)
pageForm.append = append
this.$axios.post("/platform/member/info/dataManage/setMemberByCnd").then((res) => {
if (res.code === 0) {
this.pageData()
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
})
},
onWelfare(append) {
const pageForm = clone(this.pageForm)
pageForm.personTypes = JSON.stringify(pageForm.personTypes)
pageForm.userStates = JSON.stringify(pageForm.userStates)
pageForm.append = append
this.$axios.post("/platform/member/info/dataManage/setWelfareMemberByCnd").then((res) => {
if (res.code === 0) {
this.pageData()
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
})
},
onView(row) {
this.$refs.guava.view(() => {
this.$refs.memberInfoRef.onOpen(row.id)
})
},
tagClick(key, val) {
const index = this.pageForm[key]?.findIndex(v => v === val)
if (index > -1) {
this.pageForm[key].splice(index, 1)
} else {
this.pageForm[key].push(val)
}
this.doSearch()
},
search(pageForm) {
if (pageForm) {
this.pageForm = {...this.pageForm, ...pageForm}
}
this.doSearch()
},
pageData() {
const pageForm = clone(this.pageForm)
pageForm.personTypes = JSON.stringify(pageForm.personTypes)
pageForm.userStates = JSON.stringify(pageForm.userStates)
this.$axios.post(loc() + "/pageData", pageForm).then((res) => {
if (res.code === 0) {
this.tableData = res.data.list
this.pageForm.totalCount = res.data.totalCount
}
})
},
},
created() {
this.pageData()