followUpTaskAdd.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('任务跟进人新增')" />
  5. <th:block th:include="include :: ztree-css" />
  6. </head>
  7. <body class="white-bg">
  8. <div class="wrapper wrapper-content animated fadeInRight ibox-content">
  9. <form id="form-SSpglJfspProductinfo-add" class="customize-search-form">
  10. <div class="customize-form-group-container">
  11. <div class="customize-form-group edit">
  12. <label>跟进人姓名:</label>
  13. <input name="pharmacistName" placeholder="请输入跟进人姓名" id="pharmacistName" class="styled-input" type="text">
  14. </div>
  15. <div class="customize-form-group">
  16. <label>手机号:</label>
  17. <input name="phone" placeholder="请输入手机号" id="phone" class="styled-input" type="number" maxlength="11">
  18. </div>
  19. <div class="customize-form-group">
  20. <label>角色:</label>
  21. <select name="position" id="position" class="styled-input" th:with="type=${@dict.getType('sys_gxhpz_yppz_roles')}" required>
  22. <option value="">请选择</option>
  23. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  24. </select>
  25. </div>
  26. <div class="customize-form-group">
  27. <label>是否默认为任务跟进人:</label>
  28. <select name="default_follow_up" id="default_follow_up" class="styled-input" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
  29. <option value="">请选择</option>
  30. <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
  31. </select>
  32. </div>
  33. <div class="customize-form-group">
  34. <label>所属门店:</label>
  35. <select name="storeName" id="storeSelect" class="styled-input">
  36. <option value="">全部</option>
  37. </select>
  38. </div>
  39. </div>
  40. </form>
  41. </div>
  42. <th:block th:include="include :: footer" />
  43. <th:block th:include="include :: ztree-js" />
  44. <script type="text/javascript">
  45. var prefix_task = ctx + "task/followTask";
  46. //初始化加载
  47. $(document).ready(function() {
  48. findTaskStoreList();
  49. });
  50. function submitHandler() {
  51. var selectedValue = $('#default_follow_up').val();
  52. if (selectedValue === '1') {
  53. $.modal.confirm("设置该用户为默认任务跟进人,将替换已有的的默认任务跟进人", function() {
  54. add();
  55. });
  56. } else {
  57. add();
  58. }
  59. }
  60. function add() {
  61. var data = $("#form-SSpglJfspProductinfo-add").serializeArray();
  62. $.ajax({
  63. cache : true,
  64. type : "POST",
  65. url : ctx + "gxhpz/pharmacists/savePharmacists",
  66. data : data,
  67. async : false,
  68. error : function(request) {
  69. $.modal.alertError("系统错误");
  70. },
  71. success : function(data) {
  72. $.operate.successCallback(data);
  73. }
  74. });
  75. }
  76. // 异步加载所有门店信息并填充下拉框
  77. function findTaskStoreList() {
  78. $.ajax({
  79. url: prefix_task+ "/findTaskStoreList", // 这是获取所有门店的API端点
  80. type: 'POST',
  81. cache: false, // 设置为 false 防止缓存
  82. processData: false, // 告诉 jQuery 不要处理数据(非常重要)
  83. contentType: false, // 告诉 jQuery 不要设置 contentType(非常重要)
  84. async: true, // 异步请求更为推荐,除非有特殊原因需要同步
  85. success: function (data) {
  86. var select = $('#storeSelect');
  87. // 清空除了默认选项外的所有选项
  88. select.find('option:not(:first)').remove();
  89. if (data && data.data) {
  90. data.data.forEach(function (store) {
  91. select.append(new Option(store.dept_name, store.dept_name));
  92. });
  93. } else {
  94. console.error('Unexpected response format:', data);
  95. }
  96. },
  97. error: function () {
  98. $.modal.alertError('加载门店信息失败');
  99. }
  100. });
  101. }
  102. </script>
  103. </body>
  104. </html>