forked from mt-fe-group/mt-yd-ui
update
This commit is contained in:
parent
affea8af59
commit
ffad1a2643
@ -178,7 +178,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmenfile/list'),
|
url: this.$http.adornUrl('/monitoring/equipmenfile/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -160,7 +160,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmengroup/list'),
|
url: this.$http.adornUrl('/monitoring/equipmengroup/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -154,7 +154,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmenattr/list'),
|
url: this.$http.adornUrl('/monitoring/equipmenattr/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -160,7 +160,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmenalarmlog/list'),
|
url: this.$http.adornUrl('/monitoring/equipmenalarmlog/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -190,7 +190,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmengroupalarm/list'),
|
url: this.$http.adornUrl('/monitoring/equipmengroupalarm/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -208,7 +208,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmenplc/list'),
|
url: this.$http.adornUrl('/monitoring/equipmenplc/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -154,7 +154,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmenplcconnect/list'),
|
url: this.$http.adornUrl('/monitoring/equipmenplcconnect/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -238,7 +238,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmenplcparam/list'),
|
url: this.$http.adornUrl('/monitoring/equipmenplcparam/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmenquantity/list'),
|
url: this.$http.adornUrl('/monitoring/equipmenquantity/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -178,7 +178,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmenstatuslog/list'),
|
url: this.$http.adornUrl('/monitoring/equipmenstatuslog/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -172,7 +172,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmentype/list'),
|
url: this.$http.adornUrl('/monitoring/equipmentype/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -178,7 +178,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/equipmentypefile/list'),
|
url: this.$http.adornUrl('/monitoring/equipmentypefile/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -178,7 +178,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/producarrt/list'),
|
url: this.$http.adornUrl('/monitoring/producarrt/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -1,271 +1,158 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="mod-config">
|
<div class="mod-config">
|
||||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button @click="getDataList()">查询</el-button>
|
<el-button @click="getDataList()">查询</el-button>
|
||||||
<el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
<el-button v-if="$hasPermission('monitoring:product:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
|
||||||
<el-button v-if="$hasPermission('monitoring:product:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
<el-button v-if="$hasPermission('monitoring:product:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table
|
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||||
:data="dataList"
|
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||||
border
|
<el-table-column prop="id" header-align="center" align="center" label="ID"></el-table-column>
|
||||||
v-loading="dataListLoading"
|
<el-table-column prop="code" header-align="center" align="center" label="编码"></el-table-column>
|
||||||
@selection-change="selectionChangeHandle"
|
<el-table-column prop="name" header-align="center" align="center" label="名称"></el-table-column>
|
||||||
style="width: 100%;">
|
<el-table-column prop="description" header-align="center" align="center" label="描述"></el-table-column>
|
||||||
<el-table-column
|
<el-table-column prop="externalCode" header-align="center" align="center" label="外部编码,用于对照外部系统的编码"></el-table-column>
|
||||||
type="selection"
|
<el-table-column prop="specifications" header-align="center" align="center" label="规格"></el-table-column>
|
||||||
header-align="center"
|
<el-table-column prop="unitDictValue" header-align="center" align="center" label="单位value,对应到数据字典label_value"></el-table-column>
|
||||||
align="center"
|
<el-table-column prop="area" header-align="center" align="center" label="一单位的面积(平方米)"></el-table-column>
|
||||||
width="50">
|
<el-table-column prop="processTime" header-align="center" align="center" label="加工一单位产品需要的时间"></el-table-column>
|
||||||
</el-table-column>
|
<el-table-column prop="typeDictValue" header-align="center" align="center" label="产品类型value,对应到数据字典label_value"></el-table-column>
|
||||||
<el-table-column
|
<el-table-column prop="enabled" header-align="center" align="center" label="启用状态:0 、停用,1、启用"></el-table-column>
|
||||||
prop="id"
|
<el-table-column prop="remark" header-align="center" align="center" label="备注"></el-table-column>
|
||||||
header-align="center"
|
<el-table-column prop="valid" header-align="center" align="center" label="删除标志,是否有效:1 可用 0不可用"></el-table-column>
|
||||||
align="center"
|
<el-table-column prop="creatorId" header-align="center" align="center" label="创建人"></el-table-column>
|
||||||
label="ID">
|
<el-table-column prop="creatorName" header-align="center" align="center" label="创建人姓名"></el-table-column>
|
||||||
</el-table-column>
|
<el-table-column prop="createTime" header-align="center" align="center" label="创建时间"></el-table-column>
|
||||||
<el-table-column
|
<el-table-column prop="updaterId" header-align="center" align="center" label="更新人"></el-table-column>
|
||||||
prop="code"
|
<el-table-column prop="updaterName" header-align="center" align="center" label="更新人姓名"></el-table-column>
|
||||||
header-align="center"
|
<el-table-column prop="updateTime" header-align="center" align="center" label="更新时间"></el-table-column>
|
||||||
align="center"
|
<el-table-column prop="version" header-align="center" align="center" label="版本号"></el-table-column>
|
||||||
label="编码">
|
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
|
||||||
</el-table-column>
|
<template slot-scope="scope">
|
||||||
<el-table-column
|
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
||||||
prop="name"
|
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
||||||
header-align="center"
|
</template>
|
||||||
align="center"
|
</el-table-column>
|
||||||
label="名称">
|
</el-table>
|
||||||
</el-table-column>
|
<el-pagination
|
||||||
<el-table-column
|
@size-change="sizeChangeHandle"
|
||||||
prop="description"
|
@current-change="currentChangeHandle"
|
||||||
header-align="center"
|
:current-page="pageIndex"
|
||||||
align="center"
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
label="描述">
|
:page-size="pageSize"
|
||||||
</el-table-column>
|
:total="totalPage"
|
||||||
<el-table-column
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
prop="externalCode"
|
></el-pagination>
|
||||||
header-align="center"
|
<!-- 弹窗, 新增 / 修改 -->
|
||||||
align="center"
|
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||||
label="外部编码,用于对照外部系统的编码">
|
</div>
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="specifications"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="规格">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="unitDictValue"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="单位value,对应到数据字典label_value">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="area"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="一单位的面积(平方米)">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="processTime"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="加工一单位产品需要的时间">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="typeDictValue"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="产品类型value,对应到数据字典label_value">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="enabled"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="启用状态:0 、停用,1、启用">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="remark"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="备注">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="valid"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="删除标志,是否有效:1 可用 0不可用">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="creatorId"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="创建人">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="creatorName"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="创建人姓名">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="createTime"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="创建时间">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="updaterId"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="更新人">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="updaterName"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="更新人姓名">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="updateTime"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="更新时间">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
prop="version"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
label="版本号">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
fixed="right"
|
|
||||||
header-align="center"
|
|
||||||
align="center"
|
|
||||||
width="150"
|
|
||||||
label="操作">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
|
|
||||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<el-pagination
|
|
||||||
@size-change="sizeChangeHandle"
|
|
||||||
@current-change="currentChangeHandle"
|
|
||||||
:current-page="pageIndex"
|
|
||||||
:page-sizes="[10, 20, 50, 100]"
|
|
||||||
:page-size="pageSize"
|
|
||||||
:total="totalPage"
|
|
||||||
layout="total, sizes, prev, pager, next, jumper">
|
|
||||||
</el-pagination>
|
|
||||||
<!-- 弹窗, 新增 / 修改 -->
|
|
||||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import AddOrUpdate from './product-add-or-update'
|
import AddOrUpdate from './product-add-or-update'
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
dataForm: {
|
dataForm: {
|
||||||
key: ''
|
key: ''
|
||||||
},
|
},
|
||||||
dataList: [],
|
dataList: [],
|
||||||
pageIndex: 1,
|
pageIndex: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
totalPage: 0,
|
totalPage: 0,
|
||||||
dataListLoading: false,
|
dataListLoading: false,
|
||||||
dataListSelections: [],
|
dataListSelections: [],
|
||||||
addOrUpdateVisible: false
|
addOrUpdateVisible: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
AddOrUpdate
|
AddOrUpdate
|
||||||
},
|
},
|
||||||
activated () {
|
activated() {
|
||||||
this.getDataList()
|
this.getDataList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 获取数据列表
|
// 获取数据列表
|
||||||
getDataList () {
|
getDataList() {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/product/list'),
|
url: this.$http.adornUrl('/monitoring/product/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
page: this.pageIndex,
|
||||||
'limit': this.pageSize,
|
limit: this.pageSize,
|
||||||
'key': this.dataForm.key
|
key: this.dataForm.key
|
||||||
})
|
})
|
||||||
}).then(({data}) => {
|
}).then(({ data }) => {
|
||||||
if (data && data.code === 0) {
|
if (data && data.code === 0) {
|
||||||
this.dataList = data.data.list
|
this.dataList = data.data.list
|
||||||
this.totalPage = data.data.total
|
this.totalPage = data.data.total
|
||||||
} else {
|
} else {
|
||||||
this.dataList = []
|
this.dataList = []
|
||||||
this.totalPage = 0
|
this.totalPage = 0
|
||||||
}
|
}
|
||||||
this.dataListLoading = false
|
this.dataListLoading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 每页数
|
// 每页数
|
||||||
sizeChangeHandle (val) {
|
sizeChangeHandle(val) {
|
||||||
this.pageSize = val
|
this.pageSize = val
|
||||||
this.pageIndex = 1
|
this.pageIndex = 1
|
||||||
this.getDataList()
|
this.getDataList()
|
||||||
},
|
},
|
||||||
// 当前页
|
// 当前页
|
||||||
currentChangeHandle (val) {
|
currentChangeHandle(val) {
|
||||||
this.pageIndex = val
|
this.pageIndex = val
|
||||||
this.getDataList()
|
this.getDataList()
|
||||||
},
|
},
|
||||||
// 多选
|
// 多选
|
||||||
selectionChangeHandle (val) {
|
selectionChangeHandle(val) {
|
||||||
this.dataListSelections = val
|
this.dataListSelections = val
|
||||||
},
|
},
|
||||||
// 新增 / 修改
|
// 新增 / 修改
|
||||||
addOrUpdateHandle (id) {
|
addOrUpdateHandle(id) {
|
||||||
this.addOrUpdateVisible = true
|
this.addOrUpdateVisible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs.addOrUpdate.init(id)
|
this.$refs.addOrUpdate.init(id)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 删除
|
// 删除
|
||||||
deleteHandle (id) {
|
deleteHandle(id) {
|
||||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
var ids = id
|
||||||
return item.id
|
? [id]
|
||||||
})
|
: this.dataListSelections.map(item => {
|
||||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
return item.id
|
||||||
confirmButtonText: '确定',
|
})
|
||||||
cancelButtonText: '取消',
|
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||||
type: 'warning'
|
confirmButtonText: '确定',
|
||||||
}).then(() => {
|
cancelButtonText: '取消',
|
||||||
this.$http({
|
type: 'warning'
|
||||||
url: this.$http.adornUrl('/monitoring/product/delete'),
|
}).then(() => {
|
||||||
method: 'post',
|
this.$http({
|
||||||
data: this.$http.adornData(ids, false)
|
url: this.$http.adornUrl('/monitoring/product/delete'),
|
||||||
}).then(({data}) => {
|
method: 'post',
|
||||||
if (data && data.code === 0) {
|
data: this.$http.adornData(ids, false)
|
||||||
this.$message({
|
}).then(({ data }) => {
|
||||||
message: '操作成功',
|
if (data && data.code === 0) {
|
||||||
type: 'success',
|
this.$message({
|
||||||
duration: 1500,
|
message: '操作成功',
|
||||||
onClose: () => {
|
type: 'success',
|
||||||
this.getDataList()
|
duration: 1500,
|
||||||
}
|
onClose: () => {
|
||||||
})
|
this.getDataList()
|
||||||
} else {
|
}
|
||||||
this.$message.error(data.msg)
|
})
|
||||||
}
|
} else {
|
||||||
})
|
this.$message.error(data.msg)
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/productionline/list'),
|
url: this.$http.adornUrl('/monitoring/productionline/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/productionlinerecsch/list'),
|
url: this.$http.adornUrl('/monitoring/productionlinerecsch/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -154,7 +154,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/qualityinspectiondet/list'),
|
url: this.$http.adornUrl('/monitoring/qualityinspectiondet/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/qualityinspectionrecord/list'),
|
url: this.$http.adornUrl('/monitoring/qualityinspectionrecord/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -148,7 +148,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/qualityinspectiontype/list'),
|
url: this.$http.adornUrl('/monitoring/qualityinspectiontype/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/reporsheet/list'),
|
url: this.$http.adornUrl('/monitoring/reporsheet/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -166,7 +166,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/reporsheecategory/list'),
|
url: this.$http.adornUrl('/monitoring/reporsheecategory/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -160,7 +160,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/sysfile/list'),
|
url: this.$http.adornUrl('/monitoring/sysfile/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -148,7 +148,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/sysfiletype/list'),
|
url: this.$http.adornUrl('/monitoring/sysfiletype/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -178,7 +178,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/workshopsection/list'),
|
url: this.$http.adornUrl('/monitoring/workshopsection/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -154,7 +154,7 @@
|
|||||||
getDataList () {
|
getDataList () {
|
||||||
this.dataListLoading = true
|
this.dataListLoading = true
|
||||||
this.$http({
|
this.$http({
|
||||||
url: this.$http.adornUrl('/monitoring/workshopsectionequipment/list'),
|
url: this.$http.adornUrl('/monitoring/workshopsectionequipment/page'),
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: this.$http.adornParams({
|
params: this.$http.adornParams({
|
||||||
'page': this.pageIndex,
|
'page': this.pageIndex,
|
||||||
|
@ -1,212 +1,205 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
|
<el-dialog :visible.sync="visible" :title="!dataForm.id ? $t('add') : $t('update')" :close-on-click-modal="false" :close-on-press-escape="false">
|
||||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
|
||||||
<el-form-item prop="username" :label="$t('user.username')">
|
<el-form-item prop="username" :label="$t('user.username')">
|
||||||
<el-input v-model="dataForm.username" :placeholder="$t('user.username')"></el-input>
|
<el-input v-model="dataForm.username" :placeholder="$t('user.username')"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="deptName" :label="$t('user.deptName')">
|
<el-form-item prop="deptName" :label="$t('user.deptName')">
|
||||||
<ren-dept-tree v-model="dataForm.deptId" :placeholder="$t('dept.title')" :dept-name.sync="dataForm.deptName"></ren-dept-tree>
|
<ren-dept-tree v-model="dataForm.deptId" :placeholder="$t('dept.title')" :dept-name.sync="dataForm.deptName"></ren-dept-tree>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password" :label="$t('user.password')" :class="{ 'is-required': !dataForm.id }">
|
<el-form-item prop="password" :label="$t('user.password')" :class="{ 'is-required': !dataForm.id }">
|
||||||
<el-input v-model="dataForm.password" type="password" :placeholder="$t('user.password')"></el-input>
|
<el-input v-model="dataForm.password" type="password" :placeholder="$t('user.password')"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="confirmPassword" :label="$t('user.confirmPassword')" :class="{ 'is-required': !dataForm.id }">
|
<el-form-item prop="confirmPassword" :label="$t('user.confirmPassword')" :class="{ 'is-required': !dataForm.id }">
|
||||||
<el-input v-model="dataForm.confirmPassword" type="password" :placeholder="$t('user.confirmPassword')"></el-input>
|
<el-input v-model="dataForm.confirmPassword" type="password" :placeholder="$t('user.confirmPassword')"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="realName" :label="$t('user.realName')">
|
<el-form-item prop="realName" :label="$t('user.realName')">
|
||||||
<el-input v-model="dataForm.realName" :placeholder="$t('user.realName')"></el-input>
|
<el-input v-model="dataForm.realName" :placeholder="$t('user.realName')"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="gender" :label="$t('user.gender')">
|
<el-form-item prop="gender" :label="$t('user.gender')">
|
||||||
<ren-radio-group v-model="dataForm.gender" dict-type="gender"></ren-radio-group>
|
<ren-radio-group v-model="dataForm.gender" dict-type="gender"></ren-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="email" :label="$t('user.email')">
|
<el-form-item prop="email" :label="$t('user.email')">
|
||||||
<el-input v-model="dataForm.email" :placeholder="$t('user.email')"></el-input>
|
<el-input v-model="dataForm.email" :placeholder="$t('user.email')"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="mobile" :label="$t('user.mobile')">
|
<el-form-item prop="mobile" :label="$t('user.mobile')">
|
||||||
<el-input v-model="dataForm.mobile" :placeholder="$t('user.mobile')"></el-input>
|
<el-input v-model="dataForm.mobile" :placeholder="$t('user.mobile')"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="roleIdList" :label="$t('user.roleIdList')" class="role-list">
|
<el-form-item prop="roleIdList" :label="$t('user.roleIdList')" class="role-list">
|
||||||
<el-select v-model="dataForm.roleIdList" multiple :placeholder="$t('user.roleIdList')">
|
<el-select v-model="dataForm.roleIdList" multiple :placeholder="$t('user.roleIdList')">
|
||||||
<el-option v-for="role in roleList" :key="role.id" :label="role.name" :value="role.id"></el-option>
|
<el-option v-for="role in roleList" :key="role.id" :label="role.name" :value="role.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="status" :label="$t('user.status')" size="mini">
|
<el-form-item prop="status" :label="$t('user.status')" size="mini">
|
||||||
<el-radio-group v-model="dataForm.status">
|
<el-radio-group v-model="dataForm.status">
|
||||||
<el-radio :label="0">{{ $t('user.status0') }}</el-radio>
|
<el-radio :label="0">{{ $t('user.status0') }}</el-radio>
|
||||||
<el-radio :label="1">{{ $t('user.status1') }}</el-radio>
|
<el-radio :label="1">{{ $t('user.status1') }}</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template slot="footer">
|
<template slot="footer">
|
||||||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
|
||||||
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import debounce from 'lodash/debounce'
|
import debounce from 'lodash/debounce'
|
||||||
import { isEmail, isMobile } from '@/utils/validate'
|
import { isEmail, isMobile } from '@/utils/validate'
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
visible: false,
|
visible: false,
|
||||||
roleList: [],
|
roleList: [],
|
||||||
roleIdListDefault: [],
|
roleIdListDefault: [],
|
||||||
dataForm: {
|
dataForm: {
|
||||||
id: '',
|
id: '',
|
||||||
username: '',
|
username: '',
|
||||||
deptId: '',
|
deptId: '',
|
||||||
deptName: '',
|
deptName: '',
|
||||||
password: '',
|
password: '',
|
||||||
confirmPassword: '',
|
confirmPassword: '',
|
||||||
realName: '',
|
realName: '',
|
||||||
gender: 0,
|
gender: 0,
|
||||||
email: '',
|
email: '',
|
||||||
mobile: '',
|
mobile: '',
|
||||||
roleIdList: [],
|
roleIdList: [],
|
||||||
status: 1
|
status: 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
dataRule () {
|
dataRule() {
|
||||||
var validatePassword = (rule, value, callback) => {
|
var validatePassword = (rule, value, callback) => {
|
||||||
if (!this.dataForm.id && !/\S/.test(value)) {
|
if (!this.dataForm.id && !/\S/.test(value)) {
|
||||||
return callback(new Error(this.$t('validate.required')))
|
return callback(new Error(this.$t('validate.required')))
|
||||||
}
|
}
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
var validateConfirmPassword = (rule, value, callback) => {
|
var validateConfirmPassword = (rule, value, callback) => {
|
||||||
if (!this.dataForm.id && !/\S/.test(value)) {
|
if (!this.dataForm.id && !/\S/.test(value)) {
|
||||||
return callback(new Error(this.$t('validate.required')))
|
return callback(new Error(this.$t('validate.required')))
|
||||||
}
|
}
|
||||||
if (this.dataForm.password !== value) {
|
if (this.dataForm.password !== value) {
|
||||||
return callback(new Error(this.$t('user.validate.confirmPassword')))
|
return callback(new Error(this.$t('user.validate.confirmPassword')))
|
||||||
}
|
}
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
var validateEmail = (rule, value, callback) => {
|
var validateEmail = (rule, value, callback) => {
|
||||||
if (value && !isEmail(value)) {
|
if (value && !isEmail(value)) {
|
||||||
return callback(new Error(this.$t('validate.format', { 'attr': this.$t('user.email') })))
|
return callback(new Error(this.$t('validate.format', { attr: this.$t('user.email') })))
|
||||||
}
|
}
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
var validateMobile = (rule, value, callback) => {
|
var validateMobile = (rule, value, callback) => {
|
||||||
if (value && !isMobile(value)) {
|
if (value && !isMobile(value)) {
|
||||||
return callback(new Error(this.$t('validate.format', { 'attr': this.$t('user.mobile') })))
|
return callback(new Error(this.$t('validate.format', { attr: this.$t('user.mobile') })))
|
||||||
}
|
}
|
||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
username: [
|
username: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
deptName: [{ required: true, message: this.$t('validate.required'), trigger: 'change' }],
|
||||||
],
|
password: [{ validator: validatePassword, trigger: 'blur' }],
|
||||||
deptName: [
|
confirmPassword: [{ validator: validateConfirmPassword, trigger: 'blur' }],
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
realName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||||
],
|
email: [{ validator: validateEmail, trigger: 'blur' }],
|
||||||
password: [
|
mobile: [{ validator: validateMobile, trigger: 'blur' }]
|
||||||
{ validator: validatePassword, trigger: 'blur' }
|
}
|
||||||
],
|
}
|
||||||
confirmPassword: [
|
},
|
||||||
{ validator: validateConfirmPassword, trigger: 'blur' }
|
methods: {
|
||||||
],
|
init() {
|
||||||
realName: [
|
this.visible = true
|
||||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
this.dataForm.deptId = ''
|
||||||
],
|
this.$nextTick(() => {
|
||||||
email: [
|
this.$refs['dataForm'].resetFields()
|
||||||
{ validator: validateEmail, trigger: 'blur' }
|
this.roleIdListDefault = []
|
||||||
],
|
Promise.all([this.getRoleList()]).then(() => {
|
||||||
mobile: [
|
if (this.dataForm.id) {
|
||||||
{ validator: validateMobile, trigger: 'blur' }
|
this.getInfo()
|
||||||
]
|
}
|
||||||
}
|
})
|
||||||
}
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
// 获取角色列表
|
||||||
init () {
|
getRoleList() {
|
||||||
this.visible = true
|
return this.$http
|
||||||
this.dataForm.deptId = ''
|
.get(this.$http.adornUrl('/sys/role/list'))
|
||||||
this.$nextTick(() => {
|
.then(({ data: res }) => {
|
||||||
this.$refs['dataForm'].resetFields()
|
if (res.code !== 0) {
|
||||||
this.roleIdListDefault = []
|
return this.$message.error(res.msg)
|
||||||
Promise.all([
|
}
|
||||||
this.getRoleList()
|
this.roleList = res.data
|
||||||
]).then(() => {
|
})
|
||||||
if (this.dataForm.id) {
|
.catch(() => {})
|
||||||
this.getInfo()
|
},
|
||||||
}
|
// 获取信息
|
||||||
})
|
getInfo() {
|
||||||
})
|
this.$http
|
||||||
},
|
.get(this.$http.adornUrl(`/sys/user/${this.dataForm.id}`))
|
||||||
// 获取角色列表
|
.then(({ data: res }) => {
|
||||||
getRoleList () {
|
if (res.code !== 0) {
|
||||||
return this.$http.get(this.$http.adornUrl('/sys/role/list')).then(({ data: res }) => {
|
return this.$message.error(res.msg)
|
||||||
if (res.code !== 0) {
|
}
|
||||||
return this.$message.error(res.msg)
|
this.dataForm = {
|
||||||
}
|
...this.dataForm,
|
||||||
this.roleList = res.data
|
...res.data,
|
||||||
}).catch(() => {})
|
roleIdList: []
|
||||||
},
|
}
|
||||||
// 获取信息
|
// 角色配置, 区分是否为默认角色
|
||||||
getInfo () {
|
for (var i = 0; i < res.data.roleIdList.length; i++) {
|
||||||
this.$http.get(this.$http.adornUrl(`/sys/user/${this.dataForm.id}`)).then(({ data: res }) => {
|
if (this.roleList.filter(item => item.id === res.data.roleIdList[i])[0]) {
|
||||||
if (res.code !== 0) {
|
this.dataForm.roleIdList.push(res.data.roleIdList[i])
|
||||||
return this.$message.error(res.msg)
|
continue
|
||||||
}
|
}
|
||||||
this.dataForm = {
|
this.roleIdListDefault.push(res.data.roleIdList[i])
|
||||||
...this.dataForm,
|
}
|
||||||
...res.data,
|
})
|
||||||
roleIdList: []
|
.catch(() => {})
|
||||||
}
|
},
|
||||||
// 角色配置, 区分是否为默认角色
|
// 表单提交
|
||||||
for (var i = 0; i < res.data.roleIdList.length; i++) {
|
dataFormSubmitHandle: debounce(
|
||||||
if (this.roleList.filter(item => item.id === res.data.roleIdList[i])[0]) {
|
function() {
|
||||||
this.dataForm.roleIdList.push(res.data.roleIdList[i])
|
this.$refs['dataForm'].validate(valid => {
|
||||||
continue
|
if (!valid) {
|
||||||
}
|
return false
|
||||||
this.roleIdListDefault.push(res.data.roleIdList[i])
|
}
|
||||||
}
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', {
|
||||||
}).catch(() => {})
|
...this.dataForm,
|
||||||
},
|
roleIdList: [...this.dataForm.roleIdList, ...this.roleIdListDefault]
|
||||||
// 表单提交
|
})
|
||||||
dataFormSubmitHandle: debounce(function () {
|
.then(({ data: res }) => {
|
||||||
this.$refs['dataForm'].validate((valid) => {
|
if (res.code !== 0) {
|
||||||
if (!valid) {
|
return this.$message.error(res.msg)
|
||||||
return false
|
}
|
||||||
}
|
this.$message({
|
||||||
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', {
|
message: this.$t('prompt.success'),
|
||||||
...this.dataForm,
|
type: 'success',
|
||||||
roleIdList: [
|
duration: 500,
|
||||||
...this.dataForm.roleIdList,
|
onClose: () => {
|
||||||
...this.roleIdListDefault
|
this.visible = false
|
||||||
]
|
this.$emit('refreshDataList')
|
||||||
}).then(({ data: res }) => {
|
}
|
||||||
if (res.code !== 0) {
|
})
|
||||||
return this.$message.error(res.msg)
|
})
|
||||||
}
|
.catch(() => {})
|
||||||
this.$message({
|
})
|
||||||
message: this.$t('prompt.success'),
|
},
|
||||||
type: 'success',
|
1000,
|
||||||
duration: 500,
|
{ leading: true, trailing: false }
|
||||||
onClose: () => {
|
)
|
||||||
this.visible = false
|
}
|
||||||
this.$emit('refreshDataList')
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}).catch(() => {})
|
|
||||||
})
|
|
||||||
}, 1000, { 'leading': true, 'trailing': false })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.mod-sys__user {
|
.mod-sys__user {
|
||||||
.role-list {
|
.role-list {
|
||||||
.el-select {
|
.el-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user