|
|
|
@ -8,6 +8,8 @@ |
|
|
|
|
<el-form-item> |
|
|
|
|
<el-button type="primary" size="medium" icon="el-icon-search" @click="findAll(1)">查询</el-button> |
|
|
|
|
<el-button type="primary" size="medium" icon="el-icon-plus" @click="openAddWin">新增</el-button> |
|
|
|
|
<el-button type="primary" size="medium" @click="dowBtn">下载模板</el-button> |
|
|
|
|
<el-button type="primary" size="medium" @click="upFileBtn">批量上传</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
</div> |
|
|
|
@ -20,6 +22,7 @@ |
|
|
|
|
style="width: 100%"> |
|
|
|
|
<!-- <el-table-column prop="userId" label="编号" width="150"></el-table-column> --> |
|
|
|
|
<el-table-column label="序号" type="index" width="70" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="userNum" label="人员编码"></el-table-column> |
|
|
|
|
<el-table-column prop="userName" label="人员姓名"></el-table-column> |
|
|
|
|
<el-table-column prop="phone" label="手机号" width="130"></el-table-column> |
|
|
|
|
<el-table-column prop="identityNumber" label="证件号" width="180"></el-table-column> |
|
|
|
@ -55,14 +58,10 @@ |
|
|
|
|
> |
|
|
|
|
<div class="fakeLine"></div> |
|
|
|
|
<el-form :model="addForm" ref="addForm" :rules="addRules" style="padding: 20px" label-width="111px"> |
|
|
|
|
<el-form-item label="人员编码:" prop="userNum"> |
|
|
|
|
<el-input v-model.trim="addForm.userNum" clearable maxlength="50"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="人员名称:" prop="memberId"> |
|
|
|
|
<!-- <el-select |
|
|
|
|
style="width: 100%" |
|
|
|
|
v-model="addForm.memberId"> |
|
|
|
|
<el-option v-for="(item,index) in nameList" :key="index" |
|
|
|
|
:label="item.label" :value="item.id" |
|
|
|
|
></el-option> |
|
|
|
|
</el-select> --> |
|
|
|
|
<el-input v-model.trim="addForm.memberId" clearable maxlength="50"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="手机号:" prop="phone"> |
|
|
|
@ -90,10 +89,61 @@ |
|
|
|
|
<el-button size="medium" type="primary" @click="saveCommodity('addForm')">确认</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
<el-dialog |
|
|
|
|
title="附件上传" |
|
|
|
|
class="parseWinStyle scanDialogClass" |
|
|
|
|
width="500px" |
|
|
|
|
:visible.sync="showModal" |
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
:close-on-press-escape="false" |
|
|
|
|
> |
|
|
|
|
<el-form |
|
|
|
|
style="margin: 50px" |
|
|
|
|
class="importFileForm" |
|
|
|
|
ref="importFile" |
|
|
|
|
:model="importFile" |
|
|
|
|
:rules="importFileRules" |
|
|
|
|
label-width="90px" |
|
|
|
|
> |
|
|
|
|
<el-form-item label="附件上传" prop="fileList"> |
|
|
|
|
<el-upload |
|
|
|
|
action="" |
|
|
|
|
ref="uploadFile" |
|
|
|
|
:auto-upload="false" |
|
|
|
|
:on-change="fileChange" |
|
|
|
|
:on-remove="fileRemove" |
|
|
|
|
:file-list="importFile.fileList" |
|
|
|
|
:limit="1" |
|
|
|
|
:on-exceed="handleExceed" |
|
|
|
|
> |
|
|
|
|
<el-button class="btn-cancel importBtn" |
|
|
|
|
><i class="el-icon-upload2" style="font-size: 16px;"></i> |
|
|
|
|
上传文件</el-button |
|
|
|
|
> |
|
|
|
|
<span v-if="importFile.fileList.length === 0">未选取文件</span> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button size="medium" class="btn-cancel" @click="cancelSave" :loading="tipModaSureBtnloading" |
|
|
|
|
>取消</el-button |
|
|
|
|
> |
|
|
|
|
<el-button |
|
|
|
|
size="medium" type="primary" |
|
|
|
|
class="btn-confirm" |
|
|
|
|
:disabled="disabledImport" |
|
|
|
|
:loading="tipModaSureBtnloading" |
|
|
|
|
@click="importFileConfirm" |
|
|
|
|
><i class="el-icon-loading" v-if="disabledImport"></i>确认</el-button |
|
|
|
|
> |
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
<script> |
|
|
|
|
import api from '@/api/rules'; |
|
|
|
|
import axios from "axios"; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: 'taxType', |
|
|
|
@ -125,6 +175,21 @@ |
|
|
|
|
}, 100) |
|
|
|
|
}; |
|
|
|
|
return { |
|
|
|
|
showModal:false, |
|
|
|
|
tipModaSureBtnloading:false, |
|
|
|
|
disabledImport: false, //上传防重复点击 |
|
|
|
|
disabledDownload:false, |
|
|
|
|
showTipModal:false, |
|
|
|
|
importFile: { |
|
|
|
|
fileType:'', |
|
|
|
|
fileList: [] //文件导入 |
|
|
|
|
}, |
|
|
|
|
errorTip:false, |
|
|
|
|
importFileRules: { |
|
|
|
|
fileList: [ |
|
|
|
|
{ required: true, message: "请选择导入文件", trigger: "change" } |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
token: '', |
|
|
|
|
formInline: { |
|
|
|
|
user: '', |
|
|
|
@ -137,6 +202,7 @@ |
|
|
|
|
addTitle: '新增', |
|
|
|
|
addForm: { |
|
|
|
|
memberId: '', |
|
|
|
|
userNum:'', |
|
|
|
|
company: [], |
|
|
|
|
enterpriseName: [], |
|
|
|
|
phone: '', // 手机号 |
|
|
|
@ -144,6 +210,7 @@ |
|
|
|
|
userId: '', |
|
|
|
|
}, |
|
|
|
|
addRules: { |
|
|
|
|
userNum: [{required: true, message: '人员编码不能为空', trigger: 'blur'}], |
|
|
|
|
memberId: [{required: true, message: '人员名称不能为空', trigger: 'blur'}], |
|
|
|
|
company: [{required: true, message: '可报销企业不能为空', trigger: 'blur'}], |
|
|
|
|
phone: [ |
|
|
|
@ -297,11 +364,11 @@ |
|
|
|
|
'token': this.token |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
this.$refs[form].validate((valid) => { |
|
|
|
|
if (valid) { |
|
|
|
|
let params = { |
|
|
|
|
userName: this.addForm.memberId, |
|
|
|
|
userNum: this.addForm.userNum, |
|
|
|
|
enterpriseCodeList: this.addForm.company.join(','), |
|
|
|
|
enterpriseNameList: this.addForm.enterpriseName.join(','), |
|
|
|
|
phone: this.addForm.phone, |
|
|
|
@ -330,6 +397,80 @@ |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
fileChange(file, fileList) { |
|
|
|
|
this.importFile.fileList = fileList; |
|
|
|
|
this.$refs.importFile.clearValidate(); |
|
|
|
|
}, |
|
|
|
|
//导入基础信息-删除文件 |
|
|
|
|
fileRemove(file, fileList) { |
|
|
|
|
this.importFile.fileList = []; |
|
|
|
|
}, |
|
|
|
|
//导入基础信息-文件超出个数限制时的钩子 |
|
|
|
|
handleExceed() { |
|
|
|
|
this.$message.warning("一次只可导入一个文件"); |
|
|
|
|
}, |
|
|
|
|
//导入基础信息-确定-上传文件格式校验 |
|
|
|
|
importFileVerify() { |
|
|
|
|
const file = this.importFile.fileList[0]; |
|
|
|
|
const fileFormat = file.name.substring(file.name.lastIndexOf(".") + 1); |
|
|
|
|
const allowedExtensions = ['xls', 'xlsx']; |
|
|
|
|
const extension = allowedExtensions.includes(fileFormat); |
|
|
|
|
if (!extension) { |
|
|
|
|
throw new Error("上传文件只能是Excel 格式!"); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
//导入基础信息-确定 |
|
|
|
|
importFileConfirm() { |
|
|
|
|
this.$refs["importFile"].validate(valid => { |
|
|
|
|
if (valid) { |
|
|
|
|
try { |
|
|
|
|
this.importFileVerify(); |
|
|
|
|
this.importFileRequest(); |
|
|
|
|
} catch (e) { |
|
|
|
|
this.$message.warning(e.message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//导入基础信息-确定-调接口 |
|
|
|
|
importFileRequest() { |
|
|
|
|
this.disabledDownload = true; |
|
|
|
|
const file = this.importFile.fileList[0].raw; |
|
|
|
|
console.log(this.importFile.fileList) |
|
|
|
|
let formData = new FormData(); |
|
|
|
|
formData.append("file", file); |
|
|
|
|
api.importUserInfoExcelApi(formData, { |
|
|
|
|
headers: { |
|
|
|
|
'Content-Type': 'multipart/form-data' |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.then(r => { |
|
|
|
|
console.log(r) |
|
|
|
|
if(r.data.code == '0000'){ |
|
|
|
|
this.tipModaSureBtnloading = false |
|
|
|
|
this.$message.success(r.data.message); |
|
|
|
|
this.findAll(1) |
|
|
|
|
this.showModal = false |
|
|
|
|
}else { |
|
|
|
|
this.$message.error(r.data.message); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
cancelSave() { |
|
|
|
|
this.$confirm('是否放弃操作?', '提示', { |
|
|
|
|
type: 'warning', |
|
|
|
|
center: true |
|
|
|
|
}).then(() => { |
|
|
|
|
this.showModal = false; |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
tipModaSureBtn(){ |
|
|
|
|
this.showTipModal = false |
|
|
|
|
this.showModal = false |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
maxTableHeight() { |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
let self = this; |
|
|
|
@ -356,12 +497,44 @@ |
|
|
|
|
this.addTitle = '新增'; |
|
|
|
|
this.addWin = true; |
|
|
|
|
}, |
|
|
|
|
dowBtn() { |
|
|
|
|
axios.get('/web/orgUser/getUserInfoModel', { |
|
|
|
|
responseType: 'blob' |
|
|
|
|
}).then(response => { |
|
|
|
|
console.log('Response data type:', response.data.type); // 检查 blob 的类型 |
|
|
|
|
console.log('Response data size:', response.data.size); // 检查 blob 的大小 |
|
|
|
|
|
|
|
|
|
// 创建 Blob 对象并设置正确的 MIME 类型 |
|
|
|
|
const blob = new Blob([response.data], { type: 'application/vnd.ms-excel' }); |
|
|
|
|
|
|
|
|
|
// 创建 URL 并创建下载链接 |
|
|
|
|
const url = window.URL.createObjectURL(blob); |
|
|
|
|
const a = document.createElement('a'); |
|
|
|
|
a.href = url; |
|
|
|
|
let fileName = '人员模板.xlsx'; |
|
|
|
|
a.download = fileName; // 可以根据需要设置文件名 |
|
|
|
|
|
|
|
|
|
// 触发下载 |
|
|
|
|
document.body.appendChild(a); // 将下载链接添加到 DOM |
|
|
|
|
a.click(); // 触发点击事件 |
|
|
|
|
document.body.removeChild(a); // 移除下载链接 |
|
|
|
|
|
|
|
|
|
// 确保点击事件完成后才清理 URL |
|
|
|
|
setTimeout(() => { |
|
|
|
|
window.URL.revokeObjectURL(url); // 清理 |
|
|
|
|
}, 100); |
|
|
|
|
}).catch(error => { |
|
|
|
|
console.error('Error downloading file:', error); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
handleEdit(data) { |
|
|
|
|
this.addTitle = '编辑'; |
|
|
|
|
this.addWin = true; |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.addForm = { |
|
|
|
|
id: data.id, |
|
|
|
|
userNum: this.addForm.userNum, |
|
|
|
|
// memberId: data.id, |
|
|
|
|
// code: data.taxNo, |
|
|
|
|
// phone: data.phone, |
|
|
|
@ -378,6 +551,10 @@ |
|
|
|
|
}; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
upFileBtn(){ |
|
|
|
|
this.importFile.fileList = []; |
|
|
|
|
this.showModal=true; |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|