修改回显bug
This commit is contained in:
@ -20,26 +20,26 @@
|
||||
<el-button type="primary" @click="toggleExpandAll(false)">一键收起</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-upload ref="uploadRef" class="upload-demo" :http-request="importExcel" :show-file-list="false">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
class="upload-demo"
|
||||
:http-request="importExcel"
|
||||
:show-file-list="false"
|
||||
v-hasPermi="['tender:billofquantitiesLimitList:importExcelFile']"
|
||||
>
|
||||
<template #trigger>
|
||||
<el-button type="primary">导入excel</el-button>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleExport()" v-hasPermi="['tender:billofquantitiesLimitList:export']">导出excel</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</transition>
|
||||
<el-card shadow="never" class="mb8">
|
||||
<el-table
|
||||
ref="tableRef"
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
row-key="id"
|
||||
border
|
||||
lazy
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
default-expand-all
|
||||
>
|
||||
<el-table ref="tableRef" v-loading="loading" :data="tableData" row-key="id" border lazy default-expand-all>
|
||||
<el-table-column prop="num" label="编号" />
|
||||
<el-table-column prop="name" label="工程或费用名称" />
|
||||
<el-table-column prop="unit" label="单位" />
|
||||
@ -63,8 +63,13 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="price" label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" size="small" @click="handleSave(scope.row)" v-if="scope.row.quantity && scope.row.quantity != 0"
|
||||
>确定</el-button
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="handleSave(scope.row)"
|
||||
v-if="scope.row.quantity && scope.row.quantity != 0"
|
||||
v-hasPermi="['tender:billofquantitiesLimitList:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -75,7 +80,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useUserStoreHook } from '@/store/modules/user';
|
||||
import { listBillofquantitiesLimitList, obtainAllVersionNumbers, sheetList, updatePrice } from '@/api/contract/index';
|
||||
import { listBillofquantitiesLimitList, obtainAllVersionNumbers, sheetList, updatePrice, importExcelFile } from '@/api/contract/index';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const userStore = useUserStoreHook();
|
||||
@ -180,6 +185,7 @@ const getTableData = async () => {
|
||||
type: 'error'
|
||||
});
|
||||
tableData.value = [];
|
||||
loading.value = false;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
@ -221,31 +227,25 @@ const toggleExpandAll = (isExpand: boolean) => {
|
||||
};
|
||||
//导入
|
||||
const importExcel = (options: any): any => {
|
||||
console.log(options);
|
||||
// let formData = new FormData();
|
||||
// formData.append('file', options.file);
|
||||
// state.loading.list = true;
|
||||
// importExcelFile({ workOrderType: state.work_order_type, projectId: currentProject.value?.id }, formData)
|
||||
// .then((res) => {
|
||||
// const { code } = res;
|
||||
// if (code == 200) {
|
||||
// proxy.$modal.msgSuccess(res.msg || '导入成功');
|
||||
// // 更新列表
|
||||
// if (state.work_order_type == 3) {
|
||||
// getVersionNums(false);
|
||||
// } else {
|
||||
// getVersionNums();
|
||||
// }
|
||||
// } else {
|
||||
// proxy.$modal.msgError(res.msg || '导入失败');
|
||||
// }
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// proxy.$modal.msgError(err.msg || '导入失败');
|
||||
// })
|
||||
// .finally(() => {
|
||||
// state.loading.list = false;
|
||||
// });
|
||||
let formData = new FormData();
|
||||
formData.append('file', options.file);
|
||||
loading.value = true;
|
||||
importExcelFile({ projectId: currentProject.value?.id }, formData)
|
||||
.then((res) => {
|
||||
const { code } = res;
|
||||
if (code == 200) {
|
||||
proxy.$modal.msgSuccess(res.msg || '导入成功');
|
||||
getTableData();
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg || '导入失败');
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
proxy.$modal.msgError(err.msg || '导入失败');
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
//监听项目id刷新数据
|
||||
const listeningProject = watch(
|
||||
@ -254,7 +254,16 @@ const listeningProject = watch(
|
||||
getVersionNums();
|
||||
}
|
||||
);
|
||||
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'/tender/billofquantitiesLimitList/export',
|
||||
{
|
||||
projectId: currentProject.value?.id,
|
||||
sheet: queryForm.value.sheet
|
||||
},
|
||||
`限价一览表${queryForm.value.sheet}.xlsx`
|
||||
);
|
||||
};
|
||||
onUnmounted(() => {
|
||||
listeningProject();
|
||||
});
|
||||
|
Reference in New Issue
Block a user