haoxuan
2024-02-29 76af4acbe9df51d4524fbe3039d10158c3a15bcc
纤度登记表,纤度检验表的前端开发
2个文件已添加
2个文件已修改
614 ■■■■■ 已修改文件
src/api/productManage/silkInspectForm.js 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/productManage/silkRegisterForm.js 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/silkInspectForm/index.vue 269 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/silkRegisterForm/index.vue 261 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/productManage/silkInspectForm.js
New file
@@ -0,0 +1,42 @@
import request from "@/common/untils/request.js"
// 跟进记录列表
export function getFollowRecordList(data) {
  return request({
    url: "/api/followRecord/list",
    method: "post",
    data
  })
}
// 添加跟进记录
export function getAddFollowRecord(data) {
  return request({
    url: "/api/followRecord/add",
    method: "post",
    data
  })
}
// 删除跟进记录
export function getDeleteFollowRecord(data) {
  return request({
    url: "/api/followRecord/delete",
    method: "delete",
    data
  })
}
// 更新跟进记录
export function getUpdateFollowRecord(data) {
  return request({
    url: "/api/followRecord/update",
    method: "put",
    data
  })
}
// 联系方式列表
export function getContactInfoList() {
  return request({
    url: "/api/contactInformation/list",
    method: "get"
  })
}
src/api/productManage/silkRegisterForm.js
New file
@@ -0,0 +1,42 @@
import request from "@/common/untils/request.js"
// 跟进记录列表
export function getFollowRecordList(data) {
  return request({
    url: "/api/followRecord/list",
    method: "post",
    data
  })
}
// 添加跟进记录
export function getAddFollowRecord(data) {
  return request({
    url: "/api/followRecord/add",
    method: "post",
    data
  })
}
// 删除跟进记录
export function getDeleteFollowRecord(data) {
  return request({
    url: "/api/followRecord/delete",
    method: "delete",
    data
  })
}
// 更新跟进记录
export function getUpdateFollowRecord(data) {
  return request({
    url: "/api/followRecord/update",
    method: "put",
    data
  })
}
// 联系方式列表
export function getContactInfoList() {
  return request({
    url: "/api/contactInformation/list",
    method: "get"
  })
}
src/views/productManage/silkInspectForm/index.vue
@@ -1,21 +1,268 @@
<template>
  <div class="container"></div>
  <div class="silkInspect-form">
    <div class="filter">
      <div class="filter-card">
        <CommonSearch
          :show-add="false"
          :show-download="false"
          :amount-view="false"
          :show-action-btn="false"
          placeholder="请输入关键词"
          @searchClick="onFilterSearch"
        >
          <template slot="leftButton">
            <el-button size="small" type="primary" @click="addBtnClick">新建</el-button>
            <el-button size="small" type="primary" @click="printClick">打印</el-button>
          </template>
        </CommonSearch>
      </div>
    </div>
    <div class="body">
      <div class="body-card">
        <div class="list-view">
          <TableCommonView
            ref="tableListRef"
            v-loading="loading"
            :table-list="tableList"
            @selTableCol="selTableCol"
          >
            <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>
                </template>
              </el-table-column>
            </template>
          </TableCommonView>
        </div>
        <div class="btn-pager">
          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getFollowRecordList, getDeleteFollowRecord } from "@/api/productManage/silkInspectForm.js"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
  name: "silkInspectForm",
  props: {},
  components: {},
  mixins: [],
  computed: {},
  data() {
    return {}
  name: "SilkInspectForm",
  props: {
  },
  created() {},
  methods: {}
  mixins: [pageMixin],
  components: {
  },
  data() {
    return {
      tableList: {},
      loading: false,
      searchOptions: [],
      editConfig: {
        visible: false,
        title: "新建",
        infomation: {}
      },
      search_map: {},
      tableColumn: [
        { label: "编号", prop: "topic", min: 120, default: true }, // 主题
        { label: "车间", prop: "client_name", min: 190, }, // 客户名称
        { label: "车组", prop: "contact_name", min: 100, }, // 联系人姓名
        { label: "日期", prop: "client_status", min: 100 }, // 客户状态
        { label: "平均纤度", prop: "contact_information_name", min: 100 }, // 联系方式
        { label: "公量纤度", prop: "follow_time", min: 130 }, // 联系人日期
        { label: "偏差", prop: "next_follow_time", min: 130 }, // 下次回访日期
        { label: "总差", prop: "member_name", min: 110 }, // 负责人
        { label: "车组等级", prop: "member_name", min: 110 }, // 负责人
        { label: "清洁", prop: "member_name", min: 110 }, // 负责人
        { label: "洁净", prop: "member_name", min: 110 }, // 负责人
        { label: "规格", prop: "member_name", min: 110 }, // 负责人
      ],
      showCol: [
        "编号",
        "车间",
        "车组",
        "日期",
        "平均纤度",
        "公量纤度",
        "偏差",
        "总差",
        "车组等级",
        "清洁",
        "洁净",
        "规格",
      ]
    }
  },
  created() {
    this.setTable()
    this.getData(this.search_map)
  },
  computed: {
  },
  methods: {
    setTable() {
      this.tableList = {
        selectIndex: true,
        tableInfomation: [],
        allcol: [],
        showcol: this.showCol,
        tableColumn: this.setColumnVisible(this.showCol)
      }
      this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
      this.searchOptions = []
      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
        const label = this.tableList.tableColumn[i].label
        const value = this.tableList.tableColumn[i].prop
        this.searchOptions.push({ value: value, label: label })
      }
    },
    setColumnVisible(showCol) {
      return this.tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn: showCol.includes(ele.label)
        }
      })
    },
    selTableCol(val) {
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getFollowRecordList({
        search_map: this.search_map,
        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
            } else {
              this.tableList.tableInfomation = []
            }
          } else {
            this.tableList.tableInfomation = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableList.tableInfomation = []
          this.loading = false
        })
    },
    // 搜索
    onFilterSearch(searchText) {
      this.search_map.client_name = searchText ?? ""
      this.pagerOptions.currPage = 1
      this.getData()
    },
    // 新建
    addBtnClick() {
      this.editConfig.title = "新建"
      this.editConfig.infomation = { contact_name:"",sales_leads_name:"",sale_chance_name:""}
      this.editConfig.visible = true
    },
     // 打印
     printClick(){
    },
    // 编辑
    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
    },
    // 删除
    delClick(id) {
      this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          getDeleteFollowRecord({ ids: [id] }).then((response) => {
            if (response.code === 200) {
              this.$message.success("删除成功")
              this.getData()
            } else {
              this.$message.warning("删除失败")
            }
          })
        })
        .catch(() => {})
    },
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.silkInspect-form {
  height: 100%;
  overflow: hidden;
  .filter {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 12px 20px 0 20px;
    &-card {
      height: 80px;
      display: flex;
      align-items: center;
      box-sizing: border-box;
      padding: 10px 20px;
      flex: 1;
      border-radius: 12px;
      background-color: #fff;
    }
  }
  .body {
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 12px;
    height: calc(100% - 92px);
    .body-card {
      background-color: #fff;
      border-radius: 12px;
      height: 100%;
      overflow: hidden;
    }
    .list-view {
      height: calc(100% - 60px);
      overflow: hidden;
    }
    .btn-pager {
      display: flex;
      margin-top: 10px;
      .page {
        margin-left: auto;
      }
    }
  }
}
</style>
src/views/productManage/silkRegisterForm/index.vue
@@ -1,21 +1,260 @@
<template>
  <div class="container"></div>
  <div class="silkRegister-form">
    <div class="filter">
      <div class="filter-card">
        <CommonSearch
          :show-add="false"
          :show-download="false"
          :amount-view="false"
          :show-action-btn="false"
          placeholder="请输入关键词"
          @searchClick="onFilterSearch"
        >
          <template slot="leftButton">
            <el-button size="small" type="primary" @click="addBtnClick">新建</el-button>
            <el-button size="small" type="primary" @click="printClick">打印</el-button>
          </template>
        </CommonSearch>
      </div>
    </div>
    <div class="body">
      <div class="body-card">
        <div class="list-view">
          <TableCommonView
            ref="tableListRef"
            v-loading="loading"
            :table-list="tableList"
            @selTableCol="selTableCol"
          >
            <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>
                </template>
              </el-table-column>
            </template>
          </TableCommonView>
        </div>
        <div class="btn-pager">
          <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getFollowRecordList, getDeleteFollowRecord } from "@/api/productManage/silkRegisterForm.js"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
  name: "silkRegisterForm",
  props: {},
  components: {},
  mixins: [],
  computed: {},
  data() {
    return {}
  name: "SilkRegisterForm",
  props: {
  },
  created() {},
  methods: {}
  mixins: [pageMixin],
  components: {
  },
  data() {
    return {
      tableList: {},
      loading: false,
      searchOptions: [],
      editConfig: {
        visible: false,
        title: "新建",
        infomation: {}
      },
      search_map: {},
      tableColumn: [
        { label: "编号", prop: "topic", min: 120, default: true }, // 主题
        { label: "落丝时间", prop: "client_name", min: 190, }, // 客户名称
        { label: "车组", prop: "contact_name", min: 100, }, // 联系人姓名
        { label: "规格", prop: "client_status", min: 100 }, // 客户状态
        { label: "车间", prop: "contact_information_name", min: 100 }, // 联系方式
        { label: "庄口", prop: "follow_time", min: 130 }, // 联系人日期
        { label: "开始回数", prop: "next_follow_time", min: 130 }, // 下次回访日期
        { label: "结束回数", prop: "member_name", min: 110 }, // 负责人
      ],
      showCol: [
        "编号",
        "落丝时间",
        "车组",
        "规格",
        "车间",
        "庄口",
        "开始回数",
        "结束回数",
      ]
    }
  },
  created() {
    this.setTable()
    this.getData(this.search_map)
  },
  computed: {
  },
  methods: {
    setTable() {
      this.tableList = {
        selectIndex: true,
        tableInfomation: [],
        allcol: [],
        showcol: this.showCol,
        tableColumn: this.setColumnVisible(this.showCol)
      }
      this.tableList.allcol = this.tableList.tableColumn.filter((ele) => !ele.default).map((ele) => ele.label)
      this.searchOptions = []
      for (let i = 0; i < this.tableList.tableColumn.length; i++) {
        const label = this.tableList.tableColumn[i].label
        const value = this.tableList.tableColumn[i].prop
        this.searchOptions.push({ value: value, label: label })
      }
    },
    setColumnVisible(showCol) {
      return this.tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn: showCol.includes(ele.label)
        }
      })
    },
    selTableCol(val) {
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getFollowRecordList({
        search_map: this.search_map,
        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
            } else {
              this.tableList.tableInfomation = []
            }
          } else {
            this.tableList.tableInfomation = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableList.tableInfomation = []
          this.loading = false
        })
    },
    // 搜索
    onFilterSearch(searchText) {
      this.search_map.client_name = searchText ?? ""
      this.pagerOptions.currPage = 1
      this.getData()
    },
    // 新建
    addBtnClick() {
      this.editConfig.title = "新建"
      this.editConfig.infomation = { contact_name:"",sales_leads_name:"",sale_chance_name:""}
      this.editConfig.visible = true
    },
     // 打印
     printClick(){
    },
    // 编辑
    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
    },
    // 删除
    delClick(id) {
      this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          getDeleteFollowRecord({ ids: [id] }).then((response) => {
            if (response.code === 200) {
              this.$message.success("删除成功")
              this.getData()
            } else {
              this.$message.warning("删除失败")
            }
          })
        })
        .catch(() => {})
    },
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.silkRegister-form {
  height: 100%;
  overflow: hidden;
  .filter {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 12px 20px 0 20px;
    &-card {
      height: 80px;
      display: flex;
      align-items: center;
      box-sizing: border-box;
      padding: 10px 20px;
      flex: 1;
      border-radius: 12px;
      background-color: #fff;
    }
  }
  .body {
    box-sizing: border-box;
    padding: 10px 20px;
    border-radius: 12px;
    height: calc(100% - 92px);
    .body-card {
      background-color: #fff;
      border-radius: 12px;
      height: 100%;
      overflow: hidden;
    }
    .list-view {
      height: calc(100% - 60px);
      overflow: hidden;
    }
    .btn-pager {
      display: flex;
      margin-top: 10px;
      .page {
        margin-left: auto;
      }
    }
  }
}
</style>