| | |
| | | <div class="table flex-display flex-column"> |
| | | <a-table :columns="columns" :data-source="data.member" :pagination="paginationProp" @change="refreshData" row-key="user_id" |
| | | :row-selection="rowSelection" :rowClassName="(record, index) => ((index % 2) === 0 ? 'table-striped' : null)" :scroll="{ x: '100%', y: 600 }"> |
| | | <template v-for="col in ['mqtt_username', 'mqtt_password']" #[col]="{ text, record }" :key="col"> |
| | | <div> |
| | | <template v-for="col in ['organization_name', 'user_role', ]" #[col]="{ text, record }" :key="col"> |
| | | <div v-if="col == 'organization_name'"> |
| | | <a-input |
| | | v-if="editableData[record.user_id]" |
| | | v-model:value="editableData[record.user_id][col]" |
| | |
| | | {{ text }} |
| | | </template> |
| | | </div> |
| | | <!-- <div v-else-if="col == 'user_role'"> --> |
| | | <!-- --> |
| | | <!-- </div> --> |
| | | </template> |
| | | <template #action="{ record }"> |
| | | <div class="editable-row-operations"> |
| | |
| | | <span @click="() => delete editableData[record.user_id]" class="ml15" style="color: #e70102;"><CloseOutlined /></span> |
| | | </a-tooltip> |
| | | </span> |
| | | <span v-else class="fz18 flex-align-center flex-row" style="color: #2d8cf0"> |
| | | <span v-else class="fz18 flex-align-center flex-justify-between flex-row" style="color: #2d8cf0"> |
| | | <EditOutlined @click="edit(record)" /> |
| | | <DeleteOutlined @click="del(record)" /> |
| | | </span> |
| | | </div> |
| | | </template> |
| | |
| | | import { IPage } from '/@/api/http/type' |
| | | import { getAllUsersInfo, updateUserInfo } from '/@/api/manage' |
| | | import { ELocalStorageKey } from '/@/types' |
| | | import { EditOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons-vue' |
| | | import { EditOutlined, DeleteOutlined, CheckOutlined, CloseOutlined } from '@ant-design/icons-vue' |
| | | |
| | | export interface Member { |
| | | user_id: string |
| | | username: string |
| | | user_type: string |
| | | workspace_name: string |
| | | organization_name: string |
| | | project: string |
| | | create_time: string |
| | | mqtt_username: string |
| | | mqtt_password: string |
| | | user_role: string |
| | | join_way: string |
| | | } |
| | | |
| | | interface MemberData { |
| | | member: Member[] |
| | | } |
| | | const columns = [ |
| | | { title: 'Account', dataIndex: 'username', width: 150, sorter: (a: Member, b: Member) => a.username.localeCompare(b.username), className: 'titleStyle' }, |
| | | { title: 'User Type', dataIndex: 'user_type', width: 150, className: 'titleStyle' }, |
| | | { title: 'Workspace Name', dataIndex: 'workspace_name', width: 150, className: 'titleStyle' }, |
| | | { title: 'Mqtt Username', dataIndex: 'mqtt_username', width: 150, className: 'titleStyle', slots: { customRender: 'mqtt_username' } }, |
| | | { title: 'Mqtt Password', dataIndex: 'mqtt_password', width: 150, className: 'titleStyle', slots: { customRender: 'mqtt_password' } }, |
| | | { title: 'Joined', dataIndex: 'create_time', width: 150, sorter: (a: Member, b: Member) => a.create_time.localeCompare(b.create_time), className: 'titleStyle' }, |
| | | { title: 'Action', dataIndex: 'action', width: 100, className: 'titleStyle', slots: { customRender: 'action' } }, |
| | | { title: '账号', dataIndex: 'username', width: 150, sorter: (a: Member, b: Member) => a.username.localeCompare(b.username), className: 'titleStyle' }, |
| | | { title: '人员组织名称', dataIndex: 'organization_name', sorter: (a: Member, b: Member) => a.organization_name.localeCompare(b.organization_name), width: 150, className: 'titleStyle' }, |
| | | { title: '用户角色', dataIndex: 'user_role', width: 150, className: 'titleStyle', slots: { customRender: 'user_role' } }, |
| | | { title: '所属项目', dataIndex: 'project', width: 150, className: 'titleStyle' }, |
| | | { title: '加入方式', dataIndex: 'join_way', width: 150, className: 'titleStyle', slots: { customRender: 'join_way' } }, |
| | | { title: '加入时间', dataIndex: 'create_time', width: 150, sorter: (a: Member, b: Member) => a.create_time.localeCompare(b.create_time), className: 'titleStyle' }, |
| | | { title: '操作', dataIndex: 'action', width: 70, className: 'titleStyle', slots: { customRender: 'action' } }, |
| | | ] |
| | | |
| | | const data = reactive<MemberData>({ |
| | |
| | | editableData[record.user_id] = record |
| | | } |
| | | |
| | | const del = (record: Member) => { |
| | | console.log(record) |
| | | } |
| | | |
| | | function save (record: Member) { |
| | | delete editableData[record.user_id] |
| | | updateUserInfo(workspaceId, record.user_id, record).then(res => { |