Browse Source

Merge branch 'dev_v1.0.0' of http://git.qmth.com.cn/sop/web into dev_v1.0.0

刘洋 1 year ago
parent
commit
6156593505
1 changed files with 17 additions and 1 deletions
  1. 17 1
      src/views/sop/components/metadata-content.vue

+ 17 - 1
src/views/sop/components/metadata-content.vue

@@ -4,6 +4,7 @@
     <p v-for="(cont, cindex) in optionValData" :key="cindex">{{ cont }}</p>
   </div>
   <div v-else-if="config.code === 'DATE'">{{ timestampFilter(value * 1) }}</div>
+  <div v-else-if="IS_RADIO_WITH_INPUT">{{ radioWithInputVal }}</div>
   <div v-else>{{ value }}</div>
 </template>
 
@@ -21,6 +22,9 @@ const props = defineProps({
   value: { type: [String, Number] },
 });
 
+const IS_RADIO_WITH_INPUT = computed(() => {
+  return 'RADIO_WITH_INPUT' === props.config.code;
+});
 const IS_SIMPLE_TYPE = computed(() => {
   return ['NUMBER', 'TEXTAREA', 'TEXT'].includes(props.config.code);
 });
@@ -39,7 +43,6 @@ const optionValData = computed(() => {
   options.forEach((item) => {
     optionDict[item.value] = item.label;
   });
-
   const isMultiple = ['MULTIPLE_SELECT', 'CHECKBOX'].includes(
     props.config.code
   );
@@ -50,4 +53,17 @@ const optionValData = computed(() => {
     return [optionDict[props.value]];
   }
 });
+
+const radioWithInputVal = computed(() => {
+  const options =
+    typeof props.config.options === 'string'
+      ? JSON.parse(props.config.options)
+      : props.config.options;
+  let optionDict = {};
+  options.forEach((item) => {
+    optionDict[item.value] = item.label;
+  });
+  const val = props.value ? JSON.parse(props.value) : { input: '', value: '' };
+  return val.input || optionDict[val.value];
+});
 </script>