panhui 2 år sedan
förälder
incheckning
1cd6e08df0
2 ändrade filer med 30 tillägg och 10 borttagningar
  1. 29 9
      src/views/FormView.vue
  2. 1 1
      src/views/MainView.vue

+ 29 - 9
src/views/FormView.vue

@@ -39,7 +39,12 @@
     </EditDialog>
     </EditDialog>
 
 
     <ElDialog v-model="showFileDialog" :title="selectedBase?.name" width="80%">
     <ElDialog v-model="showFileDialog" :title="selectedBase?.name" width="80%">
-        <PagingTable url="/form/fileds" :where="{ formId: selectedBase?.id }" :order="{ createdAt: 'ASC' }" ref="fileTable">
+        <PagingTable
+            url="/form/fileds"
+            :where="{ formId: selectedBase?.id }"
+            :order="{ createdAt: 'ASC' }"
+            ref="fileTable"
+        >
             <template #filter>
             <template #filter>
                 <ElButton :icon="Plus" @click="onFiledEdit()">添加</ElButton>
                 <ElButton :icon="Plus" @click="onFiledEdit()">添加</ElButton>
                 <ElButton :icon="Refresh" @click="fileTable.refresh()"></ElButton>
                 <ElButton :icon="Refresh" @click="fileTable.refresh()"></ElButton>
@@ -112,7 +117,7 @@
         >
         >
             <ElInput v-model="filedModel.optionsValue" placeholder="选项值">
             <ElInput v-model="filedModel.optionsValue" placeholder="选项值">
                 <template #append>
                 <template #append>
-                    <el-button type="text" @click="editOptions(filedModel)">编辑 </el-button>
+                    <el-button type="text" @click="openOptions">编辑 </el-button>
                 </template>
                 </template>
             </ElInput>
             </ElInput>
         </ElFormItem>
         </ElFormItem>
@@ -122,13 +127,13 @@
         <template v-if="filedModel.validate">
         <template v-if="filedModel.validate">
             <ElFormItem prop="validatorType" label="验证类型">
             <ElFormItem prop="validatorType" label="验证类型">
                 <el-select v-model="filedModel.validatorType" clearable placeholder="请选择验证类型">
                 <el-select v-model="filedModel.validatorType" clearable placeholder="请选择验证类型">
-                <el-option
-                    v-for="item in validatorTypes"
-                    :label="item.label"
-                    :value="item.value"
-                    :key="item.value"
-                ></el-option>
-            </el-select>
+                    <el-option
+                        v-for="item in validatorTypes"
+                        :label="item.label"
+                        :value="item.value"
+                        :key="item.value"
+                    ></el-option>
+                </el-select>
             </ElFormItem>
             </ElFormItem>
             <ElFormItem prop="minLength" label="最短长度">
             <ElFormItem prop="minLength" label="最短长度">
                 <ElInput v-model="filedModel.minLength" placeholder="请输入最短长度" />
                 <ElInput v-model="filedModel.minLength" placeholder="请输入最短长度" />
@@ -385,4 +390,19 @@ function confirmOptions() {
 function delOptions(index) {
 function delOptions(index) {
     options.value.splice(index, 1)
     options.value.splice(index, 1)
 }
 }
+
+function openOptions() {
+    if (filedModel.value.optionsValue) {
+        options.value = JSON.parse(filedModel.value.optionsValue)
+    } else {
+        options.value = [
+            {
+                label: '',
+                value: '',
+                type: 'string'
+            }
+        ]
+    }
+    editOptions(filedModel.value)
+}
 </script>
 </script>

+ 1 - 1
src/views/MainView.vue

@@ -118,7 +118,7 @@ const menus = computed(() => {
                     },
                     },
                     {
                     {
                         name: 'form',
                         name: 'form',
-                        title: '调查问卷'
+                        title: '企业表单管理'
                     }
                     }
                 ]
                 ]
             },
             },