| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427 |
- <html>
- <head>
- <!--
- Vue 官网引用的是 animate.css 3.5 版本
- 不能引用 animate.css 最新版本
- vue 和 animate 版本兼容性问题会导致动画不起作用
- -->
- <link rel="stylesheet" href="/apps/space/css/mobile/animate@3.5.0.css" />
- <style>
- .animated {
- -webkit-animation-duration: .6s;
- animation-duration: .6s;
- }
- </style>
- </head>
- <body>
- <div id="space-content">
- <div class="content-wrap">
- <div id="mescroll" class="mescroll">
- <div class="main-contacts-list">
- <div v-for="(item, index) in backlog.auditData" :data-index="index">
- <!-- 动画 -->
- <transition name="fade" enter-active-class="animated fadeInDown"
- leave-active-class="animated fadeOutUp" v-for="(childItem, childIndex) in item.child">
- <!-- 卡片 -->
- <div class="vant-tabCard" v-show="childIndex == 0 || (item.expandActive)" v-if="item.child">
- <div class="vant-tabCard-wrap" :code="childItem.code" :allcode="childItem.allcode">
- <h2 class="vant-tabCard-title">
- <img :src="childItem.flowIcon" alt=""
- @click="flowInfo(childItem.token, childItem.auditInfoToken, childItem.code, childItem.allcode)" />
- <div style="width: 80%" v-if="childIndex == 0">
- <span
- @click="flowInfo(childItem.token, childItem.auditInfoToken)">{{childItem.flowTitle}}</span>
- </div>
- <span @click="flowInfo(childItem.token, childItem.auditInfoToken)"
- v-if="childIndex != 0">{{childItem.flowTitle}}</span>
- <div class="vant-tabCard-title-right" v-if="childIndex == 0">
- <div class="space-switch" :class="{'space-switch-right':item.expandActive}"
- @click="expandClick(index)">
- <span>收</span><span>开</span>
- <p>{{item.childNumber}}</p>
- </div>
- </div>
- </h2>
- <div class="vant-tabCard-iframe" style="opacity: 0.99;"
- @click="flowInfo(childItem.token, childItem.auditInfoToken, childItem.code, childItem.allcode)">
- <iframe :src="childIndex == 0 ? childItem.cardToken : '' " frameborder="0"
- :id="childItem.allcode + 'Frame'" v-if="childItem.cardToken"
- v-show="childIndex == 0 || (item.expandActive)"
- :data-src="childIndex == 0 ? '' : childItem.cardToken"
- style="width: 100%;position: relative;z-index: -1;"
- @load="childIndex == 0 ? loadFrame(childItem.allcode) : ''"></iframe>
- <!-- 遮罩 -->
- <div class="vant-tabCard-iframe-shade body-bg-white">
- <van-loading size="24px" style="text-align: center;margin-top: 52px;">
- </van-loading>
- </div>
- </div>
- <div class="vant-tabCard-bottom" v-if="!childItem.auditEntrance"
- @click="flowInfo(childItem.token, childItem.auditInfoToken, childItem.code, childItem.allcode)">
- <a href="javascript:;" style="font-size: 14px;">查看详情</a>
- <van-icon name="arrow" color="#aaa" class="vant-tabCard-bottom-right"
- style="margin-top: 3px;"></van-icon>
- </div>
- <div class="vant-tabCard-bottom">
- <div class="vant-tabCard-bottom-left">
- <span class="audit-time">{{childItem.time}}</span> 来自
- <span>{{childItem.applyPersonName}}</span>
- </div>
- <div class="vant-tabCard-bottom-right" v-if="!childItem.auditEntrance">
- <a href="javascript:;" @click="auditFlow(service.rejectURI, childItem.applyid, childItem.auditid)">退回</a>
- |
- <a href="javascript:;" @click="auditFlow(service.agreeURI, childItem.applyid, childItem.auditid)">同意</a>
- </div>
- <div class="vant-tabCard-bottom-right vant-tabCard-bottom-ckeck"
- v-if="childItem.auditEntrance"
- @click="flowInfo(childItem.token, childItem.auditInfoToken, childItem.code, childItem.allcode)">
- <a href="javascript:;">查看详情</a>
- <van-icon name="arrow"></van-icon>
- </div>
- </div>
- </div>
- <!-- 两层折叠 -->
- <div class="two-fold" v-if="!item.expandActive && childIndex == 0"></div>
- <div class="three-fold"
- v-if="!item.expandActive && childIndex == 0 && item.childNumber >= 3"></div>
- </div>
- </transition>
- <!-- 展开后显示 -->
- <img src="/apps/space/images/up.png" alt="" v-show="item.expandActive"
- @click="expandClick(index)" style="display:block;width: 40px;margin: -8px auto 0;">
- <!-- 卡片 -->
- <div class="vant-tabCard" v-if="!item.child">
- <div class="vant-tabCard-wrap" :code="item.code" :allcode="item.allcode">
- <h2 class="vant-tabCard-title"
- @click="flowInfo(item.token, item.auditInfoToken, item.code, item.allcode)">
- <img :src="item.flowIcon" alt="" />
- <span>{{item.flowTitle}}</span>
- </h2>
- <div class="vant-tabCard-iframe" style="opacity: 0.99;"
- @click="flowInfo(item.token, item.auditInfoToken, item.code, item.allcode)">
- <iframe :id="item.allcode + 'Frame'" :src="item.cardToken" frameborder="0"
- v-if="item.cardToken" @load="loadFrame(item.allcode)"
- style="width: 100%;position: relative;z-index: -1;"></iframe>
- <!-- 遮罩 -->
- <div class="vant-tabCard-iframe-shade body-bg-white">
- <van-loading size="24px" style="text-align: center;margin-top: 52px;">
- </van-loading>
- </div>
- </div>
- <div class="vant-tabCard-bottom" v-if="!item.auditEntrance"
- @click="flowInfo(item.token, item.auditInfoToken, item.code, item.allcode)">
- <a href="javascript:;" style="font-size: 14px;">查看详情</a>
- <van-icon name="arrow" color="#aaa" class="vant-tabCard-bottom-right"
- style="margin-top: 3px;"></van-icon>
- </div>
- <div class="vant-tabCard-bottom">
- <div class="vant-tabCard-bottom-left">
- <span>{{item.time}}</span> 来自
- <span>{{item.applyPersonName}}</span>
- </div>
- <div class="vant-tabCard-bottom-right" v-if="!item.auditEntrance">
- <a href="javascript:;" @click="auditFlow(service.rejectURI, item.applyid, item.auditid)">退回</a>
- |
- <a href="javascript:;" @click="auditFlow(service.agreeURI, item.applyid, item.auditid)">同意</a>
- </div>
- <div class="vant-tabCard-bottom-right vant-tabCard-bottom-ckeck"
- v-if="item.auditEntrance"
- @click="flowInfo(item.token, item.auditInfoToken, item.code, item.allcode)">
- <a href="javascript:;">查看详情</a>
- <van-icon name="arrow"></van-icon>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- <script type="text/javascript">
- space.vue = new Vue({
- el: space.appContent,
- data() {
- return {
- obj: {
- // rowCountPerPage: 10 // 每页的数据条数
- },
- service: {
- agreeURI: '@service{ name: `sys.sys_agree_audit_flow`, page: `toAuditResult` }@',
- rejectURI: '@service{ name: `sys.sys_reject_audit_flow`, page: `toAuditResult` }@',
- },
- // 待处理页面数据
- backlog: {
- auditData: [],
- // 是否初始化数据,默认进来就有数据,但不影响下拉刷新
- isInitData: false
- },
- prevOpenBacklog: {}, // 上一次打开的代办信息
- }
- },
- mounted: function () {
- this.initAuditData();
- this.initJumpBacklogData();
- },
- computed: {
- auditDataAry() {
- return this.backlog.auditData;
- }
- },
- watch: {
- auditDataAry(val) {
- $("body").removeClass('body-bg-gray');
- $("body").removeClass('body-bg-white');
- $("body").addClass(val.length > 0 ? 'body-bg-gray' : 'body-bg-white');
- this.autoOpenNextBacklog();
- }
- },
- methods: {
- /**
- * 初始化待办数据
- */
- initAuditData: function () {
- var that = this;
- space.plugin.paging.init({
- url: '@service{ name: `sys_audit_list_mobileTerminal` }@',
- data: that.obj,
- nodata: '<div class="no-data-search"><p>暂无数据</p></div>',
- up: function (resp) {
- that.initData(resp);
- that.refreshFlowNumber();
- },
- down: function () {
- // that.backlog.auditData = [];
- $(".van-loading").fadeIn(200);
- $(".vant-tabCard-iframe-shade").addClass("body-bg-white");
- }
- });
- },
- /**
- * 初始化待办数据
- * @param {Object} resp
- */
- initData: function (resp) {
- resp.auditListData.forEach(function (item) {
- item.expandActive = false; // 是否展开
- item.expandIcon = "expand-o"; // 展开与关闭的样式
- if (item.child) {
- item.child.forEach(function (childItem) {
- if (childItem.cardToken) {
- childItem.loading = true; // 加载动画
- }
- })
- }
- if (item.cardToken) {
- item.loading = true; // 加载动画
- }
- })
- this.backlog.auditData = resp.auditListData;
- window.parent.space.vue.setAuditNumber(resp.auditNumber);
- },
- /**
- * 多级卡片展开
- * @param {Object} index this.backlog.auditData 数组的索引
- */
- expandClick: function (index) {
- this.backlog.auditData[index].expandActive = !this.backlog.auditData[index].expandActive;
- // 展开
- if (this.backlog.auditData[index].expandActive) {
- var that = this;
- this.backlog.auditData[index].expandIcon = "shrink";
- var loadFrameAry = $("div[data-index='" + index + "']").find("iframe");
- for (let index = 1; index < loadFrameAry.length; index++) {
- var element = loadFrameAry[index];
- const elementConst = loadFrameAry[index];
- $(element).attr('src', $(element).attr('data-src'));
- $(element).removeAttr('data-src');
- $(element)[0].onload = function (e) {
- that.loadFrame($(elementConst)[0].id.replace("Frame", ""))
- };
- }
- }
- // 收起
- else {
- this.backlog.auditData[index].expandIcon = "expand-o";
- }
- // 重新设置,不然不生效
- Vue.set(this.backlog.auditData, index, this.backlog.auditData[index]);
- },
- /**
- * 审核流程(同意、退回)
- * @param {Object} url
- */
- auditFlow: function (url, applyid, auditid) {
- var _this = this;
- space.utils.ajax({
- url: url,
- data: {
- "applyid": applyid,
- "auditid": auditid
- },
- dataType: 'json',
- loadMsg: '审核中',
- callback: function (data) {
- if (data.code == "success") {
- space.plugin.paging.refresh();
- top.space.message.success('审核成功')
- } else {
- top.space.message.error('系统繁忙,请稍后再试')
- }
- }
- });
- },
- /**
- * 刷新流程数量
- */
- refreshFlowNumber: function () {
- var _this = this;
- space.utils.ajax({
- url: '@service{ name:`sys_flow_number` }@',
- dataType: 'json',
- loadLayer: false,
- callback: function (data) {
- window.parent.space.vue.setApplyNumber(data.applyNumber);
- window.parent.space.vue.setHaveDoneNumber(data.haveDoneNumber);
- window.parent.space.vue.setAuditNumber(data.auditNumber);
- window.parent.space.vue.refreshBacklogDot();
- }
- });
- },
- /**
- * 查看
- * @param {Object} url
- */
- flowInfo: function (url, auditInfoUrl, code, allcode) {
- if (auditInfoUrl) {
- space.utils.ajax({
- url: auditInfoUrl,
- dataType: 'json'
- });
- }
- space.plugin.appWindow.show({
- 'title': '查看',
- 'url': url,
- 'position': 'right',
- close: function () {
- space.plugin.paging.refresh();
- }
- });
- this.prevOpenBacklog = {
- code: code,
- allcode: allcode
- }
- },
- /**
- * 加载动画
- * @param {Object} allcode allcode
- */
- loadFrame: function (allcode) {
- var frameDom = $("#" + allcode + "Frame");
- frameDom[0].contentWindow.loadReady = function (params) {
- $(frameDom[0]).parents("div.vant-tabCard-iframe").css("height", params.height + "px");
- }
- var that = this;
- // 隐藏动画
- for (var index = 0; index <= 1; index++) {
- setTimeout(() => {
- that.hideFrameLoad(frameDom);
- }, 1000 * index);
- }
- },
- hideFrameLoad: function (frameDom) {
- var shadeEle = $(frameDom).next("div.vant-tabCard-iframe-shade");
- $(shadeEle).find(".van-loading").hide();
- $(shadeEle).removeClass('body-bg-white')
- },
- /**
- * 自动打开下一个办理页
- */
- autoOpenNextBacklog: function () {
- this.$nextTick(function () {
- // 上一次的办理信息
- if (!this.prevOpenBacklog.code) {
- return;
- }
- // 找同流程的所有节点
- var warpCardCodeAry = $(".vant-tabCard-wrap[code='" + this.prevOpenBacklog.code + "']");
- if (warpCardCodeAry.length == 0) {
- return;
- }
- // 找上一次的审核节点
- var warpCardAllCodeAry = $(".vant-tabCard-wrap[allcode='" + this.prevOpenBacklog.allcode + "']");
- if (warpCardAllCodeAry.length > 0) {
- return;
- }
- // 只有一个的时候才打开
- if (warpCardCodeAry.length == 1) {
- setTimeout(() => {
- $(warpCardCodeAry[0]).find(".vant-tabCard-title").click();
- }, 800);
- }
- })
- },
- /**
- * 初始化单点登录的待办(一般是微信消息点击进来的)
- **/
- initJumpBacklogData: function () {
- var mjb = space.localStorage.getItem("msgJumpBacklog");
- if (!mjb) {
- return;
- }
- space.localStorage.removeItem("msgJumpBacklog");
- this.prevOpenBacklog = mjb;
- }
- }
- })
- </script>
- </html>
|