

<script>
/* eslint-disable */
// sd-skip-auto-import
import axios from"@/common/services/axios-instance";import formulas from"@/form-designer/formula";import{getRealDataType}from"@/form-designer/sd-formula";import components from"./_import-components/sd-list-variable-config-import";export const getCustomValues=(e,t)=>Promise.all(t?.map((t=>t.value?.formulaData?e.getValueByFormula(t.value?.formulaData):Promise.resolve(void 0)))).then((e=>{const a={};t?.forEach(((t,o)=>{a[t.name]=e[o]}));return a}));var _render=function e(){var t=this,a=t._self._c;return t.showCustomVariableConfig?a("a-form-model-item",{attrs:{label:"列表变量设置"}},t._l(t.value,(function(e){return a("a-row",{key:e.name,attrs:{gutter:[4,8],type:"flex",align:"middle"}},[a("a-col",[t._v(" "+t._s(e.caption)+" ")]),a("a-col",[t._v("=")]),a("a-col",{class:t.$style.formula},[a("sd-formula",{attrs:{formulas:t.formulas,fields:t.formulaFields,"data-type":t.getDataType(e)},on:{update:a=>{t.$set(e.value,"formulaData",a);t.$emit("input",t.value)}},model:{value:e.value.formulaObject,callback:function(a){t.$set(e.value,"formulaObject",a)},expression:"item.value.formulaObject"}})],1)],1)})),1):t._e()};var staticRenderFns=[];_render._withStripped=true;export default{name:"SdListVariableConfig",components:components,props:{value:{type:Array,default:()=>[]},moduleId:{type:String,default:void 0},formListId:{type:String,default:void 0},formulaFields:{type:Array,default:()=>[]},activated:{type:Boolean,default:false}},data(){return{formulas:[]}},computed:{showCustomVariableConfig(){return this.value?.length>0||false}},watch:{activated(e){if(e)this.unWatchFormListId=this.$watch("formListId",(()=>{this.loadCustomVariable()}));else this.unWatchFormListId?.()}},created(){formulas().then((e=>{this.formulas=e}))},methods:{loadCustomVariable(){if(this.moduleId&&this.formListId)axios.get(`api/framework/v1/we-app-form-list/show?appModuleId=${this.moduleId}&formListId=${this.formListId}`).then((e=>{this.$emit("input",e.data.attr?.customFields?.map((e=>({...e,value:{}})))||[])}))},getDataType(e){return getRealDataType(e)}},render:_render,staticRenderFns:staticRenderFns};</script>

<style module lang="scss">
@use '@/common/design' as *;
.formula {
  line-height: 1;
  span:global(.ant-tag) {
    margin: 0;
  }
}
</style>
