first commit
This commit is contained in:
@@ -0,0 +1,284 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
|
||||
<div id="app" v-cloak>
|
||||
<guava ref="guava">
|
||||
<template>
|
||||
<el-card shadow="never">
|
||||
<search @search="doSearch">
|
||||
<search-item label="所属年份">
|
||||
<el-date-picker
|
||||
:clearable="false"
|
||||
@change="getWelfareList"
|
||||
placeholder="所属年份"
|
||||
style="width: 100%"
|
||||
type="year"
|
||||
v-model="pageForm.year"
|
||||
value-format="yyyy"
|
||||
></el-date-picker>
|
||||
</search-item>
|
||||
|
||||
<search-item label="福利项目">
|
||||
<el-select
|
||||
:clearable="false"
|
||||
@change="doSearch"
|
||||
filterable
|
||||
placeholder="请选择福利项目"
|
||||
style="width: 100%"
|
||||
v-model="pageForm.benefitId"
|
||||
>
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in projectSelectOptions"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="所属工会" v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN','SCHOOL_UNION_WELFARE_ADMIN'])">
|
||||
<el-select clearable filterable placeholder="所属工会" style="width: 100%" v-model="pageForm.unionId">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in unions"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
<el-card shadow="never">
|
||||
<table-tool label="福利统计">
|
||||
<el-button
|
||||
@click="openExportSummary"
|
||||
icon="el-icon-download"
|
||||
size="small"
|
||||
type="primary"
|
||||
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN','SCHOOL_UNION_WELFARE_ADMIN'])"
|
||||
>
|
||||
导出汇总表
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="openSelectByAdmin"
|
||||
icon="el-icon-download"
|
||||
size="small"
|
||||
type="primary"
|
||||
v-if="$auth.hasRoleOr(['SYSADMIN', 'SCHOOL_UNION_ADMIN','SCHOOL_UNION_WELFARE_ADMIN'])"
|
||||
>
|
||||
管理员代选择
|
||||
</el-button>
|
||||
</table-tool>
|
||||
<el-table
|
||||
:data="tableData"
|
||||
:size="tableSize"
|
||||
@sort-change="pageOrder"
|
||||
class="vi-table"
|
||||
lazy
|
||||
ref="table"
|
||||
row-key="id"
|
||||
show-summary
|
||||
style="width: 100%"
|
||||
v-if="tableData&&tableData.length>0"
|
||||
>
|
||||
<el-table-column type="index" width="50"></el-table-column>
|
||||
<el-table-column
|
||||
:key="column.prop"
|
||||
:label="column.label"
|
||||
:prop="column.prop"
|
||||
:sortable="column.sortable"
|
||||
:width="column.width"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
v-for="column in tableColumns"
|
||||
>
|
||||
<template v-if="column.isHasChildren">
|
||||
<el-table-column
|
||||
:key="column2.id"
|
||||
:label="column2.name"
|
||||
:prop="column2.name"
|
||||
v-for="column2 in column.benefitGoodsSpecificationsList"
|
||||
></el-table-column>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</template>
|
||||
</guava>
|
||||
|
||||
<el-dialog :visible.sync="selectByAdminDialogVisible" title="管理员统一选择福利" width="35%">
|
||||
<el-form label-position="right" label-width="120px">
|
||||
<el-form-item label="福利选项">
|
||||
<el-row :gutter="10" :key="goods.id" style="margin: 10px" v-for="(goods,index) in benefitGoodsList">
|
||||
<el-col :span="16">
|
||||
<el-tag style="height: 40px; line-height: 40px; width: 90%">
|
||||
<div style="white-space: nowrap; display: flex; justify-content: center">
|
||||
<el-tooltip :content="goods.name+' '+goods.money+'积分'" placement="top">
|
||||
<span style="text-overflow: ellipsis; overflow: hidden">{{goods.name}} {{goods.money}}积分</span>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</el-tag>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-input-number :min="0" style="width: 100%" v-model="goods.selectNum"></el-input-number>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="goods.benefitGoodsSpecificationsList&&goods.benefitGoodsSpecificationsList.length>0&&goods.selectNum>0">
|
||||
<el-radio-group size="small" v-model="goods.specificationsId">
|
||||
<el-radio
|
||||
:key="specifications.id"
|
||||
:label="specifications.id"
|
||||
border
|
||||
v-for="specifications in goods.benefitGoodsSpecificationsList"
|
||||
>
|
||||
{{specifications.name}}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-col>
|
||||
<el-col :span="24" style="padding-top: 10px" v-if="goods.goodsProvideMode==='GOODS_PROVIDE_MODE_SHOP'&&goods.selectNum>0">
|
||||
<el-select filterable placeholder="请选择收货门店" style="width: 100%" v-model="goods.shopAddress">
|
||||
<el-option :key="item.id" :label="item.name" :value="item.name" v-for="(item,index) in goods.shopAddressList"></el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-alert class="text-primary mb10">给没有选择的福利人员统一代选择</el-alert>
|
||||
<el-row class="mt10" justify="end" type="flex">
|
||||
<el-button @click="selectByAdminDialogVisible=false">取消</el-button>
|
||||
<el-button @click="doSelectByAdmin" type="primary">提交</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
||||
<script nonce="${cspNonce!}">
|
||||
new Vue({
|
||||
el: "#app",
|
||||
mixins: [initTableMixins],
|
||||
data() {
|
||||
return {
|
||||
projectSelectOptions: [],
|
||||
unions: [],
|
||||
benefitGoodsList: [],
|
||||
selectByAdminDialogVisible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
viewBenefitGoodsList() {
|
||||
if (this.pageForm.benefitId) {
|
||||
const benefitInfo = this.projectSelectOptions.find((v) => v.id === this.pageForm.benefitId)
|
||||
if (benefitInfo) {
|
||||
return benefitInfo.benefitGoodsList
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
},
|
||||
benefitInfo() {
|
||||
if (this.pageForm.benefitId) {
|
||||
const benefitInfo = this.projectSelectOptions.find((v) => v.id === this.pageForm.benefitId)
|
||||
if (benefitInfo) {
|
||||
return benefitInfo
|
||||
}
|
||||
return null
|
||||
}
|
||||
return null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openSelectByAdmin() {
|
||||
this.benefitGoodsList = clone(this.viewBenefitGoodsList)
|
||||
this.selectByAdminDialogVisible = true
|
||||
},
|
||||
doSelectByAdmin() {
|
||||
let totalMoney = 0
|
||||
const benefitGoodsList = this.benefitGoodsList.filter((b) => b.selectNum > 0)
|
||||
benefitGoodsList.map((b) => {
|
||||
totalMoney = totalMoney + b.selectNum * b.money
|
||||
})
|
||||
if (totalMoney === 0) {
|
||||
this.$message.warning("请选择后再提交!")
|
||||
return
|
||||
}
|
||||
|
||||
if (totalMoney !== this.benefitInfo.totalMoney) {
|
||||
this.$message.warning("本次福利积分【" + this.benefitInfo.totalMoney + "】请检查商品数量!")
|
||||
return
|
||||
}
|
||||
let flag = false
|
||||
let msg = ""
|
||||
benefitGoodsList.some((b) => {
|
||||
if (b.benefitGoodsSpecificationsList && b.benefitGoodsSpecificationsList.length > 0 && !b.specificationsId) {
|
||||
flag = true
|
||||
msg = "商品中存在未填写的规格,请检查!"
|
||||
return true
|
||||
}
|
||||
if (b.shopAddressList && b.shopAddressList.length > 0 && !b.shopAddress) {
|
||||
flag = true
|
||||
msg = "商品中存在未填写的门店地址,请检查!"
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
if (flag) {
|
||||
this.$message.warning(msg)
|
||||
return
|
||||
}
|
||||
|
||||
this.$confirm("请确定是否给未选择的教职工一键选择当前福利?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(async () => {
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
text: "Loading",
|
||||
spinner: "el-icon-loading",
|
||||
background: "rgba(0, 0, 0, 0.7)"
|
||||
})
|
||||
const resp = await this.$axios.post("/platform/benefit/statistics/doSetAllBenefit", {
|
||||
benefitId: this.pageForm.benefitId,
|
||||
benefitGoodsList: JSON.stringify(benefitGoodsList)
|
||||
})
|
||||
loading.close()
|
||||
if (resp.code === 0) {
|
||||
await this.pageData()
|
||||
this.selectByAdminDialogVisible = false
|
||||
this.$message.success(resp.msg)
|
||||
} else {
|
||||
this.notifyWarning(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
openExportSummary() {
|
||||
if (!this.pageForm.benefitId) {
|
||||
this.$message.warning("请选择要导出的福利")
|
||||
return
|
||||
}
|
||||
this.$downLoad("/platform/benefit/statistics/openExportSummary", this.pageForm)
|
||||
},
|
||||
getWelfareList() {
|
||||
this.$set(this.pageForm, "benefitId", "")
|
||||
this.$axios.post("/platform/benefit/statistics/getBenefitList", { year: this.pageForm.year }).then((res) => {
|
||||
this.projectSelectOptions = res.data
|
||||
if (res.data && res.data.length > 0) {
|
||||
this.$set(this.pageForm, "benefitId", res.data[0].id)
|
||||
}
|
||||
this.pageData()
|
||||
})
|
||||
},
|
||||
async pageData() {
|
||||
this.tableLoading = true
|
||||
const resp = await this.$axios.post("/platform/benefit/statistics/pageData", this.pageForm)
|
||||
if (resp.code === 0) {
|
||||
this.tableColumns = [
|
||||
{
|
||||
prop: "name",
|
||||
label: "所属工会",
|
||||
width: "300"
|
||||
}
|
||||
].concat(resp.data.tableColumn)
|
||||
this.tableData = resp.data.tableList
|
||||
}
|
||||
this.tableLoading = false
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
this.getWelfareList()
|
||||
this.unions = await this.$businessTool.listUnion()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user