haoxuan
2024-04-09 fd78adcc4e60321cdcfad0f136476c009c37c5aa
产品登记表的样式调整
1个文件已修改
106 ■■■■ 已修改文件
src/views/productManage/productRegisterForm/index.vue 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/productRegisterForm/index.vue
@@ -13,7 +13,6 @@
          <template slot="tableButton">
            <el-table-column label="操作" width="180">
              <template slot-scope="scope">
                <el-button @click="viewClick(scope.row)" type="text" size="small">查看</el-button>
                <el-button @click="editClick(scope.row)" type="text" size="small">编辑</el-button>
                <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button>
              </template>
@@ -30,6 +29,7 @@
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import { getRegisterList,getDeleteRegister } from "@/api/productManage/productRegisterForm.js"
export default {
  name: "productRegisterForm",
  props: {},
@@ -40,13 +40,14 @@
    return {
      loading: false,
      tableList: {},
      keyword: '',
      tableColumn: [
        { label: "编号", prop: "name", min: 100, default: true },
        { label: "编号", prop: "number", min: 100, default: true },
        { label: "生产时间", prop: "member_name" },
        { label: "车组", prop: "client_level" },
        { label: "规格", prop: "next_visit_time", min: 90 },
        { label: "车间", prop: "detail_address", min: 200 },
        { label: "庄口", prop: "client_status" },
        { label: "车组", prop: "workshopGroup" },
        { label: "规格", prop: "spec", min: 90 },
        { label: "车间", prop: "name", min: 200 },
        { label: "庄口", prop: "market" },
        { label: "回数", prop: "contact_name", isContactClick: true },
        { label: "车组总产量", prop: "contact_phone" }
      ],
@@ -55,11 +56,12 @@
  },
  created() {
    this.setTable()
    this.getData(this.keyword)
  },
  methods: {
    setTable() {
      this.tableList = {
        selectIndex: true,
        selectIndex: false,
        tableInfomation: [],
        allcol: [],
        showcol: this.showCol,
@@ -85,26 +87,84 @@
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
     // 请求数据
     async getData() {
      this.loading = true
      await getRegisterList({
        keyword: this.keyword,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
            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 = []
            }
          } else {
            this.tableList.tableInfomation = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableList.tableInfomation = []
          this.loading = false
        })
    },
    // 搜索
    onFilterSearch(searchText) {
      console.log(searchText)
      this.keyword = searchText ?? ""
      this.pagerOptions.currPage = 1
      this.getData()
    },
    // 新增
    addBtnClick() {
      this.$router.push({ name: "addProductRegisterPage" })
    },
    // 查看
    viewClick(row) {
      console.log(row)
    },
    // 编辑
    editClick(row) {
      console.log(row)
      this.$router.push({
         name:'addProductRegisterPage',
         query:{
            id:row.ID,
            inspectID:row.finenessCheckID,
          }
        });
    },
    // 删除
    delClick(row) {
      console.log(row)
    }
    delClick(id) {
      this.$confirm("请确认是否删除,删除操作不可撤销?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          getDeleteRegister({ id: id }).then((response) => {
            if (response.code === 200) {
              this.$message.success("删除成功")
              this.getData()
            } else {
              this.$message.warning("删除失败")
            }
          })
        })
        .catch(() => {})
    },
  }
}
</script>
@@ -126,7 +186,19 @@
    margin: 0 30px;
    background-color: #fff;
    padding: 10px 15px;
    height: calc(100% - 180px);
    height: calc(100% - 160px);
    border-radius: 12px;
  }
    .list-view {
      height: calc(100% - 60px);
      overflow: hidden;
    }
    .btn-pager {
      display: flex;
      margin-top: 10px;
      .page {
        margin-left: auto;
      }
    }
}
</style>