DispatchForm.vue 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="document-form">
  3. <uv-loading-icon v-if="loading" mode="circle" text="正在加载派驻详情..."></uv-loading-icon>
  4. <template v-else-if="form">
  5. <!-- 基本信息 -->
  6. <view class="common-section-card">
  7. <view class="section-title">人员派驻信息</view>
  8. <view class="info-row">
  9. <text class="label">派遣类型</text>
  10. <text class="value">{{ getDictLabel('disType', form.disType) }}</text>
  11. </view>
  12. <view class="info-row"><text class="label">姓名</text><text class="value">{{ form.reserName || '-' }}</text></view>
  13. <view class="info-row">
  14. <text class="label">性别</text>
  15. <text class="value">{{ form.reserGender === '10' ? '男' : (form.reserGender === '20' ? '女' : '-') }}</text>
  16. </view>
  17. <view class="info-row">
  18. <text class="label">{{ form.disType == '10' ? '派遣单位' : '接收单位' }}</text>
  19. <text class="value">{{ form.disAddress || '-' }}</text>
  20. </view>
  21. <view class="info-row"><text class="label">手机号</text><text class="value">{{ form.reserPhone || '-' }}</text></view>
  22. <view class="info-row"><text class="label">电子邮箱</text><text class="value">{{ form.reserEmail || '-' }}</text></view>
  23. <view class="info-row">
  24. <text class="label">派遣时间</text>
  25. <text class="value">{{ form.disStartTime || '-' }} 至 {{ form.disEndTime || '-' }}</text>
  26. </view>
  27. <view class="info-row"><text class="label">项目名称</text><text class="value">{{ form.projectName || '-' }}</text></view>
  28. <view class="info-row"><text class="label">工作内容</text><text class="value">{{ form.disContent || '-' }}</text></view>
  29. </view>
  30. <!-- 附件 -->
  31. <view class="common-section-card mt20" v-if="attachment">
  32. <view class="section-title">佐证材料</view>
  33. <view class="common-file-list">
  34. <view class="file-item" @click="previewFile(attachment.url, attachment.name)">
  35. <view class="file-info">
  36. <text class="f-name">{{ attachment.name }}</text>
  37. <view class="f-meta">
  38. <text class="f-type">佐证材料</text>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  46. </view>
  47. </template>
  48. <script setup lang="ts">
  49. import { ref, onMounted, watch, computed } from 'vue';
  50. import { useDict } from '@/hooks/useDict';
  51. import { useDocumentApi } from '@/api/document';
  52. import { previewFile } from '@/utils/file';
  53. import to from 'await-to-js';
  54. const props = defineProps<{
  55. code: string;
  56. }>();
  57. const { getDictLabel } = useDict('disType');
  58. const documentApi = useDocumentApi();
  59. const form = ref<any>(null);
  60. const loading = ref(false);
  61. const attachment = computed(() => {
  62. if (form.value?.disFile) {
  63. try {
  64. return JSON.parse(form.value.disFile);
  65. } catch (e) {
  66. return null;
  67. }
  68. }
  69. return null;
  70. });
  71. const fetchData = async () => {
  72. if (!props.code) return;
  73. loading.value = true;
  74. const [err, res] = await to(documentApi.getDispatchById(props.code));
  75. if (!err && res?.data) {
  76. form.value = res.data;
  77. }
  78. loading.value = false;
  79. };
  80. onMounted(() => {
  81. fetchData();
  82. });
  83. watch(() => props.code, () => {
  84. fetchData();
  85. });
  86. </script>
  87. <style lang="scss" scoped>
  88. @import "./common.scss";
  89. </style>