CzRger 1 week ago
parent
commit
f30e93b1b7

+ 1 - 1
.env.development

@@ -3,7 +3,7 @@ NODE_ENV = development
 # 标题
 VITE_TITLE = 大模型智能应用开发及监测平台
 # 是否需要登录  Y/N
-VITE_LOGIN_MUST = N
+VITE_LOGIN_MUST = Y
 # token标识
 VITE_TOKEN = bmwToken
 # 基础路径

+ 1 - 1
src/api/interceptors.ts

@@ -31,7 +31,7 @@ export class Interceptors {
             (import.meta as any).env.VITE_TOKEN,
           )
           if (token) {
-            config.headers.Authorization = token
+            config.headers.Authorization = 'Bearer ' + token
           } else {
             // @ts-ignore
             delete config.headers.Authorization

+ 2 - 2
src/components/czr-ui/czr-form-link/upload.vue

@@ -204,8 +204,8 @@ const props = defineProps({
   acceptFunc: { default: () => (options) => {} },
   view: { default: null },
   delRule: { default: () => () => false },
-  cardWidth: { default: '147px' },
-  cardHeight: { default: '128px' },
+  cardWidth: { default: '8rem' },
+  cardHeight: { default: '8rem' },
   urlKey: { default: 'url' },
   nameKey: { default: 'name' },
   limitNoUpload: { default: false },

+ 34 - 35
src/views/global/login/index.vue

@@ -40,27 +40,27 @@
               size="large"
             />
           </div>
-          <div class="flex w-full">
-            <div class="mr-2 flex-1">
-              <CzrFormColumn
-                label-width="0px"
-                width="100%"
-                v-model:param="state.form.captcha"
-                placeholder="请输入验证码"
-                default-error-msg="请输入验证码"
-                :prefix-icon="Clock"
-                size="large"
-              />
-            </div>
-            <div class="h-[38px]">
-              <img
-                class="h-full w-full"
-                v-if="state.codeImg"
-                :src="state.codeImg"
-                @click="initCode"
-              />
-            </div>
-          </div>
+          <!--          <div class="flex w-full">-->
+          <!--            <div class="mr-2 flex-1">-->
+          <!--              <CzrFormColumn-->
+          <!--                label-width="0px"-->
+          <!--                width="100%"-->
+          <!--                v-model:param="state.form.captcha"-->
+          <!--                placeholder="请输入验证码"-->
+          <!--                default-error-msg="请输入验证码"-->
+          <!--                :prefix-icon="Clock"-->
+          <!--                size="large"-->
+          <!--              />-->
+          <!--            </div>-->
+          <!--            <div class="h-[38px]">-->
+          <!--              <img-->
+          <!--                class="h-full w-full"-->
+          <!--                v-if="state.codeImg"-->
+          <!--                :src="state.codeImg"-->
+          <!--                @click="initCode"-->
+          <!--              />-->
+          <!--            </div>-->
+          <!--          </div>-->
         </CzrForm>
         <div
           class="__hover mt-2 flex h-[2.5rem] w-full items-center justify-center bg-[#3363DE] text-sm text-[#ffffff]"
@@ -78,7 +78,7 @@
 import { computed, getCurrentInstance, reactive, ref, onMounted } from 'vue'
 import { User, Lock, Clock } from '@element-plus/icons-vue'
 import { ElMessage } from 'element-plus'
-import { loginCaptcha, loginSubmit } from '@/api/modules/global/login'
+import { loginSubmit } from '@/api/modules/global/login'
 import { useRouter } from 'vue-router'
 import { useAppStore } from '@/stores'
 
@@ -91,11 +91,10 @@ const state: any = reactive({
   form: {
     username: 'super-admin',
     password: 'Ai@2025',
-    captcha: '',
-    tenantId: 0,
+    // captcha: '',
   },
   loading: false,
-  codeImg: '',
+  // codeImg: '',
 })
 const ref_form = ref()
 const titleCpt = computed(() => (import.meta as any).env.VITE_TITLE)
@@ -126,17 +125,17 @@ const onLogin = () => {
       })
   }
 }
-const initCode = () => {
-  loginCaptcha().then((res: any) => {
-    if (res.code === 200) {
-      state.codeImg = res.data
-    } else {
-      ElMessage.error(res.message)
-    }
-  })
-}
+// const initCode = () => {
+//   loginCaptcha().then((res: any) => {
+//     if (res.code === 200) {
+//       state.codeImg = res.data
+//     } else {
+//       ElMessage.error(res.message)
+//     }
+//   })
+// }
 onMounted(() => {
-  initCode()
+  // initCode()
 })
 </script>
 

+ 234 - 0
src/views/manage/center/tenant/detail.vue

@@ -0,0 +1,234 @@
+<template>
+  <CzrDialog
+    :show="show"
+    :title="titleCpt"
+    @onClose="$emit('update:show', false)"
+    @onSubmit="onSubmit"
+    width="62.5rem"
+    height="auto"
+    max-height="90%"
+    :loading="state.loading"
+  >
+    <div class="bm-form">
+      <CzrForm ref="ref_form" :form-view="isViewCpt">
+        <el-col :span="19">
+          <el-row>
+            <CzrFormColumn
+              required
+              :span="12"
+              label="用户名称"
+              v-model:param="state.form.name"
+            />
+            <CzrFormColumn
+              required
+              :span="12"
+              label="租户状态"
+              v-model:param="state.form.name"
+              link="switch"
+            />
+            <CzrFormColumn
+              :span="12"
+              label="用户配额"
+              v-model:param="state.form.name"
+            />
+            <CzrFormColumn
+              :span="12"
+              label="租户启用时间"
+              v-model:param="state.form.name"
+              link="date"
+              :disabled="true"
+            />
+            <CzrFormColumn
+              required
+              :span="12"
+              label="租户停用时间"
+              v-model:param="state.form.name"
+              link="date"
+            />
+          </el-row>
+        </el-col>
+        <el-col :span="4" :offset="1">
+          <el-row>
+            <CzrFormColumn
+              :span="24"
+              label-width="0px"
+              v-model:param="state.file"
+              link="upload"
+              uploadLayout="card"
+              type="img"
+              cardWidth="9rem"
+              cardHeight="9rem"
+              :limit="1"
+            />
+          </el-row>
+        </el-col>
+        <div class="__czr-title_1">
+          管理员账号 <CzrButton type="normal" title="新增" class="ml-auto" />
+        </div>
+        <div class="mt-4 w-full">
+          <CzrTable
+            :data="state.admins.data"
+            :head="state.admins.head"
+            :full="true"
+            no-foot
+            maxHeight="300px"
+          >
+          </CzrTable>
+        </div>
+      </CzrForm>
+    </div>
+  </CzrDialog>
+</template>
+
+<script setup lang="ts">
+import {
+  computed,
+  getCurrentInstance,
+  nextTick,
+  reactive,
+  ref,
+  watch,
+} from 'vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { useAppStore, useDialogStore, useDictionaryStore } from '@/stores'
+import { useRouter } from 'vue-router'
+
+const router = useRouter()
+const AppStore = useAppStore()
+const DictionaryStore = useDictionaryStore()
+const DialogStore = useDialogStore()
+const emit = defineEmits(['update:show', 'refresh'])
+const { proxy } = getCurrentInstance()
+const props = defineProps({
+  show: { default: false },
+  transfer: <any>{},
+})
+const state: any = reactive({
+  loading: false,
+  form: {},
+  file: [],
+  admins: {
+    head: [
+      { value: 'name', label: '账号', show: true },
+      { value: 'name', label: '用户名', show: true },
+      { value: 'name', label: '状态', show: true },
+      {
+        value: 'caozuo',
+        label: '操作',
+        show: true,
+        width: 200,
+        fixed: 'right',
+        popover: false,
+      },
+    ],
+    data: [],
+  },
+})
+const ref_modelConfig = ref()
+const ref_form = ref()
+const titleCpt = computed(() => {
+  let t = '租户信息'
+  switch (props.transfer.mode) {
+    case 'add':
+      t = '创建' + t
+      break
+    case 'edit':
+      t = '编辑' + t
+      break
+    case 'view':
+      t = '查看' + t
+      break
+  }
+  return t
+})
+const isViewCpt = computed(() => props.transfer?.mode === 'view')
+watch(
+  () => props.show,
+  (n) => {
+    if (n) {
+      initDictionary()
+      state.form = {}
+      state.file = []
+      if (props.transfer.mode !== 'add') {
+        initData()
+      }
+      nextTick(() => {
+        ref_form.value.reset()
+      })
+    }
+  },
+)
+const initDictionary = () => {}
+const initData = () => {
+  // state.loading = true
+  // datasetsDetail(props.transfer.id)
+  //   .then(({ data }: any) => {
+  //     state.form = data
+  //     ref_modelConfig.value.init(data)
+  //   })
+  //   .catch(() => {})
+  //   .finally(() => {
+  //     state.loading = false
+  //   })
+}
+const onSubmit = (isImport) => {
+  ref_form.value
+    .submit()
+    .then(() => {
+      DialogStore.confirm({
+        content: `请确认是否${titleCpt.value}?${isImport ? '创建成功后将自动跳转至文档上传页面!' : ''}`,
+        onSubmit: () => {
+          // state.loading = true
+          // if (props.transfer.mode === 'add') {
+          //   datasetsCreate({
+          //     ...state.form,
+          //     ...ref_modelConfig.value.getData(),
+          //   })
+          //     .then(({ data }: any) => {
+          //       ElMessage.success(`${titleCpt.value}成功!`)
+          //       if (isImport) {
+          //         router.push({
+          //           name: '18e6009c-a72c-4359-864b-e7725fccca69',
+          //           params: {
+          //             id: data.id,
+          //           },
+          //         })
+          //       } else {
+          //         emit('update:show', false)
+          //         emit('refresh')
+          //       }
+          //     })
+          //     .catch(() => {})
+          //     .finally(() => {
+          //       state.loading = false
+          //     })
+          // } else {
+          //   datasetsUpdate({
+          //     ...state.form,
+          //     ...ref_modelConfig.value.getData(),
+          //     tenantId: AppStore.tenantInfo?.id,
+          //   })
+          //     .then(({ data }: any) => {
+          //       ElMessage.success(`${titleCpt.value}成功!`)
+          //       emit('update:show', false)
+          //       emit('refresh')
+          //     })
+          //     .catch(() => {})
+          //     .finally(() => {
+          //       state.loading = false
+          //     })
+          // }
+        },
+      })
+    })
+    .catch((e) => {
+      ElMessage({
+        message: e[0].message,
+        grouping: true,
+        type: 'warning',
+      })
+    })
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 103 - 158
src/views/manage/center/tenant/index.vue

@@ -1,7 +1,14 @@
 <template>
-  <div class="bm-main-box">
-    <div class="flex items-center">
-      <div class="ml-auto flex items-center gap-2.5">
+  <CzrContent
+    v-model:tableHead="state.query.head"
+    @handleReset="onReset"
+    @handleSearch="onSearch"
+  >
+    <template #tableTitle>
+      <div class="flex gap-2.5"></div>
+    </template>
+    <template #buttons>
+      <div class="flex items-center gap-2.5">
         <CzrForm class="bm-filter" label-width="0px" @handleEnter="onSearch">
           <CzrFormColumn
             width="19rem"
@@ -14,13 +21,13 @@
             placeholder="租户启用时间"
           />
           <CzrFormColumn
-            width="23rem"
+            width="19rem"
             class="__czr-table-form-column"
             :span="24"
             label-width="0px"
             v-model:param="state.query.form.time2"
-            link="datetime"
-            type="datetimerange"
+            link="date"
+            type="daterange"
             placeholder="租户到期时间"
           />
           <CzrFormColumn
@@ -45,139 +52,50 @@
           <CzrButton type="add" @click="onAdd" />
         </CzrForm>
       </div>
-    </div>
-    <div class="mt-4 flex-1 overflow-hidden" v-loading="state.query.loading">
-      <CzrTableCard
-        class="table-card"
+    </template>
+    <template #table>
+      <CzrTable
+        v-loading="state.query.loading"
+        v-model:data="state.query.result.data"
+        :head="state.query.head"
+        :total="state.query.result.total"
         :page="state.query.page.pageNum"
         :pageSize="state.query.page.pageSize"
-        :total="state.query.result.total"
-        :data="state.query.result.data"
         @handlePage="onPage"
-        :col="4"
+        @handleSort="onSort"
+        v-model:selected="state.query.selected"
       >
-        <template #model="{ row, index }">
-          <div
-            class="model __hover"
-            @click="
-              $router.push({
-                name: 'e16b6e20-4ea1-4160-9624-e775949b0c32',
-                params: {
-                  id: row.id,
-                },
-              })
-            "
-          >
-            <div class="flex">
-              <template v-if="row.icon">
-                <img :src="row.icon" class="mr-2.5 h-[3.25rem] w-[3.25rem]" />
-              </template>
-              <template v-else>
-                <img
-                  src="@/assets/images/app/app-default-logo.png"
-                  class="mr-2.5 h-[3.25rem] w-[3.25rem]"
-                />
-              </template>
-              <div class="flex flex-1 flex-col overflow-hidden">
-                <div class="flex">
-                  <template v-if="row.status == 0">
-                    <div
-                      class="rounded-xs bg-[#A7ADB9] px-2.5 py-1 text-xs text-white"
-                    >
-                      草稿
-                    </div>
-                  </template>
-                  <template v-else-if="row.status == 1">
-                    <div
-                      class="rounded-xs bg-[#5AD8A6] px-2.5 py-1 text-xs text-white"
-                    >
-                      已发布
-                    </div>
-                  </template>
-                  <template v-if="row.type == 0">
-                    <div
-                      class="ml-auto rounded-2xl bg-gradient-to-r from-[#C3E3FC] to-[#86C4FF] px-3 py-1 text-xs text-[#0876FF]"
-                    >
-                      简洁
-                    </div>
-                  </template>
-                  <template v-else-if="row.type == 1">
-                    <div
-                      class="ml-auto rounded-2xl bg-gradient-to-r from-[#E0DAFF] to-[#BABCFF] px-3 py-1 text-xs text-[#1E3F92]"
-                    >
-                      高级
-                    </div>
-                  </template>
-                </div>
-                <div
-                  class="mt-1.5 text-xl font-bold text-[#2E3238]"
-                  style="line-height: 1.3"
-                  v-title
-                >
-                  {{ row.name }}
-                </div>
-              </div>
-            </div>
-            <div
-              class="mt-3 flex items-center gap-2.5 text-[0.75rem] text-[#6F7889]"
-            >
-              <div>{{ row.userNickName }}</div>
-              <div>|</div>
-              <div>{{ YMDHms(row.updateTime) }}</div>
-              <div class="ml-auto">
-                <el-dropdown :teleported="true">
-                  <SvgIcon name="omit" />
-                  <template #dropdown>
-                    <el-dropdown-menu>
-                      <el-dropdown-item @click="onCopy(row)">
-                        创建副本
-                      </el-dropdown-item>
-                      <el-dropdown-item @click="onEdit(row)">
-                        设置
-                      </el-dropdown-item>
-                      <el-dropdown-item @click="onDel(row)">
-                        删除
-                      </el-dropdown-item>
-                      <template v-if="row.status == 1">
-                        <el-dropdown-item @click="onMonitor(row)">
-                          监测
-                        </el-dropdown-item>
-                      </template>
-                    </el-dropdown-menu>
-                  </template>
-                </el-dropdown>
-              </div>
-            </div>
+        <template #caozuo-column-value="{ scope }">
+          <div class="__czr-table-operations">
+            <CzrButton type="table" title="编辑" @click="onEdit(scope.row)" />
+            <CzrButton type="table-del" @click="onDel(scope.row)" />
           </div>
         </template>
-      </CzrTableCard>
-    </div>
-    <!--    <detailCom-->
-    <!--      v-model:show="state.detail.show"-->
-    <!--      :transfer="state.detail.transfer"-->
-    <!--      @refresh="onSearch"-->
-    <!--    />-->
-  </div>
+      </CzrTable>
+    </template>
+  </CzrContent>
+  <detailCom
+    v-model:show="state.detail.show"
+    :transfer="state.detail.transfer"
+    @refresh="onSearch"
+  />
 </template>
 
 <script setup lang="ts">
-import { getCurrentInstance, onMounted, reactive, ref, watch } from 'vue'
+import {
+  computed,
+  getCurrentInstance,
+  onMounted,
+  reactive,
+  ref,
+  watch,
+} from 'vue'
 import { Search } from '@element-plus/icons-vue'
 import { debounce } from 'lodash'
 import { useAppStore, useDialogStore, useDictionaryStore } from '@/stores'
 import { ElMessage } from 'element-plus'
-// import detailCom from './detail.vue'
-import {
-  pluginDel,
-  pluginGetInstanceList,
-  pluginUpdateStatus,
-} from '@/api/modules/model'
-import { YMDHms } from '@/utils/czr-util'
-import SvgIcon from '@/components/SvgIcon/index.vue'
-import { useRouter } from 'vue-router'
-import { appDel, appSearch } from '@/api/modules/app'
+import detailCom from './detail.vue'
 
-const router = useRouter()
 const AppStore = useAppStore()
 const DialogStore = useDialogStore()
 const DictionaryStore = useDictionaryStore()
@@ -189,16 +107,49 @@ const state: any = reactive({
   query: {
     init: false,
     loading: false,
+    head: [
+      { value: 'name', label: '租户名称', show: true },
+      { value: 'name', label: '租户编号', show: true },
+      { value: 'name', label: '用户配额', show: true },
+      { value: 'name', label: '租户状态', show: true },
+      { value: 'name', label: '用户数量', show: true, sort: true },
+      {
+        value: 'createTime',
+        label: '租户启用时间',
+        show: true,
+        width: 180,
+        datetime: true,
+        sort: true,
+      },
+      {
+        value: 'updateTime',
+        label: '租户停用时间',
+        show: true,
+        width: 180,
+        datetime: true,
+        sort: true,
+      },
+      {
+        value: 'caozuo',
+        label: '操作',
+        show: true,
+        width: 200,
+        fixed: 'right',
+        popover: false,
+      },
+    ],
     page: {
       pageNum: 1,
       pageSize: 20,
     },
     form: {},
     formReal: {},
+    sort: {},
     result: {
       total: 0,
       data: [],
     },
+    selected: [],
   },
   detail: {
     show: false,
@@ -223,6 +174,10 @@ watch(
   },
   { deep: true },
 )
+const onSort = ({ key, value }) => {
+  state.query.sort[key] = value
+  onSearch()
+}
 const onPage = (pageNum, pageSize) => {
   setTimeout(() => {
     state.query.init = true
@@ -241,16 +196,20 @@ const onPage = (pageNum, pageSize) => {
       params[k] = v
     }
   }
-  state.query.loading = true
-  appSearch(params)
-    .then(({ data }: any) => {
-      state.query.result.total = data.total
-      state.query.result.data = data.records
-    })
-    .catch(() => {})
-    .finally(() => {
-      state.query.loading = false
-    })
+
+  //  添加排序参数
+  for (const [k, v] of Object.entries(state.query.sort)) {
+  }
+  // state.query.loading = true
+  // appSearch(params)
+  //   .then(({ data }: any) => {
+  //     state.query.result.total = data.total
+  //     state.query.result.data = data.records
+  //   })
+  //   .catch(() => {})
+  //   .finally(() => {
+  //     state.query.loading = false
+  //   })
 }
 const onSearch = () => {
   state.query.formReal = JSON.parse(JSON.stringify(state.query.form))
@@ -262,6 +221,7 @@ const onReset = () => {
     pageSize: 20,
   }
   state.query.form = {}
+  state.query.sort = {}
   onSearch()
 }
 const onAdd = () => {
@@ -270,13 +230,6 @@ const onAdd = () => {
   }
   state.detail.show = true
 }
-const onCopy = (row) => {
-  state.detail.transfer = {
-    mode: 'copy',
-    id: row.id,
-  }
-  state.detail.show = true
-}
 const onEdit = (row) => {
   state.detail.transfer = {
     mode: 'edit',
@@ -289,22 +242,14 @@ const onDel = (row: any) => {
     title: '删除确认',
     content: `请确认是否删除`,
     onSubmit: () => {
-      appDel(row.id)
-        .then(() => {
-          ElMessage.success('删除成功!')
-        })
-        .catch(() => {})
-        .finally(() => {
-          onSearch()
-        })
-    },
-  })
-}
-const onMonitor = (row) => {
-  router.push({
-    name: 'a36ccd46-f399-4bf6-8db9-157ca8d3e8c8',
-    params: {
-      id: row.id,
+      // appDel(row.id)
+      //   .then(() => {
+      //     ElMessage.success('删除成功!')
+      //   })
+      //   .catch(() => {})
+      //   .finally(() => {
+      //     onSearch()
+      //   })
     },
   })
 }

+ 0 - 1
src/views/manage/knowledge/documents/document/index.vue

@@ -67,7 +67,6 @@
             :pageSize="state.query.page.pageSize"
             @handlePage="onPage"
             v-model:selected="state.query.selected"
-            :dragable="true"
           >
             <template #name-column-value="{ scope }">
               <div class="flex justify-center">

+ 1 - 8
vite.config.ts

@@ -56,15 +56,8 @@ export default defineConfig(({ mode, command }) => {
       open: true,
       strictPort: false,
       proxy: {
-        '/dify-api': {
-          target: 'http://1.95.78.201/',
-          changeOrigin: true,
-          rewrite: (path) => {
-            return path.replace(/^\/dify-api/, '')
-          },
-        },
         [env.VITE_BASE_API_PROXY]: {
-          target: 'http://1.95.78.201:18088/',
+          target: 'http://8.130.72.63:18091',
           changeOrigin: true,
           rewrite: (path) => path.replace(env.VITE_BASE_API_PROXY, ''),
         },