SafetyAlertSystem-ui/src/views/base/proj/index.vue

146 lines
3.6 KiB
Vue
Raw Normal View History

<template>
<!-- 工程管理页面 -->
<div class="app-container">
<!-- 表格 -->
<TableModel
:formLabel="formLabel"
:columnsList="columnsList"
:request-api="queryProjListApi"
ref="tableRef"
@transIdList="getIdList"
>
<template slot="btn" slot-scope="{ queryParams }">
<el-button type="primary" @click="handleAddData()" icon="el-icon-plus" size="mini"
>新建工程</el-button
>
<el-button
@click="handleExportData(
exportList,
'base/tbProject/export',
'工程清单',
queryParams
)"
icon="el-icon-upload2"
size="mini"
>导出数据</el-button
>
</template>
<template slot="handle" slot-scope="{ data }">
<el-button
type="primary"
size="mini"
@click="handleEditData(data)"
>编辑</el-button
>
<el-button
type="danger"
size="mini"
2024-11-06 15:44:54 +08:00
@click="handleDeleteData({'id':data.id}, deleteProjApi)"
v-if="data.powerTotal === 0"
>删除</el-button
>
</template>
<template slot="powerTotal" slot-scope="{ data }">
2024-09-30 12:25:57 +08:00
<span v-if="data.proTypeName==='线路工程'"
style="color: #0060EE; font-weight: bold; cursor: pointer"
@click="handleTower(data)"
>
{{ data.powerTotal }}
</span>
2024-09-30 12:25:57 +08:00
<span v-else>
-
</span>
</template>
</TableModel>
<!-- 新增以及修改时的弹框 -->
<DialogModel
:dialogConfig="dialogConfig"
@closeDialogOuter="closeDialogOuter"
>
<template slot="outerContent">
<!-- 新增以及修改数据的表单组件 -->
<FormProject
:editParams="editParams"
@closeDialog="closeDialog"
/>
</template>
</DialogModel>
<DialogModel
:dialogConfig="dialogConfigTower"
@closeDialogOuter="closeDialogTowerOuter"
>
<template slot="outerContent">
<!-- 新增以及修改数据的表单组件 -->
<TableTower
:send-data="sendData"
>
</TableTower>
</template>
</DialogModel>
</div>
</template>
<script>
import { formLabel, columnsList, dialogConfig, querySel } from './config'
import { dialogConfigTower } from './config-tower'
import { commonMixin } from '../mixins/common'
import {
queryProjListApi,
deleteProjApi
} from '@/api/base/proj'
import FormProject from './components/form-project'
import TableTower from './components/table-tower'
export default {
name: 'Project',
methods: {
queryProjListApi,
deleteProjApi,
closeDialogTowerOuter() {
this.dialogConfigTower.outerVisible = false
this.$refs.tableRef.getTableList()
},
getIdList(idList) {
this.exportList = []
idList.forEach(item => {
this.exportList.push(item.id)
})
},
handleTower(v) {
this.sendData = v
this.dialogConfigTower.outerVisible = true
}
},
mixins: [commonMixin],
components: {
FormProject,
TableTower
},
created() {
querySel()
},
data() {
return {
// 搜索区表单配置项
formLabel,
// 表格导出id列表
exportList: [],
// 列表区配置项
columnsList,
// 弹框区配置项
dialogConfig,
dialogConfigTower,
// 新建时弹框标题
addDialogTitle: '新建工程',
// 修改时弹框标题
editDialogTitle: '修改工程',
sendData: undefined
}
},
}
</script>