From 79d9fc857559982b00b68b2d709807bdc4cd286f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 11 Apr 2022 10:58:17 +0800
Subject: [PATCH] minio 地址修改
---
src/views/securityEquipment/gun.vue | 233 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 202 insertions(+), 31 deletions(-)
diff --git a/src/views/securityEquipment/gun.vue b/src/views/securityEquipment/gun.vue
index 022668d..c4bf473 100644
--- a/src/views/securityEquipment/gun.vue
+++ b/src/views/securityEquipment/gun.vue
@@ -1,10 +1,18 @@
<template>
- <div class="equipments">
+ <basic-container
+ :class="[
+ 'equipments',
+ $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
+ $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
+ ]"
+ >
<avue-crud
+ class="tablesss"
:option="option"
:data="data"
:page.sync="page"
ref="crudrec"
+ :permission="permissionList"
@on-load="onLoad"
:table-loading="loading"
@row-save="rowSave"
@@ -21,27 +29,86 @@
size="small"
plain
icon="el-icon-delete"
+ v-if="permission.gun_delete"
@click="handleDelete"
>删 除
</el-button>
+ <el-button
+ type="success"
+ size="small"
+ plain
+ icon="el-icon-upload2"
+ v-if="permission.gun_import"
+ @click="handleImport"
+ >批量导入
+ </el-button>
</template>
</avue-crud>
- </div>
+ <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>
+ </basic-container>
</template>
<script>
import { data, column } from "./gun";
import { getdata, adddata, update, remove } from "@/api/gun/gun";
-
+import { getToken } from "@/util/auth";
+import { mapGetters } from "vuex";
export default {
+ props: ["fromDeptId"],
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,
currentPage: 1,
total: 0,
+ ...this.$store.state.control.changePageSize
},
query: {},
data: [],
@@ -50,52 +117,103 @@
tip: false,
searchSize: "mini",
searchMenuSpan: 6,
- height: 627,
+ height: "auto",
+ index: true,
menuWidth: 160,
align: "center",
+ border: true,
selection: true,
+ labelWidth: 110,
column: column,
+ ...this.$store.state.control.clearOtherBut
},
+ useifid: 266
};
},
computed: {
+ ...mapGetters(["permission", "userInfo"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.gun_add, false),
+ viewBtn: this.vaildData(this.permission.gun_view, true),
+ delBtn: this.vaildData(this.permission.gun_delete, false),
+ editBtn: this.vaildData(this.permission.gun_edit, false)
+ };
+ },
ids() {
let ids = [];
- this.selectionList.forEach((ele) => {
+ this.selectionList.forEach(ele => {
ids.push(ele.id);
});
return ids.join(",");
- },
+ }
+ },
+ created() {
+ var that = this;
+ this.deptIds = this.userInfo.dept_id;
+ if (
+ this.userInfo.role_name == "装备管理员" ||
+ this.userInfo.role_name == "保安公司管理员" ||
+ this.userInfo.role_name == "分公司管理员"
+ ) {
+ this.useifid = this.userInfo.dept_id;
+ }
+ //公安局进入
+ if (this.userInfo.role_name == "公安管理员" || this.userInfo.role_name == "民警") {
+ that.option.column[5].dicUrl =
+ "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697&jurisdiction=" +
+ that.userInfo.jurisdiction;
+ } else {
+ that.option.column[5].dicUrl =
+ "/api/blade-system/dept/security_lazy-tree?parentId=1413470343230877697";
+ }
+ },
+ mounted() {
+ this.$store.commit("setWindowSizeHeightAdd");
+ this.deptIds = this.userInfo.dept_id;
},
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?${this.website.tokenHeader}=${getToken()}`
+ );
+ },
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;
+ }
+ if (this.useifid != 266) {
+ form["deptId"] = this.useifid;
+ }
adddata(form).then(
- (res) => {
+ res => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!",
+ message: "操作成功!"
});
done();
},
- (error) => {
+ error => {
window.console.log(error);
loading();
}
@@ -113,19 +231,22 @@
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;
+ }
+ if (this.useifid != 266) {
+ row["deptId"] = this.useifid;
+ }
update(row).then(
() => {
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!",
+ message: "操作成功!"
});
done();
},
- (error) => {
+ error => {
window.console.log(error);
loading();
}
@@ -135,7 +256,7 @@
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning",
+ type: "warning"
})
.then(() => {
return remove(row.id);
@@ -144,7 +265,7 @@
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!",
+ message: "操作成功!"
});
});
},
@@ -159,7 +280,7 @@
this.$confirm("确定将选择数据删除?", {
confirmButtonText: "确定",
cancelButtonText: "取消",
- type: "warning",
+ type: "warning"
})
.then(() => {
return remove(this.ids);
@@ -168,7 +289,7 @@
this.onLoad(this.page);
this.$message({
type: "success",
- message: "操作成功!",
+ message: "操作成功!"
});
this.$refs.crudrec.toggleSelection();
});
@@ -176,21 +297,71 @@
refreshChange() {
this.onLoad(this.page, this.query);
},
+ closeDep(name) {
+ for (let k in this.option.column) {
+ if (this.option.column[k].prop == name) {
+ this.option.column[k].search = false;
+ this.option.column[k].hide = true;
+ this.option.column[k].addDisplay = false;
+ this.option.column[k].editDisplay = false;
+ }
+ }
+ },
+ openDep(name) {
+ for (let k in this.option.column) {
+ if (this.option.column[k].prop == name) {
+ this.option.column[k].search = true;
+ this.option.column[k].hide = false;
+ this.option.column[k].addDisplay = true;
+ this.option.column[k].editDisplay = true;
+ }
+ }
+ },
onLoad(page, params = {}) {
this.loading = true;
+ var that = this;
+ // console.log(params.deptId);
+ if (this.fromDeptId != undefined) {
+ params["deptId"] = this.fromDeptId;
+ // this.closeDep("deptId");
+ } else if (this.useifid != 266) {
+ // console.log(123);
+ params["deptId"] = this.useifid;
+ } else {
+ this.openDep("deptId");
+ }
+
+ //公安局进入
+ if (this.userInfo.role_name == "公安管理员" || this.userInfo.role_name == "民警") {
+ params["jurisdiction"] = that.userInfo.jurisdiction;
+ }
+ //保安公司进入
+ if (
+ this.userInfo.role_name == "保安公司管理员" ||
+ 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);
+ ).then(res => {
const data = res.data.data;
this.page.total = data.total;
this.data = data.records;
- console.log(this.data);
+ this.$store.commit("setWindowSizeHeightAdd");
+ // console.log(this.data);
this.loading = false;
});
- },
+ }
},
mounted() {
// this.Ourdata = data;
@@ -199,7 +370,7 @@
// var dept_id = JSON.parse(
// window.localStorage.getItem("saber-userInfo")
// ).content.dept_id;
- },
+ }
};
</script>
@@ -218,4 +389,4 @@
// .el-tag--light {
// padding: 0 !important;
// }
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3