From c179177730686c73ecba7cca871df12b65af52c2 Mon Sep 17 00:00:00 2001
From: YuanFeng <770153798@qq.com>
Date: Mon, 18 Nov 2024 01:03:55 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E6=89=B9=E7=A8=BF?=
=?UTF-8?q?=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DraftDesign/components/DesignPropEdit.vue | 448 ++++++++++++------
.../components/DynamicPropConfig.vue | 42 +-
.../src/components/DraftDesign/index.vue | 7 +-
.../DraftDesign/components/DesignPropEdit.vue | 448 ++++++++++++------
.../components/DynamicPropConfig.vue | 42 +-
.../src/components/DraftDesign/index.vue | 7 +-
.../OrderAddProductStep/ProductItem2.vue | 107 +----
.../OrderAddProductStep/ProductItem3.vue | 356 ++++++++++++++
.../OrderAddProductStep/ProductSkuList.vue | 34 +-
.../src/views/oms/order/createorder/index.vue | 84 ++--
10 files changed, 1104 insertions(+), 471 deletions(-)
create mode 100644 hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem3.vue
diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue
index 3313cc2..6744930 100644
--- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue
+++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DesignPropEdit.vue
@@ -73,58 +73,68 @@
:key="tmp.key"
:label="getLabelName(that.propInfo[tmp.key])">
-
-
-
-
-
-
+ style="box-shadow: 0px 2px 5px 2px #dcdcdc;"
+ v-if="that.propInfo[tmp.key].multiLanguage
+ && that.propInfo[tmp.key].shape === ShapeType.vueTextCell">
-
-
-
-
-
- 占比
-
-
-
-
-
- %
-
-
+
+
-
+
+
+ @click="appendList(tmp.key)">
添加
@@ -152,7 +162,6 @@
@change="changeData"
@select="changeData"
/>
-
-
+
占比
-
+
-
+
%
@@ -186,7 +195,7 @@
+ @click="deleteList(tmp.key,index)">
@@ -194,7 +203,7 @@
+ @click="appendList(tmp.key)">
添加
@@ -231,13 +240,13 @@
+ @click="deleteList(tmp.key,index)">
+ @click="appendList(tmp.key)">
添加
@@ -317,6 +326,7 @@ const that = reactive({
svgId: "svg_" + Math.random().toString(36).substring(2),
hideCreate: true,
pageLoading: {},
+ restInfo: null,
propInfo: {
reView: true,
groupName: '', // 节点名称
@@ -403,53 +413,41 @@ const initSucceed = () => {
const changeData = (index: number, key: string) => {
const info = that.propInfo[key];
const infoList = getIngredientInfoListByType(info.groupType)
- if (index < 0) {
- let mapping = []
- for (let i = 0; i < infoList.length; i++) {
- if (infoList[i].label === info.dataInfo[0].showLabel) {
- mapping = infoList[i].langMapping;
- break;
- }
- }
- // 多语言数据
- for (let i = 0; i < that.propInfo[key].dataInfo.length; i++) {
- for (let j = 0; j < mapping.length; j++) {
- if (that.propInfo[key].dataInfo[i].locale === mapping[j].locale) {
+ let mapping = {}
+ for (let i = 0; i < infoList.length; i++) {
+ mapping[infoList[i].label] = infoList[i].langMapping;
+ }
+ // 多语言变量替换
+ const allData = [...that.propInfo[key].dataInfo]
+ const fLang = allData[0].locale;
+ let m1 = mapping[allData[0].label]
- let str = that.propInfo[key].dataInfo[0].ratio;
+ if(m1){
+ let ratio = allData[0].ratio
+ for (let i = 0; i < allData.length; i++) {
+
+ if(i>0 && allData[i].locale === fLang){
+ ratio = allData[i].ratio
+ m1 = mapping[allData[i].label]
+ }
+ for (let j = 0; j < m1.length; j++) {
+ if( allData[i].locale === m1[j].locale){
+ console.log("m1",m1[j],ratio)
+ let str = ratio;
if (str === null || str === undefined || str === -1) {
str = ''
}
- const value = `${mapping[j].value}`.replaceAll('${r}', str)
- that.propInfo[key].dataInfo[i].label = value
+ allData[i].label = `${m1[j].value}`.replaceAll('${r}', `${str}`)
break;
}
}
}
- } else {
- for (let i = 0; i < infoList.length; i++) {
- if (infoList[i].value === that.propInfo[key].dataInfo[index].showLabel) {
- const arr = infoList[i].langMapping as Array;
- let value = '';
- if (infoList[i].isCombo) {
- for (let j = 0; j < arr.length; j++) {
- if (j > 0) {
- value += arr[j].linkChar || ''
- }
- let str = that.propInfo[key].dataInfo[index].ratio;
- if (str === null || str === undefined || str === -1) {
- str = ''
- }
- value += `${arr[j].value}`.replaceAll('${r}', str)
- }
- }
- that.propInfo[key].dataInfo[index].label = value;
- break;
- }
- }
+ that.propInfo[key].dataInfo = [...allData];
+
+ resetData();
}
- resetData();
+
}
const changeComboData = (item: any, label: string) => {
let info = [];
@@ -513,19 +511,63 @@ const uploadFile = async (fileName) => {
});
}
-const deleteList = (item, index) => {
- item.dataInfo.splice(index, 1)
- resetData();
-}
-const appendList = (item) => {
- item.dataInfo.push(
- {
- label: '',
- url: '',
- ratio: 0,
- ...item.dataInfo[item.dataInfo.length - 1]
+const deleteList = (key, index) => {
+ const item = JSON.parse(JSON.stringify(that.propInfo[key]))
+ const group = findGroup(key,that.propInfo)
+ const keys = Object.keys(group);
+
+ if(keys.length > 1){
+ console.log(index)
+ // 删除同一组数据
+ const firstLang = item.dataInfo[0].locale
+ const indexs = [];
+ for (let i = index; i < item.dataInfo.length; i++) {
+ if(i > index && firstLang === item.dataInfo[i].locale){
+ break;
+ }
+ indexs.push(i);
}
- )
+ const newArr = [];
+ for (let i = 0; i < that.propInfo[key].dataInfo.length; i++) {
+ if(!indexs.includes(i)){
+ newArr.push(that.propInfo[key].dataInfo[i])
+ }
+ }
+ that.propInfo[key].dataInfo = [...newArr]
+ resetData();
+ }else {
+ useMessage().notifyWarning("至少需要一个变量")
+ return;
+ }
+
+}
+const appendList = (key) => {
+ const item = that.propInfo[key]
+ console.log("item.dataInfo",item)
+ const group = findGroup(key,that.propInfo)
+ const keys = Object.keys(group);
+ console.log("keys",keys)
+ // 有多少组变量
+ if(keys.length >= item.maxSize ){
+ useMessage().notifyWarning("最大数量为:"+item.maxSize)
+ return;
+ }
+ const locale = item.dataInfo[0].locale
+ const tmpArr = [...item.dataInfo]
+
+ for (let i = 0; i < tmpArr.length; i++) {
+ if(i > 0 && tmpArr[i].locale === locale){
+ break;
+ }
+ item.dataInfo.push(
+ {
+ label: '',
+ url: '',
+ ratio: 0,
+ ...tmpArr[i]
+ }
+ )
+ }
resetData();
}
const formData = ref({
@@ -646,7 +688,8 @@ const showPng = () => {
const info = draftDesignEditRef.value.getPropInfo();
that.propInfo = {
...info.propDefault,
- ...that.propInfo || {}
+ ...that.propInfo || {},
+ ...that.restInfo || {},
};
that.propOrderByList = info.propOrderByList;
loading.value = false;
@@ -665,65 +708,174 @@ const resetData = () => {
that.changeCount++;
}
}
+const findGroup = (key,propInfo)=>{
+ let groupArr= [];
+ let index = 0;
+ let gInfo = {};
+ let firstLang = propInfo[key].dataInfo[0].locale
+ for (let l = 0; l < propInfo[key].dataInfo.length; l++) {
+ // 数据分组
+ if(l > index && propInfo[key].dataInfo[l].locale === firstLang){
+ index = l;
+ groupArr = []
+ }
+ groupArr.push(propInfo[key].dataInfo[l])
+ gInfo[`${key}_g${index}`] = groupArr;
+ }
+ return gInfo
+}
+/**
+ * 获取语言分组
+ * @param key
+ * @param propInfo
+ */
+const findGroupAllLang = (key,propInfo)=>{
+ const langList = [];
+ let firstLang = propInfo[key].dataInfo[0].locale
+ for (let l = 0; l < propInfo[key].dataInfo.length; l++) {
+ // 数据分组
+ if(l > 0 && propInfo[key].dataInfo[l].locale === firstLang){
+ break;
+ }
+ langList.push(propInfo[key].dataInfo[l].locale)
+ }
+ return langList
+}
+const checkPropInfo = (info)=>{
+ return new Promise((resolve,reject)=>{
+ let newInfo = JSON.parse(JSON.stringify(info))
+
+ const keys = Object.keys(newInfo);
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ // 合并相同语言的文字
+ let newArr = [];
+
+ // 每种语言合并成一句话
+ const allLang = findGroupAllLang(key,newInfo);
+ for (let l = 0; l < newInfo[key].dataInfo.length; l++) {
+ let str = [];
+ let row = null;
+ let labelInfo = []
+ let rInfo = 0;
+ const firstLang = newInfo[key].dataInfo[0].locale;
+ for (let i1 = 0; i1 < newInfo[key].dataInfo.length; i1++) {
+
+
+ if(firstLang === newInfo[key].dataInfo[i1].locale){
+ if(newInfo[key].groupType === '1'){
+ rInfo += newInfo[key].dataInfo[i1].ratio
+ if(rInfo > 100){
+ useMessage().notifyError("占比总数不能超过100");
+ reject("占比总数不能超过100")
+ return
+ }
+ }
+ if(labelInfo.includes(newInfo[key].dataInfo[i1].showLabel)){
+ useMessage().notifyError(`${newInfo[key].groupName}中第${labelInfo.length+1}项重复`);
+ reject("数据重复")
+ return
+ }
+ labelInfo.push(newInfo[key].dataInfo[i1].showLabel)
+ }
+ if(newInfo[key].dataInfo[i1].locale === allLang[l]){
+ str.push(newInfo[key].dataInfo[i1].label)
+ if(!row){
+ row = {...newInfo[key].dataInfo[i1]};
+ }
+ }
+ }
+ if(newInfo[key].groupType === '1'){
+ if(rInfo != 100){
+ useMessage().notifyError(`成分占比应该是100%,当前只有${rInfo}%`);
+ reject(`成分占比应该是100%,当前只有${rInfo}%`)
+ return
+ }
+ }
+ if(row){
+ row.label = str.join(",");
+ newArr.push(row);
+ }
+ }
+ newInfo[key].dataInfo = newArr;
+ console.log("that.propInfo",newArr)
+ console.log("that. newInfo[key]", newInfo[key])
+ }
+ resolve(newInfo)
+ });
+}
const updateDesign = () => {
that.changeCount = 0;
- draftDesignEditRef.value.init(false, that.pageConfig, that.data, that.propInfo)
+ // 记录变更的数据
+ that.restInfo = {...that.propInfo}
+ checkPropInfo(that.propInfo).then(newInfo=>{
+ //
+ console.log("that.restInfo",that.restInfo)
+ draftDesignEditRef.value.init(false, that.pageConfig, that.data, newInfo)
+ })
}
+
const changeType = () => {
previewByDraftDesignId(that.draftDesignId, that.propInfo)
}
const getPropInfo = () => {
-
- that.pageLoading = ElLoading.service({
- lock: true,
- text: '数据传输中...',
- background: 'rgba(0,0,0,0.5)'
- })
// 预览数据 保持缩放
return new Promise((resolve) => {
- // 成功后再获取图片
- draftDesignEditRef.value.toSVGData((url) => {
- that.previewUrl = url
- that.hideCreate = false;
- setTimeout(()=>{
- const el = document.querySelector(`#${that.svgId} g`);
- el.setAttribute("transform",'matrix(1,0,0,1,0,0)');
+ checkPropInfo(that.propInfo).then(r =>{
+ that.pageLoading = ElLoading.service({
+ lock: true,
+ text: '数据传输中...',
+ background: 'rgba(0,0,0,0.5)'
+ })
+ // 成功后再获取图片
+ draftDesignEditRef.value.toSVGData((url) => {
+ that.previewUrl = url
+ that.hideCreate = false;
+ setTimeout(()=>{
+ const el = document.querySelector(`#${that.svgId} g`);
+ el.setAttribute("transform",'matrix(1,0,0,1,0,0)');
- document.querySelector(`#${that.svgId} svg`).style.position = 'absolute';
- document.querySelector(`#${that.svgId} svg`).style.top = '-40%';
+ document.querySelector(`#${that.svgId} svg`).style.position = 'absolute';
+ document.querySelector(`#${that.svgId} svg`).style.top = '-40%';
- const dom = document.querySelector(`#${that.svgId} svg .x6-graph-svg-viewport`).getBoundingClientRect()
- const svgDom = document.querySelector(`#${that.svgId} svg`).getBoundingClientRect()
- that.svgHeight = dom.height;
- that.svgWidth = dom.width;
- document.querySelector(`#${that.svgId} svg`).style.left = `${svgDom.left - dom.left}px`;
- document.querySelector(`#${that.svgId} svg`).style.top = `${svgDom.top - dom.top}px`;
- // that.pageLoading.close()
- // 年月日
- const date = new Date();
- const randChar = Math.random().toString(36).slice(-6);
- const fileName = `${date.getFullYear()}${(date.getMonth() + 1)}${date.getDate()}_${that.draftDesignId}_${randChar}_稿.png`;
- // 文件上传
- uploadFile(fileName).then(res => {
- that.previewData = res.data;
- that.hideCreate = true;
- that.previewUrl = ""
- const info = draftDesignEditRef.value.getPropInfo();
- that.pageLoading.close()
- resolve({
- draftDesignData: draftDesignEditRef.value.getJson(),
- propOrderByList: info.propOrderByList,
- // 设计稿id
- draftDesignId: that.draftDesignId,
- previewImage: that.previewData,
- propInfo: that.propInfo
+ const dom = document.querySelector(`#${that.svgId} svg .x6-graph-svg-viewport`).getBoundingClientRect()
+ const svgDom = document.querySelector(`#${that.svgId} svg`).getBoundingClientRect()
+ that.svgHeight = dom.height;
+ that.svgWidth = dom.width;
+ document.querySelector(`#${that.svgId} svg`).style.left = `${svgDom.left - dom.left}px`;
+ document.querySelector(`#${that.svgId} svg`).style.top = `${svgDom.top - dom.top}px`;
+ // that.pageLoading.close()
+ // 年月日
+ const date = new Date();
+ const randChar = Math.random().toString(36).slice(-6);
+ const fileName = `${date.getFullYear()}${(date.getMonth() + 1)}${date.getDate()}_${that.draftDesignId}_${randChar}_稿.png`;
+ // 文件上传
+ uploadFile(fileName).then(res => {
+ that.previewData = res.data;
+ that.hideCreate = true;
+ that.previewUrl = ""
+ const info = draftDesignEditRef.value.getPropInfo();
+ that.pageLoading.close()
+ that.propInfo = {
+ ...info.propDefault,
+ ...that.propInfo || {},
+ ...that.restInfo || {},
+ };
+ resolve({
+ draftDesignData: draftDesignEditRef.value.getJson(),
+ propOrderByList: info.propOrderByList,
+ // 设计稿id
+ draftDesignId: that.draftDesignId,
+ previewImage: that.previewData,
+ propInfo: that.propInfo
+ })
})
})
- })
- }, {
- widthScale: 6,
- heightScale: 6
+ }, {
+ widthScale: 6,
+ heightScale: 6
+ })
})
})
}
diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DynamicPropConfig.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DynamicPropConfig.vue
index f908314..370a210 100644
--- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DynamicPropConfig.vue
+++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/components/DynamicPropConfig.vue
@@ -41,7 +41,7 @@
-
+
@@ -52,7 +52,7 @@
-
+
max
@@ -119,7 +118,7 @@
-
+
+
+ 表达式
+
+
+
{{ that.configInfo.pointList[scope.$index].dataInfo.label}}
-
+
+
+
+
@@ -148,8 +155,8 @@
@@ -191,6 +198,13 @@ const props = defineProps({
default: false
}
})
+const languageOptions = computed(()=>{
+
+ const options = getStrDictOptions(DICT_TYPE.LANGUAGE_LOCALE);
+ // @ts-ignore
+ options.unshift({ label: '*取值表达式', value: '_$value' })
+ return options
+})
const delLast = () => {
if (that.configInfo.pointList.length === 1) {
useMessage().warning(`至少需要1个位置信息`)
@@ -225,6 +239,7 @@ const append = (count = 1) => {
}
const init = (allGroupList, data) => {
that.allGroupList = allGroupList;
+ console.log("that.allGroupList",that.allGroupList)
console.log("data",data)
that.configInfo = {
groupName: '', // 父节点名称
@@ -247,6 +262,7 @@ const updateVisible = (value: boolean) => {
that.show = value;
}
const getConfig = () => {
+ console.log("that.configInfo",that.configInfo)
return that.configInfo;
}
const submit = () => {
diff --git a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue
index 8414942..8b6a069 100644
--- a/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue
+++ b/hangtag-ui/hangtag-ui-admin/src/components/DraftDesign/index.vue
@@ -27,7 +27,7 @@
+ :style="{ 'box-shadow': that.editState ? '0 0 10px 1px #eee' : 'none',}">
@@ -312,6 +312,7 @@ const rightKeyMenu = computed(() => {
let max = 100;
for (let i = 0; i < that.pageConfig.propList.length; i++) {
if (that.pageConfig.propList[i].groupId === cells[0].getData().propGroupId) {
+ console.log("that.pageConfig.propList##",that.pageConfig.propList)
max = that.pageConfig.propList[i].maxSize || 100
break;
}
@@ -1445,7 +1446,7 @@ const handlerGroupList = (cells, isCombo = false, min, max) => {
}
}
- dynamicPropRef.value.init([], {
+ dynamicPropRef.value.init(that.pageConfig.propList, {
groupId: groupId,
groupName: groupName,
groupType: groupType,
@@ -1563,7 +1564,7 @@ const submitProp = (data) => {
}
removeGroup(data.groupId);
- data.maxSize = Math.min(data.pointList.length, data.maxSize)
+ data.maxSize = Math.max(data.pointList.length, data.maxSize)
that.pageConfig.propList.push(data)
dynamicPropRef.value.updateVisible(false)
draftDesignLayoutRef.value.updatePropList(orderByPropList())
diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue
index 3313cc2..6744930 100644
--- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue
+++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DesignPropEdit.vue
@@ -73,58 +73,68 @@
:key="tmp.key"
:label="getLabelName(that.propInfo[tmp.key])">
-
-
-
-
-
-
+ style="box-shadow: 0px 2px 5px 2px #dcdcdc;"
+ v-if="that.propInfo[tmp.key].multiLanguage
+ && that.propInfo[tmp.key].shape === ShapeType.vueTextCell">
-
-
-
-
-
- 占比
-
-
-
-
-
- %
-
-
+
+
-
+
+
+ @click="appendList(tmp.key)">
添加
@@ -152,7 +162,6 @@
@change="changeData"
@select="changeData"
/>
-
-
+
占比
-
+
-
+
%
@@ -186,7 +195,7 @@
+ @click="deleteList(tmp.key,index)">
@@ -194,7 +203,7 @@
+ @click="appendList(tmp.key)">
添加
@@ -231,13 +240,13 @@
+ @click="deleteList(tmp.key,index)">
+ @click="appendList(tmp.key)">
添加
@@ -317,6 +326,7 @@ const that = reactive({
svgId: "svg_" + Math.random().toString(36).substring(2),
hideCreate: true,
pageLoading: {},
+ restInfo: null,
propInfo: {
reView: true,
groupName: '', // 节点名称
@@ -403,53 +413,41 @@ const initSucceed = () => {
const changeData = (index: number, key: string) => {
const info = that.propInfo[key];
const infoList = getIngredientInfoListByType(info.groupType)
- if (index < 0) {
- let mapping = []
- for (let i = 0; i < infoList.length; i++) {
- if (infoList[i].label === info.dataInfo[0].showLabel) {
- mapping = infoList[i].langMapping;
- break;
- }
- }
- // 多语言数据
- for (let i = 0; i < that.propInfo[key].dataInfo.length; i++) {
- for (let j = 0; j < mapping.length; j++) {
- if (that.propInfo[key].dataInfo[i].locale === mapping[j].locale) {
+ let mapping = {}
+ for (let i = 0; i < infoList.length; i++) {
+ mapping[infoList[i].label] = infoList[i].langMapping;
+ }
+ // 多语言变量替换
+ const allData = [...that.propInfo[key].dataInfo]
+ const fLang = allData[0].locale;
+ let m1 = mapping[allData[0].label]
- let str = that.propInfo[key].dataInfo[0].ratio;
+ if(m1){
+ let ratio = allData[0].ratio
+ for (let i = 0; i < allData.length; i++) {
+
+ if(i>0 && allData[i].locale === fLang){
+ ratio = allData[i].ratio
+ m1 = mapping[allData[i].label]
+ }
+ for (let j = 0; j < m1.length; j++) {
+ if( allData[i].locale === m1[j].locale){
+ console.log("m1",m1[j],ratio)
+ let str = ratio;
if (str === null || str === undefined || str === -1) {
str = ''
}
- const value = `${mapping[j].value}`.replaceAll('${r}', str)
- that.propInfo[key].dataInfo[i].label = value
+ allData[i].label = `${m1[j].value}`.replaceAll('${r}', `${str}`)
break;
}
}
}
- } else {
- for (let i = 0; i < infoList.length; i++) {
- if (infoList[i].value === that.propInfo[key].dataInfo[index].showLabel) {
- const arr = infoList[i].langMapping as Array;
- let value = '';
- if (infoList[i].isCombo) {
- for (let j = 0; j < arr.length; j++) {
- if (j > 0) {
- value += arr[j].linkChar || ''
- }
- let str = that.propInfo[key].dataInfo[index].ratio;
- if (str === null || str === undefined || str === -1) {
- str = ''
- }
- value += `${arr[j].value}`.replaceAll('${r}', str)
- }
- }
- that.propInfo[key].dataInfo[index].label = value;
- break;
- }
- }
+ that.propInfo[key].dataInfo = [...allData];
+
+ resetData();
}
- resetData();
+
}
const changeComboData = (item: any, label: string) => {
let info = [];
@@ -513,19 +511,63 @@ const uploadFile = async (fileName) => {
});
}
-const deleteList = (item, index) => {
- item.dataInfo.splice(index, 1)
- resetData();
-}
-const appendList = (item) => {
- item.dataInfo.push(
- {
- label: '',
- url: '',
- ratio: 0,
- ...item.dataInfo[item.dataInfo.length - 1]
+const deleteList = (key, index) => {
+ const item = JSON.parse(JSON.stringify(that.propInfo[key]))
+ const group = findGroup(key,that.propInfo)
+ const keys = Object.keys(group);
+
+ if(keys.length > 1){
+ console.log(index)
+ // 删除同一组数据
+ const firstLang = item.dataInfo[0].locale
+ const indexs = [];
+ for (let i = index; i < item.dataInfo.length; i++) {
+ if(i > index && firstLang === item.dataInfo[i].locale){
+ break;
+ }
+ indexs.push(i);
}
- )
+ const newArr = [];
+ for (let i = 0; i < that.propInfo[key].dataInfo.length; i++) {
+ if(!indexs.includes(i)){
+ newArr.push(that.propInfo[key].dataInfo[i])
+ }
+ }
+ that.propInfo[key].dataInfo = [...newArr]
+ resetData();
+ }else {
+ useMessage().notifyWarning("至少需要一个变量")
+ return;
+ }
+
+}
+const appendList = (key) => {
+ const item = that.propInfo[key]
+ console.log("item.dataInfo",item)
+ const group = findGroup(key,that.propInfo)
+ const keys = Object.keys(group);
+ console.log("keys",keys)
+ // 有多少组变量
+ if(keys.length >= item.maxSize ){
+ useMessage().notifyWarning("最大数量为:"+item.maxSize)
+ return;
+ }
+ const locale = item.dataInfo[0].locale
+ const tmpArr = [...item.dataInfo]
+
+ for (let i = 0; i < tmpArr.length; i++) {
+ if(i > 0 && tmpArr[i].locale === locale){
+ break;
+ }
+ item.dataInfo.push(
+ {
+ label: '',
+ url: '',
+ ratio: 0,
+ ...tmpArr[i]
+ }
+ )
+ }
resetData();
}
const formData = ref({
@@ -646,7 +688,8 @@ const showPng = () => {
const info = draftDesignEditRef.value.getPropInfo();
that.propInfo = {
...info.propDefault,
- ...that.propInfo || {}
+ ...that.propInfo || {},
+ ...that.restInfo || {},
};
that.propOrderByList = info.propOrderByList;
loading.value = false;
@@ -665,65 +708,174 @@ const resetData = () => {
that.changeCount++;
}
}
+const findGroup = (key,propInfo)=>{
+ let groupArr= [];
+ let index = 0;
+ let gInfo = {};
+ let firstLang = propInfo[key].dataInfo[0].locale
+ for (let l = 0; l < propInfo[key].dataInfo.length; l++) {
+ // 数据分组
+ if(l > index && propInfo[key].dataInfo[l].locale === firstLang){
+ index = l;
+ groupArr = []
+ }
+ groupArr.push(propInfo[key].dataInfo[l])
+ gInfo[`${key}_g${index}`] = groupArr;
+ }
+ return gInfo
+}
+/**
+ * 获取语言分组
+ * @param key
+ * @param propInfo
+ */
+const findGroupAllLang = (key,propInfo)=>{
+ const langList = [];
+ let firstLang = propInfo[key].dataInfo[0].locale
+ for (let l = 0; l < propInfo[key].dataInfo.length; l++) {
+ // 数据分组
+ if(l > 0 && propInfo[key].dataInfo[l].locale === firstLang){
+ break;
+ }
+ langList.push(propInfo[key].dataInfo[l].locale)
+ }
+ return langList
+}
+const checkPropInfo = (info)=>{
+ return new Promise((resolve,reject)=>{
+ let newInfo = JSON.parse(JSON.stringify(info))
+
+ const keys = Object.keys(newInfo);
+ for (let i = 0; i < keys.length; i++) {
+ const key = keys[i];
+ // 合并相同语言的文字
+ let newArr = [];
+
+ // 每种语言合并成一句话
+ const allLang = findGroupAllLang(key,newInfo);
+ for (let l = 0; l < newInfo[key].dataInfo.length; l++) {
+ let str = [];
+ let row = null;
+ let labelInfo = []
+ let rInfo = 0;
+ const firstLang = newInfo[key].dataInfo[0].locale;
+ for (let i1 = 0; i1 < newInfo[key].dataInfo.length; i1++) {
+
+
+ if(firstLang === newInfo[key].dataInfo[i1].locale){
+ if(newInfo[key].groupType === '1'){
+ rInfo += newInfo[key].dataInfo[i1].ratio
+ if(rInfo > 100){
+ useMessage().notifyError("占比总数不能超过100");
+ reject("占比总数不能超过100")
+ return
+ }
+ }
+ if(labelInfo.includes(newInfo[key].dataInfo[i1].showLabel)){
+ useMessage().notifyError(`${newInfo[key].groupName}中第${labelInfo.length+1}项重复`);
+ reject("数据重复")
+ return
+ }
+ labelInfo.push(newInfo[key].dataInfo[i1].showLabel)
+ }
+ if(newInfo[key].dataInfo[i1].locale === allLang[l]){
+ str.push(newInfo[key].dataInfo[i1].label)
+ if(!row){
+ row = {...newInfo[key].dataInfo[i1]};
+ }
+ }
+ }
+ if(newInfo[key].groupType === '1'){
+ if(rInfo != 100){
+ useMessage().notifyError(`成分占比应该是100%,当前只有${rInfo}%`);
+ reject(`成分占比应该是100%,当前只有${rInfo}%`)
+ return
+ }
+ }
+ if(row){
+ row.label = str.join(",");
+ newArr.push(row);
+ }
+ }
+ newInfo[key].dataInfo = newArr;
+ console.log("that.propInfo",newArr)
+ console.log("that. newInfo[key]", newInfo[key])
+ }
+ resolve(newInfo)
+ });
+}
const updateDesign = () => {
that.changeCount = 0;
- draftDesignEditRef.value.init(false, that.pageConfig, that.data, that.propInfo)
+ // 记录变更的数据
+ that.restInfo = {...that.propInfo}
+ checkPropInfo(that.propInfo).then(newInfo=>{
+ //
+ console.log("that.restInfo",that.restInfo)
+ draftDesignEditRef.value.init(false, that.pageConfig, that.data, newInfo)
+ })
}
+
const changeType = () => {
previewByDraftDesignId(that.draftDesignId, that.propInfo)
}
const getPropInfo = () => {
-
- that.pageLoading = ElLoading.service({
- lock: true,
- text: '数据传输中...',
- background: 'rgba(0,0,0,0.5)'
- })
// 预览数据 保持缩放
return new Promise((resolve) => {
- // 成功后再获取图片
- draftDesignEditRef.value.toSVGData((url) => {
- that.previewUrl = url
- that.hideCreate = false;
- setTimeout(()=>{
- const el = document.querySelector(`#${that.svgId} g`);
- el.setAttribute("transform",'matrix(1,0,0,1,0,0)');
+ checkPropInfo(that.propInfo).then(r =>{
+ that.pageLoading = ElLoading.service({
+ lock: true,
+ text: '数据传输中...',
+ background: 'rgba(0,0,0,0.5)'
+ })
+ // 成功后再获取图片
+ draftDesignEditRef.value.toSVGData((url) => {
+ that.previewUrl = url
+ that.hideCreate = false;
+ setTimeout(()=>{
+ const el = document.querySelector(`#${that.svgId} g`);
+ el.setAttribute("transform",'matrix(1,0,0,1,0,0)');
- document.querySelector(`#${that.svgId} svg`).style.position = 'absolute';
- document.querySelector(`#${that.svgId} svg`).style.top = '-40%';
+ document.querySelector(`#${that.svgId} svg`).style.position = 'absolute';
+ document.querySelector(`#${that.svgId} svg`).style.top = '-40%';
- const dom = document.querySelector(`#${that.svgId} svg .x6-graph-svg-viewport`).getBoundingClientRect()
- const svgDom = document.querySelector(`#${that.svgId} svg`).getBoundingClientRect()
- that.svgHeight = dom.height;
- that.svgWidth = dom.width;
- document.querySelector(`#${that.svgId} svg`).style.left = `${svgDom.left - dom.left}px`;
- document.querySelector(`#${that.svgId} svg`).style.top = `${svgDom.top - dom.top}px`;
- // that.pageLoading.close()
- // 年月日
- const date = new Date();
- const randChar = Math.random().toString(36).slice(-6);
- const fileName = `${date.getFullYear()}${(date.getMonth() + 1)}${date.getDate()}_${that.draftDesignId}_${randChar}_稿.png`;
- // 文件上传
- uploadFile(fileName).then(res => {
- that.previewData = res.data;
- that.hideCreate = true;
- that.previewUrl = ""
- const info = draftDesignEditRef.value.getPropInfo();
- that.pageLoading.close()
- resolve({
- draftDesignData: draftDesignEditRef.value.getJson(),
- propOrderByList: info.propOrderByList,
- // 设计稿id
- draftDesignId: that.draftDesignId,
- previewImage: that.previewData,
- propInfo: that.propInfo
+ const dom = document.querySelector(`#${that.svgId} svg .x6-graph-svg-viewport`).getBoundingClientRect()
+ const svgDom = document.querySelector(`#${that.svgId} svg`).getBoundingClientRect()
+ that.svgHeight = dom.height;
+ that.svgWidth = dom.width;
+ document.querySelector(`#${that.svgId} svg`).style.left = `${svgDom.left - dom.left}px`;
+ document.querySelector(`#${that.svgId} svg`).style.top = `${svgDom.top - dom.top}px`;
+ // that.pageLoading.close()
+ // 年月日
+ const date = new Date();
+ const randChar = Math.random().toString(36).slice(-6);
+ const fileName = `${date.getFullYear()}${(date.getMonth() + 1)}${date.getDate()}_${that.draftDesignId}_${randChar}_稿.png`;
+ // 文件上传
+ uploadFile(fileName).then(res => {
+ that.previewData = res.data;
+ that.hideCreate = true;
+ that.previewUrl = ""
+ const info = draftDesignEditRef.value.getPropInfo();
+ that.pageLoading.close()
+ that.propInfo = {
+ ...info.propDefault,
+ ...that.propInfo || {},
+ ...that.restInfo || {},
+ };
+ resolve({
+ draftDesignData: draftDesignEditRef.value.getJson(),
+ propOrderByList: info.propOrderByList,
+ // 设计稿id
+ draftDesignId: that.draftDesignId,
+ previewImage: that.previewData,
+ propInfo: that.propInfo
+ })
})
})
- })
- }, {
- widthScale: 6,
- heightScale: 6
+ }, {
+ widthScale: 6,
+ heightScale: 6
+ })
})
})
}
diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DynamicPropConfig.vue b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DynamicPropConfig.vue
index f908314..370a210 100644
--- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DynamicPropConfig.vue
+++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/components/DynamicPropConfig.vue
@@ -41,7 +41,7 @@
-
+
@@ -52,7 +52,7 @@
-
+
max
@@ -119,7 +118,7 @@
-
+
+
+ 表达式
+
+
+
{{ that.configInfo.pointList[scope.$index].dataInfo.label}}
-
+
+
+
+
@@ -148,8 +155,8 @@
@@ -191,6 +198,13 @@ const props = defineProps({
default: false
}
})
+const languageOptions = computed(()=>{
+
+ const options = getStrDictOptions(DICT_TYPE.LANGUAGE_LOCALE);
+ // @ts-ignore
+ options.unshift({ label: '*取值表达式', value: '_$value' })
+ return options
+})
const delLast = () => {
if (that.configInfo.pointList.length === 1) {
useMessage().warning(`至少需要1个位置信息`)
@@ -225,6 +239,7 @@ const append = (count = 1) => {
}
const init = (allGroupList, data) => {
that.allGroupList = allGroupList;
+ console.log("that.allGroupList",that.allGroupList)
console.log("data",data)
that.configInfo = {
groupName: '', // 父节点名称
@@ -247,6 +262,7 @@ const updateVisible = (value: boolean) => {
that.show = value;
}
const getConfig = () => {
+ console.log("that.configInfo",that.configInfo)
return that.configInfo;
}
const submit = () => {
diff --git a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue
index 8414942..8b6a069 100644
--- a/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue
+++ b/hangtag-ui/hangtag-ui-front/src/components/DraftDesign/index.vue
@@ -27,7 +27,7 @@
+ :style="{ 'box-shadow': that.editState ? '0 0 10px 1px #eee' : 'none',}">
@@ -312,6 +312,7 @@ const rightKeyMenu = computed(() => {
let max = 100;
for (let i = 0; i < that.pageConfig.propList.length; i++) {
if (that.pageConfig.propList[i].groupId === cells[0].getData().propGroupId) {
+ console.log("that.pageConfig.propList##",that.pageConfig.propList)
max = that.pageConfig.propList[i].maxSize || 100
break;
}
@@ -1445,7 +1446,7 @@ const handlerGroupList = (cells, isCombo = false, min, max) => {
}
}
- dynamicPropRef.value.init([], {
+ dynamicPropRef.value.init(that.pageConfig.propList, {
groupId: groupId,
groupName: groupName,
groupType: groupType,
@@ -1563,7 +1564,7 @@ const submitProp = (data) => {
}
removeGroup(data.groupId);
- data.maxSize = Math.min(data.pointList.length, data.maxSize)
+ data.maxSize = Math.max(data.pointList.length, data.maxSize)
that.pageConfig.propList.push(data)
dynamicPropRef.value.updateVisible(false)
draftDesignLayoutRef.value.updatePropList(orderByPropList())
diff --git a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem2.vue b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem2.vue
index f9d24b7..24b4875 100644
--- a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem2.vue
+++ b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductItem2.vue
@@ -4,7 +4,6 @@
-
@@ -23,32 +22,7 @@
-
-
-
-
-
-
-
-
-
@@ -64,23 +38,13 @@
{{ that.tableList.length }}
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductSkuList.vue b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductSkuList.vue
index d19379e..3bedf16 100644
--- a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductSkuList.vue
+++ b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/components/OrderAddProductStep/ProductSkuList.vue
@@ -21,7 +21,16 @@
class="m-2"
@del-item="delItem"
:badge="`${1}`"
-
+ v-model:product-info="that.tableData[0]" />
+
+
+
@@ -31,11 +40,13 @@
import ProductItem1 from "./ProductItem1.vue"
import ProductItem2 from "./ProductItem2.vue"
+import ProductItem3 from "./ProductItem3.vue"
import {ProductInfoApi} from "@/api/oms/productinfo";
import {useResetFields} from "@/hooks/ext";
const emit = defineEmits(['change'])
const productItem2Ref = ref();
+const productItem3Ref = ref();
const [that, resetFields] = useResetFields({
tableData: [],
@@ -97,16 +108,23 @@ const init = (row) => {
if(res.templateType !== '1'){
that.cover = res.cover
}
-
+ console.log("that.tableData.length",that.tableData.length)
if (that.tableData.length === 0) {
addSku();
+ if(res.templateType === '2'){
+ // 初始化
+ setTimeout(()=>{
+ productItem2Ref.value.init(that.tableData);
+ },100)
+ }else if(res.templateType === '3'){
+ // 初始化
+ setTimeout(()=>{
+ productItem3Ref.value.init(that.tableData);
+ },100)
+ }
}
- if(res.templateType === '2'){
- // 初始化
- setTimeout(()=>{
- productItem2Ref.value.init(that.tableData);
- },100)
- }
+
+
})
}
diff --git a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/index.vue b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/index.vue
index fda5755..f58649f 100644
--- a/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/index.vue
+++ b/hangtag-ui/hangtag-ui-front/src/views/oms/order/createorder/index.vue
@@ -601,6 +601,27 @@ const submitPreHandler = (showMsg = true) => {
if (!formData.isBatch && that.tmpFormData.planDate) {
formData.value.plansenddate = new Date(that.tmpFormData.planDate).getTime()
}
+ tableData.forEach((item,index)=>{
+
+ if(!item.productSkuList || item.productSkuList.length === 0){
+ const t = `第${index+1}行 ‘${item.productName}’ SKU不能为空`;
+ if(showMsg){
+ useMessage().warning(t)
+ }
+ reject(t)
+ return;
+ }
+ item.productSkuList.forEach((item2,i2)=>{
+ if(!item2.previewImage){
+ const t = `第${index+1}行 ‘${item.productName}’SKU 第${i2+1}项 请批稿`;
+ if(showMsg){
+ useMessage().warning(t)
+ }
+ reject(t)
+ }
+ })
+ })
+
formData.value.saleOrderEntry = tableData
if ( formData.value.bizdate) {
@@ -612,35 +633,36 @@ const submitPreHandler = (showMsg = true) => {
const addNewBill = () => {
console.log("stepRef.value.getTableData()", stepRef.value.getTableData())
submitPreHandler().then(res=>{
- if(formData.value.id){
- SaleOrderApi.editOrder(formData.value.id,{
- ...formData.value
- }).then(res => {
- that.pageLoading = ElLoading.service({
- lock: true,
- text: '修改成功...',
- background: 'rgba(0,0,0,0.5)'
- })
- setTimeout(()=>{
- that.pageLoading.close()
- push("/")
- },800)
- })
- }else {
- SaleOrderApi.placeOrder({
- ...formData.value
- }).then(res => {
- that.pageLoading = ElLoading.service({
- lock: true,
- text: '下单成功...',
- background: 'rgba(0,0,0,0.5)'
- })
- setTimeout(()=>{
- that.pageLoading.close()
- push("/")
- },800)
- })
- }
+ console.log("formData",formData.value)
+ // if(formData.value.id){
+ // SaleOrderApi.editOrder(formData.value.id,{
+ // ...formData.value
+ // }).then(res => {
+ // that.pageLoading = ElLoading.service({
+ // lock: true,
+ // text: '修改成功...',
+ // background: 'rgba(0,0,0,0.5)'
+ // })
+ // setTimeout(()=>{
+ // that.pageLoading.close()
+ // push("/")
+ // },800)
+ // })
+ // }else {
+ // SaleOrderApi.placeOrder({
+ // ...formData.value
+ // }).then(res => {
+ // that.pageLoading = ElLoading.service({
+ // lock: true,
+ // text: '下单成功...',
+ // background: 'rgba(0,0,0,0.5)'
+ // })
+ // setTimeout(()=>{
+ // that.pageLoading.close()
+ // push("/")
+ // },800)
+ // })
+ // }
});
@@ -668,7 +690,7 @@ watch(() => formData.value.brandId, async (val)=>{
const data = await SaleOrderApi.getFollowerUser(val)
that.followerUserList = data
if(that.followerUserList.length > 0 && !formData.value.orderFollowerUser){
- formData.value.orderFollowerUser = that.followerUserList[0].id
+ formData.value.orderFollowerUser = `${that.followerUserList[0].id}`
}
}
})
@@ -737,7 +759,7 @@ const resFrom = (init = {}) => {
invoiceName: '',
invoiceCode: '',
invoiceRemarks: '',
- contractCode: 'tmp1',
+ contractCode: '',
retailerCode: '',
remarks: '',
isBatch: false,