| | |
| | | @click="handleDelete" |
| | | >删 除 |
| | | </el-button> |
| | | <el-button |
| | | type="success" |
| | | size="small" |
| | | plain |
| | | icon="el-icon-upload2" |
| | | @click="handleImport" |
| | | >批量导入 |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog |
| | | title="枪支导入" |
| | | append-to-body |
| | | :visible.sync="excelBox" |
| | | width="555px" |
| | | > |
| | | <avue-form |
| | | :option="excelOption" |
| | | v-model="excelForm" |
| | | :upload-after="uploadAfter" |
| | | > |
| | | <template slot="excelTemplate"> |
| | | <el-button type="primary" @click="handleTemplate"> |
| | | 点击下载<i class="el-icon-download el-icon--right"></i> |
| | | </el-button> |
| | | </template> |
| | | </avue-form> |
| | | </el-dialog> |
| | | </div> |
| | | </basic-container> |
| | | </template> |
| | |
| | | data() { |
| | | return { |
| | | loading: true, |
| | | excelBox: false, |
| | | excelForm: {}, |
| | | excelOption: { |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | column: [ |
| | | { |
| | | label: "文件上传", |
| | | prop: "excelFile", |
| | | type: "upload", |
| | | drag: true, |
| | | loadText: "文件上传中,请稍等", |
| | | span: 24, |
| | | propsHttp: { |
| | | res: "data", |
| | | }, |
| | | tip: "请上传 .xls,.xlsx 标准格式文件", |
| | | action: "/api/gun/import-gun?deptId=" + this.deptIds, |
| | | }, |
| | | { |
| | | label: "模板下载", |
| | | prop: "excelTemplate", |
| | | formslot: true, |
| | | span: 24, |
| | | }, |
| | | ], |
| | | }, |
| | | deptIds:"", |
| | | selectionList: [], |
| | | page: { |
| | | pageSize: 10, |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | handleImport() { |
| | | this.excelBox = true; |
| | | }, |
| | | uploadAfter(res, done, loading, column) { |
| | | window.console.log(column); |
| | | this.excelBox = false; |
| | | this.refreshChange(); |
| | | done(); |
| | | }, |
| | | handleTemplate() { |
| | | window.open(`/api/gun/export-template-gun`); |
| | | }, |
| | | sizeChange(val) { |
| | | this.page1.currentPage = 1; |
| | | this.page1.pageSize = val; |
| | | this.getData(); |
| | | // this.$message.success("行数" + val); |
| | | }, |
| | | currentChange(val) { |
| | | this.page1.currentPage = val; |
| | | this.getData(); |
| | | // this.$message.success("页码" + val); |
| | | }, |
| | | rowSave(form, done, loading) { |
| | | var that = this; |
| | | // var form = this.data[0]; |
| | | // delete form.id; |
| | | // for (var k = 0; k < 13; k++) { |
| | | // form["deptId"] = form.tenantName; |
| | | // delete form.tenantName; |
| | | if (this.fromDeptId != undefined) { |
| | | form["deptId"] = this.fromDeptId; |
| | | } |
| | |
| | | this.onLoad(this.page); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | // console.log(row); |
| | | // row["deptId"] = row.tenantName; |
| | | // delete row.tenantName; |
| | | if (this.fromDeptId != undefined) { |
| | | row["deptId"] = this.fromDeptId; |
| | | } |
| | |
| | | params["deptId"] = this.fromDeptId; |
| | | // this.closeDep("deptId"); |
| | | } else if (this.useifid != 266) { |
| | | console.log(123); |
| | | // console.log(123); |
| | | params["deptId"] = this.useifid; |
| | | // this.closeDep("deptId"); |
| | | // for (let k in this.option.column) { |
| | | // if (this.option.column[k].prop == "deptId") { |
| | | // this.option.column[4].search = false; |
| | | // this.option.column[k].hide = true; |
| | | // this.option.column[k].addDisplay = false; |
| | | // this.option.column[k].editDisplay = false; |
| | | // } |
| | | // } |
| | | } else { |
| | | this.openDep("deptId"); |
| | | } |
| | |
| | | if (this.userInfo.role_name == "公安管理员") { |
| | | params["jurisdiction"] = that.userInfo.jurisdiction; |
| | | } |
| | | //保安公司进入 |
| | | if (this.userInfo.role_name == "保安公司管理员") { |
| | | params["deptId"] = that.userInfo.dept_id; |
| | | //导入action 修改 |
| | | const importColumn = that.findObject( |
| | | that.excelOption.column, |
| | | "excelFile" |
| | | ); |
| | | importColumn.action = |
| | | "/api/gun/import-gun?deptId=" + that.userInfo.dept_id; |
| | | } |
| | | getdata( |
| | | page.currentPage, |
| | | page.pageSize, |
| | | Object.assign(params, this.query) |
| | | ).then((res) => { |
| | | // console.log(res); |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | console.log(this.data); |
| | | // console.log(this.data); |
| | | this.loading = false; |
| | | }); |
| | | }, |