zhouwx
2026-06-17 facea208b2fc7c8c7a0d176df06305b866c6520f
src/views/hazardousChemicals/subscribeApplyManage/subscribe/index.vue
@@ -11,7 +11,7 @@
          >新增</el-button>
        </el-form-item>
        <el-form-item label="审批状态:" >
          <el-select v-model="data.queryParams.state" placeholder="请选择" >
          <el-select v-model="data.queryParams.status" placeholder="请选择" >
            <el-option
                v-for="item in data.stateOptions"
                :key="item.id"
@@ -20,7 +20,7 @@
            />
          </el-select>
        </el-form-item>
        <el-form-item label="审批人:" prop="userId" >
        <el-form-item label="审批人:" >
          <el-select
              clearable
              v-model="data.userName"
@@ -57,25 +57,63 @@
    <!-- 表格数据 -->
    <el-table v-loading="loading" :data="dataList" :border="true">
      <el-table-column label="序号" type="index" align="center" width="80" />
      <el-table-column label="申购单号" prop="creditCode" align="center"  />
      <el-table-column label="危化品名称" prop="code" align="center" />
      <el-table-column label="申购数量" prop="name" align="center" />
      <el-table-column label="申购人" prop="major" align="center"  />
      <el-table-column label="审批人" prop="phone" align="center"/>
      <el-table-column label="申购文件" prop="phone" align="center">
      <el-table-column label="申购单号" prop="subscribeNum" align="center"  />
      <el-table-column label="危化品名称" align="center"  class-name="subscribe-quantity-cell" width="200">
        <template #default="scope">
          <el-link v-if="scope.row.fileName" style="" type="primary" @click="openFile(scope.row.filePath)">{{scope.row.fileName}}</el-link>
          <div style="width: 100%; height: 100%;display: flex; flex-direction: column;justify-content: center;align-items: center; ">
            <div
              v-for="(item, index) in scope.row.subscribeHazmats"
              :key="item.id"
              style="
              width: 100%;
              text-align: center;
              padding: 8px 0;
              border-bottom: 1px solid #ebeef5;"
              :style="{
                borderBottom: index === scope.row.subscribeHazmats.length - 1 ? 'none' : '1px solid #ebeef5'
                }"
            >
              <span>{{ item.hazmatName }}</span>
            </div>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="审批状态" prop="phone" align="center">
      <el-table-column label="申购数量" align="center" class-name="subscribe-quantity-cell">
      <template #default="scope">
        <div style="width: 100%; height: 100%;display: flex; flex-direction: column;justify-content: center;align-items: center; ">
          <div
            v-for="(item, index) in scope.row.subscribeHazmats"
            style="
            width: 100%;
            text-align: center;
            padding: 8px 0;
            border-bottom: 1px solid #ebeef5;"
            :style="{
              borderBottom: index === scope.row.subscribeHazmats.length - 1 ? 'none' : '1px solid #ebeef5'
            }"
          >
            {{ item.hazmatCount }}
          </div>
        </div>
      </template>
      </el-table-column>
      <el-table-column label="申购人" prop="subscribePersonName" align="center"  />
      <el-table-column label="审批人" prop="checkName" align="center"/>
      <el-table-column label="申购文件" prop="fileName" align="center">
        <template #default="scope">
          <span> {{scope.row.state == 0 ? '未审批' :scope.row.state == 1 ?'审批通过':scope.row.state == 2 ?'审批驳回':''}}</span><span></span>
          <el-link v-if="scope.row.fileName" style="" type="primary" @click="openFile(scope.row.filePath)">{{scope.row.fileName}}</el-link>
          <span v-else></span>
        </template>
      </el-table-column>
      <el-table-column label="审批状态" prop="status" align="center">
        <template #default="scope">
          <span> {{scope.row.status == 0 ? '未审批' :scope.row.status == 1 ?'审批通过':scope.row.status == 2 ?'审批驳回':''}}</span><span></span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" >
        <template #default="scope">
          <el-button v-if="scope.row.state == 0" link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
          <el-button v-if="scope.row.state == 0" link type="danger" @click="handleDelete(scope.row)">删除</el-button>
          <el-button v-if="scope.row.status == 0" link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
          <el-button v-if="scope.row.status == 0" link type="danger" @click="handleDelete(scope.row)">删除</el-button>
          <el-button link type="primary" @click="openDialog('view',scope.row)">查看</el-button>
        </template>
      </el-table-column>
@@ -100,6 +138,7 @@
import editDialog from "./components/editDialog.vue";
import {getUser} from "@/api/hazardousChemicals/user";
import {renderAsync} from "docx-preview";
import {delSubscribe, getSubscribeList} from "@/api/hazardousChemicals/subscribeApply";
const { proxy } = getCurrentInstance();
const loading = ref(false);
const dialogRef = ref();
@@ -107,8 +146,9 @@
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    state: null,
    userId:null
    status: null,
    subscribePersonId:null,
    checkId:null
  },
  total: 0,
  dataList: [],
@@ -143,13 +183,16 @@
const getList = async () => {
  loading.value = true
  // const res = await getCompany(data.queryParams)
  // if(res.code == 200){
  //   data.dataList = res.data.list
  //   data.total = res.data.total
  // }else{
  //   ElMessage.warning(res.message)
  // }
  const res = await getSubscribeList(data.queryParams).catch(error => {
    loading.value = false
    return
  })
  if(res.code == 200){
    data.dataList = res.data.list
    data.total = res.data.total
  }else{
    ElMessage.warning(res.message)
  }
  loading.value = false
}
@@ -162,8 +205,9 @@
  data.queryParams = {
    pageNum: 1,
    pageSize: 10,
    state: null,
    userId:null
    status: null,
    subscribePersonId:null,
    checkId:null
  }
  data.userName = ''
  getList()
@@ -179,7 +223,7 @@
        type: 'warning',
      })
      .then( async() => {
        const res = await delCompany(val.id)
        const res = await delSubscribe(val.id)
        if(res.code == 200){
          ElMessage.success('数据删除成功')
          await getList()
@@ -209,11 +253,11 @@
}
const selectValue =  (val) => {
  if(!val){
    data.queryParams.userId = null
    data.queryParams.checkId = null
  }
  data.peopleList.forEach(item => {
    if(item.name === val){
      data.queryParams.userId = item.id
      data.queryParams.checkId = item.id
    }
  })
}
@@ -259,5 +303,10 @@
    }
  }
}
</script>
<style scoped>
/* 只对申购数量这一列生效 */
:deep(.subscribe-quantity-cell .cell) {
  padding: 0 !important; /* 关键:把默认的padding清零,优先级拉满 */
}
</style>