# -*- coding: utf-8 -*-
"""Fix Chinese text in WaybillDetail.vue."""
import os
OUT = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
"ruoyi-ui", "src", "views", "basic", "waybill", "components", "WaybillDetail.vue",
)
REPLACEMENTS = [
('??????', '\u8fd0\u5355\u7f16\u53f7'),
(' ?????', ' \u6e29\u5ea6\u5f02\u5e38'),
('???????{{ detail.createBy', '\u521b\u5efa\u4eba\uff1a{{ detail.createBy'),
('@click="contactDriver">??????', '@click="contactDriver">\u8054\u7cfb\u53f8\u673a'),
('@click="handleAlarm">???????', '@click="handleAlarm">\u5904\u7406\u544a\u8b66'),
('@click="confirmReceipt">??????', '@click="confirmReceipt">\u786e\u8ba4\u7b7e\u6536'),
(' ???????', ' \u57fa\u672c\u4fe1\u606f'),
('label="???????">{{ detail.senderCompany', 'label="\u53d1\u8d27\u4f01\u4e1a">{{ detail.senderCompany'),
('label="??????">{{ detail.receiverCompany', 'label="\u6536\u8d27\u4f01\u4e1a">{{ detail.receiverCompany'),
('label="???????" :span="2">{{ senderFullAddress', 'label="\u53d1\u8d27\u5730\u5740" :span="2">{{ senderFullAddress'),
('label="??????" :span="2">{{ receiverFullAddress', 'label="\u6536\u8d27\u5730\u5740" :span="2">{{ receiverFullAddress'),
('label="???????">{{ formatDateTime(detail.planDepartTime)', 'label="\u53d1\u8d27\u65f6\u95f4">{{ formatDateTime(detail.planDepartTime)'),
('label="??????">{{ formatDateTime(detail.planArriveTime)', 'label="\u9884\u8ba1\u5230\u8fbe">{{ formatDateTime(detail.planArriveTime)'),
('label="????????">', 'label="\u5173\u8054\u8f66\u8f86">'),
('label="????">{{ detail.driverName', 'label="\u9a7e\u9a76\u5458">{{ detail.driverName'),
('label="??????">{{ tempRequireText', 'label="\u6e29\u5ea6\u8981\u6c42">{{ tempRequireText'),
('label="????????">{{ routeText', 'label="\u8fd0\u8f93\u7ebf\u8def">{{ routeText'),
(' ???????', ' \u8d27\u7269\u660e\u7ec6'),
('label="????????" prop="cargoName"', 'label="\u8d27\u7269\u540d\u79f0" prop="cargoName"'),
('label="???" prop="specModel"', 'label="\u89c4\u683c" prop="specModel"'),
('label="????" prop="quantity"', 'label="\u6570\u91cf" prop="quantity"'),
('label="????" prop="weightKg"', 'label="\u91cd\u91cf" prop="weightKg"'),
('label="???" prop="cargoValue"', 'label="\u8d27\u503c" prop="cargoValue"'),
('>?{{ formatMoney', '>\u00a5{{ formatMoney'),
(' ???????', ' \u6e29\u5ea6\u66f2\u7ebf'),
(' ?????????', ' \u8fd0\u8f93\u5b9e\u65f6\u52a8\u6001'),
('???????', '\u5f53\u524d\u4f4d\u7f6e', 1),
('??????', '\u5f53\u524d\u6e29\u5ea6', 1),
('{{ tracking.currentTemp }}??C', '{{ tracking.currentTemp }}\u00b0C'),
('effect="plain">????', 'effect="plain">\u8d85\u9650'),
('???????', '\u5f53\u524d\u8f66\u901f'),
('??????', '\u9884\u8ba1\u5230\u8fbe'),
('(???{{ tracking.remainTime }})', '(\u5269\u4f59{{ tracking.remainTime }})'),
('????? / ??????', '\u5df2\u884c\u9a76 / \u5269\u4f59\u91cc\u7a0b'),
(' ???', ' \u6e29\u5ea6'),
('??????
', '\u5f53\u524d\u6e29\u5ea6
', 1),
('{{ tempStats.current }}??C', '{{ tempStats.current }}\u00b0C'),
('{{ tempStats.max }}??C', '{{ tempStats.max }}\u00b0C'),
('{{ tempStats.min }}??C', '{{ tempStats.min }}\u00b0C'),
('{{ tempStats.avg }}??C', '{{ tempStats.avg }}\u00b0C'),
("'?????????????? ' + tempStats.alarmCount + '????'", "'\u672c\u6b21\u8fd0\u8f93\u544a\u8b66\u6b21\u6570 ' + tempStats.alarmCount + '\u6b21\u544a\u8b66'"),
(' ???????', ' \u9644\u4ef6\u6587\u6863'),
('@click="previewFile(file)">???', '@click="previewFile(file)">\u9884\u89c8'),
('@click="downloadFile(file)">????', '@click="downloadFile(file)">\u4e0b\u8f7d'),
('class="empty-attach">???????', 'class="empty-attach">\u6682\u65e0\u9644\u4ef6'),
('return d.tempMin + "??C ~ " + d.tempMax + "??C"', 'return d.tempMin + "\u00b0C ~ " + d.tempMax + "\u00b0C"'),
('return "?? " + d.tempMax + "??C"', 'return "\u2264 " + d.tempMax + "\u00b0C"'),
('return "?? " + d.tempMin + "??C"', 'return "\u2265 " + d.tempMin + "\u00b0C"'),
('return from + " ?? " + to + "??" + d.lineName + "??"', 'return from + " \u2192 " + to + "\uff08" + d.lineName + "\uff09"'),
('return from && to ? from + " ?? " + to : "-"', 'return from && to ? from + " \u2192 " + to : "-"'),
('const t4 = "???" + this.formatTimeShort', 'const t4 = "\u9884\u8ba1" + this.formatTimeShort'),
('{ title: "????", desc: t0', '{ title: "\u5355\u636e", desc: t0'),
('{ title: "?????", desc: t1', '{ title: "\u5df2\u786e\u8ba4", desc: t1'),
('{ title: "?????", desc: t2', '{ title: "\u88c5\u8f66\u4e2d", desc: t2'),
('{ title: "???", desc: t3', '{ title: "\u5728\u9014", desc: t3'),
('{ title: "?????", desc: t4', '{ title: "\u5df2\u5230\u8fbe", desc: t4'),
('{ title: "?????", desc: this.formatTimeShort(d.planSignTime)', '{ title: "\u5df2\u7b7e\u6536", desc: this.formatTimeShort(d.planSignTime)'),
('{ title: "????", desc: "", icon: "el-icon-lock"', '{ title: "\u5df2\u5173\u95ed", desc: "", icon: "el-icon-lock"'),
('{ name: no + "_?????.pdf"', '{ name: no + "_\u53d1\u8fd0\u5355.pdf"'),
('{ name: no + "_????.pdf"', '{ name: no + "_\u7b7e\u6536\u5355.pdf"'),
('{ name: no + "_?????.pdf", time: base }', '{ name: no + "_\u6e29\u5ea6\u8bb0\u5f55.pdf", time: base }'),
('statusText: "???"', 'statusText: "\u8349\u7a3f"'),
('statusText: "?????"', 'statusText: "\u5f85\u5ba1\u6838"', 1),
('statusText: "?????"', 'statusText: "\u5df2\u786e\u8ba4"'),
('statusText: "???"', 'statusText: "\u5728\u9014"'),
('statusText: "?????"', 'statusText: "\u5df2\u5230\u8fbe"'),
('statusText: "?????"', 'statusText: "\u5df2\u901a\u8fc7"'),
('const fromCity = d.senderCity || "???"', 'const fromCity = d.senderCity || "\u8d77\u70b9"'),
('"??????????? 107????"', '"\u4e1c\u839e\u5e02\u864e\u95e8\u9547 107\u56fd\u9053"'),
('name: "??C"', 'name: "\u00b0C"'),
('formatter: "???? " + max + "??C"', 'formatter: "\u4e0a\u9650 " + max + "\u00b0C"'),
('formatter: "???? " + min + "??C"', 'formatter: "\u4e0b\u9650 " + min + "\u00b0C"'),
('sums[index] = "???"', 'sums[index] = "\u5408\u8ba1"'),
('sums[index] = "?" + data.reduce', 'sums[index] = "\u00a5" + data.reduce'),
('msgSuccess("\u8054\u7cfb\u53f8\u673a"', 'msgSuccess("\u53f8\u673a\u7535\u8bdd\uff1a"'),
('msgSuccess("????????" + phone)', 'msgSuccess("\u53f8\u673a\u7535\u8bdd\uff1a" + phone'),
('msgWarning("?????????????")', 'msgWarning("\u6682\u65e0\u53f8\u673a\u8054\u7cfb\u7535\u8bdd")'),
('msgSuccess("??????????????????")', 'msgSuccess("\u544a\u8b66\u5df2\u8bb0\u5f55\uff0c\u8bf7\u8ddf\u8fdb\u5904\u7406")'),
('confirm("??????????????")', 'confirm("\u786e\u8ba4\u8be5\u8fd0\u5355\u5df2\u7b7e\u6536\u5417\uff1f")'),
('msgSuccess("??????????")', 'msgSuccess("\u7b7e\u6536\u786e\u8ba4\u5df2\u63d0\u4ea4")'),
('msgInfo("?????" + file.name)', 'msgInfo("\u9884\u89c8\uff1a" + file.name)'),
('msgInfo("?????" + file.name)', 'msgInfo("\u4e0b\u8f7d\uff1a" + file.name)'),
]
# temp-card labels need second pass with unique context
TEMP_LABELS = [
('temp-card max">\n ??????
', 'temp-card max">\n \u6700\u9ad8\u6e29\u5ea6
'),
('temp-card min">\n ??????
', 'temp-card min">\n \u6700\u4f4e\u6e29\u5ea6
'),
('temp-card avg">\n ??????
', 'temp-card avg">\n \u5e73\u5747\u6e29\u5ea6
'),
]
def main():
text = open(OUT, encoding="utf-8").read()
for item in REPLACEMENTS:
old, new = item[0], item[1]
count = item[2] if len(item) > 2 else None
if count == 1:
text = text.replace(old, new, 1)
else:
text = text.replace(old, new)
for old, new in TEMP_LABELS:
text = text.replace(old, new)
# fix duplicate stat-label replacements - re-read and fix remaining
text = text.replace(
'\u5f53\u524d\u6e29\u5ea6\n {{ tracking.speed }}',
'\u5f53\u524d\u8f66\u901f\n {{ tracking.speed }}'
)
open(OUT, "w", encoding="utf-8", newline="\n").write(text)
t = open(OUT, encoding="utf-8").read()
assert "\u8fd0\u5355\u7f16\u53f7" in t and "\u5728\u9014" in t
print("fixed", OUT)
if __name__ == "__main__":
main()