276 lines
12 KiB
HTML
276 lines
12 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
|
|
<style>
|
|
.el-input-group {
|
|
width: auto;
|
|
}
|
|
|
|
.el-input {
|
|
width: auto;
|
|
}
|
|
|
|
.user_body .el-card__body {
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
|
|
<div id="app" v-cloak>
|
|
<guava ref="guava">
|
|
|
|
<el-card shadow="never">
|
|
|
|
<div class="search">
|
|
<div class="search-item">
|
|
<div class="search-item-label">年  度:</div>
|
|
<div class="search-item-option">
|
|
<el-date-picker
|
|
style="width: 100%"
|
|
placeholder="选择年度"
|
|
type="year" disabled
|
|
v-model="pageForm.year"
|
|
value-format="yyyy">
|
|
</el-date-picker>
|
|
</div>
|
|
</div>
|
|
<div class="search-item">
|
|
<div class="search-item-label">项目名称:</div>
|
|
<div class="search-item-option">
|
|
<el-select v-model="pageForm.projectId" placeholder="请选择项目名称" filterable
|
|
@change="doSearch" style="width: 100%">
|
|
<el-option
|
|
v-for="item in projectList"
|
|
:key="item.code"
|
|
:label="item.name"
|
|
:value="item.code">
|
|
</el-option>
|
|
</el-select>
|
|
</div>
|
|
</div>
|
|
<div class="search-item">
|
|
<div class="search-item-label">近两年内:</div>
|
|
<div class="search-item-option">
|
|
<el-radio-group @change="(val) => doSearch()" v-model="pageForm.isBuy">
|
|
<el-radio-button :label="true">已购买</el-radio-button>
|
|
<el-radio-button :label="false">未购买</el-radio-button>
|
|
</el-radio-group>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-card>
|
|
|
|
<el-card class="user_body" shadow="never" style="margin-top: 10px; height: calc(100vh - 170px);">
|
|
|
|
<tree-layout>
|
|
<template #tree>
|
|
<div style="padding: 0 20px;border-right: 2px solid rgb(240,240,240);">
|
|
<el-input
|
|
placeholder="输入关键字进行查找"
|
|
v-model="filterText" clearable>
|
|
</el-input>
|
|
</div>
|
|
|
|
<el-tree :data="treeUnionList" ref="tree" :expand-on-click-node="false" class="v-tree"
|
|
:props="defaultProps"
|
|
default-expand-all
|
|
@node-click="handleNodeClick" :filter-node-method="filterNode"
|
|
highlight-current style="padding: 10px 0">
|
|
<div class="custom-tree-node" style="display: inline-block;"
|
|
slot-scope="{ node, data }">
|
|
|
|
<div v-if="node.level === 1" style="font-size: 16px;" class="v-node">
|
|
<i class="el-icon-office-building"></i>
|
|
{{ data.unionname }}
|
|
</div>
|
|
|
|
<div v-if="node.level==2" style="font-size: 15px" :title="data.unionname" class="v-node">
|
|
<i class="el-icon-school"></i>
|
|
{{ data.unionname }}
|
|
</div>
|
|
|
|
</div>
|
|
</el-tree>
|
|
</template>
|
|
<template>
|
|
<div style="padding: 0px 20px">
|
|
<div>
|
|
<vi-title2 :title="(pageForm.isBuy ? '已购买' : '未购买') + '人员名单'">
|
|
<template slot="func">
|
|
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
|
|
@keyup.enter.native="doSearch">
|
|
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
|
|
style="width: 120px;">
|
|
<el-option label="姓名" value="u.username"></el-option>
|
|
<el-option label="工号" value="u.loginname"></el-option>
|
|
</el-select>
|
|
</el-input>
|
|
<el-select @change="doSearch" filterable clearable v-model="pageForm.sex" placeholder="请选择性别">
|
|
<el-option label="男" value="男"></el-option>
|
|
<el-option label="女" value="女"></el-option>
|
|
</el-select>
|
|
</template>
|
|
</vi-title2>
|
|
</div>
|
|
<el-table ref="multipleTable" @selection-change="handleSelectionChange" :data="userData" max-height="600"
|
|
:row-key="(val) => val.id">
|
|
<el-table-column :reserve-selection="true" type="selection" width="55"></el-table-column>
|
|
<el-table-column label="姓名" prop="username" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="工号" prop="loginname" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="性别" prop="sex" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="单位" prop="unitname" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="所属工会" prop="unionname" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="联系方式" prop="mobile" align="center" header-align="center" show-overflow-tooltip></el-table-column>
|
|
</el-table>
|
|
<div style="display: flex; justify-content: space-between; margin-top: 6px">
|
|
<div> <!--#include("/layouts/pagination.html"){}#--></div>
|
|
<div>
|
|
<el-row justify="end" type="flex">
|
|
<el-button v-if="!pageForm.isBuy" @click="doHandler" type="primary">提交</el-button>
|
|
<el-button v-else @click="doHandler" type="danger">移除</el-button>
|
|
</el-row>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</tree-layout>
|
|
|
|
</el-card>
|
|
</guava>
|
|
</div>
|
|
|
|
<script>
|
|
const vue = new Vue({
|
|
el: '#app',
|
|
mixins: [initTableMixins],
|
|
components: {
|
|
'tree-layout': httpVueLoader('/components/plugins/TreeLayout.vue'),
|
|
},
|
|
watch: {
|
|
filterText(val) {
|
|
this.$refs.tree.filter(val);
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
pageForm: {
|
|
year: moment().format('YYYY'),
|
|
isBuy: false,
|
|
searchName: 'u.username'
|
|
},
|
|
projectList: [],
|
|
userData: [],
|
|
userValue: [],
|
|
treeUnionList: [],
|
|
filterText: '',
|
|
defaultProps: {
|
|
children: 'childrens',
|
|
label: 'unionname',
|
|
disabled: 'disabled'
|
|
},
|
|
}
|
|
},
|
|
methods: {
|
|
handleSelectionChange(val) {
|
|
this.userValue = val.length > 0 ? val.map(o => o.id) : []
|
|
},
|
|
filterNode(value, data, node) {
|
|
if (!value || node.level === 1) return true;
|
|
return data.unionname.indexOf(value) !== -1
|
|
},
|
|
handleNodeClick(data, node) {
|
|
if (node.level === 1 && "${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')}" !== 'true') {
|
|
return
|
|
}
|
|
if (data) {
|
|
this.pageForm.unionId = data.unioncode
|
|
this.pageData()
|
|
}
|
|
},
|
|
async doHandler() {
|
|
if(!this.pageForm.projectId) {
|
|
this.notifyWarning('请选择项目!')
|
|
return
|
|
}
|
|
if(this.userValue.length === 0) {
|
|
this.notifyWarning('请选择人员!')
|
|
return
|
|
}
|
|
const confirm = await this.$confirm('您选择了' + this.userValue.length + '人, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
if (confirm === "confirm") {
|
|
const resp = await $.post('/platform/clothing/register/doHandler', {
|
|
ids: JSON.stringify(this.userValue),
|
|
projectId: this.pageForm.projectId,
|
|
year: this.pageForm.year,
|
|
isBuy: this.pageForm.isBuy,
|
|
})
|
|
if(resp.code === 0) {
|
|
this.doSearch()
|
|
this.notifySuccess(resp.msg)
|
|
} else {
|
|
this.notifyWarning(resp.msg)
|
|
}
|
|
}
|
|
},
|
|
doSearch() {
|
|
this.$refs.multipleTable.clearSelection()
|
|
this.pageData()
|
|
},
|
|
//查询人员名单
|
|
async pageData() {
|
|
const resp = await $.post('/platform/clothing/register/pageData', this.pageForm)
|
|
if (resp.code === 0) {
|
|
this.userData = resp.data.list
|
|
this.pageForm.totalCount = resp.data.totalCount
|
|
} else {
|
|
this.$message.error(resp.msg)
|
|
}
|
|
},
|
|
//获取所有买服装的项目
|
|
async getBuyClothesProject() {
|
|
const {data} = await $.post('/platform/clothing/register/getBuyClothesProject')
|
|
return data
|
|
},
|
|
async unionTree() {
|
|
const resp = await $.post('/platform/clothing/register/getTreeUnionList')
|
|
if(resp.code === 0) {
|
|
this.sysadmin = resp.data.sysadmin
|
|
this.treeUnionList = [resp.data]
|
|
if (this.sysadmin) {
|
|
this.handleNodeClick({unioncode: ''}, {level: 1})
|
|
} else {
|
|
let data;
|
|
if (resp.data.childrens === null || resp.data.childrens === undefined) {
|
|
data = {
|
|
unioncode: ''
|
|
}
|
|
} else {
|
|
data = {
|
|
unioncode: Array.isArray(resp.data.childrens) ? resp.data.childrens[0].unioncode : resp.data.childrens.unioncode
|
|
}
|
|
}
|
|
this.handleNodeClick(data, {
|
|
level: 2, data: data
|
|
})
|
|
}
|
|
}
|
|
},
|
|
},
|
|
async created() {
|
|
this.projectList = await this.getBuyClothesProject()
|
|
if (this.projectList && this.projectList.length > 0) {
|
|
this.pageForm.projectId = this.projectList[0].code
|
|
}
|
|
await this.unionTree()
|
|
this.pageData()
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<!--#
|
|
}
|
|
#--> |