|
@@ -350,6 +350,8 @@
|
350
|
350
|
inputmode="verbatim"
|
351
|
351
|
@keyup.native="changeText"
|
352
|
352
|
@paste.native.prevent="handlePaste"
|
|
353
|
+ @compositionstart="handleCompositionStart"
|
|
354
|
+ @compositionend="handleCompositionEnd"
|
353
|
355
|
type="textarea"
|
354
|
356
|
placeholder="请输入内容"
|
355
|
357
|
v-model="textarea"
|
|
@@ -548,23 +550,24 @@
|
548
|
550
|
showDuplicateAlert:false,
|
549
|
551
|
showDuplicateAlertOne:false,
|
550
|
552
|
good_id:0,
|
551
|
|
- isComposing: false
|
|
553
|
+ isComposing: false,
|
|
554
|
+ msg:"",
|
|
555
|
+ isChineseIME: false
|
552
|
556
|
}
|
553
|
557
|
},
|
554
|
558
|
methods: {
|
555
|
559
|
|
556
|
|
- handleKeyDown(e) {
|
557
|
|
-
|
|
560
|
+ handleCompositionStart() {
|
|
561
|
+ this.isChineseIME = true
|
558
|
562
|
},
|
559
|
|
-
|
560
|
|
- handlePaste(e) {
|
561
|
|
- e.preventDefault(); // 完全禁止粘贴,避免绕过输入限制
|
562
|
|
- this.$message.warning('扫码输入不支持粘贴');
|
|
563
|
+ handleCompositionEnd() {
|
|
564
|
+ this.isChineseIME = false
|
563
|
565
|
},
|
|
566
|
+
|
|
567
|
+
|
564
|
568
|
getTotal(){
|
565
|
569
|
if(this.textarea!=null){
|
566
|
570
|
var textAreaList = this.textarea.split(",")
|
567
|
|
- console.log("textArrleti",textAreaList)
|
568
|
571
|
var arr = []
|
569
|
572
|
if(textAreaList!=null && textAreaList.length>0){
|
570
|
573
|
for(let i=0;i<textAreaList.length;i++){
|
|
@@ -1174,6 +1177,32 @@
|
1174
|
1177
|
},
|
1175
|
1178
|
changeText(event){
|
1176
|
1179
|
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+ // if (this.isChineseIME == false) {
|
|
1183
|
+ // console.log("因为======英文",)
|
|
1184
|
+ // }
|
|
1185
|
+
|
|
1186
|
+ // if (this.isChineseIME == true) {
|
|
1187
|
+ // console.log("因为======中文")
|
|
1188
|
+ // }
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+ // var str = this.toHalfWidth(this.textarea)
|
|
1192
|
+
|
|
1193
|
+ // console.log("str===============",this.convertToHalfWidth(str))
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+ // var newArr = []
|
|
1197
|
+
|
|
1198
|
+ // newArr.push(this.convertToHalfWidth(str).replace(/\s+/g, ""))
|
|
1199
|
+
|
|
1200
|
+ // console.log("newArr------",newArr)
|
|
1201
|
+
|
|
1202
|
+ // var normalizedSpace = this.fullWidthToHalfWidth(this.textarea);
|
|
1203
|
+ // console.log("halfWidthStr",normalizedSpace);
|
|
1204
|
+
|
|
1205
|
+ // this.textarea = normalizedSpace
|
1177
|
1206
|
// 1. 转换为半角字符(英文输入法标准)
|
1178
|
1207
|
const halfWidth = this.textarea.replace(/[\uff01-\uff5e]/g, ch =>
|
1179
|
1208
|
String.fromCharCode(ch.charCodeAt(0) - 0xfee0)
|
|
@@ -1182,40 +1211,12 @@
|
1182
|
1211
|
// 2. 移除中文空格(全角空格转半角)
|
1183
|
1212
|
const normalizedSpace = halfWidth.replace(/\u3000/g, ' ');
|
1184
|
1213
|
|
1185
|
|
-
|
1186
|
|
- // const fullToHalfMap = {
|
1187
|
|
- // '(': '(', ')': ')',
|
1188
|
|
- // '0': '0', '1': '1', '2': '2', '3': '3', '4': '4',
|
1189
|
|
- // '5': '5', '6': '6', '7': '7', '8': '8', '9': '9',
|
1190
|
|
- // 'A': 'A', 'B': 'B', 'C': 'C', 'D': 'D', 'E': 'E',
|
1191
|
|
- // 'F': 'F', 'G': 'G', 'H': 'H', 'I': 'I', 'J': 'J',
|
1192
|
|
- // 'K': 'K', 'L': 'L', 'M': 'M', 'N': 'N', 'O': 'O',
|
1193
|
|
- // 'P': 'P', 'Q': 'Q', 'R': 'R', 'S': 'S', 'T': 'T',
|
1194
|
|
- // 'U': 'U', 'V': 'V', 'W': 'W', 'X': 'X', 'Y': 'Y',
|
1195
|
|
- // 'Z': 'Z', 'a': 'a', 'b': 'b', 'c': 'c', 'd': 'd',
|
1196
|
|
- // 'e': 'e', 'f': 'f', 'g': 'g', 'h': 'h', 'i': 'i',
|
1197
|
|
- // 'j': 'j', 'k': 'k', 'l': 'l', 'm': 'm', 'n': 'n',
|
1198
|
|
- // 'o': 'o', 'p': 'p', 'q': 'q', 'r': 'r', 's': 's',
|
1199
|
|
- // 't': 't', 'u': 'u', 'v': 'v', 'w': 'w', 'x': 'x',
|
1200
|
|
- // 'y': 'y', 'z': 'z'
|
1201
|
|
- // };
|
1202
|
|
-
|
1203
|
|
- // // 2. 执行转换
|
1204
|
|
- // let result = '';
|
1205
|
|
- // for (const char of this.textarea) {
|
1206
|
|
- // result += fullToHalfMap[char] || char;
|
1207
|
|
- // }
|
1208
|
|
-
|
1209
|
|
- // // 3. 提取标准格式数据
|
1210
|
|
- // const normalizedSpace = result.match(/(\(\d{2}\)[\dA-Za-z]+)+/g);
|
1211
|
|
-
|
1212
|
|
- // console.log("normalizedSpace---",normalizedSpace[0])
|
1213
|
|
-
|
1214
|
|
-
|
1215
|
1214
|
var textAreaList = normalizedSpace.split(",")
|
|
1215
|
+
|
|
1216
|
+ console.log("textarealist====",textAreaList)
|
1216
|
1217
|
if (event.key === 'Enter') {
|
1217
|
1218
|
var textarea = ""
|
1218
|
|
- textarea += normalizedSpace.replace(/^\s*[\r\n]|\r?\n\s*$/gm, '') + ","
|
|
1219
|
+ textarea += normalizedSpace + ","
|
1219
|
1220
|
var parts = textarea.split(',')
|
1220
|
1221
|
for(let i=0;i<textAreaList.length;i++){
|
1221
|
1222
|
if(parts[parts.length-2] == textAreaList[i]){
|
|
@@ -1250,11 +1251,11 @@
|
1250
|
1251
|
return
|
1251
|
1252
|
}
|
1252
|
1253
|
|
1253
|
|
- // if(this.org_id == 10164 || this.org_id == 0){
|
|
1254
|
+ if(this.org_id == 10164 || this.org_id == 0){
|
1254
|
1255
|
|
1255
|
|
- // this.getRepatGood(this.textarea)
|
1256
|
|
- // this.showDuplicateAlertOne = true
|
1257
|
|
- // }
|
|
1256
|
+ this.getRepatGood(this.textarea)
|
|
1257
|
+ this.showDuplicateAlertOne = true
|
|
1258
|
+ }
|
1258
|
1259
|
|
1259
|
1260
|
this.dialogVisible = false
|
1260
|
1261
|
},
|
|
@@ -1307,13 +1308,44 @@
|
1307
|
1308
|
var msg = response.data.data.msg
|
1308
|
1309
|
}else{
|
1309
|
1310
|
var msg = response.data.msg
|
|
1311
|
+ console.log("msg-------------------",msg)
|
1310
|
1312
|
this.msg = msg
|
1311
|
1313
|
this.$message.error(msg)
|
1312
|
1314
|
}
|
1313
|
1315
|
})
|
|
1316
|
+ },
|
|
1317
|
+
|
|
1318
|
+ toHalfWidth(str) {
|
|
1319
|
+ return str.replace(/[0-9]/g, function(c) { // 转换数字
|
|
1320
|
+ return String.fromCharCode(c.charCodeAt(0) - 0xfee0);
|
|
1321
|
+ }).replace(/[A-zA-Z]/g, function(c) { // 转换英文字母
|
|
1322
|
+ return String.fromCharCode(c.charCodeAt(0) - 0xfee0);
|
|
1323
|
+ });
|
|
1324
|
+ },
|
|
1325
|
+ convertToHalfWidth(str) {
|
|
1326
|
+ // 1. 替换所有全角括号为半角
|
|
1327
|
+ str = str.replace(/[()]/g, c => c === '(' ? '(' : ')');
|
|
1328
|
+
|
|
1329
|
+ // 2. 处理特殊格式转换
|
|
1330
|
+ str = str
|
|
1331
|
+ // 处理 (01) 开头的特殊情况
|
|
1332
|
+ .replace(/^\(11\)/, '(01)')
|
|
1333
|
+ .replace(/^\(01\)/, '(01)')
|
|
1334
|
+ // 处理 ()1) 转换为 (11)
|
|
1335
|
+ .replace(/\(\)1\)/g, '(11)')
|
|
1336
|
+ // 处理 ()7) 转换为 (17)
|
|
1337
|
+ .replace(/\(\)7\)/g, '(17)')
|
|
1338
|
+ // 处理 ()X) 的一般情况
|
|
1339
|
+ .replace(/\(\)(\d)\)/g, '(1$1)');
|
|
1340
|
+
|
|
1341
|
+ // 3. 移除末尾多余的括号和数字
|
|
1342
|
+ str = str.replace(/[)\d]+$/, '');
|
|
1343
|
+
|
|
1344
|
+ return str;
|
1314
|
1345
|
}
|
1315
|
|
- }
|
1316
|
|
- ,
|
|
1346
|
+
|
|
1347
|
+ },
|
|
1348
|
+
|
1317
|
1349
|
created() {
|
1318
|
1350
|
this.org_id = this.$store.getters.xt_user.org.id
|
1319
|
1351
|
var nowDate = new Date()
|