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

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

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