|
@@ -1,48 +1,55 @@
|
|
<template>
|
|
<template>
|
|
<HcCard title="公司制度数据">
|
|
<HcCard title="公司制度数据">
|
|
<template #extra>
|
|
<template #extra>
|
|
- <el-button hc-btn type="primary" @click="addUploadFile">上传新制度</el-button>
|
|
|
|
|
|
+ <el-button hc-btn type="primary" @click="addUploadFile">
|
|
|
|
+ 上传新制度
|
|
|
|
+ </el-button>
|
|
</template>
|
|
</template>
|
|
- <HcTable :column="tableColumn" :datas="tableData" :tableLoading="tableLoading">
|
|
|
|
- <template #originalName="{row}">
|
|
|
|
- <div class="text-link text-blue" @click="viewPdf(row)">{{ row?.originalName }}</div>
|
|
|
|
|
|
+ <HcTable :column="tableColumn" :datas="tableData" :table-loading="tableLoading">
|
|
|
|
+ <template #originalName="{ row }">
|
|
|
|
+ <div class="text-link text-blue" @click="viewPdf(row)">
|
|
|
|
+ {{ row?.originalName }}
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
- <template #action="{row, index}">
|
|
|
|
- <el-button type="primary" size="small" @click="replaceUploadFile(row)">重新上传</el-button>
|
|
|
|
|
|
+ <template #action="{ row, index }">
|
|
|
|
+ <el-button type="primary" size="small" @click="replaceUploadFile(row)">
|
|
|
|
+ 重新上传
|
|
|
|
+ </el-button>
|
|
</template>
|
|
</template>
|
|
</HcTable>
|
|
</HcTable>
|
|
<template #action>
|
|
<template #action>
|
|
- <HcPages :pages="searchForm" @change="pageChange"/>
|
|
|
|
|
|
+ <HcPages :pages="searchForm" @change="pageChange" />
|
|
</template>
|
|
</template>
|
|
|
|
|
|
- <!--上传组件-->
|
|
|
|
- <HcUploadFile ref="uploadFileRef" :options="uploadOptions" :params="uploadParams" @success="uploadFileSuccess"/>
|
|
|
|
|
|
+ <!-- 上传组件 -->
|
|
|
|
+ <HcUploadFile ref="uploadFileRef" :options="uploadOptions" :params="uploadParams" @success="uploadFileSuccess" />
|
|
</HcCard>
|
|
</HcCard>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import {ref, onActivated} from 'vue'
|
|
|
|
-import {getTokenHeader} from "~src/api/request/header";
|
|
|
|
-import mainApi from '~api/people/companyRule.js';
|
|
|
|
-import {getArrValue} from "js-fast-way"
|
|
|
|
|
|
+import { onActivated, ref } from 'vue'
|
|
|
|
+import { getTokenHeader } from '~src/api/request/header'
|
|
|
|
+import mainApi from '~api/people/companyRule.js'
|
|
|
|
+import { getArrValue } from 'js-fast-way'
|
|
|
|
|
|
onActivated(() => {
|
|
onActivated(() => {
|
|
getTableData()
|
|
getTableData()
|
|
})
|
|
})
|
|
|
|
|
|
const searchForm = ref({
|
|
const searchForm = ref({
|
|
- current: 1, size: 20, total: 0
|
|
|
|
|
|
+ current: 1, size: 20, total: 0,
|
|
})
|
|
})
|
|
//分页被点击
|
|
//分页被点击
|
|
-const pageChange = ({current, size}) => {
|
|
|
|
|
|
+const pageChange = ({ current, size }) => {
|
|
searchForm.value.current = current
|
|
searchForm.value.current = current
|
|
searchForm.value.size = size
|
|
searchForm.value.size = size
|
|
|
|
+ getTableData()
|
|
}
|
|
}
|
|
|
|
|
|
//表格数据
|
|
//表格数据
|
|
const tableColumn = [
|
|
const tableColumn = [
|
|
- {key: 'originalName', name: '制度名称'},
|
|
|
|
- {key: 'action', name: '操作', width: 120}
|
|
|
|
|
|
+ { key: 'originalName', name: '制度名称' },
|
|
|
|
+ { key: 'action', name: '操作', width: 120 },
|
|
]
|
|
]
|
|
const tableData = ref([])
|
|
const tableData = ref([])
|
|
|
|
|
|
@@ -50,7 +57,7 @@ const tableData = ref([])
|
|
const tableLoading = ref(false)
|
|
const tableLoading = ref(false)
|
|
const getTableData = async () => {
|
|
const getTableData = async () => {
|
|
tableLoading.value = true
|
|
tableLoading.value = true
|
|
- const {error, code, data} = await mainApi.getPage(searchForm.value)
|
|
|
|
|
|
+ const { error, code, data } = await mainApi.getPage(searchForm.value)
|
|
tableLoading.value = false
|
|
tableLoading.value = false
|
|
if (!error && code === 200) {
|
|
if (!error && code === 200) {
|
|
tableData.value = getArrValue(data['records'])
|
|
tableData.value = getArrValue(data['records'])
|
|
@@ -68,29 +75,29 @@ const uploadOptions = {
|
|
url: '/api/blade-control/corporationinfo/put-corporationinfo',
|
|
url: '/api/blade-control/corporationinfo/put-corporationinfo',
|
|
headers: getTokenHeader(),
|
|
headers: getTokenHeader(),
|
|
multiple: false,
|
|
multiple: false,
|
|
- size: 50
|
|
|
|
|
|
+ size: 50,
|
|
}
|
|
}
|
|
|
|
|
|
//新增上传
|
|
//新增上传
|
|
const addUploadFile = () => {
|
|
const addUploadFile = () => {
|
|
uploadParams.value = {}
|
|
uploadParams.value = {}
|
|
- uploadFileRef.value?.selectFile();
|
|
|
|
|
|
+ uploadFileRef.value?.selectFile()
|
|
}
|
|
}
|
|
|
|
|
|
//重新上传
|
|
//重新上传
|
|
const replaceUploadFile = (row) => {
|
|
const replaceUploadFile = (row) => {
|
|
- uploadParams.value = {id: row.id}
|
|
|
|
- uploadFileRef.value?.selectFile();
|
|
|
|
|
|
+ uploadParams.value = { id: row.id }
|
|
|
|
+ uploadFileRef.value?.selectFile()
|
|
}
|
|
}
|
|
|
|
|
|
//上传完成
|
|
//上传完成
|
|
const uploadFileSuccess = (res) => {
|
|
const uploadFileSuccess = (res) => {
|
|
- uploadFileRef.value?.setModalShow(false);
|
|
|
|
|
|
+ uploadFileRef.value?.setModalShow(false)
|
|
getTableData()
|
|
getTableData()
|
|
}
|
|
}
|
|
|
|
|
|
//查看pdf
|
|
//查看pdf
|
|
-const viewPdf = ({link}) => {
|
|
|
|
|
|
+const viewPdf = ({ link }) => {
|
|
if (link) {
|
|
if (link) {
|
|
window.open(link, '_blank')
|
|
window.open(link, '_blank')
|
|
} else {
|
|
} else {
|
|
@@ -98,6 +105,7 @@ const viewPdf = ({link}) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
+
|
|
<style lang='scss' scoped>
|
|
<style lang='scss' scoped>
|
|
|
|
|
|
</style>
|
|
</style>
|