yangfeng
2023-08-29 5159d19ed210ec3e14d157f9ae6221299bd46e34
src/views/purchaseManage/purchase/index.vue
@@ -23,7 +23,7 @@
          <template slot="tableButton">
            <el-table-column label="操作" width="120" fixed="right">
              <template slot-scope="scope">
                <el-button type="text"  size="small" @click="editClick"  style="margin-right: 5px"
                <el-button type="text"  size="small" @click="editClick(scope.row)"  style="margin-right: 5px"
                  >编辑</el-button
                >
                <el-button  @click="submitClick(scope.row)" type="text" size="small">提交</el-button>
@@ -40,19 +40,25 @@
    <!-- 新建/编辑销售线索 -->
    <!-- <AddSalesLeadDialog v-if="editSalesLeadConfig.visible" :edit-rightContent-config="editSalesLeadConfig" /> -->
    <!-- 详情 -->
    <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail" @submitClick="submitClick" />
    <DetailSupplier v-if="commonDetail.visible" :common-detail="commonDetail"  />
    <!-- 新建/编辑 -->
    <AddPurchase v-if="editConfig.visible" :edit-common-config="editConfig" />
  </div>
</template>
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import { getSalesLeadsList, getDeleteSalesLeads } from "@/api/client/salesLead"
import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import {
  getPurchaseList,getPurchaseInfo,submitPurchase,
} from "@/api/purchaseManage/purchase";
import DetailSupplier from "@/views/purchaseManage/purchase/DetailSupplier"
import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
import { getDataByType } from "@/api/data";
export default {
  name: "SupplierManage",
  props: {},
  components: { DetailSupplier },
  components: { DetailSupplier,AddPurchase },
  mixins: [pageMixin],
  computed: {},
  data() {
@@ -63,7 +69,14 @@
        visible: false,
        infomation: {}
      },
      search_map: {}
      search_map: {},
      editRow:{},
      editConfig: {
        visible: false,
        title: "创建",
        infomation: {}
      },
      purchaseStatusList:getDataByType('purchaseStatus'),
    }
  },
  created() {
@@ -77,9 +90,9 @@
        selectIndex: true,
        tableColumn: [
          { label: "采购单号", prop: "number", min: 150, isCommonClick: true },
          { label: "采购单名称", prop: "name", min: 130,},
          { label: "采购单名称", prop: "name", min: 130, isCommonClick: true},
          { label: "单据类型", prop: "contact_name", min: 130 },
          { label: "供应商名称", prop: "contact_phone", min: 130 },
          { label: "供应商名称", prop: "contact", min: 130 },
          { label: "采购数量", prop: "sales_resources", min: 130 },
          { label: "收货仓库", prop: "province", min: 130 },
          { label: "经办人", prop: "city", min: 130 },
@@ -90,23 +103,17 @@
    },
    // 请求数据
    async getData() {
      await getSalesLeadsList({
        search_map: this.search_map,
      await getPurchaseList({
        keyword: this.search_map,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
        .then((res) => {
          const list = res.data.list.map((item) => {
            return {
              ...item,
              province: item.Province.name,
              city: item.City.name,
              sales_resources: item.sales_sources.name,
              member_name: item.member.username
            }
          })
          this.tableList.tableInfomation = list || []
          this.pagerOptions.totalCount = res.data.count
          if (res.data.code === 200) {
            const list = res.data.data.list
            this.tableList.tableInfomation = list || []
            this.pagerOptions.totalCount = res.data.data.total
          }
        })
        .catch((err) => {
          console.log(err)
@@ -125,13 +132,44 @@
      this.getData()
    },
    // 新建
    addBtnClick() {},
    addBtnClick() {
      // this.editRow = {};
      // this.$refs.add.islook = true;
      this.editConfig.visible = true
      this.editConfig.title = "创建"
      this.editConfig.infomation = {
        productList:[],
        supplierId:'',
          signingDate:'',
          remark:'',
          purchaseTypeId:'',
          phone:'',
          name:'',
          deliveryDate:'',
          contact:''
       }
    },
    // 编辑
    editClick(){
    editClick(row){
      getPurchaseInfo({id:row.ID}).then((res) => {
        if (res.code == 200) {
          this.editConfig.visible = true
          this.editConfig.title = "编辑"
          this.editConfig.infomation = {
            productList:res.data.productList,
            ...res.data.purchase
           }
        }else{
          this.$message.error(res.msg?res.msg+',':''+'获取信息失败!')
        }
      })
      // this.editRow = row;
      // this.$refs.add.islook = true;
    },
    // 确认发货
    submitClick() {
    submitClick(row) {
        this.$confirm("是否提交?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
@@ -139,7 +177,7 @@
        })
          .then(() => {
            console.log("dddd")
            getDeleteSalesLeads({ ids: this.selValueList }).then((response) => {
            submitPurchase({ id: row.ID }).then((response) => {
              if (response.code === 200) {
                this.$message.success("提交成功")
                this.getData()
@@ -154,8 +192,17 @@
    // 详情
    selCommonClick(row) {
      console.log(row)
      this.commonDetail.visible = true
      this.commonDetail.infomation = { ...row }
      getPurchaseInfo({id:row.ID}).then((res) => {
        if (res.code == 200) {
          this.commonDetail.visible = true
          this.commonDetail.infomation = {
            productList:res.data.productList,
            ...res.data.purchase
           }
        }else{
          this.$message.error(res.msg?res.msg+',':''+'获取信息失败!')
        }
      })
    }
  }
}