diff --git a/src/App.vue b/src/App.vue index 1915df4..235063d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -698,34 +698,72 @@ export default { }) }, getApiField() { - let api = '/api/Administrator/ProductColConfig/getUserConfig' + //let api = '/api/Administrator/ProductColConfig/getUserConfig' + let api = '/api//Administrator/PrintTemplate/getUserConfig?type=1' axios.get(api).then(res => { //let field = res.data - let fieldArr = res.data.data + let fieldArr = res.data.data.col_config + let fieldheader = res.data.data.header_config let fieldObj = {} let nameField = {} let showObj = {} - let aRow = {} - for (let i = 0; i < fieldArr.length; i++) { + + //console.log(fieldArr) + for(let i = 0; i < fieldArr.length; i++) { + let key = fieldArr[i].field + fieldObj[key] = fieldArr[i].name + nameField[fieldArr[i].name] = key + } + this.field = fieldObj + this.nameField = nameField + + let searchNameField = {} + let searchField = {} + for(let i = 0; i < fieldheader.length; i++) { + let key = fieldheader[i].field + searchField[key] = fieldheader[i].name + searchNameField[fieldheader[i].name] = key + } + this.searchNameField = searchNameField + this.searchField = searchField + /* for (let i = 0; i < fieldArr.length; i++) { let key = fieldArr[i].field fieldObj[key] = fieldArr[i].name showObj[key] = true - aRow[key] = false nameField[fieldArr[i].name] = key } this.nameField = nameField this.showObj = showObj this.field = fieldObj - this.fieldArr = fieldArr + this.fieldArr = fieldArr */ this.getApiData() }) }, getApiData() { - let api = '/api/Administrator/InquiryOrder/getOrderInfo?order_id=E2024060509560254698592' + let api = '/api//Administrator/PrintTemplate/preview' + let param = { + "type": 1, + "order_id": "E2024060509560254698592" + } + axios.post(api, param).then((res) => { + //console.log(res) + + this.orderData = res.data.data.col_data + this.searchList = res.data.data.header_data + this.init() + }) + }, + getApiDatabak() { + //let api = '/api/Administrator/InquiryOrder/getOrderInfo?order_id=E2024060509560254698592' + let api = '/api//Administrator/PrintTemplate/preview' let api3 = '/api/Administrator/InquirySearchConfig/getUserConfig' - const request1 = axios.get(api) + let param = { + "type": 1, + "order_id": "E2024060509560254698592" + } + const request1 = axios.post(api, param) //const request2 = axios.get(api2) const request3 = axios.get(api3) axios.all([request1, request3]).then(axios.spread((response1, response3) => { @@ -736,7 +774,7 @@ export default { for (let k = 0; k < orderList.length; k++) { const element = orderList[k] let item = { 'proid': element['pid'], 'prolistid': element['plid'] } - this.getGongXu(item, k) + //this.getGongXu(item, k) } this.searchList = data.data.searchExt @@ -747,7 +785,7 @@ export default { let data3 = response3.data this.orderData = orderData - if (data3.code == 1) { + /* if (data3.code == 1) { this.searchConfig = data3.data let searchNameField = {} let searchField = {} @@ -760,7 +798,7 @@ export default { } this.searchNameField = searchNameField this.searchField = searchField - } + } */ this.init() })) @@ -778,14 +816,14 @@ export default { }, getHTMLValuea() { const editorOption = this.instance.command.getOptions() - console.log(editorOption) + //console.log(editorOption) const html = this.instance.command.getHTML() //let str = html.main //console.log(html) //str = str.replace(/"/g, "'") //console.log(str) const ccc = this.instance.command.getValue() - console.log(ccc.data) + console.log('ccc',ccc.data) const aaa = this.instance.command.getText() if (aaa.main.indexOf('{') == -1) { ElMessage({ @@ -895,9 +933,11 @@ export default { if(end == -1) return value let fieldKey = value.substring(start + 1, end) let field = this.searchNameField[fieldKey] + console.log(field,fieldKey, this.searchNameField) let newValue = '' if (field == undefined) { field = this.nameField[fieldKey] + newValue = this.getFieldValues(field) } else { newValue = this.searchList[field] @@ -1025,6 +1065,7 @@ export default { } else { let value = configItem.value + console.log(value); configItem.value = this.replaceData(value) res.push(configItem) } @@ -1066,15 +1107,15 @@ export default { return false } let _this = this - let api = '/api/Administrator/OrderFieldStyle/getUserConfig?type=' + this.orderType + let api = '/api/Administrator/PrintTemplate/getTemplate?id=1' axios.get(api).then((res) => { res = JSON.parse(JSON.stringify(res)) let doc = {} if (res.data.code == 1) { - doc = res.data.data.field_style + doc = res.data.data.content_style let tempDoc = JSON.stringify(doc) - ///console.log(doc) + //console.log(res.data) tempDoc = JSON.parse(tempDoc) _this.doc = tempDoc @@ -1087,7 +1128,7 @@ export default { initDoc(showData) { //showData = localStorage.getItem('word_data') //showData = JSON.parse(showData) - console.log(showData) + //console.log(showData) if (Object.keys(showData).length === 0) { showData = { header: [],