|
|
|
@ -83,7 +83,9 @@ |
|
|
|
</el-row> |
|
|
|
<el-row> |
|
|
|
<el-form-item label="管理员" prop="administrator"> |
|
|
|
<el-input v-model="form.administrator" /> |
|
|
|
<el-input v-model="form.administrator"> |
|
|
|
<el-button @click="openUserDialog" slot="append" icon="el-icon-search"></el-button> |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="联系电话" prop="contactPhone"> |
|
|
|
<el-input v-model="form.contactPhone" /> |
|
|
|
@ -115,18 +117,58 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<el-dialog :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="userDialog" title="用户列表" class="group-form" width="50%"> |
|
|
|
<span class="dialog-right-top" /> |
|
|
|
<span class="dialog-left-bottom" /> |
|
|
|
<div class="setting-dialog"> |
|
|
|
<el-table ref="userTableRef" v-loading="userLoading" :data="userTable" style="width: 100%;" height="calc(100vh - 470px)" @selection-change="handleUserSelection"> |
|
|
|
<el-table-column type="selection" align="center" width="55" /> |
|
|
|
<el-table-column prop="loginid" label="账号" /> |
|
|
|
<el-table-column prop="lastname" label="用户名" /> |
|
|
|
<el-table-column prop="sex" label="性别" width="60" /> |
|
|
|
<el-table-column prop="departmentname" label="所属部门" /> |
|
|
|
<el-table-column prop="isFace" label="人脸绑定"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-tag v-if="scope.row.isFace === 1" type="success">已绑定</el-tag> |
|
|
|
<el-tag v-if="scope.row.isFace === 0" type="info">未绑定</el-tag> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<!-- <div style="text-align: right; margin-top: 15px;"> |
|
|
|
<el-button @click="userDialog = false">取消</el-button> |
|
|
|
<el-button type="primary" @click="confirmSelectUser">确认选择</el-button> |
|
|
|
</div> --> |
|
|
|
<el-pagination |
|
|
|
v-if="userTable.length !== 0" |
|
|
|
:current-page="userPage.pageNo" |
|
|
|
:total="userPage.total" |
|
|
|
:page-size="userPage.pageSize" |
|
|
|
:pager-count="5" |
|
|
|
layout="total, prev, pager, next, sizes" |
|
|
|
@size-change="handleUserSizeChange" |
|
|
|
@current-change="handleUserCurrentPage" |
|
|
|
style="text-align:right; margin: 10px 0 !important;" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
<div slot="footer" class="dialog-footer" style="margin-top:0 !important;"> |
|
|
|
<el-button @click.native="userDialog = false">取消</el-button> |
|
|
|
<el-button type="primary" @click.native="confirmSelectUser">确定</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { FetchFondsWarehouseTree } from '@/api/assetDevice/index' |
|
|
|
import crudWarehouse from '@/api/assetWarehouse/index' |
|
|
|
import { FetchInitUserList } from '@/api/system/user' |
|
|
|
import CRUD, { presenter, header, form, crud } from '@crud/crud' |
|
|
|
import rrOperation from '@crud/RR.operation' |
|
|
|
import crudOperation from '@crud/CRUD.operation' |
|
|
|
import pagination from '@crud/Pagination' |
|
|
|
|
|
|
|
const defaultForm = { id: null, administrator: null, contactPhone: null, fondsNo: null, sequence: 999, status: 1, remark: null, warehouseArea: null, warehouseName: null, warehouseNo: null } |
|
|
|
const defaultForm = { id: null, administrator: null, internalId:null, contactPhone: null, fondsNo: null, sequence: 999, status: 1, remark: null, warehouseArea: null, warehouseName: null, warehouseNo: null } |
|
|
|
export default { |
|
|
|
name: 'Warehouse', |
|
|
|
components: { pagination, crudOperation, rrOperation }, |
|
|
|
@ -165,7 +207,16 @@ export default { |
|
|
|
enabledTypeOptions: [ |
|
|
|
{ key: '1', display_name: '启用' }, |
|
|
|
{ key: '0', display_name: '停用' } |
|
|
|
] |
|
|
|
], |
|
|
|
userLoading:false, |
|
|
|
userDialog:false, |
|
|
|
userTable:[], |
|
|
|
userPage:{ |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 10, |
|
|
|
total: null |
|
|
|
}, |
|
|
|
selectedUserList: [] // 选中的用户 |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
@ -269,6 +320,68 @@ export default { |
|
|
|
this.$message({ message: '已取消修改', offset: 8 }) |
|
|
|
data.status = val === 1 ? 0 : 1 |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 打开用户弹窗并加载数据 |
|
|
|
openUserDialog() { |
|
|
|
this.userDialog = true |
|
|
|
this.$nextTick(() => { |
|
|
|
this.getUserList() |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取用户列表 |
|
|
|
async getUserList() { |
|
|
|
this.userLoading = true |
|
|
|
this.selectedUserList = [] |
|
|
|
try { |
|
|
|
const params = { |
|
|
|
isSync: true, |
|
|
|
pageNo: this.userPage.pageNo, |
|
|
|
pageSize: this.userPage.pageSize |
|
|
|
} |
|
|
|
const res = await FetchInitUserList(params) |
|
|
|
this.userTable = res.records || res.rows || res.data || [] |
|
|
|
this.userPage.total = res.total || 0 |
|
|
|
} catch (error) { |
|
|
|
console.error('获取用户列表失败', error) |
|
|
|
this.$message.error('获取用户数据失败') |
|
|
|
} finally { |
|
|
|
this.userLoading = false |
|
|
|
} |
|
|
|
}, |
|
|
|
// 每页条数改变 |
|
|
|
handleUserSizeChange(val) { |
|
|
|
this.userPage.pageSize = val |
|
|
|
this.getUserList() |
|
|
|
}, |
|
|
|
// 当前页改变 |
|
|
|
handleUserCurrentPage(val) { |
|
|
|
this.userPage.pageNo = val |
|
|
|
this.getUserList() |
|
|
|
}, |
|
|
|
// 用户选择事件 |
|
|
|
handleUserSelection(val) { |
|
|
|
const table = this.$refs.userTableRef |
|
|
|
if (val.length > 1) { |
|
|
|
// 只保留最后选中的一条,取消之前所有选中 |
|
|
|
table.clearSelection() |
|
|
|
table.toggleRowSelection(val[val.length - 1]) |
|
|
|
this.selectedUserList = [val[val.length - 1]] |
|
|
|
} else { |
|
|
|
this.selectedUserList = val |
|
|
|
} |
|
|
|
}, |
|
|
|
// 确认选择用户 |
|
|
|
confirmSelectUser() { |
|
|
|
if (this.selectedUserList.length === 0) { |
|
|
|
this.$message.warning('请选择一个用户') |
|
|
|
return |
|
|
|
} |
|
|
|
// 取第一个选中的用户,赋值给管理员 |
|
|
|
const user = this.selectedUserList[0] |
|
|
|
this.form.administrator = user.lastname |
|
|
|
this.form.internalId = user.internalId |
|
|
|
this.userDialog = false |
|
|
|
this.$message.success('选择管理员成功') |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|