• 【.net core】yisha框架单页面双列表联动效果示例


     gridTable1列表数据为gridTable别表数据的子数据,点击gridTable时gridTable1列表数据更新,

    1. @{
    2. Layout = "~/Views/Shared/_Index.cshtml";
    3. }
    4. <div class="container-div">
    5. <div class="row">
    6. <div id="searchDiv" class="col-sm-12 search-collapse">
    7. <div class="select-list">
    8. <ul>
    9. <li>
    10. 合同名称:<input id="name" col="name" type="text" />
    11. li>
    12. <li>
    13. 签订时间:<input id="signDate" col="signDate" type="text" />
    14. li>
    15. <li>
    16. 负责人:<input id="headUser" col="headUser" type="text" />
    17. li>
    18. <li>
    19. 审核状态:<input id="status" col="status" type="text" />
    20. li>
    21. <li>
    22. <a id="btnSearch" class="btn btn-primary btn-sm" onclick="searchGrid()"><i class="fa fa-search">i> 搜索a>
    23. li>
    24. ul>
    25. div>
    26. div>
    27. <div class="btn-group-sm hidden-xs" id="toolbar">
    28. <a id="btnAdd" class="btn btn-success" onclick="showSaveForm(true)"><i class="fa fa-plus">i> 新增a>
    29. <a id="btnEdit" class="btn btn-primary disabled" onclick="showSaveForm(false)"><i class="fa fa-edit">i> 修改a>
    30. <a id="btnDelete" class="btn btn-danger disabled" onclick="deleteForm()"><i class="fa fa-remove">i> 删除a>
    31. div>
    32. <div class="btn-group-sm hidden-xs" id="toolbar">
    33. <a id="btnAddDetail" class="btn btn-success" onclick="showSaveDetailForm(true)"><i class="fa fa-plus">i> 新增a>
    34. <a id="btnEditDetail" class="btn btn-primary disabled" onclick="showSaveDetailForm(false)"><i class="fa fa-edit">i> 修改a>
    35. <a id="btnDeleteDetail" class="btn btn-danger disabled" onclick="deleteDetailForm()"><i class="fa fa-remove">i> 删除a>
    36. div>
    37. <div class="col-sm-12 select-table table-striped" style="min-height: 47%;max-height: 47%">
    38. <table id="gridTable" data-mobile-responsive="true">table>
    39. div>
    40. <div class="col-sm-12 select-table table-striped" style="min-height: 47%;max-height: 47%">
    41. <table id="gridTable1" data-mobile-responsive="true">table>
    42. div>
    43. div>
    44. div>
    45. <script type="text/javascript">
    46. var curContractId = '0'
    47. $(function () {
    48. initGrid();
    49. initDetailGrid('0');
    50. });
    51. function initGrid() {
    52. var queryUrl = '@Url.Content("~/ContractManage/Salesmanagement/GetPageListJson")';
    53. $('#gridTable').ysTable({
    54. url: queryUrl,
    55. height:'350',
    56. onClickRow: function (row) {//单击事件,点击触发gridTable1表数据更新
    57. console.log('click',row.Id)
    58. refreshDetailGrid({ ContractId :row.Id});//渲染详细列表数据
    59. },
    60. columns: [
    61. { checkbox: true, visible: true },
    62. { field: 'Id', title: 'Id', visible: false },
    63. { field: 'name', title: '合同名称' },
    64. { field: 'signDate', title: '签订时间' },
    65. //{ field: 'contractNum', title: '合同编码' },
    66. //{ field: 'internalcontractNum', title: '内部合同编号' },
    67. { field: 'internalUnit', title: '需求单位' },
    68. { field: 'batchName', title: '批次名称' },
    69. //{ field: 'proId', title: '产品id', visible: false },
    70. //{ field: 'proName', title: '产品名称' },
    71. //{ field: 'model', title: '型号' },
    72. { field: 'businessType', title: '业务类型' },
    73. //{ field: 'numbers', title: '数量' },
    74. //{ field: 'unit', title: '单位' },
    75. { field: 'contractAllMonwy', title: '合同总额' },
    76. { field: 'mateMoney', title: '匹配总额' },
    77. { field: 'performanceMoney', title: '履约金额' },
    78. { field: 'unPerformanceMoney', title: '未履约金额' },
    79. { field: 'invoicingMoney', title: '开票金额' },
    80. { field: 'unInvoicingMoney', title: '已匹配未开票金额' },
    81. {
    82. field: 'documentLink', title: '合同文件',
    83. formatter: function (value, row, index) {
    84. if (value != '') {
    85. return ''">下载'
    86. }
    87. }
    88. },
    89. { field: 'headUser', title: '负责人' },
    90. { field: 'addDate', title: '添加时间' },
    91. {
    92. field: 'status', title: '审核状态',
    93. formatter: function (value, row, index) {
    94. if (value == "@VerifyEnum.Pass.ParseToInt()") {
    95. return '' + "@VerifyEnum.Pass.GetDescription()" + '';
    96. }
    97. else if (value == "@VerifyEnum.UnPass.ParseToInt()") {
    98. return '' + "@VerifyEnum.UnPass.GetDescription()" + '';
    99. }
    100. else {
    101. return '' + "@VerifyEnum.Wait.GetDescription()" + '';
    102. }
    103. }
    104. },
    105. {
    106. field: 'orderStatus', title: '订单状态',
    107. formatter: function (value, row, index) {
    108. if (value == "@SalesOrderEnum.Ordered.ParseToInt()") {
    109. return '' + "@SalesOrderEnum.Ordered.GetDescription()" + '';
    110. }
    111. else if (value == "@SalesOrderEnum.Produced.ParseToInt()") {
    112. return '' + "@SalesOrderEnum.Produced.GetDescription()" + '';
    113. }
    114. else if (value == "@SalesOrderEnum.Shipped.ParseToInt()") {
    115. return '' + "@SalesOrderEnum.Shipped.GetDescription()" + '';
    116. }
    117. else if (value == "@SalesOrderEnum.Received.ParseToInt()") {
    118. return '' + "@SalesOrderEnum.Received.GetDescription()" + '';
    119. }
    120. else if (value == "@SalesOrderEnum.Invoiced.ParseToInt()") {
    121. return '' + "@SalesOrderEnum.Invoiced.GetDescription()" + '';
    122. }
    123. else {
    124. return '' + "@SalesOrderEnum.Wait.GetDescription()" + '';
    125. }
    126. }
    127. },
    128. {
    129. title: '操作',
    130. align: 'center',
    131. formatter: function (value, row, index) {
    132. var actions = [];
    133. if (row.status == 0) {
    134. actions.push('Id + '\')">审核 ');
    135. }
    136. return actions.join('');
    137. }
    138. }
    139. ],
    140. queryParams: function (params) {
    141. var pagination = $('#gridTable').ysTable('getPagination', params);
    142. var queryString = $('#searchDiv').getWebControls(pagination);
    143. return queryString;
    144. }
    145. });
    146. }
    147. function initDetailGrid() {
    148. var queryUrl = '@Url.Content("~/ContractManage/SealsManagementDetail/GetPageListJson")';
    149. console.log("initDetailGrid");
    150. $('#gridTable1').ysTable({
    151. url: queryUrl,
    152. height: '350',
    153. columns: [
    154. { checkbox: true, visible: true },
    155. { field: 'Id', title: 'Id', visible: false },
    156. { field: 'Name', title: '名称' },
    157. { field: 'BatchName', title: '批次名称' },
    158. { field: 'Model', title: '型号' },
    159. { field: 'Specs', title: '规格' },
    160. { field: 'Unit', title: '单位' },
    161. { field: 'Number', title: '数量' },
    162. ],
    163. queryParams: function (params) {
    164. var pagination = $('#gridTable1').ysTable('getPagination', params);
    165. var queryString = $('#searchDiv1').getWebControls(pagination);
    166. queryString.ContractId = curContractId;//检索明细参数
    167. console.log('queryString', queryString);
    168. return queryString;
    169. }
    170. });
    171. }
    172. function searchGrid() {
    173. $('#gridTable').ysTable('search');
    174. resetToolbarStatus();
    175. refreshDetailGrid({ ContractId: '0' });//初始化gridTable时清空gridTable1列表数据
    176. }
    177. function refreshDetailGrid(params){//点击主表行触发事件,刷新明细表数据为当前点击主表行明细数据
    178. curContractId = params.ContractId//赋值检索明细参数
    179. $('#gridTable1').ysTable('search');//更具条件查询gridTable1表
    180. }
    181. function showSaveForm(bAdd) {
    182. var id = 0;
    183. if (!bAdd) {
    184. var selectedRow = $('#gridTable').bootstrapTable('getSelections');
    185. if (!ys.checkRowEdit(selectedRow)) {
    186. return;
    187. }
    188. else {
    189. id = selectedRow[0].Id;
    190. }
    191. }
    192. ys.openDialog({
    193. title: id > 0 ? '编辑' : '添加',
    194. content: '@Url.Content("~/ContractManage/Salesmanagement/SalesmanagementForm")' + '?id=' + id,
    195. width: '968px',
    196. height: '750px',
    197. callback: function (index, layero) {
    198. var iframeWin = window[layero.find('iframe')[0]['name']];
    199. iframeWin.saveForm(index);
    200. }
    201. });
    202. }
    203. function deleteForm() {
    204. var selectedRow = $('#gridTable').bootstrapTable('getSelections');
    205. if (ys.checkRowDelete(selectedRow)) {
    206. ys.confirm('确认要删除选中的' + selectedRow.length + '条数据吗?', function () {
    207. var ids = ys.getIds(selectedRow);
    208. ys.ajax({
    209. url: '@Url.Content("~/ContractManage/Salesmanagement/DeleteFormJson")' + '?ids=' + ids,
    210. type: 'post',
    211. success: function (obj) {
    212. if (obj.Tag == 1) {
    213. ys.msgSuccess(obj.Message);
    214. searchGrid();
    215. }
    216. else {
    217. ys.msgError(obj.Message);
    218. }
    219. }
    220. });
    221. });
    222. }
    223. }
    224. function showSaveDetailForm(bAdd) {
    225. if (curContractId == '0') {
    226. ys.msgError('请先选择合同!');
    227. return false;
    228. }
    229. var id = 0;
    230. if (!bAdd) {
    231. var selectedRow = $('#gridTable1').bootstrapTable('getSelections');
    232. if (!ys.checkRowEdit(selectedRow)) {
    233. return;
    234. }
    235. else {
    236. id = selectedRow[0].Id;
    237. }
    238. }
    239. ys.openDialog({
    240. title: id > 0 ? '编辑' : '添加',
    241. content: '@Url.Content("~/ContractManage/SealsManagementDetail/SealsManagementDetailForm")' + '?id=' + id + '&ContractId=' + curContractId,
    242. width: '50%',
    243. height: '30%',
    244. callback: function (index, layero) {
    245. var iframeWin = window[layero.find('iframe')[0]['name']];
    246. iframeWin.saveForm(index);
    247. }
    248. });
    249. }
    250. function deleteDetailForm() {
    251. var selectedRow = $('#gridTable1').bootstrapTable('getSelections');
    252. if (ys.checkRowDelete(selectedRow)) {
    253. ys.confirm('确认要删除选中的' + selectedRow.length + '条数据吗?', function () {
    254. var ids = ys.getIds(selectedRow);
    255. ys.ajax({
    256. url: '@Url.Content("~/ContractManage/SealsManagementDetail/DeleteFormJson")' + '?ids=' + ids,
    257. type: 'post',
    258. success: function (obj) {
    259. if (obj.Tag == 1) {
    260. ys.msgSuccess(obj.Message);
    261. searchGrid();
    262. }
    263. else {
    264. ys.msgError(obj.Message);
    265. }
    266. }
    267. });
    268. });
    269. }
    270. }
    271. //详情
    272. function detail(id) {
    273. ys.openDialog({
    274. title: '查看详情',
    275. content: '@Url.Content("~/ContractManage/Salesmanagement/SalesmanagementForm")' + '?id=' + id +'&sType=1',
    276. width: '968px',
    277. height: '750px',
    278. callback: function (index, layero) {
    279. var iframeWin = window[layero.find('iframe')[0]['name']];
    280. iframeWin.saveForm(index);
    281. }
    282. });
    283. }
    284. //审核
    285. function SubVaild(id) {
    286. ys.openDialog({
    287. title: '审核',
    288. content: '@Url.Content("~/ContractManage/Salesmanagement/SalesmanagementVaild")' + '?id=' + id,
    289. width: '668px',
    290. height: '450px',
    291. callback: function (index, layero) {
    292. var iframeWin = window[layero.find('iframe')[0]['name']];
    293. iframeWin.saveForm(index);
    294. }
    295. });
    296. }
    297. //合同归档文件
    298. function address(id) {
    299. ys.openDialog({
    300. title: '上传合同归档文件',
    301. content: '@Url.Content("~/ContractManage/Salesmanagement/SalesmanagementContract")' + '?id=' + id,
    302. width: '768px',
    303. height: '450px',
    304. callback: function (index, layero) {
    305. var iframeWin = window[layero.find('iframe')[0]['name']];
    306. iframeWin.saveForm(index);
    307. }
    308. });
    309. }
    310. script>

  • 相关阅读:
    Ubuntu 20.04上docker安装Redis
    理解前端工程化
    猴子也能学会的jQuery第十二期——jQuery遍历(上)
    Aztec.nr:Aztec的隐私智能合约框架——用Noir扩展智能合约功能
    Java错误:找不到或无法加载主类
    C++编程语言的深度解析: 从零开始的学习路线
    Ant Design Vue 注册全局消息通知组件
    人工智能知识全面讲解:感知机原理
    Filter(过滤器)与Listener(监听器)详解
    从零开始学习Dubbo5——让模块独立运行下
  • 原文地址:https://blog.csdn.net/MoFe1/article/details/134006246