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,20 +655,20 @@ 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);
textArea.select();
document.execCommand('copy');
textArea.remove();
}
}
},
getShow() {
this.init()
@ -735,7 +739,7 @@ export default {
let item = { 'proid': element['pid'], 'prolistid': element['plid'] }
this.getGongXu(item, k)
}
this.searchList = data.data.searchExt
let order_id = data.data.searchExt['order_id']
this.orderType = data.data.searchExt['order_type_id']
@ -785,9 +789,9 @@ export default {
})
return false
}
//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,14 +979,14 @@ export default {
'rowspan': tdListItem.rowspan,
'value': []
}
if(tdListItem.slashTypes != undefined) {
if (tdListItem.slashTypes != undefined) {
item.slashTypes = tdListItem.slashTypes
}
if (tdListItem.value.length == 0) {
tempTdList.push(item)
continue
}
let tempItem = this.handlerTdListItem(tdListItem, order)
/* let tdValue = tdListItem.value[0].value
let newValue = this.getFieldValue(tdValue, order)
@ -1004,8 +1010,8 @@ 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()
}
res.push(configItem)
@ -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++) {
@ -1090,7 +1096,7 @@ export default {
if (this.instance != null) {
this.instance.destroy()
}
this.instance = new Editor(
document.querySelector('.editor'),
showData,
@ -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: '图片类型',
@ -1139,13 +1145,13 @@ export default {
_this.gageImage()
}
})
},
gageImage() {
const imageFileDom = document.querySelector('#image')
imageFileDom.click()
},
selectImage(event) {
event.stopPropagation()
let _this = this
@ -1170,7 +1176,7 @@ export default {
}
}
},
executeInsertElementList() {
this.instance.command.executeInsertElementList([
{