zuozhengqing
2024-04-09 63a5da9d6be10bbd910812c423bdfad7ae2945e5
src/views/productManage/silkRegisterForm/index.vue
@@ -30,8 +30,8 @@
            <template slot="tableButton">
              <el-table-column label="操作" width="90" fixed="right">
                <template slot-scope="scope">
                  <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
                  <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button>
                  <el-button @click="handleClick(scope.row)" type="text" size="small">修改</el-button>
                  <el-button @click="delClick(scope.row.ID)" type="text" size="small">删除</el-button>
                </template>
              </el-table-column>
            </template>
@@ -46,7 +46,7 @@
</template>
<script>
import { getRegisterList, getDeleteRegister } from "@/api/productManage/silkRegisterForm.js"
import { getRegisterList,getDeleteRegister } from "@/api/productManage/silkRegisterForm.js"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
@@ -61,12 +61,7 @@
      tableList: {},
      loading: false,
      searchOptions: [],
      editConfig: {
        visible: false,
        title: "新建",
        infomation: {}
      },
      search_map: {},
      keyword: '',
      tableColumn: [
        { label: "编号", prop: "number", min: 120, default: true }, // 主题
        { label: "落丝时间", prop: "finishDate", min: 190, }, // 客户名称
@@ -91,7 +86,7 @@
  },
  created() {
    this.setTable()
    this.getData(this.search_map)
    this.getData(this.keyword)
  },
  computed: {
  },
@@ -128,27 +123,27 @@
    async getData() {
      this.loading = true
      await getRegisterList({
        search_map: this.search_map,
        keyword: this.keyword,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
            if (res.data.list && res.data.list.length > 0) {
              const list = res.data.list.map((item) => {
                return {
                  ...item,
                  client_name: item.client.name,
                  contact_name: item.contact.name,
                  client_status: item.client_status.name,
                  phone: item.contact.phone,
                  member_name: item.member.username,
                  contact_information_name: item.contact_information.name
                }
              })
              this.tableList.tableInfomation = list || []
              this.pagerOptions.totalCount = res.data.count
            if (res.data && res.data.length > 0) {
              // const list = res.data.map((item) => {
              //   return {
              //     ...item,
              //     client_name: item.client.name,
              //     contact_name: item.contact.name,
              //     client_status: item.client_status.name,
              //     phone: item.contact.phone,
              //     member_name: item.member.username,
              //     contact_information_name: item.contact_information.name
              //   }
              // })
              this.tableList.tableInfomation =  res.data || []
              this.pagerOptions.totalCount = res.count
            } else {
              this.tableList.tableInfomation = []
            }
@@ -165,7 +160,7 @@
    },
    // 搜索
    onFilterSearch(searchText) {
      this.search_map.client_name = searchText ?? ""
      this.keyword = searchText ?? ""
      this.pagerOptions.currPage = 1
      this.getData()
    },
@@ -181,23 +176,23 @@
    },
    // 编辑
    handleClick(row) {
      console.log(row)
      this.editConfig.title = "编辑"
      let config=JSON.parse(JSON.stringify(row));
      config.client_status_id=config.client_status_id?config.client_status_id:null
      config.contact_information_id=config.contact_information_id?config.contact_information_id:null
      this.editConfig.infomation = { ...config, sale_chance_name:row.sale_chance.name, sales_leads_name: "" }
      this.editConfig.visible = true
      this.$router.push({
                path:"/productManage/silkRegisterForm/addPage",
                query:{
                  id:row.ID,
                  activeName:'first'
                }
              });
    },
    // 删除
    delClick(id) {
      this.$confirm("是否确认删除?", "警告", {
      this.$confirm("请确认是否删除,删除操作不可撤销?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          getDeleteRegister({ ids: id }).then((response) => {
          getDeleteRegister({ id: id }).then((response) => {
            if (response.code === 200) {
              this.$message.success("删除成功")
              this.getData()