- 注册时间
- 2013-8-5
- 最后登录
- 2013-8-20
- 阅读权限
- 10
- 积分
- 164
- 精华
- 0
- 帖子
- 59
|
ouyangzhiming 发表于 2013-8-9 11:12
相关合同:
<script type="text/javascript">
mini.parse();
var grid = mini.get("datagrid1");
//隐藏列
grid.load();
var data = [];
grid.setData(data)
//////////////////////////////////////////////////////
function search() {
var key = mini.get("key").getValue();
grid.load({ key: key });
}
function onKeyEnter(e) {
search();
}
function onReceivableDateRenderer(e) {
var time = e.value;
if(!time){
return;
}
var d = new Date(time);
if (time) return d.getFullYear()+"-"+((d.getMonth()+1)<10 ? "0"+(d.getMonth()+1) : (d.getMonth()+1))+"-"+(d.getDate()< 10 ? "0"+d.getDate():d.getDate() )+" "+(d.getHours()< 10 ? "0"+d.getHours():d.getHours())+":"+(d.getMinutes()<10?"0"+d.getMinutes():d.getMinutes())+":"+(d.getSeconds()<10?"0"+d.getSeconds():d.getSeconds())
return "";
}
function addRow() {
var newRow = { name: "New Row" };
var length = grid.getData().length;
grid.addRow(newRow, length);
}
function removeRow() {
var rows = grid.getSelecteds();
if (rows.length > 0) {
mini.confirm("确定删除记录?", "确定?",
function (action) {
if (action == "ok") {
grid.removeRows(rows, true);
}
});
}else{
mini.alert('请选择要删除的行','系统提示');
}
}
function onCellValidation(e) {
if (e.field == "phase") {
if (e.value == '' || e.value == null) {
e.isValid = false;
e.errorText = "请输入计划收款阶段"; }
}
if (e.field == "amount") {
if (e.value == 0) {
e.isValid = false;
e.errorText = "请输入收款金额";
}
}
}
////////////////////
//标准方法接口定义
function SetData(data) {
if (data.action == "insertAccount") {
//显示行详细
var insertAccountForm = new mini.Form("insertAccountForm");
//跨页面传递的数据对象,克隆后才可以安全使用
var o = mini.decode(data);
insertAccountForm.setData(o);
insertAccountForm.setChanged(false);
}
}
function onAccountSummaryCell(e) {
var result = e.result;
var grid = e.sender;
if (e.field == "accoutAmount") {
var s = "<span style='color:Brown;padding-left:150px;'>"
s += e.cellHtml + "</span>";
e.cellHtml = s;
}
}
function howManyRow(i){
return '第'+(i+1)+'行的';
}
function insertAccount() {
var data = grid.getChanges();
var json = mini.encode(data);
var form = new mini.Form("#insertAccountForm");
form.validate();
if (form.isValid() == false) return;
var length = grid.getData().length;
if(length == 0){
mini.alert('必须填写一条到账信息','系统提示');
return;
}
var data = grid.getData();
for(var i=0,l=data.length; i<l; i++){
var row = data;
if(row.accountAmount == "" || row.accountAmount == null || row.accountAmount == 0){
mini.alert(howManyRow(i)+'到账金额未填写','系统提示');
return true;
}
if(row.receiveDate == "" || row.receiveDate == null){
mini.alert(howManyRow(i)+'到账时间未选择','系统提示');
return true;
}
if(row.ownUnit == "" || row.ownUnit == null){
mini.alert(howManyRow(i)+'归属中心未填写','系统提示');
return true;
}
if(row.remark == "" || row.remark == null){
mini.alert(howManyRow(i)+'备注未填写','系统提示');
return true;
}
}
var o = form.getData();
var formData = mini.encode([o]);
mini.mask({
el: document.body,
cls: 'mini-mask-loading',
html: '加载中...'
});
$.ajax({
url: "fee.insertAccount.do",
data: { data: json,formData:formData},
type: "post",
success: function (text) {
text = mini.decode(text);
mini.alert('操作成功','系统提示',function(){
CloseWindow('save');
window.Owner.realodAcountGrid();
});
mini.unmask(document.body);
},
error: function (jqXHR, textStatus, errorThrown) {
mini.alert('系统错误','系统提示');
mini.unmask(document.body);
}
});
}
function CloseWindow(action) {
if (action == "close" && form.isChanged()) {
if (confirm("数据被修改了,是否先保存?")) {
return false;
}
}
if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
else window.close();
}
</script>
</body>
</html>
完整代码贴出来,请帮我检查下 |
|