forked from mt-fe-group/mt-yd-ui
update
This commit is contained in:
parent
affea8af59
commit
ffad1a2643
@ -178,7 +178,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmenfile/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmenfile/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -160,7 +160,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmengroup/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmengroup/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -154,7 +154,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmenattr/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmenattr/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -160,7 +160,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmenalarmlog/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmenalarmlog/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -190,7 +190,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmengroupalarm/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmengroupalarm/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -208,7 +208,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmenplc/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmenplc/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -154,7 +154,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmenplcconnect/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmenplcconnect/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -238,7 +238,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmenplcparam/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmenplcparam/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -184,7 +184,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmenquantity/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmenquantity/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -178,7 +178,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmenstatuslog/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmenstatuslog/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -172,7 +172,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentype/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmentype/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -178,7 +178,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/equipmentypefile/list'),
|
||||
url: this.$http.adornUrl('/monitoring/equipmentypefile/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -178,7 +178,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/producarrt/list'),
|
||||
url: this.$http.adornUrl('/monitoring/producarrt/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -10,144 +10,29 @@
|
||||
<el-button v-if="$hasPermission('monitoring:product:delete')" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="ID">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="code"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="编码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="description"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="描述">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="externalCode"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="外部编码,用于对照外部系统的编码">
|
||||
</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="操作">
|
||||
<el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
|
||||
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"></el-table-column>
|
||||
<el-table-column prop="code" header-align="center" align="center" label="编码"></el-table-column>
|
||||
<el-table-column prop="name" header-align="center" align="center" label="名称"></el-table-column>
|
||||
<el-table-column prop="description" header-align="center" align="center" label="描述"></el-table-column>
|
||||
<el-table-column prop="externalCode" header-align="center" align="center" label="外部编码,用于对照外部系统的编码"></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>
|
||||
@ -161,17 +46,17 @@
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<!-- 弹窗, 新增 / 修改 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './product-add-or-update'
|
||||
export default {
|
||||
data () {
|
||||
import AddOrUpdate from './product-add-or-update'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
@ -188,22 +73,22 @@
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated () {
|
||||
activated() {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList () {
|
||||
getDataList() {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/product/list'),
|
||||
url: this.$http.adornUrl('/monitoring/product/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
'limit': this.pageSize,
|
||||
'key': this.dataForm.key
|
||||
page: this.pageIndex,
|
||||
limit: this.pageSize,
|
||||
key: this.dataForm.key
|
||||
})
|
||||
}).then(({data}) => {
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.dataList = data.data.list
|
||||
this.totalPage = data.data.total
|
||||
@ -215,30 +100,32 @@
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
sizeChangeHandle(val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
currentChangeHandle(val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
selectionChangeHandle(val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
addOrUpdateHandle(id) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
deleteHandle(id) {
|
||||
var ids = id
|
||||
? [id]
|
||||
: this.dataListSelections.map(item => {
|
||||
return item.id
|
||||
})
|
||||
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
|
||||
@ -250,7 +137,7 @@
|
||||
url: this.$http.adornUrl('/monitoring/product/delete'),
|
||||
method: 'post',
|
||||
data: this.$http.adornData(ids, false)
|
||||
}).then(({data}) => {
|
||||
}).then(({ data }) => {
|
||||
if (data && data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
@ -267,5 +154,5 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -184,7 +184,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionline/list'),
|
||||
url: this.$http.adornUrl('/monitoring/productionline/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -124,7 +124,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/productionlinerecsch/list'),
|
||||
url: this.$http.adornUrl('/monitoring/productionlinerecsch/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -154,7 +154,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityinspectiondet/list'),
|
||||
url: this.$http.adornUrl('/monitoring/qualityinspectiondet/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -184,7 +184,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityinspectionrecord/list'),
|
||||
url: this.$http.adornUrl('/monitoring/qualityinspectionrecord/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -148,7 +148,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/qualityinspectiontype/list'),
|
||||
url: this.$http.adornUrl('/monitoring/qualityinspectiontype/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -184,7 +184,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reporsheet/list'),
|
||||
url: this.$http.adornUrl('/monitoring/reporsheet/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -166,7 +166,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/reporsheecategory/list'),
|
||||
url: this.$http.adornUrl('/monitoring/reporsheecategory/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -160,7 +160,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/sysfile/list'),
|
||||
url: this.$http.adornUrl('/monitoring/sysfile/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -148,7 +148,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/sysfiletype/list'),
|
||||
url: this.$http.adornUrl('/monitoring/sysfiletype/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -178,7 +178,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopsection/list'),
|
||||
url: this.$http.adornUrl('/monitoring/workshopsection/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -154,7 +154,7 @@
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
this.$http({
|
||||
url: this.$http.adornUrl('/monitoring/workshopsectionequipment/list'),
|
||||
url: this.$http.adornUrl('/monitoring/workshopsectionequipment/page'),
|
||||
method: 'get',
|
||||
params: this.$http.adornParams({
|
||||
'page': this.pageIndex,
|
||||
|
@ -48,7 +48,7 @@
|
||||
import debounce from 'lodash/debounce'
|
||||
import { isEmail, isMobile } from '@/utils/validate'
|
||||
export default {
|
||||
data () {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
roleList: [],
|
||||
@ -70,7 +70,7 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dataRule () {
|
||||
dataRule() {
|
||||
var validatePassword = (rule, value, callback) => {
|
||||
if (!this.dataForm.id && !/\S/.test(value)) {
|
||||
return callback(new Error(this.$t('validate.required')))
|
||||
@ -88,51 +88,35 @@ export default {
|
||||
}
|
||||
var validateEmail = (rule, value, callback) => {
|
||||
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()
|
||||
}
|
||||
var validateMobile = (rule, value, callback) => {
|
||||
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()
|
||||
}
|
||||
return {
|
||||
username: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
],
|
||||
deptName: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'change' }
|
||||
],
|
||||
password: [
|
||||
{ validator: validatePassword, trigger: 'blur' }
|
||||
],
|
||||
confirmPassword: [
|
||||
{ validator: validateConfirmPassword, trigger: 'blur' }
|
||||
],
|
||||
realName: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
],
|
||||
email: [
|
||||
{ validator: validateEmail, trigger: 'blur' }
|
||||
],
|
||||
mobile: [
|
||||
{ validator: validateMobile, trigger: 'blur' }
|
||||
]
|
||||
username: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||
deptName: [{ required: true, message: this.$t('validate.required'), trigger: 'change' }],
|
||||
password: [{ validator: validatePassword, trigger: 'blur' }],
|
||||
confirmPassword: [{ validator: validateConfirmPassword, trigger: 'blur' }],
|
||||
realName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
|
||||
email: [{ validator: validateEmail, trigger: 'blur' }],
|
||||
mobile: [{ validator: validateMobile, trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init () {
|
||||
init() {
|
||||
this.visible = true
|
||||
this.dataForm.deptId = ''
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.roleIdListDefault = []
|
||||
Promise.all([
|
||||
this.getRoleList()
|
||||
]).then(() => {
|
||||
Promise.all([this.getRoleList()]).then(() => {
|
||||
if (this.dataForm.id) {
|
||||
this.getInfo()
|
||||
}
|
||||
@ -140,17 +124,22 @@ export default {
|
||||
})
|
||||
},
|
||||
// 获取角色列表
|
||||
getRoleList () {
|
||||
return this.$http.get(this.$http.adornUrl('/sys/role/list')).then(({ data: res }) => {
|
||||
getRoleList() {
|
||||
return this.$http
|
||||
.get(this.$http.adornUrl('/sys/role/list'))
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
this.roleList = res.data
|
||||
}).catch(() => {})
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
// 获取信息
|
||||
getInfo () {
|
||||
this.$http.get(this.$http.adornUrl(`/sys/user/${this.dataForm.id}`)).then(({ data: res }) => {
|
||||
getInfo() {
|
||||
this.$http
|
||||
.get(this.$http.adornUrl(`/sys/user/${this.dataForm.id}`))
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
@ -167,21 +156,21 @@ export default {
|
||||
}
|
||||
this.roleIdListDefault.push(res.data.roleIdList[i])
|
||||
}
|
||||
}).catch(() => {})
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmitHandle: debounce(function () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
dataFormSubmitHandle: debounce(
|
||||
function() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (!valid) {
|
||||
return false
|
||||
}
|
||||
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', {
|
||||
...this.dataForm,
|
||||
roleIdList: [
|
||||
...this.dataForm.roleIdList,
|
||||
...this.roleIdListDefault
|
||||
]
|
||||
}).then(({ data: res }) => {
|
||||
roleIdList: [...this.dataForm.roleIdList, ...this.roleIdListDefault]
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
if (res.code !== 0) {
|
||||
return this.$message.error(res.msg)
|
||||
}
|
||||
@ -194,9 +183,13 @@ export default {
|
||||
this.$emit('refreshDataList')
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
})
|
||||
}, 1000, { 'leading': true, 'trailing': false })
|
||||
.catch(() => {})
|
||||
})
|
||||
},
|
||||
1000,
|
||||
{ leading: true, trailing: false }
|
||||
)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user