CzRger 2 månader sedan
förälder
incheckning
e75618b2e4

+ 2 - 1
src/components/czr-ui/CzrButton.vue

@@ -59,7 +59,8 @@ const props = defineProps({
     margin-right: var(--czr-gap);
   }
   &.del {
-    background: rgba(255, 84, 84, 0.10);
+    background: rgba(255, 84, 84, 0.1);
+    border-color: rgba(255, 84, 84, 1);
     color: #FF5454;
   }
   &._add {

+ 3 - 1
src/components/czr-ui/CzrTable.vue

@@ -236,7 +236,9 @@ const props = defineProps({
   dragable: {
     default: false
   },
-  idKey: 'id',
+  idKey: {
+    default: 'id'
+  },
   showLast: {
     default: true
   }

+ 1 - 1
src/utils/czr-util.ts

@@ -649,7 +649,7 @@ export const extractRgbFromRgba = (rgbaString) => {
   return [46, 129, 255];
 }
 
-export const _console = (p) => console.log(p)
+export const _console = (...p) => console.log(...p)
 
 export const domRootHasAttr = (dom, attr) => {
   if (!dom) {

+ 20 - 19
src/views/manage/knowledge/documents/document/index.vue

@@ -14,7 +14,7 @@
           <CzrButton type="add" title="添加文件"/>
           <CzrButton title="迁移" icon="move"/>
           <CzrButton title="归档" icon="cloud"/>
-          <CzrButton title="删除" icon="czr_del"/>
+          <CzrButton type="del" title="删除" icon="czr_del" @click="onDel()"/>
         </div>
       </template>
       <template #buttons>
@@ -167,17 +167,14 @@ const onPage = (pageNum, pageSize) => {
     for (let i = 1; i <= params.pageSize; i++) {
       const n = (params.pageNum - 1) * params.pageSize + i
       arr.push({
-        p1: '部门知识库-部门知识库-部门知识库-' + n,
-        p2: '王一鸣',
-        p3: '只是一个政务服务事项办事指南',
-        p4: n,
-        p5: '2980k',
-        p6: n % 4,
-        p7: n % 2,
-        tags: n % 2 ? '1,2,3,41,2,3,41,2,3,41,2,3,41,2,3,4' : ''
+        id: i + '',
+        p1: '文件' + n + '.md',
       })
     }
     state.query.result.data = arr
+    // setTimeout(() => {
+    //   state.query.selected = [arr[1], arr[5]]
+    // })
     state.query.loading = false
   }, 1000)
   // state.query.loading = true
@@ -194,6 +191,7 @@ const onPage = (pageNum, pageSize) => {
   // })
 }
 const onSearch = () => {
+  state.query.selected = []
   state.query.formReal = JSON.parse(JSON.stringify(state.query.form))
   onPage(1, state.query.page.pageSize)
 }
@@ -218,15 +216,19 @@ const onEdit = (row) => {
   }
   state.detail.show = true
 }
-const onDel = (row: any) => {
-  DialogStore.confirm({
-    title: '删除确认',
-    content: `是否删除文档:${row.p1}?<br/>此文档下的29个分段都会被删除,请谨慎操作。`,
-    onSubmit: () => {
-      ElMessage.success('删除成功!')
-      onSearch()
-    }
-  })
+const onDel = (row: any = null) => {
+  if (row) {
+    DialogStore.confirm({
+      title: '删除确认',
+      content: `是否删除文档:${row.p1}?<br/>此文档下的29个分段都会被删除,请谨慎操作。`,
+      onSubmit: () => {
+        ElMessage.success('删除成功!')
+        onSearch()
+      }
+    })
+  } else {
+    console.log(state.query.selected)
+  }
 }
 const onRename = (row) => {
   state.rename.transfer = {
@@ -238,7 +240,6 @@ const initDictionary = () => {
   DictionaryStore.initKnowledgeGroups()
 }
 onMounted(() => {
-  console.log(props.knowledge)
   initDictionary()
   onReset()
 })