ソースを参照

修改图片,没有上传图片时会变空掉

jf 5 年 前
コミット
a84735b766
1 ファイル変更18 行追加7 行削除
  1. 18 7
      ghs/src/views/item/list.vue

+ 18 - 7
ghs/src/views/item/list.vue

@@ -61,11 +61,12 @@
 			<span v-if="!costPrice">{{ scope.row.cost }}</span>
 			<el-input style="width:50%;" ref="sort-input" focus size="mini" v-else v-model="scope.row.cost" @blur="changeSort(scope.row, 'cost')" ></el-input>
 		</template>
-		<template #table-header-addPrice>
+		<template #table-header-addPrice="{scope}">
 			<div class="set-sort">
 				<span>每扎加价</span>
 				<el-button v-if="!canAddPrice" icon="el-icon-edit-outline" size="small" type="text" @click="showAddPrice" class="show"></el-button>
-				<el-button class="hide" v-else size="mini" @click="hideSort" type="primary">完成</el-button>
+				<el-button class="hide" v-if="canAddPrice"  size="mini" @click="changeAllSort(scope)" type="primary">批</el-button>
+				<el-button class="hide" v-if="canAddPrice"  size="mini" @click="hideSort" type="primary">完成</el-button>
 			</div>
 		</template>
       	<template #table-column-addPrice="{scope}">
@@ -87,6 +88,9 @@
 
       <template #slot-add-goods-btn>
         <el-button type="primary" size="mini" @click="addFn()">添加</el-button>
+      </template>
+		<template #slot-addNew-goods-btn>
+        <el-button type="primary" size="mini" @click="addFn()">新增</el-button>
       </template>
 
     </x-crud>
@@ -124,7 +128,7 @@
 					</el-form-item>
 
           <el-form-item label="图片" prop="cover">
-						<cl-upload v-model="replaceForm.cover" :success="uploadSuccess"></cl-upload>
+						<cl-upload v-model="replaceForm.cover" :successFun="uploadSuccess"></cl-upload>
 						<p style="font-size: 14px; color: #cccccc">建议上传图片比例 400X400</p>
 					</el-form-item>
 
@@ -328,9 +332,13 @@ export default {
 			this.addDialog = false;
 		},
     replaceConfirmFn() {
+		let replaceForm = this.$util.copyObject(this.replaceForm)
+		if(this.replaceForm.cover.substr(0,4).toLowerCase() == "http"){
+			replaceForm.cover = this.replaceForm.shortCover;
+		}
       this.$refs.replaceForm.validate((valid) => {
         if(valid) {
-          this.$service.product.update(this.replaceForm).then(res => {
+          this.$service.product.update(replaceForm).then(res => {
             console.log('res1111', res)
             this.$message.success('操作成功!');
             this.addDialog = false
@@ -393,7 +401,7 @@ export default {
               prop: 'addPrice',
               label: '每扎加价',
               align: 'center',
-              'min-width': 120
+              'min-width': 150
             },
             {
               prop: 'weight',
@@ -449,13 +457,13 @@ export default {
         })
         .set('layout', [
           ['slot-tabs'],
-          ['flex1', 'slot-add-goods-btn', 'refresh-btn'],
+          ['flex1', 'slot-addNew-goods-btn','slot-add-goods-btn', 'refresh-btn'],
           ['data-table'],
           ['flex1', 'pagination']
         ])
         .done();
       app.refresh({ classId: this.classId});
-      app.refresh({ showPage: 1 });
+      app.refresh({ showPage: 1, });
     },
     uploadSuccess() {
 			console.log(this.$refs['replaceForm'].validateField('cover'))
@@ -521,6 +529,9 @@ export default {
         }
       })
     },
+	  changeAllSort(e){
+    	console.log(e,'1111');
+	  },
     changeSort (d, type) {
       this.dataList.form.type = type
       let obj = {