Files
UNION_NSI/target/classes/views/platform/hd/checkin/checkinManage.html
T
2026-09-08 19:49:21 +08:00

1137 lines
48 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--#
layout("/layouts/platform.html"){
#-->
<!--
抗疫打卡签到
-->
<style>
input[type=file] {
display: none;
}
.w-e-text-container {
min-height: 200px !important;
max-height: 700px !important;
height: auto !important;
}
.w-e-text {
min-height: 200px !important;
max-height: 700px !important;
height: auto !important;
}
.ViewDialogClass .el-collapse-item__header {
font-size: 12px;
color: rgb(150, 150, 150);
/*font-weight: bold;*/
background-color: white;
}
.el-collapse-item__wrap {
border: none;
}
.el-collapse-item__header {
border: none;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.el-upload--picture-card {
width: 80px;
height: 80px;
line-height: 80px;
}
.el-upload-list--picture-card .el-upload-list__item {
width: 80px;
height: 80px;
line-height: 80px;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 80px;
height: 80px;
line-height: 80px;
text-align: center;
}
.avatar {
width: 80px;
height: 80px;
display: block;
}
.iphonex_box {
width: 366px;
height: 720px;
background: url("https://www.qmwtp.com/assets/www/ActivityPc2/img/iphoneX.png") no-repeat;
background-size: 100% 100%;
position: relative;
top: 0;
left: 0;
right: 0;
margin: 0 auto;
}
.box_title {
position: absolute;
width: 40%;
top: 68px;
color: white;
left: 0;
right: 0;
margin: 0 auto;
display: inline-block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.new_frame {
position: absolute;
width: 321px;
height: 576px;
top: 94px;
left: 24px;
border-radius: 5px;
}
.clearfix:after {
content: '';
display: block;
clear: both;
}
.clearfix:after {
content: '';
display: block;
clear: both;
}
.clearfix:after {
content: '';
display: block;
clear: both;
}
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix:after {
content: '';
display: block;
clear: both;
}
.style_every {
width: 35px;
height: 35px;
border-radius: 4px;
position: relative;
float: left;
margin-right: 10px;
cursor: pointer;
margin-top: 5px;
}
li {
list-style: none;
}
.style_every input {
width: 100%;
height: 100%;
position: absolute;
opacity: 0;
top: 0px;
left: 0;
cursor: pointer;
}
.style_every img {
position: absolute;
top: 10px;
left: 7px;
display: none;
}
.ViewDialogClass .el-form-item {
margin-bottom: 20px;
}
</style>
<script src="${base!}/assets/platform/js/jquery.qrcode.min.js"></script>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never">
<div class="btn-group tool-button ">
<el-date-picker
v-model="pageForm.year"
type="year"
value-format="yyyy"
placeholder="选择年">
</el-date-picker>
</div>
<div class="btn-group tool-button">
<el-input placeholder="请输入内容" v-model="pageForm.hdname">
<template slot="prepend">活动主题</template>
</el-input>
</div>
<div class="btn-group tool-button">
<el-button icon="el-icon-search" @click="doSearch"
style="background-color:#409eff;color: white;"></el-button>
</div>
<div class="pull-right offscreen-right">
<el-button size="medium" @click="openAdd"><i class="ti-plus"></i> 创建活动</el-button>
</div>
</el-card>
<el-card shadow="never" class="mt20">
<el-table :data="tableData" header-align="center" style="width: 100%">
<el-table-column label="序号" type="index" header-align="center" align="center">
<template scope="scope">
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
</template>
</el-table-column>
<el-table-column prop="hdname" label="主题" header-align="center" show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="cjr" label="创建人" header-align="center" align="center"></el-table-column>
<el-table-column prop="hdcjsj" label="创建时间" header-align="center" align="center"></el-table-column>
<el-table-column prop="time" label="活动时间" header-align="center" width="300px" align="center">
<template slot-scope="scope">
{{scope.row.hdkssj}} -- {{scope.row.hdjssj}}
</template>
</el-table-column>
<el-table-column prop="hdflag" label="状态" header-align="center" align="center">
<template slot-scope="scope">
<i v-if="!scope.row.hdflag"
class="fa fa-circle text-danger ml5"></i>
<i v-if="scope.row.hdflag"
class="fa fa-circle text-success ml5"></i>
</template>
</el-table-column>
<el-table-column label="操作" width="300" header-align="center" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.hdflag==false" type="success" size="mini"
@click="changeStatus(scope.row.hdid,true)">开启
</el-button>
<el-button v-else type="info" size="mini" @click="changeStatus(scope.row.hdid,false)">关闭
</el-button>
<el-button size="mini" type="primary" @click="openCode(scope.row.hdid)">二维码</el-button>
<el-button type="primary" size="mini" @click="openEdit(scope.row.hdid)">编辑</el-button>
<el-button type="danger" size="mini" @click="doDelete(scope.row.hdid)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="el-pagination-container">
<el-pagination
@size-change="pageSizeChange"
@current-change="pageNumberChange"
:current-page="pageForm.pageNumber"
:page-sizes="[10, 20, 30, 50]"
:page-size="pageForm.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageForm.totalCount">
</el-pagination>
</el-row>
</el-card>
</template>
<template #edit>
<el-row type="flex">
<el-col :span="9" style="position: relative;text-align: center">
<div class="iphonex_box">
<div class="box_title">{{formData.hdname}}</div>
<iframe class="new_frame" id="myIframe" scrolling="auto" frameborder="none;"
src="/platform/hd/checkinManage/mobileBox">
</iframe>
</div>
<el-button type="info" style="margin-top: 10px" icon="el-icon-refresh" @click="refreshBox" round>刷新
</el-button>
</el-col>
<el-col :span="14" offset="1">
<el-form :model="formData" style="padding-top: 20px;padding-right: 10px" ref="addForm"
label-position="left" :rules="formRules" size="medium"
label-width="90px">
<el-form-item prop="hdname" label="活动主题">
<el-input placeholder="请输入活动主题" v-model="formData.hdname"></el-input>
</el-form-item>
<el-form-item prop="rate" label="月打卡率">
<el-input placeholder="请输入月打卡率" v-model="formData.rate">
<template slot="append">%</template>
</el-input>
</el-form-item>
<el-row>
<el-col :span="24">
<el-form-item prop="time" label="活动时间">
<el-date-picker
style="width: 100%"
v-model="formData.time"
type="datetimerange"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00']">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-form-item prop="hdjs" label="活动介绍">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="hdjsEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdcjry" label="参加人员">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="cjryEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdjlfs" label="奖励方式">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="jlfsEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdnr" label="活动内容">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="hdnrEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdlxr" label="联系人">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="lxrEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdother" label="其他">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="otherEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item label="活动封面">
<el-upload
accept="image/*"
action="****"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:on-change="handleChange"
:auto-upload="false"
limit="4"
:file-list="fileList">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="配色">
<ul class="style_box old_stylebox clearfix" style="display: block;padding-left: 0;">
<li class="style_every" v-for="color,idx in colorList" @click="colorChange(color)"
:style="'background: '+color">
<img src="https://www.qmwtp.com/assets/www/ActivityPc2/img/duihao.png"
:style="'display: '+(formData.hdcolor==color?'block':'none')">
<input type="radio" name="sex" checked="checked" value="1">
</li>
</ul>
</el-form-item>
</el-form>
</el-col>
</el-row>
<el-row type="flex" justify="end">
<el-button type="success" v-show="selected=='add'" @click="save">保 存</el-button>
<el-button type="primary" @click="doSubmit">确 定</el-button>
</el-row>
</template>
</guava>
<el-dialog
:title="selected=='add'?'创建活动':'修改活动'"
:visible.sync="addDialogVisible"
:close-on-click-modal="false"
width="70%">
<el-row>
<el-col :span="9" style="position: relative;text-align: center">
<div class="iphonex_box">
<div class="box_title">{{formData.hdname}}</div>
<iframe class="new_frame" id="myIframe" scrolling="auto" frameborder="none;"
src="/platform/hd/cahdMange/mobileBox">
</iframe>
</div>
<el-button type="info" style="margin-top: 10px" icon="el-icon-refresh" @click="refreshBox" round>刷新
</el-button>
</el-col>
<el-col :span="14" offset="1">
<el-form :model="formData" style="padding-top: 20px;padding-right: 10px" ref="addForm"
label-position="left" :rules="formRules" size="medium"
label-width="90px">
<el-form-item prop="hdname" label="活动主题">
<el-input placeholder="请输入活动主题" v-model="formData.hdname"></el-input>
</el-form-item>
<el-form-item prop="rate" label="月打卡率">
<el-input placeholder="请输入月打卡率" v-model="formData.rate"></el-input>
</el-form-item>
<el-row>
<el-col :span="24">
<el-form-item prop="time" label="活动时间">
<el-date-picker
style="width: 100%"
v-model="formData.time"
type="datetimerange"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="yyyy-MM-dd HH:mm:ss"
:default-time="['00:00:00']">
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
<el-form-item prop="hdjs" label="活动介绍">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="hdjsEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdcjry" label="参加人员">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="cjryEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdjlfs" label="奖励方式">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="jlfsEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdnr" label="活动内容">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="hdnrEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdlxr" label="联系人">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="lxrEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item prop="hdother" label="其他">
<el-collapse>
<el-collapse-item>
<template slot="title">
点击展开 <i class="header-icon el-icon-thumb" style="margin-left: 5px"></i>
</template>
<div id="otherEditor"></div>
</el-collapse-item>
</el-collapse>
</el-form-item>
<el-form-item label="活动封面">
<el-upload
accept="image/*"
action="****"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:on-change="handleChange"
:auto-upload="false"
limit="4"
:file-list="fileList">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="配色">
<ul class="style_box old_stylebox clearfix" style="display: block;padding-left: 0;">
<li class="style_every" v-for="color,idx in colorList" @click="colorChange(color)"
:style="'background: '+color">
<img src="https://www.qmwtp.com/assets/www/ActivityPc2/img/duihao.png"
:style="'display: '+(formData.hdcolor==color?'block':'none')">
<input type="radio" name="sex" checked="checked" value="1">
</li>
</ul>
</el-form-item>
</el-form>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="addDialogVisible = false">取 消</el-button>
<el-button type="success" v-show="selected=='add'" @click="save">保 存</el-button>
<el-button type="primary" @click="doSubmit">确 定</el-button>
</span>
</el-dialog>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
<el-dialog
title="活动二维码"
:visible.sync="codeDialogVisible"
:close-on-click-modal="false"
width="40%">
<div style="width: 100%;">
<div id="qrcode" style="width: 70%;left: 0;right: 0;margin: auto"></div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="codeDialogVisible = false">关 闭</el-button>
<el-button type="primary" @click="share">分 享</el-button>
<el-button type="primary" onclick="dwn('活动二维码')">下 载</el-button>
</span>
</el-dialog>
</div>
<a id="download"></a>
<script src="${base!}/assets/platform/plugins/wangeditor/wangEditor.min.js"></script>
<script>
/*下载二维码*/
function dwn(name) {
var type = 'png';
// var dataurl = $("canvas").get(0).toDataURL('image/png').replace("image/png", "image/octet-stream");
// var filename = name + '_' + (new Date()).getTime() + '.' + type;
// saveFile(dataurl, filename);
alert(IEVersion())
if (IEVersion() != -1) {
var blob = $("canvas").get(0).msToBlob();
window.navigator.msSaveBlob(blob, name + '_' + (new Date()).getTime() + '.' + type);
} else {
$('#download').attr({
href: $("canvas").get(0).toDataURL('image/png').replace("image/png", "image/octet-stream"),
download: name + '_' + (new Date()).getTime() + '.' + type
}).get(0).click();
}
}
function IEVersion() {
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
if (isIE) {
var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
reIE.test(userAgent);
var fIEVersion = parseFloat(RegExp["$1"]);
if (fIEVersion == 7) {
return 7;
} else if (fIEVersion == 8) {
return 8;
} else if (fIEVersion == 9) {
return 9;
} else if (fIEVersion == 10) {
return 10;
} else {
return 6;//IE版本<=7
}
} else if (isEdge) {
return 'edge';//edge
} else if (isIE11) {
return 11; //IE11
} else {
return -1;//不是ie浏览器
}
}
/**
    * 在本地进行文件保存
    * @param  {String} data     要保存到本地的图片数据
    * @param  {String} filename 文件名
    */
var saveFile = function (data, filename) {
var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
save_link.href = data;
save_link.download = filename;
var event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
save_link.dispatchEvent(event);
};
var HOST_URL = function () {
return location.protocol + "//" + location.host;
}();
var editor = {
hdjsEditor: null,
cjryEditor: null,
jlfsEditor: null,
hdnrEditor: null,
lxrEditor: null,
otherEditor: null,
}
var vue = new Vue({
el: '#app',
data: function () {
var self = this
return {
selected: '',
colorList: ['#6A005F', '#31cab1', '#e54242', '#ff8939', '#ffb712', '#1dc47b', '#4495f7', '#ff5e8b', '#5d6e7f'],
fileList: [],
delFiles: [],
dialogImageUrl: '',
activeNames: '',
tableData: [],
pageForm: {
year: moment().format('YYYY'),
hdtype: 2,
searchName: "",
searchKeyword: "",
pageNumber: 1,
pageSize: 10,
totalCount: 0,
pageOrderName: "",
pageOrderBy: "",
hdname: ""
},
formData: {},
codeDialogVisible: false,
addDialogVisible: false,
editDialogVisible: false,
dialogVisible: false,
formRules: {
hdname: [{required: true, message: '必填', trigger: ['blur', 'change']}],
hdjs: [{required: true, message: '必填', trigger: ['blur', 'change']}],
hdcjry: [{required: true, message: '必填', trigger: ['blur', 'change']}],
hdjlfs: [{required: true, message: '必填', trigger: ['blur', 'change']}],
hdnr: [{required: true, message: '必填', trigger: ['blur', 'change']}],
hdlxr: [{required: true, message: '必填', trigger: ['blur', 'change']}],
time: [{required: true, message: '必填', trigger: ['blur', 'change']}],
rate: [{required: true, message: '必填', trigger: ['blur', 'change']}],
},
isNull: function (val) {
if (val === null || val === undefined || val === '') {
return true
}
return false
},
id: '',
}
},
methods: {
share: function () {
const id = this.id
$.get("/platform/hd/checkinManage/findOne", {hdid: id}, function (data) {
if (data.code == 0) {
window.open("http://connect.qq.com/widget/shareqq/index.html?url=" + HOST_URL + "/staffActivities?id=" + id + "&title=" + data.data.hdname + "&desc=" + data.data.hdname + "")
}
}
)
},
openCode: function (id) {
var self = this
self.id = id
self.codeDialogVisible = true
vue.$nextTick(function () {
$("#qrcode").html("")
$("#qrcode").qrcode({ //设置css
render: "canvas", //二维码的生成方式
width: $("#qrcode").width(), //生成二维码的宽度
height: $("#qrcode").width(), //生成二维码的高度
text: HOST_URL + "/childrenActivities?id=" + id,
correctLevel: 3 //容错级别,默认为2,最高为3,为了让用户扫码最快,容错级别应当设为最低
});
})
},
doSubmit: function () {
if (this.selected === 'add') {
this.doAdd()
} else if (this.selected === 'edit') {
this.doEdit()
}
},
changeStatus: function (hdid, flag) {
$.post(base + "/platform/hd/checkinManage/changeStatus", {hdid: hdid, flag: flag}, function (data) {
if (data.code == 0) {
vue.$message({
message: data.msg,
type: 'success'
});
vue.pageData();
} else {
vue.$message({
message: data.msg,
type: 'error'
});
}
})
},
save: function () {
vue.changeFormEditorData()
localStorage.setItem("wmhd_savedata2", JSON.stringify(vue.formData))
vue.$message({
message: '保存成功!',
type: 'success'
});
}
,
changeFormEditorDataTxt() {
this.$set(this.formData, 'hdjs', editor.hdjsEditor.txt.html())
this.$set(this.formData, 'hdcjry', editor.cjryEditor.txt.html())
this.$set(this.formData, 'hdjlfs', editor.jlfsEditor.txt.html())
this.$set(this.formData, 'hdnr', editor.hdnrEditor.txt.html())
this.$set(this.formData, 'hdlxr', editor.lxrEditor.txt.html())
this.$set(this.formData, 'hdother', editor.otherEditor.txt.html())
}
,
changeFormEditorData() {
this.$set(this.formData, 'hdjs', editor.hdjsEditor.txt.html())
this.$set(this.formData, 'hdcjry', editor.cjryEditor.txt.html())
this.$set(this.formData, 'hdjlfs', editor.jlfsEditor.txt.html())
this.$set(this.formData, 'hdnr', editor.hdnrEditor.txt.html())
this.$set(this.formData, 'hdlxr', editor.lxrEditor.txt.html())
this.$set(this.formData, 'hdother', editor.otherEditor.txt.html())
}
,
refreshBox: function () {
vue.changeFormEditorData()
var fileList = []
vue.fileList.forEach(function (file) {
fileList.push(file.url)
})
vue.$set(vue.formData, 'fileList', fileList)
localStorage.setItem("wmhd_boxdata", JSON.stringify(vue.formData))
$('#myIframe').attr('src', $('#myIframe').attr('src'));
}
,
colorChange: function (color, idx) {
this.formData.hdcolor = color
}
,
handlePictureCardPreview: function (file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
}
,
handleChange: function (file, fileList) {
var self = this;
if (file.size == 0) {
self.$message.warning("您选择的是空文件!");
for (var i = 0; i < fileList.length; i++) {
if (file == fileList[i]) {
fileList.splice(i, 1);
}
}
}
self.fileList = fileList;
}
,
handleRemove: function (file, fileList) {
var self = this;
self.fileList = fileList;
if (file.status == 'ok') {
console.log("增加要删除的文件:" + file.name)
self.delFiles.push({uid: file.uid, url: file.urlx})
}
}
,
doDelete: function (id) {
var self = this;
this.$confirm('确定要删除吗?这将会删除目前所有已提交的作品数据!', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
callback: function (a, b) {
if ("confirm" == a) {//确认后再执行
$.post(base + "/platform/hd/checkinManage/delete", {hdid: id}, function (data) {
if (data.code == 0) {
self.$message({
message: data.msg,
type: 'success'
});
self.pageData();
} else {
self.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
}
}
});
}
,
openEdit: function (id) {
var self = this;
self.selected = 'edit'
this.formData = {};
this.fileList = []
this.delFiles = []
if (this.$refs["addForm"])
this.$refs["addForm"].resetFields();
$.get("/platform/hd/checkinManage/findOne", {hdid: id}, function (data) {
if (data.code == 0) {
data.data.time = [data.data.hdkssj, data.data.hdjssj]
self.formData = data.data
data.data.bgis.forEach(function (bgi) {
self.fileList.push({
uid: bgi.iid,
url: FILE_DOMAIN + bgi.iurl,
urlx: bgi.iurl,
name: 'bgi.iid',
status: 'ok'
})
})
self.$refs.guava.edit()
vue.$nextTick(function () {
E = window.wangEditor
menu = [
'head', // 标题
'bold', // 粗体
'fontSize', // 字号
'fontName', // 字体
'italic', // 斜体
'underline', // 下划线
'strikeThrough', // 删除线
'foreColor', // 文字颜色
// 'backColor', // 背景颜色
'link', // 插入链接
'list', // 列表
'justify', // 对齐方式
'quote', // 引用
'emoticon', // 表情
// 'image', // 插入图片
'table', // 表格
// 'code', // 插入代码
// 'undo', // 撤销
// 'redo' // 重复
]
for (key in editor) {
$('#' + key).html("")
editor[key] = new E('#' + key)
editor[key].config.menus = menu
editor[key].create()
}
editor.hdjsEditor.txt.html(vue.formData.hdjs)
editor.cjryEditor.txt.html(vue.formData.hdcjry)
editor.jlfsEditor.txt.html(vue.formData.hdjlfs)
editor.hdnrEditor.txt.html(vue.formData.hdnr)
editor.lxrEditor.txt.html(vue.formData.hdlxr)
editor.otherEditor.txt.html(vue.formData.hdother)
self.refreshBox()
})
} else {
self.$message({
message: data.msg,
type: 'error'
});
}
}, 'json')
}
,
doEdit: function () {
var self = this;
self.changeFormEditorDataTxt()
self.$refs["addForm"].validate(function (valid) {
if (valid) {
self.changeFormEditorData()
self.formData.hdkssj = self.formData.time[0]
self.formData.hdjssj = self.formData.time[1]
var formdata = new FormData();
for (key in vue.formData) {
if (key == 'lbs' || key == 'bgis') {
formdata.append(key, JSON.stringify(vue.formData[key]));
} else {
formdata.append(key, vue.isNull(vue.formData[key]) ? '' : vue.formData[key]);
}
}
formdata.append("delFilesJson", JSON.stringify(self.delFiles))
vue.fileList.forEach(function (val) {
if (val.status == 'ready') {
formdata.append("files", val.raw, val.raw.name);
}
});
var loading = self.$loading({
lock: true,
text: '数据正在提交中,请稍后...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.ajax({
url: base + "/platform/hd/checkinManage/doEdit",
type: "post",
data: formdata,
processData: false,
contentType: false,
success: function (data) {
if (data.code === 0) {
self.$message.success('修改成功!');
self.addDialogVisible = false;
self.pageData()
} else {
self.$message.error(data.msg);
}
loading.close()
},
error: function (data) {
self.$message.error("应用程序出现异常!");
loading.close()
}
});
}
})
}
,
doAdd: function () {
var self = this;
self.changeFormEditorDataTxt()
self.$refs["addForm"].validate(function (valid) {
if (valid) {
self.changeFormEditorData()
self.formData.hdkssj = self.formData.time[0]
self.formData.hdjssj = self.formData.time[1]
var formdata = new FormData();
/*for (key in vue.formData) {
if (key == 'lbs') {
formdata.append(key, JSON.stringify(vue.formData[key]));
} else {
formdata.append(key, vue.isNull(vue.formData[key]) ? '' : vue.formData[key]);
}
}*/
formdata.append("data", JSON.stringify(self.formData))
vue.fileList.forEach(function (val) {
formdata.append("files", val.raw, val.raw.name);
});
var loading = self.$loading({
lock: true,
text: '数据正在提交中,请稍后...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
$.ajax({
url: base + "/platform/hd/checkinManage/doAdd",
type: "post",
data: formdata,
processData: false,
contentType: false,
success: function (data) {
if (data.code === 0) {
self.$message.success('创建成功!');
self.addDialogVisible = false;
localStorage.removeItem("wmhd_savedata2")
self.pageData()
} else {
self.$message.error(data.msg);
}
loading.close()
},
error: function (data) {
self.$message.error("应用程序出现异常!");
loading.close()
}
});
}
})
}
,
openAdd: function () {
var self = this;
this.selected = 'add'
if (localStorage.getItem("wmhd_savedata2")) {
try {
this.formData = JSON.parse(localStorage.getItem("wmhd_savedata2"))
} catch (e) {
localStorage.removeItem('wmhd_savedata2')
this.formData = {
hdtype: 2,
hdcolor: this.colorList[0],
username: "${@shiro.getPrincipalProperty('username')}",
hdcjsj: moment().format('YYYY-MM-DD'),
lbs: [{zplbs: [{}]}],
};
}
} else {
this.formData = {
hdtype: 2,
hdcolor: this.colorList[0],
username: "${@shiro.getPrincipalProperty('username')}",
hdcjsj: moment().format('YYYY-MM-DD'),
lbs: [{zplbs: [{}]}],
};//打开新增窗口,表单先清空
}
this.fileList = []
if (this.$refs["addForm"])
this.$refs["addForm"].resetFields();
// this.addDialogVisible = true;
this.$refs.guava.edit()
vue.$nextTick(function () {
E = window.wangEditor
menu = [
'head', // 标题
'bold', // 粗体
'fontSize', // 字号
'fontName', // 字体
'italic', // 斜体
'underline', // 下划线
'strikeThrough', // 删除线
'foreColor', // 文字颜色
// 'backColor', // 背景颜色
'link', // 插入链接
'list', // 列表
'justify', // 对齐方式
'quote', // 引用
'emoticon', // 表情
// 'image', // 插入图片
'table', // 表格
// 'code', // 插入代码
// 'undo', // 撤销
// 'redo' // 重复
]
for (key in editor) {
$('#' + key).html("")
editor[key] = new E('#' + key)
editor[key].config.menus = menu
editor[key].create()
}
editor.hdjsEditor.txt.html(vue.formData.hdjs)
editor.cjryEditor.txt.html(vue.formData.hdcjry)
editor.jlfsEditor.txt.html(vue.formData.hdjlfs)
editor.hdnrEditor.txt.html(vue.formData.hdnr)
editor.lxrEditor.txt.html(vue.formData.hdlxr)
editor.otherEditor.txt.html(vue.formData.hdother)
if (localStorage.getItem("wmhd_savedata2")) {
vue.refreshBox()
} else {
$('#myIframe').attr('src', $('#myIframe').attr('src'));
}
})
}
,
doSearch: function () {
this.pageForm.pageNumber = 1;
this.pageData();
}
,
pageOrder: function (column) {//按字段排序
switch (column.order) {
case 'descending':
column.order = 'desc'
break
case "ascending":
column.order = 'asc'
break
}
this.pageForm.pageOrderName = column.prop;
this.pageForm.pageOrderBy = column.order;
this.pageData();
}
,
pageNumberChange: function (val) {//页码更新操作
this.pageForm.pageNumber = val;
this.pageData();
}
,
pageSizeChange: function (val) {//分页大小更新操作
this.pageForm.pageSize = val;
this.pageData();
}
,
pageData: function () {//加载分页数据
var self = this;
sublime.showLoadingbar();//显示loading
$.post(base + "/platform/hd/checkinManage/data", self.pageForm, function (data) {
sublime.closeLoadingbar();//关闭loading
if (data.code == 0) {
self.tableData = data.data.list;
self.pageForm.totalCount = data.data.totalCount;
} else {
self.$message({
message: data.msg,
type: 'error'
});
}
}, "json");
}
,
},
created: function () {
this.pageData();
}
})
</script>
<!--#
}
#-->