Ver Fonte

修改资产图片导入前端

yanwentao há 2 anos atrás
pai
commit
df9f399800

+ 10 - 0
src/components/sonicAlbumUpload/configData.js

@@ -27,6 +27,16 @@ export const resultColumns = [{
   key: 'assetNo',
   dataIndex: 'assetNo',
   width: 100,
+}, {
+  title: '主图片',
+  key: 'mainImageName',
+  dataIndex: 'mainImageName',
+  width: 100,
+}, {
+  title: '其他图片',
+  key: 'otherImageName',
+  dataIndex: 'otherImageName',
+  width: 200,
 }, {
   title: '导入结果',
   key: 'result',

+ 32 - 11
src/components/sonicAlbumUpload/index.vue

@@ -12,7 +12,7 @@
         <ImagesUpload v-show="company==''?false:true" />
         <p class="pStyle">支持拓展名:.png .jpg .jpeg .gif</p>
         <p class="pStyle">
-          <a :disabled="company==''?true:false" @click="viewImage">查看上传的图片</a>
+          <a @click="viewImage">查看上传的图片</a>
         </p>
       </div>
       <div class="step">
@@ -38,8 +38,16 @@
         <div v-show="company==''?false:true">
           <CommonTable
             ref="table" :total="totalResult" :is-select="false" :columns="resultImageColumns" :is-loading="isLoading"
-            :data-source="resultImageDatas" 
-          />
+            :data-source="resultImageDatas"
+          >
+            <template #bodyCell="{ column, record }">
+              <template v-if="column.key === 'result'">
+                <div :style="record.result === '校验成功'?style1:style2">
+                  {{ record.result }}
+                </div>
+              </template>
+            </template>
+          </CommonTable>
         </div>
       </div>
     </div>
@@ -74,9 +82,7 @@
           />
         </li>
         <li class="site">
-          <span class="labels">
-            <a-button :disabled="company==''?true:false" type="primary" @click="searchDatas">查询</a-button>
-          </span>
+          <a-button :disabled="company==''?true:false" style="margin-left: -200px;" type="primary" @click="searchDatas">查询</a-button>
         </li>
       </ul>
       <CommonTable
@@ -205,6 +211,12 @@ const viewColumns = ref(imageColumns);
 const assetImageColumns = ref(assetColumns);
 const resultImageColumns = ref(resultColumns);
 const excelFile = ref(null);
+const style1 = ref({
+  color: 'black',
+});
+const style2 = ref({
+  color: 'red',
+});
 const pager = reactive({
   start: 0,
   length: 20,
@@ -246,9 +258,11 @@ const searchDatas = debounce(() => {
 
 // 查看上传的图片
 const viewImage = () => {
-  table.value.clear();
-  imagesVisible.value = true;
-  queryUploadImage();
+  if (company.value != '') {
+    table.value.clear();
+    imagesVisible.value = true;
+    queryUploadImage();
+  }
 };
 
 // 查询上传图片接口
@@ -333,6 +347,7 @@ const testImport = () => {
           resultImageDatas.value = successData.datas;
         } else {
           message.warning(successData.errorMessage);
+          resultImageDatas.value = successData.datas;
         }
         loading.value = false;
       },
@@ -341,6 +356,8 @@ const testImport = () => {
         loading.value = false;
       },
     );
+  } else {
+    message.warning('未上传资产图片Excel,请先上传资产图片Excel后再点击测试导入!');
   }
 };
 
@@ -353,7 +370,10 @@ const importImageExcel = () => {
         message.success('正式导入资产图片Excel成功!');
         searchAsset();
       } else {
-        message.warning(successData.errorMessage);
+        var strarr = successData.errorMessage.replace(/\n+$/, '').split('\n');
+        strarr.forEach(function(item) {
+          message.warning(item);
+        });
       }
       loading.value = false;
     },
@@ -499,9 +519,10 @@ const getClient = () => {
 			justify-content: flex-start;
 		}
 
+		/* 
 		.siteList>li {
 			margin-right: 8px;
-		}
+		} */
 	}
 
 	.labels {