智慧軍營(yíng)營(yíng)區(qū)管理系統(tǒng)平臺(tái)源碼
<style>
.customWidthMb{
width:100%;
}
.customWidthPC{
width:720px;
}
</style>
<template>
<div class="app-container">
<el-row :gutter="20">
<!--單位數(shù)據(jù)-->
<!-- <el-col :span="4" :xs="24">-->
<el-col :span="orgNum==='mult'?4:0" :xs="24">
<div class="head-container">
<el-input
v-model="orgName"
placeholder="請(qǐng)輸入單位名稱"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="orgOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
default-expand-all
@node-click="handleNodeClick"
/>
</div>
</el-col>
<!--人員數(shù)據(jù)-->
<!-- <el-col :span="20" :xs="24">-->
<el-col :span="orgNum==='mult'?20:24" :xs="24">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="人員姓名" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="請(qǐng)輸入人員姓名"
clearable
size="small"
style="width: 180px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="人員類型" prop="personType">
<el-select
v-model="queryParams.personType"
placeholder="人員狀態(tài)"
clearable
size="small"
style="width: 180px"
>
<el-option
v-for="dict in personTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="狀態(tài)" prop="status">
<el-select
v-model="queryParams.status"
placeholder="人員狀態(tài)"
clearable
size="small"
style="width: 180px"
>
<el-option
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="截止時(shí)間">
<el-date-picker
v-model="dateRange"
size="small"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="開(kāi)始日期"
end-placeholder="結(jié)束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['campsys:hr:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['campsys:hr:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['campsys:hr:remove']"
>刪除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
@click="handleImport"
v-hasPermi="['campsys:hr:import']"
>導(dǎo)入</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['campsys:hr:export']"
>導(dǎo)出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="personList" @selection-change="handleSelectionChange" @sort-change="changeSort">
<el-table-column type="selection" width="50" align="center" />
<!-- <el-table-column label="人員編號(hào)" align="center" prop="personId" />-->
<el-table-column label="人事名稱" align="center" prop="personName" :show-overflow-tooltip="true" />
<el-table-column label="證件號(hào)碼" align="center" prop="personSid" :show-overflow-tooltip="true" />
<el-table-column label="類型" align="center" prop="personType" :show-overflow-tooltip="true" />
<el-table-column label="手機(jī)號(hào)碼" align="center" prop="personMp" width="120" />
<!-- <el-table-column label="人事昵稱" align="center" prop="nickName" :show-overflow-tooltip="true" />-->
<el-table-column label="所屬營(yíng)區(qū)" align="center" prop="camp.campName" :show-overflow-tooltip="true" />
<el-table-column label="所屬單位" align="center" prop="org.orgName" :show-overflow-tooltip="true" />
<el-table-column
label="操作"
align="center"
width="160"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['campsys:hr:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['campsys:hr:remove']"
>刪除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-key"
@click="handleResetPwd(scope.row)"
v-hasPermi="['campsys:hr:resetPwd']"
>重置</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
<!-- 添加或修改參數(shù)配置對(duì)話框 -->
<el-dialog v-bind:customClass="dialogStyle?'customWidthMb':'customWidthPC'" :title="title" :visible.sync="open" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="colWidth" >
<el-form-item label="人事名稱" prop="personName">
<el-input v-model="form.personName" placeholder="請(qǐng)輸入人事名稱" />
</el-form-item>
</el-col>
<el-col :span="colWidth" >
<el-form-item label="人事昵稱" prop="nickName">
<el-input v-model="form.nickName" placeholder="請(qǐng)輸入人事昵稱" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="colWidth">
<el-form-item label="人事性別" prop="personSex">
<el-select v-model="form.personSex" placeholder="請(qǐng)選擇" style="width:100%">
<el-option
v-for="dict in sexOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="colWidth">
<el-form-item label="人員類型" prop="personType">
<el-select v-model="form.personType" placeholder="請(qǐng)選擇人員類型" style="width:100%">
<el-option
v-for="dict in personTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="colWidth">
<el-form-item label="歸屬單位" prop="orgId">
<treeselect v-model="form.orgId" :options="orgOptions" :show-count="true" placeholder="請(qǐng)選擇歸屬單位" />
</el-form-item>
</el-col>
<el-col :span="colWidth">
<el-form-item label="所屬營(yíng)區(qū)" prop="campId">
<el-select v-model="form.campId" placeholder="請(qǐng)選擇營(yíng)區(qū)" style="width:100%" >
<el-option
v-for="item in campOptions"
:key="item.campId"
:label="item.campName"
:value="item.campId"
:disabled="item.status == 1"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="colWidth">
<el-form-item label="通行權(quán)限" prop="devRoleId">
<el-select v-model="form.devRoleId" placeholder="請(qǐng)選擇人員通行權(quán)限角色" style="width:100%" >
<el-option
v-for="item in roleOptions"
:key="item.roleId"
:label="item.roleName"
:value="item.roleId"
:disabled="item.status == 1"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="colWidth">
<el-form-item v-if="form.personId == undefined" label="人事密碼" prop="personPsw">
<el-input v-model="form.personPsw" placeholder="請(qǐng)輸入人事密碼" type="password" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="colWidth">
<el-form-item label="證件類型" prop="personSidType">
<el-select v-model="form.personSidType" placeholder="請(qǐng)選擇證件類型" style="width:100%">
<el-option
v-for="dict in IDTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="colWidth">
<el-form-item label="證件號(hào)碼" prop="personSid">
<el-input v-model="form.personSid" placeholder="請(qǐng)輸入證件號(hào)" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="colWidth">
<el-form-item label="手機(jī)號(hào)碼" prop="personMp">
<el-input v-model="form.personMp" placeholder="請(qǐng)輸入手機(jī)號(hào)碼" maxlength="11" />
</el-form-item>
</el-col>
<el-col :span="colWidth">
<el-form-item label="地址">
<el-input v-model="form.addr" type="text" placeholder="請(qǐng)輸入內(nèi)容"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="照片路徑">
<el-input v-model="form.imgPath" type="text" placeholder="請(qǐng)上傳照片"></el-input>
</el-form-item>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
icon="el-icon-upload2"
size="mini"
@click="handleImportJPG"
>導(dǎo)入圖片</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="備注">
<el-input v-model="form.remark" type="textarea" placeholder="請(qǐng)輸入內(nèi)容"></el-input>
</el-form-item>
</el-col>
</el-row>
<template>
<div>
<img v-bind:src="options.img" @click="editCropper()" title="點(diǎn)擊上傳頭像" class="img-circle img-lg" />
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body @opened="modalOpened">
<el-row>
<el-col :xs="24" :md="12" :style="{height: '350px'}">
<vue-cropper
ref="cropper"
:img="options.img"
:info="true"
:autoCrop="options.autoCrop"
:autoCropWidth="options.autoCropWidth"
:autoCropHeight="options.autoCropHeight"
:fixedBox="options.fixedBox"
@realTime="realTime"
v-if="visible"
/>
</el-col>
<el-col :xs="24" :md="12" :style="{height: '350px'}">
<div class="avatar-upload-preview">
<img :src="previews.url" :style="previews.img" />
</div>
</el-col>
</el-row>
<br />
<el-row>
<el-col :lg="2" :md="2">
<el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload">
<el-button size="small">
上傳
<i class="el-icon-upload el-icon--right"></i>
</el-button>
</el-upload>
</el-col>
<el-col :lg="{span: 1, offset: 2}" :md="2">
<el-button icon="el-icon-plus" size="small" @click="changeScale(1)"></el-button>
</el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2">
<el-button icon="el-icon-minus" size="small" @click="changeScale(-1)"></el-button>
</el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2">
<el-button icon="el-icon-refresh-left" size="small" @click="rotateLeft()"></el-button>
</el-col>
<el-col :lg="{span: 1, offset: 1}" :md="2">
<el-button icon="el-icon-refresh-right" size="small" @click="rotateRight()"></el-button>
</el-col>
<el-col :lg="{span: 2, offset: 6}" :md="2">
<el-button type="primary" size="small" @click="uploadImg()">提 交</el-button>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
<el-row>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">確 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<!-- 人員導(dǎo)入對(duì)話框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".xlsx, .xls"
:headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
將文件拖到此處,或
<em>點(diǎn)擊上傳</em>
</div>
<div class="el-upload__tip" slot="tip">
<el-checkbox v-model="upload.updateSupport" />是否更新已經(jīng)存在的人員數(shù)據(jù)
<el-link type="info" style="font-size:12px" @click="importTemplate">下載模板</el-link>
</div>
<div class="el-upload__tip" style="color:#ff0000" slot="tip">提示:僅允許導(dǎo)入“xls”或“xlsx”格式文件!</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">確 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
</div>
</el-dialog>
<el-dialog :title="uploadJPG.title" :visible.sync="uploadJPG.open" width="400px" append-to-body>
<el-upload
ref="upload"
:limit="1"
accept=".jpg"
:headers="uploadJPG.headers"
:action="uploadJPG.url + '?updateSupport=' + uploadJPG.updateSupport"
:disabled="uploadJPG.isUploading"
:on-progress="handleJPGUploadProgress"
:on-success="handleJPGSuccess"
:auto-upload="false"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">
將文件拖到此處,或
<em>點(diǎn)擊上傳</em>
</div>
<!-- <div class="el-upload__tip" slot="tip">-->
<!-- <el-checkbox v-model="uploadJPG.updateSupport" />是否更新已經(jīng)存在的人員數(shù)據(jù)-->
<!-- <el-link type="info" style="font-size:12px" @click="importTemplate">下載模板</el-link>-->
<!-- </div>-->
<div class="el-upload__tip" style="color:#ff0000" slot="tip">提示:僅允許導(dǎo)入“jpg”格式文件,正面人臉占比大于70%!</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitJPGForm">確 定</el-button>
<el-button @click="uploadJPG.open = false">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listPerson, getPerson, delPerson, addPerson, updatePerson, exportPerson, resetPersonPwd, changePersonStatus, importTemplate } from "@/api/campsys/armyman";
import { getToken } from "@/utils/auth";
import { treeselect } from "@/api/system/org";
import { getCampsOfOrg } from "@/api/campsys/camp";
import { getUsersOfOrg,getUsersOfOrgbyname} from "@/api/companySys/user";
import { getRolesAll } from "@/api/campsys/pdevrole";
import { getInfo } from "@/api/login";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Person",
components: { Treeselect },
data() {
return {
// 遮罩層
loading: true,
// 選中數(shù)組
ids: [],
// 非單個(gè)禁用
single: true,
// 非多個(gè)禁用
multiple: true,
// 顯示搜索條件
showSearch: true,
// 總條數(shù)
total: 0,
// 人員表格數(shù)據(jù)
personList: null,
// 彈出層標(biāo)題
title: "",
//選擇人事
radiohr: "0",
//輸入查詢值
name:'',
// 單位樹(shù)選項(xiàng)
orgOptions: undefined,
// 場(chǎng)站選項(xiàng)
campOptions: undefined,
//通道權(quán)限角色
roleOptions:undefined,
// 部門(mén)選項(xiàng)
deptOptions: undefined,
//人員信息
userOptions:undefined,
userOptionscp:undefined,
//用戶信息
userInfo:undefined,
// 是否顯示彈出層
open: false,
// 單位名稱
orgName: undefined,
//單位個(gè)數(shù)
orgNum:undefined,
// 默認(rèn)密碼
initPassword: undefined,
// 日期范圍
dateRange: [],
// 狀態(tài)數(shù)據(jù)字典
statusOptions: [],
// 證件類型字典
IDTypeOptions: [],
// 性別狀態(tài)字典
sexOptions: [],
// 人員類型
typeOptions: [],
personTypeOptions: [],
dialogWidth: "'600px'",
dialogStyle: 1,
colWidth:12,
// 表單參數(shù)
form: { },
defaultProps: {
children: "children",
label: "label"
},
// 人員導(dǎo)入?yún)?shù)
upload: {
// 是否顯示彈出層(人員導(dǎo)入)
open: false,
// 彈出層標(biāo)題(人員導(dǎo)入)
title: "",
// 是否禁用上傳
isUploading: false,
// 是否更新已經(jīng)存在的人員數(shù)據(jù)
updateSupport: 0,
// 設(shè)置上傳的請(qǐng)求頭部
headers: { Authorization: "Bearer " + getToken() },
// 上傳的地址
url: process.env.VUE_APP_BASE_API + "/campsys/armyman/importData"
},
uploadJPG: {
// 是否顯示彈出層(圖片導(dǎo)入)
open: false,
// 彈出層標(biāo)題(人員導(dǎo)入)
title: "",
// 是否禁用上傳
isUploading: false,
// 是否更新已經(jīng)存在的人員數(shù)據(jù)
updateSupport: 0,
// 設(shè)置上傳的請(qǐng)求頭部
headers: { Authorization: "Bearer " + getToken() },
// 上傳的地址
url: process.env.VUE_APP_BASE_API + "/campsys/armyman/importJPG"
},
// 查詢參數(shù)
queryParams: {
pageNum: 1,
pageSize: 10,
personName: undefined,
personSid:undefined,
personType:undefined,
status: undefined,
isAsc:"asc",
orderByColumn:"personId",
orgId: undefined
},
// 查詢參數(shù)
queryUsers: {
pageNum: 1,
pageSize: 10,
userName: undefined,
orgId: undefined
},
// 表單校驗(yàn)
rules: {
personName: [
{ required: true, message: "人員名稱不能為空", trigger: "blur" }
],
orgId: [
{ required: true, message: "歸屬單位不能為空", trigger: "blur" }
],
campId: [
{ required: true, message: "所屬營(yíng)區(qū)不能為空", trigger: "blur" }
],
personType: [
{ required: true, message: "人員類型不能為空", trigger: "blur" }
],
personSex: [
{ required: true, message: "人員性別不能為空", trigger: "blur" }
],
devRoleId: [
{ required: true, message: "通行權(quán)限不能為空", trigger: "blur" }
]
}
};
},
watch: {
// 根據(jù)名稱篩選單位樹(shù)
orgName(val) {
this.$refs.tree.filter(val);
},
'form.orgId': 'currOrgChange'
},
created() {
this.getList();
this.getTreeselect();
this.getUserInfo();
this.setDialogWidth();
this.getAllRoles();
this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data;
});
this.getDicts("arm_person_type").then(response => {
this.personTypeOptions = response.data;
});
this.getDicts("sys_user_sex").then(response => {
this.sexOptions = response.data;
});
//證件類型
this.getDicts("sys_card_type").then(response => {
this.IDTypeOptions = response.data;
});
this.getConfigKey("sys.user.initPassword").then(response => {
this.initPassword = response.msg;
});
},
filters: {
rounding (value) {
return value.toFixed(2)
}
},
mounted() {
window.onresize = () => {
return (() => {
this.setDialogWidth()
})()
}
},
computed:{
addDialogStyle(){
console.log(document.body.clientWidth)
var val = document.body.clientWidth
const def = 800 // 默認(rèn)寬度
if (val < def) {
this.colWidth=24;
console.log("customWidthMb");
return 'customWidthMb';
} else {
this.colWidth=12;
console.log("customWidthPC");
return 'customWidthPC';
}
},
},
methods: {
// 設(shè)置 Dialog 寬度。
setDialogWidth() {
console.log(document.body.clientWidth)
var val = document.body.clientWidth
const def = 800 // 默認(rèn)寬度
if (val < def) {
this.colWidth=24;
this.dialogStyle=1;
} else {
this.dialogStyle=0;
this.colWidth=12
}
console.log(this.dialogWidth)
},
//獲取進(jìn)出營(yíng)區(qū)角色信息
getAllRoles(){
getRolesAll().then(response => {
this.roleOptions = response.data;
});
},
// 排序
changeSort(column){ //column.prop
if (column.order === 'descending') {
this.queryParams.orderByColumn=column.prop;
this.queryParams.isAsc="desc";
}
else{
this.queryParams.orderByColumn=column.prop;
this.queryParams.isAsc="asc";
}
//攜帶當(dāng)前的排序規(guī)則再請(qǐng)求后臺(tái)數(shù)據(jù)a
this.getList()
},
//查詢?nèi)藛T姓名
searchUsers(){
this.queryUsers.orgId=this.form.orgId;
this.queryUsers.userName=this.name;
getUsersOfOrgbyname(this.queryUsers).then(response => {
this.userOptions = response.data;
this.userOptionscp = response.data;
});
},
dataFilter(val) {
if (val) { //val存在
this.userOptions = this.userOptionscp.filter((item) => {
if (!!~item.userName.indexOf(val) || !!~item.userName.toUpperCase().indexOf(val.toUpperCase())) {
return true
}
})
}
else { //val為空時(shí),還原數(shù)組
this.userOptions = this.userOptionscp;
}
},
/** 單位發(fā)生變化 */
currOrgChange(val) {
if (val) {
getUsersOfOrg(val).then(response => {
this.userOptions = response.data;
this.userOptionscp = response.data;
});
getCampsOfOrg(val).then(response => {
this.campOptions = response.data;
this.form.campId=this.campOptions[0].campId;
});
}
},
// 人員類型翻譯
personTypeFormat(row, column) {
return this.selectDictLabel(this.personTypeOptions, row.personType);
},
//用戶信息
getUserInfo(){
getInfo().then(response => {
this.userInfo= response.user;
console.log(this.userInfo.userName);
}
);
},
/** 查詢?nèi)藛T列表 */
getList() {
this.loading = true;
listPerson(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.personList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 查詢單位下拉樹(shù)結(jié)構(gòu) */
getTreeselect() {
treeselect().then(response => {
this.orgOptions = response.data;
this.orgNum=response.msg;
});
},
// 篩選節(jié)點(diǎn)
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// 節(jié)點(diǎn)單擊事件m
handleNodeClick(data) {
this.queryParams.orgId = data.id;
this.getList();
},
// 人員狀態(tài)修改
handleStatusChange(row) {
let text = row.status === "0" ? "啟用" : "停用";
this.$confirm('確認(rèn)要"' + text + '""' + row.license + '"人員嗎?', "警告", {
confirmButtonText: "確定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return changePersonStatus(row.personId, row.status);
}).then(() => {
this.msgSuccess(text + "成功");
}).catch(function() {
row.status = row.status === "0" ? "1" : "0";
});
},
// 取消按鈕
cancel() {
this.open = false;
this.reset();
},
// 表單重置
reset() {
this.form = {
personId: undefined,
orgId: undefined,
campId:undefined,
license: undefined,
personType: undefined,
status: "0",
parkroleId:undefined
};
this.resetForm("form");
this.form.orgId=this.userInfo.orgId;
},
/** 搜索按鈕操作 */
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
/** 重置按鈕操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 多選框選中數(shù)據(jù)
handleSelectionChange(selection) {
this.ids = selection.map(item => item.personId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 新增按鈕操作 */
handleAdd() {
this.reset();
this.getTreeselect();
getPerson().then(response => {
this.open = true;
this.form.personPsw = this.initPassword;
this.title = "添加人員";
});
},
/** 修改按鈕操作 */
handleUpdate(row) {
this.reset();
this.getTreeselect();
const personId = row.personId || this.ids;
getPerson(personId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改人員";
});
},
/** 重置密碼按鈕操作 */
handleResetPwd(row) {
this.$prompt('請(qǐng)輸入"' + row.license + '"的新密碼', "提示", {
confirmButtonText: "確定",
cancelButtonText: "取消"
}).then(({ value }) => {
resetPersonPwd(row.personId, value).then(response => {
this.msgSuccess("修改成功,新密碼是:" + value);
});
}).catch(() => {});
},
/** 提交按鈕 */
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.personId != undefined) {
updatePerson(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addPerson(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 刪除按鈕操作 */
handleDelete(row) {
const personIds = row.personId || this.ids;
this.$confirm('是否確認(rèn)刪除人員編號(hào)為"' + personIds + '"的數(shù)據(jù)項(xiàng)?', "警告", {
confirmButtonText: "確定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delPerson(personIds);
}).then(() => {
this.getList();
this.msgSuccess("刪除成功");
})
},
/** 導(dǎo)出按鈕操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否確認(rèn)導(dǎo)出所有人員數(shù)據(jù)項(xiàng)?', "警告", {
confirmButtonText: "確定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportPerson(queryParams);
}).then(response => {
this.download(response.msg);
})
},
/** 導(dǎo)入按鈕操作 */
handleImport() {
this.upload.title = "人員導(dǎo)入";
this.upload.open = true;
},
/** 下載模板操作 */
importTemplate() {
importTemplate().then(response => {
this.download(response.msg);
});
},
// 文件上傳中處理
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
// 文件上傳成功處理
handleFileSuccess(response, file, fileList) {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$alert(response.msg, "導(dǎo)入結(jié)果", { dangerouslyUseHTMLString: true });
this.getList();
},
// 提交上傳文件
submitFileForm() {
this.$refs.upload.submit();
},
/** 導(dǎo)入圖片操作 */
handleImportJPG() {
this.uploadJPG.title = "上傳人臉圖片";
this.uploadJPG.open = true;
},
handleJPGUploadProgress(event, file, fileList) {
this.uploadJPG.isUploading = true;
},
// 文件上傳成功處理
handleJPGSuccess(response, file, fileList) {
this.uploadJPG.open = false;
this.uploadJPG.isUploading = false;
this.$refs.uploadJPG.clearFiles();
this.form.imgPath=response.imgUrl;
this.$alert(response.msg, "導(dǎo)入結(jié)果", { dangerouslyUseHTMLString: true });
this.getList();
},
// 提交上傳文件
submitJPGForm() {
this.$refs.upload.submit();
}
}
};
</script>
- 上一篇:電子巡更工廠系統(tǒng)安全的保障手段 2021/2/2
- 下一篇:智慧軍營(yíng)綜合管理基礎(chǔ)模塊 2021/1/28