unknown 1 тиждень тому
батько
коміт
7d165b7e6f

+ 18 - 72
src/views/elderly/contracts/ContractManageForm.vue

@@ -313,10 +313,12 @@ const selectorVisible = ref<{
   list: []
 })
 
-const open = (row?: any) => {
+const type_c = ref(1)
+const open = (row?: any,type=1) => {
   recordRow.value = row || null
+  type_c.value = type
+  isTextMode.value = type_c.value != 1;
   formLoading.value = true
-  isTextMode.value = false
   isPrint.value = false
   attachmentList.forEach((it) => {
     // 固定内容附件(3=入住须知)默认展示,不需要从列表选择
@@ -408,75 +410,7 @@ const handlePrint = async () => {
   }, 500)
 }
 
-const handleExport = async () => {
-  isPrint.value = true
-  isTextMode.value = true
-
-  await nextTick()
-  await new Promise((resolve) => setTimeout(resolve, 2500))
-
-  const container = document.querySelector('.print-container') as HTMLElement | null
-  if (!container) {
-    message.error('未找到打印内容,请重试')
-    isPrint.value = false
-    isTextMode.value = false
-    return
-  }
-
-  // html2canvas 无法渲染 display:none 的元素,因此临时显示(移出可视区域,避免闪烁)
-  const originalDisplay = container.style.display
-  const originalPosition = container.style.position
-  const originalLeft = container.style.left
-  const originalTop = container.style.top
-  const originalWidth = container.style.width
-  container.style.display = 'block'
-  container.style.position = 'absolute'
-  container.style.left = '-10000px'
-  container.style.top = '0px'
-  container.style.width = '210mm'
-
-  const filename = recordRow.value?.elderName
-    ? `${recordRow.value.elderName}-养老服务合同.pdf`
-    : '养老服务合同.pdf'
 
-  try {
-    await html2pdf()
-      .set({
-        margin: 0,
-        filename,
-        image: { type: 'jpeg', quality: 0.98 },
-        html2canvas: {
-          scale: 2,
-          useCORS: true,
-          backgroundColor: '#ffffff',
-          logging: false,
-          foreignObjectRendering: false
-        },
-        jsPDF: {
-          unit: 'mm',
-          format: 'a4',
-          orientation: 'portrait'
-        },
-        pagebreak: { mode: ['css'] }
-      })
-      .from(container)
-      .save()
-    message.success('导出成功')
-  } catch (e) {
-    console.error('导出PDF失败', e)
-    message.error('导出失败,请尝试使用打印功能另存为PDF')
-  } finally {
-    container.style.display = originalDisplay
-    container.style.position = originalPosition
-    container.style.left = originalLeft
-    container.style.top = originalTop
-    container.style.width = originalWidth
-    setTimeout(() => {
-      isPrint.value = false
-      isTextMode.value = false
-    }, 500)
-  }
-}
 
 const toggleTextMode = () => {
   isTextMode.value = !isTextMode.value
@@ -491,6 +425,17 @@ const openAttachmentSelector = (attach: any) => {
   }
 }
 
+const handleAttachmentDelete = (attach: any) => {
+  const key = `attach_${attach.no}`
+  // 固定内容附件(3=入住须知)删除后恢复默认展示
+  if (attach.no === 3) {
+    attachments[key] = { title: attach.title }
+  } else {
+    attachments[key] = null
+  }
+  message.success(`已删除:${attach.title}`)
+}
+
 const handleAttachmentSelect = (row: any) => {
   const key = selectorVisible.value.current
   if (key) {
@@ -572,11 +517,11 @@ const renderAttachmentContent = (key: string) => {
         <el-tag type="info" size="large">颐年集团养老服务合同</el-tag>
         <div class="toolbar-right">
           <el-tooltip :content="isTextMode ? '切换为编辑模式(输入框)' : '切换为文本模式(打印预览)'" placement="top">
-            <el-button :type="isTextMode ? 'success' : 'default'" size="small" @click="toggleTextMode">
+            <el-button v-show="type_c==1" :type="isTextMode ? 'success' : 'default'" size="small" @click="toggleTextMode">
               {{ isTextMode ? '文本模式' : '编辑模式' }}
             </el-button>
           </el-tooltip>
-          <el-button type="primary" :loading="formLoading" size="small" @click="handleSave">保存</el-button>
+          <el-button v-show="type_c==1" type="primary" :loading="formLoading" size="small" @click="handleSave">保存</el-button>
           <el-button size="small" @click="handleClose">关闭</el-button>
           <el-tooltip placement="bottom" content="打印时目标打印机选择「Microsoft Print to PDF」;导出时目标打印机选择「另存为 PDF」">
             <el-button type="success" size="small" @click="handlePrint">打印/导出</el-button>
@@ -604,6 +549,7 @@ const renderAttachmentContent = (key: string) => {
           :selected-data="attachments[`attach_${attach.no}`]"
           :is-text-mode="isTextMode"
           @select="openAttachmentSelector(attach)"
+          @delete="handleAttachmentDelete(attach)"
         >
           <template #default="{ data }">
             <div v-if="attach.no === 1" class="attachment-content">

+ 25 - 9
src/views/elderly/contracts/components/AttachmentPage.vue

@@ -10,6 +10,7 @@ const props = defineProps<{
 
 const emit = defineEmits<{
   (e: 'select'): void
+  (e: 'delete'): void
 }>()
 
 const hasData = computed(() => {
@@ -26,15 +27,25 @@ const hasData = computed(() => {
       <div class="attachment-title">
         附件{{ attachmentNo }}:{{ title }}
       </div>
-      <el-button
-        v-if="!isTextMode"
-        type="primary"
-        size="small"
-        plain
-        @click="emit('select')"
-      >
-        从列表中选择
-      </el-button>
+      <div v-if="!isTextMode" class="attachment-actions">
+        <el-button
+          type="primary"
+          size="small"
+          plain
+          @click="emit('select')"
+        >
+          从列表中选择
+        </el-button>
+        <el-button
+          v-if="hasData && !isTextMode"
+          type="danger"
+          size="small"
+          plain
+          @click="emit('delete')"
+        >
+          删除
+        </el-button>
+      </div>
     </div>
 
     <div v-if="hasData" class="attachment-content">
@@ -82,6 +93,11 @@ const hasData = computed(() => {
   color: #222;
 }
 
+.attachment-actions {
+  display: flex;
+  gap: 8px;
+}
+
 .attachment-content {
   font-size: 14px;
   line-height: 1.9;

+ 14 - 2
src/views/elderly/elder/contract/index.vue

@@ -63,13 +63,21 @@
       :data="list"
       :columns="ContractColumns"
       :queryParams="queryParams"
-      :opWidth="240"
+      :opWidth="290"
       @edit="(arg) => handleRenewal(arg, 1)"
       @upload="openForm"
       @detail="openDetail"
     >
       <!-- @check="(arg) => handleRenewal(arg, 2)" -->
       <template #pre="{ scope }">
+        <el-button
+          link
+          type="warning"
+          @click="handleElectronic(scope, 1)"
+          v-hasPermi="['contracts:electronic_contract']"
+        >
+          电子合同
+        </el-button>
         <el-button
           link
           type="primary"
@@ -154,7 +162,6 @@ const resetQuery = () => {
 /** 添加/修改操作 */
 const formRef = ref()
 const openForm = (row: any = {}, type: number = 1) => {
- // contractManageFormRef.value.open(row, type)
   formRef.value.open(row, type)
 }
 
@@ -164,6 +171,11 @@ const handleRenewal = (row: any = {}, type: number = 1) => {
   renewalRef.value.open(row, type)
 }
 
+// 电子合同
+const handleElectronic = (row: any = {}, type: number = 1) => {
+   contractManageFormRef.value.open(row, type)
+}
+
 // 详情
 const detailRef = ref()
 const openDetail = (row: any = {}) => {

+ 26 - 9
src/views/elderly/elder/elder-file/Third.vue

@@ -81,12 +81,12 @@
     </ElScrollbar>
 
     <div class="title">合同信息</div>
-    <el-table :header-cell-style="tableHeaderColor" :data="info.contracts">
-      <el-table-column prop="date" label="序号">
-        <template #default="scope">
-          {{ scope.$index + 1 }}
-        </template>
-      </el-table-column>
+    <el-table :header-cell-style="tableHeaderColor" :data="info.contracts" >
+<!--      <el-table-column prop="date" label="序号">-->
+<!--        <template #default="scope">-->
+<!--          {{ scope.$index + 1 }}-->
+<!--        </template>-->
+<!--      </el-table-column>-->
       <el-table-column prop="contractNumber" label="合同编号" />
       <el-table-column prop="beginTime" label="合同开始日期" :formatter="dateFormatter2" />
       <el-table-column prop="expireTime" label="合同结束日期">
@@ -113,6 +113,18 @@
           <el-link v-for="item in scope.row.files" :key="item.fileUrl" @click="handleDownLoad(item)">{{ item.fileName }}</el-link>
         </template>
       </el-table-column>
+      <el-table-column label="操作" align="right" width="70" fixed="right">
+        <template #default="scope" >
+          <el-button
+            link
+            type="primary"
+            @click="openFormC(scope.row)"
+          >
+            电子合同
+          </el-button>
+           
+        </template>
+      </el-table-column>
     </el-table>
 
     <div class="title mt-3">变更信息</div>
@@ -168,6 +180,10 @@
         </el-table>
       </el-tab-pane>
     </el-tabs>
+
+    <ContractManageForm ref="contractManageFormRef" />
+
+
   </div>
 </template>
 <script lang="ts" setup>
@@ -182,6 +198,7 @@ import { ElScrollbar } from 'element-plus'
 import { formatTime, handleDownLoad } from '@/utils'
 import {Edit} from "@element-plus/icons-vue"
 import {updateContractDate} from "@/api/elderly/fee/leave-settle";
+import ContractManageForm from "@/views/elderly/contracts/ContractManageForm.vue";
 const message = useMessage()
 
 const props = defineProps({
@@ -194,6 +211,7 @@ const props = defineProps({
 const bedInfo = ref({})
 const nurseInfo = ref({})
 const foodInfo = ref({})
+const contractManageFormRef = ref()
 
 const info = ref({})
 const activeChangeTab = ref('changeRecords')
@@ -232,9 +250,8 @@ const formData = ref({
 })
 
 // 格式化日期字符串
-const formatDateStr = (date) => {
-  if (!date) return ''
-  return formatDate(date, 'yyyy-MM-dd')
+const openFormC = (row) => {
+  contractManageFormRef.value.open(row, 2)
 }
 
 let tempContractData = {}

+ 1 - 1
src/views/elderly/fee/leave-settle/Form.vue

@@ -253,7 +253,7 @@
 </template>
 <script setup lang="ts">
 import {
-  getVirtualRefundSettlementOrder,
+
   settleAccountsNew,
   getSettledRefundOrderDetail,
   getOutboundRefundDetail, editRefundSettlementOrder

+ 1 - 1
src/views/elderly/fee/leave-settle/Print.vue

@@ -101,7 +101,7 @@
 import { useUserStore } from '@/store/modules/user'
 import {
   getOutboundRefundDetail,
-  getSettledRefundOrderDetail, getVirtualRefundSettlementOrder
+  getSettledRefundOrderDetail,
 } from '@/api/elderly/fee/leave-settle'
 import { formatDate } from '@/utils/formatTime'
 import { getDictLabel, DICT_TYPE } from '@/utils/dict'