Merge pull request 'master' (#599) from master into prod
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/599
This commit is contained in:
@@ -160,6 +160,13 @@ export const searchUpdateLedgerData = (projectId) => {
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
//
|
||||
// export const searchUpdateLedgerData = (projectId) => {
|
||||
// return request({
|
||||
// url: '/workflow/mosr/expense/ledger/import',
|
||||
// method: "get"
|
||||
// });
|
||||
// };
|
||||
|
||||
export const exportExcel = (data) => {
|
||||
return axios.post(
|
||||
|
||||
@@ -432,7 +432,6 @@ onMounted(() => {
|
||||
// }
|
||||
})
|
||||
|
||||
console.log("propsprops", props.formData, props.type , props)
|
||||
if (props.formData.mode == 'view' && props.type == 'execute') {
|
||||
handleSearchImplementationFileList()
|
||||
getTagsOption()
|
||||
|
||||
95
src/components/ImportExcel.vue
Normal file
95
src/components/ImportExcel.vue
Normal file
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<el-upload :action="uploadFileUrl"
|
||||
:headers="headers"
|
||||
:limit="maxSize"
|
||||
with-credentials
|
||||
:multiple="multiple"
|
||||
:data="uploadParams"
|
||||
:auto-upload="true"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="handleUploadSuccess"
|
||||
:on-error="uploadError"
|
||||
:before-remove="beforeRemove"
|
||||
:on-remove="handleRemove"
|
||||
>
|
||||
<el-button color="#DED0B2" style="margin-left: 10px; margin-right: 10px;" :loading="loading" :disabled="disabled">导入</el-button>
|
||||
</el-upload>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessageBox, ElNotification} from "element-plus";
|
||||
import {getToken} from '@/utils/auth'
|
||||
|
||||
const baseURL = import.meta.env.VITE_BASE_URL
|
||||
const uploadFileUrl = ref(baseURL + "/workflow/mosr/expense/ledger/import")
|
||||
const headers = reactive({
|
||||
authorization: getToken()
|
||||
})
|
||||
const loading = ref(false)
|
||||
const uploadParams = ref({})
|
||||
const props = defineProps({
|
||||
value: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return []
|
||||
}
|
||||
},
|
||||
maxSize: {
|
||||
type: Number,
|
||||
default: 30
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
|
||||
const emit = defineEmits(["input", "getFile", "delete"])
|
||||
const beforeRemove = (file) => {
|
||||
return ElMessageBox.confirm(`确认删除名称为${file.name}的文件吗?`, '系统提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => true)
|
||||
}
|
||||
|
||||
const handleRemove = (file) => {
|
||||
emit("delete", file.response.data.id)
|
||||
}
|
||||
const beforeUpload = () => {
|
||||
loading.value = true
|
||||
return true
|
||||
}
|
||||
const handleUploadSuccess = (res) => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.code === 1000 ? '上传成功' : '上传失败',
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
loading.value = false
|
||||
emit("success")
|
||||
}
|
||||
const uploadError = (error) => {
|
||||
loading.value = false
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: "上传失败,请稍后再试!",
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
defineExpose({
|
||||
handleRemove
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
a {
|
||||
font-size: 14px;
|
||||
color: #2a99ff;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -17,7 +17,13 @@
|
||||
</el-form>
|
||||
<fvForm :schema="schema" @getInstance="(e)=>baseForm = e"></fvForm>
|
||||
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
|
||||
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick" @selectionChange="selectionChange">
|
||||
<div style="display: flex">
|
||||
<el-button color="#DED0B2" @click="exportExcelHandler">导出</el-button>
|
||||
<import-excel v-if="buttonShow" @success="importTheExpenseLedger"/>
|
||||
<el-button color="#DED0B2" v-if="buttonShow" @click="handleUploadFee">上传费用</el-button>
|
||||
<el-button color="#DED0B2" v-if="buttonShow" @click="handleUpdateTable">表格更新</el-button>
|
||||
</div>
|
||||
<fvTable ref="tableIns" :tableConfig="tableConfig" @selectionChange="selectionChange">
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据"/>
|
||||
</template>
|
||||
@@ -31,6 +37,7 @@ import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
||||
import {toThousands} from '@/utils/changePrice.js'
|
||||
import {getBaseInfoApi} from "@/components/steps/api";
|
||||
import {searchUpdateLedgerData, exportExcel} from "@/api/project-manage";
|
||||
// import ImportExcel from "../../../components/ImportExcel";
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
@@ -88,6 +95,7 @@ const formDataArray = ref([
|
||||
}
|
||||
}
|
||||
])
|
||||
const buttonShow = ref(false)
|
||||
const schema = computed(() => {
|
||||
return formDataArray.value
|
||||
})
|
||||
@@ -218,7 +226,7 @@ const tableConfig = reactive({
|
||||
params: {
|
||||
projectId: route.query.id
|
||||
},
|
||||
btns: btns.value
|
||||
// btns: btns.value
|
||||
})
|
||||
// const exportIds=ref([])
|
||||
const selectionChange = (data) => {
|
||||
@@ -241,12 +249,17 @@ const getBaseInfo = async () => {
|
||||
}
|
||||
}
|
||||
const init = async () => {
|
||||
buttonShow.value = false
|
||||
const {code, msg, data} = await searchUpdateLedgerData(route.query.id)
|
||||
if (code === 1000) {
|
||||
tableData.value = data
|
||||
if(!data.view){
|
||||
btns.value.push({name: '上传费用', key: 'add', color: '#DED0B2', auth: ''},{name: '表格更新', key: 'update', color: '#DED0B2', auth: ''},)
|
||||
}
|
||||
nextTick(() => {
|
||||
buttonShow.value = !data.view
|
||||
})
|
||||
// if (!data.view) {
|
||||
// btns.value.push({name: '上传费用', key: 'add', color: '#DED0B2', auth: ''},
|
||||
// {name: '表格更新', key: 'update', color: '#DED0B2', auth: ''})
|
||||
// }
|
||||
baseForm.value.setValues(data)
|
||||
}
|
||||
// if (code !== 1000) {
|
||||
@@ -259,18 +272,8 @@ const init = async () => {
|
||||
}
|
||||
getBaseInfo()
|
||||
init()
|
||||
const headBtnClick = (key) => {
|
||||
switch (key) {
|
||||
case 'add':
|
||||
handleUploadFee()
|
||||
break;
|
||||
case 'update':
|
||||
handleUpdateTable()
|
||||
break;
|
||||
case 'export':
|
||||
exportExcelHandler()
|
||||
break;
|
||||
}
|
||||
const importTheExpenseLedger = () => {
|
||||
tableIns.value.refresh()
|
||||
}
|
||||
const handleUploadFee = () => {
|
||||
router.push({
|
||||
|
||||
Reference in New Issue
Block a user