[update 分组管理] 页面无接口

This commit is contained in:
danshihao
2024-07-18 18:51:13 +08:00
parent 8704f001ae
commit e6acccee3d
6 changed files with 334 additions and 6 deletions
@@ -0,0 +1,146 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<!--分组名称-->
<a-col :md="6" :sm="12">
<a-form-item :label="$t('system.groupMange.groupName')">
<j-input
:placeholder="$t('pleaseEnter') + $t('system.groupMange.groupName')"
v-model="queryParam.name"></j-input>
</a-form-item>
</a-col>
<!--用户名称/工号-->
<a-col :md="6" :sm="12">
<a-form-item :label="`${$t('system.groupMange.userName')}/${$t('user.workNo')}`">
<j-input
:placeholder="$t('pleaseEnter') + `${$t('system.groupMange.userName')}/${$t('user.workNo')}`"
v-model="queryParam.name"></j-input>
</a-form-item>
</a-col>
<div style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search" v-has="'sys:groupManage:search'">
{{ $t('query') }}
</a-button>
<a-button type="primary" ghost @click="searchReset" icon="reload" style="margin-left: 8px">
{{ $t('reset') }}
</a-button>
</div>
</a-row>
</a-form>
</div>
<div class="table-operator" v-has="'sys:groupManage:add'">
<!-- 新增 -->
<a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button>
</div>
<!-- table区域-begin -->
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%', y: yScrollHeight}"
ref="table"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<template v-slot:action="{text, record}">
<a @click="handleEdit(record)" v-has="'sys:groupManage:edit'">{{ $t('edit') }}</a>
</template>
</j-table>
</div>
<!--新增编辑-->
<group-manage-modal ref="modalForm" @ok="modalFormOk"/>
</a-card>
</template>
<script>
import JTable from '@/components/jero/JTable'
import { JeroListMixin } from '@/mixins/JeroListMixin'
import GroupManageModal from '@views/system/groupManage/modules/GroupManageModal'
export default {
name: 'GroupManageList',
components: {
GroupManageModal,
JTable
},
mixins: [JeroListMixin],
data () {
return {
columns: [
{
title: this.$t('serialNumber'),
dataIndex: '',
key: 'rowIndex',
align: 'center',
width: 80,
customRender: function (t, r, index) {
return parseInt(index) + 1
}
},
{
title: this.$t('system.groupMange.groupName'),
align: 'center',
width: 180,
dataIndex: 'name',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('system.groupMange.peopleNumber'),
align: 'center',
width: 180,
dataIndex: 'link',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('system.groupMange.groupMembers'),
align: 'center',
width: 180,
dataIndex: 'user',
scopedSlots: { customRender: 'text' }
},
{
title: this.$t('operation'),
scopedSlots: { customRender: 'action' },
align: 'center',
width: 100
}
],
url: {
list: ''
}
}
},
methods: {
}
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';
/deep/ .table-page-search-wrapper .ant-form-inline .ant-form-item > .ant-form-item-label {
min-width: 80px;
}
.table-image {
img {
max-width: 100%;
max-height: 50px;
}
}
</style>
@@ -0,0 +1,140 @@
<template>
<j-modal
:title="title"
:maskClosable="true"
:width="500"
:closable="true"
switchFullscreen
@cancel="handleCancel"
@ok="handleOk"
:confirm-loading="confirmLoading"
:visible="visible">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<!--分组名称-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('system.groupMange.groupName')">
<a-input
v-decorator.trim="[ 'groupName', validatorRules.groupName]"
:maxLength="50"
:placeholder="$t('pleaseEnter')+$t('system.groupMange.groupName')"
></a-input>
</a-form-item>
<!--组内人员-->
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('system.groupMange.groupMembers')">
<user-selection :placeholder="$t('pleaseSelect')+$t('system.groupMange.groupMembers')"
v-decorator="['users', validatorRules.peopleNumber]"
filedName="users"
@nameChange="userSelectNameChange"
:nameStr="model.users_dictText"
input-type="textarea"
type="checkbox" />
</a-form-item>
</a-form>
</a-spin>
</j-modal>
</template>
<script>
import { postAction } from '@/api/manage'
import UserSelection from '@comp/selection/UserSelection'
export default {
name: 'GroupManageModal',
components: { UserSelection },
data () {
return {
title: '',
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 }
},
validatorRules: {
// 分组名称
groupName: {
rules: [
{ required: true, message: this.$t('pleaseEnter') + this.$t('system.groupMange.groupName') }
],
validateTrigger: 'blur'
},
// 组内人员
peopleNumber: {
rules: [
{ required: true, message: this.$t('pleaseSelect') + this.$t('system.groupMange.peopleNumber') }
],
validateTrigger: 'change'
}
},
url: {
add: '',
edit: ''
}
}
},
methods: {
userSelectNameChange (value, fieldName) {
this.model[fieldName + '_dictText'] = value
},
add () {
this.edit({})
},
edit (record) {
this.visible = true
this.form.resetFields()
this.model = Object.assign({}, record)
this.$nextTick(() => {
this.form.setFieldsValue(this.model)
})
},
handleCancel () {
this.close()
},
handleOk () {
if (this.confirmLoading) return
this.form.validateFields((err, values) => {
if (!err) {
this.confirmLoading = true
const param = Object.assign({}, this.model, values)
let url
if (this.model.id) {
url = this.url.edit
} else {
url = this.url.add
}
postAction(url, param).then(res => {
if (res.success) {
this.$message.success(res.message)
this.$emit('ok')
this.close()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
// 防止连点提交
setTimeout(() => {
this.confirmLoading = false
}, 700)
})
}
})
},
close () {
this.visible = false
this.model = {}
}
}
}
</script>
<style scoped>
</style>