Newer
Older
xc-business-system / src / views / resource / outsideService / supplier / evaluate.vue
<!-- 供方名录 人员信息 -->
<script name="SupplierInfoEvaluate" lang="ts" setup>
import type { ISupplierInfoEvaluate } from './supplier-interface'
import type { TableColumn } from '@/components/NormalTable/table_interface'
import { getSupplierEvaluateList } from '@/api/resource/supplier'

const props = defineProps({
  supplierId: { type: String, default: '' },
  supplierType: { type: String, default: '' },
})

const evaluateColumns = ref<TableColumn[]>([
  { text: '评价表编号', value: 'formNo', align: 'center', width: '180' },
  { text: '评价表名称', value: 'formName', align: 'center', width: '280' },
  { text: '编制部门', value: 'deptName', align: 'center' },
  { text: '编制人', value: 'createUserName', align: 'center', width: '180' },
  { text: '编制日期', value: 'createTime', align: 'center', width: '180' },
]) // 表头

const evaluateList = ref<ISupplierInfoEvaluate[]>([]) // 表格数据

// 逻辑
const detail = (row: ISupplierInfoEvaluate) => {
  console.log(row.id)
}

// 根据供方id查询相关人员
const getEvaluateListBySupplierId = () => {
  getSupplierEvaluateList({ supplierId: props.supplierId, supplierType: props.supplierType }).then((res: any) => {
    if (res.code === 200) {
      switch (props.supplierType) {
        case '1':
          evaluateList.value = res.data.serviceEvaluateList
          break
        case '2':
          evaluateList.value = res.data.supplierEvaluateList
          break
        case '3':
          evaluateList.value = res.data.consumableGoodsEvaluateList
          break
      }
    }
  })
}

watch(() => props.supplierId, (newVal: string) => {
  // listQuery.id = newVal
  // staffRecord.supplierId = newVal

  getEvaluateListBySupplierId()
})
</script>

<template>
  <table-container title="关联评价表">
    <!-- 表格区域 -->
    <normal-table
      id="evaluateListTabel"
      :data="evaluateList" :columns="evaluateColumns"
      :pagination="false"
    >
      <template #preColumns>
        <el-table-column label="序号" width="55" align="center">
          <template #default="scope">
            {{ scope.$index + 1 }}
          </template>
        </el-table-column>
      </template>
      <template #columns>
        <el-table-column fixed="right" label="操作" align="center" width="130">
          <template #default="{ row }">
            <el-button size="small" type="primary" link @click="detail(row)">
              查看
            </el-button>
          </template>
        </el-table-column>
      </template>
    </normal-table>
  </table-container>
</template>