|
@@ -1,9 +1,10 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { onMounted, inject, ref, onBeforeUnmount } from 'vue'
|
|
|
-import { getProductCardData } from '/@/views/productCenter/productList/api'
|
|
|
+import { Delete, Edit } from '@element-plus/icons-vue'
|
|
|
import * as echarts from 'echarts'
|
|
|
-import { Edit, Delete } from '@element-plus/icons-vue'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import { inject, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
|
import emitter from '/@/utils/emitter'
|
|
|
+import { getProductCardData, postDeleteProductLine } from '/@/views/productCenter/productList/api'
|
|
|
|
|
|
const profile = <any>inject('profile')
|
|
|
|
|
@@ -88,6 +89,24 @@ function editCard(item) {
|
|
|
emitter.emit('ProductTab-editProductCard', { isVisible: true, data: item })
|
|
|
}
|
|
|
|
|
|
+async function deleteProductLine(item) {
|
|
|
+ const obj = {
|
|
|
+ productlineId: item.productlineId,
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const response = await postDeleteProductLine(obj)
|
|
|
+ if (response.data.code == 'success') {
|
|
|
+ ElMessage({ message: '已删除', type: 'success' })
|
|
|
+ await fetchProductCardData()
|
|
|
+ emitter.emit('ProductSelectCard-reloading', { reloading: true })
|
|
|
+ } else {
|
|
|
+ ElMessage({ message: '删除失败', type: 'error' })
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log('error:', error)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
emitter.on('ProductList-updateCardData', (value: any) => {
|
|
|
if (value.isUpdate) {
|
|
|
cardData.value.splice(0)
|
|
@@ -126,11 +145,11 @@ onBeforeUnmount(() => {
|
|
|
<div class="pct-chart" :id="`chart${index}-${item.productlineId}`"></div>
|
|
|
<el-popover v-if="index !== 0" placement="bottom" :width="150" trigger="click">
|
|
|
<template #reference>
|
|
|
- <el-icon class="custom-icon" @click.stop=""><MoreFilled /></el-icon>
|
|
|
+ <el-icon class="custom-icon" @click.stop=""><Setting /></el-icon>
|
|
|
</template>
|
|
|
<div class="custom-popoer">
|
|
|
<el-button :icon="Edit" text size="small" @click="editCard(item)">编辑</el-button>
|
|
|
- <el-button :icon="Delete" text size="small" style="margin-left: 0;">删除</el-button>
|
|
|
+ <el-button :icon="Delete" text size="small" @click="deleteProductLine(item)" style="margin-left: 0">删除</el-button>
|
|
|
</div>
|
|
|
</el-popover>
|
|
|
<div class="left-part-container">
|