You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
200 lines
9.3 KiB
Plaintext
200 lines
9.3 KiB
Plaintext
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>数据快照</title>
|
|
|
|
<script src="../../Scripts/jquery-1.11.0.min.js"></script>
|
|
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
|
|
<script src="../../Scripts/config.js" type="text/javascript"></script>
|
|
<script src="../../Comm/Gener.js" type="text/javascript"></script>
|
|
<link href="../../js/mui/css/mui.min.css" rel="stylesheet" />
|
|
<script src="../../js/mui/js/mui.min.js" type="text/javascript"></script>
|
|
<script src="../../Scripts/vue.js" type="text/javascript"></script>
|
|
|
|
</head>
|
|
<body>
|
|
<div id="DataVer">
|
|
<header class="mui-bar mui-bar-nav">
|
|
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
|
|
<a class="mui-icon mui-icon-right-nav mui-pull-right" @click="NewVer">创建数据快照</a>
|
|
<h1 class="mui-title">数据快照</h1>
|
|
</header>
|
|
<div class="mui-content">
|
|
<div class="mui-scroll">
|
|
<ul class="mui-table-view" v-for="(data,idx) in dataGrid" :key="idx">
|
|
<li class="mui-table-view-cell mui-media">
|
|
<a href="javascript:;">
|
|
<div class="mui-media-body">
|
|
<template v-for="item in data">
|
|
<span v-if="item.indexOf('IsChangetrue')!=-1">
|
|
数据有无变化:<font style="color:red">有</font>
|
|
</span>
|
|
<span v-else-if="item.indexOf('IsChangefalse')!=-1">
|
|
数据有无变化:无
|
|
</span>
|
|
<span v-else=v-else>
|
|
{{item}}
|
|
</span>
|
|
<br />
|
|
|
|
</template>
|
|
<button type="button" class="mui-btn mui-btn-primary mui-btn-outlined" @click="AppFieldData(data)">应用</button>
|
|
</div>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<ul class="mui-table-view" v-for="ver in vers" :key="ver.MyPK">
|
|
<li class="mui-table-view-cell mui-media">
|
|
<a href="javascript:;">
|
|
<div class="mui-media-body">
|
|
#{{ver.EnVer}}<br />
|
|
日期:{{ver.RDT}}<br />
|
|
拍照人:{{ver.RecNo}}<br />
|
|
名称:{{ver.RecName}}<br />
|
|
备注:{{ver.MyNote}}<br />
|
|
<button type="button" class="mui-btn mui-btn-primary mui-btn-outlined" @click="Delete(ver.MyPK)">删除快照</button>
|
|
<button type="button" class="mui-btn mui-btn-primary mui-btn-outlined" @click="Reback(ver.MyPK)">还原到此位置</button>
|
|
</div>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
<form id="cc" name="cc" class="mui-input-group" style="margin-bottom:50px">
|
|
<div id="docs"></div>
|
|
</form>
|
|
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
new Vue({
|
|
el: "#DataVer",
|
|
data: {
|
|
frmID: GetQueryString("FrmID"),
|
|
workID: GetQueryString("WorkID"),
|
|
vers: [],
|
|
verDtls: [],
|
|
mapAttrs: [],
|
|
frmEn: {},
|
|
dataGrid:[],
|
|
},
|
|
methods: {
|
|
loadData: function () {
|
|
|
|
var sysFiels = ",AtPara,OID,WorkID,WFState,BillNo,Title,RDT,CDT,OrgNo,Starter,StarterName,BillState,FK_Dept,";
|
|
var _this = this;
|
|
var idx = 0;
|
|
$.each(_this.mapAttrs, function (i, mapAttr) {
|
|
if (sysFiels.indexOf(',' + mapAttr.KeyOfEn + ',') >= 0)
|
|
return true;
|
|
if (mapAttr.UIContralType >= 4)
|
|
return true;
|
|
var data = [];
|
|
data.push("字段:" + mapAttr.KeyOfEn);
|
|
data.push("名称:" + mapAttr.Name);
|
|
var isChange = false;
|
|
var myval = null;
|
|
_this.vers.forEach(function (ver) {
|
|
var verDtls = $.grep(_this.verDtls, function (verDtl) {
|
|
return verDtl.RefPK == ver.MyPK && verDtl.AttrKey == mapAttr.KeyOfEn
|
|
})
|
|
if (verDtls.length == 0)
|
|
data.push("版本号[" + ver.EnVer + "]:无数据");
|
|
else {
|
|
var verDtl = verDtls[0];
|
|
if (myval == null)
|
|
myval = verDtl.MyVal;
|
|
if (myval != verDtl.MyVal)
|
|
isChange = true;
|
|
data.push("版本号[" + ver.EnVer + "]:" + myval);
|
|
}
|
|
})
|
|
|
|
data.push("IsChange" + isChange);
|
|
if (mapAttr.UIContralType == 0)
|
|
data.push("当前数据:" + _this.frmEn[mapAttr.KeyOfEn]);
|
|
else
|
|
data.push("当前数据:[" + _this.frmEn[mapAttr.KeyOfEn] + "][" + _this.frmEn[mapAttr.KeyOfEn + 'Text'] + "]");
|
|
_this.dataGrid[idx] = data;
|
|
idx++;
|
|
})
|
|
},
|
|
AppFieldData: function (array) {
|
|
var keyOfEn = array[0].replace("字段:", "");
|
|
var val = window.prompt("请输入要复原的版本号: (请输入数字,1,2,3)", "1");
|
|
if(val == undefined || val == null)
|
|
return;
|
|
|
|
//设置为主版本.
|
|
var handler = new HttpHandler("BP.CCBill.WF_CCBill_OptComponents");
|
|
handler.AddUrlData();
|
|
handler.AddPara("KeyOfEn", keyOfEn);
|
|
handler.AddPara("VerNum", val);
|
|
var data = handler.DoMethodReturnString("DataVer_AppFieldData");
|
|
alert(data);
|
|
if (data.indexOf("err@") == 0) {
|
|
return;
|
|
}
|
|
Reload();
|
|
},
|
|
Reback: function (mypk) {
|
|
if (window.confirm("确定要还原到当前的快照吗?现有的数据将会被覆盖,请慎重执行。") == false)
|
|
return;
|
|
|
|
var handler = new HttpHandler("BP.CCBill.WF_CCBill_OptComponents");
|
|
handler.AddUrlData();
|
|
handler.AddPara("MyPK", mypk);
|
|
var data = handler.DoMethodReturnString("DataVer_Reback");
|
|
alert(data);
|
|
if (data.indexOf("err@") == 0) {
|
|
return;
|
|
}
|
|
window.location.reload();
|
|
},
|
|
Delete: function (mypk) {
|
|
if (window.confirm("系统将要删除备份的快照数据,您确定要删除吗?") == false)
|
|
return;
|
|
var en = new Entity("BP.Sys.EnVer", mypk);
|
|
en.Delete(); //已经在删除的逻辑里写了删除dtl数据。
|
|
Reload();
|
|
},
|
|
NewVer: function () {
|
|
var val = window.prompt("备注*", "");
|
|
if (val == null || val == undefined) return;
|
|
if (val == "") val = "无";
|
|
|
|
var handler = new HttpHandler("BP.CCBill.WF_CCBill_OptComponents");
|
|
handler.AddUrlData();
|
|
handler.AddPara("MyNote", val);
|
|
|
|
var data = handler.DoMethodReturnString("DataVer_NewVer");
|
|
if (data.indexOf("err@") == 0) {
|
|
return;
|
|
}
|
|
|
|
window.location.reload(); // = url;
|
|
}
|
|
|
|
},
|
|
created() {
|
|
//查询出来版本.
|
|
var vers = new Entities("BP.Sys.EnVers");
|
|
vers.Retrieve("FrmID", this.frmID, "EnPKValue", this.workID, "EnVer");
|
|
this.vers = vers.TurnToArry();
|
|
//所有的快照数据.
|
|
var verDtls = new Entities("BP.Sys.EnVerDtls");
|
|
verDtls.Retrieve("FrmID", this.frmID, "EnPKValue", this.workID);
|
|
this.verDtls = verDtls.TurnToArry();
|
|
//所有的字段.
|
|
var mapAttrs = new Entities("BP.Sys.MapAttrs");
|
|
mapAttrs.Retrieve("FK_MapData", this.frmID);
|
|
this.mapAttrs = mapAttrs.TurnToArry();
|
|
this.frmEn = new Entity(this.frmID, this.workID);
|
|
this.loadData();
|
|
}
|
|
})
|
|
</script>
|
|
</body>
|
|
</html>
|