# -*- coding: utf-8 -*- """Rebuild WaybillDetail.vue with correct UTF-8 Chinese and component structure.""" import os OUT = os.path.join( os.path.dirname(os.path.dirname(__file__)), "ruoyi-ui", "src", "views", "basic", "waybill", "components", "WaybillDetail.vue", ) # Template + style: decode unicode_escape TPL = r""" """.strip() SCRIPT = r""" """.strip() STYLE = r""" """ def main(): content = ( TPL.encode("utf-8").decode("unicode_escape") + "\n\n" + SCRIPT.encode("utf-8").decode("unicode_escape") + "\n\n" + STYLE ) os.makedirs(os.path.dirname(OUT), exist_ok=True) with open(OUT, "w", encoding="utf-8", newline="\n") as f: f.write(content) t = open(OUT, encoding="utf-8").read() assert "\u8fd0\u5355\u7f16\u53f7" in t and "methods:" in t and "computed:" in t print("rebuilt", OUT, len(content)) if __name__ == "__main__": main()