This commit is contained in:
2024-08-02 14:31:56 +08:00
parent f8bca9ff88
commit 649cde9aa6
15 changed files with 507 additions and 138 deletions
@@ -1,6 +1,10 @@
package io.v.nutz.wakershome.controller.declaration; package io.v.nutz.wakershome.controller.declaration;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import io.v.nutz.annontation.ViReturn; import io.v.nutz.annontation.ViReturn;
import io.v.nutz.base.utils.Vi; import io.v.nutz.base.utils.Vi;
import io.v.nutz.modules.models.Audit; import io.v.nutz.modules.models.Audit;
@@ -8,8 +12,10 @@ import io.v.nutz.modules.models.PageForm;
import io.v.nutz.util.ShiroUtil; import io.v.nutz.util.ShiroUtil;
import io.v.nutz.wakershome.model.WakesHomeApply; import io.v.nutz.wakershome.model.WakesHomeApply;
import io.v.nutz.wakershome.service.IWakesHomeApplyService; import io.v.nutz.wakershome.service.IWakesHomeApplyService;
import io.v.nutz.web.commons.base.Globals;
import org.apache.shiro.authz.annotation.Logical; import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.ddr.poi.html.HtmlRenderPolicy;
import org.nutz.aop.interceptor.ioc.TransAop; import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
@@ -17,10 +23,15 @@ import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop; import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject; import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.mvc.annotation.At; import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok; import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param; import org.nutz.mvc.annotation.Param;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.HashMap;
/** /**
* @version 1.0 * @version 1.0
* @Author zzr * @Author zzr
@@ -39,15 +50,16 @@ public class WakesHomeDeclarationMineController {
@At("") @At("")
@Ok("beetl:/platform/wakeshome/declaration/mine.html") @Ok("beetl:/platform/wakeshome/declaration/mine.html")
@RequiresPermissions("wakeshome.declaration.mine") @RequiresPermissions("wakeshome.declaration.mine")
public void index() {} public void index() {
}
@At @At
@ViReturn @ViReturn
@RequiresPermissions("wakeshome.declaration.mine") @RequiresPermissions("wakeshome.declaration.mine")
public Object pageData(PageForm pageForm, public Object pageData(PageForm pageForm,
@Param(value = "year",required = false) Integer year, @Param(value = "year", required = false) Integer year,
@Param(value = "unionId",required = false) String unionId){ @Param(value = "unionId", required = false) String unionId) {
Sql sql = Sqls.create(""" Sql sql = Sqls.create("""
SELECT SELECT
wh.*, wh.*,
@@ -59,9 +71,9 @@ public class WakesHomeDeclarationMineController {
$condition $condition
"""); """);
Cnd cnd = Cnd.NEW(); Cnd cnd = Cnd.NEW();
cnd.andEX("YEAR(wh.applyDate)","=",year); cnd.andEX("YEAR(wh.applyDate)", "=", year);
if (!ShiroUtil.hasAnyRoles("sysadmin,A06")){ if (!ShiroUtil.hasAnyRoles("sysadmin,A06")) {
cnd.and("unionId","=", Vi.getUnionId()); cnd.and("unionId", "=", Vi.getUnionId());
} else { } else {
cnd.andEX("unionId", "=", unionId); cnd.andEX("unionId", "=", unionId);
} }
@@ -73,16 +85,63 @@ public class WakesHomeDeclarationMineController {
@At @At
@ViReturn @ViReturn
@Aop(TransAop.READ_COMMITTED) @Aop(TransAop.READ_COMMITTED)
@RequiresPermissions(value = {"wakeshome.declaration.apply","wakeshome.declaration.mine"},logical = Logical.OR) @RequiresPermissions(value = {"wakeshome.declaration.apply", "wakeshome.declaration.mine"}, logical = Logical.OR)
public Object doDelete(String id) { public Object doDelete(String id) {
WakesHomeApply apply = wakesHomeApplyService.fetch(id); WakesHomeApply apply = wakesHomeApplyService.fetch(id);
if (StrUtil.isNotBlank(apply.getOrganizationAuditId())) { if (StrUtil.isNotBlank(apply.getOrganizationAuditId())) {
wakesHomeApplyService.dao().delete(Audit.class,apply.getOrganizationAuditId()); wakesHomeApplyService.dao().delete(Audit.class, apply.getOrganizationAuditId());
} }
if (StrUtil.isNotBlank(apply.getSchoolAuditId())) { if (StrUtil.isNotBlank(apply.getSchoolAuditId())) {
wakesHomeApplyService.dao().delete(Audit.class,apply.getSchoolAuditId()); wakesHomeApplyService.dao().delete(Audit.class, apply.getSchoolAuditId());
} }
wakesHomeApplyService.delete(id); wakesHomeApplyService.delete(id);
return null; return null;
} }
@At
@Ok("void")
public void openExport(String id, HttpServletResponse response) {
try {
NutMap nutMap = wakesHomeApplyService.findById(id);
HackLoopTableRenderPolicy policy = new HackLoopTableRenderPolicy();
HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
htmlRenderPolicy.getConfig().setShowDefaultTableBorderInTableCell(true);
Configure config = Configure.newBuilder()
.bind("basicInformation", htmlRenderPolicy)
.bind("constructionPlan", htmlRenderPolicy).build();
HashMap<String, Object> map = new HashMap<>();
String fileName = Globals.schoolName + "教工小家”建设计划书";
map.put("fileName", fileName);
map.put("schoolName", Globals.schoolName);
map.put("unionName", nutMap.getString("unionName"));
map.put("applyDate", nutMap.getString("applyDate"));
map.put("username", nutMap.getString("username"));
map.put("mobile", nutMap.getString("mobile"));
map.put("basicInformation", nutMap.getString("basicInformation"));
map.put("constructionPlan", nutMap.getString("constructionPlan"));
NutMap schoolAudit = nutMap.getAs("schoolAudit", NutMap.class);
NutMap organizationAudit = nutMap.getAs("organizationAudit", NutMap.class);
schoolAudit.setv("auditTime", DateUtil.formatDate(schoolAudit.getTime("auditTime")));
schoolAudit.setv("auditSign", Vi.getImg(schoolAudit.getString("auditSign")));
organizationAudit.setv("auditTime", DateUtil.formatDate(organizationAudit.getTime("auditTime")));
organizationAudit.setv("auditSign", Vi.getImg(organizationAudit.getString("auditSign")));
map.put("organizationAudit", organizationAudit);
map.put("schoolAudit", schoolAudit);
response.addHeader("Content-Type", "application/octet-stream");
response.addHeader("Content-Disposition", "attachment; filename=\"" + new String(fileName.getBytes("UTF-8"), "ISO-8859-1") + "\".docx");
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/wakeshome/wakeshome.docx");
XWPFTemplate.compile(inputStream, config).render(map, response.getOutputStream());
inputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} }
@@ -65,6 +65,6 @@ public class WakesHomeApplyController {
@RequiresPermissions("wakeshome.info.apply") @RequiresPermissions("wakeshome.info.apply")
public Object validateApply(){ public Object validateApply(){
int count = wakesHomeInfoService.dao().count(WakesHomeApply.class, Cnd.where("state", "=", "10030").and("unionId", "=", Vi.getUnionId())); int count = wakesHomeInfoService.dao().count(WakesHomeApply.class, Cnd.where("state", "=", "10030").and("unionId", "=", Vi.getUnionId()));
return (count > 0) ? Result.error() : Result.success(); return (count > 0) ? Result.success() : Result.error();
} }
} }
@@ -55,6 +55,10 @@ const FILE_PREVIEW_ADDRESS = '/file_server/preview'
const FILE_DOWNLOAD_ADDRESS = '/file_server/download' const FILE_DOWNLOAD_ADDRESS = '/file_server/download'
const FILE_STREAM_PREVIEW_ADDRESS = '/file_server/fileStreamPreview' const FILE_STREAM_PREVIEW_ADDRESS = '/file_server/fileStreamPreview'
const CREATE_PREVIEW_URL = (val) => {
return FILE_STREAM_PREVIEW_ADDRESS + "?id=" + val
}
const preview = async (filename, id) => { const preview = async (filename, id) => {
const suffix = filename.substring(filename.lastIndexOf('.') + 1) const suffix = filename.substring(filename.lastIndexOf('.') + 1)
@@ -0,0 +1,242 @@
<template>
<div class="component-upload-image">
<el-upload
:style="{'--box-width': width + 'px', '--box-height': height + 'px'}"
multiple
:action="FILE_UPLOAD_ADDRESS"
list-type="picture-card"
:on-success="handleUploadSuccess"
:before-upload="handleBeforeUpload"
:limit="limit"
:on-error="handleUploadError"
:on-exceed="handleExceed"
ref="imageUpload"
:on-remove="handleDelete"
:file-list="fileList"
:on-preview="handlePictureCardPreview"
:class="{hidePic: this.fileList.length >= this.limit}"
>
<i class="el-icon-plus"></i>
</el-upload>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b></template>
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
的文件
</div>
</div>
</template>
<script>
module.exports = {
name: "ImageUpload",
props: {
value: [String, Array],
// 图片数量限制
limit: {
type: Number,
default: 5,
},
// 大小限制(MB)
fileSize: {
type: Number,
default: 5,
},
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["png", "jpg", "jpeg"],
},
// 是否显示提示
isShowTip: {
type: Boolean,
default: true
},
height: {
type: Number,
default: 100
},
width: {
type: Number,
default: 100
}
},
data() {
return {
dialogImageUrl: "",
dialogVisible: false,
hideUpload: false,
fileList: []
}
},
watch: {
value: {
immediate: true,
deep: true,
handler(val) {
if (val) {
let fff = []
fff = Array.isArray(val) ? [...val] : [val]
this.fileList = fff.map(v => {
return {
name: v,
url: CREATE_PREVIEW_URL(v)
}
})
}
}
}
},
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
},
methods: {
// 上传前loading加载
handleBeforeUpload(file) {
let isImg = false;
if (this.fileType.length) {
let fileExtension = "";
if (file.name.lastIndexOf(".") > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
}
isImg = this.fileType.some(type => {
if (file.type.indexOf(type) > -1) return true;
if (fileExtension && fileExtension.indexOf(type) > -1) return true;
return false;
});
} else {
isImg = file.type.indexOf("image") > -1;
}
if (!isImg) {
this.$message.error(`文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`);
return false;
}
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$message.error(`上传头像图片大小不能超过 ${this.fileSize} MB!`);
return false;
}
}
},
// 文件个数超出
handleExceed() {
this.$message.error(`上传文件数量不能超过 ${this.limit} 个!`);
},
// 上传成功回调
handleUploadSuccess(res, file) {
if (res.code === 0) {
if (this.limit === 1) {
this.$emit("input", res.data.filepath)
} else {
if (this.value && Array.isArray(this.value)) {
const v = [...this.value, res.data.filepath]
this.$emit("input", v)
} else {
this.$emit("input", [res.data.filepath])
}
}
} else {
this.$message.error(res.msg);
this.$refs.imageUpload.handleRemove(file);
}
},
// 删除图片
async handleDelete(file) {
const resp = await $.post(FILE_DELETE_ADDRESS, {id: file.name})
const findex = this.fileList.map(f => f.name).indexOf(file.name);
if (findex > -1) {
this.fileList.splice(findex, 1)
if (this.limit === 1) {
this.$emit("input", this.fileList.map(v => v.name).join('、'))
} else {
this.$emit("input", this.fileList.map(v => v.name))
}
}
/*if (resp.code === 0) {
this.$message.success(resp.msg)
const findex = this.fileList.map(f => f.name).indexOf(file.name);
if (findex > -1) {
this.fileList.splice(findex, 1)
if (this.limit === 1) {
this.$emit("input", this.fileList.map(v => v.name).join('、'))
} else {
this.$emit("input", this.fileList.map(v => v.name))
}
}
} else {
this.$message.warning(resp.msg)
}*/
},
// 上传失败
handleUploadError() {
this.$message.error("上传图片失败,请重试");
},
// 预览
handlePictureCardPreview(file) {
if (file.url) {
let image = new Image();
image.src = file.url
let viewer = new Viewer(image);
viewer.show();
} else {
viewImage(file.response.data.id)
}
}
}
}
</script>
<style scoped>
.component-upload-image .el-upload--picture-card {
width: var(--box-width, '100px') !important;
height: var(--box-height, '100px') !important;
display: flex;
align-items: center;
justify-content: center;
}
.el-upload--picture-card i {
font-size: 1em;
}
.el-upload-list--picture-card .el-upload-list__item {
width: var(--box-width, '100px');
height: var(--box-height, '100px');
}
.hidePic .el-upload--picture-card {
display: none !important;
}
.el-list-enter-active,
.el-list-leave-active {
transition: all 0s;
}
.el-list-enter, .el-list-leave-active {
opacity: 0;
transform: translateY(0);
}
.component-upload-image {
height: inherit;
}
.component-upload-image > div:nth-child(1) {
width: 100%;
height: 100%;
}
.el-upload__tip {
text-align: left;
}
</style>
@@ -23,7 +23,9 @@
<tr> <tr>
<th>基本情况简介</th> <th>基本情况简介</th>
<td colspan="5">{{ viewData.basicInformation }}</td> <td colspan="5">
<div class="text-left" v-html="viewData.basicInformation"></div>
</td>
</tr> </tr>
<tr> <tr>
@@ -131,8 +131,7 @@ module.exports = {
}, },
methods: { methods: {
async openView(id) { async openView(id) {
console.log(id) const resp = await $.get('/platform/wakeshome/info/mine/getInfoById', {id: id})
const resp = await $.get('/platform/wakeshome/mine/getInfoById', {id: id})
if (resp.code === 0) { if (resp.code === 0) {
this.viewData = resp.data this.viewData = resp.data
this.schoolAudit = resp.data.schoolAudit this.schoolAudit = resp.data.schoolAudit
@@ -132,6 +132,7 @@
Vue.component('file-upload', httpVueLoader('/components/plugins/FileUpload.vue')) Vue.component('file-upload', httpVueLoader('/components/plugins/FileUpload.vue'))
Vue.component('text-editor', httpVueLoader('/components/plugins/textEditor.vue')) Vue.component('text-editor', httpVueLoader('/components/plugins/textEditor.vue'))
Vue.component('border-table', httpVueLoader('/components/plugins/BorderTable.vue')) Vue.component('border-table', httpVueLoader('/components/plugins/BorderTable.vue'))
Vue.component('image-upload', httpVueLoader('/components/plugins/ImageUpload.vue'))
</script> </script>
@@ -30,7 +30,7 @@ layout("/layouts/platform.html"){
</el-row> </el-row>
</template> </template>
<el-form :model="formData" :rules="formRules" label-width="120px" ref="form"> <el-form :model="formData" :rules="formRules" label-width="150px" ref="form">
<vi-title title="职工建家申报信息"></vi-title> <vi-title title="职工建家申报信息"></vi-title>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
@@ -45,7 +45,7 @@ layout("/layouts/platform.html"){
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="联系方式" prop="mobile"> <el-form-item label="联系方式" prop="mobile">
<el-input v-model="formData.mobile" maxlength="11"></el-input> <el-input maxlength="11" v-model="formData.mobile"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@@ -58,28 +58,30 @@ layout("/layouts/platform.html"){
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="填报时间" prop="applyTime"> <el-form-item label="填报时间" prop="applyTime">
<el-input readonly v-model="formData.applyTime"></el-input> <el-input readonly v-model="formData.applyDate"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="24"> <el-col :span="24">
<el-form-item label="基层工会简况" prop="basicInformation"> <el-form-item class="is-required" label="基层工会简况"
<el-input type="textarea" v-model="formData.basicInformation" maxlength="500" show-word-limit></el-input> prop="basicInformation">
<text-editor v-model="formData.basicInformation"></text-editor>
<!-- <el-input type="textarea" v-model="formData.basicInformation" maxlength="500" show-word-limit :rows="10"></el-input>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<vi-title title="职工建家建设方案"></vi-title> <el-form-item label="职工建家建设方案" prop="constructionPlan">
<el-form-item prop="constructionPlan">
<text-editor v-model="formData.constructionPlan"></text-editor> <text-editor v-model="formData.constructionPlan"></text-editor>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-row class="mt10" justify="center" type="flex"> <el-row class="mt10" justify="center" type="flex">
<el-button @click="doSave()" style="width: 200px" type="primary">保 存</el-button> <el-button @click="doSave()" style="width: 200px" type="primary">保 存</el-button>
<el-button @click="doSubmit()" style="width: 200px" type="primary">提 交</el-button> <el-button @click="doSubmit()" style="width: 200px" type="primary">提 交
</el-button>
</el-row> </el-row>
</el-card> </el-card>
</template> </template>
@@ -90,19 +92,43 @@ layout("/layouts/platform.html"){
const vue = new Vue({ const vue = new Vue({
el: '#app', el: '#app',
mixins: [initTableMixins], mixins: [initTableMixins],
data:{ data() {
id: '', const validBasicInformation = (rule, value, callback) => {
formData: {}, if (!this.formData.basicInformation || !dd3s.html2txt(this.formData.basicInformation)) {
formRules: { callback(new Error('请填写基层工会简况'));
mobile: [{ required: true, message: '手机号不能为空', trigger: 'blur' }, } else if (dd3s.html2txt(this.formData.basicInformation).length > 500) {
{ pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号格式', trigger: 'blur' }], console.log(11)
basicInformation: [{required: true, message: '必填', trigger: ['blur', 'change']}], callback(new Error('基层工会简况最多500字'));
constructionPlan: [{required: true, message: '必填', trigger: ['blur', 'change']}], } else {
}, callback();
}
};
return {
id: '',
formData: {},
formRules: {
mobile: [{required: true, message: '手机号不能为空', trigger: 'blur'},
{pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号格式', trigger: 'blur'}],
basicInformation: [{
required: true,
message: '必填',
trigger: ['blur', 'change']
}],
constructionPlan: [{
required: true,
message: '必填',
trigger: ['blur', 'change']
}],
basicInformation: [{
validator: validBasicInformation,
trigger: ['blur', 'change']
}],
},
}
}, },
methods:{ methods: {
async doSave(){ async doSave() {
const resp = await $.post('/platform/wakeshome/declaration/apply/doSave',this.formData) const resp = await $.post('/platform/wakeshome/declaration/apply/doSave', this.formData)
if (resp.code === 0) { if (resp.code === 0) {
this.$message.success('保存成功') this.$message.success('保存成功')
setTimeout(() => { setTimeout(() => {
@@ -112,11 +138,11 @@ layout("/layouts/platform.html"){
this.$message.warning('操作失败') this.$message.warning('操作失败')
} }
}, },
async doSubmit(){ async doSubmit() {
try { try {
const valid = await this.$refs.form.validate() const valid = await this.$refs.form.validate()
if (valid) { if (valid) {
const resp = await $.post('/platform/wakeshome/declaration/apply/doSubmit',this.formData) const resp = await $.post('/platform/wakeshome/declaration/apply/doSubmit', this.formData)
if (resp.code === 0) { if (resp.code === 0) {
this.$message.success('提交成功') this.$message.success('提交成功')
setTimeout(() => { setTimeout(() => {
@@ -127,7 +153,7 @@ layout("/layouts/platform.html"){
} }
} }
} catch (e) { } catch (e) {
this.$message.warning('操作失败') // this.$message.warning('请查看是否按要求填写')
} }
}, },
async initFormData() { async initFormData() {
@@ -135,17 +161,17 @@ layout("/layouts/platform.html"){
this.$set(this.formData, 'username', "${@shiro.getPrincipalProperty('username')}") this.$set(this.formData, 'username', "${@shiro.getPrincipalProperty('username')}")
this.$set(this.formData, 'loginName', "${@shiro.getPrincipalProperty('loginname')}") this.$set(this.formData, 'loginName', "${@shiro.getPrincipalProperty('loginname')}")
this.$set(this.formData, 'mobile', "${@shiro.getPrincipalProperty('mobile')}") this.$set(this.formData, 'mobile', "${@shiro.getPrincipalProperty('mobile')}")
this.$set(this.formData, 'applyTime', moment().format('YYYY-MM-DD')) this.$set(this.formData, 'applyDate', moment().format('YYYY-MM-DD'))
this.$set(this.formData, 'unionName', "${@shiro.getPrincipalProperty('union').getUnionname()}") this.$set(this.formData, 'unionName', "${@shiro.getPrincipalProperty('union').getUnionname()}")
} else { } else {
const resp = await $.get('/platform/wakeshome/mine/getInfoById',{id:this.id}) const resp = await $.get('/platform/wakeshome/declaration/apply/getInfoById', {id: this.id})
if (resp.code === 0){ if (resp.code === 0) {
this.formData = resp.data this.formData = resp.data
} }
} }
}, },
}, },
async created(){ async created() {
this.id = GetQueryString("id") this.id = GetQueryString("id")
this.initFormData(); this.initFormData();
} }
@@ -11,76 +11,89 @@ layout("/layouts/platform.html"){
<div class="search-item-label">年度:</div> <div class="search-item-label">年度:</div>
<div class="search-item-option"> <div class="search-item-option">
<el-date-picker <el-date-picker
v-model="pageForm.year"
value-format="yyyy"
formData="yyyy"
type="year"
@change="doSearch" @change="doSearch"
formData="yyyy"
placeholder="请选择年度"
style="width: 100%" style="width: 100%"
placeholder="请选择年度"> type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker> </el-date-picker>
</div> </div>
</div> </div>
<div class="search-item"> <div class="search-item">
<div class="search-item-label">所属工会:</div> <div class="search-item-label">所属工会:</div>
<div class="search-item-option"> <div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId" <el-select @change="doSearch" clearable="true"
filterable="true"
placeholder="所属工会"
style="width: 100%;" style="width: 100%;"
clearable="true" v-model="pageForm.unionId">
@change="doSearch" <el-option :label="item.unionname" :value="item.id"
filterable="true"> v-for="item in unions"></el-option>
<el-option v-for="item in unions" :label="item.unionname"
:value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
<div class="search-query"> <div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索 <el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button> </el-button>
</div> </div>
</div> </div>
</el-card> </el-card>
<el-card shadow="never" class="mt10"> <el-card class="mt10" shadow="never">
<table-tool label="申报列表" :app="this"> <table-tool :app="this" label="申报列表">
</table-tool> </table-tool>
<el-table ref="table" :data="tableData" style="width: 100%" row-key="id" <el-table :data="tableData" :size="tableSize" @sort-change="pageOrder"
@sort-change="pageOrder" class="vi-table"
v-loading="tableLoading" :size="tableSize" class="vi-table"> ref="table"
<el-table-column align="center" header-align="center" type="index" row-key="id" style="width: 100%" v-loading="tableLoading">
:index="indexMethod" label="序号" <el-table-column :index="indexMethod" align="center" header-align="center"
label="序号" type="index"
width="80px"></el-table-column> width="80px"></el-table-column>
<el-table-column <el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label" :label="column.label"
:prop="column.prop" :prop="column.prop"
:sortable="column.sortable" :sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
> >
<template scope="{row}" v-if="column.prop === 'applyDate'"> <template scope="{row}" v-if="column.prop === 'applyDate'">
<span>{{ moment(row.applyDate).format('YYYY年MM月DD日') }}</span> <span>{{ moment(row.applyDate).format('YYYY年MM月DD日') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="280px"> <el-table-column align="center" fixed="right" header-align="center" label="操作"
width="280px">
<template scope="{row}"> <template scope="{row}">
<el-button @click="openView(row)" v-if="!['10000'].includes(row.state) && row.state" <el-button @click="openView(row)"
size="mini" type="primary">查看 size="mini"
type="primary"
v-if="!['10000'].includes(row.state) && row.state">查看
</el-button> </el-button>
<el-button @click="openView(row)" v-if="['10030'].includes(row.state) && row.state" <el-button @click="openExport(row.id)"
size="mini" type="primary">申报表导出 size="mini"
type="primary"
v-if="['10030'].includes(row.state) && row.state">申报表导出
</el-button> </el-button>
<el-button @click="openEdit(row)" v-if="['10000'].includes(row.state) || !row.state" <el-button @click="openEdit(row)"
size="mini" type="primary">编辑 size="mini"
</el-button> type="primary"
<el-button @click="doDelete(row)" v-if="['10000'].includes(row.state) || !row.state" v-if="['10000','10015','10025'].includes(row.state) || !row.state">
size="mini" type="danger">删除 编辑
</el-button> </el-button>
<el-button @click="doDelete(row)" <el-button @click="doDelete(row)"
v-if="!['10000'].includes(row.state) && row.state && (${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')})" size="mini"
size="mini" type="danger">删除 type="danger"
v-if="['10000'].includes(row.state) || !row.state">删除
</el-button>
<el-button @click="doDelete(row)"
size="mini"
type="danger"
v-if="!['10000'].includes(row.state) && row.state && (${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')})">
删除
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@@ -112,7 +125,7 @@ layout("/layouts/platform.html"){
{prop: 'username', label: '申报人', sortable: true}, {prop: 'username', label: '申报人', sortable: true},
{prop: 'loginName', label: '申报人工号', sortable: true}, {prop: 'loginName', label: '申报人工号', sortable: true},
{prop: 'mobile', label: '联系方式', sortable: true}, {prop: 'mobile', label: '联系方式', sortable: true},
{prop: 'basicInformation', label: '基本情况简介', sortable: true}, // {prop: 'basicInformation', label: '基本情况简介', sortable: true},
{prop: 'applyDate', label: '申报日期', sortable: true}, {prop: 'applyDate', label: '申报日期', sortable: true},
{prop: 'stateName', label: '审核状态', sortable: true}, {prop: 'stateName', label: '审核状态', sortable: true},
], ],
@@ -123,6 +136,9 @@ layout("/layouts/platform.html"){
'wakes-info-apply': httpVueLoader('/components/wakeshome/declaration/WakesHomeInfoApply.vue') 'wakes-info-apply': httpVueLoader('/components/wakeshome/declaration/WakesHomeInfoApply.vue')
}, },
methods: { methods: {
openExport(id) {
window.open(loc() + "/openExport?id=" + id)
},
openView(row) { openView(row) {
this.$refs.guava.view() this.$refs.guava.view()
this.$refs.viewInfo.openView(row.id) this.$refs.viewInfo.openView(row.id)
@@ -150,7 +150,7 @@ layout("/layouts/platform.html"){
{prop: 'username', label: '申报人', sortable: true}, {prop: 'username', label: '申报人', sortable: true},
{prop: 'loginName', label: '申报人工号', sortable: true}, {prop: 'loginName', label: '申报人工号', sortable: true},
{prop: 'mobile', label: '联系方式', sortable: true}, {prop: 'mobile', label: '联系方式', sortable: true},
{prop: 'basicInformation', label: '基本情况简介', sortable: true}, // {prop: 'basicInformation', label: '基本情况简介', sortable: true},
{prop: 'applyDate', label: '申报日期', sortable: true}, {prop: 'applyDate', label: '申报日期', sortable: true},
{prop: 'stateName', label: '审核状态', sortable: true}, {prop: 'stateName', label: '审核状态', sortable: true},
], ],
@@ -150,7 +150,7 @@ layout("/layouts/platform.html"){
{prop: 'username', label: '申报人', sortable: true}, {prop: 'username', label: '申报人', sortable: true},
{prop: 'loginName', label: '申报人工号', sortable: true}, {prop: 'loginName', label: '申报人工号', sortable: true},
{prop: 'mobile', label: '联系方式', sortable: true}, {prop: 'mobile', label: '联系方式', sortable: true},
{prop: 'basicInformation', label: '基本情况简介', sortable: true}, // {prop: 'basicInformation', label: '基本情况简介', sortable: true},
{prop: 'applyDate', label: '申报日期', sortable: true}, {prop: 'applyDate', label: '申报日期', sortable: true},
{prop: 'stateName', label: '审核状态', sortable: true}, {prop: 'stateName', label: '审核状态', sortable: true},
], ],
@@ -134,7 +134,7 @@ layout("/layouts/platform.html"){
<el-date-picker <el-date-picker
v-model="row.awardTime" v-model="row.awardTime"
type="datetime" type="datetime"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd"
placeholder="请选择获奖日期"> placeholder="请选择获奖日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@@ -238,9 +238,9 @@ layout("/layouts/platform.html"){
async doSave() { async doSave() {
let postUrl = '' let postUrl = ''
if (this.formData.id) { if (this.formData.id) {
postUrl = '/platform/wakeshome/apply/doEdit' postUrl = loc()+'/doEdit'
} else { } else {
postUrl = '/platform/wakeshome/apply/doAdd' postUrl = loc()+'/doAdd'
} }
const formData = this.doJsonStr(this.formData) const formData = this.doJsonStr(this.formData)
formData.isSubmit = false; formData.isSubmit = false;
@@ -248,7 +248,7 @@ layout("/layouts/platform.html"){
if (resp.code === 0) { if (resp.code === 0) {
this.notifySuccess(resp.msg) this.notifySuccess(resp.msg)
setTimeout(() => { setTimeout(() => {
sublime.jumpPagePjax('/platform/wakeshome/mine') sublime.jumpPagePjax('/platform/wakeshome/declaration/mine')
}, 500) }, 500)
} else { } else {
this.notifyWarning(resp.msg) this.notifyWarning(resp.msg)
@@ -260,9 +260,9 @@ layout("/layouts/platform.html"){
if (valid) { if (valid) {
let postUrl = '' let postUrl = ''
if (this.formData.id) { if (this.formData.id) {
postUrl = '/platform/wakeshome/apply/doEdit' postUrl = loc()+'/doEdit'
} else { } else {
postUrl = '/platform/wakeshome/apply/doAdd' postUrl = loc()+'/doAdd'
} }
const formData = this.doJsonStr(this.formData) const formData = this.doJsonStr(this.formData)
formData.isSubmit = true formData.isSubmit = true
@@ -270,7 +270,7 @@ layout("/layouts/platform.html"){
if (resp.code === 0) { if (resp.code === 0) {
this.notifySuccess(resp.msg) this.notifySuccess(resp.msg)
setTimeout(() => { setTimeout(() => {
sublime.jumpPagePjax('/platform/wakeshome/mine') sublime.jumpPagePjax('/platform/wakeshome/declaration/mine')
}, 500) }, 500)
} else { } else {
this.notifyWarning(resp.msg) this.notifyWarning(resp.msg)
@@ -296,7 +296,7 @@ layout("/layouts/platform.html"){
this.$set(this.formData, 'applyTime', moment().format('YYYY-MM-DD')) this.$set(this.formData, 'applyTime', moment().format('YYYY-MM-DD'))
this.$set(this.formData, 'unionName', "${@shiro.getPrincipalProperty('union').getUnionname()}") this.$set(this.formData, 'unionName', "${@shiro.getPrincipalProperty('union').getUnionname()}")
} else { } else {
const resp = await $.get('/platform/wakeshome/mine/getInfoById',{id:this.id}) const resp = await $.get('/platform/wakeshome/declaration/mine/getInfoById',{id:this.id})
if (resp.code === 0){ if (resp.code === 0){
this.formData = {...resp.data} this.formData = {...resp.data}
} }
@@ -136,11 +136,11 @@ layout("/layouts/platform.html"){
<el-row :gutter="20" style="margin-right: 15px;margin-left: -5px" type="flex" v-loading="loading"> <el-row :gutter="20" style="margin-right: 15px;margin-left: -5px" type="flex" v-loading="loading">
<el-col v-for="(item, index) in tableData" :key="index" :span="6" style="margin-top: 10px"> <el-col v-for="(item, index) in tableData" :key="index" :span="6" style="margin-top: 10px">
<el-card class="box-card" shadow="always" :body-style="{ padding: '0px' }"> <el-card class="box-card" shadow="always" :body-style="{ padding: '0px' }">
<div slot="header" class="header"> <div slot="header" class="header" style="display: flex">
<span class="label">{{item.unionName}}</span> <span class="label">{{item.unionName}}</span>
<div style="display:flex; align-items: center;color: #cccccc;margin-left: 20px">|</div> <div style="display:flex; align-items: center;color: #cccccc;margin-left: 20px">|</div>
<el-tooltip class="item" effect="dark" :content="item.position" placement="top-start"> <el-tooltip class="item" effect="dark" :content="item.position" placement="top-start">
<span class="header-label">位置:{{item.position}}</span> <el-button type="text" class="header-label">查看位置</el-button>
</el-tooltip> </el-tooltip>
<!--<span class="header-label"></span>--> <!--<span class="header-label"></span>-->
</div> </div>
@@ -11,62 +11,75 @@ layout("/layouts/platform.html"){
<div class="search-item-label">年度:</div> <div class="search-item-label">年度:</div>
<div class="search-item-option"> <div class="search-item-option">
<el-date-picker <el-date-picker
v-model="pageForm.year"
value-format="yyyy"
formData="yyyy"
type="year"
@change="doSearch" @change="doSearch"
formData="yyyy"
placeholder="请选择年度"
style="width: 100%" style="width: 100%"
placeholder="请选择年度"> type="year"
v-model="pageForm.year"
value-format="yyyy">
</el-date-picker> </el-date-picker>
</div> </div>
</div> </div>
<div class="search-item"> <div class="search-item">
<div class="search-item-label">所属工会:</div> <div class="search-item-label">所属工会:</div>
<div class="search-item-option"> <div class="search-item-option">
<el-select placeholder="所属工会" v-model="pageForm.unionId" <el-select @change="doSearch" clearable="true"
filterable="true"
placeholder="所属工会"
style="width: 100%;" style="width: 100%;"
clearable="true" v-model="pageForm.unionId">
@change="doSearch" <el-option :label="item.unionname" :value="item.id"
filterable="true"> v-for="item in unions"></el-option>
<el-option v-for="item in unions" :label="item.unionname"
:value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
<div class="search-query"> <div class="search-query">
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索 <el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
</el-button> </el-button>
</div> </div>
</div> </div>
</el-card> </el-card>
<el-card shadow="never" class="mt10"> <el-card class="mt10" shadow="never">
<table-tool label="申报列表" :app="this"> <table-tool :app="this" label="申报列表">
</table-tool> </table-tool>
<el-table ref="table" :data="tableData" style="width: 100%" row-key="id" <el-table :data="tableData" :size="tableSize" @sort-change="pageOrder" class="vi-table"
@sort-change="pageOrder" ref="table"
v-loading="tableLoading" :size="tableSize" class="vi-table"> row-key="id" style="width: 100%" v-loading="tableLoading">
<el-table-column align="center" header-align="center" type="index" <el-table-column :index="indexMethod" align="center" header-align="center"
:index="indexMethod" label="序号" label="序号" type="index"
width="80px"></el-table-column> width="80px"></el-table-column>
<el-table-column <el-table-column
align="center"
header-align="center"
v-for="column in tableColumns"
show-overflow-tooltip
:label="column.label" :label="column.label"
:prop="column.prop" :prop="column.prop"
:sortable="column.sortable" :sortable="column.sortable"
align="center"
header-align="center"
show-overflow-tooltip
v-for="column in tableColumns"
> >
</el-table-column> </el-table-column>
<el-table-column align="center" header-align="center" label="操作" fixed="right" width="150px"> <el-table-column align="center" fixed="right" header-align="center" label="操作"
width="150px">
<template scope="{row}"> <template scope="{row}">
<el-button @click="openView(row)" v-if="![8100].includes(row.state) && row.state" size="mini" type="primary">查看</el-button> <el-button @click="openView(row)"
<el-button @click="openEdit(row)" v-if="[8100].includes(row.state) || !row.state" size="mini" type="primary">编辑</el-button> size="mini" type="primary"
<el-button @click="doDelete(row)" v-if="[8100].includes(row.state) || !row.state" size="mini" type="danger">删除</el-button> v-if="![8100].includes(row.state) && row.state">查看
<el-button @click="doDelete(row)" v-if="![8100].includes(row.state) && row.state && (${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')})" size="mini" type="danger">删除</el-button> </el-button>
<el-button @click="openEdit(row)"
size="mini" type="primary"
v-if="[8100].includes(row.state) || !row.state">编辑
</el-button>
<el-button @click="doDelete(row)"
size="mini" type="danger"
v-if="[8100].includes(row.state) || !row.state">删除
</el-button>
<el-button @click="doDelete(row)"
size="mini"
type="danger" v-if="![8100].includes(row.state) && row.state && (${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')})">删除
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -83,13 +96,13 @@ layout("/layouts/platform.html"){
<script> <script>
const vue = new Vue({ const vue = new Vue({
el:'#app', el: '#app',
mixins:[initTableMixins], mixins: [initTableMixins],
data(){ data() {
return{ return {
unions:[], unions: [],
pageForm:{ pageForm: {
isAudit:false, isAudit: false,
year: moment().format('YYYY'), year: moment().format('YYYY'),
}, },
tableColumns: [ tableColumns: [
@@ -105,25 +118,32 @@ layout("/layouts/platform.html"){
} }
}, },
components: { components: {
'guava': httpVueLoader('/components/plugins/Guava.vue'),
'wakes-info': httpVueLoader('/components/wakeshome/info/WakesHomeInfo.vue') 'wakes-info': httpVueLoader('/components/wakeshome/info/WakesHomeInfo.vue')
}, },
methods:{ methods: {
openView(row){ openView(row) {
this.$refs.guava.view() this.$refs.guava.view()
this.$refs.viewInfo.openView(row.id) this.$refs.viewInfo.openView(row.id)
}, },
async doDelete(row){ async doDelete(row) {
const resp = await $.get(loc() + '/doRemove',{id:row.id}) const confirm = await this.$confirm('确定要删除吗?', '提示', {
if (resp.code === 0){ confirmButtonText: '确定',
this.notifySuccess(resp.msg) cancelButtonText: '取消',
this.pageData(); type: 'warning'
} else { })
this.notifyWarning(resp.msg) if (confirm==="confirm"){
const resp = await $.get(loc() + '/doRemove', {id: row.id})
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.pageData();
} else {
this.notifyWarning(resp.msg)
}
} }
}, },
openEdit(row){ openEdit(row) {
window.location.href = '/platform/wakeshome/apply?id=' + row.id; sublime.jumpPagePjax('/platform/wakeshome/declaration/apply?id=' + row.id)
}, },
async flushUnits() { async flushUnits() {
this.$set(this.pageForm, "unitId", null) this.$set(this.pageForm, "unitId", null)
@@ -133,10 +153,10 @@ layout("/layouts/platform.html"){
} }
}, },
}, },
async created(){ async created() {
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') { if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
this.unions = await getUnions(null, false) this.unions = await getUnions(null, false)
this.unions.unshift({id:'校工会',unionname:'校工会'}) this.unions.unshift({id: '校工会', unionname: '校工会'})
} else { } else {
this.unions = await getUnions(null, true) this.unions = await getUnions(null, true)
this.$set(this.pageForm, 'unionId', this.unions ? this.unions[0].id : null) this.$set(this.pageForm, 'unionId', this.unions ? this.unions[0].id : null)