8
0
ZaiZai 1 rok pred
rodič
commit
aa0a08653a

+ 1 - 1
src/layout/modules/mainBody.vue

@@ -28,7 +28,7 @@ watch(() => useRoutes?.name, (name) => {
 })
 
 //判断数据
-const routes = ['/certificate/management']
+const routes = ['/certificate/management', '/certificate/list']
 const isPadding = ref(true)
 const setBarRoutesData = (name) => {
     isPadding.value = routes.indexOf(name) === -1

+ 17 - 3
src/views/certificate/list.vue

@@ -1,5 +1,5 @@
 <template>
-    <hc-new-card>
+    <hc-new-card id-ref="hc-certificate-list" div-p="12px">
         <template #header>
             <div class="w-100">
                 <el-select v-model="searchForm.projectId" filterable block placeholder="选择项目" @change="searchClick">
@@ -24,6 +24,10 @@
         <template #action>
             <hc-pages :pages="searchForm" @change="pageChange" />
         </template>
+        <!-- 查看 -->
+        <hc-new-drawer v-model="isRowDrawer" to-id="hc-certificate-list">
+            <HcListForm v-if="isRowDrawer" :info="tableRowItem" @close="isRowDrawer = false" />
+        </hc-new-drawer>
     </hc-new-card>
 </template>
 
@@ -31,6 +35,7 @@
 import { nextTick, onActivated, ref } from 'vue'
 import { getArrValue } from 'js-fast-way'
 import { delMessage } from '~uti/tools'
+import HcListForm from './modules/list/form.vue'
 import adminApi from '~api/certificate/admin'
 import mainApi from '~api/certificate/list'
 
@@ -98,14 +103,23 @@ const getTableData = async () => {
     }
 }
 
+const isRowDrawer = ref(false)
+const tableRowItem = ref({})
+
 //新增
 const addClick = () => {
-
+    tableRowItem.value = {}
+    nextTick(() => {
+        isRowDrawer.value = true
+    })
 }
 
 //修改
 const editRowClick = (row) => {
-
+    tableRowItem.value = row
+    nextTick(() => {
+        isRowDrawer.value = true
+    })
 }
 
 //注册

+ 21 - 9
src/views/certificate/modules/list/form.vue

@@ -1,6 +1,13 @@
 <template>
-    <hc-new-card>
-        11111
+    <hc-new-card :title="rowItem.id ? '编辑证书' : '新增证书'">
+        22213
+
+        <template #action>
+            <div class="hc-flex-center">
+                <el-button hc-btn class="mr-4" @click="cancelClick">取消</el-button>
+                <el-button hc-btn type="primary">提交</el-button>
+            </div>
+        </template>
     </hc-new-card>
 </template>
 
@@ -11,15 +18,16 @@ import adminApi from '~api/certificate/admin'
 import mainApi from '~api/certificate/list'
 
 const props = defineProps({
-    cid: {
-        type: [String, Number],
-        default: '',
+    info: {
+        type: Object,
+        default: () => ({}),
     },
 })
 
+const emit = defineEmits(['close'])
+
 //监听内容
-const contractId = ref(props.cid)
-const currentId = ref(props.cid)
+const rowItem = ref(props.info)
 
 //渲染完成
 onMounted(() => {
@@ -28,7 +36,11 @@ onMounted(() => {
 
 //获取数据
 const getDataApi = () => {
-    if (isNullES(contractId.value)) return
-    console.log('contractId', contractId.value)
+    console.log('rowItem:', rowItem.value)
+}
+
+//取消关闭
+const cancelClick = () => {
+    emit('close')
 }
 </script>