| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import re
- path = r'd:\Users\chenjun\kyj-yanglao-web-new\src\views\elderly\apply\check-in\ContractForm.vue'
- with open(path, 'r', encoding='utf-8') as f:
- content = f.read()
- # 检查 <template> 标签匹配
- template_open = content.count('<template>') + content.count('<template ')
- template_close = content.count('</template>')
- print(f"<template> open: {template_open}, close: {template_close}")
- # 检查 <div> 标签匹配
- div_open = len(re.findall(r'<div\b', content))
- div_close = content.count('</div>')
- print(f"<div> open: {div_open}, close: {div_close}")
- # 检查 <el-drawer> 标签匹配
- drawer_open = len(re.findall(r'<el-drawer\b', content))
- drawer_close = content.count('</el-drawer>')
- print(f"<el-drawer> open: {drawer_open}, close: {drawer_close}")
- # 检查 <script> 标签
- script_open = content.count('<script')
- script_close = content.count('</script>')
- print(f"<script> open: {script_open}, close: {script_close}")
- # 检查 <style> 标签
- style_open = content.count('<style')
- style_close = content.count('</style>')
- print(f"<style> open: {style_open}, close: {style_close}")
- # 检查有没有剩余的 {{ contractForm.xxx || '' }} 模式(没有被isTextMode包裹的)
- # 应该只有在template条件下的,其他应该都被包裹
- remaining_raw = []
- for m in re.finditer(r'([^>])\{{2}\s*contractForm\.(\w+)\s*\|\|\s*', content):
- pos = m.start()
- line = content[:pos].count('\n') + 1
- remaining_raw.append((line, m.group(0)[:50]))
- print(f"\nRaw || patterns not wrapped (should be minimal): {len(remaining_raw)}")
- for line, snippet in remaining_raw[:10]:
- print(f" Line {line}: ...{snippet}...")
- # 检查附件是否还存在(关键词:附件1到附件9)
- attachments_found = []
- for m in re.finditer(r'附件[一二三四五六七八九十]', content):
- pos = m.start()
- line = content[:pos].count('\n') + 1
- snippet = content[max(0, pos-20):pos+30]
- attachments_found.append((line, snippet))
- print(f"\n附件 references found: {len(attachments_found)}")
- for line, snippet in attachments_found:
- print(f" Line {line}: {snippet.strip()}")
- print("\n=== Summary ===")
- print("File looks OK!" if (template_close > 0 and drawer_open == drawer_close and script_open == script_close and style_open == style_close) else "File has structural issues!")
|