Jelajahi Sumber

询盘通知

chenlei1231 4 bulan lalu
induk
melakukan
04a48be7ee

+ 2 - 2
src/api/manage/manage.ts

@@ -47,12 +47,12 @@ export function postAction3(url, parameter) {
   });
 }
 
-export function postActionForm(url, parameter) {
+export function postActionForm(url, parameter, timeout: 120000) {
   return defHttp.post(
     {
       url: url,
       params: parameter,
-      timeout: 1000 * 120,
+      timeout: timeout,
       headers: {
         'Content-Type': 'multipart/form-data',
       },

+ 1 - 1
src/components/Adweb/selectSite.vue

@@ -62,7 +62,7 @@
     (newValue, oldValue) => {
       emit('setSiteInfo', selectSiteInfo); // 触发父方法
     },
-    { immediate: true, deep: true }
+    { immediate: false, deep: true }
   );
 
   //进入获取站点code

+ 13 - 11
src/layouts/default/header/components/notify/index.vue

@@ -7,7 +7,7 @@
     <DynamicNotice ref="dynamicNoticeRef" v-bind="dynamicNoticeProps" />
     <DetailModal @register="registerDetail" />
 
-    <sys-message-modal @register="registerMessageModal" @refresh="reloadCount"></sys-message-modal>
+    <sys-message-modal @register="registerMessageModal" @refresh="reloadCount" />
   </div>
 </template>
 <script lang="ts">
@@ -28,7 +28,7 @@
   import { getToken } from '/@/utils/auth';
   import md5 from 'crypto-js/md5';
 
-  import SysMessageModal from '/@/views/system/message/components/SysMessageModal.vue'
+  import SysMessageModal from '/@/views/system/message/components/SysMessageModal.vue';
 
   export default defineComponent({
     components: {
@@ -59,17 +59,17 @@
       });
 
       const [registerMessageModal, { openModal: openMessageModal }] = useModal();
-      function clickBadge(){
+      function clickBadge() {
         //消息列表弹窗前去除角标
         for (let i = 0; i < listData.value.length; i++) {
           listData.value[i].count = 0;
         }
-        openMessageModal(true, {})
+        openMessageModal(true, {});
       }
 
       const popoverVisible = ref<boolean>(false);
       onMounted(() => {
-       initWebSocket();
+        initWebSocket();
       });
 
       function mapAnnouncement(item) {
@@ -123,20 +123,24 @@
         let token = getToken();
         //将登录token生成一个短的标识
         let wsClientId = md5(token);
-        let userId = unref(userStore.getUserInfo).id + "_" + wsClientId;
+        let userId = unref(userStore.getUserInfo).id + '_' + wsClientId;
         // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
         let url = glob.domainUrl?.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId;
         connectWebSocket(url);
         onWebSocket(onWebSocketMessage);
+
+        console.log(12312312);
       }
 
       function onWebSocketMessage(data) {
+        console.log(data, 'datadatadatadata');
+
         if (data.cmd === 'topic' || data.cmd === 'user') {
           //update-begin-author:taoyan date:2022-7-13 for: VUEN-1674【严重bug】系统通知,为什么必须刷新右上角才提示
           //后台保存数据太慢 前端延迟刷新消息
-          setTimeout(()=>{
+          setTimeout(() => {
             loadData();
-          }, 1000)
+          }, 1000);
           //update-end-author:taoyan date:2022-7-13 for: VUEN-1674【严重bug】系统通知,为什么必须刷新右上角才提示
         }
       }
@@ -146,7 +150,7 @@
         popoverVisible.value = false;
         readAllMsg({}, loadData);
       }
-      async function reloadCount(id){
+      async function reloadCount(id) {
         try {
           await editCementSend(id);
           await loadData();
@@ -193,7 +197,6 @@
       .ant-list-item {
         padding: 12px 24px;
         transition: background-color 300ms;
-
       }
 
       .bottom-buttons {
@@ -264,5 +267,4 @@
       }
     }
   }
-
 </style>

+ 1 - 30
src/views/adweb/enquiry/AdwebEnquiryList.vue

@@ -381,7 +381,6 @@
   onMounted(async () => {
     userRole.value = useUserStore().roleList;
     getEffectiveList();
-    initWebSocket();
   });
 
   function getSiteList(selectedSiteInfo: any) {
@@ -646,7 +645,7 @@
   //拒收
   function enquiryAddBlackList(record) {
     delete record.wasteEnquiry;
-    postAction('/enquiry/blacklist/addBlacklist', record).then((res) => {
+    postAction('/enquiry/blacklist/addBlacklist', record, null).then((res) => {
       if (res.success) {
         createMessage.success(`拒收成功!`);
         this.getTableAndNum();
@@ -835,34 +834,6 @@
     //刷新数据
     reload();
   }
-
-  const glob = useGlobSetting();
-  const userStore = useUserStore();
-
-  // 初始化 WebSocket
-  function initWebSocket() {
-    let token = getToken();
-    //将登录token生成一个短的标识
-    let wsClientId = md5(token);
-    let userId = unref(userStore.getUserInfo).id + '_' + wsClientId;
-    // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
-    let url = glob.domainUrl?.replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId;
-
-    connectWebSocket(url);
-    onWebSocket(onWebSocketMessage);
-  }
-
-  function onWebSocketMessage(data) {
-    console.log(data, 'websorket');
-    if (data.cmd === 'topic' || data.cmd === 'user') {
-      //update-begin-author:taoyan date:2022-7-13 for: VUEN-1674【严重bug】系统通知,为什么必须刷新右上角才提示
-      //后台保存数据太慢 前端延迟刷新消息
-      setTimeout(() => {
-        loadData();
-      }, 1000);
-      //update-end-author:taoyan date:2022-7-13 for: VUEN-1674【严重bug】系统通知,为什么必须刷新右上角才提示
-    }
-  }
 </script>
 
 <style lang="less" scoped>

+ 629 - 739
src/views/adweb/enquiry/AdwebWasteEnquiryList.vue

@@ -1,11 +1,10 @@
 <template>
   <div class="p-2">
-
     <a-row class="r1" :gutter="8">
       <a-col :xl="7" :xxl="6">
         <div class="choose-site">
           <span class="t1">站点:</span>
-          <select-site ref="selectSiteRef" @com-methods="changeSite" @set-site-info="getSiteList" />
+          <select-site ref="selectSiteRef" @set-site-info="getSiteList" />
         </div>
       </a-col>
       <a-col :xl="8" :xxl="6">
@@ -25,71 +24,40 @@
 
     <a-row class="r3" type="flex" :gutter="8">
       <a-col flex="2">
-        <a-input placeholder="邮箱/姓名/国家" v-model:value="queryParam.searchText"></a-input>
+        <a-input placeholder="邮箱/姓名/国家" v-model:value="queryParam.searchText" />
       </a-col>
 
       <a-col flex="2">
-        <a-select v-model="queryParam.readStatus"
-                  :allowClear="true"
-                  placeholder="全部阅读状态"
-                  style="width: 100%"
-                  @change="filterStatus"
-        >
-          <a-select-option value="0">
-            未读
-          </a-select-option>
-          <a-select-option value="1">
-            已读
-          </a-select-option>
+        <a-select v-model="queryParam.readStatus" :allowClear="true" placeholder="全部阅读状态" style="width: 100%" @change="filterStatus">
+          <a-select-option value="0"> 未读 </a-select-option>
+          <a-select-option value="1"> 已读 </a-select-option>
         </a-select>
       </a-col>
 
-      <a-col  flex="2">
-        <a-select v-model:value="queryParam.wasteEnquiryType"
-                  :allowClear="true"
-                  placeholder="垃圾询盘类型"
-                  style="width: 100%"
-        >
-          <a-select-option value="keyword">
-            关键词
-          </a-select-option>
-          <a-select-option value="email">
-            邮箱
-          </a-select-option>
-          <a-select-option value="ip">
-            ip
-          </a-select-option>
-          <a-select-option value="other">
-            其他
-          </a-select-option>
+      <a-col flex="2">
+        <a-select v-model:value="queryParam.wasteEnquiryType" :allowClear="true" placeholder="垃圾询盘类型" style="width: 100%">
+          <a-select-option value="keyword"> 关键词 </a-select-option>
+          <a-select-option value="email"> 邮箱 </a-select-option>
+          <a-select-option value="ip"> ip </a-select-option>
+          <a-select-option value="other"> 其他 </a-select-option>
         </a-select>
       </a-col>
 
       <a-col v-if="haveSubAccount" flex="2">
-        <a-select placeholder="全部跟进人"
-                  v-model="queryParam.principalUid"
-                  showSearch
-                  allowClear
-                  style="width: 100%"
-                  :filterOption="filterOption">
+        <a-select placeholder="全部跟进人" v-model="queryParam.principalUid" showSearch allowClear style="width: 100%" :filterOption="filterOption">
           <a-select-option key="ALL" value="ALL">所有人</a-select-option>
-          <a-select-option v-for="principal in subAccountOptions" :key="principal.id"
-                           :value="principal.id">
+          <a-select-option v-for="principal in subAccountOptions" :key="principal.id" :value="principal.id">
             {{ principal.username }}
           </a-select-option>
         </a-select>
       </a-col>
 
-      <a-col flex="500px" style="text-align:right">
+      <a-col flex="500px" style="text-align: right">
         <a-button type="primary" @click="searchQuery">查询</a-button>
         <a-button ghost type="primary" @click="searchReset" style="margin-left: 8px">重置</a-button>
-        <a-button ghost type="primary" @click="handleExportXlsLU()"
-                  style="margin-left: 8px" :loading="excelLoading">导出Excel
-        </a-button>
-        <a-button ghost type="primary" @click="recycleBinVisible" style="margin-left: 8px">回收站
-        </a-button>
-        <a-button ghost type="primary" @click="showBlackList" style="margin-left: 8px">黑名单
-        </a-button>
+        <a-button ghost type="primary" @click="handleExportXlsLU()" style="margin-left: 8px" :loading="excelLoading">导出Excel </a-button>
+        <a-button ghost type="primary" @click="recycleBinVisible" style="margin-left: 8px">回收站 </a-button>
+        <a-button ghost type="primary" @click="showBlackList" style="margin-left: 8px">黑名单 </a-button>
       </a-col>
     </a-row>
 
@@ -115,15 +83,9 @@
 
       <!-- 操作动作  -->
       <template #action="{ record }">
-
-        <div  style="padding: 5px 8px;display: flex;justify-content: space-around;">
-          <a-tag v-if="isForwardSite" color="blue" @click="forwardDetail(record)"
-                 style="cursor:pointer;">
-            转发
-          </a-tag>
-          <a-tag color="purple" @click="showEnquiryDetail(record)" style="cursor:pointer;">
-            详情
-          </a-tag>
+        <div style="padding: 5px 8px; display: flex; justify-content: space-around">
+          <a-tag v-if="isForwardSite" color="blue" @click="forwardDetail(record)" style="cursor: pointer"> 转发 </a-tag>
+          <a-tag color="purple" @click="showEnquiryDetail(record)" style="cursor: pointer"> 详情 </a-tag>
           <a-popconfirm
             title="确认拒收后,该用户会归入【黑名单】,后期不再接收该用户的询盘信息~"
             ok-text="是"
@@ -131,24 +93,21 @@
             placement="topRight"
             @confirm="enquiryAddBlackList(record)"
           >
-            <a-tag color="orange" style="cursor:pointer;">
-              拒收
-            </a-tag>
+            <a-tag color="orange" style="cursor: pointer"> 拒收 </a-tag>
           </a-popconfirm>
-          <a-tag color="green" @click="showEnquiryTrackRecord(record)" style="cursor:pointer;">
-            跟踪
-          </a-tag>
-          <a-tag color="blue"
-                 v-if='record.visitId !== null && record.visitId !== "" && record.visitId !== undefined'
-                 style="cursor:pointer;" @click="enquiryTrack(record)">
+          <a-tag color="green" @click="showEnquiryTrackRecord(record)" style="cursor: pointer"> 跟踪 </a-tag>
+          <a-tag
+            color="blue"
+            v-if="record.visitId !== null && record.visitId !== '' && record.visitId !== undefined"
+            style="cursor: pointer"
+            @click="enquiryTrack(record)"
+          >
             访问记录
           </a-tag>
         </div>
-
       </template>
 
       <template #bodyCell="{ column, record, index, text }">
-
         <!-- 自定义显示字段       -->
 
         <!-- 询盘状态 -->
@@ -156,7 +115,6 @@
           <a class="theme-color" v-if="text === 2" @click="showEnquiryDetail(record)">{{ record.userEffectiveStr }}</a>
           <span v-else-if="text == 0" style="color: #fa8c16">{{ record.userEffectiveStr }}</span>
           <span v-else>{{ record.userEffectiveStr }}</span>
-
         </template>
         <!-- 阅读状态 -->
         <template v-if="column.key == 'readStatus'">
@@ -165,8 +123,7 @@
         </template>
         <!-- 询盘详情 -->
         <div v-if="column.key == 'details'">
-          <a @click="showEnquiryDetail(record)" style="margin: 0 10px 0 10px">
-            {{record.context ? record.context.substr(0, 50) : '--'}}</a>
+          <a @click="showEnquiryDetail(record)" style="margin: 0 10px 0 10px"> {{ record.context ? record.context.substr(0, 50) : '--' }}</a>
         </div>
         <!-- 来源页面 -->
 
@@ -175,810 +132,743 @@
           <template v-else-if="text.indexOf('http') < 0">-</template>
           <template v-else-if="text.indexOf('http') === 0">
             <template v-if="text.lastIndexOf('/') <= 7">
-              <a :href="text" target="_blank"
-                 style="text-decoration: underline">Home</a>
+              <a :href="text" target="_blank" style="text-decoration: underline">Home</a>
             </template>
             <template v-else>
-              <a :href="text" target="_blank"
-                 style="text-decoration: underline">{{
-                  text.substring(text.lastIndexOf('/') + 1).slice(0, 45) + (text.substring(text.lastIndexOf('/') + 1).length > 45 ? "..." : "")
-                }}</a>
+              <a :href="text" target="_blank" style="text-decoration: underline">{{
+                text.substring(text.lastIndexOf('/') + 1).slice(0, 45) + (text.substring(text.lastIndexOf('/') + 1).length > 45 ? '...' : '')
+              }}</a>
             </template>
           </template>
           <template v-else-if="text.indexOf('http') > 0">
-            <a :href="text.substring(text.indexOf('http'))" target="_blank"
-               style="text-decoration: underline">{{
-                text.substring(0, text.indexOf('http')).slice(0, 45) + (text.substring(0, text.indexOf('http')).length > 45 ? "..." : "")
-              }}</a>
+            <a :href="text.substring(text.indexOf('http'))" target="_blank" style="text-decoration: underline">{{
+              text.substring(0, text.indexOf('http')).slice(0, 45) + (text.substring(0, text.indexOf('http')).length > 45 ? '...' : '')
+            }}</a>
           </template>
           <template v-else>-</template>
         </template>
         <!-- 邮箱 -->
-        <div  v-if="column.key == 'fromEmail'">
+        <div v-if="column.key == 'fromEmail'">
           <a-popover>
-            <template slot="content">
+            <template #content>
               {{ text }}
             </template>
-            <a @click.prevent="copyEmailFunction(text)" :href="'mailto:'+text"
-               v-if="text">{{ text.slice(0, 30) + (text.length > 30 ? "..." : "") }}</a>
+            <a @click.prevent="copyEmailFunction(text)" :href="'mailto:' + text" v-if="text">{{
+              text.slice(0, 30) + (text.length > 30 ? '...' : '')
+            }}</a>
             <div v-else>--</div>
           </a-popover>
         </div>
 
-        <template  v-if="column.key == 'wasteEnquiryType'">
+        <template v-if="column.key == 'wasteEnquiryType'">
           <a-tag v-if="text == 'keyword'" color="#2db7f5">关键词</a-tag>
           <a-tag v-if="text == 'email'" color="#108ee9">邮箱</a-tag>
           <a-tag v-if="text == 'ip'" color="#3D59AB">IP</a-tag>
           <a-tag v-if="text == 'other'" color="#87CEEB">其他</a-tag>
-          <span v-if="text == '' || text == null" >-</span>
+          <span v-if="text == '' || text == null">-</span>
         </template>
-
       </template>
     </BasicTable>
     <!-- 表单区域 -->
     <AdwebEnquiryModal ref="registerModal" @success="handleSuccess" />
 
     <!--回收站-->
-    <xp-recycle-bin-modal ref="XpRecycleBinModalRef" @ok="getTableAndNum"/>
+    <xp-recycle-bin-modal ref="XpRecycleBinModalRef" @ok="getTableAndNum" />
 
     <!--询盘详情   reload用于子组件删除询盘功能刷新父组件table showDelBtn用于展示删除按钮-->
-    <enquiry-detail :userEffectiveOption="userEffectiveOption" :showDelBtn="true"
-                    @reload="getTableAndNum()" @ok="getTableAndNum"
-                    ref="enquiryDetailRef"></enquiry-detail>
+    <enquiry-detail
+      :userEffectiveOption="userEffectiveOption"
+      :showDelBtn="true"
+      @reload="getTableAndNum()"
+      @ok="getTableAndNum"
+      ref="enquiryDetailRef"
+    />
 
     <!-- 转发询盘 -->
-    <a-modal
-      title="转发"
-      :visible="forwardVisible"
-      @ok="editForward"
-      @cancel="cancelEditForward"
-      :confirm-loading="forwardLoading"
-    >
+    <a-modal title="转发" :visible="forwardVisible" @ok="editForward" @cancel="cancelEditForward" :confirm-loading="forwardLoading">
       <a-radio-group v-model:value="selectedUserId">
-        <a-radio v-for="item in subAccountOptions" style="display: block; height: 30px; lineHeight: 30px;" :value="item.id">
+        <a-radio v-for="item in subAccountOptions" style="display: block; height: 30px; lineheight: 30px" :value="item.id">
           {{ item.username }}
         </a-radio>
       </a-radio-group>
     </a-modal>
 
     <!--黑名单-->
-    <black-list ref="blackListRef" @ok="getTableAndNum"></black-list>
+    <black-list ref="blackListRef" @ok="getTableAndNum" />
 
     <!--跟踪记录-->
-    <enquiry-track-record ref="enquiryTrackRecordRef"></enquiry-track-record>
+    <enquiry-track-record ref="enquiryTrackRecordRef" />
   </div>
 </template>
 
 <script lang="ts" name="adweb-adwebWasteEnquiry" setup>
+  import selectSite from '@/components/Adweb/selectSite.vue';
+  import { nextTick, onBeforeMount, onMounted, reactive, ref } from 'vue';
+  import { BasicTable } from '/@/components/Table';
+  import { useListPage } from '/@/hooks/system/useListPage';
+  import { wasteColumns, superQuerySchema } from './AdwebEnquiry.data';
+  import { batchDelete, deleteOne, getExportUrl, getImportUrl, list } from './AdwebEnquiry.api';
+  import AdwebEnquiryModal from './components/AdwebEnquiryModal.vue';
+  import { useUserStore } from '/@/store/modules/user';
+  import { getAction, postAction } from '@/api/manage/manage';
+
+  import { useMessage } from '@/hooks/web/useMessage';
+
+  import moment from 'moment';
+  import { any } from 'vue-types';
+  import { filterOption } from 'ant-design-vue/es/vc-mentions/src/util';
+  import enquiryDetail from '@/views/adweb/enquiry/modules/enquiryDetail.vue';
+  import XpRecycleBinModal from '@/views/adweb/system/modules/XpRecycleBinModal.vue';
+  import blackList from '@/views/adweb/enquiry/modules/blackList.vue';
+  import enquiryTrackRecord from '@/views/adweb/enquiry/modules/enquiryTrackRecord.vue';
+
+  const formRef = ref();
+  const queryParam = reactive<any>({});
+  const toggleSearchStatus = ref<boolean>(false);
+  const registerModal = ref();
+  const selectSiteRef = ref(null);
+  const { createMessage } = useMessage();
+  //注册table数据
+  const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
+    tableProps: {
+      title: '询盘信息存储表单',
+      api: list,
+      columns: wasteColumns,
+      canResize: false,
+      useSearchForm: false,
+      actionColumn: {
+        width: 180,
+        fixed: 'right',
+      },
+      striped: true,
+      bordered: false,
+      immediate: false, // 不直接触发,通过reload事件触发接口
+      beforeFetch: (params) => {
+        //  如果查询条件中没有设置状态,则默认查出所有状态数据
+        if (queryParam.userEffective == undefined) {
+          queryParam.userEffective = '0';
+        }
 
-import selectSite from '@/components/Adweb/selectSite.vue';
-import {nextTick, onBeforeMount, onMounted, reactive, ref} from 'vue';
-import {BasicTable} from '/@/components/Table';
-import {useListPage} from '/@/hooks/system/useListPage';
-import {wasteColumns, superQuerySchema} from './AdwebEnquiry.data';
-import {batchDelete, deleteOne, getExportUrl, getImportUrl, list} from './AdwebEnquiry.api';
-import AdwebEnquiryModal from './components/AdwebEnquiryModal.vue';
-import {useUserStore} from '/@/store/modules/user';
-import {getAction, postAction} from '@/api/manage/manage';
-
-import {useMessage} from '@/hooks/web/useMessage';
-
-import moment from 'moment';
-import {any} from "vue-types";
-import {filterOption} from "ant-design-vue/es/vc-mentions/src/util";
-import enquiryDetail from "@/views/adweb/enquiry/modules/enquiryDetail.vue";
-import XpRecycleBinModal from "@/views/adweb/system/modules/XpRecycleBinModal.vue";
-import blackList from "@/views/adweb/enquiry/modules/blackList.vue";
-import enquiryTrackRecord from "@/views/adweb/enquiry/modules/enquiryTrackRecord.vue";
-
-const formRef = ref();
-const queryParam = reactive<any>({});
-const toggleSearchStatus = ref<boolean>(false);
-const registerModal = ref();
-const selectSiteRef = ref(null);
-const { createMessage } = useMessage();
-//注册table数据
-const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
-  tableProps: {
-    title: '询盘信息存储表单',
-    api: list,
-    columns: wasteColumns,
-    canResize: false,
-    useSearchForm: false,
-    actionColumn: {
-      width: 180,
-      fixed: 'right',
+        return Object.assign(params, queryParam);
+      },
     },
-    striped: true,
-    bordered: false,
-    immediate: false, // 不直接触发,通过reload事件触发接口
-    beforeFetch: (params) => {
-
-      //  如果查询条件中没有设置状态,则默认查出所有状态数据
-      if (queryParam.userEffective == undefined) {
-        queryParam.userEffective = '0';
-      }
-
-      return Object.assign(params, queryParam);
+    exportConfig: {
+      name: '垃圾询盘列表',
+      url: getExportUrl,
+      params: queryParam,
     },
-  },
-  exportConfig: {
-    name: '询盘列表',
-    url: getExportUrl,
-    params: queryParam,
-  },
-  importConfig: {
-    url: getImportUrl,
-    success: handleSuccess,
-  },
-});
-const [registerTable, { reload, clearSelectedRowKeys, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
-
-// const labelCol = reactive({
-//   xs: 24,
-//   sm: 4,
-//   xl: 6,
-//   xxl: 4,
-// });
-// const wrapperCol = reactive({
-//   xs: 24,
-//   sm: 20,
-// });
-//
-// let siteCode: string | null = ref('');
-
-// 站点列表
-let siteList = ref([{'id': '', 'code': ''}]);
-
-// 询盘数量
-const enquiryNums = ref({
-  all: 0,
-  noRead: 0,
-  product: 0,
-  wait: 0,
-});
-
-// 过滤日期范围
-let rangeDate = ref<any>(any);
-
-// 子账号列表
-let subAccountOptions = ref([{'id': '', 'username': ''}]);
-
-// 是否有子账户
-let haveSubAccount = ref(false);
-
-// 导出excel进度
-let excelLoading = ref<boolean>(false);
-
-// 编辑转发进度
-let forwardLoading = ref<boolean>(false);
-
-// 选中跟进人
-let selectedUserId = ref<any>(undefined);
-
-let userEffectiveOption = ref<[]>([]);
-
-// 当前用户角色
-const userRole = ref('');
-
-// 已经选择的站点code
-const siteCode = ref<any>('');
-
-const isForwardSite = ref<boolean>(false);
-
-//转发的询盘id
-const forwardEnquiryDetail = ref<any>(undefined);
-
-//转发是否可见
-const forwardVisible = ref(false);
-
-// 询盘详情子组件
-const enquiryDetailRef = ref(null);
-
-// 回收站子组件
-const XpRecycleBinModalRef = ref(null);
-
-// 黑名单子组件
-const blackListRef = ref(null);
-
-// 跟踪记录
-const enquiryTrackRecordRef = ref(null);
-
-onBeforeMount(() => {
-  siteCode.value = localStorage.getItem('siteCode');
-  getTurnInquiryCode();
-});
-
-onMounted(async () => {
-  userRole.value = useUserStore().roleList;
-  getEffectiveList();
-});
-
-function getSiteList(siteInfo: any[], selectedSiteInfo: any) {
-  siteList.value = siteInfo;
-
-  if (siteList.value.length === 1) {
-    queryParam.siteId = siteList.value[0].id;
-  } else {
-    let isInSite = false;
-    for (let index in siteList.value) {
-
-      if (localStorage.getItem('siteCode') !== null && siteList.value[index].code === localStorage.getItem('siteCode')) {
-        isInSite = true;
-        queryParam.siteId = siteList.value[index].id
-      }
-    }
+    importConfig: {
+      url: getImportUrl,
+      success: handleSuccess,
+    },
+  });
+  const [
+    registerTable,
+    { reload, clearSelectedRowKeys, updateTableDataRecord, findTableDataRecord, getDataSource },
+    { rowSelection, selectedRowKeys },
+  ] = tableContext;
+
+  // const labelCol = reactive({
+  //   xs: 24,
+  //   sm: 4,
+  //   xl: 6,
+  //   xxl: 4,
+  // });
+  // const wrapperCol = reactive({
+  //   xs: 24,
+  //   sm: 20,
+  // });
+  //
+  // let siteCode: string | null = ref('');
+
+  // 站点列表
+  let siteList = ref([{ id: '', code: '' }]);
+
+  // 询盘数量
+  const enquiryNums = ref({
+    all: 0,
+    noRead: 0,
+    product: 0,
+    wait: 0,
+  });
 
-    if (localStorage.getItem('siteCode') == null || !isInSite) {
-      queryParam.siteId = siteList.value[0].id;
-      localStorage.setItem('siteCode', siteList.value[0].code);
-    }
-  }
+  // 过滤日期范围
+  let rangeDate = ref<any>(any);
 
-  getTableAndNumWithQueryCondition();
-}
+  // 子账号列表
+  let subAccountOptions = ref([{ id: '', username: '' }]);
 
-//重新刷新页面数据及获取询盘数量,不清除查询条件
-function getTableAndNumWithQueryCondition() {
-  getEnquiryNums();
-  getSubAccountOptions();
-  loadData();
-}
+  // 是否有子账户
+  let haveSubAccount = ref(false);
 
-//切换站点
-function changeSite(value, e) {
-  queryParam.siteId = e.info.id;
-  siteCode.value = localStorage.getItem('siteCode');
-  getTableAndNum(true);
-}
+  // 导出excel进度
+  let excelLoading = ref<boolean>(false);
 
-function filterCategory(value: string) {
-  queryParam.userEffective = value;
-}
+  // 编辑转发进度
+  let forwardLoading = ref<boolean>(false);
 
-function filterStatus(value: number) {
-  queryParam.readStatus = value;
-}
+  // 选中跟进人
+  let selectedUserId = ref<any>(undefined);
 
-//重新刷新页面数据及获取询盘数量
-function getTableAndNum(clearParam: boolean = false) {
-  // 设置默认站点
-  let siteId = queryParam.siteId;
+  let userEffectiveOption = ref<[]>([]);
 
-  for (let site of siteList.value) {
-    if (site.id === siteId) {
-      localStorage.setItem('siteCode', site.code);
-    }
-  }
+  // 当前用户角色
+  const userRole = ref('');
 
-  getEnquiryNums();
-  getSubAccountOptions();
-  if (clearParam) {
-    if (queryParam.readStatus) {
-      delete queryParam.readStatus;
-    }
-    if (queryParam.searchText) {
-      delete queryParam.searchText;
-    }
-    if (queryParam.searchContent) {
-      delete queryParam.searchContent;
-    }
-    if (queryParam.userEffective) {
-      delete queryParam.userEffective;
-    }
-    if (queryParam.principalUid) {
-      delete queryParam.principalUid;
-    }
-  }
+  // 已经选择的站点code
+  const siteCode = ref<any>('');
 
-  // queryParam.fields = 'id,,siteName,contact,fromEmail,whatsApp,phone,fromIp,readStatus,details,principalUid,fromPage,userEffective,countryName,pluginName,recordCtime,action';
-  // queryParam.userEffective = '1,2';
-  loadData();
-}
-
-//搜索条件部分的逻辑
-function onChangeDatePciker(date, dateString) {
-  if (dateString.length > 0) {
-    rangeDate.value = date;
-    queryParam.start = dateString[0];
-    queryParam.end = dateString[1];
-    queryParam.dateType = undefined;
-  }
-}
-
-//日期选择只能今天之前
-function disabledDate(current) {
-  return current && current > moment().endOf('day');
-}
-
-//设置列表的时间查询条件
-function setTime(time) {
-  queryParam.dateType = time;
-  queryParam.start = '';
-  queryParam.end = '';
-  // sevenDay   thirtyDay  today  yesterday
-  if (time == '') {
-    rangeDate.value = undefined;
-  } else if (time == 'sevenDay') {
-    rangeDate.value = [moment().subtract(6, 'days'), moment()];
-  } else if (time == 'thirtyDay') {
-    rangeDate.value = [moment().subtract(29, 'days'), moment()];
-  } else if (time == 'today') {
-    rangeDate.value = [moment(), moment()];
-  } else if (time == 'yesterday') {
-    rangeDate.value = [moment().subtract(1, 'days'), moment().subtract(1, 'days')];
-  }
-  getTableAndNum();
-}
-
-//获取不同状态询盘的数量
-function getEnquiryNums() {
-  let siteId = '';
-
-  if (queryParam.siteId && queryParam.siteId != '') {
-    siteId = queryParam.siteId;
-  } else {
-    siteId = '';
-  }
-  let d = {
-    siteId: siteId,
-    dateType: queryParam.dateType,
-    start: queryParam.start,
-    end: queryParam.end,
-  };
-  getAction('/adweb/adwebEnquiry/getEnquiryNums', d).then((res) => {
-
-    if (res.code == 200) {
-      enquiryNums.value.all = res.result.all;
-      enquiryNums.value.noRead = res.result.noRead;
-      enquiryNums.value.product = res.result.product;
-      enquiryNums.value.wait =res.result.wait;
-    } else {
-      enquiryNums.value.all = 0;
-      enquiryNums.value.noRead = 0;
-      enquiryNums.value.product = 0;
-      enquiryNums.value.wait = 0;
-    }
+  const isForwardSite = ref<boolean>(false);
+
+  //转发的询盘id
+  const forwardEnquiryDetail = ref<any>(undefined);
+
+  //转发是否可见
+  const forwardVisible = ref(false);
+
+  // 询盘详情子组件
+  const enquiryDetailRef = ref();
+
+  // 回收站子组件
+  const XpRecycleBinModalRef = ref();
+
+  // 黑名单子组件
+  const blackListRef = ref();
+
+  // 跟踪记录
+  const enquiryTrackRecordRef = ref();
+
+  onBeforeMount(() => {
+    siteCode.value = localStorage.getItem('siteCode');
+    getTurnInquiryCode();
   });
-}
-
-// 获取子账户的下拉框选项
-function getSubAccountOptions() {
-  getAction('/usercountry/subAccounts/options?siteId=' + queryParam.siteId, null).then((res) => {
-    if (res.code === 200) {
-      subAccountOptions.value = res.result;
-      haveSubAccount.value =  res.result !== null &&  res.result !== undefined &&  res.result.length > 0;
-    }
+
+  onMounted(async () => {
+    userRole.value = useUserStore().roleList;
+    getEffectiveList();
   });
-}
 
-function getList(type: String) {
-  //清空查询条件
-  queryParam.principalUid = undefined;
-  queryParam.searchText = undefined;
-  queryParam.searchContent = undefined;
-  if (type == 'noRead') {
-    queryParam.readStatus = '0'
-    queryParam.userEffective = undefined
+  function getSiteList(selectedSiteInfo: any) {
+    queryParam.siteId = selectedSiteInfo.id;
+
+    getTableAndNum(true);
+  }
+  function filterStatus(value: number) {
+    queryParam.readStatus = value;
   }
-  if (type == 'product') {
-    queryParam.userEffective = 1
-    console.log('1', queryParam)
 
-    queryParam.readStatus = undefined
-    console.log('2', queryParam)
+  //重新刷新页面数据及获取询盘数量
+  function getTableAndNum(clearParam: boolean = false) {
+    // 设置默认站点
+    let siteId = queryParam.siteId;
 
+    for (let site of siteList.value) {
+      if (site.id === siteId) {
+        localStorage.setItem('siteCode', site.code);
+      }
+    }
+
+    getEnquiryNums();
+    getSubAccountOptions();
+    if (clearParam) {
+      if (queryParam.readStatus) {
+        delete queryParam.readStatus;
+      }
+      if (queryParam.searchText) {
+        delete queryParam.searchText;
+      }
+      if (queryParam.searchContent) {
+        delete queryParam.searchContent;
+      }
+      if (queryParam.userEffective) {
+        delete queryParam.userEffective;
+      }
+      if (queryParam.principalUid) {
+        delete queryParam.principalUid;
+      }
+    }
+
+    // queryParam.fields = 'id,,siteName,contact,fromEmail,whatsApp,phone,fromIp,readStatus,details,principalUid,fromPage,userEffective,countryName,pluginName,recordCtime,action';
+    // queryParam.userEffective = '1,2';
+    loadData();
   }
-  if (type == 'wait') {
-    queryParam.userEffective = 2
-    queryParam.readStatus = undefined
-  }
-  if (type == 'all') {
-    queryParam.userEffective = undefined
-    queryParam.readStatus = undefined
+
+  //搜索条件部分的逻辑
+  function onChangeDatePciker(date, dateString) {
+    if (dateString.length > 0) {
+      rangeDate.value = date;
+      queryParam.start = dateString[0];
+      queryParam.end = dateString[1];
+      queryParam.dateType = undefined;
+    }
   }
-  loadData(1)
-}
 
-//批量设为已读
-function enquiryReady() {
+  //日期选择只能今天之前
+  function disabledDate(current) {
+    return current && current > moment().endOf('day');
+  }
 
-  console.log(selectedRowKeys.value.length, "selectedRowKeysselectedRowKeysselectedRowKeys");
-  if (selectedRowKeys.value.length <= 0) {
-    createMessage.warning('请选择至少一条记录!');
-    return;
+  //设置列表的时间查询条件
+  function setTime(time) {
+    queryParam.dateType = time;
+    queryParam.start = '';
+    queryParam.end = '';
+    // sevenDay   thirtyDay  today  yesterday
+    if (time == '') {
+      rangeDate.value = undefined;
+    } else if (time == 'sevenDay') {
+      rangeDate.value = [moment().subtract(6, 'days'), moment()];
+    } else if (time == 'thirtyDay') {
+      rangeDate.value = [moment().subtract(29, 'days'), moment()];
+    } else if (time == 'today') {
+      rangeDate.value = [moment(), moment()];
+    } else if (time == 'yesterday') {
+      rangeDate.value = [moment().subtract(1, 'days'), moment().subtract(1, 'days')];
+    }
+    getTableAndNum();
   }
-  getAction('/adweb/adwebEnquiry/read', {id: selectedRowKeys.value.toString()}).then((res) => {
-    if (res.success) {
-      createMessage.success('批量设置已读成功!')
-      getTableAndNum();
-      clearSelectedRowKeys();
+
+  //获取不同状态询盘的数量
+  function getEnquiryNums() {
+    let siteId = '';
+
+    if (queryParam.siteId && queryParam.siteId != '') {
+      siteId = queryParam.siteId;
     } else {
-      if (res.code == 403) {
-        createMessage.warning(res.message)
+      siteId = '';
+    }
+    let d = {
+      siteId: siteId,
+      dateType: queryParam.dateType,
+      start: queryParam.start,
+      end: queryParam.end,
+    };
+    getAction('/adweb/adwebEnquiry/getEnquiryNums', d).then((res) => {
+      if (res.code == 200) {
+        enquiryNums.value.all = res.result.all;
+        enquiryNums.value.noRead = res.result.noRead;
+        enquiryNums.value.product = res.result.product;
+        enquiryNums.value.wait = res.result.wait;
       } else {
-        createMessage.error('设置失败!')
+        enquiryNums.value.all = 0;
+        enquiryNums.value.noRead = 0;
+        enquiryNums.value.product = 0;
+        enquiryNums.value.wait = 0;
       }
-    }
-  })
-}
+    });
+  }
+
+  // 获取子账户的下拉框选项
+  function getSubAccountOptions() {
+    getAction('/usercountry/subAccounts/options?siteId=' + queryParam.siteId, null).then((res) => {
+      if (res.code === 200) {
+        subAccountOptions.value = res.result;
+        haveSubAccount.value = res.result !== null && res.result !== undefined && res.result.length > 0;
+      }
+    });
+  }
 
-// 加载table列表数据
-function loadData(page: number = 1) {
-  reload({page: page});
-}
+  //批量设为已读
+  function enquiryReady() {
+    console.log(selectedRowKeys.value.length, 'selectedRowKeysselectedRowKeysselectedRowKeys');
+    if (selectedRowKeys.value.length <= 0) {
+      createMessage.warning('请选择至少一条记录!');
+      return;
+    }
+    getAction('/adweb/adwebEnquiry/read', { id: selectedRowKeys.value.toString() }).then((res) => {
+      if (res.success) {
+        createMessage.success('批量设置已读成功!');
+        getTableAndNum();
+        clearSelectedRowKeys();
+      } else {
+        if (res.code == 403) {
+          createMessage.warning(res.message);
+        } else {
+          createMessage.error('设置失败!');
+        }
+      }
+    });
+  }
 
-// 导出excel
-function handleExportXlsLU() {
-  excelLoading.value = true;
+  // 加载table列表数据
+  function loadData(page: number = 1) {
+    reload({ page: page });
+  }
 
-  delete queryParam.userEffective;
+  // 导出excel
+  function handleExportXlsLU() {
+    excelLoading.value = true;
 
-  onExportXls().then(() => {
-    excelLoading.value = false;
-  });
-}
+    delete queryParam.userEffective;
 
-//询盘详情
-async function showEnquiryDetail(record) {
-  if (record.readStatus == 0) {
-    getAction('/adweb/adwebEnquiry/read?id=' + record.id, null).then(() => {
-      getTableAndNum();
-    })
+    onExportXls().then(() => {
+      excelLoading.value = false;
+    });
   }
 
-  await nextTick();
+  //询盘详情
+  async function showEnquiryDetail(record) {
+    if (record.readStatus == 0) {
+      getAction('/adweb/adwebEnquiry/read?id=' + record.id, null).then(() => {
+        getTableAndNum();
+      });
+    }
 
-  if (enquiryDetailRef.value && enquiryDetailRef.value.init) {
-    enquiryDetailRef.value.init(record);
-  }
-}
+    await nextTick();
 
-//获取询盘分类列表
-function getEffectiveList() {
-  getAction('/adweb/adwebEnquiry/getEnquiryCatalog', null).then(function (res) {
-    if (res.code == 200) {
-      userEffectiveOption.value = JSON.parse(res.result);
-    } else {
-      createMessage.error('获取询盘分类失败!')
+    if (enquiryDetailRef.value && enquiryDetailRef.value.init) {
+      enquiryDetailRef.value.init(record);
     }
-  }).catch(function (err) {
-    console.log(err)
-  })
-}
+  }
+
+  //获取询盘分类列表
+  function getEffectiveList() {
+    getAction('/adweb/adwebEnquiry/getEnquiryCatalog', null)
+      .then(function (res) {
+        if (res.code == 200) {
+          userEffectiveOption.value = JSON.parse(res.result);
+        } else {
+          createMessage.error('获取询盘分类失败!');
+        }
+      })
+      .catch(function (err) {
+        console.log(err);
+      });
+  }
 
-//复制email到剪切板
-function copyEmailFunction(text) {
   //复制email到剪切板
-  if (!navigator.clipboard) {
-    console.log('浏览器不支持navigator');
-    let copy = (e) => {
-      e.preventDefault()
-      e.clipboardData.setData('text/plain', text)
-      createMessage.success('复制成功');
-      document.removeEventListener('copy', copy)
+  function copyEmailFunction(text) {
+    //复制email到剪切板
+    if (!navigator.clipboard) {
+      console.log('浏览器不支持navigator');
+      let copy = (e) => {
+        e.preventDefault();
+        e.clipboardData.setData('text/plain', text);
+        createMessage.success('复制成功');
+        document.removeEventListener('copy', copy);
+      };
+      document.addEventListener('copy', copy);
+      document.execCommand('Copy');
+      return;
     }
-    document.addEventListener('copy', copy)
-    document.execCommand("Copy");
-    return
-  }
-  navigator.clipboard.writeText(text).then(function () {
-    createMessage.success('复制成功');
-  }, function (err) {
-    createMessage.error('复制失败', err);
-  });
-}
+    navigator.clipboard.writeText(text).then(
+      function () {
+        createMessage.success('复制成功');
+      },
+      function (err) {
+        createMessage.error('复制失败', err);
+      }
+    );
+  }
 
-//获取需要轮流询盘的站点code,判断哪个站点的询盘需要开启转发功能
-function getTurnInquiryCode() {
-  // 站点code
-  let dictSiteCode = [{'label': '', 'value': ''}]
+  //获取需要轮流询盘的站点code,判断哪个站点的询盘需要开启转发功能
+  function getTurnInquiryCode() {
+    // 站点code
+    let dictSiteCode = [{ label: '', value: '' }];
 
-  getAction('/adweb/adwebEnquiry/getTurnInquiryCode', null).then((res) => {
-    if (res.code === 200) {
-      Object.assign(dictSiteCode, res.result);
+    getAction('/adweb/adwebEnquiry/getTurnInquiryCode', null).then((res) => {
+      if (res.code === 200) {
+        Object.assign(dictSiteCode, res.result);
 
-      for (let it in dictSiteCode) {
-        if ( dictSiteCode[it].value === siteCode.value) {
-          isForwardSite.value = true
+        for (let it in dictSiteCode) {
+          if (dictSiteCode[it].value === siteCode.value) {
+            isForwardSite.value = true;
+          }
         }
       }
-    }
-  })
-}
-
-//转发询盘
-function forwardDetail(record) {
-  forwardEnquiryDetail.value = record.id;
-  forwardVisible.value = true;
-}
-
-//拒收
-function enquiryAddBlackList(record) {
-  delete record.wasteEnquiry
-  postAction('/enquiry/blacklist/addBlacklist', record).then(res => {
-    if (res.success) {
-      createMessage.success(`拒收成功!`)
-      this.getTableAndNum()
-    } else {
-      if (res.code == 403 || res.code == 500) {
-        createMessage.warning(res.message)
+    });
+  }
+
+  //转发询盘
+  function forwardDetail(record) {
+    forwardEnquiryDetail.value = record.id;
+    forwardVisible.value = true;
+  }
+
+  //拒收
+  function enquiryAddBlackList(record) {
+    delete record.wasteEnquiry;
+    postAction('/enquiry/blacklist/addBlacklist', record).then((res) => {
+      if (res.success) {
+        createMessage.success(`拒收成功!`);
+        this.getTableAndNum();
       } else {
-        createMessage.error('拒收失败!')
+        if (res.code == 403 || res.code == 500) {
+          createMessage.warning(res.message);
+        } else {
+          createMessage.error('拒收失败!');
+        }
       }
+    });
+  }
 
+  // 编辑转发
+  function editForward() {
+    if (forwardEnquiryDetail.value === undefined) {
+      createMessage.warning('请选择询盘信息!');
+      return;
     }
-  })
-}
-
-
-// 编辑转发
-function editForward() {
-  if (forwardEnquiryDetail === undefined) {
-    createMessage.warning('请选择询盘信息!');
-    return;
-  }
-  if (!selectedUserId) {
-    createMessage.warning('请选择跟进人!');
-    return;
-  }
-
-  forwardLoading.value = true;
-  let param = {
-    'ids': forwardEnquiryDetail.value,
-    'uid': selectedUserId.value,
-    'code': siteCode.value
-  }
-  getAction('/adweb/adwebEnquiry/setForward', param).then((res) => {
-    if (res.success) {
-      createMessage.success(res.message);
-      loadData();
-      cancelEditForward();
-      getEnquiryNums();
-      clearSelectedRowKeys();
-    } else {
-      createMessage.warning(res.message);
+    if (!selectedUserId.value) {
+      createMessage.warning('请选择跟进人!');
+      return;
     }
-  }).finally(() => {
-    forwardLoading.value = false;
-  });
-}
 
-// 取消转发的编辑
-function cancelEditForward() {
-  selectedUserId.value = undefined;
-  forwardEnquiryDetail.value = undefined;
-  forwardVisible.value = false;
-}
+    forwardLoading.value = true;
+    let param = {
+      ids: forwardEnquiryDetail.value,
+      uid: selectedUserId.value,
+      code: siteCode.value,
+    };
+    getAction('/adweb/adwebEnquiry/setForward', param)
+      .then((res) => {
+        if (res.success) {
+          createMessage.success(res.message);
+          loadData();
+          cancelEditForward();
+          getEnquiryNums();
+          clearSelectedRowKeys();
+        } else {
+          createMessage.warning(res.message);
+        }
+      })
+      .finally(() => {
+        forwardLoading.value = false;
+      });
+  }
 
-//回收箱
-async function recycleBinVisible() {
+  // 取消转发的编辑
+  function cancelEditForward() {
+    selectedUserId.value = undefined;
+    forwardEnquiryDetail.value = undefined;
+    forwardVisible.value = false;
+  }
 
-  await nextTick();
+  //回收箱
+  async function recycleBinVisible() {
+    await nextTick();
 
-  if (XpRecycleBinModalRef.value && XpRecycleBinModalRef.value.init) {
-    XpRecycleBinModalRef.value.init(queryParam.siteId, '1,2');
+    if (XpRecycleBinModalRef.value && XpRecycleBinModalRef.value.init) {
+      XpRecycleBinModalRef.value.init(queryParam.siteId, '1,2');
+    }
   }
-}
 
-//黑名单
-async function showBlackList() {
-  await nextTick();
+  //黑名单
+  async function showBlackList() {
+    await nextTick();
 
-  if (blackListRef.value && blackListRef.value.init) {
-    blackListRef.value.init(queryParam.siteId);
+    if (blackListRef.value && blackListRef.value.init) {
+      blackListRef.value.init(queryParam.siteId);
+    }
   }
-}
 
-//跟踪记录
-async function showEnquiryTrackRecord(record) {
-  await nextTick();
+  //跟踪记录
+  async function showEnquiryTrackRecord(record) {
+    await nextTick();
 
-  if (enquiryTrackRecordRef.value && enquiryTrackRecordRef.value.init) {
-    enquiryTrackRecordRef.value.init(record);
+    if (enquiryTrackRecordRef.value && enquiryTrackRecordRef.value.init) {
+      enquiryTrackRecordRef.value.init(record);
+    }
   }
-}
 
-// 高级查询配置
-const superQueryConfig = reactive(superQuerySchema);
+  // 高级查询配置
+  const superQueryConfig = reactive(superQuerySchema);
+
+  /**
+   * 高级查询事件
+   */
+  function handleSuperQuery(params) {
+    Object.keys(params).map((k) => {
+      queryParam[k] = params[k];
+    });
+    searchQuery();
+  }
 
-/**
- * 高级查询事件
- */
-function handleSuperQuery(params) {
-  Object.keys(params).map((k) => {
-    queryParam[k] = params[k];
-  });
-  searchQuery();
-}
-
-/**
- * 新增事件
- */
-function handleAdd() {
-  registerModal.value.disableSubmit = false;
-  registerModal.value.add();
-}
-
-/**
- * 编辑事件
- */
-function handleEdit(record: Recordable) {
-  registerModal.value.disableSubmit = false;
-  registerModal.value.edit(record);
-}
-
-/**
- * 详情
- */
-function handleDetail(record: Recordable) {
-  registerModal.value.disableSubmit = true;
-  registerModal.value.edit(record);
-}
-
-/**
- * 删除事件
- */
-async function handleDelete(record) {
-  await deleteOne({ id: record.id }, handleSuccess);
-}
-
-/**
- * 批量删除事件
- */
-async function batchHandleDelete() {
-  await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
-}
-
-/**
- * 成功回调
- */
-function handleSuccess() {
-  (selectedRowKeys.value = []) && reload();
-}
-
-/**
- * 操作栏
- */
-function getTableAction(record) {
-  return [
-    {
-      label: '编辑',
-      onClick: handleEdit.bind(null, record),
-    },
-  ];
-}
-
-/**
- * 下拉操作栏
- */
-function getDropDownAction(record) {
-  return [
-    {
-      label: '详情',
-      onClick: handleDetail.bind(null, record),
-    },
-    {
-      label: '删除',
-      popConfirm: {
-        title: '是否确认删除',
-        confirm: handleDelete.bind(null, record),
-        placement: 'topLeft',
-      },
-    },
-  ];
-}
-
-/**
- * 查询
- */
-function searchQuery() {
-
-  console.log(queryParam.userEffective, "queryParam.userEffectivequeryParam.userEffective");
-  reload();
-}
-
-/**
- * 重置
- */
-function searchReset() {
-  formRef.value.resetFields();
-  selectedRowKeys.value = [];
-  //刷新数据
-  reload();
-}
-</script>
+  /**
+   * 新增事件
+   */
+  function handleAdd() {
+    registerModal.value.disableSubmit = false;
+    registerModal.value.add();
+  }
 
-<style lang="less" scoped>
-.jeecg-basic-table-form-container {
-  padding: 0;
+  /**
+   * 编辑事件
+   */
+  function handleEdit(record: Recordable) {
+    registerModal.value.disableSubmit = false;
+    registerModal.value.edit(record);
+  }
 
-  .table-page-search-submitButtons {
-    display: block;
-    margin-bottom: 24px;
-    white-space: nowrap;
+  /**
+   * 详情
+   */
+  function handleDetail(record: Recordable) {
+    registerModal.value.disableSubmit = true;
+    registerModal.value.edit(record);
   }
 
-  .query-group-cust {
-    min-width: 100px !important;
+  /**
+   * 删除事件
+   */
+  async function handleDelete(record) {
+    await deleteOne({ id: record.id }, handleSuccess);
   }
 
-  .query-group-split-cust {
-    width: 30px;
-    display: inline-block;
-    text-align: center;
+  /**
+   * 批量删除事件
+   */
+  async function batchHandleDelete() {
+    await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
   }
 
-  .ant-form-item:not(.ant-form-item-with-help) {
-    margin-bottom: 16px;
-    height: 32px;
+  /**
+   * 成功回调
+   */
+  function handleSuccess() {
+    (selectedRowKeys.value = []) && reload();
   }
 
-  :deep(.ant-picker),
-  :deep(.ant-input-number) {
-    width: 100%;
+  /**
+   * 操作栏
+   */
+  function getTableAction(record) {
+    return [
+      {
+        label: '编辑',
+        onClick: handleEdit.bind(null, record),
+      },
+    ];
   }
-}
 
-.theme-color {
-  color: @primary-color;
-}
+  /**
+   * 下拉操作栏
+   */
+  function getDropDownAction(record) {
+    return [
+      {
+        label: '详情',
+        onClick: handleDetail.bind(null, record),
+      },
+      {
+        label: '删除',
+        popConfirm: {
+          title: '是否确认删除',
+          confirm: handleDelete.bind(null, record),
+          placement: 'topLeft',
+        },
+      },
+    ];
+  }
 
-.r1 {
-  .choose-site {
-    display: flex;
+  /**
+   * 查询
+   */
+  function searchQuery() {
+    console.log(queryParam.userEffective, 'queryParam.userEffectivequeryParam.userEffective');
+    reload();
   }
 
-  .t1 {
-    font-size: 18px;
+  /**
+   * 重置
+   */
+  function searchReset() {
+    formRef.value.resetFields();
+    selectedRowKeys.value = [];
+    //刷新数据
+    reload();
   }
+</script>
+
+<style lang="less" scoped>
+  .ant-form-item {
+    flex: 1;
+  }
+  .jeecg-basic-table-form-container {
+    padding: 0;
+
+    .table-page-search-submitButtons {
+      display: block;
+      margin-bottom: 24px;
+      white-space: nowrap;
+    }
 
-  .ant-calendar-picker {
-    margin-right: 20px;
+    .query-group-cust {
+      min-width: 100px !important;
+    }
 
+    .query-group-split-cust {
+      width: 30px;
+      display: inline-block;
+      text-align: center;
+    }
+
+    .ant-form-item:not(.ant-form-item-with-help) {
+      margin-bottom: 16px;
+      height: 32px;
+    }
+
+    :deep(.ant-picker),
+    :deep(.ant-input-number) {
+      width: 100%;
+    }
   }
 
+  .theme-color {
+    color: @primary-color;
+  }
 
-}
+  .r1 {
+    .choose-site {
+      display: flex;
+    }
 
-.r2 {
-  background: #fff;
-  border-radius: 10px;
-  padding: 30px 20px;
-  margin-top: 20px;
+    .t1 {
+      font-size: 18px;
+    }
 
-  .ant-col:not(:last-child) {
-    border-right: 1px solid #e6e6e6;
+    .ant-calendar-picker {
+      margin-right: 20px;
+    }
   }
 
-  p {
-    margin: 0;
-    text-align: center;
+  .r2 {
+    background: #fff;
+    border-radius: 10px;
+    padding: 30px 20px;
+    margin-top: 20px;
+
+    .ant-col:not(:last-child) {
+      border-right: 1px solid #e6e6e6;
+    }
+
+    p {
+      margin: 0;
+      text-align: center;
 
-    &.t1 {
-      color: #333;
-      margin-bottom: 15px;
+      &.t1 {
+        color: #333;
+        margin-bottom: 15px;
 
-      img {
-        margin-right: 10px;
-        width: 15px;
-        margin-top: -5px;
+        img {
+          margin-right: 10px;
+          width: 15px;
+          margin-top: -5px;
+        }
       }
-    }
 
-    &.t2 {
-      color: @primary-color;
-      font-size: 30px;
-      font-weight: 500;
-      line-height: 1;
-      text-decoration: underline;
-      cursor: pointer;
-      padding-left: 25px;
+      &.t2 {
+        color: @primary-color;
+        font-size: 30px;
+        font-weight: 500;
+        line-height: 1;
+        text-decoration: underline;
+        cursor: pointer;
+        padding-left: 25px;
+      }
     }
   }
-}
 
-.r3 {
-  margin-top: 20px;
-}
+  .r3 {
+    margin-top: 20px;
+  }
 </style>

+ 93 - 391
src/views/adweb/theme/AdwebThemeList.vue

@@ -9,65 +9,25 @@
         class="j-table-force-nowrap template_list"
         :style="{ height: '100%' }"
       >
-        <template #renderItem="{ item }">
+        <template #loadMore>
+          <div v-if="!loading && !moreLoading" :style="{ textAlign: 'center', marginTop: '12px', height: '32px', lineHeight: '32px' }">
+            <a-button @click="onLoadMore">loading more</a-button>
+          </div>
+        </template>
+
+        <template #renderItem="{ item, index }">
           <a-list-item>
             <a-card :title="item.name" class="text-center">
               <div class="item" @mouseover="hoverThis">
                 <div class="Pic">
                   <a class="img">
                     <img v-if="checkUrl(item.images)" :key="item.code" :alt="item.name" :src="domainUrl + '/sys/common/static/' + item.images" />
-                    <img v-else alt="item.name" />
+                    <img v-else alt="item.name" :src="domainUrl + '/sys/common/static/' + item.images" />
                   </a>
-                  <template v-if="item.putaway == 1 && item.externalTemplate != 1 && item.developmentStatus != 1">
-                    <div class="Content">
-                      <a-button class="fl" block @click="visit(item)">模板预览</a-button>
-                      <a-button type="primary" block class="fr" @click="createSite(item)">创建站点</a-button>
-                    </div>
-                  </template>
-                  <template
-                    v-else-if="
-                      item.putaway == 1 &&
-                      item.developmentStatus == 1 &&
-                      item.siteType == 3 &&
-                      (item.externalTemplateUrl == null || item.externalTemplateUrl == '')
-                    "
-                  >
-                    <div class="Content">
-                      <a-button type="primary" block @click="visitImage(item)">模板预览</a-button>
-                    </div>
-                  </template>
-                  <template
-                    v-else-if="
-                      item.putaway == 1 &&
-                      item.developmentStatus == 1 &&
-                      item.siteType == 3 &&
-                      item.externalTemplateUrl != null &&
-                      item.externalTemplateUrl != ''
-                    "
-                  >
-                    <div class="Content">
-                      <a-button type="primary" block @click="visitOut(item)">模板预览</a-button>
-                    </div>
-                  </template>
-                  <template v-else-if="item.putaway == 1 && item.externalTemplate == 1 && item.externalTemplateUrl != null">
-                    <div class="Content">
-                      <a-button type="primary" block @click="visitOut(item)">模板预览</a-button>
-                    </div>
-                  </template>
-                  <template
-                    v-else-if="
-                      item.putaway == 1 && item.externalTemplate == 1 && (item.externalTemplateUrl == null || item.externalTemplateUrl == '')
-                    "
-                  >
-                    <div class="Content">
-                      <a-button type="dashed" block>bb敬请期待</a-button>
-                    </div>
-                  </template>
-                  <template v-else-if="item.putaway == 1 && item.developmentStatus == 1 && item.siteType == 3">
-                    <div class="Content">
-                      <a-button type="dashed" block>{{ item.externalTemplateUrl }}敬请期待 {{ item.siteType }}</a-button>
-                    </div>
-                  </template>
+                  <div class="Content">
+                    <a-button class="fl" block @click="visit(item, index)">模板预览</a-button>
+                    <a-button type="primary" block class="fr" @click="createSite(item)">创建站点</a-button>
+                  </div>
                 </div>
                 <div class="clear"></div>
               </div>
@@ -75,70 +35,8 @@
           </a-list-item>
         </template>
       </a-list>
-      <a-modal
-        v-model:open="modalVisible"
-        :title="modalTitle"
-        centered
-        :confirm-loading="confirmLoading"
-        @ok="handleOk"
-        @cancel="handleCancel"
-        :closable="false"
-        :keyboard="false"
-        :maskClosable="false"
-        width="50%"
-        :ok-button-props="okBtnStatus"
-        :cancel-button-props="cancelBtnStatus"
-        :okText="okText"
-        :cancelText="cancelText"
-      >
-        <template v-if="showCreateSite">
-          <a-spin :spinning="spinning" :tip="tipTitle">
-            <a-form ref="createSiteFormsRef" :model="createSiteForm" :rules="createSiteFormRules" :label-col="labelCol" :wrapper-col="wrapperCol">
-              <a-form-item>
-                我们将为您新建站点,稍后请移至“站群管理”对网站内容进行编辑<br />
-                在建站完成后,需要您将域名解析到指定的CNAME将网站发布上线<br />
-                您可在“站群管理”中查看建站进度和CNAME
-              </a-form-item>
-              <a-form-item name="name" label="用户名称" prop="uid">
-                <a-select v-model:value="createSiteForm.uid" show-search :filter-option="filterOption" placeholder="请选择用户名称">
-                  <a-select-option v-for="user in userList" :key="user.id" :value="user.id">
-                    {{ user.realname }}
-                  </a-select-option>
-                </a-select>
-              </a-form-item>
-              <a-form-item name="name" label="站点名称" prop="name">
-                <a-input v-model:value="createSiteForm.name" placeholder="请输入站点名称" />
-              </a-form-item>
-              <a-form-item name="languageCode" label="站点语言" prop="languageCode">
-                <j-search-select placeholder="请选择站点语言" v-model:value="createSiteForm.languageCode" dict="adweb_language" />
-              </a-form-item>
-              <a-form-item name="planId" label="营销方案" prop="planId">
-                <a-row :gutter="8">
-                  <a-col :span="21">
-                    <j-search-select placeholder="请选择营销方案" v-model:value="createSiteForm.planId" dict="subscribe_plan,plan_name,id,status=1" />
-                  </a-col>
-                  <a-col :span="3">
-                    <router-link :to="{ path: '/deliver/serp/seoMarketPlan/list', query: { from: 'themeList' } }">
-                      <a-button type="primary" block>新增</a-button>
-                    </router-link>
-                  </a-col>
-                </a-row>
-              </a-form-item>
-
-              <a-form-item label="赠送天数" prop="giveDay" v-show="createSiteForm.planId !== undefined">
-                <a-input-number :min="0" :max="1000" style="width: 100%" placeholder="赠送天数" v-model="createSiteForm.giveDay" />
-              </a-form-item>
-              <a-form-item label="补偿天数" prop="compensateDay" v-show="createSiteForm.planId !== undefined">
-                <a-input-number :min="0" :max="1000" style="width: 100%" placeholder="补偿天数" v-model="createSiteForm.compensateDay" />
-              </a-form-item>
-            </a-form>
-          </a-spin>
-        </template>
 
-        <template v-if="showResult">
-          <a-result status="success" title="站点创建完成!" />
-        </template>
-      </a-modal>
+      <adweb-create-site ref="modelRef" />
       <a-modal v-model:open="visible" width="80%" @cancel="visitImageCancel" :footer="null" class="self_buy_modal">
         <template #title>
           <div>
@@ -171,30 +69,12 @@
 <script lang="ts" setup name="AdwebThemeCList">
   import '/@/assets/less/TableExpand.less';
   import '/@/assets/less/common.less';
-
-  import Qs from 'qs';
-  import { getAction, postAction } from '/@/api/manage/manage';
+  import { getAction } from '/@/api/manage/manage';
   import $ from 'jquery';
 
-  import { onMounted, reactive, ref } from 'vue';
+  import { nextTick, onMounted, reactive, ref } from 'vue';
   import { useMessage } from '@/hooks/web/useMessage';
-  import JSearchSelect from '@/components/Form/src/jeecg/components/JSearchSelect.vue';
-
-  const description = ref('adweb_theme管理页面');
-
-  const columns = reactive([
-    {
-      title: '站点名称',
-      align: 'left',
-      dataIndex: 'name',
-    },
-    {
-      title: '图片路径',
-      align: 'left',
-      dataIndex: 'images',
-      scopedSlots: { customRender: 'imgSlot' },
-    },
-  ]);
+  import AdwebCreateSite from '@/views/adweb/theme/components/AdwebCreateSite.vue';
 
   const url = reactive({
     list: '/adweb/adwebTheme/list',
@@ -207,68 +87,84 @@
     getAdwebVipUrl: 'adweb/adwebSiteManage/getAdwebVip',
   });
 
-  const dictOptions = reactive({});
-
-  const createSiteFormsRef = ref();
-  const superFieldList = reactive([]);
   const domainUrl = ref(window._CONFIG.domianURL);
-  const modalVisible = ref(false);
-  const modalTitle = ref('');
-  const userRole = ref('');
 
-  const confirmLoading = ref(false);
-  const showCreateSite = ref(false);
-  const createSiteForm = reactive({
-    uid: undefined,
-    source: '',
-    name: '',
-    languageCode: 'en',
-    parentCode: '',
-    planId: undefined,
-    giveDay: 0,
-    compensateDay: 0,
-  });
-
-  const createSiteFormRules = reactive({
-    uid: [{ required: true, message: '请选择用户名称', trigger: 'blur' }],
-    name: [{ required: true, message: '请输入站点名称', trigger: 'blur' }],
-    languageCode: [{ required: true, message: '站点语言不能为空', trigger: 'change' }],
-    planId: [{ required: true, message: '请选择营销方案', trigger: 'blur' }],
-  });
+  const userRole = ref('');
 
-  const showResult = ref(false);
-  const spinning = ref(false);
-  const tipTitle = ref('');
-  const labelCol = reactive({ span: 3 });
-  const wrapperCol = reactive({ span: 21 });
-  const modalStatus = ref(false);
-  const okBtnStatus = reactive({});
-  const okText = ref('');
-  const cancelText = ref('');
   const modelText = ref('');
   const theImage = ref('');
-  const cancelBtnStatus = reactive({});
-  const templateTag = reactive([]);
-  const ins = ref(0);
-  let dataSource = reactive([]);
-  const loading = ref(false);
-  const isHeight = ref($(window).height() - 59 - 52 - 12 - 62 - 12 - 93);
-  const siteCreating = ref(false);
-  const isWpSiteCreate = ref(false);
-  const wpTemplateData = reactive({
-    name: '',
-    tempId: '',
-    domain: '',
-    uid: '',
-  });
-  let userList = reactive([{ id: '', realname: '' }]);
+
+  let dataSource = reactive([
+    {
+      createBy: '',
+      createTime: '',
+      descirbe: '',
+      domain: '',
+      id: '',
+      images: '',
+      name: '',
+      putaway: '',
+      runStatus: null,
+      templateColorId: '',
+      templatePrice: 0,
+      templateTags: '',
+      updateBy: null,
+      updateTime: null,
+      visible: true,
+    },
+  ]);
+  const loading = ref(true);
+  const moreLoading = ref(false);
+  const modelRef = ref();
   const visible = ref(false);
-  const { createMessage, createConfirm } = useMessage();
+
+  const pageNo = ref(1);
+
+  const { createMessage } = useMessage();
 
   onMounted(() => {
     getTemplateList();
   });
 
+  function getTemplateList() {
+    loading.value = true;
+    let listUrl = `${url.list}` + '?pageNo=' + pageNo.value + '&pageSize=8&templateTags=' + 22;
+    getAction(listUrl, null).then(function (res) {
+      if (res.code == 200) {
+        loading.value = false;
+
+        // 第一页数据直接赋值数组,后续合并数组
+        if (res.result.current === 1) {
+          dataSource = res.result.records.map((item) => ({
+            ...item,
+            visible: false,
+          }));
+        } else {
+          dataSource = dataSource.concat(
+            res.result.records.map((item) => ({
+              ...item,
+              visible: false,
+            }))
+          );
+        }
+
+        if (res.result.current >= res.result.pages) {
+          moreLoading.value = true;
+        }
+      } else {
+        loading.value = false;
+        createMessage.error('模板获取失败!');
+      }
+
+      nextTick(() => {
+        // Resetting window's offsetTop so as to display react-virtualized demo underfloor.
+        // In real scene, you can using public method of react-virtualized:
+        // https://stackoverflow.com/questions/46700726/how-to-use-public-method-updateposition-of-react-virtualized
+        window.dispatchEvent(new Event('resize'));
+      });
+    });
+  }
+
   function checkUrl(val) {
     if (val != null) {
       if (val.substr(0, 7).toLowerCase() == 'http://' || val.substr(0, 8).toLowerCase() == 'https://') {
@@ -299,8 +195,8 @@
     );
   }
   //预览
-  function visit(data) {
-    if (data.domain != null && data.domain != '') {
+  function visit(data, index) {
+    if (data.domain != null && data.domain != '' && data.putaway === 1) {
       return window.open(data.domain, '_blank');
     } else {
       visitImage(data);
@@ -314,213 +210,19 @@
   }
 
   function visitImageCancel() {
-    this.visible = false;
-    this.modelText = '';
-    this.theImage = '';
-  }
-
-  function visitOut(data) {
-    if (data.externalTemplateUrl != null && data.externalTemplateUrl != '') {
-      return window.open(data.externalTemplateUrl, '_blank');
-    } else {
-      this.visitImage(data);
-    }
-  }
-
-  function cleanAllFormData() {
-    confirmLoading.value = false;
-    templateInfo = {};
-    spinning.value = false;
-    tipTitle.value = '';
-    modalVisible.value = false;
-    modalTitle.value = '';
-    modalCopyTemplateStatus = false;
-    copyTemplateForm = {
-      name: '',
-    };
-    showCreateSite.value = false;
-    createSiteForm = {
-      uid: undefined,
-      languageCode: 'en',
-      source: '',
-      name: '',
-      parentCode: '',
-      planId: undefined,
-      giveDay: 0,
-      compensateDay: 0,
-    };
-    showResult.value = false;
-    okBtnStatus = {};
-    cancelBtnStatus = {};
-    ins.value = 0;
-    loading.value = false;
-  }
-
-  //创建站点
-  function createSite(item) {
-    getUserList();
-    if (item.siteType === 3) {
-      isWpSiteCreate.value = true;
-      wpTemplateData.tempId = item.id;
-    } else {
-      createSiteForm.source = item.source;
-      createSiteForm.parentCode = item.code;
-      createSiteForm.id = item.id;
-      createSiteForm.languageCode = 'en';
-    }
-    modalVisible.value = true;
-    modalTitle.value = '创建站点';
-    showCreateSite.value = true;
-    okText.value = '确定';
-    cancelText.value = '取消';
+    visible.value = false;
+    modelText.value = '';
+    theImage.value = '';
   }
 
-  function createSiteData() {
-    confirmLoading.value = false;
-    spinning.value = true;
-    tipTitle.value = '正在创建站点';
-    let createSiteUrl = `${url.createSiteUrl}`;
-    okBtnStatus = { props: { disabled: true } };
-    cancelBtnStatus = { props: { disabled: true } };
-    postAction(createSiteUrl, Qs.stringify(createSiteForm), 1000 * 60 * 5)
-      .then(function (res) {
-        spinning.value = false;
-        tipTitle.value = '';
-        if (res.code == 200) {
-          showCreateSite.value = false;
-          showResult.value = true;
-          modalTitle.value = '系统提示';
-          okText.value = '预览站点';
-          cancelText.value = '关闭';
-          showCreateSite.value = false;
-          okBtnStatus = {};
-          cancelBtnStatus = {};
-          newCreateSiteInfo = res.data;
-        } else {
-          cancelBtnStatus = {};
-          createMessage.error('网站创建失败,请重试!');
-        }
-      })
-      .catch(function () {
-        modalVisible.value = true;
-        createMessage.error('网络超时,请重试!');
-      });
-  }
-
-  function handleOk() {
-    if (showCreateSite.value && !isWpSiteCreate.value) {
-      createSiteFormsRef.value.validate((valid) => {
-        if (valid) {
-          createSiteData();
-        } else {
-          return false;
-        }
-      });
-    }
-    if (showCreateSite.value && isWpSiteCreate) {
-      createSiteFormsRef.value.validate((valid) => {
-        if (valid) {
-          wpSiteCreate(createSiteForm.name);
-        } else {
-          return false;
-        }
-      });
-    }
-    if (showResult.value && !isWpSiteCreate.value) {
-      toMySite();
-    }
-    if (showResult.value && isWpSiteCreate) {
-      toMyWPSite();
-    }
-  }
-
-  function handleCancel() {
-    cleanAllFormData();
-  }
-
-  function toMySite() {
-    return window.open(domainUrl.value + newCreateSiteInfo, '_blank');
-  }
-
-  //wp站点创建成功预览
-  function toMyWPSite() {
-    return window.open('http://' + newCreateSiteInfo, '_blank');
-  }
-
-  function getTemplateList() {
+  function onLoadMore() {
     loading.value = true;
-    let listUrl = `${url.list}` + '?templateTags=' + 22;
-    getAction(listUrl, null).then(function (res) {
-      if (res.code == 200) {
-        loading.value = false;
-        dataSource = res.result.records;
-      } else {
-        loading.value = false;
-        createMessage.error('模板获取失败!');
-      }
-    });
-  }
-
-  //wp站点创建
-  function wpSiteCreate(siteName) {
-    if (siteCreating.value) {
-      createMessage.warning('站点创建中,请勿重复点击!');
-      return;
-    }
-    siteCreating.value = true;
-    confirmLoading.value = false;
-    spinning.value = true;
-    tipTitle.value = '正在创建站点';
-    okBtnStatus = { props: { disabled: true } };
-    cancelBtnStatus = { props: { disabled: true } };
-    wpTemplateData.name = siteName;
-    wpTemplateData.uid = createSiteForm.uid;
-    wpTemplateData.planId = createSiteForm.planId;
-    wpTemplateData.giveDay = createSiteForm.giveDay;
-    wpTemplateData.compensateDay = createSiteForm.compensateDay;
-    postAction(url.wpSiteCreateUrl, Qs.stringify(wpTemplateData), 1000 * 60 * 5)
-      .then(function (res) {
-        if (res.code === 200 && res.result === 'ignore') {
-          createMessage.error('您距离上个站点创建不足两分钟,请两分钟后再次尝试!');
-          return;
-        }
-        if (res.code === 200) {
-          showCreateSite.value = false;
-          showResult.value = true;
-          modalTitle.value = '系统提示';
-          okText.value = '预览站点';
-          cancelText.value = '关闭';
-          showCreateSite.value = false;
-          okBtnStatus = {};
-          cancelBtnStatus = {};
-          newCreateSiteInfo = res.result;
-          wpSitePreviewUrl = '';
-        } else {
-          cancelBtnStatus = {};
-          createMessage.error('网站创建失败,请重试!');
-        }
-      })
-      .catch(function () {
-        modalVisible.value = true;
-        createMessage.error('网络超时,请重试!');
-      })
-      .finally(() => {
-        siteCreating.value = false;
-        spinning.value = false;
-        tipTitle.value = '';
-      });
-  }
-
-  function getUserList() {
-    getAction(url.getAdwebVipUrl, null).then(function (res) {
-      if (res.code == 200) {
-        userList = res.result;
-      }
-    });
+    pageNo.value += 1;
+    getTemplateList();
   }
 
-  function filterOption(input, option) {
-    return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0;
+  function createSite(data) {
+    modelRef.value.initCreateSiteModel(data);
   }
 </script>
 <style scoped lang="less">

+ 246 - 0
src/views/adweb/theme/components/AdwebCreateSite.vue

@@ -0,0 +1,246 @@
+<template>
+  <a-modal
+    v-model:open="modalVisible"
+    :title="modalTitle"
+    centered
+    :confirmLoading="confirmLoading"
+    @ok="handleOk"
+    @cancel="handleCancel"
+    width="50%"
+    :okButtonProps="okBtnStatus"
+    :cancelButtonProps="cancelBtnStatus"
+    :okText="okText"
+    :cancelText="cancelText"
+  >
+    <template v-if="showCreateSite">
+      <a-spin :spinning="spinning" :tip="tipTitle">
+        <a-form ref="createSiteFormsRef" :model="createSiteForm" :rules="createSiteFormRules" :label-col="labelCol" :wrapper-col="wrapperCol">
+          <a-form-item>
+            我们将为您新建站点,稍后请移至“站群管理”对网站内容进行编辑<br />
+            在建站完成后,需要您将域名解析到指定的CNAME将网站发布上线<br />
+            您可在“站群管理”中查看建站进度和CNAME
+          </a-form-item>
+          <a-form-item name="uid" label="用户名称">
+            <a-select
+              v-model:value="createSiteForm.uid"
+              show-search
+              :options="userList"
+              :filter-option="filterOption"
+              :field-names="{ label: 'realname', value: 'id' }"
+              placeholder="请选择用户名称"
+            />
+          </a-form-item>
+          <a-form-item name="name" label="站点名称">
+            <a-input v-model:value="createSiteForm.name" placeholder="请输入站点名称" />
+          </a-form-item>
+          <a-form-item name="languageCode" label="站点语言">
+            <j-search-select placeholder="请选择站点语言" v-model:value="createSiteForm.languageCode" dict="adweb_language" />
+          </a-form-item>
+          <a-form-item name="planId" label="营销方案">
+            <a-row :gutter="8">
+              <a-col :span="21">
+                <j-search-select placeholder="请选择营销方案" v-model:value="createSiteForm.planId" dict="subscribe_plan,plan_name,id,status=1" />
+              </a-col>
+              <a-col :span="3">
+                <router-link :to="{ path: '/deliver/serp/seoMarketPlan/list', query: { from: 'themeList' } }">
+                  <a-button type="primary" block>新增</a-button>
+                </router-link>
+              </a-col>
+            </a-row>
+          </a-form-item>
+
+          <a-form-item label="赠送天数" name="giveDay" v-show="createSiteForm.planId !== undefined">
+            <a-input-number :min="0" :max="1000" style="width: 100%" placeholder="赠送天数" v-model:value="createSiteForm.giveDay" />
+          </a-form-item>
+          <a-form-item label="补偿天数" name="compensateDay" v-show="createSiteForm.planId !== undefined">
+            <a-input-number :min="0" :max="1000" style="width: 100%" placeholder="补偿天数" v-model:value="createSiteForm.compensateDay" />
+          </a-form-item>
+        </a-form>
+      </a-spin>
+    </template>
+
+    <template v-if="showResult">
+      <a-result status="success" title="站点创建完成!" />
+    </template>
+  </a-modal>
+</template>
+<script setup lang="ts">
+  import JSearchSelect from '@/components/Form/src/jeecg/components/JSearchSelect.vue';
+  import { onBeforeMount, reactive, ref } from 'vue';
+  import { getAction, postActionForm } from '@/api/manage/manage';
+  import { useMessage } from '@/hooks/web/useMessage';
+
+  const createSiteFormRules = reactive({
+    uid: [{ required: true, message: '请选择用户名称', trigger: 'blur' }],
+    name: [{ required: true, message: '请输入站点名称', trigger: 'blur' }],
+    languageCode: [{ required: true, message: '站点语言不能为空', trigger: 'change' }],
+    planId: [{ required: true, message: '请选择营销方案', trigger: 'blur' }],
+  });
+  const modalTitle = ref('');
+  const showResult = ref(false);
+  const confirmLoading = ref(false);
+  const labelCol = reactive({ span: 3 });
+  const wrapperCol = reactive({ span: 21 });
+
+  const okText = ref('');
+  const cancelText = ref('');
+  const spinning = ref(false);
+  const showCreateSite = ref(false);
+  let createSiteForm = reactive({
+    uid: undefined,
+    templateId: undefined,
+    source: '',
+    name: '',
+    languageCode: 'en',
+    parentCode: '',
+    planId: undefined,
+    giveDay: 0,
+    compensateDay: 0,
+  });
+  const tipTitle = ref('');
+
+  let okBtnStatus = reactive({});
+  const createSiteFormsRef = ref();
+
+  const modalVisible = ref(false);
+
+  const siteCreating = ref(false);
+  const isWpSiteCreate = ref(false);
+
+  const url = reactive({
+    createSiteUrl: 'siteManage/createSite',
+    addSiteLanguageUrl: 'siteManage/addSiteLanguage',
+    getTemplateTagsUrl: '/adweb/adwebThemeC/getTemplateTags',
+    wpSiteCreateUrl: 'wpWebSite/addWebsite',
+    getAdwebVipUrl: 'adweb/adwebSiteManage/getAdwebVip',
+  });
+  const newCreateSiteInfo = ref('');
+  let userList = reactive([{ id: '', realname: '' }]);
+  let cancelBtnStatus = reactive({});
+
+  const ins = ref(0);
+  // 用户搜索
+  const filterOption = (input: string, option: any) => {
+    if (option.realname == null) {
+      return false;
+    }
+    return option.realname.toLowerCase().indexOf(input.toLowerCase()) >= 0;
+  };
+
+  const { createMessage } = useMessage();
+
+  function cleanAllFormData() {
+    confirmLoading.value = false;
+
+    spinning.value = false;
+    tipTitle.value = '';
+    modalVisible.value = false;
+    modalTitle.value = '';
+    showCreateSite.value = false;
+
+    createSiteFormsRef.value.resetFields();
+    createSiteForm = {
+      uid: undefined,
+      languageCode: 'en',
+      source: '',
+      name: '',
+      parentCode: '',
+      planId: undefined,
+      giveDay: 0,
+      compensateDay: 0,
+    };
+    showResult.value = false;
+    ins.value = 0;
+  }
+
+  onBeforeMount(() => {
+    getUserList();
+  });
+
+  //创建站点
+  function initCreateSiteModel(item) {
+    isWpSiteCreate.value = true;
+    createSiteForm.templateId = item.id;
+    modalVisible.value = true;
+    modalTitle.value = '创建站点';
+    showCreateSite.value = true;
+    okText.value = '确定';
+    cancelText.value = '取消';
+  }
+
+  async function handleOk() {
+    if (showCreateSite.value && isWpSiteCreate.value) {
+      await createSiteFormsRef.value.validateFields();
+      wpSiteCreate();
+    }
+
+    if (showResult.value && isWpSiteCreate) {
+      toMyWPSite();
+    }
+  }
+
+  function handleCancel() {
+    cleanAllFormData();
+  }
+
+  //wp站点创建成功预览
+  function toMyWPSite() {
+    return window.open('http://' + newCreateSiteInfo.value, '_blank');
+  }
+
+  //wp站点创建
+  function wpSiteCreate() {
+    if (siteCreating.value) {
+      createMessage.warning('站点创建中,请勿重复点击!');
+      return;
+    }
+
+    siteCreating.value = true;
+    confirmLoading.value = false;
+    spinning.value = true;
+    tipTitle.value = '正在创建站点';
+    okBtnStatus = { props: { disabled: true } };
+    cancelBtnStatus = { props: { disabled: true } };
+
+    postActionForm(url.wpSiteCreateUrl, createSiteForm, 1000 * 60 * 5)
+      .then(function (res) {
+        if (res.code === 200 && res.result === 'ignore') {
+          createMessage.error('您距离上个站点创建不足两分钟,请两分钟后再次尝试!');
+          return;
+        }
+        if (res.code === 200) {
+          showCreateSite.value = false;
+          showResult.value = true;
+          modalTitle.value = '系统提示';
+          okText.value = '预览站点';
+          cancelText.value = '关闭';
+          showCreateSite.value = false;
+          okBtnStatus = {};
+          cancelBtnStatus = {};
+          newCreateSiteInfo.value = res.data;
+        } else {
+          cancelBtnStatus = {};
+          createMessage.error('网站创建失败,请重试!');
+        }
+      })
+      .catch(function () {
+        modalVisible.value = true;
+        createMessage.error('网络超时,请重试!');
+      })
+      .finally(() => {
+        siteCreating.value = false;
+        spinning.value = false;
+        tipTitle.value = '';
+      });
+  }
+
+  async function getUserList() {
+    getAction(url.getAdwebVipUrl, null).then(function (res) {
+      if (res.code == 200) {
+        userList = res.result;
+      }
+    });
+  }
+
+  defineExpose({ initCreateSiteModel });
+</script>