Newer
Older
KaiFengPC / src / views / floodSys / scada / areaInfo / todoDon.vue
@鲁yixuan 鲁yixuan on 14 Aug 4 KB updata
<template>
  <div class="water-analysis-page">
    <el-table :key="isFlag" :data="tableData" v-loading="tableLoading" max-height="600">
      <el-table-column type="index" width="70" label="序号" />
      <el-table-column :label="i.label" :prop="i.prop" show-overflow-tooltip v-for="i in areaInfoCloum">
        <template #default="{ row }" v-if="i.prop == 'stationName'">
          {{ getstationName(row.stationCode) }}
        </template>
        <template #default="{ row }" v-if="i.prop == 'parentId'">
          {{ getplc_station_type(row.parentId) }}
        </template>
      </el-table-column>
      <el-table-column label="操作" width="250">
        <template #default="{ row }">
          <el-button link type="primary" icon="View" @click="onCheck(row, 1, '详情')">详情</el-button>
          <el-button link icon="Edit" type="warning" @click="onCheck(row, 2, '修改')">修改</el-button>
          <el-button link icon="Delete" type="danger" @click="onCheck(row, 3)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="totals > 0"
      :total="totals"
      v-model:page="FormList.pageNum"
      v-model:limit="FormList.pageSize"
      @pagination="getInfoList(FormList)"
    />
  </div>
  <el-dialog
    v-model="visible"
    :title="'PLC区域信息' + FormList.title"
    :modal-append-to-body="false"
    :close-on-click-modal="false"
    width="51%"
  >
    <tableDalgo ref="tableDalgoRef" v-if="visible" @onModalClose="onModalClose" :typeList="typeList" :key="isFlag"></tableDalgo>
    <template #footer>
      <div class="dialog-footer">
        <el-button v-show="typeList.type == '2'" @click="open2" type="primary">确定</el-button>
        <el-button @click="visible = false">关闭</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup>
import { ElMessage, ElMessageBox } from 'element-plus';
import { getInfo, projectInfoDelete, projectInfoGet, getInfolist } from '@/api/scada/areaInfo';
import { FileSystemList } from '@/api/project/tenderReview';
import tableDalgo from './tableDalgo.vue';
import { areaInfoCloum } from '@/utils/cloums';
const { proxy } = getCurrentInstance();
const { typeListlist } = defineProps(['typeListlist']);
import { reactive } from 'vue';
let visible = ref(false);
let isFlag = ref(1);
const tableDalgoRef = ref();
const FormList = ref({});
const totals = ref(0);
//动态组件
let dataForm = reactive({
  tableData: [],
  tableDateTwo: '',
  tableLoading: true,
});
let { date, tableData, tableDateTwo, tableLoading } = toRefs(dataForm);
//获取列表数据
const getInfoList = async prams => {
  tableLoading.value = true;
  let { data, total } = await getInfo(prams);
  tableData.value = data;
  totals.value = total;
  tableLoading.value = false;
};
//搜索
const search = p => {
  FormList.value = p;
  FormList.value.pageNum = 1;
  getInfoList(p);
  isFlag.value++;
};
defineExpose({ search });
// 查看上报数据
let typeList = ref({});
const onCheck = (row, ty, t) => {
  FormList.value.title = t;
  console.log(ty, 'ty111');
  if (ty == 1 || ty == 2) {
    projectInfoGet(row.id).then(({ code, data }) => {
      if (code == 200) {
        typeList.value = { ...typeListlist, type: ty, ...data };
        visible.value = true;
        FileSystemList({
          refId: row.id,
          refType: 'plcAreaPictures',
        }).then(({ data }) => {
          typeList.value.fileSaveRequestList = data;
        });
      }
    });
    // 获取文件列表
  } else if (ty == 3) {
    ElMessageBox.confirm(`您确定删除吗?`, '提示', {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
    })
      .then(() => {
        proxy.$modal.msgSuccess('操作成功!');
        projectInfoDeleteM(row.id);
      })
      .catch(() => {});
    // emgBox(row.id, projectInfoDeleteM, "您确定删除吗?");
  }
};
//删除
const projectInfoDeleteM = async id => {
  let { code } = await projectInfoDelete(id);
  getInfoList();
};
function onModalClose() {
  visible.value = false;
  getInfoList();
}

function open2() {
  tableDalgoRef.value.submit();
}
function getstationName(v) {
  let arrr = typeListlist.stationName_type.filter(i => {
    return i.stationCode == v;
  });
  return arrr[0]?.stationName;
}
function getplc_station_type(v) {
  let arrr = arrrOne.value.filter(i => {
    return i.id == v + '';
  });
  return arrr[0]?.areaName;
}
const arrrOne = ref([]);
const getInfolistM = async p => {
  let { data } = await getInfolist(p);
  arrrOne.value = data;
};
onMounted(() => {
  getInfolistM();
});
</script>
<style lang="scss" scoped></style>