zhangjie 1 жил өмнө
parent
commit
3a78ffc36f

+ 1 - 1
src/style/global.less

@@ -481,7 +481,7 @@ body {
     .sop-step-body {
       flex-grow: 2;
       overflow: auto;
-      padding: 15px;
+      padding: 15px 15px 30px;
     }
     .sop-step-footer {
       flex-grow: 0;

+ 9 - 0
src/views/sop/components/dynamic-form-item/BIG_TITLE.vue

@@ -0,0 +1,9 @@
+<template>
+  <div class="form-group-title">{{ config.title }}</div>
+</template>
+
+<script setup name="BIGTITLE">
+const props = defineProps({
+  config: { type: Object },
+});
+</script>

+ 2 - 1
src/views/sop/components/dynamic-form-item/SELECT.vue

@@ -26,11 +26,12 @@ const isMultiple = computed(() => {
 const options = ref([]);
 const getOptionsApi = () => {
   request({
-    url: config.dataGrid,
+    url: props.config.dataGrid,
     method: 'post',
   });
 };
 const getOptions = async () => {
+  if (!props.config.dataGrid) return;
   const { data } = useRequest(getOptionsApi);
   // TODO: 将接口数据转换成options
   options.value = data;

+ 2 - 2
src/views/sop/components/dynamic-form-item/TEXTAREA.vue

@@ -16,8 +16,8 @@ const emit = defineEmits(['update:modelValue', 'change']);
 const valueData = ref('');
 
 const emitChange = () => {
-  emit('update:modelValue', tableData.value);
-  emit('change', tableData.value);
+  emit('update:modelValue', valueData.value);
+  emit('change', valueData.value);
 };
 
 watch(

+ 5 - 6
src/views/sop/components/dynamic-form-item/index.vue

@@ -4,11 +4,7 @@
     :name="config.formName"
     class="my-form-item"
   >
-    <div v-if="isBigTitle" class="top-label flex items-center">
-      <p>{{ config.title }}</p>
-    </div>
     <component
-      v-else
       :is="tabComp"
       v-model="valueData"
       :config="config"
@@ -16,6 +12,7 @@
     ></component>
   </t-form-item>
 </template>
+
 <script setup name="DynamicFormItem">
 import { computed, ref, watch } from 'vue';
 import TEXT from './TEXT.vue';
@@ -28,15 +25,15 @@ import TEXTAREA from './TEXTAREA.vue';
 import UPLOADIMAGE from './UPLOAD_IMAGE.vue';
 import RADIOWITHINPUT from './RADIO_WITH_INPUT.vue';
 import NUMBER from './NUMBER.vue';
+import BIGTITLE from './BIG_TITLE.vue';
 
+// 待完善
 import SIGN from './SIGN.vue';
-
 import DEVICEOUTTABLE from './DEVICE_OUT_TABLE.vue';
 import DEVICEINTABLE from './DEVICE_IN_TABLE.vue';
 
 const props = defineProps({
   config: { type: Object },
-  modelValue: { type: String },
 });
 const emit = defineEmits(['change']);
 
@@ -62,6 +59,8 @@ const tabComps = {
   RADIO_WITH_INPUT: RADIOWITHINPUT,
   DEVICE_OUT_TABLE: DEVICEOUTTABLE,
   DEVICE_IN_TABLE: DEVICEINTABLE,
+  FORM_GROUP_TITLE: BIGTITLE,
+  ONLY_TITLE: BIGTITLE,
 };
 const tabComp = computed(() => {
   return tabComps[props.config.code];

+ 4 - 3
src/views/sop/components/dynamic-form-item/table/index.vue

@@ -58,7 +58,7 @@ const showEditColumnDialog = ref(false);
 const curRow = ref(null);
 
 const readonly = computed(() => {
-  return !prop.config.writable;
+  return !props.config.writable;
 });
 
 const tableColumns = computed(() => {
@@ -91,7 +91,7 @@ const tableColumns = computed(() => {
   return ncolumns;
 });
 const formColumns = computed(() => {
-  return props.columns.filter((item) => item.colKey !== 'operate');
+  return tableColumns.value.filter((item) => item.colKey !== 'operate');
 });
 
 const rowData = props.config.tablePropList.reduce((row, item) => {
@@ -132,7 +132,8 @@ watch(
   () => props.modelValue,
   (val, oldval) => {
     if (val === oldval) return;
-    tableData.value = val.map((item) => {
+    const vals = val || [];
+    tableData.value = vals.map((item) => {
       return { ...item, key: randomCode() };
     });
   },

+ 2 - 2
src/views/sop/sop-manage/sop-step/index.vue

@@ -314,8 +314,8 @@ const curFormConfig = computed(() => {
       item.writable = true;
       item.value = allFormData.value[item.formName];
     } else if (IS_FILL_MODE.value) {
-      // item.value = item.value ? JSON.parse(item.value).value : null;
-      item.value = null;
+      item.value = item.value ? JSON.parse(item.value).value : null;
+      // item.value = null;
     }
   });
   return formProperty;