123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 |
- <template>
- <div class="gasReport">
- <customHeader>瓦斯巡检地点管理</customHeader>
- <div class="report-container">
- <div class="search-area">
- <a-row>
- <a-col :span="4">
- <div class="area-item">
- <div class="item-text">地点:</div>
- <a-input style="width: 240px" v-model:value="searchParams" placeholder="请输入地点" />
- </div>
- </a-col>
- <a-col :span="20">
- <a-button type="primary" preIcon="ant-design:search-outlined" class="" @click="getSearchCardId">查询</a-button>
- <a-button preIcon="ant-design:sync-outlined" class="ml-10px" @click="getReset">重置</a-button>
- <a-button type="primary" preIcon="ant-design:import-outlined" class="ml-10px" @click="getupload">导入</a-button>
- <a-button type="primary" preIcon="ant-design:download-outlined" class="ml-10px" @click="getdownload">导出</a-button>
- <a-button type="primary" preIcon="ant-design:plus-outlined" class="ml-10px" @click="getTjAddress">新增瓦斯巡检地址</a-button>
- </a-col>
- </a-row>
- </div>
- <a-table
- :key="keyActive"
- :columns="columns2"
- size="small"
- :data-source="tableData"
- :scroll="{ y: 500 }"
- class="tableW"
- :pagination="pagination"
- @change="pageChange"
- >
- <template #action="{ record }">
- <a class="table-action-link" @click="handlerEdit(record)">编辑</a>
- <a-popconfirm title="删除内容无法恢复,是否删除" ok-text="确定" cancel-text="取消" @confirm="handleDelCardInfo(record)">
- <a class="table-action-link">删除</a>
- </a-popconfirm>
- </template>
- <template #bodyCell="{ column, text }">
- <template v-if="column.dataIndex == 'isSensor'">
- <div v-if="text == '1'">
- <div class="table-text text-y">是</div>
- </div>
- <div v-else>
- <div class="table-text text-n">否</div>
- </div>
- </template>
- <template v-if="column.dataIndex == 'checkState'">
- <div v-if="text == '1'">
- <div class="table-text text-y">已检</div>
- </div>
- <div v-else>
- <div class="table-text text-n">未检</div>
- </div>
- </template>
- </template>
- </a-table>
-
- <a-modal v-model:visible="visibleTask" width="850px" :footer="null" :title="titleTask" centered destroyOnClose>
- <inspectTask @handleTaskSubmit="handleTaskSubmit" @handleTaskCancel="handleTaskCancel" />
- </a-modal>
-
- <a-modal v-model:visible="visibleEdit" width="650px" :footer="null" :title="titleEdit" centered destroyOnClose>
- <inspectEdit :inspectEditData="inspectEditData" @confirmEdit="confirmEdit" @cancelEdit="cancelEdit" />
- </a-modal>
-
- <a-modal v-model:visible="visibleUploadorDown" width="450px" :footer="null" :title="titleUploadorDown" centered destroyOnClose>
- <uploadOrdown :modalType="modalType" @handlerComfirm="handlerComfirm" @handlerCancel="handlerCancel" />
- </a-modal>
-
- <a-modal v-model:visible="visibleAddress" width="450px" :footer="null" :title="titleAddress" centered destroyOnClose>
- <addressAdd @confirmAddress="confirmAddress" @cancelAddress="cancelAddress" />
- </a-modal>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { ref, onMounted, reactive } from 'vue';
- import customHeader from '/@/components/vent/customHeader.vue';
- import inspectTask from './components/inspectTask.vue';
- import inspectEdit from './components/inspectEdit2.vue';
- import uploadOrdown from './components/uploadOrdown.vue';
- import addressAdd from './components/addressAdd2.vue';
- import { message } from 'ant-design-vue';
- import { columns2, pagination } from './gasInspectNonfc.data';
- import { list, importByExcel, exportGasByExcel, moveOrderNum, edit, taskSubmit, clearCardInfo, addGasReportAddress } from './gasInspectNonfc.api';
- let keyActive = ref(0);
- let searchParams = ref('');
- let tableData = ref<any[]>([]);
- let visibleTask = ref(false);
- let titleTask = ref('');
- let visibleEdit = ref(false);
- let titleEdit = ref('');
- let inspectEditData = reactive({});
- let visibleUploadorDown = ref(false);
- let titleUploadorDown = ref('');
- let modalType = ref('');
- let visibleAddress = ref(false);
- let titleAddress = ref('');
-
-
-
-
-
-
- async function handleTaskSubmit(param) {
- let res = await taskSubmit({ ...param });
- if (res) {
- visibleTask.value = false;
- queryByIdList();
- }
- }
-
- let handleTaskCancel = () => {
- visibleTask.value = false;
- };
-
- let handlerEdit = (record) => {
- visibleEdit.value = true;
- titleEdit.value = '瓦斯巡检点编辑';
- inspectEditData = Object.assign({}, record);
- };
-
- async function confirmEdit(param) {
- let res = await edit({ ...param });
- if (res) {
- queryByIdList();
- visibleEdit.value = false;
- }
- }
-
- let cancelEdit = () => {
- visibleEdit.value = false;
- };
-
- async function handleDelCardInfo(record) {
- let res = await clearCardInfo({ id: record.id });
- if (res) {
- queryByIdList();
- }
- }
-
- async function queryByIdList() {
- let res = await list({ strinstallpos: searchParams.value, pageNo: pagination.current, pageSize: pagination.pageSize });
- keyActive.value = new Date().getTime();
- tableData.value = res.records.map((el: any) => {
- return {
- morning: el.insType,
- afterNoon: el.insType,
- evening: el.insType,
- ...el,
- };
- });
- pagination.total = res.total;
- }
-
- let getSearchCardId = () => {
- pagination.current = 1;
- queryByIdList();
- };
-
- let getReset = () => {
- pagination.current = 1;
- searchParams.value = '';
- queryByIdList();
- };
-
- let pageChange = (val) => {
- pagination.current = val.current;
- pagination.pageSize = val.pageSize;
- queryByIdList();
- };
-
- let getupload = () => {
- modalType.value = 'upload';
- visibleUploadorDown.value = true;
- titleUploadorDown.value = '导入';
- };
-
- async function handlerComfirm(param) {
- if (modalType.value == 'upload') {
- let res = await importByExcel(param);
- if (res.code == 200) {
- visibleUploadorDown.value = false;
- message.success('导入成功');
- queryByIdList();
- }
- } else {
- let res = await exportGasByExcel({ insType: param.insType });
- console.log(res, '导出数据');
- if (res) {
- let filename = `${new Date().getTime()}.xlsx`;
- downFilePublic(res, filename);
- message.success('导出成功');
- }
- }
- }
-
- let getdownload = () => {
- modalType.value = 'download';
- visibleUploadorDown.value = true;
- titleUploadorDown.value = '导出';
- };
-
- async function handlerCancel() {
- modalType.value = '';
- }
-
- function downFilePublic(content, fileName) {
- const blob = new Blob([content], { type: 'application/xlsx;charset=UTF-8' });
-
-
- if ('download' in document.createElement('a')) {
-
- const link = document.createElement('a');
- link.download = fileName;
- link.style.display = 'none';
- link.href = URL.createObjectURL(blob);
- document.body.appendChild(link);
- link.click();
- URL.revokeObjectURL(link.href);
- document.body.removeChild(link);
- } else {
-
-
- }
- }
-
- async function moveUp(param) {
- let res = await moveOrderNum({ id: param.id, moveType: 'upp' });
- console.log(res, '向上移动');
- if (res) {
- queryByIdList();
- }
- }
-
- async function moveDown(param) {
- let res = await moveOrderNum({ id: param.id, moveType: 'bel' });
- console.log(res, '向下移动');
- if (res) {
- queryByIdList();
- }
- }
-
- let handlerFilter = (param) => {
- let data = param.key;
- switch (data) {
- case '1':
- pagination.current = 1;
- tableData.value = tableData.value.filter((v) => v.insType == '1');
- break;
- case '2':
- pagination.current = 2;
- tableData.value = tableData.value.filter((v) => v.insType == '2');
- break;
- }
- };
-
- let getTjAddress = () => {
- visibleAddress.value = true;
- titleAddress.value = '新增瓦斯巡检地址';
- };
-
- async function confirmAddress(param) {
- let res = await addGasReportAddress(param);
- console.log(res, '新增瓦斯巡检地点');
- if (res) {
- visibleAddress.value = false;
- queryByIdList();
- }
- }
-
- let cancelAddress = () => {
- visibleAddress.value = false;
- };
- onMounted(() => {
- queryByIdList();
- });
- </script>
- <style lang="less" scoped>
- .gasReport {
- width: 100%;
- height: 100%;
- padding: 80px 10px 15px 10px;
- box-sizing: border-box;
- position: relative;
- .search-area {
- margin: 20px 0px;
- .area-item {
- display: flex;
- align-items: center;
- .item-text {
- color: #fff;
- }
- }
- }
- .table-text {
- margin-bottom: 5px;
- }
- .text-y {
- color: #0be716;
- }
- .text-n {
- color: #ff0000;
- }
- .zxm-picker,
- .zxm-input {
- border: 1px solid #3ad8ff77 !important;
- background-color: #ffffff00 !important;
- color: #fff !important;
- }
- }
- :deep(.zxm-table-thead > tr > th:last-child) {
- border-right: 1px solid #91e9fe !important;
- }
- :deep(.zxm-picker-input > input) {
- color: #fff;
- }
- :deep(.zxm-select:not(.zxm-select-customize-input) .zxm-select-selector) {
- border: 1px solid #3ad8ff77 !important;
- background-color: #ffffff00 !important;
- }
- :deep(.zxm-select-selection-item) {
- color: #fff !important;
- }
- </style>
|