Newer
Older
KaiFengPC / src / views / project / compensation / noticeRewardComponents / todoDon.vue
@鲁yixuan 鲁yixuan on 29 Aug 6 KB updata
<template>
  <div class="water-analysis-page1">
    <el-table :key="isFlag" :data="tableData" @selection-change="selectionChange" v-loading="tableLoading" max-height="500">
      <!-- <el-table-column type="index" width="55" label="序号" /> -->
      <el-table-column type="selection" width="55" />
      <el-table-column label="文档编码" prop="documentCode" show-overflow-tooltip />
      <el-table-column label="文档名称" prop="documentName" show-overflow-tooltip />
      <el-table-column label="文档负责人" prop="documentDutyUserName" width="160" show-overflow-tooltip>
        <template #default="{ row }">
          {{ getuserLists(row.documentDutyUserName)?.nickName || 1 }}
        </template>
      </el-table-column>
      <el-table-column label="联系方式" prop="remark" show-overflow-tooltip>
        <template #default="{ row }">
          {{ getuserLists(row.documentDutyUserName)?.phonenumber || 1 }}
        </template>
      </el-table-column>
      <el-table-column label="文档内容" prop="status">
        <template #default="{ row }">
          <span v-html="row.documentContent"></span>
        </template>
      </el-table-column>
      <el-table-column label="操作" width="280">
        <template #default="{ row }">
          <!-- <el-button icon="Connection" link type="primary" @click="onCheck(row, 0, '配置')">配置</el-button> -->
          <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
      v-show="totals > 0"
      :total="totals"
      v-model:page="FormList.pageNum"
      v-model:limit="FormList.pageSize"
      @pagination="getInfoList(FormList)"
    />
    <el-dialog v-model="visible" :title="'奖补须知 ' + title" :modal-append-to-body="false" :close-on-click-modal="false" width="50%">
      <tableDalgo
        ref="tableDalgoRef"
        v-if="visible"
        :configOpts="configOpts"
        @onModalClose="onModalClose"
        :typeList="typeList"
      ></tableDalgo>
      <template #footer>
        <div class="dialog-footer">
          <el-button v-if="typeList?.type != 1" type="primary" @click="submit">确定</el-button>
          <el-button @click="visible = false">取消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script setup>
import { required } from '@/utils/validate-helper';
import { getInfo, projectInfoDelete, projectInfoGet, getProjectItemDescriptionConfigList } from '@/api/project/noticeReward';
import tableDalgo from './tableDalgo.vue';
import { formatMonths } from '@/utils';
import emgBox1 from '@/utils/ElMessageBox1';
import { ElMessage } from 'element-plus';
import { FileSystemList } from '@/api/project/tenderReview';

const { proxy } = getCurrentInstance();
const { userLists } = defineProps(['userLists']);
console.log(userLists, 'userLists');
const tableDalgoRef = ref();
let visible = ref(false);
let isFlag = ref(1);
const title = ref('');
const FormList = ref({
  pageNum: 1,
  pageSize: 10,
});
const totals = ref(0);
let dataForm = reactive({
  date: formatMonths(new Date()),
  tableData: '',
  tableDateTwo: '',
  tableLoading: true,
});
let { date, tableData, tableDateTwo, tableLoading } = toRefs(dataForm);
const visible1 = ref(false);
const list = ref([]);
const loading = ref(false);
const form = reactive({
  projectTypeId: '',
  projectContentType: '',
  propertyKey: '',
  propertyName: '',
  sort: '',
});
const rules = reactive({
  projectContentType: required('项目内容类型'),
  propertyKey: required('项目内容'),
  propertyName: required('项目内容名称'),
  sort: required('排序'),
});
let row = {};
const visible2 = ref(false);
const outRow = shallowRef({});
//获取列表数据
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);
};
defineExpose({ search, delAll });
// 查看上报数据
let typeList = ref({});
const onCheck = (row, ty, t) => {
  title.value = t;
  if (ty == 1 || ty == 2) {
    projectInfoGet(row.id).then(({ code, data }) => {
      if (code == 200) {
        typeList.value = { ...data, type: ty };
        FileSystemList({
          refId: row.id,
          refType: 'projectBonusNotice',
        }).then(({ data }) => {
          typeList.value.fileList1 = data;
          visible.value = true;
        });
      }
    });
  } else if (ty == 3) {
    emgBox1(row.id, projectInfoDeleteM, '您确定删除吗?');
  } else if (ty === 0) {
    visible1.value = true;
    outRow.value = row;
    form.projectTypeId = row.id;
    getList(row.id);
  }
};
//删除
const projectInfoDeleteM = async id => {
  let { code } = await projectInfoDelete(id);
  if (code == 200) {
    ElMessage({
      type: 'success',
      message: '操作成功',
    });
    getInfoList(FormList.value);
  }
};
//撤回操作
const Returncnfiorm = async id => {
  let { code } = await projectInfoDelete(id);
};
function onModalClose() {
  visible.value = false;
  console.log('object', 3444);

  getInfoList(FormList.value);
}
function submit() {
  tableDalgoRef.value.submit();
}

const closeDialog = () => {
  visible1.value = false;
};
const del = (row, index) => {
  proxy.$modal
    .confirm('是否确认删除?')
    .then(async () => {
      list.value.splice(index, 1);
    })
    .catch(() => {});
};
function delAll() {
  if (selectData.value.length == 0) {
    ElMessage({
      message: '请选要删除数据',
      type: 'warning',
    });
    return;
  } else {
    let arr = [];
    selectData.value.forEach(i => {
      arr.push(i.id);
    });
    console.log(arr.join(','), 333);
    emgBox1(arr.join(','), projectInfoDeleteM, '您确定删除吗?');
  }
}
const getList = async id => {
  const res = await getProjectItemDescriptionConfigList({ projectTypeId: id });
  if (res?.code !== 200) return;
  list.value = res?.data || [];
};
//选择删除
const selectData = ref([]);
function selectionChange(v) {
  selectData.value = v;
}
function getuserLists(v) {
  let arr = {};
  userLists.map(k => {
    if (String(k.userId) == v) {
      arr = k;
    }
  });
  return arr;
}
onMounted(() => {
  getInfoList(FormList.value);
});
</script>
<style lang="scss" scoped>
.water-analysis-page1 {
  height: 90vh;
  :deep(.formItem) {
    .el-form-item__label {
      width: 110px;
      word-break: keep-all;
    }
  }
}

.btns {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 15px;
}
</style>