update code

This commit is contained in:
lq 2024-07-20 09:33:57 +08:00
parent dce43668b3
commit 9dc291fa60

View File

@ -511,7 +511,7 @@ import JsBarcode from 'jsbarcode'
export default {
data() {
return {
count:'',
count: '',
fieldArr: [],
confShow: false,
tableCol: 4,
@ -539,7 +539,7 @@ export default {
modeIndex: 0,
imageType: '',
id: 0,
code:'',
code: '',
flag: false,
options: {
margins: [100, 120, 100, 120],
@ -610,15 +610,19 @@ export default {
})
.catch(error => console.error(error))
},
createBarCode(){//
createBarCode() {//
const svgElement = document.createElement('svg')
//
let content = '1234567788'
let options = JsBarcode.Options
let options = {
'lineColor': 'red'
}//JsBarcode.Options
console.log(options)
options['lineColor'] = 'red'
JsBarcode(svgElement, content, options)
let base64Image = this.convertSvgElementToBase64(svgElement)
console.log('条形码: ',base64Image)
console.log('条形码: ', base64Image)
},
handleGeneratebak(idName, name) {//
@ -642,7 +646,7 @@ export default {
let hints = new Map()
hints.set(EncodeHintType.MARGIN, 0)
const svgElement = codeWriter.write(content, 200, 200, hints)
svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')
svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg')
return this.convertSvgElementToBase64(svgElement)
},
convertSvgElementToBase64(svgElement) {
@ -651,13 +655,13 @@ export default {
)}`
},
copy(value) {
if(navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(value).then(function() {
if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(value).then(function () {
console.log('复制成功');
}).catch(function(error) {
}).catch(function (error) {
console.error('复制失败', error);
})
}else{
} else {
const textArea = document.createElement('textarea');
textArea.value = value;
document.body.appendChild(textArea);
@ -787,7 +791,7 @@ export default {
}
//localStorage.setItem('word_data', JSON.stringify(ccc.data))
return false
//return false
let saveData = { 'id': this.id, 'type': this.orderType, 'field_style': ccc.data }
let api = '/api/Administrator/OrderFieldStyle/save'
axios.post(api, saveData).then((res) => {
@ -914,8 +918,10 @@ export default {
if (tdListItem.value.length == 0) {
continue
}
let tdValue = tdListItem.value[0].value
tdListItem.value[0].value = this.getFieldValue(tdValue, order)
for (let j = 0; j < tdListItem.value.length; j++) {
let tdValue = tdListItem.value[j].value
tdListItem.value[j].value = this.getFieldValue(tdValue, order)
}
}
return trList
},
@ -973,7 +979,7 @@ export default {
'rowspan': tdListItem.rowspan,
'value': []
}
if(tdListItem.slashTypes != undefined) {
if (tdListItem.slashTypes != undefined) {
item.slashTypes = tdListItem.slashTypes
}
if (tdListItem.value.length == 0) {
@ -1004,7 +1010,7 @@ export default {
res.push(temTrList)
} else if (configItem.hasOwnProperty('type') && configItem['type'] == 'image') {
//console.log(configItem)
if(configItem.hasOwnProperty('field') && configItem['field'] == 'code') {
if (configItem.hasOwnProperty('field') && configItem['field'] == 'code') {
configItem.value = this.handleGenerate()
}
@ -1020,7 +1026,7 @@ export default {
//console.log('res',res)
return res
},
handlerTdListItem(tdItem, order){
handlerTdListItem(tdItem, order) {
let list = JSON.stringify(tdItem)
list = JSON.parse(list)
for (let i = 0; i < list['value'].length; i++) {
@ -1105,7 +1111,7 @@ export default {
getSelectImage() {
//const imageFileDom = document.querySelector('#image')
//imageFileDom.click()
if(this.flag == true) return
if (this.flag == true) return
let _this = this
new Dialog({
title: '图片类型',