yangfeng
2024-03-01 15c2636bb7cd4ae729c1cfd4c11f1324a9cd04f1
生丝定级标准列表组件开发、router配置、menu修改
2个文件已添加
4个文件已修改
592 ■■■■■ 已修改文件
src/assets/jialianlogo.png 补丁 | 查看 | 原始文档 | blame | 历史
src/components/layout/components/appsidebar/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/productRegisterForm/index.vue 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/silkStandardSetting/components/silkTableList.vue 361 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/systemSetting/silkStandardSetting/index.vue 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/jialianlogo.png
src/components/layout/components/appsidebar/index.vue
@@ -3,7 +3,7 @@
  <div class="app-sidebar">
    <div class="box">
      <div class="logo-view">
        <el-image :src="require('@/assets/logo.png')"></el-image>
        <el-image :src="require('@/assets/jialianlogo.png')"></el-image>
      </div>
      <el-menu
        router
src/router/index.js
@@ -80,7 +80,7 @@
      insIndex: true
    },
    redirect: {
      name: "supplier"
      name: "silkStandardSetting"
    },
    children: routes
  },
src/views/productManage/productRegisterForm/index.vue
@@ -3,25 +3,107 @@
    <div class="filter-card">
      <CommonSearch :show-add="false" :amount-view="false" placeholder="请输入关键词" @searchClick="onFilterSearch">
        <template slot="leftButton">
          <el-button size="small" type="primary" @click="addBtnClick">新建</el-button>
          <el-button size="small" type="primary" @click="addBtnClick">新增</el-button>
        </template>
      </CommonSearch>
    </div>
    <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="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>
            </el-table-column>
          </template>
        </TableCommonView>
      </div>
      <div class="btn-pager">
        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
      </div>
    </div>
  </div>
</template>
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
  name: "productRegisterForm",
  props: {},
  components: {},
  mixins: [],
  mixins: [pageMixin],
  computed: {},
  data() {
    return {}
    return {
      loading: false,
      tableList: {},
      tableColumn: [
        { label: "编号", prop: "name", 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: "contact_name", isContactClick: true },
        { label: "车组总产量", prop: "contact_phone" }
      ],
      showCol: ["编号", "生产时间", "车组", "规格", "车间", "庄口", "回数", "车组总产量"]
    }
  },
  created() {},
  methods: {}
  created() {
    this.setTable()
  },
  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)
    },
    // 搜索
    onFilterSearch(searchText) {
      console.log(searchText)
    },
    // 新增
    addBtnClick() {},
    // 查看
    viewClick(row) {
      console.log(row)
    },
    // 编辑
    editClick(row) {
      console.log(row)
    },
    // 删除
    delClick(row) {
      console.log(row)
    }
  }
}
</script>
@@ -37,5 +119,10 @@
    border-radius: 12px;
    background-color: #fff;
  }
  .body-card {
    margin: 0 30px;
    background-color: #fff;
    padding: 10px 15px;
  }
}
</style>
src/views/systemSetting/silkStandardSetting/components/silkTableList.vue
New file
@@ -0,0 +1,361 @@
<template>
  <div class="page-view">
    <el-form ref="form" :model="tableList" :show-message="false" label-position="right">
      <el-table
        ref="fromTable"
        :data="tableList.tableData"
        style="width: 100%"
        @selection-change="handleSelectionChange"
        :row-key="(row) => row.productId"
        :header-cell-style="{ background: '#f1f3f8', color: '#000009', 'font-size': '14px' }"
        border
      >
        <el-table-column v-if="selectBox" type="selection" :reserve-selection="true" width="40" align="center">
        </el-table-column>
        <el-table-column v-if="tableList.isReturn" type="index" label="#" width="50" align="center"></el-table-column>
        <el-table-column
          v-for="(item, i) in tableList.tableColumn"
          :key="i"
          :prop="item.prop"
          :label="item.label"
          :width="item.width"
          :min-width="item.min"
          align="center"
        >
          <!-- 表头样式 -->
          <template slot="header">
            <span v-if="item.isRequird" style="color: #f56c6c">*</span>
            <span>{{ item.label }}</span>
          </template>
          <!-- column样式 -->
          <template slot-scope="scope">
            <template v-if="detailEnter">
              <el-form-item
                v-if="item.input"
                label=" "
                :prop="'tableData.' + scope.$index + '.' + item.prop"
                :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
              >
                <el-input
                  v-model.trim="scope.row[item.prop]"
                  maxlength="50"
                  size="mini"
                  :disabled="!isOperate"
                  @change="
                    (val) => {
                      commonInputChange(val, item.prop, scope.row, scope)
                    }
                  "
                ></el-input>
              </el-form-item>
              <el-form-item
                v-else-if="item.projectName"
                label=" "
                :prop="'tableData.' + scope.$index + '.' + item.prop"
              >
                <div class="custom-name">
                  <el-select v-model="scope.row[item.prop]" clearable size="mini" placeholder="请选择">
                    <el-option
                      v-for="(item, index) in projectOptions"
                      :key="index"
                      :label="item.value"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                  <div class="common-select-btn" @click="clearupClient(scope)">
                    <i class="el-icon-remove" title="删除"></i>
                  </div>
                </div>
              </el-form-item>
              <el-form-item
                v-else-if="item.inputNumber"
                label=" "
                :prop="'tableData.' + scope.$index + '.' + item.prop"
                :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
              >
                <el-input-number
                  v-model="scope.row[item.prop]"
                  placeholder=""
                  :min="0"
                  :controls="false"
                  :disabled="!isOperate"
                  size="mini"
                  style="width: 100%; margin-right: 5px"
                  @change="
                    (val) => {
                      commonInputChange(val, item.prop, scope.row, scope)
                    }
                  "
                ></el-input-number>
              </el-form-item>
              <el-form-item
                v-else-if="item.inputFloat"
                label=" "
                :prop="'tableData.' + scope.$index + '.' + item.prop"
                :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
              >
                <el-input-number
                  v-model="scope.row[item.prop]"
                  placeholder=""
                  :min="0"
                  :precision="4"
                  :disabled="!isOperate"
                  :controls="false"
                  size="mini"
                  style="width: 100%; margin-right: 5px"
                  @change="
                    (val) => {
                      commonInputChange(val, item.prop, scope.row, scope)
                    }
                  "
                ></el-input-number>
              </el-form-item>
              <span v-else>
                <template>
                  {{ scope.row[item.prop] }}
                </template>
              </span>
            </template>
            <el-form-item
              v-else-if="item.inputNumber && selectBox"
              label=" "
              :prop="'tableData.' + scope.$index + '.' + item.prop"
              :rules="[{ required: item.isRequird ? true : false, message: '输入不能为空' }]"
            >
              <el-input-number
                v-model="scope.row[item.prop]"
                placeholder=""
                :min="0"
                :controls="false"
                :disabled="!isOperate"
                size="mini"
                style="width: 100%; margin-right: 5px"
                @change="
                  (val) => {
                    commonInputChange(val, item.prop, scope.row, scope)
                  }
                "
              ></el-input-number>
            </el-form-item>
            <span v-else style="text-align: right">{{ scope.row[item.prop] }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="80" v-if="detailEnter" align="center">
          <template slot-scope="scope">
            <el-button type="text" size="small" :disabled="!isOperate" @click="deleteClick(scope)">删除</el-button>
          </template>
        </el-table-column>
        <slot name="tableButton" />
        <div slot="empty">
          <el-empty description="暂无数据"></el-empty>
        </div>
      </el-table>
    </el-form>
    <div v-if="detailEnter" style="margin: 10px">
      <div class="add-btn-box" @click="add">
        <i class="el-icon-circle-plus"></i>
      </div>
      <!-- <el-button size="small" type="primary" :disabled="!isOperate" @click="add">新增</el-button> -->
      <!-- <el-button size="small" type="primary" disabled>导入明细</el-button> -->
    </div>
  </div>
</template>
<script>
// import { getProductList } from "@/api/common/other"
export default {
  name: "CommmonFormTableView",
  components: {},
  props: {
    detailEnter: {
      type: Boolean,
      default: false
    },
    selectBox: {
      type: Boolean,
      default: false
    },
    // 那个页面 用来判断计算方式
    pageName: {
      type: String,
      default: ""
    },
    // 列表新增是否多选
    addTypeIdMultiple: {
      type: Boolean,
      default: false
    },
    // 根据报价单查询产品
    quotationNumber: {
      type: [String, Number],
      default: ""
    },
    // 是否可以操作 添加等
    isOperate: {
      type: Boolean,
      default: true
    },
    silkTableList: {
      type: Object,
      default: () => {
        return {
          tableData: [], // 接口返回数据
          isReturn: false,
          tableColumn: [
            // table表单
            { label: "", prop: "", min: 200, tooltip: true }
          ]
        }
      }
    }
  },
  data() {
    return {
      total: 0,
      productList: [],
      tableList: [],
      projectIndex: 0,
      projectOptions: [
        { id: 1, value: "纤度偏差" },
        { id: 2, value: "二次变化" },
        { id: 3, value: "清洁分" },
        { id: 4, value: "洁净分" },
        { id: 5, value: "最大偏差" }
      ]
    }
  },
  created() {
    // if (!this.selectBox) {
    //   this.getProductList()
    // }
    this.getTableInfo()
  },
  watch: {
    silkTableList: {
      handler() {
        this.getTableInfo()
      },
      immediate: true
    }
  },
  computed: {},
  methods: {
    getTableInfo() {
      this.tableList = this.silkTableList
      if (this.tableList.tableData.length === 1 && this.tableList.tableData[0].name === "") {
        this.isRecalculate = false
      } else {
        this.isRecalculate = true
      }
    },
    // 产品名称
    // async getProductList() {
    //   await getProductList({
    //     productName: "",
    //     productNumber: "",
    //     page: 1,
    //     pageSize: 100
    //   }).then((res) => {
    //     console.log(res, "产品名称")
    //     if (res.code === 200) {
    //       if (res.data.data && res.data.data.length > 0) {
    //         this.productList = res.data.data
    //       }
    //     }
    //   })
    // },
    // 多选
    handleSelectionChange(val) {
      this.$emit("getSelectArray", val)
    },
    // 新增
    add() {
      if (this.addTypeIdMultiple) {
        this.projectIndex = this.tableList.tableData.length
        this.editSelCommonConfig.title = "产品名称"
        this.editSelCommonConfig.isSelectBox = true
        this.editSelCommonConfig.editVisible = true
      } else {
        this.$emit("addProjectClick")
      }
    },
    commonInputChange(val, prop, row, scope) {
      this.$emit("inputContent", val, prop, row, scope)
    },
    // 删除
    deleteClick(scope) {
      this.tableList.tableData.splice(scope.$index, 1)
      this.$forceUpdate()
      this.$message.success("删除成功!")
      this.$emit("deleteClick", scope)
    },
    // 新增
    selClientClick(scope, prop) {
      console.log(scope, prop)
      this.projectIndex = scope.$index
      this.editSelCommonConfig.title = "产品名称"
      this.editSelCommonConfig.isSelectBox = true
      this.editSelCommonConfig.editVisible = true
    },
    // 编辑
    handleEditClient(scope, prop) {
      console.log(scope, prop)
      this.projectIndex = scope.$index
      this.editSelCommonConfig.title = "产品名称"
      this.editSelCommonConfig.isSelectBox = false
      this.editSelCommonConfig.editVisible = true
    },
    // 删除
    clearupClient(scope) {
      this.$emit("clearupProject", this.tableList.tableData, scope.$index)
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.page-view {
  .el-form-item {
    margin-bottom: 0;
    .custom-name {
      display: flex;
      .common-select-btn {
        margin-left: 5px;
        font-size: 18px;
        cursor: pointer;
        color: #ff0000;
      }
    }
  }
  .add-btn-box {
    font-size: 26px;
    color: #5582f3;
    margin-left: 50px;
    cursor: pointer;
  }
}
::v-deep {
  .el-form-item__label {
    display: none;
  }
  .el-table__footer-wrapper tbody td.el-table__cell {
    background-color: #fff;
    // text-align: right;
    font-weight: bold;
  }
  .el-input--suffix .el-input__inner {
    padding-right: 0px;
  }
  .el-table .cell,
  .el-table th.el-table__cell > .cell {
    padding: 0 5px;
  }
  .el-input__inner {
    // text-align: left;
    text-align: center !important;
  }
}
</style>
src/views/systemSetting/silkStandardSetting/index.vue
@@ -1,21 +1,139 @@
<template>
  <div class="container"></div>
  <div class="silkStandardSetting-container">
    <div class="filter-card">
      <CommonSearch :show-add="false" :amount-view="false" placeholder="请输入关键词" @searchClick="onFilterSearch">
        <template slot="leftButton">
          <el-button size="small" type="primary" @click="addBtnClick">新增</el-button>
          <el-button size="small" type="primary" @click="refreshClick">刷新</el-button>
          <el-button size="small" type="primary" @click="printClick">打印</el-button>
        </template>
      </CommonSearch>
    </div>
    <div class="body-card">
      <div class="edit-save">
        <div class="edit-save-icon" @click="editSaveClick">
          <i :class="isEdit ? 'el-icon-unlock' : 'el-icon-lock'"></i>
        </div>
        <div class="edit-sace-label">{{ isEdit ? "锁定保存" : "界面设计" }}</div>
      </div>
      <div>
        <SilkTableList
          :detail-enter="isEdit"
          :silk-table-list="silkTableList"
          @inputContent="inputContent"
          @addProjectClick="addBtnClick"
          @clearupProject="clearupProject"
          @deleteClick="clearupProject"
        >
        </SilkTableList>
      </div>
    </div>
  </div>
</template>
<script>
import SilkTableList from "@/views/systemSetting/silkStandardSetting/components/silkTableList"
export default {
  name: "silkStandardSetting",
  props: {},
  components: {},
  components: { SilkTableList },
  mixins: [],
  computed: {},
  data() {
    return {}
    return {
      isEdit: false,
      silkTableList: {},
      tableData: []
    }
  },
  created() {},
  methods: {}
  created() {
    this.setTableForm()
  },
  methods: {
    setTableForm() {
      this.silkTableList = {
        tableData: this.tableData,
        isReturn: false,
        tableColumn: [
          { label: "检查项目名称", prop: "projectName", projectName: true },
          { label: "开始纤度", prop: "start", inputFloat: true },
          { label: "结束纤度", prop: "end", inputFloat: true },
          { label: "野纤", prop: "price1", inputFloat: true },
          { label: "大野", prop: "price2", inputFloat: true },
          { label: "特野", prop: "price3", inputFloat: true }
        ]
      }
    },
    // 搜索
    onFilterSearch(searchText) {
      console.log(searchText)
    },
    // 新增
    addBtnClick() {
      this.tableData.push({
        projectName: "",
        start: 0,
        end: 0,
        price1: 0,
        price2: 0,
        price3: 0
      })
    },
    // 刷新
    refreshClick() {},
    // 打印
    printClick() {},
    // 列表输入回调
    inputContent(val, prop, row) {
      console.log(val, prop, row)
    },
    // 删除
    clearupProject(data, index) {
      console.log(data)
      this.tableData.splice(index, 1)
    },
    // 保存编辑按钮切换
    editSaveClick() {
      this.isEdit = !this.isEdit
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.silkStandardSetting-container {
  height: 100%;
  .filter-card {
    margin: 20px 30px;
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 20px 0 20px;
    border-radius: 4px;
    background-color: #fff;
  }
  .body-card {
    margin: 0 30px;
    background-color: #fff;
    padding: 10px 15px;
    height: calc(100% - 180px);
    border-radius: 4px;
    .edit-save {
      display: flex;
      align-items: center;
      margin-bottom: 10px;
      .edit-save-icon {
        font-size: 24px;
        color: #5582f3;
        cursor: pointer;
      }
      .edit-sace-label {
        margin-left: 10px;
        font-size: 14px;
        color: #000000d8;
      }
    }
  }
}
</style>