Newer
Older
KaiFengPC / src / views / project / projectConfiguration / dwwh / todoDon.vue
@zhangdeliang zhangdeliang on 23 May 5 KB 初始化项目
<template>
  <div class="water-analysis-page">
    <el-table :key="isFlag" :data="tableData" v-loading="tableLoading" max-height="500">
      <el-table-column type="index" width="55" label="序号" />
      <el-table-column :label="i.label" :prop="i.props" show-overflow-tooltip v-for="i in dwwhCloum">
        <template #default="{ row }" v-if="i.props == 'unitType'">
          <dict-tag :options="unit_type" :value="row.unitType" />
        </template>
        <template #default="{ row }" v-if="i.props == 'unitProperty'">
          <dict-tag :options="unit_property" :value="row.unitProperty" />
        </template>
        <template #default="{ row }" v-if="i.props == 'unitPhone'">
          <span :title="row.unitPhone">{{ row.unitPhone.replace(/^(.{3})(?:\d+)(.{4})$/, '$1****$2') }}</span>
        </template>
        <template #default="{ row }" v-if="i.props == 'primaryConcatPersonInformation'">
          <span :title="row.primaryConcatPersonInformation">{{
            row.primaryConcatPersonInformation.replace(/^(.{3})(?:\d+)(.{4})$/, '$1****$2')
          }}</span>
        </template>
        <template #default="{ row }" v-if="i.props == 'creditLine'">
          <dict-tag :options="credit_line" :value="row.creditLine" />
        </template>
        <template #default="{ row }" v-if="i.props == 'registryDate'">
          {{ row.registryDate.substring(0, 10) }}
        </template>
      </el-table-column>
      <el-table-column label="操作" width="210">
        <template #default="{ row }">
          <el-button icon="View" link type="primary" @click="onCheck(row, 1, '详情')">详情</el-button>
          <el-button icon="Edit" link type="warning" @click="onCheck(row, 2, '修改')">修改</el-button>
          <el-button icon="Delete" link type="danger" @click="onCheck(row, 3)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      :total="totals"
      v-show="totals > 0"
      v-model:page="FormList.pageNum"
      v-model:limit="FormList.pageSize"
      @pagination="getInfoList(FormList)"
    />
  </div>

  <!-- <projectTable v-else @returnClick="returnClick" :category='category'></projectTable> -->
  <!-- 查看详情弹框 -->
  <el-dialog
    v-model="visible"
    :title="'单位维护' + title"
    :modal-append-to-body="false"
    :close-on-click-modal="false"
    width="65%"
    style="height: auto; overflow: hidden"
  >
    <tableDalgo ref="tableDalgoRef" :key="isFlag" @onModalClose="onModalClose" :typeList="typeList"></tableDalgo>
    <template #footer>
      <div class="dialog-footer">
        <el-button v-show="typeList.type != 1" type="primary" @click="submit">保存</el-button>
        <el-button @click="visible = false">关闭</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup>
import { getInfo, projectInfoDelete, projectCompanyGet } from '@/api/project/dwwh';
import tableDalgo from './tableDalgo.vue';
import { formatMonths } from '@/utils';
import emgBox from '@/utils/ElMessageBox';
import { FileSystemList } from '@/api/project/tenderReview';
import { dwwhCloum } from '@/utils/cloums';

const { proxy } = getCurrentInstance();
const { unit_type, unit_property, credit_line } = proxy.useDict('unit_type', 'unit_property', 'credit_line');
const props = defineProps({
  tableData: {
    type: Object,
  },
});
const FormList = ref({});
const totals = ref(0);
let visible = ref(false);
let isFlag = ref(1);
let title = ref();
const tableDalgoRef = ref();
//动态组件
let dataForm = reactive({
  date: formatMonths(new Date()),
  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;

  setTimeout(() => {
    tableLoading.value = false;
  }, 1000);
};
//搜索
const search = p => {
  FormList.value.pageNum = 1;
  getInfoList(p);
  isFlag.value++;
  // getTableData(Date.parse(date.value));
};
defineExpose({ search });
// 查看上报数据
let typeList = ref({});
const onCheck = (row, ty, t) => {
  title.value = t;
  if (ty == 1 || ty == 2) {
    projectCompanyGet(row.id).then(({ code, data }) => {
      if (code == 200) {
        typeList.value = data;
        typeList.value.type = ty;
        FileSystemList({
          refId: row.id,
          refType: 'proProjectCompany',
        }).then(({ data }) => {
          typeList.value.fileList1 = data;
          visible.value = true;
          isFlag.value++;
        });
      }
    });
  } else if (ty == 3) {
    emgBox(row.id, projectInfoDeleteM, '您确定删除吗?');
  }
};
//删除
const projectInfoDeleteM = async id => {
  let { code } = await projectInfoDelete(id);
  getInfoList(FormList.value);
};
function onModalClose() {
  visible.value = false;
  getInfoList(FormList.value);
}
function submit() {
  tableDalgoRef.value.submit();
}
onMounted(() => {
  FormList.value = props.tableData;
  getInfoList(FormList.value);
});
</script>
<style lang="scss" scoped>
.water-analysis-page {
  height: 90vh;
}
</style>