YY hace 1 año
padre
commit
21bc8249e5
Se han modificado 1 ficheros con 47 adiciones y 65 borrados
  1. 47 65
      src/views/product/detail.vue

+ 47 - 65
src/views/product/detail.vue

@@ -28,18 +28,11 @@
             <template #type>
               <el-option v-for="(i, index) in product_typeList" :key="index" :label="i.label" :value="i.value"></el-option>
             </template>
-            <template #roadshow="{ item }">
-              <cUpload :model="item.model" :limit="1" url="/files/zkzx/product/upload" :list="form[item.model]" @change="onUpload"></cUpload>
+            <template #roadshow>
+              <cUpload :model="`${'roadshow'}`" :limit="1" url="/files/zkzx/product/upload" :list="form.roadshow" @change="onUpload"></cUpload>
             </template>
-            <template #file="{ item }">
-              <cUpload
-                :model="item.model"
-                :limit="6"
-                url="/files/zkzx/product/upload"
-                :list="form[item.model]"
-                listType="picture-card"
-                @change="onUpload"
-              ></cUpload>
+            <template #file>
+              <cUpload :model="`${'file'}`" :limit="6" url="/files/zkzx/product/upload" :list="form.file" listType="picture-card" @change="onUpload"></cUpload>
             </template>
             <template #patent>
               <el-col :span="24" class="logs">
@@ -151,11 +144,50 @@ const search = async () => {
 };
 const dataChange = (e: { model: string; value: any }) => {
   const { model, value } = e;
-  if (model == 'type') {
-    if (value == '0') valueOne(); // 科技需求
-    else if (value == '1') valueTwo(); // 科技成果
-    else if (value == '2') valueThr(); // 商务服务
+  if (model == 'type') getFields(value);
+};
+const getFields = (type) => {
+  let list: any = [];
+  if (type == '0') {
+    list = [
+      { label: '需求紧急程度', model: 'demand', type: 'select' },
+      { label: '所属领域', model: 'field', type: 'select' },
+      { label: '投资预算', model: 'budget' },
+      { label: '合作方式', model: 'cooperation', type: 'select' },
+      { label: '技术说明', model: 'requirementdesc' },
+      { label: '预期目标', model: 'expect' },
+      { label: '需求现状', model: 'present' },
+      { label: '合作条件及要求', model: 'condition' },
+      { label: '产品图片(6)', model: 'file', custom: true }
+    ];
+  } else if (type == '1') {
+    list = [
+      { label: '所属领域', model: 'field', type: 'select' },
+      { label: '合作方式', model: 'cooperation', type: 'select' },
+      { label: '成果状态', model: 'achievestatus', type: 'select' },
+      { label: '成果权属', model: 'achieveown' },
+      { label: '成果来源', model: 'achievesource', type: 'select' },
+      { label: '意向价格', model: 'intentionprice' },
+      { label: '专利信息', model: 'patent', custom: true }, //Array
+      { label: '项目路演', model: 'roadshow', custom: true }, //Array
+      { label: '成果简介', model: 'achievebrief', type: 'textarea' },
+      { label: '技术特点', model: 'features' },
+      { label: '技术团队', model: 'team' },
+      { label: '商业预期', model: 'expect' },
+      { label: '合作条件及要求', model: 'condition' },
+      { label: '产品图片(6)', model: 'file', custom: true }
+    ];
+  } else if (type == '2') {
+    list = [
+      { label: '信息属性', model: 'messattribute', type: 'select' },
+      { label: '需求程度', model: 'demand', type: 'select' },
+      { label: '信息描述', model: 'informationdesc', type: 'textarea' },
+      { label: '核心要素', model: 'coreelements' },
+      { label: '价格信息', model: 'priceinfo' },
+      { label: '商业预期', model: 'expect' }
+    ];
   }
+  formFields.value = [...infoFields.value, ...list];
 };
 // 任职记录
 const add = () => {
@@ -165,56 +197,6 @@ const add = () => {
 const del = (e) => {
   form.value.patent = form.value.patent.filter((i) => i.id != e.id);
 };
-// 科技需求
-const valueOne = () => {
-  let field = [
-    { label: '需求紧急程度', model: 'demand', type: 'select' },
-    { label: '所属领域', model: 'field', type: 'select' },
-    { label: '投资预算', model: 'budget' },
-    { label: '合作方式', model: 'cooperation', type: 'select' },
-    { label: '技术说明', model: 'requirementdesc' },
-    { label: '预期目标', model: 'expect' },
-    { label: '需求现状', model: 'present' },
-    { label: '合作条件及要求', model: 'condition' },
-    { label: '产品图片(6)', model: 'file', custom: true }
-  ];
-  formFields.value = [];
-  formFields.value = [...infoFields.value, ...field];
-};
-// 技术成果
-const valueTwo = () => {
-  let field = [
-    { label: '所属领域', model: 'field', type: 'select' },
-    { label: '合作方式', model: 'cooperation', type: 'select' },
-    { label: '成果状态', model: 'achievestatus', type: 'select' },
-    { label: '成果权属', model: 'achieveown' },
-    { label: '成果来源', model: 'achievesource', type: 'select' },
-    { label: '意向价格', model: 'intentionprice' },
-    { label: '专利信息', model: 'patent', custom: true }, //Array
-    { label: '项目路演', model: 'roadshow', custom: true }, //Array
-    { label: '成果简介', model: 'achievebrief', type: 'textarea' },
-    { label: '技术特点', model: 'features' },
-    { label: '技术团队', model: 'team' },
-    { label: '商业预期', model: 'expect' },
-    { label: '合作条件及要求', model: 'condition' },
-    { label: '产品图片(6)', model: 'file', custom: true }
-  ];
-  formFields.value = [];
-  formFields.value = [...infoFields.value, ...field];
-};
-// 商务服务
-const valueThr = () => {
-  let field = [
-    { label: '信息属性', model: 'messattribute', type: 'select' },
-    { label: '需求程度', model: 'demand', type: 'select' },
-    { label: '信息描述', model: 'informationdesc', type: 'textarea' },
-    { label: '核心要素', model: 'coreelements' },
-    { label: '价格信息', model: 'priceinfo' },
-    { label: '商业预期', model: 'expect' }
-  ];
-  formFields.value = [];
-  formFields.value = [...infoFields.value, ...field];
-};
 const onUpload = (e: { model: string; value: Array<[]> }) => {
   const { model, value } = e;
   form.value[model] = value;