TC 수정 반영

This commit is contained in:
kimre
2022-07-18 01:06:10 +09:00
parent e8328fef2c
commit 2bfa07c17f
30 changed files with 2446 additions and 2066 deletions

View File

@@ -14,8 +14,8 @@
<tr>
<th>차단문구</th>
<td class="input_add">
<input v-model="word" ref="_word" maxlength="50">
<button type="button" class="button white add" @click="doAdd"></button>
<input v-model="word" ref="_word" maxlength="10" @input="msgLimitByte()">
<button type="button" class="button white add" @click="doAdd" ></button>
</td>
</tr>
<tr>
@@ -53,7 +53,8 @@
</tr>
<tr>
<th>메모</th>
<td class="sender"><textarea class="memo_text" v-model.trim="memo" ref="memo"></textarea></td>
<td class="sender"><textarea class="memo_text" v-model.trim="memo" ref="memo" maxlength="2000"
@input="memoLimitByte()"></textarea></td>
</tr>
</tbody>
@@ -82,15 +83,9 @@ export default {
return {
row: {},
// msgBlckword: {
// word:'',
// },
msgBlckwordList: [
// { word : '스팸'},
],
msgBlckwordList: [],
rsnType: [],
tpType: [],
// seqNo: '', // 일련번호
word: '', // 차단문구
blckSndrno: '',
sndblckTpCd: '',
@@ -101,6 +96,7 @@ export default {
regId: '',
regDt: '',
memo: '', // 메모
maxByte: 2000,
}
},
@@ -139,9 +135,15 @@ export default {
},
async doInsert() {
// if(this.doValidate() && window.confirm('등록 하시겠습니까?')){
this.row.blckRsnCd = this.blckRsnCd;
this.row.blckContCd = this.blckContCd;
this.row.memo = this.memo;
this.row.blckYn = this.blckYn;
this.row.list = this.msgBlckwordList
console.log(this.row)
// return false;
try {
const response = await riskMgtApi.msgIntrcpList(this.row);
const response = await riskMgtApi.msgInsertIntrcp(this.row);
const result = response.data;
if (result != null && result.retCode == "0000") {
this.row.title = '메세지 차단';
@@ -165,14 +167,7 @@ export default {
this.$refs._word.focus();
return false;
}
this.row.blckRsnCd = this.blckRsnCd;
this.row.blckContCd = this.blckContCd;
this.row.memo = this.memo;
this.row.blckYn = this.blckYn;
this.row.list = this.msgBlckwordList
return true;
},
toComplete() {
@@ -210,8 +205,46 @@ export default {
if (this.doValidate()) {
this.$refs.ValidationConfirmPopup.msgConfirmInsertOpen();
}
}
},
// 바이트길이 구하기
getByteLength: function (decimal) {
return (decimal >> 7) || (this.LINE_FEED === decimal) ? 2 : 1
},
getByte: function (str) {
return str
.split('')
.map((s) => s.charCodeAt(0))
.reduce((prev, unicodeDecimalValue) => prev + this.getByteLength(unicodeDecimalValue), 0)
},
getLimitedByteText: function (inputText, maxByte) {
const characters = inputText.split('')
let validText = ''
let totalByte = 0
for (let i = 0; i < characters.length; i += 1) {
const character = characters[i]
const decimal = character.charCodeAt(0)
const byte = this.getByteLength(decimal) // 글자 한 개가 몇 바이트 길이인지 구해주기
// console.log(byte)
// 현재까지의 바이트 길이와 더해 최대 바이트 길이를 넘지 않으면
if (totalByte + byte <= maxByte) {
totalByte += byte // 바이트 길이 값을 더해 현재까지의 총 바이트 길이 값을 구함
validText += character // 글자를 더해 현재까지의 총 문자열 값을 구함
} else { // 최대 바이트 길이를 넘으면
break // for 루프 종료
}
}
return validText
},
memoLimitByte() {
this.memo = this.getLimitedByteText(this.memo, this.maxByte);
}, //END 바이트길이 구하기
msgLimitByte(){
this.word = this.getLimitedByteText(this.word, 10);
}
}