Ver código fonte

子账户功能界面开发完成,并增加询盘分类页面

chenlei1231 1 mês atrás
pai
commit
94b81e122e

+ 14 - 0
src/assets/enquiry/enquiryRules/checked.svg

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="200px" height="200px" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <!-- Generator: Sketch 63 (92445) - https://sketch.com -->
+    <title>选中</title>
+    <desc>Created with Sketch.</desc>
+    <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="选中">
+            <circle id="椭圆形" fill="#544BEB" cx="100" cy="100" r="100"></circle>
+            <g id="选择" transform="translate(40.000000, 50.000000)" fill="#FFFFFF" fill-rule="nonzero">
+                <path d="M127.777857,1.54841111 C125.614837,-0.480107293 122.203409,-0.383208092 120.17489,1.78530783 L48.4163055,78.1869522 L9.21727745,39.5635342 C7.09735565,37.4757192 3.69113403,37.4974131 1.6033191,39.6173349 C-0.484495835,41.7320501 -0.457595393,45.1434783 1.66261562,47.2257974 L44.7896742,89.712454 C44.8058723,89.7286521 44.8272769,89.7338587 44.8434749,89.7500567 C44.859673,89.7662547 44.8648796,89.7876594 44.8810776,89.8038574 C45.22008,90.1266617 45.6290811,90.3097577 46.0218841,90.5249606 C46.2156824,90.6380578 46.3822911,90.8046664 46.5867916,90.8853675 C47.2216979,91.1329665 47.8942068,91.2619726 48.5615092,91.2619726 C49.2664144,91.2619726 49.9713193,91.121975 50.6276303,90.8422691 C50.848329,90.7508657 51.0204334,90.5625633 51.224934,90.4439702 C51.6284393,90.2070735 52.0481428,90.0080687 52.392641,89.6583641 C52.408839,89.642166 52.4140456,89.6152656 52.4302436,89.5990676 C52.4409459,89.5828695 52.4626397,89.5776629 52.4785485,89.5614649 L128.008679,9.15079941 C130.053685,6.99356432 129.940877,3.58763192 127.777857,1.54841111 Z" id="路径"></path>
+            </g>
+        </g>
+    </g>
+</svg>

+ 30 - 0
src/assets/enquiry/enquiryRules/quyuguanli.svg

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#999999;}
+</style>
+<title>区域管理备份</title>
+<desc>Created with Sketch.</desc>
+<g id="页面-1">
+	<g id="区域管理备份">
+		<path id="形状" class="st0" d="M45.2,106.1c2.3,2.1,5.8,2.1,8,0c27.5-25,40.8-45,40.8-61.2C94,20.1,73.9,0,49.2,0
+			S4.3,20.1,4.3,44.8C4.3,61.1,17.7,81.1,45.2,106.1z M49.2,6C70,6,86.9,22.9,86.9,43.7c0,9.4-6.7,26.6-37.7,55.7
+			c-31-29.2-37.7-46.3-37.7-55.7C11.5,22.9,28.4,6,49.2,6z M49.6,26.6C40.4,26.6,33,34,33,43.2c0,9.2,7.4,16.6,16.6,16.6
+			s16.6-7.4,16.6-16.6C66.2,34,58.8,26.6,49.6,26.6z M49.6,52.9c-5.4,0-9.7-4.4-9.7-9.7s4.4-9.7,9.7-9.7s9.7,4.4,9.7,9.7
+			C59.3,48.6,55,52.9,49.6,52.9z M173.5,46.7c-3.6-4.2-7.6-7.9-11.8-11.4c-0.4-0.5-0.8-0.8-1.3-1.1C144.1,21.2,123.8,14,102.7,14
+			c-2.3,0-4.2,1.9-4.2,4.2s1.9,4.2,4.2,4.2c15.6,0,30.6,4.3,43.6,12.1c-5.3,1.1-11.4,3.3-16.5,8c-7.1,6.5-10.5,15.9-10.3,28.1
+			c0.5,24.5,17.7,38.2,27.9,44.1l0.8,0.5c2.3,1.5,3.7,3.9,3.8,6.7c0.1,2.8-1,5.4-3.2,7.1c-6.1,4.7-16.1,14.7-14.1,28.7
+			c1.6,10.8,9.2,17.6,13.3,20.5c-12.5,8-27.2,12.8-43,13.2c4.4-6.2,9.6-15.7,8.8-25.7c-0.6-7.7-4.5-14.3-11.6-19.5
+			c-16.7-12.3-34.9-7.6-44.9-3.4c-1.4,0.5-2.6,0.5-3.7,0c-2-1-3.8-3.6-4.8-7.1c-3.9-12.8-14.8-19.4-30-18.3
+			c-0.4-3.4-0.7-6.8-0.7-10.3c0-2.3-1.9-4.2-4.2-4.2s-4.2,1.9-4.2,4.2c0,48.9,38,89,86,92.6c0.2,0,0.4,0.1,0.6,0.1
+			c0.1,0,0.2-0.1,0.4-0.1c2,0.1,4,0.3,6.1,0.3c51.3,0,93-41.7,93-93C195.7,84.9,187.8,63.5,173.5,46.7L173.5,46.7z M20.3,125.6
+			c8-0.4,17.2,1.7,20.5,12.4c1.8,5.9,5.1,10.2,9.2,12.3c3.2,1.6,6.8,1.7,10.4,0.4l1-0.4c9.4-4,23.2-6.7,35.9,2.7
+			c5.1,3.8,7.8,8.1,8.2,13.3c0.8,10.4-7.7,21.1-10.9,24.8C58,187.6,28.3,160.7,20.3,125.6z M155.4,172.9c-0.2-0.2-0.4-0.4-0.6-0.5
+			c-0.1,0-10.1-5.6-11.7-16c-1.4-9.7,6.2-17.1,10.8-20.7c4.4-3.3,6.8-8.6,6.5-14.2c-0.2-5.5-3.2-10.5-7.8-13.5l-1-0.6
+			c-8.7-5-23.3-16.5-23.7-36.9c-0.2-9.6,2.3-16.9,7.5-21.6c7.1-6.6,17.5-6.9,21.1-6.8c3.7,3.1,7.3,6.4,10.4,10.2
+			c13,15.2,20.1,34.7,20.1,54.8C187.2,133.6,174.7,157.4,155.4,172.9L155.4,172.9z"/>
+	</g>
+</g>
+</svg>

+ 16 - 0
src/assets/enquiry/enquiryRules/uncheck.svg

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+	 viewBox="0 0 200 200" style="enable-background:new 0 0 200 200;" xml:space="preserve">
+<style type="text/css">
+	.st0{fill:#999999;}
+</style>
+<title>椭圆形备份</title>
+<desc>Created with Sketch.</desc>
+<g id="页面-1">
+	<g id="椭圆形备份">
+		<path class="st0" d="M100,200C44.9,200,0,155.1,0,100C0,44.9,44.9,0,100,0c55.1,0,100,44.9,100,100C200,155.1,155.1,200,100,200z
+			 M100,10c-49.6,0-90,40.4-90,90s40.4,90,90,90s90-40.4,90-90S149.6,10,100,10z"/>
+	</g>
+</g>
+</svg>

Diferenças do arquivo suprimidas por serem muito extensas
+ 7 - 0
src/assets/enquiry/enquiryRules/wanquankaifang.svg


+ 480 - 0
src/views/adweb/enquiry/AdwebEnquiryDistribution.vue

@@ -0,0 +1,480 @@
+<template>
+  <div class="content adweb-enquiry-distribution">
+    <a-spin :tip="loadingTip" :spinning="loadingStatus">
+      <div class="spin-content">
+        <a-row class="r0" :gutter="8" style="margin-bottom: 16px">
+          <a-col :xl="7" :xxl="6">
+            <div class="choose-site">
+              <span class="t1">站点:</span>
+              <select-site ref="selectSiteRef" @set-site-info="changeSite" select-width="100%" />
+            </div>
+          </a-col>
+        </a-row>
+        <a-row class="r1">
+          <a-col :xl="19" :xxl="20">
+            <a-row>
+              <a-col :span="24"><p class="title">分配规则:</p></a-col>
+              <a-col :span="8" :class="rulesOptions == 'MASTER' ? 'active' : ''">
+                <p class="t1">
+                  <img @click="changeRules('MASTER')" class="chooseImg" :src="rulesOptions == 'MASTER' ? checkImg : uncheckImg" alt="" />
+                  仅主账户可见
+                </p>
+                <p class="t2">(只有主账户可以查看询盘信息)</p>
+              </a-col>
+              <a-col :span="8" :class="rulesOptions == 'ALL' ? 'active' : ''">
+                <p class="t1">
+                  <img @click="changeRules('ALL')" class="chooseImg" :src="rulesOptions == 'ALL' ? checkImg : uncheckImg" alt="" />
+                  完全开放
+                </p>
+                <p class="t2">(客户主账号和员工账号均可在后台查看该站点所有询盘)</p>
+              </a-col>
+              <a-col :span="8" :class="rulesOptions == 'REGION' ? 'active' : ''">
+                <p class="t1">
+                  <img @click="changeRules('REGION')" class="chooseImg" :src="rulesOptions == 'REGION' ? checkImg : uncheckImg" alt="" />
+                  按买家地域分配
+                </p>
+                <p class="t2">(系统根据买家的国家,将询盘自动分配给对应的账号)</p>
+              </a-col>
+            </a-row>
+          </a-col>
+          <a-col
+            :xl="5"
+            :xxl="4"
+            v-if="!(userRole.indexOf('admin') > -1 || userRole.indexOf('adweb_site_manager') > -1 || userRole.indexOf('adweb_seo_manager') > -1)"
+          >
+            <router-link :to="{ path: '/enterprise/enterpriseUser' }">
+              <div class="add-account">
+                <a-icon type="user" />
+                <p>新增子账户</p>
+              </div>
+            </router-link>
+          </a-col>
+        </a-row>
+        <a-row class="r2" v-if="rulesOptions == 'REGION'">
+          <a-col :span="24">
+            <p class="tips">说明:系统根据买家的国家,将询盘自动分配给对应的账号,不能确定买卖国家或相关国家没有被分配的,将统一分配给主账号。</p>
+            <a-button type="primary" style="margin-bottom: 10px" @click="showDistributionArea">待分配区域</a-button>
+          </a-col>
+
+          <a-col :span="24">
+            <a-table
+              ref="table"
+              size="middle"
+              :scroll="{ x: true }"
+              rowKey="id"
+              :columns="columns"
+              :dataSource="dataSource"
+              :pagination="false"
+              :loading="loading"
+              class="j-table-force-nowrap"
+            >
+              <template #bodyCell="{ column, record }">
+                <template v-if="column.dataIndex === 'action'">
+                  <a-button v-if="record.id !== '-1'" type="primary" @click="getUsersTree(record.id)">负责区域</a-button>
+                  <span v-else>--</span>
+                </template>
+              </template>
+            </a-table>
+          </a-col>
+        </a-row>
+        <a-row class="r1">
+          <a-col :xl="19" :xxl="20">
+            <a-row>
+              <a-col :span="24"><p class="title">邮件发送规则:</p></a-col>
+              <a-col :span="8" :class="sendEmailOptions == 'MASTER' ? 'active' : ''">
+                <p class="t1">
+                  <img @click="changeSendEmailRules('MASTER')" class="chooseImg" :src="sendEmailOptions == 'MASTER' ? checkImg : uncheckImg" />
+                  仅主账户
+                </p>
+                <p class="t2">(只有主账户邮箱可以收到询盘邮件)</p>
+              </a-col>
+              <a-col :span="8" :class="sendEmailOptions == 'ALL' ? 'active' : ''">
+                <p class="t1">
+                  <img @click="changeSendEmailRules('ALL')" class="chooseImg" :src="sendEmailOptions == 'ALL' ? checkImg : uncheckImg" />
+                  所有人
+                </p>
+                <p class="t2">(客户主账号和员工账号邮箱均可收到询盘邮件)</p>
+              </a-col>
+            </a-row>
+          </a-col>
+        </a-row>
+      </div>
+    </a-spin>
+    <distribution-area @ok="modalFormOk" ref="distributionAreaRef" />
+  </div>
+</template>
+
+<script lang="ts" setup>
+  import distributionArea from './modules/distributionArea.vue';
+  import checkImg from '/@/assets/enquiry/enquiryRules/checked.svg';
+  import uncheckImg from '/@/assets/enquiry/enquiryRules/uncheck.svg';
+  import { getAction, postAction } from '/@/api/manage/manage';
+  import selectSite from '/@/components/Adweb/selectSite.vue';
+  import { nextTick, onMounted, reactive, ref } from 'vue';
+  import { useUserStore } from '@/store/modules/user';
+  import { useMessage } from '@/hooks/web/useMessage';
+  import { Modal } from 'ant-design-vue';
+  const { userInfo } = useUserStore();
+  const queryParam = reactive<any>({});
+  const rulesOptions = ref('');
+  const sendEmailOptions = ref('');
+  const columns = [
+    {
+      title: '用户名',
+      align: 'center',
+      dataIndex: 'realname',
+    },
+    {
+      title: '登录账号',
+      align: 'center',
+      dataIndex: 'username',
+    },
+    {
+      title: '已分配国家',
+      align: 'center',
+      dataIndex: 'countryNum',
+      customRender: function (text) {
+        return text >= 0 ? text : '-';
+      },
+    },
+    {
+      title: '询盘数',
+      align: 'center',
+      dataIndex: 'enquiryNum',
+    },
+    {
+      title: '操作',
+      align: 'center',
+      dataIndex: 'action',
+      scopedSlots: {
+        customRender: 'action',
+      },
+    },
+  ];
+  const url = {
+    list: '/usercountry/subAccounts',
+  };
+  let dataSource = reactive([]);
+  const loading = ref(false);
+  const distributionAreaRef = ref();
+
+  const siteId = ref();
+
+  const userRole = ref('');
+  const loadingTip = ref('');
+  const loadingStatus = ref(false);
+  const { createMessage } = useMessage();
+
+  const ipagination = {
+    current: 1,
+    pageSize: 30,
+    pageSizeOptions: ['15', '30', '50', '100'],
+    showTotal: (total, range) => {
+      return range[0] + '-' + range[1] + ' 共' + total + '条';
+    },
+    showQuickJumper: true,
+    showSizeChanger: true,
+    total: 0,
+  };
+
+  onMounted(() => {
+    userRole.value = userInfo?.roles.join(',');
+  });
+
+  function changeSite(selectedSiteInfo: any) {
+    loadingTip.value = '切换站点中...';
+    loadingStatus.value = true;
+    siteId.value = selectedSiteInfo.id;
+    dealSiteData();
+  }
+  //处理站点数据
+  function dealSiteData() {
+    let param = {
+      siteId: siteId.value,
+    };
+    getAction('/usercountry/getSiteBySiteId', param)
+      .then((res) => {
+        if (res.code == 200) {
+          let data = res.result;
+          //获取并处理站点分配规则
+          rulesOptions.value = data.enquiryDistributeType;
+          if (data.enquiryDistributeType === 'REGION') {
+            queryParam.siteId = siteId;
+            loadData(1);
+          }
+
+          //获取站点的发送邮箱规则
+          sendEmailOptions.value = data.enquirySendEmailType;
+        }
+      })
+      .finally(() => {
+        loadingStatus.value = false;
+        loadingTip.value = '';
+      });
+  }
+  //改变分配规则
+  function changeRules(e) {
+    if (
+      userRole.value.indexOf('admin') > -1 ||
+      userRole.value.indexOf('adweb_site_manager') > -1 ||
+      userRole.value.indexOf('adweb_seo_manager') > -1
+    ) {
+      createMessage.warning('管理员账号不可修改分配规则!');
+      return;
+    }
+
+    Modal.confirm({
+      title: '修改分配规则',
+      content: `您确定要修改吗?`,
+      centered: true,
+      onOk: () => {
+        loadingTip.value = '改变分配规则中,请稍等...';
+        loadingStatus.value = true;
+        postAction('/usercountry/updateDistributeType?distributeType=' + e + '&siteId=' + siteId.value, {}, 60000)
+          .then((res) => {
+            if (res.success) {
+              rulesOptions.value = e;
+              if (e === 'REGION') {
+                queryParam.siteId = siteId;
+                loadData(1);
+              }
+            } else {
+              if (res.code == 403) {
+                createMessage.warning(res.message);
+              } else {
+                createMessage.error('修改失败,请联系管理员');
+              }
+            }
+          })
+          .finally(() => {
+            loadingStatus.value = false;
+            loadingTip.value = '';
+          });
+      },
+    });
+  }
+
+  function showDistributionArea() {
+    nextTick(() => {
+      distributionAreaRef.value.init(siteId.value);
+    });
+  }
+
+  function getUsersTree(id) {
+    nextTick(() => {
+      console.log(id, siteId.value, 'id, siteId.value');
+
+      distributionAreaRef.value.getUsersTree(id, siteId.value);
+    });
+  }
+
+  //改变邮箱接收邮件规则
+  function changeSendEmailRules(e) {
+    if (
+      userRole.value.indexOf('admin') > -1 ||
+      userRole.value.indexOf('adweb_site_manager') > -1 ||
+      userRole.value.indexOf('adweb_seo_manager') > -1
+    ) {
+      createMessage.warning('管理员账号不可修改分配规则!');
+      return;
+    }
+
+    Modal.confirm({
+      title: '修改邮件发送规则',
+      content: `您确定要修改吗?`,
+      centered: true,
+      onOk: () => {
+        loadingTip.value = '改变邮件规则中,请稍等...';
+        loadingStatus.value = true;
+        postAction('/usercountry/updateSendEmailType?sendEmailType=' + e + '&siteId=' + siteId.value, {}, 120000)
+          .then((res) => {
+            if (res.success) {
+              sendEmailOptions.value = e;
+            } else {
+              if (res.code == 403) {
+                createMessage.warning(res.message);
+              } else {
+                createMessage.error('修改失败,请联系管理员');
+              }
+            }
+          })
+          .finally(() => {
+            loadingStatus.value = false;
+            loadingTip.value = '';
+          });
+      },
+    });
+  }
+
+  function modalFormOk() {
+    // 新增/修改 成功时,重载列表
+    loadData(0);
+  }
+
+  function loadData(arg) {
+    if (!url.list) {
+      createMessage.error('请设置url.list属性!');
+      return;
+    }
+    //加载数据 若传入参数1则加载第一页的内容
+    if (arg === 1) {
+      ipagination.current = 1;
+    }
+
+    loading.value = true;
+    getAction(url.list, queryParam).then((res) => {
+      if (res.success) {
+        dataSource = res.result.records || res.result;
+        if (res.result.total != 0) {
+          ipagination.total = res.result.total;
+        } else {
+          ipagination.total = 0;
+        }
+      }
+      if (res.code === 510) {
+        createMessage.warning(res.message);
+      }
+      loading.value = false;
+    });
+  }
+</script>
+
+<style lang="less" scoped>
+  :deep(.spin-content .ant-row) {
+    margin: 15px 0;
+  }
+
+  .r0 {
+    .choose-site {
+      display: flex;
+      align-items: center;
+
+      :deep(.ant-select-selection) {
+        background: transparent;
+        color: #fff;
+      }
+
+      :deep(.ant-select-selection__clear) {
+        background: transparent;
+      }
+
+      :deep(i),
+      :deep(.ant-calendar-range-picker-separator) {
+        color: #fff;
+      }
+    }
+
+    .t1 {
+      font-size: 18px;
+    }
+
+    .ant-calendar-picker {
+      margin-right: 20px;
+
+      :deep(.ant-input) {
+        background: transparent;
+        color: #e2e2e2;
+      }
+    }
+
+    :deep(.ant-btn) {
+      background: transparent;
+      color: #e2e2e2;
+      margin-right: 10px;
+
+      &.active {
+        background: #fff;
+        border-color: #fff;
+        color: @primary-color;
+      }
+    }
+  }
+
+  .r1 {
+    background: #fff;
+    border-radius: 10px;
+    padding: 20px;
+    color: #000;
+    margin-bottom: 10px;
+    .title {
+      font-size: 18px;
+      font-weight: 500;
+      color: #000;
+    }
+
+    .t1 {
+      color: #999;
+      margin-bottom: 5px;
+      font-size: 16px;
+
+      .chooseImg {
+        width: 20px;
+        cursor: pointer;
+        margin: -4px 10px 0 0;
+      }
+    }
+
+    .t2 {
+      color: #999;
+      margin-bottom: 0;
+      margin-left: 35px;
+    }
+
+    .active {
+      .t1 {
+        color: @primary-color;
+      }
+
+      .t2 {
+        color: #000;
+      }
+    }
+
+    .add-account {
+      background: rgb(242, 248, 255);
+      color: @primary-color;
+      text-align: center;
+      line-height: 1;
+      display: flex;
+      flex-direction: column;
+      justify-content: center;
+      align-items: center;
+      height: 95px;
+      border-radius: 10px;
+      cursor: pointer;
+      transition: all 0.3s;
+      &:hover {
+        background: @primary-color;
+        a {
+          color: #fff;
+        }
+        p {
+          color: #fff;
+        }
+        :deep(svg) {
+          color: #fff;
+        }
+      }
+
+      i {
+        padding-bottom: 10px;
+      }
+
+      p {
+        margin-bottom: 0;
+      }
+    }
+  }
+
+  .r2 {
+    background: #fff;
+    border-radius: 10px;
+    padding: 20px;
+    color: #000;
+    .tips {
+      margin-bottom: 10px;
+      color: #999;
+      font-size: 13px;
+    }
+  }
+</style>

+ 13 - 18
src/views/adweb/enquiry/components/AdwebEnquiryForm.vue

@@ -3,8 +3,7 @@
     <JFormContainer :disabled="disabled">
       <template #detail>
         <a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol">
-          <a-row>
-          </a-row>
+          <a-row />
         </a-form>
       </template>
     </JFormContainer>
@@ -12,18 +11,17 @@
 </template>
 
 <script lang="ts" setup>
-  import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
-  import { defHttp } from '/@/utils/http/axios';
+  import { computed, defineExpose, defineProps, nextTick, reactive, ref } from 'vue';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { getValueType } from '/@/utils';
   import { saveOrUpdate } from '../AdwebEnquiry.api';
   import { Form } from 'ant-design-vue';
   import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
-  
+
   const props = defineProps({
     formDisabled: { type: Boolean, default: false },
-    formData: { type: Object, default: () => ({})},
-    formBpm: { type: Boolean, default: true }
+    formData: { type: Object, default: () => ({}) },
+    formBpm: { type: Boolean, default: true },
   });
   const formRef = ref();
   const useForm = Form.useForm;
@@ -36,23 +34,21 @@
   const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
   const confirmLoading = ref<boolean>(false);
   //表单验证
-  const validatorRules = reactive({
-  });
+  const validatorRules = reactive({});
   const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
 
   // 表单禁用
-  const disabled = computed(()=>{
-    if(props.formBpm === true){
-      if(props.formData.disabled === false){
+  const disabled = computed(() => {
+    if (props.formBpm === true) {
+      if (props.formData.disabled === false) {
         return false;
-      }else{
+      } else {
         return true;
       }
     }
     return props.formDisabled;
   });
 
-  
   /**
    * 新增
    */
@@ -68,10 +64,10 @@
       resetFields();
       const tmpData = {};
       Object.keys(formData).forEach((key) => {
-        if(record.hasOwnProperty(key)){
-          tmpData[key] = record[key]
+        if (record.hasOwnProperty(key)) {
+          tmpData[key] = record[key];
         }
-      })
+      });
       //赋值
       Object.assign(formData, tmpData);
     });
@@ -115,7 +111,6 @@
       });
   }
 
-
   defineExpose({
     add,
     edit,

+ 211 - 0
src/views/adweb/enquiry/modules/distributionArea.vue

@@ -0,0 +1,211 @@
+<template>
+  <a-drawer
+    :width="width"
+    placement="right"
+    :closable="true"
+    @close="handleCancel"
+    :keyboard="false"
+    :body-style="{ padding: '5px 24px 64px 24px' }"
+    :maskClosable="false"
+    v-model:open="visible"
+  >
+    <template #title>
+      <span v-if="onlyUser"> 负责区域 </span>
+      <span v-else
+        >{{ title }}
+        <span style="float: right; margin: -3px 20px 0 0"
+          >分配给:
+          <a-select v-model:value="user" style="width: 180px">
+            <a-select-option v-for="item in userList" :key="item.id" :value="item.id">
+              {{ item.username }}
+            </a-select-option>
+          </a-select>
+        </span>
+      </span>
+    </template>
+
+    <a-tree
+      checkable
+      v-if="treeData.length"
+      :tree-data="treeData"
+      v-model:checked-keys="checkdNode"
+      class="self-tree"
+      :defaultExpandAll="true"
+      :blockNode="false"
+      @check="onCheck"
+    />
+
+    <a-empty v-if="treeData.length == 0" />
+
+    <div class="drawer-footer">
+      <a-button @click="handleCancel" style="margin-bottom: 0">关闭</a-button>
+      <a-button :loading="loading" @click="handleOk" type="primary" style="margin-bottom: 0" v-if="treeData.length > 0">
+        {{ onlyUser ? '保存修改' : '确认分配' }}</a-button
+      >
+    </div>
+  </a-drawer>
+</template>
+
+<script lang="ts" setup>
+  import { getAction, postAction } from '/@/api/manage/manage';
+  import { useMessage } from '@/hooks/web/useMessage';
+  import { ref } from 'vue';
+
+  const { createMessage } = useMessage();
+
+  const title = ref('待分配区域');
+  const width = 700;
+  const onlyUser = ref(false);
+  const visible = ref(false);
+
+  let treeData = ref([]);
+  let checkdNode = ref([]);
+  let userList = ref([{ id: '', username: '' }]);
+  const user = ref('');
+  const id = ref('');
+  const loading = ref(false);
+  const siteId = ref('');
+
+  // 定义父组件的方法, 子组件调用父组件的方法
+  const emit = defineEmits(['ok']);
+
+  function reload() {
+    visible.value = true;
+    treeData.value = [];
+    checkdNode.value = [];
+    userList.value = [];
+    user.value = '';
+    loading.value = false;
+  }
+
+  function init(siteIdParam) {
+    siteId.value = siteIdParam;
+    reload();
+    onlyUser.value = false;
+    getAllTree();
+  }
+
+  function getAllTree() {
+    checkdNode.value = [];
+    id.value = '';
+    getAction('/usercountry/country/uncontribute?siteId=' + siteId.value, {}).then((res) => {
+      if (res.code == 200) {
+        treeData.value = res.result == null ? [] : res.result;
+
+        console.log(treeData, 'treeDatatreeData');
+      }
+    });
+
+    getAction('/usercountry/subAccounts/optionswithoutself', {}).then((res) => {
+      if (res.code == 200) {
+        userList.value = res.result;
+        user.value = res.result.length > 0 ? res.result[0].id : '';
+      }
+    });
+  }
+
+  //子账户直接进入获取到所有的已分配国家
+  function getUsersTree(idParam, siteIdParam) {
+    siteId.value = siteIdParam;
+    reload();
+    onlyUser.value = true;
+    id.value = idParam;
+    checkdNode.value = [];
+    getAction('/usercountry/country/charge?id=' + id.value + '&siteId=' + siteId.value, {}).then((res) => {
+      if (res.code == 200) {
+        treeData.value = res.result == null ? [] : res.result;
+        if (treeData.value.length > 0) {
+          for (let i in res.result) {
+            checkdNode.value.push(res.result[i].key);
+            for (let j in res.result[i].children) {
+              checkdNode.value.push(res.result[i].children[j].key);
+            }
+          }
+        }
+      }
+    });
+  }
+
+  function onCheck() {
+    console.log('onCheck', checkdNode);
+  }
+
+  function handleCancel() {
+    visible.value = false;
+  }
+
+  function handleOk() {
+    console.log(user.value, ' user.value', id.value, ' id.value');
+
+    if (user.value == '' && id.value == '') {
+      createMessage.warn('请先选择要分配的子用户');
+      return;
+    }
+
+    let d = {
+      uid: user.value == '' ? id.value : user.value,
+      countryIds: checkdNode.value.toString(),
+      siteId: siteId.value,
+    };
+    let url = onlyUser.value ? '/usercountry/contribute/delete' : '/usercountry/contribute/add';
+    loading.value = true;
+    postAction(url, d, 120000).then((res) => {
+      loading.value = false;
+      if (res.code == 200) {
+        createMessage.success('分配成功');
+        emit('ok');
+        if (onlyUser.value) {
+          getUsersTree(id, siteId);
+        } else {
+          getAllTree();
+        }
+      } else {
+        if (res.code == 403) {
+          createMessage.warning(res.message);
+        } else {
+          createMessage.error('分配失败');
+        }
+      }
+    });
+  }
+
+  // 暴漏子组件方法,引用该组件的父组件可直接调用该方法
+  defineExpose({ init, getUsersTree });
+</script>
+
+<style lang="less" scoped>
+  /** Button按钮间距 */
+  .ant-btn {
+    margin-left: 30px;
+    margin-bottom: 30px;
+    float: right;
+  }
+
+  .drawer-footer {
+    position: absolute;
+    bottom: 0px;
+    width: 100%;
+    border-top: 1px solid #e8e8e8;
+    padding: 10px 16px;
+    text-align: right;
+    left: 0;
+    background: #fff;
+    border-radius: 0 0 2px 2px;
+  }
+</style>
+
+<style lang="less">
+  .self-tree {
+    .ant-tree-child-tree {
+      width: 100%;
+      display: block;
+      overflow: hidden;
+      li {
+        width: 33.33%;
+        float: left;
+        display: inline-block;
+        padding: 5px 0;
+      }
+    }
+  }
+</style>

+ 3 - 1
src/views/adweb/enterprise/EnterpriseUserManage.api.ts

@@ -17,7 +17,9 @@ export const list = (params) => defHttp.get({ url: Api.list, params });
 
 export const queryEnterpriseAll = (params) => defHttp.get({ url: '/enterprise/role/queryall', params });
 
-export const addEnterpriseUser = (params) => defHttp.post({ url: '/enterprise/user/add', params });
+export const addEnterpriseUser = (params) => {
+  return defHttp.post({ url: '/enterprise/user/add', params });
+};
 /**
  * 删除单个
  */

+ 89 - 1
src/views/adweb/enterprise/EnterpriseUserManage.data.ts

@@ -1,5 +1,6 @@
-import { BasicColumn } from '@/components/Table';
+import { BasicColumn, FormSchema } from '@/components/Table';
 import { render } from '@/utils/common/renderUtils';
+import { rules } from '@/utils/helper/validator';
 
 export const columns: BasicColumn[] = [
   {
@@ -148,3 +149,90 @@ export const subColumns: BasicColumn[] = [
     align: 'left',
   },
 ];
+
+export const formSchema: FormSchema[] = [
+  {
+    label: '',
+    field: 'id',
+    component: 'Input',
+    show: false,
+  },
+  {
+    label: '用户账号',
+    field: 'username',
+    component: 'Input',
+    dynamicDisabled: ({ values }) => {
+      return !!values.id;
+    },
+    dynamicRules: ({ model, schema }) => rules.duplicateCheckRule('sys_user', 'username', model, schema, true),
+  },
+  {
+    label: '登录密码',
+    field: 'password',
+    component: 'StrengthMeter',
+    componentProps: {
+      autocomplete: 'new-password',
+    },
+    rules: [
+      {
+        required: true,
+        message: '请输入登录密码',
+      },
+      {
+        pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
+        message: '密码由8位数字、大小写字母和特殊符号组成!',
+      },
+    ],
+    ifShow: ({ values }) => {
+      return !values.id;
+    },
+  },
+  {
+    label: '确认密码',
+    field: 'confirmPassword',
+    component: 'InputPassword',
+    dynamicRules: ({ values }) => rules.confirmPassword(values, true),
+    ifShow: ({ values }) => {
+      return !values.id;
+    },
+  },
+  {
+    label: '公司名称',
+    field: 'realname',
+    required: true,
+    component: 'Input',
+  },
+  {
+    label: '手机号码',
+    field: 'phone',
+    component: 'Input',
+    required: true,
+    dynamicRules: ({ model, schema }) => {
+      return [
+        { ...rules.duplicateCheckRule('sys_user', 'phone', model, schema, true)[0], trigger: 'blur' },
+        { pattern: /^1[3456789]\d{9}$/, message: '手机号码格式有误', trigger: 'blur' },
+      ];
+    },
+  },
+  {
+    label: '邮箱',
+    field: 'email',
+    component: 'Input',
+    required: true,
+    dynamicRules: ({ model, schema }) => {
+      return [
+        { ...rules.duplicateCheckRule('sys_user', 'email', model, schema, true)[0], trigger: 'blur' },
+        { ...rules.rule('email', false)[0], trigger: 'blur' },
+      ];
+    },
+  },
+
+  {
+    label: '头像',
+    field: 'avatar',
+    component: 'JImageUpload',
+    componentProps: {
+      fileMax: 1,
+    },
+  },
+];

+ 32 - 33
src/views/adweb/enterprise/EnterpriseUserManageList.vue

@@ -6,7 +6,7 @@
         <a-row :gutter="24">
           <a-col :md="6" :sm="12">
             <a-form-item>
-              <a-input placeholder="请输入用户账号/用户名/手机号" v-model="queryParam.queryCondition" />
+              <a-input placeholder="请输入用户账号/用户名/手机号" v-model:value="queryParam.queryCondition" />
             </a-form-item>
           </a-col>
           <a-col :md="18" :sm="12">
@@ -15,6 +15,11 @@
               <a-button ghost type="primary" @click="searchReset" preIcon="ant-design:reload-outlined" style="margin-left: 8px">重置</a-button>
               <a-button ghost @click="handleAdd" type="primary" style="margin-left: 8px" preIcon="ant-design:plus-outlined">添加子用户</a-button>
               <a-button ghost type="primary" @click="showRecycleBin" style="margin-left: 8px" preIcon="ant-design:hdd-outlined">回收站</a-button>
+              <router-link :to="{ path: '/inquery/rules' }" v-if="siteCode !== dictSiteCode">
+                <a-button ghost type="primary" preIcon="ant-design:logout-outlined" @click="showRecycleBin" style="margin-left: 8px"
+                  >配置询盘规则</a-button
+                >
+              </router-link>
             </span>
           </a-col>
         </a-row>
@@ -95,8 +100,8 @@
     <!-- 编辑、新增用户 -->
     <enterprise-user-modal ref="registerModal" @ok="modalFormOk" />
 
-    <!-- 权限分配 -->
-    <enterprise-user-role-modal ref="modalUserRole" />
+    <!--修改密码-->
+    <PasswordModal @register="registerPasswordModal" @success="reload" />
 
     <!-- 用户回收站 -->
     <enterprise-user-recycle-bin-modal ref="recycleBin" @ok="modalFormOk" />
@@ -109,17 +114,19 @@
 
   import { getAction, getFileAccessHttpUrl, putAction } from '@/api/manage/manage';
   import EnterpriseUserRecycleBinModal from './modules/EnterpriseUserRecycleBinModal.vue';
-  import EnterpriseUserRoleModal from './modules/EnterpriseUserRoleModal.vue';
+  import PasswordModal from '/@/views/system/user/PasswordModal.vue';
 
-  import { ref, reactive, onMounted, nextTick, watch, toRaw, toRefs, computed, onBeforeMount } from 'vue';
+  import { onBeforeMount, reactive, ref } from 'vue';
   import { BasicTable } from '@/components/Table';
   import { useMessage } from '@/hooks/web/useMessage';
   import { useListPage } from '@/hooks/system/useListPage';
-  import { batchDelete, deleteOne, list } from '@/views/adweb/enterprise/EnterpriseUserManage.api';
+  import { deleteOne, list } from '@/views/adweb/enterprise/EnterpriseUserManage.api';
   import { columns, subColumns } from '@/views/adweb/enterprise/EnterpriseUserManage.data';
+  import { useModal } from '@/components/Modal';
 
   let subAccountList = reactive([]);
   const registerModal = ref();
+  const recycleBin = ref();
   const ipagination1 = reactive({
     current: 1,
     pageSize: 10,
@@ -128,7 +135,7 @@
       return range[0] + '-' + range[1] + ' 共' + total + '条';
     },
   });
-  const queryParam = reactive<any>({});
+  let queryParam = reactive<any>({});
   const loading = ref(false);
   const siteCode = ref();
   const dictSiteCode = ref();
@@ -160,6 +167,8 @@
     { rowSelection, selectedRowKeys },
   ] = tableContext;
 
+  const [registerPasswordModal, { openModal: openPasswordModal }] = useModal();
+
   onBeforeMount(() => {
     subList();
     siteCode.value = localStorage.getItem('siteCode');
@@ -182,7 +191,7 @@
         if (siteCode.value === dictSiteCode.value) {
           subList();
         } else {
-          loadData();
+          reload();
         }
       } else {
         createMessage.warning(res.message);
@@ -194,27 +203,32 @@
     return getFileAccessHttpUrl(avatar, 'https');
   }
   function showRecycleBin() {
-    this.$refs.recycleBin.show();
+    recycleBin.value.show();
   }
   function searchQuery() {
     if (siteCode.value === dictSiteCode.value) {
       subList();
     } else {
-      loadData();
+      reload();
     }
-    onClearSelected();
+    clearSelectedRowKeys();
   }
   function searchReset() {
     queryParam = {};
     if (siteCode.value === dictSiteCode.value) {
       subList();
     } else {
-      loadData(1);
+      reload();
     }
   }
+
+  /**
+   * 打开修改密码弹窗
+   */
   function handleChangePassword(username) {
-    this.$refs.passwordmodal.show(username);
+    openPasswordModal(true, { username });
   }
+
   function handlePerssion(userId) {
     this.$refs.modalUserRole.show(userId);
   }
@@ -224,7 +238,7 @@
     if (siteCode.value === dictSiteCode.value) {
       subList();
     } else {
-      loadData();
+      reload();
     }
   }
   //获取子账户
@@ -246,11 +260,11 @@
     record.isInquiry = checked ? 2 : 1;
     putAction('/enterprise/user/updateIsInquiry', record).then((res) => {
       if (res.success) {
-        this.$message.success(res.message);
-        this.subList();
+        createMessage.success(res.message);
+        subList();
       } else {
-        this.$message.warning(res.message);
-        this.subList();
+        createMessage.warning(res.message);
+        subList();
       }
     });
   }
@@ -273,14 +287,6 @@
   }
 
   /**
-   * 详情
-   */
-  function handleDetail(record: Recordable) {
-    registerModal.value.disableSubmit = true;
-    registerModal.value.edit(record);
-  }
-
-  /**
    * 删除事件
    */
   async function handleDelete(record) {
@@ -288,13 +294,6 @@
   }
 
   /**
-   * 批量删除事件
-   */
-  async function batchHandleDelete() {
-    await batchDelete({ id: selectedRowKeys.value.join(',') }, handleSuccess);
-  }
-
-  /**
    * 成功回调
    */
   function handleSuccess() {

+ 0 - 183
src/views/adweb/enterprise/modules/EnterpriseDepartWindow.vue

@@ -1,183 +0,0 @@
-<template>
-  <a-modal
-    :width="modalWidth"
-    :visible="visible"
-    title="部门搜索"
-    :confirmLoading="confirmLoading"
-    @ok="handleSubmit"
-    @cancel="handleCancel"
-    cancelText="关闭"
-    wrapClassName="ant-modal-cust-warp"
-  >
-    <!--部门树-->
-    <template>
-      <a-form :form="form">
-        <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="上级部门">
-          <a-tree
-            multiple
-            treeCheckable="tree"
-            checkable
-            @expand="onExpand"
-            :expandedKeys="expandedKeysss"
-            :checkedKeys="checkedKeys"
-            allowClear="true"
-            :checkStrictly="true"
-            @check="onCheck"
-            :dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }"
-            :treeData="departTree"
-            placeholder="请选择上级部门"
-          />
-        </a-form-item>
-      </a-form>
-    </template>
-  </a-modal>
-</template>
-
-<script lang="ts" setup>
-  import { getAction } from '@/api/manage/manage';
-  import { queryIdTree } from '@/views/system/departUser/depart.user.api';
-  import { nextTick, reactive, ref } from 'vue';
-  import { pick } from 'lodash-es';
-
-  let checkedKeys = reactive([]);
-  const expandedKeysss = reactive([]);
-  let model = {};
-  const userId = ref();
-  const userDepartModel = { userId: '', departIdList: [] };
-  let departList = [];
-  const modalWidth = ref(400);
-  const departTree = reactive([]);
-  const title = '操作';
-  const visible = ref(false);
-  const labelCol = reactive({
-    xs: { span: 24 },
-    sm: { span: 5 },
-  });
-  const wrapperCol = reactive({
-    xs: { span: 24 },
-    sm: { span: 16 },
-  });
-
-  const confirmLoading = ref(false);
-  const headers = reactive({});
-  const form = ref();
-  const url = {
-    userId: '/sys/user/generateUserId', // 引入生成添加用户情况下的url
-  };
-  const emit = defineEmits(['ok', 'close']);
-
-  function add(checkedDepartKeys, userId) {
-    checkedKeys = checkedDepartKeys;
-    userId.value = userId;
-    edit({});
-  }
-
-  function edit(record) {
-    departList = [];
-    queryDepartTree();
-    form.value.resetFields();
-    visible.value = true;
-    model = Object.assign({}, record);
-    let filedsVal = pick(model, 'id', 'userId', 'departIdList');
-    nextTick(() => {
-      form.value.setFieldsValue(filedsVal);
-    });
-  }
-
-  function close() {
-    emit('close');
-    visible.value = false;
-    departList = [];
-    checkedKeys = [];
-  }
-
-  function handleSubmit() {
-    // 触发表单验证
-    form.value.validateFields((err) => {
-      if (!err) {
-        confirmLoading.value = true;
-        if (userId.value == null) {
-          getAction(url.userId)
-            .then((res) => {
-              if (res.success) {
-                let formData = { userId: res.result, departIdList: departList };
-                console.log(formData);
-                emit('ok', formData);
-              }
-            })
-            .finally(() => {
-              departList = [];
-              confirmLoading.value = false;
-              close();
-            });
-        } else {
-          let formData = { userId: userId, departIdList: departList };
-          console.log(formData);
-          departList = [];
-          emit('ok', formData);
-          confirmLoading.value = false;
-          close();
-        }
-      }
-    });
-  }
-
-  function handleCancel() {
-    close();
-  }
-
-  // 选择部门时作用的API
-  function onCheck(checkedKeys, info) {
-    departList = [];
-    checkedKeys = checkedKeys.checked;
-    let checkedNodes = info.checkedNodes;
-    for (let i = 0; i < checkedNodes.length; i++) {
-      let de = checkedNodes[i].data.props;
-      let depart = { key: '', value: '', title: '' };
-      depart.key = de.value;
-      depart.value = de.value;
-      depart.title = de.title;
-      departList.push(depart);
-    }
-    console.log('onCheck', checkedKeys, info);
-  }
-
-  function queryDepartTree() {
-    queryIdTree().then((res) => {
-      if (res.success) {
-        departTree = res.result;
-        if (checkedKeys && checkedKeys.length > 0) {
-          let treekey = [];
-          let arr = res.result;
-          if (arr && arr.length > 0) {
-            arr.forEach((item) => {
-              treekey.push(item.key);
-              /*     if(item.children&&item.children.length>0){
-                item.children.forEach(item1 => {
-                  treekey.push(item1.key);
-                })
-              }*/
-            });
-            expandedKeysss = treekey;
-          }
-        }
-      }
-    });
-  }
-
-  function onExpand(expandedKeys) {
-    expandedKeysss = expandedKeys;
-  }
-
-  function modalFormOk() {}
-</script>
-
-<style lang="less" scoped>
-  .ant-table-tbody .ant-table-row td {
-    padding-top: 10px;
-    padding-bottom: 10px;
-  }
-  :deep(.ant-modal) {
-    height: 700px;
-  }
-</style>

+ 0 - 120
src/views/adweb/enterprise/modules/EnterpriseRoleDataruleModal.vue

@@ -1,120 +0,0 @@
-<template>
-  <a-drawer
-    title="数据规则/按钮权限配置"
-    width="365"
-    :closable="false"
-    @close="onClose"
-    :visible="visible"
-  >
-
-    <a-tabs defaultActiveKey="1">
-      <a-tab-pane tab="数据规则" key="1">
-
-        <a-checkbox-group v-model="dataruleChecked" v-if="dataruleList.length>0">
-          <a-row>
-            <a-col :span="24" v-for="(item,index) in dataruleList" :key=" 'dr'+index ">
-              <a-checkbox :value="item.id">{{ item.ruleName }}</a-checkbox>
-            </a-col>
-
-            <a-col :span="24">
-              <div style="width: 100%;margin-top: 15px">
-                <a-button @click="saveDataruleForRole" type="primary" size="small" icon="save">点击保存</a-button>
-              </div>
-            </a-col>
-          </a-row>
-        </a-checkbox-group>
-        <div v-else><h3>无配置信息!</h3></div>
-
-      </a-tab-pane>
-      <!--<a-tab-pane tab="按钮权限" key="2">敬请期待!!!</a-tab-pane>-->
-    </a-tabs>
-
-  </a-drawer>
-</template>
-
-<script>
-  import ARow from 'ant-design-vue/es/grid/Row'
-  import ACol from 'ant-design-vue/es/grid/Col'
-  import { getAction,postAction } from '@/api/manage'
-
-  export default {
-    name: 'EnterpriseRoleDataruleModal',
-    components: { ACol, ARow },
-    data(){
-      return {
-        functionId:'',
-        roleId:'',
-        visible:false,
-        tabList: [{
-          key: '1',
-          tab: '数据规则',
-        }, {
-          key: '2',
-          tab: '按钮权限',
-        }],
-        activeTabKey: '1',
-        url:{
-          datarule:"/enterprise/role/datarule",
-        },
-        dataruleList:[],
-        dataruleChecked:[]
-      }
-    },
-    methods:{
-      loadData(){
-        getAction(`${this.url.datarule}/${this.functionId}/${this.roleId}`).then(res=>{
-          console.log(res)
-          if(res.success){
-            this.dataruleList = res.result.datarule
-            let drChecked = res.result.drChecked
-            if(drChecked){
-              this.dataruleChecked = drChecked.split(",")
-            }
-          }
-        })
-      },
-      saveDataruleForRole(){
-        if(!this.dataruleChecked || this.dataruleChecked.length==0){
-          this.$message.warning("请注意,现未勾选任何数据权限!")
-        }
-        let params = {
-          permissionId:this.functionId,
-          roleId:this.roleId,
-          dataRuleIds:this.dataruleChecked.join(",")
-        }
-        console.log("保存数据权限",params)
-        postAction(this.url.datarule,params).then(res=>{
-          if(res.success){
-            this.$message.success(res.message)
-          }else{
-            this.$message.error(res.message)
-          }
-        })
-      },
-      show(functionId,roleId){
-        this.onReset()
-        this.functionId = functionId
-        this.roleId = roleId
-        this.visible=true
-        this.loadData()
-      },
-      onClose(){
-        this.visible=false
-        this.onReset()
-      },
-      onTabChange (key) {
-        this.activeTabKey = key
-      },
-      onReset(){
-        this.functionId=''
-        this.roleId=''
-        this.dataruleList=[]
-        this.dataruleChecked=[]
-      }
-    }
-  }
-</script>
-
-<style scoped>
-
-</style>

+ 0 - 292
src/views/adweb/enterprise/modules/EnterpriseSelectUserModal.vue

@@ -1,292 +0,0 @@
-<template>
-  <div>
-    <a-modal
-      centered
-      :title="title"
-      :width="1000"
-      :visible="visible"
-      @ok="handleOk"
-      @cancel="handleCancel"
-      cancelText="关闭">
-
-
-      <!-- 查询区域 -->
-      <div class="table-page-search-wrapper">
-        <a-form layout="inline"  @keyup.enter.native="searchQuery">
-          <a-row :gutter="24">
-
-            <a-col :span="10">
-              <a-form-item label="用户账号">
-                <a-input placeholder="请输入用户账号" v-model="queryParam.username"></a-input>
-              </a-form-item>
-            </a-col>
-            <a-col :span="8">
-                    <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
-                      <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
-                      <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
-                    </span>
-            </a-col>
-
-          </a-row>
-        </a-form>
-      </div>
-      <!-- table区域-begin -->
-      <div>
-        <a-table
-          size="small"
-          bordered
-          rowKey="id"
-          :columns="columns1"
-          :dataSource="dataSource1"
-          :pagination="ipagination"
-          :loading="loading"
-          :scroll="{ y: 240 }"
-          :rowSelection="{selectedRowKeys: selectedRowKeys,onSelectAll:onSelectAll,onSelect:onSelect,onChange: onSelectChange}"
-          @change="handleTableChange">
-
-        </a-table>
-      </div>
-      <!-- table区域-end -->
-
-
-    </a-modal>
-  </div>
-</template>
-
-<script>
-  import {filterObj} from '@/utils/util'
-  import {getAction} from '@/api/manage'
-  import store from '@/store/'
-
-  export default {
-    name: "EnterpriseSelectUserModal",
-    data() {
-      return {
-        title: "添加已有用户",
-        names: [],
-        visible: false,
-        placement: 'right',
-        description: '',
-        // 查询条件
-        queryParam: {
-          id: store.getters.userInfo.id
-        },
-        // 表头
-        columns1: [
-          {
-            title: '#',
-            dataIndex: '',
-            key: 'rowIndex',
-            width: 50,
-            align: "center",
-            customRender: function (t, r, index) {
-              return parseInt(index) + 1;
-            }
-          },
-          {
-            title: '用户账号',
-            align: "center",
-            width: 100,
-            dataIndex: 'username'
-          },
-          {
-            title: '用户名称',
-            align: "center",
-            width: 100,
-            dataIndex: 'realname'
-          },
-          {
-            title: '性别',
-            align: "center",
-            width: 100,
-            dataIndex: 'sex_dictText'
-          },
-          {
-            title: '电话',
-            align: "center",
-            width: 100,
-            dataIndex: 'phone'
-          },
-          {
-            title: '部门',
-            align: "center",
-            width: 150,
-            dataIndex: 'orgCode'
-          }
-        ],
-        columns2: [
-          {
-            title: '用户账号',
-            align: "center",
-            dataIndex: 'username',
-
-          },
-          {
-            title: '用户名称',
-            align: "center",
-            dataIndex: 'realname',
-          },
-          {
-            title: '操作',
-            dataIndex: 'action',
-            align: "center",
-            width: 100,
-            scopedSlots: {customRender: 'action'},
-          }
-        ],
-        //数据集
-        dataSource1: [],
-        dataSource2: [],
-        // 分页参数
-        ipagination: {
-          current: 1,
-          pageSize: 10,
-          pageSizeOptions: ['10', '20', '30'],
-          showTotal: (total, range) => {
-            return range[0] + "-" + range[1] + " 共" + total + "条"
-          },
-          showQuickJumper: true,
-          showSizeChanger: true,
-          total: 0
-        },
-        isorter: {
-          column: 'createTime',
-          order: 'desc',
-        },
-        loading: false,
-        selectedRowKeys: [],
-        selectedRows: [],
-        url: {
-          list: "/enterprise/user/list",
-        }
-      }
-    },
-    created() {
-      this.loadData();
-    },
-    methods: {
-      searchQuery() {
-        this.loadData(1);
-      },
-      searchReset() {
-        this.queryParam = {
-          id: store.getters.userInfo.id
-        };
-        this.loadData(1);
-      },
-      handleCancel() {
-        this.visible = false;
-      },
-      handleOk() {
-        this.dataSource2 = this.selectedRowKeys;
-        console.log("data:" + this.dataSource2);
-        this.$emit("selectFinished", this.dataSource2);
-        this.visible = false;
-      },
-      add() {
-        this.visible = true;
-      },
-      loadData(arg) {
-        //加载数据 若传入参数1则加载第一页的内容
-        if (arg === 1) {
-          this.ipagination.current = 1;
-        }
-        var params = this.getQueryParams();//查询条件
-        getAction(this.url.list, params).then((res) => {
-          if (res.success) {
-            this.dataSource1 = res.result.records;
-            this.ipagination.total = res.result.total;
-          }
-        })
-      },
-      getQueryParams() {
-        var param = Object.assign({}, this.queryParam, this.isorter);
-        param.field = this.getQueryField();
-        param.pageNo = this.ipagination.current;
-        param.pageSize = this.ipagination.pageSize;
-        return filterObj(param);
-      },
-      getQueryField() {
-        //TODO 字段权限控制
-      },
-      onSelectAll(selected, selectedRows, changeRows) {
-        if (selected === true) {
-          for (var a = 0; a < changeRows.length; a++) {
-            this.dataSource2.push(changeRows[a]);
-          }
-        } else {
-          for (var b = 0; b < changeRows.length; b++) {
-            this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1);
-          }
-        }
-        // console.log(selected, selectedRows, changeRows);
-      },
-      onSelect(record, selected) {
-        if (selected === true) {
-          this.dataSource2.push(record);
-        } else {
-          var index = this.dataSource2.indexOf(record);
-          //console.log();
-          if (index >= 0) {
-            this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
-          }
-
-        }
-      },
-      onSelectChange(selectedRowKeys, selectedRows) {
-        this.selectedRowKeys = selectedRowKeys;
-        this.selectionRows = selectedRows;
-      },
-      onClearSelected() {
-        this.selectedRowKeys = [];
-        this.selectionRows = [];
-      },
-      handleDelete: function (record) {
-        this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
-      },
-      handleTableChange(pagination, filters, sorter) {
-        //分页、排序、筛选变化时触发
-        console.log(sorter);
-        //TODO 筛选
-        if (Object.keys(sorter).length > 0) {
-          this.isorter.column = sorter.field;
-          this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
-        }
-        this.ipagination = pagination;
-        this.loadData();
-      }
-    }
-  }
-</script>
-<style lang="less" scoped>
-  .ant-card-body .table-operator {
-    margin-bottom: 18px;
-  }
-
-  .ant-table-tbody .ant-table-row td {
-    padding-top: 15px;
-    padding-bottom: 15px;
-  }
-
-  .anty-row-operator button {
-    margin: 0 5px
-  }
-
-  .ant-btn-danger {
-    background-color: #ffffff
-  }
-
-  .ant-modal-cust-warp {
-    height: 100%
-  }
-
-  .ant-modal-cust-warp .ant-modal-body {
-    height: calc(100% - 110px) !important;
-    overflow-y: auto
-  }
-
-  .ant-modal-cust-warp .ant-modal-content {
-    height: 90% !important;
-    overflow-y: hidden
-  }
-</style>

+ 67 - 437
src/views/adweb/enterprise/modules/EnterpriseUserModal.vue

@@ -1,7 +1,8 @@
 <template>
-  <a-drawer
+  <BasicDrawer
     :title="title"
     :maskClosable="true"
+    :confirmLoading="confirmLoading"
     :width="drawerWidth"
     placement="right"
     :closable="true"
@@ -9,161 +10,46 @@
     v-model:open="visible"
     style="height: 100%; overflow: auto; padding-bottom: 53px"
   >
-    <template #title>
-      <div style="width: 100%">
-        <span>{{ title }}</span>
-        <span style="display: inline-block; width: calc(100% - 51px); padding-right: 10px; text-align: right">
-          <a-button @click="toggleScreen" icon="appstore" style="height: 20px; width: 20px; border: 0px" />
-        </span>
-      </div>
-    </template>
-
-    <a-spin :spinning="confirmLoading">
-      <a-form :ref="formRef" :model="model" :rules="formRules">
-        <a-form-item label="用户账号" :labelCol="labelCol" :wrapperCol="wrapperCol" name="username">
-          <a-input placeholder="请输入用户账号" :disabled="!!model.id" />
-        </a-form-item>
-        <a-form-item label="用户姓名" :labelCol="labelCol" :wrapperCol="wrapperCol" name="realname">
-          <a-input placeholder="请输入用户姓名" name="realname" />
-        </a-form-item>
-        <template v-if="!model.id">
-          <a-form-item label="登录密码" :labelCol="labelCol" :wrapperCol="wrapperCol" name="password">
-            <a-input type="password" autocomplete="new-password" placeholder="请输入登录密码" />
-          </a-form-item>
-          <a-form-item label="确认密码" :labelCol="labelCol" :wrapperCol="wrapperCol" name="confirmpassword">
-            <a-input type="password" @blur="handleConfirmBlur" placeholder="请重新输入登录密码" />
-          </a-form-item>
-        </template>
-        <template v-if="siteCode === dictSiteCode">
-          <a-form-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol" name="sex">
-            <a-radio-group>
-              <a-radio :value="1">男</a-radio>
-              <a-radio :value="2">女</a-radio>
-            </a-radio-group>
-          </a-form-item>
-          <a-form-item label="工作手机" :labelCol="labelCol" :wrapperCol="wrapperCol" name="phone">
-            <a-input placeholder="请输入手机号码" />
-          </a-form-item>
-          <a-form-item label="企业邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol" name="email">
-            <a-input placeholder="请输入邮箱" />
-          </a-form-item>
-        </template>
-        <template v-if="siteCode !== dictSiteCode">
-          <a-form-item label="手机号码" :labelCol="labelCol" :wrapperCol="wrapperCol" name="phone">
-            <a-input placeholder="请输入手机号码" />
-          </a-form-item>
-          <a-form-item label="邮箱" :labelCol="labelCol" :wrapperCol="wrapperCol" name="email">
-            <a-input placeholder="请输入邮箱" />
-          </a-form-item>
-        </template>
-        <a-form-item label="头像" :labelCol="labelCol" :wrapperCol="wrapperCol">
-          <j-image-upload class="avatar-uploader" text="上传" v-model="fileList" />
-        </a-form-item>
-      </a-form>
-    </a-spin>
-    <enterprise-depart-window ref="enterpriseDepartWindow" @ok="modalFormOk" />
+    <BasicForm @register="registerForm" />
+
     <div class="drawer-bootom-button" v-show="!disableSubmit">
       <a-button @click="handleCancel" style="margin-right: 0.8rem">取消</a-button>
       <a-button @click="handleSubmit" type="primary" :loading="confirmLoading">提交</a-button>
     </div>
-  </a-drawer>
+  </BasicDrawer>
 </template>
 
 <script lang="ts" setup>
-  // 引入搜索部门弹出框的组件
-  import enterpriseDepartWindow from './EnterpriseDepartWindow.vue';
-
   import { getAction, postAction } from '@/api/manage/manage';
-  import { addEnterpriseUser, queryEnterpriseAll } from '../EnterpriseUserManage.api';
-  import { duplicateCheck } from '@/views/system/user/user.api';
-  import JImageUpload from '/@/components/Form/src/jeecg/components/JImageUpload.vue';
-  import { nextTick, onBeforeMount, reactive, ref } from 'vue';
+  import { formSchema } from '../EnterpriseUserManage.data';
+  import { onBeforeMount, ref } from 'vue';
   import { useUserStore } from '/@/store/modules/user';
-  import pick from 'lodash.pick';
-  import type { FormInstance } from 'ant-design-vue';
+  import { useMessage } from '@/hooks/web/useMessage';
+  import { BasicForm, useForm } from '@/components/Form';
+  import { BasicDrawer } from '@/components/Drawer';
+  import { getTenantId } from '/@/utils/auth';
 
   const userStore = useUserStore();
-  const isMasterAccount = ref(false);
-  const departDisabled = ref(false);
-  const roleDisabled = ref(false);
-  const modaltoggleFlag = ref(true);
-  const confirmDirty = ref(false);
-  const modalWidth = ref(800);
+
   let drawerWidth = ref(700);
-  const formRef = ref<FormInstance>();
-  const queryParam = reactive({ username: userStore.getUserInfo.username });
-  let selectedDepartKeys = reactive([]);
-  let checkedDepartKeys = reactive([]);
-  let checkedDepartNames = reactive([]);
+
   let checkedDepartNameString = ref('');
-  let resultDepartOptions = reactive([]);
+
   let userId = ref('');
   const disableSubmit = ref(false);
-  const userDepartModel = reactive({ userId: '', departIdList: [] }); // 保存SysUserDepart的用户部门中间表数据需要的对象
-  const dateFormat = ref('YYYY-MM-DD');
-  const formRules = reactive({
-    username: [
-      { required: true, message: '请输入用户账号', trigger: 'blur' },
-      {
-        validator: validateUsername,
-      },
-    ],
-    password: [
-      {
-        required: true,
-        pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,}$/,
-        message: '密码由8位数字、大小写字母和特殊符号组成!',
-      },
-      {
-        validator: validateToNextPassword,
-      },
-    ],
-    confirmpassword: [
-      {
-        required: true,
-        message: '请重新输入登录密码!',
-      },
-      {
-        validator: compareToFirstPassword,
-      },
-    ],
-    realname: [{ required: true, message: '请输入用户名称!' }],
-    phone: [{ validator: validatePhone }],
-    email: [
-      {
-        validator: validateEmail,
-      },
-    ],
-    roles: {},
-    telephone: [{ pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '请输入正确的座机号码' }],
-  });
 
   let departIdShow = ref(false);
-  const departIds = reactive([]);
+
   const title = ref('操作');
   const visible = ref(false);
-  let model = reactive({ userIdentity: '', id: '', tenantId: '' });
-  let roleList = reactive([]);
-  const selectedRole = ref([]);
-  const labelCol = reactive({
-    xs: { span: 24 },
-    sm: { span: 5 },
-  });
 
-  const wrapperCol = reactive({
-    xs: { span: 24 },
-    sm: { span: 16 },
-  });
+  const selectedRole = ref([]);
 
-  const uploadLoading = false;
-  const confirmLoading = false;
+  const confirmLoading = ref(false);
 
-  const headers = reactive({});
   const picUrl = ref('');
   const identity = ref('1');
-  let fileList = reactive([]);
-  let tenantList = reactive([]);
-  let currentTenant = reactive([]);
+
   let siteCode = ref('');
   let dictSiteCode = ref('');
   const url = {
@@ -172,61 +58,26 @@
     syncUserByUserName: '/act/process/extActProcess/doSyncUserByUserName', //同步用户到工作流
     queryTenantList: '/sys/tenant/queryList',
   };
-  const emit = defineEmits(['ok', 'close']);
+  const emit = defineEmits(['ok', 'close', 'success']);
+
+  //表单配置
+  const [registerForm, { setProps, resetFields, setFieldsValue, validate, updateSchema }] = useForm({
+    labelWidth: 90,
+    schemas: formSchema,
+    showActionButtonGroup: false,
+  });
+
+  const { createMessage } = useMessage();
 
   onBeforeMount(() => {
-    initTenantList();
     siteCode.value = localStorage.getItem('siteCode') ?? '';
     getTurnInquiryCode();
   });
 
-  function initTenantList() {
-    getAction(url.queryTenantList, {}).then((res) => {
-      if (res.success) {
-        tenantList = res.result;
-      }
-    });
-  }
-
-  //窗口最大化切换
-  function toggleScreen() {
-    if (modaltoggleFlag.value) {
-      modalWidth.value = window.innerWidth;
-    } else {
-      modalWidth.value = 800;
-    }
-    modaltoggleFlag.value = !modaltoggleFlag.value;
-  }
-
-  function initialRoleList() {
-    queryEnterpriseAll({ username: queryParam.username }).then((res) => {
-      if (res.success) {
-        roleList = res.result;
-      } else {
-        console.log(res.message);
-      }
-    });
-  }
-
-  function loadUserRoles(userid) {
-    queryUserRole({ userid: userid }).then((res) => {
-      if (res.success) {
-        selectedRole.value = res.result;
-      } else {
-        console.log(res.message);
-      }
-    });
-  }
-
   function refresh() {
-    selectedDepartKeys = [];
-    checkedDepartKeys = [];
-    checkedDepartNames = [];
     checkedDepartNameString.value = '';
     userId.value = '';
-    resultDepartOptions = [];
     departIdShow.value = false;
-    currentTenant = [];
   }
 
   function add() {
@@ -238,37 +89,16 @@
   function edit(record) {
     resetScreenSize(); // 调用此方法,根据屏幕宽度自适应调整抽屉的宽度
 
-    initialRoleList();
     checkedDepartNameString.value = '';
 
     if (record.hasOwnProperty('id')) {
-      loadUserRoles(record.id);
-      setTimeout(() => {
-        fileList = record.avatar;
-      }, 5);
+      setFieldsValue({
+        ...record,
+      });
     }
     userId.value = record.id;
-    model = Object.assign({}, record);
-    nextTick(() => {
-      // formRef.value.setFieldsValue(pick(model, 'username', 'sex', 'realname', 'email', 'phone', 'activitiSync', 'telephone', 'post'));
-    });
+
     visible.value = true;
-    //身份为上级显示负责部门,否则不显示
-    if (model.userIdentity == '2') {
-      identity.value = '2';
-      departIdShow.value = true;
-    } else {
-      identity.value = '1';
-      departIdShow.value = false;
-    }
-    // 调用查询用户对应的部门信息的方法
-    checkedDepartKeys = [];
-    //update-begin-author:taoyan date:2020710 for:多租户配置
-    if (!record.relTenantIds || record.relTenantIds.length == 0) {
-      currentTenant = [];
-    } else {
-      currentTenant = record.relTenantIds.split(',').map(Number);
-    }
   }
 
   function close() {
@@ -276,250 +106,56 @@
     visible.value = false;
     disableSubmit.value = false;
     selectedRole.value = [];
-    userDepartModel = { userId: '', departIdList: [] };
-    checkedDepartNames = [];
     checkedDepartNameString.value = '';
-    checkedDepartKeys = [];
-    selectedDepartKeys = [];
-    resultDepartOptions = [];
-    departIds = [];
     departIdShow.value = false;
     identity.value = '1';
-    fileList = [];
-  }
-
-  function handleSubmit() {
-    const that = this;
-    // 触发表单验证
-    form.validateFields((err, values) => {
-      if (!err) {
-        confirmLoading = true;
-        if (!values.birthday) {
-          values.birthday = '';
-        } else {
-          values.birthday = values.birthday.format(dateFormat);
-        }
-        let formData = Object.assign(model, values);
-        if (fileList != '') {
-          formData.avatar = fileList;
-        } else {
-          formData.avatar = null;
-        }
-        if (formData.email == '') {
-          formData.email = null;
-        }
-        //update-begin-author:taoyan date:2020710 for:多租户配置
-        formData.relTenantIds = currentTenant.length > 0 ? currentTenant.join(',') : '';
-        //update-end-author:taoyan date:2020710 for:多租户配置
-        formData.selectedroles = selectedRole.value.length > 0 ? selectedRole.value.join(',') : '';
-        formData.selecteddeparts = userDepartModel.departIdList.length > 0 ? userDepartModel.departIdList.join(',') : '';
-        formData.userIdentity = identity;
-        //如果是上级择传入departIds,否则为空
-        if (identity.value === '2') {
-          formData.departIds = departIds.join(',');
-        } else {
-          formData.departIds = '';
-        }
-        // addDepartsToUser(that,formData); // 调用根据当前用户添加部门信息的方法
-        let obj;
-        formData.masterId = store.getters.userInfo.id;
-        formData.masterName = store.getters.userInfo.username;
-        if (!model.id) {
-          formData.id = userId;
-          formData.siteCode = siteCode;
-          obj = addEnterpriseUser(formData);
-        } else {
-          formData.masterEmail = store.getters.userInfo.email;
-          formData.siteCode = siteCode;
-          obj = postAction('/enterprise/user/edit', formData);
-        }
-        obj
-          .then((res) => {
-            if (res.success) {
-              $message.success(res.message);
-              $emit('ok');
-              confirmLoading = false;
-              checkedDepartNames = [];
-              userDepartModel.departIdList = { userId: '', departIdList: [] };
-              close();
-            } else {
-              confirmLoading = false;
-              $message.warning(res.message);
-            }
-          })
-          .finally(() => {});
-      }
-    });
-  }
-
-  function handleCancel() {
-    close();
   }
-  function validateToNextPassword(rule, value, callback) {
-    const form = form;
-    const confirmpassword = form.getFieldValue('confirmpassword');
 
-    if (value && confirmpassword && value !== confirmpassword) {
-      callback('两次输入的密码不一样!');
-    }
-    if (value && confirmDirty) {
-      form.validateFields(['confirm'], { force: true });
-    }
-    callback();
-  }
+  async function handleSubmit() {
+    try {
+      let values = await validate();
+      confirmLoading.value = true;
+      values.userIdentity === 1 && (values.departIds = '');
 
-  function compareToFirstPassword(rule, value, callback) {
-    const form = form;
-    if (value && value !== form.getFieldValue('password')) {
-      callback('两次输入的密码不一样!');
-    } else {
-      callback();
-    }
-  }
+      let obj;
+      values.masterId = userStore.getUserInfo.id;
+      values.masterName = userStore.getUserInfo.username;
 
-  function validatePhone(rule, value, callback) {
-    if (!value) {
-      callback();
-    } else {
-      //update-begin--Author:kangxiaolin  Date:20190826 for:[05] 手机号不支持199号码段--------------------
-      if (new RegExp(/^1[3|4|5|7|8|9][0-9]\d{8}$/).test(value)) {
-        //update-end--Author:kangxiaolin  Date:20190826 for:[05] 手机号不支持199号码段--------------------
-
-        var params = {
-          tableName: 'sys_user',
-          fieldName: 'phone',
-          fieldVal: value,
-          dataId: userId,
-        };
-        duplicateCheck(params).then((res) => {
-          if (res.success) {
-            callback();
-          } else {
-            callback('手机号已存在!');
-          }
-        });
+      if (!values.id) {
+        values.siteCode = siteCode.value;
+        values.relTenantIds = getTenantId();
+        obj = postAction('/enterprise/user/add', values, 120000);
       } else {
-        callback('请输入正确格式的手机号码!');
+        values.masterEmail = userStore.getUserInfo.email;
+        values.siteCode = siteCode;
+        obj = postAction('/enterprise/user/edit', values, 120000);
       }
-    }
-  }
-
-  function validateEmail(rule, value, callback) {
-    if (!value) {
-      callback();
-    } else {
-      if (
-        new RegExp(
-          /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
-        ).test(value)
-      ) {
-        var params = {
-          tableName: 'sys_user',
-          fieldName: 'email',
-          fieldVal: value,
-          dataId: userId,
-        };
-        duplicateCheck(params).then((res) => {
-          console.log(res);
-          if (res.success) {
-            callback();
+      //提交表单
+      obj
+        .then((res) => {
+          if (res.code === 200) {
+            createMessage.success(res.message);
+            confirmLoading.value = false;
+            close();
+            emit('ok');
           } else {
-            callback('邮箱已存在!');
+            confirmLoading.value = false;
+            createMessage.warning(res.message);
           }
+        })
+        .finally(() => {
+          //关闭弹窗
+          close();
         });
-      } else {
-        callback('请输入正确格式的邮箱!');
-      }
+    } finally {
+      confirmLoading.value = false;
     }
   }
 
-  function validateUsername(rule, value, callback) {
-    var params = {
-      tableName: 'sys_user',
-      fieldName: 'username',
-      fieldVal: value,
-      dataId: userId,
-    };
-    duplicateCheck(params).then((res) => {
-      if (res.success) {
-        callback();
-      } else {
-        callback('用户名已存在!');
-      }
-    });
-  }
-
-  function handleConfirmBlur(e) {
-    const value = e.target.value;
-    confirmDirty.value = confirmDirty.value || !!value;
-  }
-
-  function normFile(e) {
-    console.log('Upload event:', e);
-    if (Array.isArray(e)) {
-      return e;
-    }
-    return e && e.fileList;
-  }
-
-  function beforeUpload(file) {
-    var fileType = file.type;
-    if (fileType.indexOf('image') < 0) {
-      $message.warning('请上传图片');
-      return false;
-    }
-    //TODO 验证文件大小
-  }
-
-  function handleChange(info) {
-    picUrl.value = '';
-    if (info.file.status === 'uploading') {
-      uploadLoading = true;
-      return;
-    }
-    if (info.file.status === 'done') {
-      var response = info.file.response;
-      uploadLoading = false;
-      console.log(response);
-      if (response.success) {
-        model.avatar = response.message;
-        picUrl.value = 'Has no pic url yet';
-      } else {
-        $message.warning(response.message);
-      }
-    }
-  }
-
-  // 搜索用户对应的部门API
-  function onSearch() {
-    $refs.enterpriseDepartWindow.add(checkedDepartKeys, userId);
+  function handleCancel() {
+    close();
   }
 
-  // 获取用户对应部门弹出框提交给返回的数据
-  function modalFormOk(formData) {
-    checkedDepartNames = [];
-    selectedDepartKeys = [];
-    checkedDepartNameString.value = '';
-    userId.value = formData.userId;
-    userDepartModel.userId = formData.userId;
-    departIds = [];
-    resultDepartOptions = [];
-    var depart = [];
-    for (let i = 0; i < formData.departIdList.length; i++) {
-      selectedDepartKeys.push(formData.departIdList[i].key);
-      checkedDepartNames.push(formData.departIdList[i].title);
-      checkedDepartNameString.value = checkedDepartNames.join(',');
-      //新增部门选择,如果上面部门选择后不为空直接付给负责部门
-      depart.push({
-        key: formData.departIdList[i].key,
-        title: formData.departIdList[i].title,
-      });
-      departIds.push(formData.departIdList[i].key);
-    }
-    resultDepartOptions = depart;
-    userDepartModel.departIdList = selectedDepartKeys;
-    checkedDepartKeys = selectedDepartKeys; //更新当前的选择keys
-  }
   // 根据屏幕变化,设置抽屉尺寸
   function resetScreenSize() {
     let screenWidth = document.body.clientWidth;
@@ -530,14 +166,6 @@
     }
   }
 
-  function identityChange(e) {
-    if (e.target.value === '1') {
-      departIdShow.value = false;
-    } else {
-      departIdShow.value = true;
-    }
-  }
-
   //获取需要轮流询盘的站点code
   function getTurnInquiryCode() {
     getAction('/adweb/adwebEnquiry/getTurnInquiryCode', {}).then((res) => {
@@ -549,6 +177,8 @@
 
   defineExpose({
     add,
+    edit,
+    disableSubmit,
     title,
   });
 </script>

+ 1 - 1
src/views/adweb/enterprise/modules/EnterpriseUserRecycleBinModal.vue

@@ -1,5 +1,5 @@
 <template>
-  <a-drawer :title="title" :mask-closable="true" :width="1000" placement="right" :closable="true" @close="handleCancel" :visible="visible">
+  <a-drawer :title="title" :mask-closable="true" :width="1000" placement="right" :closable="true" @close="handleCancel" v-model:open="visible">
     <a-table
       ref="table"
       size="middle"

+ 0 - 183
src/views/adweb/enterprise/modules/EnterpriseUserRoleModal.vue

@@ -1,183 +0,0 @@
-<template>
-  <a-drawer
-    :title="title"
-    :maskClosable="true"
-    width="650"
-    placement="right"
-    :closable="true"
-    @close="close"
-    :visible="visible"
-    style="overflow: auto; padding-bottom: 53px"
-  >
-    <a-form>
-      <a-form-item>
-        <a-tree
-          checkable
-          @check="onCheck"
-          :checkedKeys="checkedKeys"
-          :treeData="treeData"
-          @expand="onExpand"
-          @select="onTreeNodeSelect"
-          :selectedKeys="selectedKeys"
-          :expandedKeys="expandedKeysss"
-          :checkStrictly="checkStrictly"
-        >
-          <template #hasDatarule="{ slotTitle, ruleFlag }">
-            <span> {{ slotTitle }}<a-icon v-if="ruleFlag" type="align-left" style="margin-left: 5px; color: red" /> </span>
-          </template>
-        </a-tree>
-      </a-form-item>
-    </a-form>
-
-    <div class="drawer-bootom-button">
-      <a-dropdown style="float: left" :trigger="['click']" placement="topCenter">
-        <template #overlay>
-          <a-menu>
-            <!--          <a-menu-item key="1" @click="switchCheckStrictly(1)">父子关联</a-menu-item>-->
-            <!--          <a-menu-item key="2" @click="switchCheckStrictly(2)">取消关联</a-menu-item>-->
-            <a-menu-item key="3" @click="checkALL">全部勾选</a-menu-item>
-            <a-menu-item key="4" @click="cancelCheckALL">取消全选</a-menu-item>
-            <a-menu-item key="5" @click="expandAll">展开所有</a-menu-item>
-            <a-menu-item key="6" @click="closeAll">合并所有</a-menu-item>
-          </a-menu>
-        </template>
-        <a-button> 快捷操作 <a-icon type="up" /> </a-button>
-      </a-dropdown>
-      <a-button style="margin-right: 0.8rem" @click="close">取消</a-button>
-      <!--      <a-button @click="handleSubmit(false)" type="primary" :loading="loading" ghost style="margin-right: 0.8rem">仅保存</a-button>-->
-      <a-button @click="handleSubmit" type="primary" :loading="loading">保存</a-button>
-    </div>
-  </a-drawer>
-</template>
-
-<script>
-  import { getAction, postAction } from '@/api/manage/manage';
-
-  export default {
-    name: 'EnterpriseUserRoleModal',
-    components: {},
-    data() {
-      return {
-        userId: '',
-        treeData: [],
-        defaultCheckedKeys: [],
-        checkedKeys: [],
-        expandedKeysss: [],
-        allTreeKeys: [],
-        autoExpandParent: true,
-        checkStrictly: false,
-        title: '菜单权限配置',
-        visible: false,
-        loading: false,
-        selectedKeys: [],
-      };
-    },
-    watch: {
-      visible() {
-        if (this.visible) {
-          this.loadData();
-        }
-      },
-    },
-    methods: {
-      onTreeNodeSelect(id) {
-        if (id && id.length > 0) {
-          this.selectedKeys = id;
-        }
-      },
-      onCheck(o) {
-        if (this.checkStrictly) {
-          this.checkedKeys = o.checked;
-        } else {
-          this.checkedKeys = o;
-        }
-      },
-      show(userId) {
-        this.userId = userId;
-        this.visible = true;
-      },
-      close() {
-        this.reset();
-        this.$emit('close');
-        this.visible = false;
-      },
-      onExpand(expandedKeys) {
-        this.expandedKeysss = expandedKeys;
-        this.autoExpandParent = false;
-      },
-      reset() {
-        this.expandedKeysss = [];
-        this.checkedKeys = [];
-        this.defaultCheckedKeys = [];
-        this.loading = false;
-      },
-      expandAll() {
-        this.expandedKeysss = this.allTreeKeys;
-      },
-      closeAll() {
-        this.expandedKeysss = [];
-      },
-      checkALL() {
-        this.checkedKeys = this.allTreeKeys;
-      },
-      cancelCheckALL() {
-        //this.checkedKeys = this.defaultCheckedKeys
-        this.checkedKeys = [];
-      },
-      // switchCheckStrictly(v) {
-      //   if (v == 1) {
-      //     this.checkStrictly = false
-      //   } else if (v == 2) {
-      //     this.checkStrictly = true
-      //   }
-      // },
-      handleCancel() {
-        this.close();
-      },
-      handleSubmit() {
-        let that = this;
-        let params = {
-          userId: that.userId,
-          permissionIds: that.checkedKeys.join(','),
-        };
-        that.loading = true;
-        console.log('请求参数:', params);
-        postAction('/enterprise/user/saveRolePermission', params).then((res) => {
-          if (res.success) {
-            that.$message.success(res.message);
-          } else {
-            that.$message.error(res.message);
-          }
-          that.loading = false;
-          that.close();
-          this.loadData();
-        });
-      },
-      loadData() {
-        getAction('/enterprise/user/queryTreeList').then((res) => {
-          this.treeData = res.result.treeList;
-          this.allTreeKeys = res.result.ids;
-          getAction('/enterprise/user/queryRolePermission', { userId: this.userId }).then((res) => {
-            this.checkedKeys = [...res.result];
-            this.defaultCheckedKeys = [...res.result];
-            this.expandedKeysss = this.allTreeKeys;
-            console.log(this.defaultCheckedKeys);
-          });
-        });
-      },
-    },
-  };
-</script>
-<style lang="less" scoped>
-  .drawer-bootom-button {
-    position: absolute;
-    bottom: 0;
-    width: 100%;
-    border-top: 1px solid #e8e8e8;
-    padding: 10px 16px;
-    text-align: right;
-    left: 0;
-    background: #fff;
-    border-radius: 0 0 2px 2px;
-  }
-</style>

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff