|
|
|
@ -67,7 +67,10 @@
|
|
|
|
|
<div class="contenttwo">
|
|
|
|
|
<div class="descriptionsdiv">
|
|
|
|
|
<el-table :data="tableData" style="width: 98%">
|
|
|
|
|
<el-table-column prop="id" label="序号" width="200">
|
|
|
|
|
<el-table-column label="序号" width="200">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ (pagination.currentPage - 1) * pagination.pageSize + scope.$index + 1 }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="name" label="企业名称" width="300">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
@ -91,16 +94,24 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" width="200" align="center">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button v-if="scope.row.isEditing" size="mini" type="text" icon="el-icon-check" @click="saveRow(scope.row)">保存</el-button>
|
|
|
|
|
<el-button v-else size="mini" type="text" icon="el-icon-edit" @click="editRow(scope.row)">编辑</el-button>
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-delete" style="color: #F25353;" @click="deleteRow(scope.$index)">删除</el-button>
|
|
|
|
|
<el-button v-if="scope.row.isEditing" size="mini" type="text" icon="el-icon-check"
|
|
|
|
|
@click="saveRow(scope.row)">保存</el-button>
|
|
|
|
|
<el-button v-else size="mini" type="text" icon="el-icon-edit"
|
|
|
|
|
@click="editRow(scope.row)">编辑</el-button>
|
|
|
|
|
<el-button size="mini" type="text" icon="el-icon-delete" style="color: #F25353;"
|
|
|
|
|
@click="deleteRow(scope.$index)">删除</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<div class="block">
|
|
|
|
|
<div style="visibility: hidden;"></div>
|
|
|
|
|
<el-pagination :current-page="4" :page-sizes="[100, 200, 300, 400]" :page-size="100"
|
|
|
|
|
layout="total, prev, pager, next, jumper" :total="400">
|
|
|
|
|
<el-pagination
|
|
|
|
|
:current-page="pagination.currentPage"
|
|
|
|
|
:page-sizes="[10, 20, 50, 100]"
|
|
|
|
|
:page-size="pagination.pageSize"
|
|
|
|
|
layout="total, prev, pager, next, jumper"
|
|
|
|
|
:total="pagination.total"
|
|
|
|
|
@current-change="handleCurrentChange"
|
|
|
|
|
@size-change="handleSizeChange">
|
|
|
|
|
</el-pagination>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -109,13 +120,10 @@
|
|
|
|
|
<el-dialog title="数据导入" :visible.sync="upload.open" width="400px" append-to-body :close-on-click-modal="false">
|
|
|
|
|
<el-upload ref="upload" :limit="1" accept=".xlsx,.xls" :headers="upload.headers" :action="upload.url"
|
|
|
|
|
:disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess"
|
|
|
|
|
:auto-upload="false" drag>
|
|
|
|
|
:auto-upload="false" :data="upload.data" drag>
|
|
|
|
|
<i class="el-icon-upload"></i>
|
|
|
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
|
|
<div class="el-upload__tip text-center" slot="tip">
|
|
|
|
|
<!-- <div class="el-upload__tip" slot="tip">
|
|
|
|
|
<el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据
|
|
|
|
|
</div> -->
|
|
|
|
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
|
|
<el-link type="primary" :underline="false" style="font-size: 12px; vertical-align: baseline"
|
|
|
|
|
@click="importTemplate">下载模板</el-link>
|
|
|
|
@ -136,7 +144,7 @@
|
|
|
|
|
<script>
|
|
|
|
|
import { getToken } from "@/utils/auth";
|
|
|
|
|
import { download } from "@/utils/request";
|
|
|
|
|
import { getqyBasicInformationById, updateqyBasicInformation, deleteqyBasicInformation } from "@/api/ManageApi/index";
|
|
|
|
|
import { getqyBasicInformationPage, updateqyBasicInformation, deleteqyBasicInformation } from "@/api/ManageApi/index";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
@ -157,6 +165,10 @@ export default {
|
|
|
|
|
action: {
|
|
|
|
|
type: String,
|
|
|
|
|
required: true
|
|
|
|
|
},
|
|
|
|
|
xmId: {
|
|
|
|
|
type: Number,
|
|
|
|
|
required: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
@ -166,18 +178,27 @@ export default {
|
|
|
|
|
...this.qyrzInfo
|
|
|
|
|
},
|
|
|
|
|
tableData: [], // 初始化为空数组
|
|
|
|
|
pagination: {
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
total: 0
|
|
|
|
|
},
|
|
|
|
|
upload: {
|
|
|
|
|
open: false,
|
|
|
|
|
isUploading: false,
|
|
|
|
|
updateSupport: 0,
|
|
|
|
|
headers: {
|
|
|
|
|
Authorization: "Bearer " + getToken()
|
|
|
|
|
Authorization: "Bearer " + getToken(),
|
|
|
|
|
},
|
|
|
|
|
url: process.env.VUE_APP_BASE_API + "/api/enterprise/import"
|
|
|
|
|
url: process.env.VUE_APP_BASE_API + "/gysl/enterprise/importEnterprise",
|
|
|
|
|
data: {
|
|
|
|
|
xmId: this.xmId
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
console.log('xmId:', this.xmId);
|
|
|
|
|
this.fetchTableData();
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
@ -192,11 +213,19 @@ export default {
|
|
|
|
|
methods: {
|
|
|
|
|
// 获取表格数据
|
|
|
|
|
fetchTableData() {
|
|
|
|
|
getqyBasicInformationById().then(response => {
|
|
|
|
|
const params = {
|
|
|
|
|
xmId: this.xmId,
|
|
|
|
|
current: this.pagination.currentPage,
|
|
|
|
|
size: this.pagination.pageSize
|
|
|
|
|
};
|
|
|
|
|
getqyBasicInformationPage(params).then(response => {
|
|
|
|
|
console.log('Fetched Data:', response.data.records); // 调试信息
|
|
|
|
|
this.tableData = response.data.records.map(item => ({
|
|
|
|
|
...item,
|
|
|
|
|
isEditing: false
|
|
|
|
|
}));
|
|
|
|
|
console.log('Table Data:', this.tableData); // 调试信息
|
|
|
|
|
this.pagination.total = response.data.total; // 设置总记录数
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
console.error('获取数据失败:', error);
|
|
|
|
|
});
|
|
|
|
@ -211,7 +240,7 @@ export default {
|
|
|
|
|
...this.form,
|
|
|
|
|
rzqys: Number(this.form.rzqys),
|
|
|
|
|
rysl: Number(this.form.rysl),
|
|
|
|
|
rzl: Number(this.form.rzl),
|
|
|
|
|
rzl: Number(this.form.r0zl),
|
|
|
|
|
yczmj: Number(this.form.yczmj),
|
|
|
|
|
kzczmj: Number(this.form.kzczmj),
|
|
|
|
|
gycfpjzj: Number(this.form.gycfpjzj),
|
|
|
|
@ -236,10 +265,12 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
deleteRow(index) {
|
|
|
|
|
this.tableData.splice(index, 1);
|
|
|
|
|
// 这里可以调用删除接口,将删除的数据发送到服务器
|
|
|
|
|
deleteqyBasicInformation([this.tableData[index].id]).then(response => {
|
|
|
|
|
const id = this.tableData[index].id;
|
|
|
|
|
deleteqyBasicInformation([id]).then(response => {
|
|
|
|
|
this.$modal.msgSuccess('删除成功');
|
|
|
|
|
this.tableData.splice(index, 1);
|
|
|
|
|
// 重新获取表格数据以确保分页正确
|
|
|
|
|
this.fetchTableData();
|
|
|
|
|
}).catch(error => {
|
|
|
|
|
console.error('删除失败:', error);
|
|
|
|
|
this.$modal.msgError('删除失败');
|
|
|
|
@ -269,6 +300,8 @@ export default {
|
|
|
|
|
|
|
|
|
|
if (response.code === 200) {
|
|
|
|
|
this.$modal.msgSuccess(response.msg);
|
|
|
|
|
// 重新获取表格数据
|
|
|
|
|
this.fetchTableData();
|
|
|
|
|
this.$emit("refresh-data"); // 通知父组件刷新
|
|
|
|
|
} else {
|
|
|
|
|
this.$modal.msgError(response.msg || "导入失败");
|
|
|
|
@ -279,7 +312,22 @@ export default {
|
|
|
|
|
this.$modal.msgWarning("请先选择文件");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
this.$refs.upload.submit();
|
|
|
|
|
// 将 xmId 添加到请求参数中
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append('file', this.$refs.upload.uploadFiles[0].raw);
|
|
|
|
|
formData.append('xmId', this.upload.data.xmId);
|
|
|
|
|
|
|
|
|
|
this.$refs.upload.submit(formData); // 提交表单数据
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 分页处理
|
|
|
|
|
handleCurrentChange(page) {
|
|
|
|
|
this.pagination.currentPage = page;
|
|
|
|
|
this.fetchTableData();
|
|
|
|
|
},
|
|
|
|
|
handleSizeChange(size) {
|
|
|
|
|
this.pagination.pageSize = size;
|
|
|
|
|
this.fetchTableData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|