Browse Source

删除员工档案

duy 2 years ago
parent
commit
ebf5d82c8e
1 changed files with 74 additions and 70 deletions
  1. 74 70
      src/views/people/archive/index.vue

+ 74 - 70
src/views/people/archive/index.vue

@@ -7,59 +7,63 @@
                 </el-select>
             </div>
             <div class="ml-4">
-                <el-button type="primary" @click="searchClick" size="large">
-                    <HcIcon name="search-2"/>
+                <el-button type="primary" size="large" @click="searchClick">
+                    <HcIcon name="search-2" />
                     <span>搜索</span>
                 </el-button>
             </div>
             <div class="ml-2">
                 <el-button size="large" @click="resetClick">
-                    <HcIcon name="close-circle"/>
+                    <HcIcon name="close-circle" />
                     <span>重置</span>
                 </el-button>
             </div>
         </template>
         <HcTable :loading="tableLoading" :column="tableColumn" :datas="tableData">
-            <template #conFileUrl="{row}">
+            <template #conFileUrl="{ row }">
                 <span class="text-blue text-hover" @click="rowViewPdf(row.conFileUrl)">
-                    {{getFileName(row.conFileUrl)}}
+                    {{ getFileName(row.conFileUrl) }}
                 </span>
             </template>
-            <template #carAimgUrl="{row}">
+            <template #carAimgUrl="{ row }">
                 <span class="text-blue text-hover" @click="rowViewImg(row.carAimgUrl)">
-                    {{getFileName(row.carAimgUrl)}}
+                    {{ getFileName(row.carAimgUrl) }}
                 </span>
             </template>
-            <template #carBimgUrl="{row}">
+            <template #carBimgUrl="{ row }">
                 <span class="text-blue text-hover" @click="rowViewImg(row.carBimgUrl)">
-                    {{getFileName(row.carBimgUrl)}}
+                    {{ getFileName(row.carBimgUrl) }}
                 </span>
             </template>
-            <template #userImgUrl="{row}">
+            <template #userImgUrl="{ row }">
                 <span class="text-blue text-hover" @click="rowViewImg(row.userImgUrl)">
-                    {{getFileName(row.userImgUrl)}}
+                    {{ getFileName(row.userImgUrl) }}
                 </span>
             </template>
-            <template #action="{row, index}">
-                <el-button type="primary" size="small" @click="editRowClick(row)">编辑</el-button>
-                <el-button type="danger" size="small" @click="delRowClick(row)">删除</el-button>
+            <template #action="{ row, index }">
+                <el-button type="primary" size="small" @click="editRowClick(row)">
+                    编辑
+                </el-button>
+                <el-button type="danger" size="small" @click="delRowClick(row)">
+                    删除
+                </el-button>
             </template>
         </HcTable>
         <template #action>
-            <HcPages :pages="searchForm" @change="pageChange"/>
+            <HcPages :pages="searchForm" @change="pageChange" />
         </template>
-        <!--预览图片-->
-        <el-image-viewer v-if="showViewer" :initial-index="initialIndex" :url-list="previewFileList" @close="showViewerClose"/>
+        <!-- 预览图片 -->
+        <el-image-viewer v-if="showViewer" :initial-index="initialIndex" :url-list="previewFileList" @close="showViewerClose" />
     </HcCard>
 </template>
 
 <script setup>
-import {onActivated, ref} from 'vue'
-import mainApi from "~api/people/archive";
-import {useRouter} from 'vue-router'
-import {getuserList} from "~api/other";
-import {getArrValue} from "js-fast-way";
-import {delMessage, getFileName} from "~uti/tools";
+import { onActivated, ref } from 'vue'
+import mainApi from '~api/people/archive'
+import { useRouter } from 'vue-router'
+import { getuserList } from '~api/other'
+import { getArrValue } from 'js-fast-way'
+import { delMessage, getFileName } from '~uti/tools'
 
 const router = useRouter()
 
@@ -71,28 +75,28 @@ onActivated(() => {
 //获取用户下拉数据
 const userList = ref([])
 const getuserListApi = async () => {
-    const {data} = await getuserList()
+    const { data } = await getuserList()
     userList.value = getArrValue(data)
 }
 
 const searchForm = ref({
     type: 1, userId: null,
-    current: 1, size: 20, total: 0
+    current: 1, size: 20, total: 0,
 })
 
 //搜索
 const searchClick = () => {
-    searchForm.value.current = 1;
+    searchForm.value.current = 1
     getTableData()
 }
 
 //重置搜索表单
 const resetClick = () => {
-    searchForm.value = {current: 1, size: 20, total: 0}
+    searchForm.value = { current: 1, size: 20, total: 0 }
 }
 
 //分页被点击
-const pageChange = ({current, size}) => {
+const pageChange = ({ current, size }) => {
     searchForm.value.current = current
     searchForm.value.size = size
     getTableData()
@@ -101,53 +105,53 @@ const pageChange = ({current, size}) => {
 //表格参数
 const tableLoading = ref(false)
 const tableColumn = [
-    {key: 'name', name: '姓名', width: 100},
-    {key: 'email', name: '邮箱', width: 120},
-    {key: 'deptName', name: '部门', width: 120},
-    {key: 'leaderName', name: '直属主管', width: 100},
-    {key: 'postName', name: '职位', width: 120},
-    {key: 'phone', name: '手机号', width: 120},
-    {key: 'entryTime', name: '入职时间', width: 120},
-    {key: 'cyear', name: '司龄', width: 100},
-    {key: 'userTypeName', name: '员工类型', width: 100},
-    {key: 'userStatusName', name: '员工状态', width: 100},
-    {key: 'periodMoth', name: '试用期', width: 100},
-    {key: 'idNumber', name: '身份证号码', width: 120},
-    {key: 'carName', name: '身份证姓名', width: 120},
-    {key: 'birthday', name: '出生日期', width: 120},
-    {key: 'userAge', name: '年龄', width: 90},
-    {key: 'sexName', name: '性别', width: 90},
-    {key: 'nation', name: '民族', width: 90},
-    {key: 'carAddr', name: '身份证地址', width: 120},
-    {key: 'marriageStatusName', name: '婚姻状况', width: 100},
-    {key: 'domicileAddr', name: '户籍', width: 100},
-    {key: 'politicalName', name: '政治面貌', width: 100},
-    {key: 'educationName', name: '学历', width: 100},
-    {key: 'speciality', name: '专业', width: 100},
-    {key: 'bankNum', name: '银行卡号', width: 120},
-    {key: 'bankName', name: '开户行', width: 120},
-    {key: 'conTypeName', name: '合同类型', width: 120},
-    {key: 'conStartDate', name: '合同开始日期', width: 120},
-    {key: 'conEndDate', name: '合同结束日期', width: 120},
-    {key: 'renewalCount', name: '续签次数', width: 100},
-    {key: 'conYear', name: '合同期限', width: 100},
-    {key: 'conFileUrl', name: '合同附件', width: 120},
-    {key: 'emergencyName', name: '紧急联系人姓名', width: 130},
-    {key: 'emergencyPhone', name: '联系人电话', width: 120},
-    {key: 'emergencyRelation', name: '联系人关系', width: 100},
-    {key: 'carAimgUrl', name: '身份证(人面像)', width: 120},
-    {key: 'carBimgUrl', name: '身份证(国徽)', width: 120},
-    {key: 'userImgUrl', name: '员工照片', width: 120},
-    {key: 'action', name: '操作', width: 145, align: 'center', fixed: 'right'},
+    { key: 'name', name: '姓名', width: 100 },
+    { key: 'email', name: '邮箱', width: 120 },
+    { key: 'deptName', name: '部门', width: 120 },
+    { key: 'leaderName', name: '直属主管', width: 100 },
+    { key: 'postName', name: '职位', width: 120 },
+    { key: 'phone', name: '手机号', width: 120 },
+    { key: 'entryTime', name: '入职时间', width: 120 },
+    { key: 'cyear', name: '司龄', width: 100 },
+    { key: 'userTypeName', name: '员工类型', width: 100 },
+    { key: 'userStatusName', name: '员工状态', width: 100 },
+    { key: 'periodMoth', name: '试用期', width: 100 },
+    { key: 'idNumber', name: '身份证号码', width: 120 },
+    { key: 'carName', name: '身份证姓名', width: 120 },
+    { key: 'birthday', name: '出生日期', width: 120 },
+    { key: 'userAge', name: '年龄', width: 90 },
+    { key: 'sexName', name: '性别', width: 90 },
+    { key: 'nation', name: '民族', width: 90 },
+    { key: 'carAddr', name: '身份证地址', width: 120 },
+    { key: 'marriageStatusName', name: '婚姻状况', width: 100 },
+    { key: 'domicileAddr', name: '户籍', width: 100 },
+    { key: 'politicalName', name: '政治面貌', width: 100 },
+    { key: 'educationName', name: '学历', width: 100 },
+    { key: 'speciality', name: '专业', width: 100 },
+    { key: 'bankNum', name: '银行卡号', width: 120 },
+    { key: 'bankName', name: '开户行', width: 120 },
+    { key: 'conTypeName', name: '合同类型', width: 120 },
+    { key: 'conStartDate', name: '合同开始日期', width: 120 },
+    { key: 'conEndDate', name: '合同结束日期', width: 120 },
+    { key: 'renewalCount', name: '续签次数', width: 100 },
+    { key: 'conYear', name: '合同期限', width: 100 },
+    { key: 'conFileUrl', name: '合同附件', width: 120 },
+    { key: 'emergencyName', name: '紧急联系人姓名', width: 130 },
+    { key: 'emergencyPhone', name: '联系人电话', width: 120 },
+    { key: 'emergencyRelation', name: '联系人关系', width: 100 },
+    { key: 'carAimgUrl', name: '身份证(人面像)', width: 120 },
+    { key: 'carBimgUrl', name: '身份证(国徽)', width: 120 },
+    { key: 'userImgUrl', name: '员工照片', width: 120 },
+    { key: 'action', name: '操作', width: 145, align: 'center', fixed: 'right' },
 ]
 
 //获取表格数据
 const tableData = ref([
-    {id:1}
+    { id:1 },
 ])
 const getTableData = async () => {
     tableLoading.value = true
-    const {data} = await mainApi.page(searchForm.value)
+    const { data } = await mainApi.page(searchForm.value)
     tableLoading.value = false
     tableData.value = getArrValue(data['records'])
     searchForm.value.total = data['total'] || 0
@@ -157,14 +161,14 @@ const getTableData = async () => {
 const editRowClick = (row) => {
     router.push({
         name: 'people-archive-info',
-        query: {id: row.id}
+        query: { id: row.id },
     })
 }
 
 //删除
 const delRowClick = (row) => {
     delMessage(async () => {
-        const {error, code, msg} = await mainApi.remove({ids: row.id})
+        const { error, code, msg } = await mainApi.remove(row.id)
         if (!error && code === 200) {
             window.$message?.success(msg)
             getTableData().then()