liudong
2024-07-25 bd82158c1ef6b3f71115bfc1d5fe77fb7c9287db
src/views/dmx/knowledgeLib/index.vue
@@ -46,79 +46,9 @@
                          <!--            新建-->
                          <add />
                        </a-col>
                        <!--              <a-col :span="8">-->
                        <!--                <a-form-item field="name" :label="$t('searchTable.form.name')">-->
                        <!--                  <a-input-->
                        <!--                    v-model="formModel.name"-->
                        <!--                    :placeholder="$t('searchTable.form.name.placeholder')"-->
                        <!--                  />-->
                        <!--                </a-form-item>-->
                        <!--              </a-col>-->
                        <!--              <a-col :span="8">-->
                        <!--                <a-form-item-->
                        <!--                  field="contentType"-->
                        <!--                  :label="$t('searchTable.form.contentType')"-->
                        <!--                >-->
                        <!--                  <a-select-->
                        <!--                    v-model="formModel.contentType"-->
                        <!--                    :options="contentTypeOptions"-->
                        <!--                    :placeholder="$t('searchTable.form.selectDefault')"-->
                        <!--                  />-->
                        <!--                </a-form-item>-->
                        <!--              </a-col>-->
                        <!--              <a-col :span="8">-->
                        <!--                <a-form-item-->
                        <!--                  field="filterType"-->
                        <!--                  :label="$t('searchTable.form.filterType')"-->
                        <!--                >-->
                        <!--                  <a-select-->
                        <!--                    v-model="formModel.filterType"-->
                        <!--                    :options="filterTypeOptions"-->
                        <!--                    :placeholder="$t('searchTable.form.selectDefault')"-->
                        <!--                  />-->
                        <!--                </a-form-item>-->
                        <!--              </a-col>-->
                        <!--              <a-col :span="8">-->
                        <!--                <a-form-item-->
                        <!--                  field="createdTime"-->
                        <!--                  :label="$t('searchTable.form.createdTime')"-->
                        <!--                >-->
                        <!--                  <a-range-picker-->
                        <!--                    v-model="formModel.createdTime"-->
                        <!--                    style="width: 100%"-->
                        <!--                  />-->
                        <!--                </a-form-item>-->
                        <!--              </a-col>-->
                        <!--              <a-col :span="8">-->
                        <!--                <a-form-item-->
                        <!--                  field="status"-->
                        <!--                  :label="$t('searchTable.form.status')"-->
                        <!--                >-->
                        <!--                  <a-select-->
                        <!--                    v-model="formModel.status"-->
                        <!--                    :options="statusOptions"-->
                        <!--                    :placeholder="$t('searchTable.form.selectDefault')"-->
                        <!--                  />-->
                        <!--                </a-form-item>-->
                        <!--              </a-col>-->
                      </a-row>
                    </a-form>
                  </a-col>
                  <!--                <a-divider style="height: 40px" direction="vertical" />-->
                  <!--                <a-col :flex="'200px'" style="text-align: right">-->
                  <!--                  <a-button @click="reset" style="margin-right: 20px">-->
                  <!--                    <template #icon>-->
                  <!--                      <icon-refresh />-->
                  <!--                    </template>-->
                  <!--                    {{ $t('searchTable.form.reset') }}-->
                  <!--                  </a-button>-->
                  <!--                  <a-button type="primary" @click="search">-->
                  <!--                    <template #icon>-->
                  <!--                      <icon-search />-->
                  <!--                    </template>-->
                  <!--                    {{ $t('searchTable.form.search') }}-->
                  <!--                  </a-button>-->
                  <!--                </a-col>-->
                </a-row>
                <a-divider style="margin-top: 0" />
                <a-row style="margin-bottom: 16px">
@@ -217,51 +147,67 @@
                  :scroll="{ y: 580 }"
                >
                  <template #contentType="{ record }">
                    <a-space>
                      <a-avatar
                        v-if="record.contentType === 'img'"
                        :size="16"
                        shape="square"
                      >
                        <img
                          alt="avatar"
                          src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/581b17753093199839f2e327e726b157.svg~tplv-49unhts6dw-image.image"
                        />
                      </a-avatar>
                      <a-avatar
                        v-else-if="record.contentType === 'horizontalVideo'"
                        :size="16"
                        shape="square"
                      >
                        <img
                          alt="avatar"
                          src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/77721e365eb2ab786c889682cbc721c1.svg~tplv-49unhts6dw-image.image"
                        />
                      </a-avatar>
                      <a-avatar v-else :size="16" shape="square">
                        <img
                          alt="avatar"
                          src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/ea8b09190046da0ea7e070d83c5d1731.svg~tplv-49unhts6dw-image.image"
                        />
                      </a-avatar>
                      {{ $t(`searchTable.form.contentType.${record.contentType}`) }}
                    </a-space>
                  </template>
                  <template #filterType="{ record }">
                    {{ $t(`searchTable.form.filterType.${record.filterType}`) }}
                  <template #staue="{ record }">
                    <a-switch :model-value="record.staue"/>
                  </template>
                  <template #status="{ record }">
                    <span v-if="record.status === 'offline'" class="circle"></span>
                    <span v-else class="circle pass"></span>
                    {{ $t(`searchTable.form.status.${record.status}`) }}
                    <div style="display: flex;align-items: center;">
                      <div style="width: 100px">
                        <a-popover title="Title">
                          <a-tag :color="'blue'" border>成功</a-tag>
                          <template #content>
                            <p>Here is the text content</p>
                          </template>
                        </a-popover>
                        <a-popover title="Title">
                          <a-tag :color="'gold'" border>取消</a-tag>
                          <template #content>
                            <p>Here is the text content</p>
                          </template>
                        </a-popover>
                        <a-popover title="Title">
                          <a-tag :color="'green'" border>未启动</a-tag>
                          <template #content>
                            <p>Here is the text content</p>
                          </template>
                        </a-popover>
                      </div>
                      <div>
                        <a-button type="text" size="large">
                          <template #icon>
                            <icon-sync />
                          </template>
                        </a-button>
                        <a-button type="text" size="large">
                          <template #icon>
                            <icon-sync style="color: green" />
                          </template>
                        </a-button>
                        <a-button type="text" size="large">
                          <template #icon>
                            <icon-play-circle style="color: green" />
                          </template>
                        </a-button>
                      </div>
                    </div>
                  </template>
                  <template #operations="{ record }">
                    <tool/>
                    <edit/>
                    <a-popconfirm content="确定删除吗?" type="warning" @ok="deleteItem(record)">
                      <a-button v-permission="['admin']" type="text" size="small">
                        {{ $t('删除') }}
                        <template #icon>
                          <icon-delete />
                        </template>
                      </a-button>
                    </a-popconfirm>
                    <a-button type="text" size="small">
                      <template #icon>
                        <icon-download />
                      </template>
                    </a-button>
                  </template>
                </a-table>
              </a-card>
@@ -294,9 +240,11 @@
  import cloneDeep from 'lodash/cloneDeep';
  import Sortable from 'sortablejs';
  import add from '@/views/dmx/knowledgeLib/add.vue'
  import edit from '@/views/dmx/knowledgeLib/edit.vue'
  import addKnow from '@/views/dmx/knowledgeLib/addKnow.vue'
  import config from '@/views/dmx/knowledgeLib/config.vue'
  import test from '@/views/dmx/knowledgeLib/test.vue'
  import tool from '@/views/dmx/knowledgeLib/tool.vue'
  import { deleteAccount } from "@/api/account";
  type SizeProps = 'mini' | 'small' | 'medium' | 'large';
  type Column = TableColumnData & { checked?: true };
@@ -317,7 +265,6 @@
  const formModel = ref(generateFormModel());
  const cloneColumns = ref<Column[]>([]);
  const showColumns = ref<Column[]>([]);
  const edit = ref('add');
  const size = ref<SizeProps>('medium');
  let visible = ref(false)
@@ -354,11 +301,6 @@
    },
  ]);
  const columns = computed<TableColumnData[]>(() => [
    // {
    //   title: t('序号'),
    //   dataIndex: 'index',
    //   slotName: 'index',
    // },
    {
      title: t('名称'),
      dataIndex: 'name',
@@ -381,9 +323,21 @@
      dataIndex: 'createdTime',
    },
    {
      title: t('启用'),
      dataIndex: 'staue',
      slotName: 'staue',
    },
    {
      title: t('解析状态'),
      dataIndex: 'status',
      slotName: 'status',
    },
    {
      title: t('操作'),
      dataIndex: 'operations',
      slotName: 'operations',
      width: 150,
      minWidth: 100,
    },
  ]);
  const contentTypeOptions = computed<SelectOptionData[]>(() => [
@@ -427,7 +381,7 @@
    try {
      const { data } = await queryPolicyList(params);
      renderData.value = data.list;
      console.log(renderData);
      console.log(renderData, 'renderData');
      pagination.current = params.current;
      pagination.total = data.total;
    } catch (err) {