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 { export default {
data() { data() {
return { return {
count:'', count: '',
fieldArr: [], fieldArr: [],
confShow: false, confShow: false,
tableCol: 4, tableCol: 4,
@ -539,7 +539,7 @@ export default {
modeIndex: 0, modeIndex: 0,
imageType: '', imageType: '',
id: 0, id: 0,
code:'', code: '',
flag: false, flag: false,
options: { options: {
margins: [100, 120, 100, 120], margins: [100, 120, 100, 120],
@ -610,15 +610,19 @@ export default {
}) })
.catch(error => console.error(error)) .catch(error => console.error(error))
}, },
createBarCode(){// createBarCode() {//
const svgElement = document.createElement('svg') const svgElement = document.createElement('svg')
// //
let content = '1234567788' let content = '1234567788'
let options = JsBarcode.Options let options = {
'lineColor': 'red'
}//JsBarcode.Options
console.log(options)
options['lineColor'] = 'red'
JsBarcode(svgElement, content, options) JsBarcode(svgElement, content, options)
let base64Image = this.convertSvgElementToBase64(svgElement) let base64Image = this.convertSvgElementToBase64(svgElement)
console.log('条形码: ',base64Image) console.log('条形码: ', base64Image)
}, },
handleGeneratebak(idName, name) {// handleGeneratebak(idName, name) {//
@ -642,7 +646,7 @@ export default {
let hints = new Map() let hints = new Map()
hints.set(EncodeHintType.MARGIN, 0) hints.set(EncodeHintType.MARGIN, 0)
const svgElement = codeWriter.write(content, 200, 200, hints) 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) return this.convertSvgElementToBase64(svgElement)
}, },
convertSvgElementToBase64(svgElement) { convertSvgElementToBase64(svgElement) {
@ -651,20 +655,20 @@ export default {
)}` )}`
}, },
copy(value) { copy(value) {
if(navigator.clipboard && window.isSecureContext) { if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(value).then(function() { navigator.clipboard.writeText(value).then(function () {
console.log('复制成功'); console.log('复制成功');
}).catch(function(error) { }).catch(function (error) {
console.error('复制失败', error); console.error('复制失败', error);
}) })
}else{ } else {
const textArea = document.createElement('textarea'); const textArea = document.createElement('textarea');
textArea.value = value; textArea.value = value;
document.body.appendChild(textArea); document.body.appendChild(textArea);
textArea.select(); textArea.select();
document.execCommand('copy'); document.execCommand('copy');
textArea.remove(); textArea.remove();
} }
}, },
getShow() { getShow() {
this.init() this.init()
@ -735,7 +739,7 @@ export default {
let item = { 'proid': element['pid'], 'prolistid': element['plid'] } let item = { 'proid': element['pid'], 'prolistid': element['plid'] }
this.getGongXu(item, k) this.getGongXu(item, k)
} }
this.searchList = data.data.searchExt this.searchList = data.data.searchExt
let order_id = data.data.searchExt['order_id'] let order_id = data.data.searchExt['order_id']
this.orderType = data.data.searchExt['order_type_id'] this.orderType = data.data.searchExt['order_type_id']
@ -785,9 +789,9 @@ export default {
}) })
return false return false
} }
//localStorage.setItem('word_data', JSON.stringify(ccc.data)) //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 saveData = { 'id': this.id, 'type': this.orderType, 'field_style': ccc.data }
let api = '/api/Administrator/OrderFieldStyle/save' let api = '/api/Administrator/OrderFieldStyle/save'
axios.post(api, saveData).then((res) => { axios.post(api, saveData).then((res) => {
@ -914,8 +918,10 @@ export default {
if (tdListItem.value.length == 0) { if (tdListItem.value.length == 0) {
continue continue
} }
let tdValue = tdListItem.value[0].value for (let j = 0; j < tdListItem.value.length; j++) {
tdListItem.value[0].value = this.getFieldValue(tdValue, order) let tdValue = tdListItem.value[j].value
tdListItem.value[j].value = this.getFieldValue(tdValue, order)
}
} }
return trList return trList
}, },
@ -973,14 +979,14 @@ export default {
'rowspan': tdListItem.rowspan, 'rowspan': tdListItem.rowspan,
'value': [] 'value': []
} }
if(tdListItem.slashTypes != undefined) { if (tdListItem.slashTypes != undefined) {
item.slashTypes = tdListItem.slashTypes item.slashTypes = tdListItem.slashTypes
} }
if (tdListItem.value.length == 0) { if (tdListItem.value.length == 0) {
tempTdList.push(item) tempTdList.push(item)
continue continue
} }
let tempItem = this.handlerTdListItem(tdListItem, order) let tempItem = this.handlerTdListItem(tdListItem, order)
/* let tdValue = tdListItem.value[0].value /* let tdValue = tdListItem.value[0].value
let newValue = this.getFieldValue(tdValue, order) let newValue = this.getFieldValue(tdValue, order)
@ -1004,8 +1010,8 @@ export default {
res.push(temTrList) res.push(temTrList)
} else if (configItem.hasOwnProperty('type') && configItem['type'] == 'image') { } else if (configItem.hasOwnProperty('type') && configItem['type'] == 'image') {
//console.log(configItem) //console.log(configItem)
if(configItem.hasOwnProperty('field') && configItem['field'] == 'code') { if (configItem.hasOwnProperty('field') && configItem['field'] == 'code') {
configItem.value = this.handleGenerate() configItem.value = this.handleGenerate()
} }
res.push(configItem) res.push(configItem)
@ -1020,7 +1026,7 @@ export default {
//console.log('res',res) //console.log('res',res)
return res return res
}, },
handlerTdListItem(tdItem, order){ handlerTdListItem(tdItem, order) {
let list = JSON.stringify(tdItem) let list = JSON.stringify(tdItem)
list = JSON.parse(list) list = JSON.parse(list)
for (let i = 0; i < list['value'].length; i++) { for (let i = 0; i < list['value'].length; i++) {
@ -1090,7 +1096,7 @@ export default {
if (this.instance != null) { if (this.instance != null) {
this.instance.destroy() this.instance.destroy()
} }
this.instance = new Editor( this.instance = new Editor(
document.querySelector('.editor'), document.querySelector('.editor'),
showData, showData,
@ -1105,7 +1111,7 @@ export default {
getSelectImage() { getSelectImage() {
//const imageFileDom = document.querySelector('#image') //const imageFileDom = document.querySelector('#image')
//imageFileDom.click() //imageFileDom.click()
if(this.flag == true) return if (this.flag == true) return
let _this = this let _this = this
new Dialog({ new Dialog({
title: '图片类型', title: '图片类型',
@ -1139,13 +1145,13 @@ export default {
_this.gageImage() _this.gageImage()
} }
}) })
}, },
gageImage() { gageImage() {
const imageFileDom = document.querySelector('#image') const imageFileDom = document.querySelector('#image')
imageFileDom.click() imageFileDom.click()
}, },
selectImage(event) { selectImage(event) {
event.stopPropagation() event.stopPropagation()
let _this = this let _this = this
@ -1170,7 +1176,7 @@ export default {
} }
} }
}, },
executeInsertElementList() { executeInsertElementList() {
this.instance.command.executeInsertElementList([ this.instance.command.executeInsertElementList([
{ {