业主管理、设备类型管理、项目类型管理功能开发。
This commit is contained in:
parent
febb97dfa9
commit
98eef3af01
|
|
@ -0,0 +1,34 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 获取层级列表
|
||||
export function getDeviceTypeListApi(query) {
|
||||
return request({
|
||||
url: '/deviceType/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
// 新增层级
|
||||
export function addDeviceTypeApi(data) {
|
||||
return request({
|
||||
url: '/deviceType/add',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
// 删除层级
|
||||
export function delDeviceTypeApi(data) {
|
||||
return request({
|
||||
url: '/deviceType/del',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
// 修改层级
|
||||
export function editDeviceTypeApi(data) {
|
||||
return request({
|
||||
url: '/deviceType/update',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 获取层级列表
|
||||
export function getOwnerListApi(query) {
|
||||
return request({
|
||||
url: '/owner/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
// 新增层级
|
||||
export function addOwnerApi(data) {
|
||||
return request({
|
||||
url: '/owner/add',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
// 删除层级
|
||||
export function delOwnerApi(data) {
|
||||
return request({
|
||||
url: '/owner/del',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
// 修改层级
|
||||
export function editOwnerApi(data) {
|
||||
return request({
|
||||
url: '/owner/update',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 获取层级列表
|
||||
export function getProTypeListApi(query) {
|
||||
return request({
|
||||
url: '/proType/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
// 新增层级
|
||||
export function addProTypeApi(data) {
|
||||
return request({
|
||||
url: '/proType/add',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
// 删除层级
|
||||
export function delProTypeApi(data) {
|
||||
return request({
|
||||
url: '/proType/del',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
// 修改层级
|
||||
export function editProTypeApi(data) {
|
||||
return request({
|
||||
url: '/proType/update',
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<!-- 基础管理-层级-新增或编辑 -->
|
||||
<div>
|
||||
<el-form
|
||||
:model="addOrEditForm"
|
||||
:rules="addOrEditFormRules"
|
||||
ref="addOrEditFormRef"
|
||||
label-position="left"
|
||||
label-width="auto"
|
||||
>
|
||||
<el-form-item label="设备类型名称" prop="typeName">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="addOrEditForm.typeName" placeholder="请输入设备类型名称"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="addOrEditForm.remark" placeholder="请输入备注"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addDeviceTypeApi, editDeviceTypeApi,} from '@/api/basic/dev-type'
|
||||
|
||||
export default {
|
||||
name: 'AddOrEditForm',
|
||||
data() {
|
||||
return {
|
||||
addOrEditForm: {
|
||||
typeName: '',
|
||||
remark: '',
|
||||
id: undefined,
|
||||
},
|
||||
addOrEditFormRules: {
|
||||
typeName: [{required: true, message: '请输入设备类型名称', trigger: 'blur'}],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
this.addOrEditForm.typeName='';
|
||||
this.addOrEditForm.remark='';
|
||||
this.addOrEditForm.id=undefined;
|
||||
this.$emit('closeAddOrEditFormDialog', false)
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.addOrEditFormRef.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// 组装参数
|
||||
const params = {
|
||||
typeName: this.addOrEditForm.typeName?.trim() ?? '',
|
||||
remark: this.addOrEditForm.remark?.trim() ?? '',
|
||||
}
|
||||
if (this.addOrEditForm.id) {
|
||||
params.id = this.addOrEditForm.id
|
||||
}
|
||||
const API = this.addOrEditForm.id ? editDeviceTypeApi : addDeviceTypeApi
|
||||
|
||||
const res = await API(params)
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess(this.addOrEditForm.id ? '修改成功' : '新增成功')
|
||||
this.addOrEditForm.typeName='';
|
||||
this.addOrEditForm.remark='';
|
||||
this.addOrEditForm.id=undefined;
|
||||
this.$emit('closeAddOrEditFormDialog', true)
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs.addOrEditFormRef.resetFields()
|
||||
},
|
||||
|
||||
setFormData(data) {
|
||||
const {typeName, remark, id} = data
|
||||
this.addOrEditForm.typeName = typeName
|
||||
this.addOrEditForm.remark = remark
|
||||
this.addOrEditForm.id = id
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
<template>
|
||||
<!-- 基础管理-设备类型 -->
|
||||
<div class="app-container">
|
||||
<el-form size="small" :inline="true" ref="queryForm" :model="queryParams">
|
||||
<el-form-item label="设备类型名称" prop="typeName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入设备类型名称"
|
||||
v-model="queryParams.typeName"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button plain size="mini" type="primary" icon="el-icon-plus" @click="handleAddDeviceType">
|
||||
新增设备类型
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="deviceList" border>
|
||||
<el-table-column label="序号" align="center" type="index"/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
:key="item.prop"
|
||||
:label="item.label"
|
||||
:prop="item.prop"
|
||||
v-for="item in columnList"
|
||||
/>
|
||||
|
||||
<el-table-column label="操作" align="center" width="240">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleEdit(scope.row)"
|
||||
v-hasPermi="['basic:device:edit']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
style="color: #f56c6c"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['basic:device:remove']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getDeviceList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改设备类型对话框 -->
|
||||
<el-dialog width="50%" append-to-body :title="addOrEditFormTitle" :visible.sync="addOrEditFormVisible">
|
||||
<AddOrEditForm ref="addOrEditComponentRef" @closeAddOrEditFormDialog="closeAddOrEditFormDialog"/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrEditForm from './addOrEditForm.vue'
|
||||
import {getDeviceTypeListApi, delDeviceTypeApi} from '@/api/basic/dev-type'
|
||||
|
||||
export default {
|
||||
name: 'DevType',
|
||||
components: {
|
||||
AddOrEditForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
total: 0, // 总条数
|
||||
loading: false, // 加载中
|
||||
addOrEditFormTitle: '新增', // 新增或编辑对话框标题
|
||||
addOrEditFormVisible: false, // 新增或编辑对话框是否显示
|
||||
useOrReturnFormTitle: '领用', // 领用或归还对话框标题
|
||||
useOrReturnFormVisible: false, // 领用或归还对话框是否显示
|
||||
useRecordFormVisible: false, // 使用记录对话框是否显示
|
||||
// 设备列表
|
||||
deviceList: [],
|
||||
|
||||
// 列配置
|
||||
columnList: [
|
||||
{
|
||||
label: '设备类型名称',
|
||||
prop: 'typeName',
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
prop: 'remark',
|
||||
},
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
typeName: undefined,
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDeviceList()
|
||||
},
|
||||
methods: {
|
||||
// 查询按钮
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getDeviceList()
|
||||
},
|
||||
|
||||
// 重置按钮
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
|
||||
// 新增按钮操作
|
||||
handleAddDeviceType() {
|
||||
this.addOrEditFormTitle = '新增'
|
||||
this.editForm = null
|
||||
this.addOrEditFormVisible = true
|
||||
},
|
||||
|
||||
// 获取设备列表
|
||||
async getDeviceList() {
|
||||
this.loading = true
|
||||
const res = await getDeviceTypeListApi(this.queryParams)
|
||||
console.log(res, '获取设备类型列表')
|
||||
this.deviceList = res.rows
|
||||
this.total = res.total
|
||||
this.loading = false
|
||||
},
|
||||
|
||||
// 领用或归还按钮
|
||||
handleUseOrReturn(row) {
|
||||
console.log(row)
|
||||
this.useOrReturnFormTitle = row.status == '正常' ? '领用' : '归还'
|
||||
this.useOrReturnFormVisible = true
|
||||
},
|
||||
|
||||
// 查看记录按钮
|
||||
handleViewRecord(row) {
|
||||
console.log(row)
|
||||
this.useRecordFormVisible = true
|
||||
},
|
||||
|
||||
// 编辑按钮
|
||||
handleEdit(row) {
|
||||
this.addOrEditFormTitle = '编辑'
|
||||
this.addOrEditFormVisible = true
|
||||
const {typeName, remark, id} = row
|
||||
const editForm = {typeName, remark, id}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrEditComponentRef.setFormData(editForm)
|
||||
})
|
||||
},
|
||||
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.addOrEditFormTitle = '编辑'
|
||||
this.addOrEditFormVisible = true
|
||||
},
|
||||
|
||||
// 删除按钮
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除设备类型编号为"' + row.id + '"的数据项?').then(async () => {
|
||||
var data ={id:row.id}
|
||||
const res = await delDeviceTypeApi(data)
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
this.getDeviceList()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 关闭新增或编辑对话框
|
||||
closeAddOrEditFormDialog(isRefresh) {
|
||||
this.$refs.addOrEditComponentRef.resetForm()
|
||||
this.addOrEditFormVisible = false
|
||||
if (isRefresh) {
|
||||
this.getDeviceList()
|
||||
}
|
||||
},
|
||||
|
||||
// 关闭领用或归还对话框
|
||||
closeUseOrReturnFormDialog() {
|
||||
this.$refs.useOrReturnFormComponentRef.resetForm()
|
||||
this.useOrReturnFormVisible = false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
<template>
|
||||
<!-- 基础管理-业主单位-新增或编辑 -->
|
||||
<div>
|
||||
<el-form
|
||||
:model="addOrEditForm"
|
||||
:rules="addOrEditFormRules"
|
||||
ref="addOrEditFormRef"
|
||||
label-position="left"
|
||||
label-width="auto"
|
||||
>
|
||||
<el-form-item label="业主单位名称" prop="unitName">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="addOrEditForm.unitName" placeholder="请输入业主单位名称"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="主单位负责人" prop="unitMan">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="addOrEditForm.unitMan" placeholder="请输入主单位负责人"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="主单位负责人电话" prop="phone">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="addOrEditForm.phone" placeholder="请输入主单位负责人电话"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="主单位地址" prop="address">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="addOrEditForm.address" placeholder="请输入主单位地址"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="addOrEditForm.remark" placeholder="请输入备注"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addOwnerApi, editOwnerApi,} from '@/api/basic/owner-manage'
|
||||
|
||||
export default {
|
||||
name: 'AddOrEditForm',
|
||||
data() {
|
||||
return {
|
||||
addOrEditForm: {
|
||||
unitName: '',
|
||||
unitMan: '',
|
||||
phone: '',
|
||||
address: '',
|
||||
remark: '',
|
||||
id: undefined,
|
||||
},
|
||||
addOrEditFormRules: {
|
||||
unitName: [{required: true, message: '请输入业主单位名称', trigger: 'blur'}],
|
||||
unitMan: [{required: true, message: '请输入主单位负责人', trigger: 'blur'}],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
this.addOrEditForm.unitName='';
|
||||
this.addOrEditForm.unitMan='';
|
||||
this.addOrEditForm.phone='';
|
||||
this.addOrEditForm.address='';
|
||||
this.addOrEditForm.remark='';
|
||||
this.addOrEditForm.id=undefined;
|
||||
this.$emit('closeAddOrEditFormDialog', false)
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.addOrEditFormRef.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// 组装参数
|
||||
const params = {
|
||||
unitName: this.addOrEditForm.unitName?.trim() ?? '',
|
||||
unitMan: this.addOrEditForm.unitMan?.trim() ?? '',
|
||||
phone: this.addOrEditForm.phone?.trim() ?? '',
|
||||
address: this.addOrEditForm.address?.trim() ?? '',
|
||||
remark: this.addOrEditForm.remark?.trim() ?? '',
|
||||
}
|
||||
if (this.addOrEditForm.id) {
|
||||
params.id = this.addOrEditForm.id
|
||||
}
|
||||
const API = this.addOrEditForm.id ? editOwnerApi : addOwnerApi
|
||||
|
||||
const res = await API(params)
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess(this.addOrEditForm.id ? '修改成功' : '新增成功')
|
||||
this.addOrEditForm.unitName='';
|
||||
this.addOrEditForm.unitMan='';
|
||||
this.addOrEditForm.phone='';
|
||||
this.addOrEditForm.address='';
|
||||
this.addOrEditForm.remark='';
|
||||
this.addOrEditForm.id=undefined;
|
||||
this.$emit('closeAddOrEditFormDialog', true)
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs.addOrEditFormRef.resetFields()
|
||||
},
|
||||
|
||||
setFormData(data) {
|
||||
const {unitName,unitMan, phone,address, remark, id} = data
|
||||
this.addOrEditForm.unitName = unitName
|
||||
this.addOrEditForm.unitMan = unitMan
|
||||
this.addOrEditForm.phone = phone
|
||||
this.addOrEditForm.address = address
|
||||
this.addOrEditForm.remark = remark
|
||||
this.addOrEditForm.id = id
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,221 @@
|
|||
<template>
|
||||
<!-- 基础管理-业主单位 -->
|
||||
<div class="app-container">
|
||||
<el-form size="small" :inline="true" ref="queryForm" :model="queryParams">
|
||||
<el-form-item label="业主单位名称" prop="unitName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入业主单位名称"
|
||||
v-model="queryParams.unitName"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button plain size="mini" type="primary" icon="el-icon-plus" @click="handleAddDeviceType">
|
||||
新增业主单位
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="deviceList" border>
|
||||
<el-table-column label="序号" align="center" type="index"/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
:key="item.prop"
|
||||
:label="item.label"
|
||||
:prop="item.prop"
|
||||
v-for="item in columnList"
|
||||
/>
|
||||
|
||||
<el-table-column label="操作" align="center" width="240">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleEdit(scope.row)"
|
||||
v-hasPermi="['basic:device:edit']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
style="color: #f56c6c"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['basic:device:remove']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getDeviceList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改业主单位对话框 -->
|
||||
<el-dialog width="50%" append-to-body :title="addOrEditFormTitle" :visible.sync="addOrEditFormVisible">
|
||||
<AddOrEditForm ref="addOrEditComponentRef" @closeAddOrEditFormDialog="closeAddOrEditFormDialog"/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrEditForm from './addOrEditForm.vue'
|
||||
import {getOwnerListApi, delOwnerApi} from '@/api/basic/owner-manage'
|
||||
|
||||
export default {
|
||||
name: 'DevType',
|
||||
components: {
|
||||
AddOrEditForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
total: 0, // 总条数
|
||||
loading: false, // 加载中
|
||||
addOrEditFormTitle: '新增', // 新增或编辑对话框标题
|
||||
addOrEditFormVisible: false, // 新增或编辑对话框是否显示
|
||||
useOrReturnFormTitle: '领用', // 领用或归还对话框标题
|
||||
useOrReturnFormVisible: false, // 领用或归还对话框是否显示
|
||||
useRecordFormVisible: false, // 使用记录对话框是否显示
|
||||
// 设备列表
|
||||
deviceList: [],
|
||||
|
||||
// 列配置
|
||||
columnList: [
|
||||
{
|
||||
label: '业主单位名称',
|
||||
prop: 'unitName',
|
||||
},
|
||||
{
|
||||
label: '业主单位负责人',
|
||||
prop: 'unitMan',
|
||||
},
|
||||
{
|
||||
label: '业主单位负责人电话',
|
||||
prop: 'phone',
|
||||
},
|
||||
{
|
||||
label: '业主单位地址',
|
||||
prop: 'address',
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
prop: 'remark',
|
||||
},
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
unitName: undefined,
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDeviceList()
|
||||
},
|
||||
methods: {
|
||||
// 查询按钮
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getDeviceList()
|
||||
},
|
||||
|
||||
// 重置按钮
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
|
||||
// 新增按钮操作
|
||||
handleAddDeviceType() {
|
||||
this.addOrEditFormTitle = '新增'
|
||||
this.editForm = null
|
||||
this.addOrEditFormVisible = true
|
||||
},
|
||||
|
||||
// 获取设备列表
|
||||
async getDeviceList() {
|
||||
this.loading = true
|
||||
const res = await getOwnerListApi(this.queryParams)
|
||||
console.log(res, '获取业主单位列表')
|
||||
this.deviceList = res.rows
|
||||
this.total = res.total
|
||||
this.loading = false
|
||||
},
|
||||
|
||||
// 领用或归还按钮
|
||||
handleUseOrReturn(row) {
|
||||
console.log(row)
|
||||
this.useOrReturnFormTitle = row.status == '正常' ? '领用' : '归还'
|
||||
this.useOrReturnFormVisible = true
|
||||
},
|
||||
|
||||
// 查看记录按钮
|
||||
handleViewRecord(row) {
|
||||
console.log(row)
|
||||
this.useRecordFormVisible = true
|
||||
},
|
||||
|
||||
// 编辑按钮
|
||||
handleEdit(row) {
|
||||
this.addOrEditFormTitle = '编辑'
|
||||
this.addOrEditFormVisible = true
|
||||
const {unitName,unitMan,phone,address, remark, id} = row
|
||||
const editForm = {unitName,unitMan,phone, address,remark, id}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrEditComponentRef.setFormData(editForm)
|
||||
})
|
||||
},
|
||||
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.addOrEditFormTitle = '编辑'
|
||||
this.addOrEditFormVisible = true
|
||||
},
|
||||
|
||||
// 删除按钮
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除业主单位编号为"' + row.id + '"的数据项?').then(async () => {
|
||||
var data ={id:row.id}
|
||||
const res = await delOwnerApi(data)
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
this.getDeviceList()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 关闭新增或编辑对话框
|
||||
closeAddOrEditFormDialog(isRefresh) {
|
||||
this.$refs.addOrEditComponentRef.resetForm()
|
||||
this.addOrEditFormVisible = false
|
||||
if (isRefresh) {
|
||||
this.getDeviceList()
|
||||
}
|
||||
},
|
||||
|
||||
// 关闭领用或归还对话框
|
||||
closeUseOrReturnFormDialog() {
|
||||
this.$refs.useOrReturnFormComponentRef.resetForm()
|
||||
this.useOrReturnFormVisible = false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<template>
|
||||
<!-- 基础管理-层级-新增或编辑 -->
|
||||
<div>
|
||||
<el-form
|
||||
:model="addOrEditForm"
|
||||
:rules="addOrEditFormRules"
|
||||
ref="addOrEditFormRef"
|
||||
label-position="left"
|
||||
label-width="auto"
|
||||
>
|
||||
<el-form-item label="项目类型名称" prop="typeName">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="addOrEditForm.typeName" placeholder="请输入项目类型名称"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-input v-model="addOrEditForm.remark" placeholder="请输入备注"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addProTypeApi, editProTypeApi,} from '@/api/basic/pro-type'
|
||||
|
||||
export default {
|
||||
name: 'AddOrEditForm',
|
||||
data() {
|
||||
return {
|
||||
addOrEditForm: {
|
||||
typeName: '',
|
||||
remark: '',
|
||||
id: undefined,
|
||||
},
|
||||
addOrEditFormRules: {
|
||||
typeName: [{required: true, message: '请输入项目类型名称', trigger: 'blur'}],
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
cancel() {
|
||||
this.addOrEditForm.typeName='';
|
||||
this.addOrEditForm.remark='';
|
||||
this.addOrEditForm.id=undefined;
|
||||
this.$emit('closeAddOrEditFormDialog', false)
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.addOrEditFormRef.validate(async (valid) => {
|
||||
if (valid) {
|
||||
// 组装参数
|
||||
const params = {
|
||||
typeName: this.addOrEditForm.typeName?.trim() ?? '',
|
||||
remark: this.addOrEditForm.remark?.trim() ?? '',
|
||||
}
|
||||
if (this.addOrEditForm.id) {
|
||||
params.id = this.addOrEditForm.id
|
||||
}
|
||||
const API = this.addOrEditForm.id ? editProTypeApi : addProTypeApi
|
||||
|
||||
const res = await API(params)
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess(this.addOrEditForm.id ? '修改成功' : '新增成功')
|
||||
this.addOrEditForm.typeName='';
|
||||
this.addOrEditForm.remark='';
|
||||
this.addOrEditForm.id=undefined;
|
||||
this.$emit('closeAddOrEditFormDialog', true)
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs.addOrEditFormRef.resetFields()
|
||||
},
|
||||
|
||||
setFormData(data) {
|
||||
const {typeName, remark, id} = data
|
||||
this.addOrEditForm.typeName = typeName
|
||||
this.addOrEditForm.remark = remark
|
||||
this.addOrEditForm.id = id
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
<template>
|
||||
<!-- 基础管理-项目类型 -->
|
||||
<div class="app-container">
|
||||
<el-form size="small" :inline="true" ref="queryForm" :model="queryParams">
|
||||
<el-form-item label="项目类型名称" prop="typeName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入项目类型名称"
|
||||
v-model="queryParams.typeName"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button plain size="mini" type="primary" icon="el-icon-plus" @click="handleAddDeviceType">
|
||||
新增项目类型
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="deviceList" border>
|
||||
<el-table-column label="序号" align="center" type="index"/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
:key="item.prop"
|
||||
:label="item.label"
|
||||
:prop="item.prop"
|
||||
v-for="item in columnList"
|
||||
/>
|
||||
|
||||
<el-table-column label="操作" align="center" width="240">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleEdit(scope.row)"
|
||||
v-hasPermi="['basic:device:edit']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
style="color: #f56c6c"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['basic:device:remove']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getDeviceList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改项目类型对话框 -->
|
||||
<el-dialog width="50%" append-to-body :title="addOrEditFormTitle" :visible.sync="addOrEditFormVisible">
|
||||
<AddOrEditForm ref="addOrEditComponentRef" @closeAddOrEditFormDialog="closeAddOrEditFormDialog"/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrEditForm from './addOrEditForm.vue'
|
||||
import {getProTypeListApi, delProTypeApi} from '@/api/basic/pro-type'
|
||||
|
||||
export default {
|
||||
name: 'DevType',
|
||||
components: {
|
||||
AddOrEditForm,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
total: 0, // 总条数
|
||||
loading: false, // 加载中
|
||||
addOrEditFormTitle: '新增', // 新增或编辑对话框标题
|
||||
addOrEditFormVisible: false, // 新增或编辑对话框是否显示
|
||||
useOrReturnFormTitle: '领用', // 领用或归还对话框标题
|
||||
useOrReturnFormVisible: false, // 领用或归还对话框是否显示
|
||||
useRecordFormVisible: false, // 使用记录对话框是否显示
|
||||
// 设备列表
|
||||
deviceList: [],
|
||||
|
||||
// 列配置
|
||||
columnList: [
|
||||
{
|
||||
label: '项目类型名称',
|
||||
prop: 'typeName',
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
prop: 'remark',
|
||||
},
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
typeName: undefined,
|
||||
},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDeviceList()
|
||||
},
|
||||
methods: {
|
||||
// 查询按钮
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1
|
||||
this.getDeviceList()
|
||||
},
|
||||
|
||||
// 重置按钮
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
|
||||
// 新增按钮操作
|
||||
handleAddDeviceType() {
|
||||
this.addOrEditFormTitle = '新增'
|
||||
this.editForm = null
|
||||
this.addOrEditFormVisible = true
|
||||
},
|
||||
|
||||
// 获取设备列表
|
||||
async getDeviceList() {
|
||||
this.loading = true
|
||||
const res = await getProTypeListApi(this.queryParams)
|
||||
console.log(res, '获取项目类型列表')
|
||||
this.deviceList = res.rows
|
||||
this.total = res.total
|
||||
this.loading = false
|
||||
},
|
||||
|
||||
// 领用或归还按钮
|
||||
handleUseOrReturn(row) {
|
||||
console.log(row)
|
||||
this.useOrReturnFormTitle = row.status == '正常' ? '领用' : '归还'
|
||||
this.useOrReturnFormVisible = true
|
||||
},
|
||||
|
||||
// 查看记录按钮
|
||||
handleViewRecord(row) {
|
||||
console.log(row)
|
||||
this.useRecordFormVisible = true
|
||||
},
|
||||
|
||||
// 编辑按钮
|
||||
handleEdit(row) {
|
||||
this.addOrEditFormTitle = '编辑'
|
||||
this.addOrEditFormVisible = true
|
||||
const {typeName, remark, id} = row
|
||||
const editForm = {typeName, remark, id}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrEditComponentRef.setFormData(editForm)
|
||||
})
|
||||
},
|
||||
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.addOrEditFormTitle = '编辑'
|
||||
this.addOrEditFormVisible = true
|
||||
},
|
||||
|
||||
// 删除按钮
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除项目类型编号为"' + row.id + '"的数据项?').then(async () => {
|
||||
var data ={id:row.id}
|
||||
const res = await delProTypeApi(data)
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
this.getDeviceList()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 关闭新增或编辑对话框
|
||||
closeAddOrEditFormDialog(isRefresh) {
|
||||
this.$refs.addOrEditComponentRef.resetForm()
|
||||
this.addOrEditFormVisible = false
|
||||
if (isRefresh) {
|
||||
this.getDeviceList()
|
||||
}
|
||||
},
|
||||
|
||||
// 关闭领用或归还对话框
|
||||
closeUseOrReturnFormDialog() {
|
||||
this.$refs.useOrReturnFormComponentRef.resetForm()
|
||||
this.useOrReturnFormVisible = false
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue