Commit e821dbab authored by 何远江's avatar 何远江

变量转换设置映射字段改为下拉选择

parent 68fdf0fc
...@@ -136,4 +136,15 @@ export const apiOrderVarGetNewVars = (orderItemId: any) => { ...@@ -136,4 +136,15 @@ export const apiOrderVarGetNewVars = (orderItemId: any) => {
}); });
}; };
/**
* 获取变量下拉数据
* @param orderItemId
* @returns
*/
export const getVarSpecList = (productCode: any) => {
return axios.get("/api/varTemplateDetail/getVarSpecList", {
params: { productCode }
});
};
...@@ -6,7 +6,7 @@ type StoreState = { ...@@ -6,7 +6,7 @@ type StoreState = {
fileInfo: Record<any, any> fileInfo: Record<any, any>
isSelectedRow: Boolean isSelectedRow: Boolean
isSetSheetMarks: Boolean[] isSetSheetMarks: Boolean[]
sheetBegin: Record<any, any>[] sheetBegin: Record<any, any>[],
} }
export const useExcelStore = defineStore('excelStore', { export const useExcelStore = defineStore('excelStore', {
...@@ -95,6 +95,7 @@ type ExcelChangeStore = { ...@@ -95,6 +95,7 @@ type ExcelChangeStore = {
scriptList: Recordable[] scriptList: Recordable[]
orderFieldList: Recordable[] orderFieldList: Recordable[]
usedFieldList: Recordable[] usedFieldList: Recordable[]
specList?: Recordable[]
} }
export const useExcelChangeStore = defineStore('excelChangeStore', { export const useExcelChangeStore = defineStore('excelChangeStore', {
...@@ -148,7 +149,7 @@ export const useExcelChangeStore = defineStore('excelChangeStore', { ...@@ -148,7 +149,7 @@ export const useExcelChangeStore = defineStore('excelChangeStore', {
}, },
setUsedFieldList(list: any) { setUsedFieldList(list: any) {
this.usedFieldList = list this.usedFieldList = list
} },
} }
}) })
...@@ -158,7 +159,7 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore ...@@ -158,7 +159,7 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore
allMapConfigs: {}, // 缓存当前这条数据的所有映射关系 allMapConfigs: {}, // 缓存当前这条数据的所有映射关系
scriptList: [], // 脚本 scriptList: [], // 脚本
orderFieldList: [], // 订单字段 orderFieldList: [], // 订单字段
usedFieldList: [] // 当前编辑column使用过的映射字段 usedFieldList: [], // 当前编辑column使用过的映射字段
}), }),
getters: { getters: {
getAllMapConfigs(): Recordable { getAllMapConfigs(): Recordable {
...@@ -187,6 +188,9 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore ...@@ -187,6 +188,9 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore
: (item.disabled = false) : (item.disabled = false)
return item return item
}) })
},
getSpecList(): any {
return this.specList
} }
}, },
actions: { actions: {
...@@ -204,6 +208,9 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore ...@@ -204,6 +208,9 @@ export const useVariableExcelChangeStore = defineStore('variableExcelChangeStore
}, },
setUsedFieldList(list: any) { setUsedFieldList(list: any) {
this.usedFieldList = list this.usedFieldList = list
},
setSpecList(list: any) {
this.specList = list
} }
} }
}) })
\ No newline at end of file
...@@ -192,6 +192,7 @@ import { ...@@ -192,6 +192,7 @@ import {
apiVarTemplateGetConf, apiVarTemplateGetConf,
apiVarTemplateConvert, apiVarTemplateConvert,
apiVarTemplateSaveConf, apiVarTemplateSaveConf,
getVarSpecList,
} from "@/api/var"; } from "@/api/var";
import { import {
ElMessage, ElMessage,
...@@ -361,9 +362,12 @@ const toDetail = async (row: any) => { ...@@ -361,9 +362,12 @@ const toDetail = async (row: any) => {
const { data } = await apiVarTemplateGetVars(row.varTemplateDetailId); const { data } = await apiVarTemplateGetVars(row.varTemplateDetailId);
const { data: cdata } = await apiVarTemplateGetConf(row.varTemplateDetailId); const { data: cdata } = await apiVarTemplateGetConf(row.varTemplateDetailId);
const { data: specList } = await getVarSpecList(row.productCode)
const { res, titles, configs } = filterRunData2(data.result, true); const { res, titles, configs } = filterRunData2(data.result, true);
excelChangeStore.setSpecList(specList)
cdata.result?.forEach((item) => { cdata.result?.forEach((item) => {
Reflect.set(configs[item.title], "filedConfs", item.filedConfs); Reflect.set(configs[item.title], "filedConfs", item.filedConfs);
}); });
......
...@@ -2,24 +2,21 @@ ...@@ -2,24 +2,21 @@
<!-- 字段映射设置 --> <!-- 字段映射设置 -->
<el-col> <el-col>
<el-form-item label="对应字段" prop="mapField"> <el-form-item label="对应字段" prop="mapField">
<!-- <el-select <el-select
v-if="!isVariable"
v-model="item.mapField" v-model="item.mapField"
style="width: 160px" style="width: 260px"
filterable filterable
placeholder="请选择" placeholder="请选择"
@change="mapFieldChange"
clearable clearable
> >
<el-option <el-option
v-for="item in getAllFields" v-for="item in getSpecList"
:key="item.filedName" :key="item.itemId"
:label="item.fliedTitle" :label="item.spec"
:value="item.filedName" :value="item.spec"
:disabled="!!item.disabled"
/> />
</el-select> --> </el-select>
<el-input v-model="item.mapField" style="width: 260px" /> <!-- <el-input v-model="item.mapField" style="width: 260px" /> -->
<!-- <el-checkbox class="ml-1" v-model="isVariable" @change="checkboxChange">是变量</el-checkbox> --> <!-- <el-checkbox class="ml-1" v-model="isVariable" @change="checkboxChange">是变量</el-checkbox> -->
<el-button <el-button
class="ml-1" class="ml-1"
...@@ -84,7 +81,7 @@ import { onMounted, ref, watch } from 'vue' ...@@ -84,7 +81,7 @@ import { onMounted, ref, watch } from 'vue'
const props = defineProps<{ item?: any; index: number }>() const props = defineProps<{ item?: any; index: number }>()
const emits = defineEmits(['remove']) const emits = defineEmits(['remove'])
const excelChangeStore = useVariableExcelChangeStore() const excelChangeStore = useVariableExcelChangeStore()
const { getScriptList } = storeToRefs(excelChangeStore) const { getScriptList, getSpecList } = storeToRefs(excelChangeStore)
const isVariable = ref(false) const isVariable = ref(false)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment