经费预审系统

This commit is contained in:
2025-04-10 09:50:26 +08:00
parent 2f99a7f06b
commit 71f1c4162d
8 changed files with 1153 additions and 0 deletions
@@ -0,0 +1,101 @@
package io.v.nutz.reimbursementPreAudit.controller;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.Audit;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.reimbursementPreAudit.models.ReimbursementPreAudit;
import io.v.nutz.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* @ClassName preAuditManageController
* @Description 我的预审管理
* @Version 1.0
* @Author zhf
* @Date 2025/4/9 下午2:04
*/
@At("/platform/reimbursementPreAudit/manage")
@Ok("json:full")
@IocBean
public class preAuditManageController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/reimbursementPreAudit/manage.html")
@RequiresPermissions("reimbursementPreAudit.manage")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("reimbursementPreAudit.manage")
public Object pageData(PageForm pageForm, String year, String notes) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT * FROM `reimbursement_pre_audit` $condition
""");
cnd.andEX("YEAR(applyDate)", "=", year);
cnd.andEX("userId", "=", ShiroUtil.getUserId());
cnd.desc("applyDate").desc("opAt");
if (StrUtil.isNotEmpty(notes)) {
cnd.andEX("notes", "like", "%" + notes + "%");
}
if (StrUtil.isAllNotEmpty(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
}
sql.setCondition(cnd);
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@RequiresPermissions("reimbursementPreAudit.manage")
public Object doDelete(String id) {
baseService.dao().delete(ReimbursementPreAudit.class, id);
return null;
}
@At
@ViReturn
@RequiresPermissions("reimbursementPreAudit.manage")
public Object doSubmit(@Param("preAudit") ReimbursementPreAudit preAudit, Boolean flag) {
preAudit.setUserId(ShiroUtil.getUserId());
preAudit.setUnitId(ShiroUtil.getUnitId());
preAudit.setUnionId(Vi.getUnionId());
preAudit.setAuditState(flag ? 1 : 0);
baseService.insertOrUpdate(preAudit);
return null;
}
@At
@ViReturn
public Object findOne(String id) {
Sql sql = Sqls.create("""
SELECT * FROM `reimbursement_pre_audit` WHERE id=@id
""").setParam("id", id);
sql.setCallback(Sqls.callback.map());
baseService.dao().execute(sql);
NutMap info = (NutMap) sql.getResult();
info.put("auditInfo", baseService.dao().fetch(Audit.class, Cnd.where("id", "=", info.getString("auditId"))));
return info;
}
}
@@ -0,0 +1,59 @@
package io.v.nutz.reimbursementPreAudit.controller;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @ClassName preAuditQueryController
* @Description TODO
* @Author zhf
* @Date 2025/4/10 上午9:13
*/
@At("/platform/reimbursementPreAudit/query")
@Ok("json:full")
@IocBean
public class preAuditQueryController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/reimbursementPreAudit/query.html")
@RequiresPermissions("reimbursementPreAudit.query")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("reimbursementPreAudit.manage")
public Object pageData(PageForm pageForm, String startDate, String endDate, String notes) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT * FROM `reimbursement_pre_audit` $condition
""");
cnd.andEX("applyDate", ">=", startDate);
cnd.andEX("applyDate", "<=", endDate);
cnd.andEX("userId", "=", ShiroUtil.getUserId());
cnd.andEX("auditState", "=", 3);
cnd.desc("applyDate").desc("opAt");
if (StrUtil.isNotEmpty(notes)) {
cnd.andEX("notes", "like", "%" + notes + "%");
}
if (StrUtil.isAllNotEmpty(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
}
sql.setCondition(cnd);
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
}
@@ -0,0 +1,81 @@
package io.v.nutz.reimbursementPreAudit.controller;
import cn.hutool.core.util.StrUtil;
import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.service.BaseService;
import io.v.nutz.modules.models.Audit;
import io.v.nutz.modules.models.PageForm;
import io.v.nutz.reimbursementPreAudit.models.ReimbursementPreAudit;
import io.v.nutz.util.ShiroUtil;
import io.v.nutz.web.commons.slog.annotation.SLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
/**
* @ClassName preAuditController
* @Description TODO
* @Author zhf
* @Date 2025/4/9 下午4:46
*/
@At("/platform/reimbursementPreAudit/audit")
@Ok("json:full")
@IocBean
public class preAuditSchoolController {
@Inject
private BaseService baseService;
@At("")
@Ok("beetl:/platform/reimbursementPreAudit/audit.html")
@RequiresPermissions("reimbursementPreAudit.audit")
public void index() {
}
@At
@ViReturn
@RequiresPermissions("reimbursementPreAudit.audit")
public Object pageData(PageForm pageForm, String year, String notes, Integer auditState,String unitId,String unionId) {
Cnd cnd = Cnd.NEW();
Sql sql = Sqls.create("""
SELECT * FROM `reimbursement_pre_audit` $condition
""");
cnd.andEX("YEAR(applyDate)", "=", year);
cnd.andEX("unitId", "=", unitId);
cnd.andEX("unionId", "=", unionId);
if (auditState != 0) {
cnd.andEX("auditState", auditState == 1 ? ">" : "=", 1);
} else {
cnd.andEX("auditState", ">=", 1);
}
if (StrUtil.isNotEmpty(notes)) {
cnd.andEX("notes", "like", "%" + notes + "%");
}
cnd.andEX("userId", "=", ShiroUtil.getUserId());
cnd.desc("applyDate").desc("opAt");
if (StrUtil.isAllNotEmpty(pageForm.getPageOrderName(), pageForm.getPageOrderBy())) {
cnd.orderBy(pageForm.getPageOrderName(), pageForm.getPageOrderBy());
}
sql.setCondition(cnd);
return baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
}
@At
@ViReturn
@SLog(tag = "报销预审", msg = "审核一条记录", param = true, result = true)
@RequiresPermissions("reimbursementPreAudit.audit")
public Object doSubmit(Audit audit, String id, Boolean flag) {
audit.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
baseService.insert(audit);
Chain chain = Chain.make("auditId", audit.getId()).add("auditState", flag ? 3 : 2);
baseService.dao().update(ReimbursementPreAudit.class, chain, Cnd.where("id", "=", id));
return null;
}
}
@@ -0,0 +1,91 @@
package io.v.nutz.reimbursementPreAudit.models;
import io.v.nutz.base.model.BaseModel;
import io.v.nutz.sys.models.Sys_file;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.util.List;
/**
* @ClassName ReimbursementPreAudit
* @Description TODO
* @Author zhf
* @Date 2025/4/9 下午1:55
*/
@Data
@Table
@Comment("报销预审系统")
public class ReimbursementPreAudit extends BaseModel {
@Column
@Name
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userId;
@Column
@Comment("姓名")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String userName;
@Column
@Comment("工号")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String loginName;
@Column
@Comment("单位")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unitName;
@Column
@Comment("单位Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unitId;
@Column
@Comment("工会")
@ColDefine(type = ColType.VARCHAR, width = 50)
private String unionName;
@Column
@Comment("工会Id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String unionId;
@Column
@Comment("报销事由")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String notes;
@Column
@Comment("申报时间")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String applyDate;
@Column
@Comment("附件信息")
@ColDefine(type = ColType.MYSQL_JSON)
private List<Sys_file> files;
@Column
@Comment("审核记录id")
@ColDefine(type = ColType.VARCHAR, width = 32)
private String auditId;
@Column
@Comment("审核状态")
@ColDefine(type = ColType.INT)
private Integer auditState;
}
@@ -0,0 +1,255 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.formData .viewFile {
height: 200px;
}
</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">年&emsp;&emsp;度:</div>
<div class="search-item-option">
<el-date-picker
placeholder="选择年"
style="width: 100%"
type="year" 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-input v-model="pageForm.notes" placeholder="请选择或输入摘要" clearable>
</el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
clearable="true"
@change="flushUnits" @clear="flushUnits"
filterable>
<el-option v-for="item in unions" :label="item.unionname" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
clearable="true"
filterable="true">
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="预审列表">
<template #func>
<el-radio-group v-model="pageForm.auditState" @change="doSearch" size="small">
<el-radio-button :label="0">全部</el-radio-button>
<el-radio-button :label="1">已审核</el-radio-button>
<el-radio-button :label="2">未审核</el-radio-button>
</el-radio-group>
</template>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder" row-key="id"
style="width: 100%"
v-loading="tableLoading">
<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"
:sortable="column.sortable"
align="center"
header-align="center"
v-for="column in tableColumns">
<template scope="{row}" v-if="column.prop==='auditState'">
<el-tag v-if="row.auditState===0" type="info">保存中</el-tag>
<el-tag v-if="row.auditState===1" type="info">待审核</el-tag>
<el-tag v-else-if="row.auditState===2" type="danger">退回修改</el-tag>
<el-tag v-else-if="row.auditState===3" type="success">已通过</el-tag>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作"
width="300">
<template scope="{row}">
<el-button @click="openView(row)" type="primary" size="mini">查看
</el-button>
<el-button @click="openAudit(row)" type="primary" size="mini"
:disabled="![1].includes(row.auditState)">审核
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</guava>
<el-dialog
title="报销预审信息"
:visible.sync="dialogVisible"
width="40%"
:close-on-click-modal="false"
>
<info ref="auditInfo">
<template #handle>
<el-form :model="formData" ref="form" :rules="formRules" label-position="right"
style="padding: 20px 0"
label-width="120px">
<el-row gutter="20">
<el-col :span="12">
<el-form-item prop="username" label="审核人员">
<el-input v-model="formData.username"
disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="time" label="审核时间">
<el-input v-model="formData.auditTime" disabled></el-input>
</el-form-item>
</el-col>
</el-row>
<el-form-item prop="opinion" label="审核意见">
<el-input type="textarea" v-model="formData.auditOpinion" rows="4"
maxlength="500"
placeholder="请填写您的审核意见"></el-input>
</el-form-item>
</el-form>
</template>
</info>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">关 闭</el-button>
<el-button type="danger" @click="doSubmit(false)">退回修改</el-button>
<el-button type="primary" @click="doSubmit(true)">通 过</el-button>
</span>
</el-dialog>
<el-dialog
title="报销预审信息"
:visible.sync="viewDialogVisible"
width="40%"
:close-on-click-modal="false">
<info ref="info"></info>
<span slot="footer" class="dialog-footer">
<el-button @click="viewDialogVisible = false">关 闭</el-button>
</span>
</el-dialog>
</div>
<script>
<!--#include("info.js"){}#-->
new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
units: [],
unions: [],
pageForm: {
auditState: 0,
year: new Date().getFullYear() + ""
},
tableColumns: [
{prop: 'loginName', label: '工号'},
{prop: 'userName', label: '姓名'},
{prop: 'unitName', label: '单位'},
{prop: 'unionName', label: '工会'},
{prop: 'notes', label: '事由'},
{prop: 'applyDate', label: '填写时间'},
{prop: 'auditState', label: '状态'},
],
formRules: {},
dialogVisible: false,
viewDialogVisible: false,
}
},
components: {
"info": info
},
methods: {
openView(row) {
this.viewDialogVisible = true
setTimeout(() => {
this.$refs.info.openView(row.id)
}, 300)
},
openAudit(row) {
this.formData = {
id: row.id,
auditOpinion: "",
auditTime: moment().format('YYYY-MM-DD'),
username: "${@shiro.getPrincipalProperty('username')}",
}
this.dialogVisible = true
setTimeout(() => {
this.$refs.auditInfo.openAudit(row.id, true)
}, 300)
},
doSubmit(flag) {
this.$refs.form.validate(async (valid) => {
if (valid) {
this.$confirm('确定要' + (flag ? '通过' : '退回修改') + '吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.formData.flag=flag
$.post("/platform/reimbursementPreAudit/audit/doSubmit", this.formData).then(res => {
if (res.code === 0) {
this.$message({
type: 'success',
message: '操作成功!'
});
this.dialogVisible = false
this.pageData()
}
})
})
}
})
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.units = await getUnits(this.pageForm.unionId)
} else {
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
}
},
},
async created() {
this.unions = await getUnions(null)
this.flushUnits()
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,92 @@
let info = {
/*language=HTML*/
template: `
<el-tabs tab-position="top" v-model="activeName" v-loading="loading">
<el-tab-pane label="预审信息" name="1">
<el-form label-width="110px" class="formData">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="姓名">
{{viewData.userName}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工号">
{{viewData.loginName}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位">
{{viewData.unitName}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工会">
{{viewData.unionName}}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="摘要">
{{viewData.notes}}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="材料" prop="files">
<file-upload card :files.sync="viewData.files"
view></file-upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="审核信息" name="2" v-if="viewData.auditId">
<el-form label-width="110px" class="formData">
<el-col :span="12">
<el-form-item label="姓名">
{{viewData.auditInfo.username}}
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="审核时间">
{{viewData.auditInfo.auditTime}}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="审核意见">
{{viewData.auditInfo.auditOpinion}}
</el-form-item>
</el-col>
</el-form>
</el-tab-pane>
<el-tab-pane v-if="handle" :label="label" name="999">
<slot name="handle"></slot>
</el-tab-pane>
</el-tabs>
</el-tabs>
`,
data() {
return {
handle: false,
label: "审核",
loading: false,
activeName: "1",
viewData: {}
}
},
methods: {
async openAudit(id, handle) {
this.handle = handle
await this.openView(id)
},
async openView(id) {
this.loading = true
const resp = await $.post("/platform/reimbursementPreAudit/manage/findOne", {id})
resp.data.files = JSON.parse(resp.data.files)
this.viewData = resp.data
this.loading = false
if (this.handle){
this.activeName = "999"
}
}
}
}
@@ -0,0 +1,257 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.formData .viewFile {
height: 200px;
}
</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">年&emsp;&emsp;度:</div>
<div class="search-item-option">
<el-date-picker
placeholder="选择年"
style="width: 100%"
type="year" 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-input v-model="pageForm.notes" placeholder="请选择或输入摘要" clearable>
</el-input>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="预审列表">
<template #func>
<el-button type="primary" @click="openAdd" size="small">新增报销预审</el-button>
</template>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder" row-key="id"
style="width: 100%"
v-loading="tableLoading">
<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"
:sortable="column.sortable"
align="center"
header-align="center"
v-for="column in tableColumns">
<template scope="{row}" v-if="column.prop==='auditState'">
<el-tag v-if="row.auditState===0" type="info">保存中</el-tag>
<el-tag v-if="row.auditState===1" type="info">待审核</el-tag>
<el-tag v-else-if="row.auditState===2" type="danger">退回修改</el-tag>
<el-tag v-else-if="row.auditState===3" type="success">已通过</el-tag>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作"
width="300">
<template scope="{row}">
<el-button @click="openView(row)" type="primary" size="mini">查看
</el-button>
<el-button @click="openEdit(row)" type="primary" size="mini"
:disabled="![0,1,2].includes(row.auditState)">编辑
</el-button>
<el-button @click="doDelete(row.id)" type="danger" size="mini"
:disabled="![0,1].includes(row.auditState)">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</guava>
<el-dialog
title="报销预审信息"
:visible.sync="dialogVisible"
width="40%"
:close-on-click-modal="false"
>
<el-form :model="formData" :rules="rules" ref="form" label-width="100px" class="formData">
<el-row>
<el-col :span="12">
<el-form-item label="姓名" prop="userName">
<el-input v-model="formData.userName" disabled>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工号" prop="loginName">
<el-input v-model="formData.loginName" disabled>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unitName">
<el-input v-model="formData.unitName" disabled>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工会" prop="unionName">
<el-input v-model="formData.unionName" disabled>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="摘要" prop="notes">
<el-input v-model="formData.notes"
placeholder="请选择或输入摘要" maxlength="50" show-word-limit>
</el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="材料" prop="files">
<file-upload card :files.sync="formData.files"></file-upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">关 闭</el-button>
<el-button type="primary" @click="doSubmit(false)">保 存</el-button>
<el-button type="primary" @click="doSubmit(true)">提 交</el-button>
</span>
</el-dialog>
<el-dialog
title="报销预审信息"
:visible.sync="viewDialogVisible"
width="40%"
:close-on-click-modal="false">
<info ref="info"></info>
<span slot="footer" class="dialog-footer">
<el-button @click="viewDialogVisible = false">关 闭</el-button>
</span>
</el-dialog>
</div>
<script>
<!--#include("info.js"){}#-->
const vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
pageForm: {
year: new Date().getFullYear() + ""
},
tableColumns: [
{prop: 'loginName', label: '工号'},
{prop: 'userName', label: '姓名'},
{prop: 'unitName', label: '单位'},
{prop: 'unionName', label: '工会'},
{prop: 'notes', label: '事由'},
{prop: 'applyDate', label: '填写时间'},
{prop: 'auditState', label: '状态'},
],
dialogVisible: false,
viewDialogVisible: false,
rules: {
notes: [{required: true, message: '必填', trigger: 'blur'}],
files: [{required: true, message: '必填', trigger: 'blur'}],
},
}
},
components: {
"info": info
},
methods: {
openAdd() {
this.formData = {
applyDate: moment().format('YYYY-MM-DD'),
userName: "${@shiro.getPrincipalProperty('username')}",
loginName: "${@shiro.getPrincipalProperty('loginname')}",
unitName: "${@shiro.getPrincipalProperty('unit').getName()}",
unionName: "${@shiro.getPrincipalProperty('union').getUnionname()}",
}
this.dialogVisible = true
this.$nextTick(() => {
this.$refs.form.clearValidate()
})
},
openView(row) {
this.viewDialogVisible = true
setTimeout(() => {
this.$refs.info.openView(row.id)
}, 300)
},
openEdit(row) {
const data = clone(row)
data.files = JSON.parse(data.files)
this.formData = data
this.dialogVisible = true
},
doDelete(id) {
this.$confirm('确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$.post("/platform/reimbursementPreAudit/manage/doDelete", {id}).then(res => {
if (res.code === 0) {
this.$message({
type: 'success',
message: '删除成功!'
});
this.pageData()
}
})
})
},
doSubmit(flag) {
this.$refs.form.validate(async (valid) => {
if (valid) {
this.$confirm('确定要' + (flag ? '提交' : '保存') + '吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
$.post("/platform/reimbursementPreAudit/manage/doSubmit", {
preAudit: JSON.stringify(this.formData),
flag: flag
}).then(res => {
if (res.code === 0) {
this.$message({
type: 'success',
message: '操作成功!'
});
this.dialogVisible = false
this.pageData()
}
})
})
}
})
},
},
async created() {
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,217 @@
<!--#
layout("/layouts/platform.html"){
#-->
<style>
.formData .viewFile {
height: 200px;
}
</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">年&emsp;&emsp;度:</div>
<div class="search-item-option">
<el-date-picker
v-model="pageForm.date"
type="daterange"
@change="dateChange"
align="right"
unlink-panels
value-format="yyyy-MM-dd"
style="width: 100%"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
:picker-options="pickerOptions">
</el-date-picker>
</div>
</div>
<div class="search-item">
<div class="search-item-label">事由:</div>
<div class="search-item-option">
<el-input v-model="pageForm.notes" placeholder="请选择或输入摘要" clearable>
</el-input>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属工会:</div>
<div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId"
style="width: 100%;"
clearable="true"
@change="flushUnits" @clear="flushUnits"
filterable>
<el-option v-for="item in unions" :label="item.unionname"
:value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-item">
<div class="search-item-label">所属单位:</div>
<div class="search-item-option">
<el-select placeholder="所属单位" v-model="pageForm.unitId"
style="width: 100%;"
clearable="true"
filterable="true">
<el-option v-for="item in units" :label="item.name"
:value="item.id"></el-option>
</el-select>
</div>
</div>
<div class="search-query">
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button>
</div>
</div>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="预审列表">
<template #func>
</template>
</table-tool>
<el-table :data="tableData" @sort-change="pageOrder" row-key="id"
style="width: 100%"
v-loading="tableLoading">
<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"
:sortable="column.sortable"
align="center"
header-align="center"
v-for="column in tableColumns">
<template scope="{row}" v-if="column.prop==='auditState'">
<el-tag v-if="row.auditState===0" type="info">保存中</el-tag>
<el-tag v-if="row.auditState===1" type="info">待审核</el-tag>
<el-tag v-else-if="row.auditState===2" type="danger">退回修改</el-tag>
<el-tag v-else-if="row.auditState===3" type="success">已通过</el-tag>
</template>
</el-table-column>
<el-table-column align="center" header-align="center" label="操作"
width="100">
<template scope="{row}">
<el-button @click="openView(row)" type="primary" size="mini">查看
</el-button>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</guava>
<el-dialog
title="报销预审信息"
:visible.sync="viewDialogVisible"
width="40%"
:close-on-click-modal="false">
<info ref="info"></info>
<span slot="footer" class="dialog-footer">
<el-button @click="viewDialogVisible = false">关 闭</el-button>
</span>
</el-dialog>
</div>
<script>
<!--#include("info.js"){}#-->
new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
units: [],
unions: [],
pageForm: {
date: [moment().subtract(1, 'months')._d, new Date()],
year: new Date().getFullYear() + ""
},
tableColumns: [
{prop: 'loginName', label: '工号'},
{prop: 'userName', label: '姓名'},
{prop: 'unitName', label: '单位'},
{prop: 'unionName', label: '工会'},
{prop: 'notes', label: '事由'},
{prop: 'applyDate', label: '填写时间'},
{prop: 'auditState', label: '状态'},
],
formRules: {},
viewDialogVisible: false,
pickerOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
}
}]
},
}
},
components: {
"info": info
},
methods: {
dateChange(val) {
if (val && val.length > 0) {
this.$set(this.pageForm, 'startDate', val[0])
this.$set(this.pageForm, 'endDate', val[1])
} else {
this.$set(this.pageForm, 'startDate', '')
this.$set(this.pageForm, 'endDate', '')
}
},
openView(row) {
this.viewDialogVisible = true
setTimeout(() => {
this.$refs.info.openView(row.id)
}, 300)
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.units = await getUnits(this.pageForm.unionId)
} else {
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
}
},
},
async created() {
this.unions = await getUnions(null)
this.flushUnits()
this.pageData()
}
})
</script>
<!--#
}
#-->