| | |
| | | </div> |
| | | </div> |
| | | <template> |
| | | <TableCommonView |
| | | ref="tableListRef" |
| | | :table-list="tableList" |
| | | @selCommonClick="selCommonClick" |
| | | @getSelectArray="getSelectArray" |
| | | > |
| | | <TableCommonView ref="tableListRef" :table-list="tableList" @selCommonClick="selCommonClick"> |
| | | <template slot="tableButton"> |
| | | <el-table-column label="操作" width="120"> |
| | | <template slot-scope="scope"> |
| | |
| | | |
| | | <script> |
| | | import pageMixin from "@/components/makepager/pager/mixin/pageMixin" |
| | | import { getSalesLeadsList, getDeleteSalesLeads } from "@/api/client/salesLead" |
| | | import { getProductList, deleteProduct } from "@/api/productManage/product" |
| | | import DetailProduct from "@/views/productManage/product/DetailProduct" |
| | | import AddProduct from "@/views/productManage/product/AddProduct" |
| | | |
| | |
| | | data() { |
| | | return { |
| | | tableList: {}, |
| | | selValueList: [], |
| | | searchOptions: [], |
| | | commonDetail: { |
| | | visible: false, |
| | |
| | | visible: false, |
| | | title: "新建", |
| | | infomation: {} |
| | | }, |
| | | search_map: {} |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | { label: "产品编码", prop: "number", min: 190, isCommonClick: true }, |
| | | { label: "产品名称", prop: "name", min: 130 }, |
| | | { label: "供应商", prop: "id", min: 130 }, |
| | | { label: "产品类别", prop: "contact_phone", min: 130 }, |
| | | { label: "产品类别", prop: "productType", min: 130 }, |
| | | { label: "规格", prop: "sales_resources", min: 130 }, |
| | | { label: "型号", prop: "province", min: 130 }, |
| | | { label: "单位", prop: "sales_sources_id", min: 60 }, |
| | | { label: "单位", prop: "unit", min: 60 }, |
| | | { label: "价格", prop: "contact_phone1", min: 130 }, |
| | | { label: "最低库存", prop: "desc", min: 80 }, |
| | | { label: "最高库存", prop: "member_name", min: 80 } |
| | |
| | | } |
| | | }, |
| | | // 请求数据 |
| | | async getData() { |
| | | await getSalesLeadsList({ |
| | | search_map: this.search_map, |
| | | async getData(val, content) { |
| | | await getProductList({ |
| | | val, |
| | | content, |
| | | page: this.pagerOptions.currPage, |
| | | pageSize: this.pagerOptions.pageSize |
| | | }) |
| | | .then((res) => { |
| | | const list = res.data.list.map((item) => { |
| | | }).then((res) => { |
| | | if (res.data.code === 200) { |
| | | const list = res.data.data.list.map((item) => { |
| | | return { |
| | | ...item, |
| | | sales_resources: item.sales_sources.name, |
| | | member_name: item.member.username |
| | | ...item |
| | | } |
| | | }) |
| | | this.tableList.tableInfomation = list || [] |
| | | this.pagerOptions.totalCount = res.data.count |
| | | }) |
| | | .catch((err) => { |
| | | console.log(err) |
| | | }) |
| | | this.pagerOptions.totalCount = res.data.data.total |
| | | } |
| | | }) |
| | | }, |
| | | // 搜索 |
| | | searchClick(val, content) { |
| | | console.log(val, content) |
| | | this.search_map = { |
| | | [val.value]: content |
| | | } |
| | | this.getData() |
| | | this.getData(val, content) |
| | | }, |
| | | resetClick() { |
| | | this.search_map = {} |
| | | this.getData() |
| | | }, |
| | | // 新建 |
| | |
| | | console.log(row) |
| | | this.editConfig.visible = true |
| | | this.editConfig.title = "编辑" |
| | | this.editConfig.infomation = { ...row } |
| | | }, |
| | | // 删除 |
| | | delClick() { |
| | | if (this.selValueList && this.selValueList.length > 0) { |
| | | this.$confirm("是否确认删除?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | console.log("dddd") |
| | | getDeleteSalesLeads({ ids: this.selValueList }).then((response) => { |
| | | if (response.code === 200) { |
| | | this.$message.success("删除成功") |
| | | this.getData() |
| | | } else { |
| | | this.$message.warning("删除失败") |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => {}) |
| | | } else { |
| | | this.$message.warning("请至少选择一条记录") |
| | | } |
| | | }, |
| | | getSelectArray(val) { |
| | | this.selValueList = [] |
| | | const list = val.map((item) => { |
| | | return item.id |
| | | delClick(val) { |
| | | this.$confirm("是否确认删除?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }) |
| | | this.selValueList = list |
| | | .then(() => { |
| | | deleteProduct({ id: val }).then((response) => { |
| | | if (response.code === 200) { |
| | | this.$message.success("删除成功") |
| | | this.getData() |
| | | } else { |
| | | this.$message.warning("删除失败") |
| | | } |
| | | }) |
| | | }) |
| | | .catch(() => {}) |
| | | }, |
| | | // 详情 |
| | | selCommonClick(row) { |