religionPerson.html 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('教职人员列表')" />
  5. <th:block th:include="include :: datetimepicker-css" />
  6. </head>
  7. <body class="gray-bg">
  8. <div class="container-div">
  9. <div class="row">
  10. <div class="col-sm-12 search-collapse">
  11. <form id="formId">
  12. <div class="select-list">
  13. <ul>
  14. <li>
  15. <label>所属场所:</label>
  16. <select id="placeId" name="placeId" class="form-control">
  17. <option value="">所有场所</option>
  18. <option th:each="place : ${placeList}" th:value="${place.placeId}" th:text="${place.placeName}"></option>
  19. </select>
  20. </li>
  21. <li>
  22. <label>姓名:</label>
  23. <input type="text" name="name" placeholder="请输入姓名"/>
  24. </li>
  25. <li>
  26. <label>身份证号:</label>
  27. <input type="text" name="idNumber" placeholder="请输入身份证号"/>
  28. </li>
  29. <li>
  30. <label>宗教类别:</label>
  31. <select name="religionType" th:with="type=${@dict.getType('religion_type')}">
  32. <option value="">所有</option>
  33. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  34. </select>
  35. </li>
  36. <li>
  37. <label>所属区县:</label>
  38. <select name="county" class="form-control" th:with="type=${@dict.getType('region_xa_district')}">
  39. <option value="">所有区县</option>
  40. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  41. </select>
  42. </li>
  43. <li>
  44. <label>民族:</label>
  45. <select name="nation" class="form-control" th:with="type=${@dict.getType('sys_nation')}">
  46. <option value="">所有民族</option>
  47. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  48. </select>
  49. </li>
  50. <li>
  51. <label>联系电话:</label>
  52. <input type="text" name="phone" placeholder="请输入联系电话"/>
  53. </li>
  54. <li>
  55. <label>状态:</label>
  56. <select name="status" th:with="type=${@dict.getType('person_status')}">
  57. <option value="">所有</option>
  58. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  59. </select>
  60. </li>
  61. <li>
  62. <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
  63. <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
  64. </li>
  65. </ul>
  66. </div>
  67. </form>
  68. </div>
  69. <div class="btn-group-sm" id="toolbar" role="group">
  70. <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="religion:religionPerson:add">
  71. <i class="fa fa-plus"></i> 添加
  72. </a>
  73. <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="religion:religionPerson:edit">
  74. <i class="fa fa-edit"></i> 修改
  75. </a>
  76. <a class="btn btn-info" onclick="openBatchUpdateModal()" shiro:hasPermission="religion:religionPerson:edit">
  77. <i class="fa fa-edit"></i> 批量维护
  78. </a>
  79. <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="religion:religionPerson:remove">
  80. <i class="fa fa-remove"></i> 删除
  81. </a>
  82. <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="religion:religionPerson:export">
  83. <i class="fa fa-download"></i> 导出
  84. </a>
  85. </div>
  86. <div class="col-sm-12 select-table table-striped">
  87. <table id="bootstrap-table"></table>
  88. </div>
  89. </div>
  90. </div>
  91. <!-- 批量维护模态框 -->
  92. <div class="modal fade" id="personBatchModal" tabindex="-1" role="dialog" aria-hidden="true">
  93. <div class="modal-dialog" style="width: 1000px;">
  94. <div class="modal-content">
  95. <div class="modal-header">
  96. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
  97. <h4 class="modal-title">批量维护教职人员</h4>
  98. </div>
  99. <div class="modal-body" style="max-height: 650px; overflow-y: auto;">
  100. <!-- 条件筛选区 -->
  101. <div class="panel panel-default">
  102. <div class="panel-heading">
  103. <h3 class="panel-title">条件筛选(指定批量更新范围)</h3>
  104. </div>
  105. <div class="panel-body">
  106. <form id="batchConditionForm" class="form-horizontal">
  107. <div class="row">
  108. <div class="col-sm-6">
  109. <div class="form-group">
  110. <label class="col-sm-4 control-label">姓名:</label>
  111. <div class="col-sm-8">
  112. <input type="text" id="cond_name" class="form-control" placeholder="请输入姓名">
  113. </div>
  114. </div>
  115. </div>
  116. <div class="col-sm-6">
  117. <div class="form-group">
  118. <label class="col-sm-4 control-label">身份证号:</label>
  119. <div class="col-sm-8">
  120. <input type="text" id="cond_idNumber" class="form-control" placeholder="请输入身份证号">
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. <div class="row">
  126. <div class="col-sm-6">
  127. <div class="form-group">
  128. <label class="col-sm-4 control-label">所属场所:</label>
  129. <div class="col-sm-8">
  130. <select id="cond_placeId" class="form-control">
  131. <option value="">所有场所</option>
  132. <option th:each="place : ${placeList}" th:value="${place.placeId}" th:text="${place.placeName}"></option>
  133. </select>
  134. </div>
  135. </div>
  136. </div>
  137. <div class="col-sm-6">
  138. <div class="form-group">
  139. <label class="col-sm-4 control-label">宗教类别:</label>
  140. <div class="col-sm-8">
  141. <select id="cond_religionType" class="form-control" th:with="type=${@dict.getType('religion_type')}">
  142. <option value="">所有</option>
  143. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  144. </select>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="row">
  150. <div class="col-sm-6">
  151. <div class="form-group">
  152. <label class="col-sm-4 control-label">性别:</label>
  153. <div class="col-sm-8">
  154. <select id="cond_gender" class="form-control">
  155. <option value="">所有</option>
  156. <option value="男">男</option>
  157. <option value="女">女</option>
  158. </select>
  159. </div>
  160. </div>
  161. </div>
  162. <div class="col-sm-6">
  163. <div class="form-group">
  164. <label class="col-sm-4 control-label">民族:</label>
  165. <div class="col-sm-8">
  166. <select id="cond_nation" class="form-control" th:with="type=${@dict.getType('sys_nation')}">
  167. <option value="">所有民族</option>
  168. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  169. </select>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. <div class="row">
  175. <div class="col-sm-6">
  176. <div class="form-group">
  177. <label class="col-sm-4 control-label">所属区县:</label>
  178. <div class="col-sm-8">
  179. <select id="cond_county" class="form-control" th:with="type=${@dict.getType('region_xa_district')}">
  180. <option value="">所有区县</option>
  181. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  182. </select>
  183. </div>
  184. </div>
  185. </div>
  186. <div class="col-sm-6">
  187. <div class="form-group">
  188. <label class="col-sm-4 control-label">状态:</label>
  189. <div class="col-sm-8">
  190. <select id="cond_status" class="form-control" th:with="type=${@dict.getType('person_status')}">
  191. <option value="">所有</option>
  192. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  193. </select>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. </form>
  199. <div class="row">
  200. <div class="col-sm-12 text-right">
  201. <button type="button" class="btn btn-sm btn-info" onclick="queryPreview()">
  202. <i class="fa fa-search"></i> 查询
  203. </button>
  204. </div>
  205. </div>
  206. </div>
  207. </div>
  208. <!-- 查询结果预览区 -->
  209. <div class="panel panel-default" id="previewPanel" style="display: none;">
  210. <div class="panel-heading">
  211. <h3 class="panel-title">查询结果预览</h3>
  212. </div>
  213. <div class="panel-body">
  214. <div class="alert alert-info" style="margin-bottom: 10px;">
  215. <i class="fa fa-info-circle"></i> 共 <span id="batchTotalCount" style="font-weight: bold; color: #d9534f;">0</span> 条记录,将作为本次批量修改的对象
  216. </div>
  217. <div>
  218. <table id="previewTable"></table>
  219. </div>
  220. </div>
  221. </div>
  222. <!-- 批量更新字段区 -->
  223. <div class="panel panel-default">
  224. <div class="panel-heading">
  225. <h3 class="panel-title">批量更新字段(勾选需要修改的字段)</h3>
  226. </div>
  227. <div class="panel-body">
  228. <form id="batchUpdateForm" class="form-horizontal">
  229. <div class="row">
  230. <div class="col-sm-6">
  231. <div class="form-group">
  232. <label class="col-sm-4 control-label">
  233. <input type="checkbox" id="chk_newPlaceId"> 所属场所:
  234. </label>
  235. <div class="col-sm-8">
  236. <select id="new_placeId" class="form-control" disabled>
  237. <option value="">请选择所属场所</option>
  238. <option th:each="place : ${placeList}" th:value="${place.placeId}" th:text="${place.placeName}"></option>
  239. </select>
  240. </div>
  241. </div>
  242. </div>
  243. <div class="col-sm-6">
  244. <div class="form-group">
  245. <label class="col-sm-4 control-label">
  246. <input type="checkbox" id="chk_newReligionType"> 宗教类别:
  247. </label>
  248. <div class="col-sm-8">
  249. <select id="new_religionType" class="form-control" disabled th:with="type=${@dict.getType('religion_type')}">
  250. <option value="">请选择宗教类别</option>
  251. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  252. </select>
  253. </div>
  254. </div>
  255. </div>
  256. </div>
  257. <div class="row">
  258. <div class="col-sm-6">
  259. <div class="form-group">
  260. <label class="col-sm-4 control-label">
  261. <input type="checkbox" id="chk_newGender"> 性别:
  262. </label>
  263. <div class="col-sm-8">
  264. <select id="new_gender" class="form-control" disabled>
  265. <option value="">请选择性别</option>
  266. <option value="男">男</option>
  267. <option value="女">女</option>
  268. </select>
  269. </div>
  270. </div>
  271. </div>
  272. <div class="col-sm-6">
  273. <div class="form-group">
  274. <label class="col-sm-4 control-label">
  275. <input type="checkbox" id="chk_newNation"> 民族:
  276. </label>
  277. <div class="col-sm-8">
  278. <select id="new_nation" class="form-control" disabled th:with="type=${@dict.getType('sys_nation')}">
  279. <option value="">请选择民族</option>
  280. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  281. </select>
  282. </div>
  283. </div>
  284. </div>
  285. </div>
  286. <div class="row">
  287. <div class="col-sm-6">
  288. <div class="form-group">
  289. <label class="col-sm-4 control-label">
  290. <input type="checkbox" id="chk_newBirthday"> 出生日期:
  291. </label>
  292. <div class="col-sm-8">
  293. <div class="input-group date">
  294. <input id="new_birthday" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
  295. <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
  296. </div>
  297. </div>
  298. </div>
  299. </div>
  300. <div class="col-sm-6">
  301. <div class="form-group">
  302. <label class="col-sm-4 control-label">
  303. <input type="checkbox" id="chk_newCounty"> 所属区县:
  304. </label>
  305. <div class="col-sm-8">
  306. <select id="new_county" class="form-control" disabled th:with="type=${@dict.getType('region_xa_district')}">
  307. <option value="">请选择区县</option>
  308. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  309. </select>
  310. </div>
  311. </div>
  312. </div>
  313. </div>
  314. <div class="row">
  315. <div class="col-sm-6">
  316. <div class="form-group">
  317. <label class="col-sm-4 control-label">
  318. <input type="checkbox" id="chk_newAddress"> 家庭地址:
  319. </label>
  320. <div class="col-sm-8">
  321. <input id="new_address" class="form-control" type="text" maxlength="512" placeholder="请输入家庭地址" disabled>
  322. </div>
  323. </div>
  324. </div>
  325. <div class="col-sm-6">
  326. <div class="form-group">
  327. <label class="col-sm-4 control-label">
  328. <input type="checkbox" id="chk_newPoliticalStatus"> 政治面貌:
  329. </label>
  330. <div class="col-sm-8">
  331. <select id="new_politicalStatus" class="form-control" disabled th:with="type=${@dict.getType('political_status')}">
  332. <option value="">请选择政治面貌</option>
  333. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  334. </select>
  335. </div>
  336. </div>
  337. </div>
  338. </div>
  339. <div class="row">
  340. <div class="col-sm-6">
  341. <div class="form-group">
  342. <label class="col-sm-4 control-label">
  343. <input type="checkbox" id="chk_newEduNational"> 国民教育学历:
  344. </label>
  345. <div class="col-sm-8">
  346. <select id="new_eduNational" class="form-control" disabled th:with="type=${@dict.getType('edu_national')}">
  347. <option value="">请选择学历</option>
  348. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  349. </select>
  350. </div>
  351. </div>
  352. </div>
  353. <div class="col-sm-6">
  354. <div class="form-group">
  355. <label class="col-sm-4 control-label">
  356. <input type="checkbox" id="chk_newEduReligious"> 宗教学历:
  357. </label>
  358. <div class="col-sm-8">
  359. <select id="new_eduReligious" class="form-control" disabled th:with="type=${@dict.getType('edu_religious')}">
  360. <option value="">请选择宗教学历</option>
  361. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  362. </select>
  363. </div>
  364. </div>
  365. </div>
  366. </div>
  367. <div class="row">
  368. <div class="col-sm-6">
  369. <div class="form-group">
  370. <label class="col-sm-4 control-label">
  371. <input type="checkbox" id="chk_newJoinTime"> 入教/出家时间:
  372. </label>
  373. <div class="col-sm-8">
  374. <div class="input-group date">
  375. <input id="new_joinTime" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled>
  376. <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
  377. </div>
  378. </div>
  379. </div>
  380. </div>
  381. <div class="col-sm-6">
  382. <div class="form-group">
  383. <label class="col-sm-4 control-label">
  384. <input type="checkbox" id="chk_newPhone"> 联系电话:
  385. </label>
  386. <div class="col-sm-8">
  387. <input id="new_phone" class="form-control" type="text" maxlength="32" placeholder="请输入联系电话" disabled>
  388. </div>
  389. </div>
  390. </div>
  391. </div>
  392. <div class="row">
  393. <div class="col-sm-6">
  394. <div class="form-group">
  395. <label class="col-sm-4 control-label">
  396. <input type="checkbox" id="chk_newDomicile"> 户籍所在地:
  397. </label>
  398. <div class="col-sm-8">
  399. <input id="new_domicile" class="form-control" type="text" maxlength="128" placeholder="请输入户籍所在地" disabled>
  400. </div>
  401. </div>
  402. </div>
  403. <div class="col-sm-6">
  404. <div class="form-group">
  405. <label class="col-sm-4 control-label">
  406. <input type="checkbox" id="chk_newNativePlace"> 籍贯:
  407. </label>
  408. <div class="col-sm-8">
  409. <input id="new_nativePlace" class="form-control" type="text" maxlength="128" placeholder="请输入籍贯" disabled>
  410. </div>
  411. </div>
  412. </div>
  413. </div>
  414. <div class="row">
  415. <div class="col-sm-6">
  416. <div class="form-group">
  417. <label class="col-sm-4 control-label">
  418. <input type="checkbox" id="chk_newOrgName"> 所属宫观名称:
  419. </label>
  420. <div class="col-sm-8">
  421. <input id="new_orgName" class="form-control" type="text" maxlength="256" placeholder="请输入所属宫观名称" disabled>
  422. </div>
  423. </div>
  424. </div>
  425. <div class="col-sm-6">
  426. <div class="form-group">
  427. <label class="col-sm-4 control-label">
  428. <input type="checkbox" id="chk_newOrgAddress"> 所属宫观地址:
  429. </label>
  430. <div class="col-sm-8">
  431. <textarea id="new_orgAddress" class="form-control" maxlength="512" placeholder="请输入所属宫观地址" disabled></textarea>
  432. </div>
  433. </div>
  434. </div>
  435. </div>
  436. </form>
  437. </div>
  438. </div>
  439. </div>
  440. <div class="modal-footer">
  441. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  442. <button type="button" class="btn btn-primary" onclick="executeBatchUpdate()">执行批量更新</button>
  443. </div>
  444. </div>
  445. </div>
  446. </div>
  447. <!-- 批量更新预览模态框 -->
  448. <div class="modal fade" id="personBatchPreviewModal" tabindex="-1" role="dialog" aria-hidden="true">
  449. <div class="modal-dialog" style="width: 80%; max-width: 1200px;">
  450. <div class="modal-content">
  451. <div class="modal-header">
  452. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  453. <h4 class="modal-title">批量更新预览</h4>
  454. </div>
  455. <div class="modal-body">
  456. <div class="alert alert-info">
  457. <i class="fa fa-info-circle"></i>
  458. 将影响 <strong id="previewTotalPersons">0</strong> 名人员,共 <strong id="previewTotalChanges">0</strong> 条字段变更。
  459. 请仔细核对以下变更内容,确认无误后点击"确认执行"按钮。
  460. </div>
  461. <div class="table-responsive">
  462. <table id="previewChangeTable" class="table table-striped table-bordered table-hover">
  463. <thead>
  464. <tr>
  465. <th>姓名</th>
  466. <th>所属场所</th>
  467. <th>字段名称</th>
  468. <th>修改前</th>
  469. <th>修改后</th>
  470. </tr>
  471. </thead>
  472. <tbody id="previewChangeTableBody">
  473. <!-- 动态填充 -->
  474. </tbody>
  475. </table>
  476. </div>
  477. </div>
  478. <div class="modal-footer">
  479. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  480. <button type="button" class="btn btn-primary" id="btnConfirmBatchUpdate">确认执行</button>
  481. </div>
  482. </div>
  483. </div>
  484. </div>
  485. <th:block th:include="include :: footer" />
  486. <th:block th:include="include :: datetimepicker-js" />
  487. <script th:inline="javascript">
  488. var editFlag = [[${@permission.hasPermi('religion:religionPerson:edit')}]];
  489. var removeFlag = [[${@permission.hasPermi('religion:religionPerson:remove')}]];
  490. var religionTypeDatas = [[${@dict.getType('religion_type')}]];
  491. var nationDatas = [[${@dict.getType('sys_nation')}]];
  492. var statusDatas = [[${@dict.getType('person_status')}]];
  493. var prefix = ctx + "religion/religionPerson";
  494. $(function() {
  495. var options = {
  496. url: prefix + "/list",
  497. createUrl: prefix + "/add",
  498. updateUrl: prefix + "/edit/{id}",
  499. removeUrl: prefix + "/remove",
  500. exportUrl: prefix + "/export",
  501. modalName: "教职人员",
  502. showColumns: true,
  503. columns: [{
  504. checkbox: true
  505. },
  506. {
  507. field: 'personId',
  508. title: '人员ID',
  509. visible: false
  510. },
  511. {
  512. field: 'placeName',
  513. title: '所属场所'
  514. },
  515. {
  516. field: 'name',
  517. title: '姓名',
  518. sortable: true
  519. },
  520. {
  521. field: 'religionType',
  522. title: '宗教类别',
  523. formatter: function(value, row, index) {
  524. return $.table.selectDictLabel(religionTypeDatas, value);
  525. }
  526. },
  527. {
  528. field: 'gender',
  529. title: '性别'
  530. },
  531. {
  532. field: 'nation',
  533. title: '民族',
  534. formatter: function(value, row, index) {
  535. return $.table.selectDictLabel(nationDatas, value);
  536. }
  537. },
  538. {
  539. field: 'idNumber',
  540. title: '身份证号'
  541. },
  542. {
  543. field: 'birthday',
  544. title: '出生日期',
  545. visible: false
  546. },
  547. {
  548. field: 'phone',
  549. title: '联系电话'
  550. },
  551. {
  552. field: 'county',
  553. title: '所属区县'
  554. },
  555. {
  556. field: 'address',
  557. title: '家庭地址',
  558. visible: false
  559. },
  560. {
  561. field: 'politicalStatus',
  562. title: '政治面貌'
  563. },
  564. {
  565. field: 'eduNational',
  566. title: '国民教育学历',
  567. visible: false
  568. },
  569. {
  570. field: 'eduReligious',
  571. title: '宗教学历',
  572. visible: false
  573. },
  574. {
  575. field: 'joinTime',
  576. title: '入教/出家时间',
  577. visible: false
  578. },
  579. {
  580. field: 'domicile',
  581. title: '户籍所在地',
  582. visible: false
  583. },
  584. {
  585. field: 'nativePlace',
  586. title: '籍贯',
  587. visible: false
  588. },
  589. {
  590. field: 'orgName',
  591. title: '所属宫观名称',
  592. visible: false
  593. },
  594. {
  595. field: 'orgAddress',
  596. title: '所属宫观地址',
  597. visible: false
  598. },
  599. {
  600. field: 'status',
  601. title: '状态',
  602. formatter: function(value, row, index) {
  603. return $.table.selectDictLabel(statusDatas, value);
  604. }
  605. },
  606. {
  607. title: '操作',
  608. align: 'center',
  609. formatter: function(value, row, index) {
  610. var actions = [];
  611. actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.personId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
  612. actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.personId + '\')"><i class="fa fa-remove"></i>删除</a>');
  613. return actions.join('');
  614. }
  615. }]
  616. };
  617. $.table.init(options);
  618. // 初始化日期控件
  619. $("#new_birthday, #new_joinTime").datetimepicker({
  620. format: "yyyy-mm-dd",
  621. minView: "month",
  622. autoclose: true
  623. });
  624. // 复选框控制字段启用/禁用 - 使用事件委托
  625. $(document).on("change", "#batchUpdateForm input[type='checkbox']", function() {
  626. var checkboxId = $(this).attr("id");
  627. // chk_newReligionType -> ReligionType -> religionType
  628. var fieldName = checkboxId.replace("chk_new", "");
  629. var fieldId = "new_" + fieldName.charAt(0).toLowerCase() + fieldName.slice(1);
  630. var isChecked = $(this).is(":checked");
  631. var $field = $("#" + fieldId);
  632. console.log("复选框变化:", checkboxId, "->", fieldId, "启用:", isChecked, "找到元素:", $field.length);
  633. if ($field.length > 0) {
  634. $field.prop("disabled", !isChecked);
  635. console.log("设置后disabled状态:", $field.prop("disabled"));
  636. // 如果是日期选择器,需要特殊处理
  637. if (fieldId === "new_birthday" || fieldId === "new_joinTime") {
  638. if (isChecked) {
  639. $field.datetimepicker('enable');
  640. } else {
  641. $field.datetimepicker('disable');
  642. }
  643. }
  644. } else {
  645. console.error("未找到元素:", fieldId);
  646. }
  647. });
  648. // 确认批量更新按钮点击事件
  649. $("#btnConfirmBatchUpdate").on("click", function() {
  650. if (!window.batchUpdateRequestData) {
  651. $.modal.alertError("请求数据丢失,请重新操作");
  652. return;
  653. }
  654. $.modal.confirm("确定要执行批量更新吗?", function() {
  655. $.ajax({
  656. url: prefix + "/batchUpdateByCondition",
  657. type: "post",
  658. contentType: "application/json",
  659. data: JSON.stringify(window.batchUpdateRequestData),
  660. success: function(result) {
  661. if (result.code == web_status.SUCCESS) {
  662. var count = result.data || 0;
  663. $.modal.msgSuccess("批量更新成功,共修改 " + count + " 条记录");
  664. $("#personBatchPreviewModal").modal("hide");
  665. $("#personBatchModal").modal("hide");
  666. $.table.refresh();
  667. // 清空保存的请求数据
  668. window.batchUpdateRequestData = null;
  669. } else {
  670. $.modal.alertError(result.msg);
  671. }
  672. },
  673. error: function() {
  674. $.modal.alertError("批量更新失败,请稍后重试");
  675. }
  676. });
  677. });
  678. });
  679. });
  680. // 打开批量维护模态框
  681. function openBatchUpdateModal() {
  682. // 重置表单
  683. $("#batchConditionForm")[0].reset();
  684. $("#batchUpdateForm")[0].reset();
  685. $("#batchUpdateForm input[type='checkbox']").prop("checked", false);
  686. // 只禁用输入框、下拉框和文本域,不禁用复选框
  687. $("#batchUpdateForm input[type='text'], #batchUpdateForm input[type='date'], #batchUpdateForm select, #batchUpdateForm textarea").prop("disabled", true);
  688. // 隐藏预览区并重置
  689. $("#previewPanel").hide();
  690. $("#batchTotalCount").text("0");
  691. if ($("#previewTable").data('bootstrap.table')) {
  692. $("#previewTable").bootstrapTable('destroy');
  693. }
  694. // 显示模态框
  695. $("#personBatchModal").modal("show");
  696. }
  697. // 查询预览
  698. function queryPreview() {
  699. var conditions = getConditions();
  700. // 初始化预览表格
  701. var previewOptions = {
  702. url: prefix + "/batchPreviewList",
  703. method: 'post',
  704. contentType: "application/json",
  705. ajax: function(request) {
  706. var queryParams = $.extend({}, conditions);
  707. queryParams.pageNum = request.data.offset / request.data.limit + 1;
  708. queryParams.pageSize = request.data.limit;
  709. $.ajax({
  710. type: "POST",
  711. url: request.url,
  712. contentType: "application/json",
  713. data: JSON.stringify(queryParams),
  714. dataType: "json",
  715. success: function(res) {
  716. request.success({
  717. total: res.total,
  718. rows: res.rows
  719. });
  720. },
  721. error: function(res) {
  722. request.error(res);
  723. }
  724. });
  725. },
  726. pagination: true,
  727. sidePagination: "server",
  728. pageSize: 20,
  729. pageList: [10, 20, 50],
  730. showRefresh: false,
  731. showToggle: false,
  732. showColumns: false,
  733. clickToSelect: false,
  734. columns: [{
  735. field: 'name',
  736. title: '姓名'
  737. },
  738. {
  739. field: 'placeName',
  740. title: '所属场所'
  741. },
  742. {
  743. field: 'religionType',
  744. title: '宗教类别',
  745. formatter: function(value, row, index) {
  746. return getDictLabel(religionTypeDatas, value);
  747. }
  748. },
  749. {
  750. field: 'gender',
  751. title: '性别'
  752. },
  753. {
  754. field: 'nation',
  755. title: '民族',
  756. formatter: function(value, row, index) {
  757. return getDictLabel(nationDatas, value);
  758. }
  759. },
  760. {
  761. field: 'county',
  762. title: '所属区县'
  763. },
  764. {
  765. field: 'status',
  766. title: '状态',
  767. formatter: function(value, row, index) {
  768. return getDictLabel(statusDatas, value);
  769. }
  770. }],
  771. onLoadSuccess: function(data) {
  772. $("#batchTotalCount").text(data.total || 0);
  773. $("#previewPanel").show();
  774. },
  775. onLoadError: function() {
  776. $.modal.alertError("查询失败,请稍后重试");
  777. }
  778. };
  779. // 销毁旧表格并初始化新表格
  780. if ($("#previewTable").data('bootstrap.table')) {
  781. $("#previewTable").bootstrapTable('destroy');
  782. }
  783. $("#previewTable").bootstrapTable(previewOptions);
  784. }
  785. // 执行批量更新(改为预览)
  786. function executeBatchUpdate() {
  787. // 检查是否至少选择了一个字段
  788. var checkedCount = $("#batchUpdateForm input[type='checkbox']:checked").length;
  789. if (checkedCount == 0) {
  790. $.modal.alertWarning("请至少选择一个要修改的字段");
  791. return;
  792. }
  793. // 获取条件
  794. var data = getConditions();
  795. // 收集勾选字段的值
  796. $("#batchUpdateForm input[type='checkbox']:checked").each(function() {
  797. var checkboxId = $(this).attr("id");
  798. // chk_newReligionType -> ReligionType
  799. var fieldName = checkboxId.replace("chk_new", "");
  800. // 构造输入框ID: new_religionType (首字母小写)
  801. var fieldId = "new_" + fieldName.charAt(0).toLowerCase() + fieldName.slice(1);
  802. var fieldValue = $("#" + fieldId).val();
  803. // 构造后端字段名: newReligionType (带new前缀,首字母大写)
  804. var backendFieldName = "new" + fieldName;
  805. if (fieldValue !== null && fieldValue !== "") {
  806. data[backendFieldName] = fieldValue;
  807. }
  808. });
  809. // 调用预览接口
  810. $.ajax({
  811. url: prefix + "/batchUpdatePreview",
  812. type: "post",
  813. contentType: "application/json",
  814. data: JSON.stringify(data),
  815. success: function(result) {
  816. if (result.code == web_status.SUCCESS) {
  817. var previewData = result.data;
  818. // 检查是否有实际变更
  819. if (!previewData || previewData.totalPersons == 0 || !previewData.rows || previewData.rows.length == 0) {
  820. $.modal.alertWarning("无实际变更,请检查筛选条件和修改字段");
  821. return;
  822. }
  823. // 保存请求数据供确认时使用
  824. window.batchUpdateRequestData = data;
  825. // 填充预览数据
  826. showBatchUpdatePreview(previewData);
  827. } else {
  828. $.modal.alertError(result.msg);
  829. }
  830. },
  831. error: function() {
  832. $.modal.alertError("预览失败,请稍后重试");
  833. }
  834. });
  835. }
  836. // 显示批量更新预览
  837. function showBatchUpdatePreview(previewData) {
  838. // 更新统计信息
  839. $("#previewTotalPersons").text(previewData.totalPersons);
  840. $("#previewTotalChanges").text(previewData.totalChanges);
  841. // 清空并填充表格
  842. var tbody = $("#previewChangeTableBody");
  843. tbody.empty();
  844. if (previewData.rows && previewData.rows.length > 0) {
  845. $.each(previewData.rows, function(index, row) {
  846. var tr = $("<tr>");
  847. tr.append($("<td>").text(row.name || ""));
  848. tr.append($("<td>").text(row.placeName || ""));
  849. tr.append($("<td>").text(row.fieldLabel || ""));
  850. tr.append($("<td>").text(row.oldValue || ""));
  851. tr.append($("<td>").html("<strong>" + (row.newValue || "") + "</strong>"));
  852. tbody.append(tr);
  853. });
  854. }
  855. // 关闭批量维护模态框,打开预览模态框
  856. $("#personBatchModal").modal("hide");
  857. $("#personBatchPreviewModal").modal("show");
  858. }
  859. // 获取筛选条件
  860. function getConditions() {
  861. var conditions = {};
  862. var name = $.trim($("#cond_name").val());
  863. var idNumber = $.trim($("#cond_idNumber").val());
  864. var placeId = $("#cond_placeId").val();
  865. var religionType = $("#cond_religionType").val();
  866. var gender = $("#cond_gender").val();
  867. var nation = $("#cond_nation").val();
  868. var county = $("#cond_county").val();
  869. var status = $("#cond_status").val();
  870. if (name && name != "") conditions.name = name;
  871. if (idNumber && idNumber != "") conditions.idNumber = idNumber;
  872. if (placeId && placeId != "") conditions.placeId = placeId;
  873. if (religionType && religionType != "") conditions.religionType = religionType;
  874. if (gender && gender != "") conditions.gender = gender;
  875. if (nation && nation != "") conditions.nation = nation;
  876. if (county && county != "") conditions.county = county;
  877. if (status && status != "") conditions.status = status;
  878. return conditions;
  879. }
  880. // 获取字典标签
  881. function getDictLabel(datas, value) {
  882. if (!value || !datas) return "";
  883. for (var i = 0; i < datas.length; i++) {
  884. if (datas[i].dictValue == value) {
  885. return datas[i].dictLabel;
  886. }
  887. }
  888. return value;
  889. }
  890. </script>
  891. </body>
  892. </html>