123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <!DOCTYPE html>
- <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
- <head>
- <th:block th:include="include :: header('任务跟进人新增')" />
- <th:block th:include="include :: ztree-css" />
- </head>
- <body class="white-bg">
- <div class="wrapper wrapper-content animated fadeInRight ibox-content">
- <form id="form-SSpglJfspProductinfo-add" class="customize-search-form">
- <div class="customize-form-group-container">
- <div class="customize-form-group edit">
- <label>跟进人姓名:</label>
- <input name="pharmacistName" placeholder="请输入跟进人姓名" id="pharmacistName" class="styled-input" type="text">
- </div>
- <div class="customize-form-group">
- <label>手机号:</label>
- <input name="phone" placeholder="请输入手机号" id="phone" class="styled-input" type="number" maxlength="11">
- </div>
- <div class="customize-form-group">
- <label>角色:</label>
- <select name="position" id="position" class="styled-input" th:with="type=${@dict.getType('sys_gxhpz_yppz_roles')}" required>
- <option value="">请选择</option>
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
- </select>
- </div>
- <div class="customize-form-group">
- <label>是否默认为任务跟进人:</label>
- <select name="default_follow_up" id="default_follow_up" class="styled-input" th:with="type=${@dict.getType('sys_select_yes_no')}" required>
- <option value="">请选择</option>
- <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
- </select>
- </div>
- <div class="customize-form-group">
- <label>所属门店:</label>
- <select name="storeName" id="storeSelect" class="styled-input">
- <option value="">全部</option>
- </select>
- </div>
- </div>
- </form>
- </div>
- <th:block th:include="include :: footer" />
- <th:block th:include="include :: ztree-js" />
- <script type="text/javascript">
- var prefix_task = ctx + "task/followTask";
- //初始化加载
- $(document).ready(function() {
- findTaskStoreList();
- });
- function submitHandler() {
- var selectedValue = $('#default_follow_up').val();
- if (selectedValue === '1') {
- $.modal.confirm("设置该用户为默认任务跟进人,将替换已有的的默认任务跟进人", function() {
- add();
- });
- } else {
- add();
- }
- }
- function add() {
- var data = $("#form-SSpglJfspProductinfo-add").serializeArray();
- $.ajax({
- cache : true,
- type : "POST",
- url : ctx + "gxhpz/pharmacists/savePharmacists",
- data : data,
- async : false,
- error : function(request) {
- $.modal.alertError("系统错误");
- },
- success : function(data) {
- $.operate.successCallback(data);
- }
- });
- }
- // 异步加载所有门店信息并填充下拉框
- function findTaskStoreList() {
- $.ajax({
- url: prefix_task+ "/findTaskStoreList", // 这是获取所有门店的API端点
- type: 'POST',
- cache: false, // 设置为 false 防止缓存
- processData: false, // 告诉 jQuery 不要处理数据(非常重要)
- contentType: false, // 告诉 jQuery 不要设置 contentType(非常重要)
- async: true, // 异步请求更为推荐,除非有特殊原因需要同步
- success: function (data) {
- var select = $('#storeSelect');
- // 清空除了默认选项外的所有选项
- select.find('option:not(:first)').remove();
- if (data && data.data) {
- data.data.forEach(function (store) {
- select.append(new Option(store.dept_name, store.dept_name));
- });
- } else {
- console.error('Unexpected response format:', data);
- }
- },
- error: function () {
- $.modal.alertError('加载门店信息失败');
- }
- });
- }
- </script>
- </body>
- </html>
|