From f358f667a292973618199b51552d61179181cf1d Mon Sep 17 00:00:00 2001 From: ZZJ <10913410+zzj2100@user.noreply.gitee.com> Date: 星期三, 27 七月 2022 14:23:32 +0800 Subject: [PATCH] bug修复 --- src/views/operateManage/productManage/ProductList.vue | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 109 insertions(+), 0 deletions(-) diff --git a/src/views/operateManage/productManage/ProductList.vue b/src/views/operateManage/productManage/ProductList.vue index cb71bb2..1275c1e 100644 --- a/src/views/operateManage/productManage/ProductList.vue +++ b/src/views/operateManage/productManage/ProductList.vue @@ -17,6 +17,7 @@ :data="dataList" tooltip-effect="dark" :fit="true" + :key="num" > <el-table-column label="搴忓彿" width="68"> <template slot-scope="scope">{{ scope.$index + 1 }}</template> @@ -63,6 +64,51 @@ </span> </template> </el-table-column> + + <el-table-column + width="350" + key="status" + label="瀹夎鍖呯鐞�" + align="center" + > + <template slot-scope="scope"> + <div class="uploadBox"> + <file-uploader + single + uploadPlaceholder="涓婁紶鏂囦欢" + url="/admin/api-f/file/upload" + @complete="onFileUpload($event, scope.row)" + @file-added="onFileAdded(scope.row)" + v-if="scope.row.status === 0" + /> + <div class="name" v-if="scope.row.status === 1"> + {{ scope.row.component_name }} + </div> + <div + class="cancel" + v-if="scope.row.status === 1" + @click="cancel(scope.row)" + > + 鍙栨秷 + </div> + <div + class="save" + @click="submit(scope.row)" + v-if="scope.row.status === 1" + > + 淇濆瓨 + </div> + + <div + class="save" + @click="editPcg(scope.row)" + v-if="scope.row.status === 2" + > + 缂栬緫 + </div> + </div> + </template> + </el-table-column> </el-table> </div> </div> @@ -77,16 +123,21 @@ <script> import DelBox from "@/views/operateManage/productManage/DelBox"; +import FileUploader from "@/components/subComponents/FileUpload/index"; +import { getFilePath } from "@/api/utils"; + import { getProductListByModel, setProductIsShow, setProductIndexShow, deleteProduct, + saveProductPackage, } from "@/api/product"; export default { components: { DelBox, + FileUploader, }, created() { this.getProductList(); @@ -98,6 +149,8 @@ dataList: [], showDelBox: false, delId: null, + stop: false, + num: 0, }; }, methods: { @@ -107,6 +160,9 @@ }); if (res && res.success) { this.dataList = res.data.productList; + this.dataList.forEach((item) => { + item.status = 2; + }); } }, edit() { @@ -146,6 +202,41 @@ id: id, indexShow: val, }); + }, + onFileUpload(params, row) { + row.component_name = params.filename; + console.log(row.component_name); + getFilePath(params).then((res) => { + if (res.code == 200) { + this.num++; + row.component_path = res.data; + row.status = 1; + } + }); + }, + onFileAdded() {}, + cancel(row) { + this.num++; + row.status = 0; + }, + async submit(row) { + console.log(row); + const res = await saveProductPackage({ + component_path: row.component_path, + productId: row.productId, + }); + if (res && res.success) { + this.$notify({ + type: "success", + message: "淇濆瓨鎴愬姛", + }); + row.status = 2; + this.num++; + } + }, + editPcg(row) { + this.num++; + row.status = 0; }, }, }; @@ -270,5 +361,23 @@ cursor: pointer; } } + + .uploadBox { + display: flex; + justify-content: center; + line-height: 32px; + + .cancel { + color: #0064ff; + margin: 0 10px; + margin-left: 35px; + cursor: pointer; + } + + .save { + color: #0064ff; + cursor: pointer; + } + } } </style> \ No newline at end of file -- Gitblit v1.8.0