1 changed files with 123 additions and 0 deletions
@ -0,0 +1,123 @@
@@ -0,0 +1,123 @@
|
||||
<template> |
||||
<div class="app-container app-container-bg"> |
||||
<el-card class="first-card" ref='firstCard' shadow="always"> |
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" @submit.native.prevent> |
||||
<el-form-item label="测站" prop="stnm"> |
||||
<el-input v-model="queryParams.stnm" placeholder="请输入测站" clearable @keyup.enter.native="handleQuery" /> |
||||
</el-form-item> |
||||
<el-form-item> |
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button> |
||||
</el-form-item> |
||||
</el-form> |
||||
</el-card> |
||||
<div class="el-card-p card-shadow carder-border mt10 pad10 "> |
||||
<el-table class="table-box" v-table-height v-loading="loading" :data="zbOpenList"> |
||||
<el-table-column type="index" label="序号" width="55" :align="alignment" /> |
||||
<el-table-column label="测站名称" :align="alignment" prop="stnm" /> |
||||
<el-table-column label="测站编码" :align="alignment" prop="staid" /> |
||||
<el-table-column label="开关状态" :align="alignment" prop="zbOpen"> |
||||
<template #default="scope"> |
||||
<el-tag v-if="scope.row.zbOpen == 0" type="danger">关闭</el-tag> |
||||
<el-tag v-if="scope.row.zbOpen == 1" type="success">开启</el-tag> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="关闭原因" :align="alignment" prop="zbCloseReason" /> |
||||
<el-table-column label="操作" :align="alignment" class-name="small-padding fixed-width"> |
||||
<template #default="scope"> |
||||
<el-button text type="success" icon="Edit" v-if="scope.row.zbOpen == 0" @click="handleOpenStatus(scope.row,1)">开启</el-button> |
||||
<el-button text type="danger" icon="Delete" v-if="scope.row.zbOpen == 1" @click="handleOpenStatus(scope.row,0)">关闭</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.page" v-model:limit="queryParams.limit" @pagination="getList" /> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
<script setup> |
||||
import * as echarts from "echarts"; |
||||
import * as XLSX from 'xlsx'; |
||||
import { ref, reactive, onMounted, nextTick, getCurrentInstance } from 'vue' |
||||
import { getToken } from "@/utils/auth"; |
||||
|
||||
const { proxy } = getCurrentInstance() |
||||
const alignment = 'center' |
||||
const showSearch = ref(true) |
||||
const queryParams = reactive({ |
||||
page: 1, |
||||
limit: 10, |
||||
stnm: '', |
||||
}) |
||||
const loading = ref(false) |
||||
const total = ref(0) |
||||
const zbOpenList = ref([]) |
||||
const getList = async () => { |
||||
loading.value = true; |
||||
try { |
||||
const res = await proxy.axiosGet('/basic/station/page', queryParams) |
||||
if (res.code == 0) { |
||||
zbOpenList.value = res.data |
||||
total.value = res.count |
||||
} |
||||
|
||||
} catch (error) { |
||||
} finally { |
||||
loading.value = false |
||||
} |
||||
} |
||||
|
||||
/** 搜索按钮操作 */ |
||||
const handleQuery = () => { |
||||
queryParams.page = 1 |
||||
getList() |
||||
} |
||||
|
||||
const resetQuery = () => { |
||||
proxy.resetForm("queryForm"); |
||||
handleQuery(); |
||||
} |
||||
|
||||
/** 关闭按钮操作 */ |
||||
const handleOpenStatus = (row, status) => { |
||||
const ts = status == 0 ? '关闭' : '开启'; |
||||
if (status == 1) { |
||||
proxy.$confirm('是否确认 ' + ts + " [<span style='color: red'>" + row.stnm + "</span>] 自动整编功能", "确认信息", { |
||||
title: '确认操作', |
||||
dangerouslyUseHTMLString: true, |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消' |
||||
}).then(() => { |
||||
setZbOpen(row.stnmId, status) |
||||
}).catch(() => { }); |
||||
} else { |
||||
proxy.$prompt("请输入关闭 [<span style='color: red'>" + row.stnm + "</span>] 自动整编功能的原因" |
||||
, '确认信息', { |
||||
dangerouslyUseHTMLString: true, |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
}) |
||||
.then(({ value }) => { |
||||
setZbOpen(row.stnmId, status, value) |
||||
}).catch(() => { }); |
||||
|
||||
} |
||||
} |
||||
/** 设置整编开关状态 */ |
||||
const setZbOpen = async (stnmId, status, zbCloseReason) => { |
||||
let data = { |
||||
stnmId: stnmId, |
||||
zbOpen: status, |
||||
zbCloseReason: zbCloseReason |
||||
} |
||||
let res = await proxy.axiosPost('/basic/station/setZbOpen', data); |
||||
if (res.code === 0) { |
||||
proxy.$modal.msgSuccess('操作成功') |
||||
getList() |
||||
} |
||||
} |
||||
|
||||
|
||||
onMounted(() => { |
||||
getList() |
||||
}) |
||||
</script> |
||||
Loading…
Reference in new issue