Browse Source

同步云极审批流修改

jzy 1 year ago
parent
commit
3bc767c357

+ 26 - 6
src/components/designer/DesignerSetting.vue

@@ -7,7 +7,20 @@ const formDesignerStore = useFormDesignerStore()
 const { formProps, formSpan } = storeToRefs(formDesignerStore)
 
 // 组件属性
-const compData: any = computed(() => formDesignerStore.curFormItem)
+const compData: any = computed(() => {
+  if (formDesignerStore.curFormItem.type == 'time-select') {
+    if (formDesignerStore.curFormItem.props.start) {
+      selectStart.value = formDesignerStore.curFormItem.props.start
+    }
+    if (formDesignerStore.curFormItem.props.step) {
+      selectStep.value = formDesignerStore.curFormItem.props.step
+    }
+    if (formDesignerStore.curFormItem.props.end) {
+      selectEnd.value = formDesignerStore.curFormItem.props.end
+    }
+  }
+  return formDesignerStore.curFormItem
+})
 const handleCompTypeChange = (type: string) => {
   let formItem: any
   comps.forEach(comp => {
@@ -20,6 +33,9 @@ const handleCompTypeChange = (type: string) => {
   formDesignerStore.setCurFormItem(compToFormItem(formItem))
   // formDesignerStore.curFormItem.type = type
 }
+let selectStart = ref('9:00')
+let selectEnd = ref('18:30')
+let selectStep = ref('00:30')
 
 // 日期类型
 const dateType = ref(['year', 'month', 'date', 'dates', 'datetime', 'week', 'datetimerange', 'daterange', 'monthrange'])
@@ -39,7 +55,11 @@ const handleAddOption = () => {
 const handleDelOption = (index: number) => {
   compData.value.options.splice(index, 1)
 }
-
+const setStart = () => {
+  compData.value.props.start = selectStart.value
+  compData.value.props.step = selectStep.value
+  compData.value.props.end = selectEnd.value
+}
 const marks = ref({
   6: '6',
   8: '8',
@@ -81,7 +101,7 @@ watch(
           <el-form-item label="组件栅格">
             <el-slider :max="24" v-model="compData.span" :marks="marks" class="mb-10px"></el-slider>
           </el-form-item>
-          <el-form-item label="默认值" v-if="compData.type !== 'date-picker'">
+          <el-form-item label="默认值" v-if="compData.type !== 'date-picker' && compData.type != 'time-picker'">
             <el-input v-model="compData.value"></el-input>
           </el-form-item>
           <el-form-item label="列表显示">
@@ -217,13 +237,13 @@ watch(
           <!-- time-select属性 begin -->
           <template v-if="compData.type === 'time-select'">
             <el-form-item label="起始时间">
-              <el-input v-model="compData.props.start" placeholder="08:30"></el-input>
+              <el-input v-model="selectStart" placeholder="09:00" @blur="setStart"></el-input>
             </el-form-item>
             <el-form-item label="结束时间">
-              <el-input v-model="compData.props.end" placeholder="18:30"></el-input>
+              <el-input v-model="selectEnd" placeholder="18:00" @blur="setStart"></el-input>
             </el-form-item>
             <el-form-item label="步长">
-              <el-input v-model="compData.props.step" placeholder="00:15"></el-input>
+              <el-input v-model="selectStep" placeholder="00:30" @blur="setStart"></el-input>
             </el-form-item>
           </template>
           <!-- time-select属性 begin -->

+ 7 - 1
src/components/form/FormComp.vue

@@ -115,7 +115,13 @@ const headers = reactive({
       </el-radio>
     </template>
     <template v-if="item.type === 'checkbox-group'">
-      <el-checkbox v-for="(option, index) in item.options" :label="option.label" :key="index" v-bind="option.props">
+      <el-checkbox
+        v-for="(option, index) in item.options"
+        :label="option.label"
+        :value="option.value"
+        :key="index"
+        v-bind="option.props"
+      >
         {{ option.value }}
       </el-checkbox>
     </template>

+ 1 - 1
src/utils/utils.ts

@@ -41,7 +41,7 @@ export const compToFormItem = (comp: any) => {
   const formItem: BasicFormItem = {
     id,
     label: comp.name,
-    value: '',
+    value: comp.type == 'checkbox-group' ? [] : '',
     name: comp.type + '_' + id,
     type: comp.type,
     children: [],