|
@@ -1,56 +1,56 @@
|
|
|
-
|
|
|
<template>
|
|
|
- <HcCard>
|
|
|
- <template #extra>
|
|
|
- <el-button hc-btn type="primary" @click="uoloadNewRule">上传新制度</el-button>
|
|
|
- </template>
|
|
|
- <HcTable :column="tableColumn" :datas="tableData" :tableLoading="tableLoading">
|
|
|
- <template #name="{row}">
|
|
|
- <div class="text-link text-blue" @click="viewPdf(row)">{{row?.name}}</div>
|
|
|
+ <HcCard>
|
|
|
+ <template #extra>
|
|
|
+ <el-button hc-btn type="primary" @click="addUploadFile">上传新制度</el-button>
|
|
|
+ </template>
|
|
|
+ <HcTable :column="tableColumn" :datas="tableData" :tableLoading="tableLoading">
|
|
|
+ <template #originalName="{row}">
|
|
|
+ <div class="text-link text-blue" @click="viewPdf(row)">{{ row?.originalName }}</div>
|
|
|
</template>
|
|
|
<template #action="{row, index}">
|
|
|
- <el-button hc-btn type="primary" size="small" @click="replaceUoload">重新上传</el-button>
|
|
|
+ <el-button hc-btn type="primary" size="small" @click="replaceUploadFile(row)">重新上传</el-button>
|
|
|
</template>
|
|
|
- </HcTable>
|
|
|
- <template #action>
|
|
|
- <HcPages :pages="searchForm" @change="pageChange"></HcPages>
|
|
|
- </template>
|
|
|
- <HcUploadFile
|
|
|
- :echoParams="uploadEchoParams"
|
|
|
- ref="HcUploadFileRef"
|
|
|
- :options="UploadFileOptions"
|
|
|
- @progress="HcUploadFileProgress"
|
|
|
- @success="HcUploadFileSuccess"
|
|
|
- @change="HcUploadFileChange"
|
|
|
- :url="'/blade-resource/oss/endpoint/upload-file'"
|
|
|
- >
|
|
|
- </HcUploadFile>
|
|
|
- </HcCard>
|
|
|
+ </HcTable>
|
|
|
+ <template #action>
|
|
|
+ <HcPages :pages="searchForm" @change="pageChange"/>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!--上传组件-->
|
|
|
+ <HcUploadFile ref="uploadFileRef" :options="uploadOptions" :params="uploadParams" @success="uploadFileSuccess"/>
|
|
|
+ </HcCard>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import {ref, watch,onActivated} from 'vue'
|
|
|
+import {ref, onActivated} from 'vue'
|
|
|
import {getTokenHeader} from "~src/api/request/header";
|
|
|
-import companyRuleApi from '~api/people/companyRule.js';
|
|
|
-import {getArrValue,getObjValue} from "js-fast-way"
|
|
|
-onActivated(()=>{
|
|
|
+import mainApi from '~api/people/companyRule.js';
|
|
|
+import {getArrValue} from "js-fast-way"
|
|
|
+
|
|
|
+onActivated(() => {
|
|
|
getTableData()
|
|
|
-
|
|
|
})
|
|
|
+
|
|
|
+const searchForm = ref({
|
|
|
+ current: 1, size: 20, total: 0
|
|
|
+})
|
|
|
+//分页被点击
|
|
|
+const pageChange = ({current, size}) => {
|
|
|
+ searchForm.value.current = current
|
|
|
+ searchForm.value.size = size
|
|
|
+}
|
|
|
+
|
|
|
+//表格数据
|
|
|
const tableColumn = [
|
|
|
- {key: 'name', name: '制度名称'},
|
|
|
+ {key: 'originalName', name: '制度名称'},
|
|
|
{key: 'action', name: '操作', width: 120}
|
|
|
-
|
|
|
]
|
|
|
-const tableData = ref([
|
|
|
- {name: '名称1',},
|
|
|
- {name: '名称2', },
|
|
|
- {name: '名称3', }
|
|
|
-])
|
|
|
-const tableLoading=ref(false)
|
|
|
-const getTableData = async() => {
|
|
|
+const tableData = ref([])
|
|
|
+
|
|
|
+//获取表格数据
|
|
|
+const tableLoading = ref(false)
|
|
|
+const getTableData = async () => {
|
|
|
tableLoading.value = true
|
|
|
- const {error, code, data} = await companyRuleApi.getPage(searchForm.value)
|
|
|
+ const {error, code, data} = await mainApi.getPage(searchForm.value)
|
|
|
tableLoading.value = false
|
|
|
if (!error && code === 200) {
|
|
|
tableData.value = getArrValue(data['records'])
|
|
@@ -60,82 +60,40 @@ const getTableData = async() => {
|
|
|
searchForm.value.total = 0
|
|
|
}
|
|
|
}
|
|
|
-const searchForm = ref({
|
|
|
- current: 1, size: 20, total: 0
|
|
|
-})
|
|
|
-//分页被点击
|
|
|
-const pageChange = ({current, size}) => {
|
|
|
- searchForm.value.current = current
|
|
|
- searchForm.value.size = size
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
//上传配置
|
|
|
-const HcUploadFileRef=ref(null)
|
|
|
-const uploadEchoParams = ref({})
|
|
|
-const UploadFileOptions = {
|
|
|
- // 此处设置header
|
|
|
+const uploadFileRef = ref(null)
|
|
|
+const uploadParams = ref({})
|
|
|
+const uploadOptions = {
|
|
|
+ url: '/api/blade-control/corporationinfo/put-corporationinfo',
|
|
|
headers: getTokenHeader(),
|
|
|
+ multiple: false,
|
|
|
+ size: 50
|
|
|
}
|
|
|
|
|
|
-// 文件上传进度
|
|
|
-const HcUploadFileProgress = (res) => {
|
|
|
- console.log('文件上传进度', res)
|
|
|
-}
|
|
|
-// 文件上传成功的回调
|
|
|
-const fileData=ref({})
|
|
|
-const HcUploadFileSuccess = ({echoParams, resData}) => {
|
|
|
- fileData.value= getObjValue(resData)
|
|
|
- HcUploadFileRef.value?.setModalShow(false);
|
|
|
- const {name, index} = echoParams
|
|
|
- if(name==='newRule'){
|
|
|
- addRule(resData)
|
|
|
- }
|
|
|
+//新增上传
|
|
|
+const addUploadFile = () => {
|
|
|
+ uploadParams.value = {}
|
|
|
+ uploadFileRef.value?.selectFile();
|
|
|
}
|
|
|
|
|
|
-//新增制度
|
|
|
-const addRuleLoaing=ref(false)
|
|
|
-const addRule=async(resData)=>{
|
|
|
-console.log(resData,'res');
|
|
|
-addRuleLoaing.value=true
|
|
|
-const {error, code, data,msg} = await companyRuleApi.save(
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-)
|
|
|
-
|
|
|
-addRuleLoaing.value = false
|
|
|
- if (!error && code === 200) {
|
|
|
- window.$message.success(msg)
|
|
|
- getTableData().then
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
-// 文件全部上传成功
|
|
|
-const HcUploadFileChange = () => {
|
|
|
- console.log('文件全部上传成功')
|
|
|
+//重新上传
|
|
|
+const replaceUploadFile = (row) => {
|
|
|
+ uploadParams.value = {id: row.id}
|
|
|
+ uploadFileRef.value?.selectFile();
|
|
|
}
|
|
|
-//上传新制度
|
|
|
-const uoloadNewRule=()=>{
|
|
|
- HcUploadFileRef.value?.selectFile();
|
|
|
- uploadEchoParams.value = {
|
|
|
- name: 'newRule',
|
|
|
- }
|
|
|
-}
|
|
|
-//上传新制度
|
|
|
-const replaceUoload=()=>{
|
|
|
- HcUploadFileRef.value?.selectFile();
|
|
|
- uploadEchoParams.value = {
|
|
|
- name: 'replace',
|
|
|
- }
|
|
|
+
|
|
|
+//上传完成
|
|
|
+const uploadFileSuccess = (res) => {
|
|
|
+ uploadFileRef.value?.setModalShow(false);
|
|
|
+ getTableData()
|
|
|
}
|
|
|
+
|
|
|
//查看pdf
|
|
|
- const viewPdf=(row)=>{
|
|
|
+const viewPdf = (row) => {
|
|
|
window.open(row?.link, '_blank')
|
|
|
- }
|
|
|
+}
|
|
|
</script>
|
|
|
<style lang='scss' scoped>
|
|
|
-</style>
|
|
|
+
|
|
|
+</style>
|