diff --git a/boilerplate/mock/api/page1/page1.json b/boilerplate/mock/api/page1/page1.json index d7c497a..03c45b4 100644 --- a/boilerplate/mock/api/page1/page1.json +++ b/boilerplate/mock/api/page1/page1.json @@ -1 +1,30 @@ -{"success":true,"msg":"来自page1的后台模拟数据"} +{ + "success": true, + "hh":"xx", + "msg": [{ + "vyear": "2016", + "contractUnionId": "20160101", + "vstatus": "开立" + }, { + "vyear": "2016", + "contractUnionId": "20160102", + "vstatus": "关闭" + }, { + "vyear": "2017", + "contractUnionId": "20160102", + "vstatus": "关闭" + }], + "msg1":[{ + "unionContractPeople": "张三", + "idNumber": "20160101", + "vnote": "开立" + }, { + "unionContractPeople": "李四", + "idNumber": "20160101", + "vnote": "开立" + }, { + "unionContractPeople": "王五", + "idNumber": "20160101", + "vnote": "开立" + }] +} diff --git a/boilerplate/src/components/home/home.css b/boilerplate/src/components/home/home.css index 28517ca..3696d01 100644 --- a/boilerplate/src/components/home/home.css +++ b/boilerplate/src/components/home/home.css @@ -391,6 +391,7 @@ li.last>h5 { } .page-container { + padding-top: 70px; margin-left: 200px; -webkit-transition: all .3s ease-in-out; -moz-transition: all .3s ease-in-out; diff --git a/boilerplate/src/containers/page1/index.css b/boilerplate/src/containers/page1/index.css index 86bc48c..e69de29 100644 --- a/boilerplate/src/containers/page1/index.css +++ b/boilerplate/src/containers/page1/index.css @@ -1,3 +0,0 @@ -.page1 { - border: 1px dashed #c53526; -} diff --git a/boilerplate/src/containers/page1/index.html b/boilerplate/src/containers/page1/index.html index bce00dd..eaa67fc 100644 --- a/boilerplate/src/containers/page1/index.html +++ b/boilerplate/src/containers/page1/index.html @@ -1,3 +1,150 @@ -
-

页面一

-
\ No newline at end of file +
+
+
快速查询
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ + +
+ +
+ +
+
+
+ +
+
+
+ + + +
+
+
+ +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+

基本卡片

+
+ +
+
+
+ + +
+
+ +
+ +
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+ + +
+
+
+ +
+
+
+ + + + +
+
+
+
+
+
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
diff --git a/boilerplate/src/containers/page1/index.js b/boilerplate/src/containers/page1/index.js index de9cf05..6e1965d 100644 --- a/boilerplate/src/containers/page1/index.js +++ b/boilerplate/src/containers/page1/index.js @@ -1,8 +1,172 @@ require('./index.css'); +var pageHtml = require('./index.html'); module.exports = function() { - require(['./index.html', 'jquery'], function(html, K) { - console.log(K.fn.jquery); - document.querySelector('.content').innerHTML = html; + + document.querySelector('.page-container').innerHTML = pageHtml; + var meta = { + meta: { + vyear: { + type: 'string', + default: new Date().getFullYear() + }, + contractUnionId: { + type: "string" + }, + vstatus: { + type: "string", + default: '开立' + }, + } + }; + var meta_2 = { + meta: { + 'unionContractPeople': { //联保方 + type: "string", + }, + 'idNumber': { //身份证号/统一社会编码 + type: "string" + }, + 'vnote': { + type: "string" + } + } + }; + var data = { + listTable_1: new u.DataTable(meta), + listTable_2: new u.DataTable(meta_2), + cardTable: new u.DataTable(meta), + itemTable: new u.DataTable(meta_2), + formState: [{ + name: '开立', + value: '开立' + }, { + name: '关闭', + value: '关闭' + }], + }; + + var events = { + addClick: function() { + var row = viewModel.cardTable.createEmptyRow(); + viewModel.cardTable.setRowFocus(row); + + var a = document.getElementById('u_master'); + a.style.display = "none"; + var md = document.querySelector('#u_md')['u.MDLayout']; + md.dGo('card_show'); + }, + delClick: function() { + var row = viewModel.listTable_1.getSelectedRows(); + if (row.length > 0) { + viewModel.listTable_1.removeRows(row); + viewModel.listTable_2.removeAllRows(); + } else { + u.showMessage({ + msg: "未选中行", + position: "center" + }); + } + }, + updClick: function() { + var row = viewModel.listTable_1.getSelectedRows(); + if (row.length > 0) { + var data = row[0].getData().data; + viewModel.cardTable.setSimpleData(data); + viewModel.itemTable.setSimpleData(viewModel.listTable_2.getSimpleData()); + var md = document.querySelector('#u_md')['u.MDLayout']; + md.dGo('card_show'); + } else { + u.showMessage({ + msg: "未选中行", + position: "center" + }); + } + }, + searchClick: function() { + + }, + resetClick: function() { + $(document).find('#u_master').find('input').val(''); + }, + saveClick: function() { + var status = viewModel.cardTable.getSelectedRows()[0].status; + var data = viewModel.cardTable.getCurrentRow().getData().data; + if (data) { + if (status != "new") { + var meta = viewModel.cardTable.meta; + for (var field in meta) { + viewModel.listTable_1.setValue(field, data[field].value); + } + } else { + viewModel.listTable_1.addSimpleData(data); + var length = viewModel.listTable_1.getSimpleData().length; //获取当前主表数据条数 + viewModel.listTable_1.setRowSelect(length - 1); //设置新增行的选中 + viewModel.listTable_2.setSimpleData(viewModel.itemTable.getSimpleData()); + } + } + + u.showMessage({ + msg: "保存成功", + position: "center" + }); + viewModel.cardTable.clear(); + viewModel.backClick(); + + }, + backClick: function() { + var md = document.querySelector('#u_md')['u.MDLayout']; + document.querySelector('.u-mdlayout-master').style.display = "block"; + viewModel.cardTable.clear(); + viewModel.itemTable.clear(); + md.dBack(); + }, + rowClick: function() { + viewModel.listTable_2.clear(); + viewModel.listTable_2.setSimpleData([{ + "unionContractPeople": '张三', + "idNumber": '20160101', + "vnote": '开立' + }, ]); + }, + addItemClick: function() { + var row = viewModel.itemTable.createEmptyRow(); + viewModel.itemTable.setRowFocus(row); + }, + delItemClick: function() { + var row = viewModel.itemTable.getSelectedRows(); + if (row.length > 0) { + viewModel.itemTable.removeRows(row); + } else { + u.showMessage({ + msg: "未选中行", + position: "center" + }); + } + } + }; + + var varinit = function() { + $.ajax({ + type: "get", + url: "./api/page1/page1.json", + dataType: "json", + async: true, + success: function(data) { + if (data.success) { + viewModel.listTable_1.setSimpleData(data.msg); + viewModel.listTable_2.setSimpleData(data.msg1); + } + } + }); + }; + + var viewModel = u.extend({}, data, events); + $(function() { + var app = u.createApp({ + el: "#u_md", + model: viewModel + }); + varinit(); }); } diff --git a/boilerplate/src/index.html b/boilerplate/src/index.html index bcd4da5..ed8a69b 100644 --- a/boilerplate/src/index.html +++ b/boilerplate/src/index.html @@ -6,6 +6,8 @@ + + @@ -22,7 +24,7 @@
yunweipingtai
- +
@@ -59,7 +61,7 @@ 消费记录
  • - 工单 + 工单 @@ -79,7 +81,7 @@