search_tools_web/src/views/data-create/epc-template/index.vue

246 lines
8.7 KiB
Vue
Raw Normal View History

<template>
2025-06-17 13:38:47 +08:00
<!-- EPC模板 -->
<div class="app-container">
2025-04-29 11:45:05 +08:00
<el-form :model="queryParams" ref="login" label-width="0px" class="ms-content">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item>
2025-04-29 11:45:05 +08:00
<el-input v-model="queryParams.name" placeholder="请输入标书名称" clearable> </el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
2025-04-29 11:45:05 +08:00
<el-date-picker
clearable
type="daterange"
style="width: 100%"
v-model="timeValue"
range-separator="至"
value-format="yyyy-MM-dd"
end-placeholder="结束日期"
start-placeholder="开始日期"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item>
2025-06-17 13:38:47 +08:00
<el-button type="primary" @click="getGwTemplateList">查询</el-button>
2025-04-29 11:45:05 +08:00
<el-button @click="resetQueryParams">重置</el-button>
2025-06-17 13:38:47 +08:00
<el-button type="primary" @click="onHandleAddOrEdit(null, 1)" v-hasPermi="['gw:template:add']">
2025-05-08 09:58:46 +08:00
新增
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table :data="tableList" stripe style="width: 100%">
2025-05-08 15:25:37 +08:00
<el-table-column label="序号" width="55" type="index" align="center" />
<el-table-column
:key="index"
align="center"
:prop="item.prop"
:label="item.label"
show-overflow-tooltip
v-for="(item, index) in tableColumn"
/>
2025-05-07 17:14:05 +08:00
<el-table-column label="操作" width="auto" align="center">
<template #default="{ row }">
<el-button
style="color: #67c23a"
icon="el-icon-view"
type="text"
size="mini"
@click="onHandleAddOrEdit(row, 2)"
>
详情
</el-button>
<el-button
2025-06-17 13:38:47 +08:00
style="color: #d140ff"
icon="el-icon-download"
type="text"
size="mini"
@click="onHandleDownload(row)"
2025-06-17 13:38:47 +08:00
v-hasPermi="['gw:template:download']"
>
下载
</el-button>
<el-button
2025-06-17 13:38:47 +08:00
style="color: #409eff"
icon="el-icon-edit"
type="text"
size="mini"
@click="onHandleAddOrEdit(row, 3)"
2025-06-17 13:38:47 +08:00
v-hasPermi="['gw:template:edit']"
>
编辑
</el-button>
<el-button
2025-06-17 13:38:47 +08:00
style="color: #f56c6c"
icon="el-icon-delete"
type="text"
size="mini"
@click="onHandleDelete(row)"
2025-06-17 13:38:47 +08:00
v-hasPermi="['gw:template:delete']"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
2025-04-29 11:45:05 +08:00
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
2025-06-17 13:38:47 +08:00
@pagination="getGwTemplateList"
2025-04-29 11:45:05 +08:00
/>
<DialogModel :dialogConfig="dialogConfig" @closeDialogOuter="closeDialogOuter">
<template slot="outerContent">
2025-04-29 11:45:05 +08:00
<AddAndEditForm :formType="formType" :queryId="queryId" @closeDialogOuter="closeDialogOuter" />
</template>
</DialogModel>
</div>
</template>
<script>
import DialogModel from '@/components/DialogModel/index'
import AddAndEditForm from './components/addAndEditForm.vue'
2025-06-17 13:38:47 +08:00
import { getGwTemplateListAPI, deleteGwTemplateAPI, downloadGwTemplateByIdAPI } from '@/api/data-create/gw-template'
export default {
components: {
DialogModel,
AddAndEditForm,
},
data() {
return {
formType: 1, // 1新增 2详情 3编辑
2025-04-29 11:45:05 +08:00
total: 0,
queryId: '', // 详情或编辑的id
dialogConfig: {
2025-06-17 13:38:47 +08:00
outerTitle: '新增国网模板',
innerTitle: false,
outerWidth: '80%',
outerVisible: false,
innerVisible: false,
},
2025-04-29 11:45:05 +08:00
queryParams: {
name: '',
startDate: '',
endDate: '',
pageNum: 1,
pageSize: 10,
2025-06-17 13:38:47 +08:00
type: 2,
},
timeValue: [],
2025-04-29 11:45:05 +08:00
tableList: [],
tableColumn: [
2025-04-29 11:45:05 +08:00
{ label: '标书名称', prop: 'name' },
{ label: '创建人', prop: 'createUser' },
{ label: '创建时间', prop: 'createTime' },
],
}
},
methods: {
// 关闭
2025-04-29 11:45:05 +08:00
closeDialogOuter(isRefresh = false) {
this.dialogConfig.outerVisible = false
2025-04-29 11:45:05 +08:00
if (isRefresh) {
2025-06-17 13:38:47 +08:00
this.getGwTemplateList()
2025-04-29 11:45:05 +08:00
}
},
// 删除
onHandleDelete(row) {
this.$modal
2025-04-29 14:36:59 +08:00
.confirm('确定删除该模板吗?')
2025-04-29 11:45:05 +08:00
.then(async () => {
2025-06-17 13:38:47 +08:00
const res = await deleteGwTemplateAPI({ id: row.id })
2025-04-29 11:45:05 +08:00
if (res.code == 200) {
this.$message.success('删除成功')
2025-06-17 13:38:47 +08:00
this.getGwTemplateList()
2025-04-29 11:45:05 +08:00
}
})
2025-04-29 11:45:05 +08:00
.catch(() => {})
},
// 新增或编辑
onHandleAddOrEdit(row, type) {
2025-04-29 11:45:05 +08:00
this.formType = type
if (type === 1) {
2025-06-17 13:38:47 +08:00
this.dialogConfig.outerTitle = '新增国网模板'
2025-04-29 11:45:05 +08:00
this.queryId = ''
} else if (type === 3) {
2025-06-17 13:38:47 +08:00
this.dialogConfig.outerTitle = '编辑国网模板'
2025-04-29 11:45:05 +08:00
this.queryId = row.id
} else if (type === 2) {
2025-06-17 13:38:47 +08:00
this.dialogConfig.outerTitle = '国网模板详情'
2025-04-29 11:45:05 +08:00
this.queryId = row.id
}
this.dialogConfig.outerVisible = true
},
// 下载
2025-06-17 13:38:47 +08:00
async onHandleDownload(row) {
// downloadStateGridTemp
// const res = await downloadGwTemplateByIdAPI({ id: row.id })
// console.log(res, '下载结果')
this.$confirm('请选择下载的模板类型?', '温馨提示', {
distinguishCancelAndClose: true,
2025-06-23 18:19:39 +08:00
confirmButtonText: '商务标下载',
cancelButtonText: '技术标下载',
2025-06-17 13:38:47 +08:00
})
2025-06-23 18:19:39 +08:00
.then(() => {
2025-06-17 13:38:47 +08:00
// 表格下载
this.downloadNew(
'/stateGrid/downloadStateGridTemp',
{
id: row.id,
2025-06-23 18:19:39 +08:00
isJsb: 0,
2025-06-17 13:38:47 +08:00
},
2025-06-23 18:19:39 +08:00
`商务标_${row.name}.doc`,
2025-06-17 13:38:47 +08:00
)
})
.catch((action) => {
// 普通下载
2025-06-23 18:19:39 +08:00
this.downloadNew(
'/stateGrid/downloadStateGridTemp',
{
id: row.id,
isJsb: 1,
},
`技术标_${row.name}.doc`,
)
2025-06-17 13:38:47 +08:00
})
2025-04-30 10:09:25 +08:00
},
2025-04-29 11:45:05 +08:00
2025-06-17 13:38:47 +08:00
// 获取国网模板列表列表
async getGwTemplateList() {
2025-04-29 11:45:05 +08:00
if (this.timeValue && this.timeValue.length > 0) {
this.queryParams.startDate = this.timeValue[0]
this.queryParams.endDate = this.timeValue[1]
} else {
this.queryParams.startDate = ''
this.queryParams.endDate = ''
}
2025-06-17 13:38:47 +08:00
const res = await getGwTemplateListAPI(this.queryParams)
2025-04-29 11:45:05 +08:00
this.tableList = res.rows
this.total = res.total
},
2025-04-29 11:45:05 +08:00
// 重置
resetQueryParams() {
this.timeValue = []
this.queryParams.name = ''
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
2025-06-17 13:38:47 +08:00
this.getGwTemplateList()
2025-04-29 11:45:05 +08:00
},
},
created() {
2025-06-17 13:38:47 +08:00
this.getGwTemplateList()
},
}
</script>