|
@@ -51,7 +51,7 @@
|
|
|
<template #buttons>
|
|
|
<el-button v-if="hasPermission('sys:user:add')" type="primary" size="small" icon="el-icon-plus" @click="add()">新建</el-button>
|
|
|
<el-button v-if="hasPermission('sys:user:edit')" type="warning" size="small" icon="el-icon-edit-outline" @click="edit()" :disabled="$refs.userTable && $refs.userTable.getCheckboxRecords().length !== 1" plain>修改</el-button>
|
|
|
- <el-button v-if="hasPermission('sys:user:del')" type="danger" size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.userTable && $refs.userTable.getCheckboxRecords().length === 0" plain>删除</el-button>
|
|
|
+<!-- <el-button v-if="hasPermission('sys:user:del')" type="danger" size="small" icon="el-icon-delete" @click="del()" :disabled="$refs.userTable && $refs.userTable.getCheckboxRecords().length === 0" plain>删除</el-button>-->
|
|
|
<el-button v-if="hasPermission('sys:user:import')" type="default" @click="downloadTpl()" size="small">下载模板</el-button>
|
|
|
<!-- <el-button size="small" @click="updateAllUser">同步花名册</el-button>-->
|
|
|
</template>
|
|
@@ -87,41 +87,42 @@
|
|
|
>
|
|
|
<vxe-column type="seq" width="60" title="序号"></vxe-column>
|
|
|
<vxe-column type="checkbox" width="40px"></vxe-column>
|
|
|
- <vxe-column title="头像" field="photo">
|
|
|
+ <vxe-column title="头像" field="photo" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<img :src="scope.row.photo === ''?'/static/img/avatar.png':scope.row.photo" style="height:35px"/>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
- <vxe-column title="登录名" field="loginName" sortable>
|
|
|
+ <vxe-column title="登录名" field="loginName" align="center" sortable>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-link type="primary" :underline="false" v-if="hasPermission('sys:user:edit')" @click="edit(scope.row.id)">{{scope.row.loginName}}</el-link>
|
|
|
- <el-link type="primary" :underline="false" v-else-if="hasPermission('sys:user:view')" @click="view(scope.row.id,)">{{scope.row.loginName}}</el-link>
|
|
|
+<!-- <el-link type="primary" :underline="false" v-if="hasPermission('sys:user:edit')" @click="edit(scope.row.id)">{{scope.row.loginName}}</el-link>-->
|
|
|
+ <el-link type="primary" :underline="false" v-if="hasPermission('sys:user:view')" @click="view(scope.row.id,)">{{scope.row.loginName}}</el-link>
|
|
|
<span v-else>{{scope.row.loginName}}</span>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
|
|
|
- <vxe-column title="姓名" field="name" sortable></vxe-column>
|
|
|
- <vxe-column title="集团" field="companyDTO.name" sortable>
|
|
|
+ <vxe-column title="姓名" field="name" align="center" sortable></vxe-column>
|
|
|
+ <vxe-column title="集团" field="companyDTO.name" align="center" sortable>
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag>{{scope.row.companyDTO && scope.row.companyDTO.name}}</el-tag>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
- <vxe-column title="部门" field="officeDTO.name" sortable>
|
|
|
+ <vxe-column title="部门" field="officeDTO.name" align="center" sortable>
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag>{{scope.row.officeDTO && scope.row.officeDTO.name}}</el-tag>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
- <vxe-column title="状态" field="loginFlag" sortable>
|
|
|
+ <vxe-column title="状态" field="loginFlag" align="center" sortable>
|
|
|
<template slot-scope="scope">
|
|
|
<el-tag v-if="scope.row.loginFlag === '1'" size="small" type="success">正常</el-tag>
|
|
|
<el-tag v-else-if="scope.row.loginFlag === '0'" size="small" type="danger">禁用</el-tag>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
- <vxe-column title="操作" width="200px" fixed="right" align="center">
|
|
|
+ <vxe-column title="操作" width="130px" fixed="right" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button v-if="hasPermission('sys:user:view')" type="text" size="small" icon="el-icon-view" @click="view(scope.row.id)">查看</el-button>
|
|
|
- <el-button v-if="hasPermission('sys:user:edit')" type="text" size="small" icon="el-icon-edit" @click="edit(scope.row.id)">修改</el-button>
|
|
|
- <el-button v-if="hasPermission('sys:user:del')" type="text" size="small" icon="el-icon-delete" @click="del(scope.row.id)">删除</el-button>
|
|
|
+<!-- <el-button v-if="hasPermission('sys:user:view')" type="text" size="small" @click="view(scope.row.id)">查看</el-button>-->
|
|
|
+ <el-button v-if="hasPermission('sys:user:edit') && (commonJS.isEmpty(scope.row.pushFailed) || scope.row.pushFailed)" type="text" size="small" @click="edit(scope.row.id)">修改</el-button>
|
|
|
+ <el-button v-if="hasPermission('sys:user:del') && (commonJS.isEmpty(scope.row.pushFailed) || scope.row.pushFailed)" type="text" size="small" @click="del(scope.row.id)">删除</el-button>
|
|
|
+ <el-button v-if="hasPermission('sys:user:edit') && !scope.row.pushFailed" type="text" size="small" @click="pushData(scope.row.id)">推送</el-button>
|
|
|
</template>
|
|
|
</vxe-column>
|
|
|
</vxe-table>
|
|
@@ -268,23 +269,34 @@
|
|
|
},
|
|
|
// 删除
|
|
|
del (id) {
|
|
|
- let ids = id || this.$refs.userTable.getCheckboxRecords().map(item => {
|
|
|
- return item.id
|
|
|
- }).join(',')
|
|
|
- this.$confirm(`确定删除所选项吗?`, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.loading = true
|
|
|
- this.userService.delete(ids).then(({data}) => {
|
|
|
- this.loading = false
|
|
|
- this.$message.success({dangerouslyUseHTMLString: true,
|
|
|
- message: data})
|
|
|
+ this.userService.checkIsSyncFailed(id).then(({data}) => {
|
|
|
+ if (this.commonJS.isNotEmpty(data) && !data.success) {
|
|
|
+ // 不允许删除
|
|
|
+ this.$message.warning(data.message + ',请重新推送后再进行尝试')
|
|
|
this.refreshList()
|
|
|
- }).catch(() => {
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
+ } else {
|
|
|
+ let ids = id || this.$refs.userTable.getCheckboxRecords().map(item => {
|
|
|
+ return item.id
|
|
|
+ }).join(',')
|
|
|
+ this.$confirm(`删除用户数据时会同时删除关联的花名册数据以及子系统数据,确定删除吗?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.loading = true
|
|
|
+ this.userService.delete(ids).then(({data}) => {
|
|
|
+ this.loading = false
|
|
|
+ if (data.success) {
|
|
|
+ this.$message.success({dangerouslyUseHTMLString: true, message: data.message})
|
|
|
+ } else {
|
|
|
+ this.$message.warning({dangerouslyUseHTMLString: true, message: data.message})
|
|
|
+ }
|
|
|
+ this.refreshList()
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
// 下载模板
|
|
@@ -353,6 +365,41 @@
|
|
|
},
|
|
|
updateAllUser () {
|
|
|
this.userService.updateAllUser()
|
|
|
+ },
|
|
|
+ pushData (userId) {
|
|
|
+ this.loading = true
|
|
|
+ this.userService.checkIsSyncFailed(userId).then(({data}) => {
|
|
|
+ this.loading = false
|
|
|
+ if (this.commonJS.isNotEmpty(data) && !data.success) {
|
|
|
+ this.$confirm(data.message + ',是否重新推送', '提示', {
|
|
|
+ confirmButtonText: '重新推送',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.loading = true
|
|
|
+ let param = {
|
|
|
+ id: userId
|
|
|
+ }
|
|
|
+ this.userService.pushUserSync(param).then(({data}) => {
|
|
|
+ if (data) {
|
|
|
+ this.$message.success('推送数据到子系统成功')
|
|
|
+ } else {
|
|
|
+ this.$message.error('推送数据到子系统失败,请稍后再进行尝试')
|
|
|
+ }
|
|
|
+ this.loading = false
|
|
|
+ this.refreshList()
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ this.refreshList()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.success('没有获取到需要推送的数据')
|
|
|
+ this.refreshList()
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|