append_contract6.py 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. # -*- coding: utf-8 -*-
  2. import io
  3. out = r'd:\Users\chenjun\kyj-yanglao-web-new\src\views\elderly\apply\check-in\ContractForm.vue'
  4. with io.open(out, 'a', encoding='utf-8') as f:
  5. f.write(u'''
  6. <script setup>
  7. import { ref, reactive, onMounted } from 'vue'
  8. import { ElMessage } from 'element-plus'
  9. import { getCheckInRecordId } from '@/api/elderly/apply/check-in'
  10. const drawerVisible = ref(false)
  11. const loading = ref(false)
  12. const isPrint = ref(false)
  13. const currentRow = ref({})
  14. const contractForm = reactive({
  15. contractNumber: '',
  16. partyAName: '颐年健康产业(集团)有限公司',
  17. partyACode: '',
  18. partyAAddr: '',
  19. partyAZip: '',
  20. partyALegal: '',
  21. partyAPhone: '',
  22. elderName: '',
  23. elderGender: '',
  24. elderGenderText: '',
  25. elderBirth: '',
  26. elderIdCard: '',
  27. elderPhone: '',
  28. elderHomeAddr: '',
  29. elderAddress: '',
  30. elderZip: '',
  31. elderNation: '',
  32. elderEducation: '',
  33. elderMarital: '',
  34. elderInsurance: '',
  35. eatingHabit: '',
  36. sleepHabit: '',
  37. hobby: '',
  38. medicalHistory: '',
  39. allergyHistory: '',
  40. nurseLevelName: '',
  41. partyCName: '',
  42. partyCIdCard: '',
  43. partyCRelation: '',
  44. partyCPhone: '',
  45. partyCAddress: '',
  46. partyCHomeAddr: '',
  47. partyCZip: '',
  48. partyCWorkUnit: '',
  49. partyCCommAddr: '',
  50. partyCGenderText: '',
  51. partyCBirth: '',
  52. contractMonths: '',
  53. startDate: '',
  54. endDate: '',
  55. servicePlace: '颐年集团养老服务机构',
  56. roomNumber: '',
  57. bedFee: '',
  58. nurseFee: '',
  59. mealFee: '',
  60. manageFee: '',
  61. freeElectric: '',
  62. freeWater: '',
  63. hotWaterFee: '',
  64. coldWaterFee: '',
  65. electricFee: '',
  66. consultFee: '',
  67. totalFee: '',
  68. deposit: '',
  69. payeeName: '',
  70. payeeBank: '',
  71. payeeAccount: '',
  72. payerName: '',
  73. payerBank: '',
  74. payerAccount: '',
  75. lifeSavingDeposit: '',
  76. lifeSavingDepositCN: '',
  77. deathDeposit: '',
  78. deathDepositCN: '',
  79. emergencyContact2Name: '',
  80. emergencyContact2Relation: '',
  81. emergencyContact2Phone: '',
  82. otherContact1Name: '',
  83. otherContact1Relation: '',
  84. otherContact1Phone: '',
  85. otherContact2Name: '',
  86. otherContact2Relation: '',
  87. otherContact2Phone: '',
  88. partyASeal: '',
  89. partyALegalSign: '',
  90. partyASignDate: '',
  91. partyBSign: '',
  92. partyBSignDate: '',
  93. partyCSign: '',
  94. partyCSignDate: '',
  95. consentSignB: '',
  96. consentSignC: '',
  97. consentDate: '',
  98. promiseSignB: '',
  99. promiseSignC: '',
  100. promiseDate: '',
  101. outingStartDate: '',
  102. outingEndDate: '',
  103. outingReason: '',
  104. outingCompanionName: '',
  105. outingCompanionPhone: '',
  106. outingCompanionRelation: '',
  107. outingDestination: '',
  108. outingSignB: '',
  109. outingSignC: '',
  110. outingOperator: '',
  111. outingDate: '',
  112. signProxyReason: '',
  113. signProxySignB: '',
  114. signProxySignC: '',
  115. signProxyDate: '',
  116. agentSignB: '',
  117. agentSignC: '',
  118. agentDate: '',
  119. feeSignA: '',
  120. feeSignC: '',
  121. facilitySignA: '',
  122. facilitySignC: '',
  123. facilityDate: '',
  124. facilityFee: '',
  125. facilityStartDateText: '',
  126. facilityEndDateText: '',
  127. facilityRefundRule: ''
  128. })
  129. const open = async (row = {}) => {
  130. currentRow.value = row
  131. drawerVisible.value = true
  132. loading.value = true
  133. try {
  134. const res = await getCheckInRecordId(row.id, row.status)
  135. if (res) {
  136. contractForm.elderName = res.elderlyContractDO?.elderName || res.elderName || ''
  137. contractForm.elderIdCard = res.elderlyContractDO?.idCard || res.idCard || ''
  138. contractForm.elderGender = res.elderlyContractDO?.gender || res.gender || ''
  139. if (contractForm.elderGender === 1 || contractForm.elderGender === '1' || contractForm.elderGender === '男') {
  140. contractForm.elderGenderText = '男'
  141. } else if (contractForm.elderGender === 2 || contractForm.elderGender === '2' || contractForm.elderGender === '女') {
  142. contractForm.elderGenderText = '女'
  143. } else {
  144. contractForm.elderGenderText = contractForm.elderGender || ''
  145. }
  146. contractForm.elderBirth = res.elderlyContractDO?.birthDate || res.birthDate || ''
  147. contractForm.elderPhone = res.elderlyContractDO?.phone || res.phone || ''
  148. contractForm.elderHomeAddr = res.elderlyContractDO?.homeAddress || res.homeAddress || ''
  149. contractForm.elderAddress = res.elderlyContractDO?.address || res.address || ''
  150. contractForm.nurseLevelName = res.nurseLevelName || res.elderlyContractDO?.nurseLevelName || ''
  151. contractForm.contractNumber = res.elderlyContractDO?.contractNumber || ''
  152. contractForm.startDate = res.checkInTime || res.elderlyContractDO?.beginTime || ''
  153. contractForm.endDate = res.checkInDeadlineTime || res.elderlyContractDO?.expireTime || ''
  154. contractForm.roomNumber = res.roomNumber || res.elderlyContractDO?.roomNumber || ''
  155. contractForm.medicalHistory = res.medicalHistory || ''
  156. contractForm.allergyHistory = res.allergyHistory || ''
  157. contractForm.eatingHabit = res.eatingHabit || ''
  158. contractForm.sleepHabit = res.sleepHabit || ''
  159. contractForm.hobby = res.hobby || ''
  160. contractForm.contractMonths = res.elderlyContractDO?.contractMonths || ''
  161. contractForm.elderNation = res.elderlyContractDO?.nation || ''
  162. contractForm.elderEducation = res.elderlyContractDO?.education || ''
  163. contractForm.elderMarital = res.elderlyContractDO?.maritalStatus || ''
  164. contractForm.elderInsurance = res.elderlyContractDO?.insurance || ''
  165. const monthly = res.monthlyExpenses || []
  166. const findAmt = (list, name) => {
  167. const item = list.find(i => (i.itemCategoryName || '').includes(name)
  168. return item ? item.actualAmount : ''
  169. }
  170. contractForm.bedFee = findAmt(monthly, '床位') || ''
  171. contractForm.nurseFee = findAmt(monthly, '护理') || ''
  172. contractForm.mealFee = findAmt(monthly, '膳食') || ''
  173. contractForm.manageFee = findAmt(monthly, '管理') || ''
  174. const relative = (res.relativesList && res.relativesList[0]) || {}
  175. contractForm.partyCName = relative.name || ''
  176. contractForm.partyCIdCard = relative.idCard || ''
  177. contractForm.partyCRelation = relative.relation || ''
  178. contractForm.partyCPhone = relative.phone || ''
  179. contractForm.partyCAddress = relative.address || ''
  180. }
  181. } catch (err) {
  182. console.error('加载合同数据失败:', err)
  183. } finally {
  184. loading.value = false
  185. }
  186. }
  187. const handleClose = () => {
  188. drawerVisible.value = false
  189. }
  190. const handleSubmit = () => {
  191. ElMessage.success('合同信息已保存')
  192. drawerVisible.value = false
  193. }
  194. const handlePrint = () => {
  195. isPrint.value = true
  196. setTimeout(() => {
  197. window.print()
  198. isPrint.value = false
  199. }, 300)
  200. }
  201. defineExpose({
  202. open
  203. })
  204. </script>
  205. <style lang="scss" scoped>
  206. .contract-container {
  207. width: 100%;
  208. padding: 0;
  209. background: #f5f5f5;
  210. }
  211. .a4-page {
  212. width: 210mm;
  213. min-height: 297mm;
  214. margin: 10mm auto;
  215. padding: 15mm 20mm;
  216. background: #fff;
  217. box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
  218. position: relative;
  219. box-sizing: border-box;
  220. page-break-after: always;
  221. }
  222. .a4-page:last-child {
  223. page-break-after: auto;
  224. }
  225. .page-header {
  226. position: absolute;
  227. top: 5mm;
  228. right: 10mm;
  229. font-size: 12px;
  230. color: #999;
  231. }
  232. .page-no {
  233. display: inline-block;
  234. padding: 2px 8px;
  235. background: #f0f0f0;
  236. border-radius: 4px;
  237. }
  238. .page-content {
  239. width: 100%;
  240. }
  241. .doc-title {
  242. font-size: 22px;
  243. font-weight: bold;
  244. margin-bottom: 20px;
  245. color: #333;
  246. }
  247. .section-title {
  248. font-size: 18px;
  249. font-weight: bold;
  250. margin: 20px 0 10px;
  251. color: #333;
  252. }
  253. .subsection-title {
  254. font-size: 15px;
  255. font-weight: bold;
  256. margin: 15px 0 8px;
  257. color: #333;
  258. }
  259. .content-text {
  260. font-size: 14px;
  261. line-height: 1.9;
  262. text-indent: 2em;
  263. color: #333;
  264. margin-bottom: 4px;
  265. }
  266. .fill {
  267. display: inline-block;
  268. min-width: 80px;
  269. border-bottom: 1px solid #333;
  270. padding: 0 4px;
  271. text-indent: 0;
  272. font-weight: 500;
  273. }
  274. .cover-fields {
  275. margin-bottom: 30px;
  276. }
  277. .cover-fields p {
  278. font-size: 15px;
  279. line-height: 2;
  280. }
  281. .label {
  282. display: inline-block;
  283. min-width: 100px;
  284. }
  285. .info-table {
  286. width: 100%;
  287. border-collapse: collapse;
  288. margin: 10px 0;
  289. font-size: 13px;
  290. }
  291. .info-table th,
  292. .info-table td {
  293. border: 1px solid #ddd;
  294. padding: 8px 10px;
  295. text-align: left;
  296. }
  297. .info-table th {
  298. background: #f9f9f9;
  299. font-weight: bold;
  300. width: 100px;
  301. text-align: center;
  302. }
  303. .sign-block {
  304. margin-top: 15px;
  305. }
  306. .sign-line {
  307. font-size: 14px;
  308. line-height: 1.8;
  309. margin: 8px 0;
  310. }
  311. .sign-page .sign-block {
  312. margin-top: 25px;
  313. }
  314. </style>
  315. <style>
  316. @media print {
  317. .el-drawer,
  318. .el-drawer__header,
  319. .el-drawer__body {
  320. overflow: visible !important;
  321. }
  322. .el-drawer {
  323. position: absolute !important;
  324. left: 0 !important;
  325. top: 0 !important;
  326. width: 100% !important;
  327. height: auto !important;
  328. box-shadow: none !important;
  329. }
  330. .el-drawer__header {
  331. display: none !important;
  332. }
  333. .contract-container {
  334. background: #fff !important;
  335. }
  336. .a4-page {
  337. display: block !important;
  338. margin: 0 !important;
  339. box-shadow: none !important;
  340. width: 210mm !important;
  341. min-height: 297mm !important;
  342. page-break-after: always;
  343. }
  344. .a4-page:last-child {
  345. page-break-after: auto;
  346. }
  347. @page {
  348. size: A4;
  349. margin: 0;
  350. }
  351. body {
  352. background: #fff !important;
  353. margin: 0 !important;
  354. padding: 0 !important;
  355. }
  356. }
  357. </style>
  358. ''')
  359. print('Script and Style sections appended successfully')