update 一些视图,并且优化dialog

This commit is contained in:
2022-08-11 15:23:48 +08:00
parent cd9beb120a
commit 0ef30e1985
11 changed files with 163 additions and 114 deletions

View File

@@ -7,7 +7,6 @@
<el-form-item>
<el-button @click="getDataList()">查询</el-button>
<el-button v-if="$hasPermission('monitoring:factory:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
</el-form-item>
</el-form>
<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
@@ -35,7 +34,7 @@
</template>
</el-table-column>
</el-table> -->
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
@@ -47,12 +46,13 @@
>
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
</div>
</template>
<script>
import AddOrUpdate from './factory-add-or-update'
// import AddOrUpdate from './factory-add-or-update'
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
import BaseTable from '@/components/base-table'
import TableOperateComponent from '@/components/base-table/components/operationComponent'
import TableTextComponent from '@/components/base-table/components/detailComponent'
@@ -63,23 +63,37 @@ const tableConfigs = [
{ prop: 'code', name: '工厂编码' },
{ prop: 'address', name: '地址' },
{ prop: 'remark', name: '备注' },
// { prop: 'id', name: 'id' },
// { prop: 'description', name: '描述' },
// { prop: 'enabled', name: '启用状态:0 、停用1、启用' },
// { prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' },
// { prop: 'creatorId', name: '创建人' },
// { prop: 'creatorName', name: '创建人姓名' },
// { prop: 'updaterId', name: '更新人' },
// { prop: 'updaterName', name: '更新人姓名' },
// { prop: 'updateTime', name: '更新时间' },
// { prop: 'version', name: '版本号' },
// { prop: 'externalCode', name: '外部系统编码' },
{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
]
const addOrUpdateConfigs = {
type: 'dialog',
infoUrl: '/monitoring/factory',
fields: [
'name',
{
name: 'code',
api: '/monitoring/factory/getCode'
},
{
name: 'address',
label: '地址',
placeholder: '请输入地址'
},
'remark'
],
operations: [
{ name: 'reset', url: true, showAlways: true },
{ name: 'cancel', url: true, showAlways: true },
{ name: 'save', url: '/monitoring/factory', permission: '', showOnEdit: false },
{ name: 'update', url: '/monitoring/factory', permission: '', showOnEdit: true }
]
}
export default {
data() {
return {
addOrUpdateConfigs,
tableConfigs,
dataForm: {
key: ''
@@ -103,6 +117,7 @@ export default {
methods: {
// 获取数据列表
getDataList() {
this.addOrUpdateVisible = false
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/monitoring/factory/page'),
@@ -138,6 +153,14 @@ export default {
selectionChangeHandle(val) {
this.dataListSelections = val
},
handleOperations({ type, data: id }) {
switch (type) {
case 'edit':
return this.addOrUpdateHandle(id)
case 'delete':
return this.deleteHandle(id)
}
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true