205 lines
5.8 KiB
Vue
205 lines
5.8 KiB
Vue
<!--
|
|
* @Author: gtz
|
|
* @Date: 2021-04-16 16:05:31
|
|
* @LastEditors: Please set LastEditors
|
|
* @LastEditTime: 2021-07-23 09:14:27
|
|
* @Description: file content
|
|
-->
|
|
<template>
|
|
<div class="usermanager-container">
|
|
<div class="method-btn-area">
|
|
<el-select v-model="listQuery.workerId" :placeholder="$t('module.equipmentManager.eqManagerManage.worker')" filterable clearable style="width: 200px;">
|
|
<el-option
|
|
v-for="item in roleList"
|
|
:key="item.userId"
|
|
:label="item.name"
|
|
:value="item.userId"
|
|
/>
|
|
</el-select>
|
|
<el-select v-model="listQuery.equipmentId" :placeholder="$t('module.equipmentManager.eqManagerManage.equipmentName')" filterable clearable style="width: 200px;">
|
|
<el-option
|
|
v-for="item in eqList"
|
|
:key="item.id"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
<!-- <el-select v-model="listQuery.workerId" :placeholder="$t('module.equipmentManager.eqManagerManage.worker')" clearable style="width: 200px;">
|
|
<el-option
|
|
v-for="item in workerList"
|
|
:key="item.id"
|
|
:label="item.name"
|
|
:value="item.id"
|
|
/>
|
|
</el-select> -->
|
|
<el-button type="primary" @click="getList">{{ 'btn.search' | i18nFilter }}</el-button>
|
|
<el-button type="primary" @click="handleAdd">{{ 'btn.add' | i18nFilter }}</el-button>
|
|
</div>
|
|
<base-table :table-config="tableProps" :table-data="list" :is-loading="listLoading" :page="listQuery.current" :limit="listQuery.size">
|
|
<method-btn slot="handleBtn" :method-list="tableBtn" @clickBtn="handleClick" />
|
|
</base-table>
|
|
<pagination :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="getList" />
|
|
<add-or-edit-form ref="addorEditDrawer" :role-list="roleList" :worker-list="workerList" :eq-list="eqList" :visible.sync="showAddorEditDialog" @refreshDataList="getList" @done="getList" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
|
|
const tableBtn = [{
|
|
type: 'edit',
|
|
btnName: 'btn.edit'
|
|
}, {
|
|
type: 'delete',
|
|
btnName: 'btn.delete'
|
|
}]
|
|
const tableProps = [{
|
|
prop: 'equipmentName',
|
|
label: i18n.t('module.equipmentManager.eqManagerManage.equipmentName'),
|
|
align: 'center'
|
|
}, {
|
|
prop: 'equipmentCode',
|
|
label: i18n.t('module.equipmentManager.eqManagerManage.equipmentCode'),
|
|
align: 'center'
|
|
}, {
|
|
prop: 'equipmentDesc',
|
|
label: i18n.t('module.equipmentManager.eqManagerManage.description'),
|
|
align: 'center'
|
|
}, {
|
|
prop: 'workerName',
|
|
label: i18n.t('module.equipmentManager.eqManagerManage.worker'),
|
|
align: 'center'
|
|
}, {
|
|
prop: 'ruleName',
|
|
label: i18n.t('module.equipmentManager.eqManagerManage.roleName'),
|
|
align: 'center'
|
|
}]
|
|
// , {
|
|
// prop: 'remark',
|
|
// label: i18n.t('module.equipmentManager.eqManagerManage.remark'),
|
|
// align: 'center'
|
|
// }
|
|
import AddOrEditForm from './AddorEditForm'
|
|
import BaseTable from '@/components/BaseTable'
|
|
// edit here
|
|
import { page, del, getEqList, getWorkerList, getRoleList } from '@/api/equipment/eqManager'
|
|
import Pagination from '@/components/Pagination'
|
|
import MethodBtn from '@/components/BaseTable/subcomponents/MethodBtn'
|
|
import i18n from '@/lang'
|
|
export default {
|
|
name: 'OrgManager',
|
|
components: {
|
|
Pagination,
|
|
BaseTable,
|
|
MethodBtn,
|
|
AddOrEditForm
|
|
},
|
|
props: {},
|
|
data() {
|
|
return {
|
|
tableBtn,
|
|
tableProps,
|
|
list: [],
|
|
total: 0,
|
|
listLoading: true,
|
|
showDialog: false,
|
|
curEditId: null,
|
|
curStatus: null,
|
|
showAddorEditDialog: false,
|
|
listQuery: {
|
|
current: 1,
|
|
size: 10,
|
|
equipmentId: null,
|
|
workerId: null
|
|
},
|
|
eqList: [],
|
|
workerList: [],
|
|
roleList: []
|
|
}
|
|
},
|
|
created() {},
|
|
mounted() {
|
|
this.getListQuery()
|
|
},
|
|
methods: {
|
|
handleClick(raw) {
|
|
switch (raw.type) {
|
|
case 'edit':
|
|
this.showAddorEditDialog = true
|
|
this.$nextTick(() => {
|
|
this.$refs.addorEditDrawer.init(raw.data.id)
|
|
})
|
|
break
|
|
case 'delete':
|
|
this.$confirm(`${this.$t('module.basicData.visual.TipsBefore')}?`, this.$t('module.basicData.visual.Tips'), {
|
|
confirmButtonText: this.$t('module.basicData.visual.confirmButtonText'),
|
|
cancelButtonText: this.$t('module.basicData.visual.cancelButtonText'),
|
|
type: 'warning'
|
|
}).then(() => {
|
|
del({ id: raw.data.id }).then(response => {
|
|
this.$message({
|
|
message: this.$t('module.basicData.visual.success'),
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {
|
|
this.getList()
|
|
}
|
|
})
|
|
})
|
|
}).catch(() => {})
|
|
}
|
|
},
|
|
handleAdd() {
|
|
this.showAddorEditDialog = true
|
|
this.$nextTick(() => {
|
|
this.$refs.addorEditDrawer.init()
|
|
})
|
|
},
|
|
async getList() {
|
|
this.listLoading = true
|
|
// edit here
|
|
const res = await page(this.listQuery)
|
|
if (res.code === 0) {
|
|
this.list = res.data.records
|
|
this.total = res.data.total
|
|
this.listLoading = false
|
|
}
|
|
},
|
|
async getListQuery() {
|
|
const resEq = await getEqList({
|
|
current: 1,
|
|
size: 999
|
|
})
|
|
this.eqList = resEq.data.records
|
|
const resWorker = await getWorkerList({
|
|
current: 1,
|
|
size: 999
|
|
})
|
|
this.workerList = resWorker.data.records
|
|
const resRole = await getRoleList()
|
|
this.roleList = resRole.data
|
|
console.log(this.roleList)
|
|
this.getList()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.usermanager-container {
|
|
padding: 20px;
|
|
.method-btn-area {
|
|
padding: 15px 30px;
|
|
margin: 10px 0 20px 0;
|
|
border: 1px solid #dfe6ec;
|
|
}
|
|
}
|
|
.edit-input {
|
|
padding-right: 100px;
|
|
}
|
|
.cancel-btn {
|
|
position: absolute;
|
|
right: 15px;
|
|
top: 10px;
|
|
}
|
|
</style>
|