| | |
| | | ref="tableListRef" |
| | | :table-list="tableList" |
| | | :show-checkcol="false" |
| | | :selectClassRow="selectRow" |
| | | @tableRowClick="clickRow" |
| | | > |
| | | <template slot="tableButton"> |
| | | <el-table-column label="操作" width="90" align="center"> |
| | | <el-table-column label="操作" width="120" align="center"> |
| | | <template slot-scope="scope"> |
| | | <span @click.stop="showDetail(scope.row)" class="cursor_pointer" style="margin-right: 10px"> |
| | | <span style="color: #2a78fb">查看</span> |
| | | </span> |
| | | <span @click.stop="editRow(scope.row)" class="cursor_pointer"> |
| | | <span style="color: #2a78fb">编辑</span> |
| | | </span> |
| | | <span @click.stop="deleteRow(scope.row)" class="cursor_pointer"> |
| | | <span style="color: #2a78fb;margin-left: 10px">删除</span> |
| | | </span> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </div> |
| | | </div> |
| | | <!-- 新建/编辑 --> |
| | | <AddProductCategoryDialog v-if="editConfig.visible" :productCategoryList="tableList.tableInfomation" @refresh="refresh" :edit-common-config="editConfig" /> |
| | | <AddProductCategoryDialog ref="addProductCategory1" v-if="editConfig.visible" :productCategoryList="categoryList" @refresh="refresh" :edit-common-config="editConfig" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import { getProductCategoryList } from "@/api/product/productCategory" |
| | | import { getProductCategoryList,deleteProductCategory } from "@/api/product/productCategory" |
| | | import AddProductCategoryDialog from "@/views/productManage/productCategory/AddProductCategoryDialog" |
| | | |
| | | import {getTreeData} from '@/common/untils/index.js'; |
| | | export default { |
| | | name: "ProductCategory", |
| | | props: {}, |
| | |
| | | computed: {}, |
| | | data() { |
| | | return { |
| | | selectRow:{}, |
| | | tableList: {}, |
| | | categoryList:[], |
| | | searchOptions: [], |
| | | editConfig: { |
| | | visible: false, |
| | | title: "新建", |
| | | infomation: {}, |
| | | infomation: {parentId:0}, |
| | | autoEdit: false |
| | | } |
| | | } |
| | |
| | | this.getData() |
| | | }, |
| | | methods: { |
| | | clickRow(row){ |
| | | if(row.id===this.selectRow.id){ |
| | | this.selectRow={}; |
| | | }else{ |
| | | this.selectRow={...row}; |
| | | } |
| | | }, |
| | | setTable() { |
| | | this.tableList = { |
| | | key:"id", |
| | | tableInfomation: [], |
| | | selectBox: false, |
| | | selectIndex: true, |
| | |
| | | pageSize: this.pagerOptions.pageSize |
| | | }).then((res) => { |
| | | if (res.code === 200) { |
| | | const list = res.data?res.data:[] |
| | | this.tableList.tableInfomation = list |
| | | this.pagerOptions.totalCount = res.total |
| | | const list = res.data?res.data:[]; |
| | | this.categoryList=list; |
| | | this.tableList.tableInfomation = getTreeData(list,'child'); |
| | | this.pagerOptions.totalCount = res.total; |
| | | } |
| | | }) |
| | | }, |
| | |
| | | editRow(row){ |
| | | this.editConfig.autoEdit = true |
| | | this.editConfig.title = "编辑" |
| | | this.editConfig.infomation = { ...row } |
| | | this.editConfig.infomation = { ...row }; |
| | | this.editConfig.visible = true |
| | | }, |
| | | // 新建 |
| | |
| | | forceRemovalStrategy:null, |
| | | inventoryValuation:null, |
| | | name:'', |
| | | parentId:null, |
| | | parentId:this.selectRow.id||0, |
| | | } |
| | | this.editConfig.visible = true |
| | | }, |
| | | |
| | | //删除 |
| | | deleteRow(row){ |
| | | this.$confirm('此操作将永久删除该产品类型, 是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | deleteProductCategory({ |
| | | id: row.id, |
| | | }).then((res) => { |
| | | if (res.code == 200) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '删除成功!', |
| | | }) |
| | | this.getData() |
| | | }else{ |
| | | this.$message.error('删除时出错,请稍后重试或联系管理员...'); |
| | | |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => {}) |
| | | } |
| | | } |
| | | } |