yangfeng
2023-11-14 02b7655966b254a1c2b9f59006d52deb71aff3f4
选择供应商组件优化、列表公共组件优化、创建采购单
5个文件已修改
174 ■■■■■ 已修改文件
src/assets/style/reset-element.scss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/layout/components/appsidebar/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/TableCommonView.vue 68 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/supplierManage/supplier/index.vue 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/style/reset-element.scss
@@ -28,3 +28,7 @@
.el-drawer__wrapper {
  z-index: 9999 !important;
}
// 颜色
.el-table .onSelect {
  background: #ebf2ff;
}
src/components/layout/components/appsidebar/index.vue
@@ -29,9 +29,9 @@
            <span>采购管理</span>
          </template>
          <el-menu-item index="/purchaseManage/purchase">采购订单</el-menu-item>
          <el-menu-item index="/purchaseManage/quality">采购质检单</el-menu-item>
          <!-- <el-menu-item index="/purchaseManage/quality">采购质检单</el-menu-item> -->
          <!-- <el-menu-item index="/purchaseManage/warehouse">采购入库单</el-menu-item> -->
          <el-menu-item index="/purchaseManage/returned">采购退货单</el-menu-item>
          <!-- <el-menu-item index="/purchaseManage/returned">采购退货单</el-menu-item> -->
        </el-submenu>
        <el-submenu index="3">
          <template slot="title">
src/components/makepager/TableCommonView.vue
@@ -11,7 +11,7 @@
      :lazy="tableList.lazy"
      size="mini"
      @selection-change="handleSelectionChange"
      :header-cell-style="{ background: '#f1f3f8', color: '#000009' , 'font-size': '14px'}"
      :header-cell-style="{ background: '#f1f3f8', color: '#000009', 'font-size': '14px' }"
      :highlight-current-row="tableList.highlight"
      :row-class-name="tableRowClassName"
      @row-click="tableRowClick"
@@ -20,7 +20,8 @@
      :tree-props="{ children: 'child', hasChildren: 'hasChildren' }"
    >
      <el-table-column align="center" v-if="tableList.selectBox" type="selection" width="40"> </el-table-column>
      <el-table-column align="center" v-if="tableList.selectIndex" type="index" label="序号" width="50"> </el-table-column>
      <el-table-column align="center" v-if="tableList.selectIndex" type="index" label="序号" width="50">
      </el-table-column>
      <template v-for="(item, i) in tableList.tableColumn">
        <el-table-column
          align="center"
@@ -37,19 +38,22 @@
            <span v-if="item.price">{{ "¥" + number_format(scope.row[item.prop], 2, ".", ",") }}</span>
            <div v-else-if="item.status" :class="scope.row.status">{{ scope.row[item.prop] }}</div>
            <span v-else-if="item.isTime">{{
                dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 00:06:26"
                    ? "--"
                    : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop])
              }}</span>
            <span v-else-if="item.isClick && scope.row[item.prop]" class="sel-name" @click="selCommonClick(scope.row)">{{
                scope.row[item.prop]
              }}</span>
              dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 00:06:26"
                ? "--"
                : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop])
            }}</span>
            <span
              v-else-if="item.isClick && scope.row[item.prop]"
              class="sel-name"
              @click="selCommonClick(scope.row)"
              >{{ scope.row[item.prop] }}</span
            >
            <span v-else-if="item.isFirst">{{ scope.row[item.prop] ? "是" : "否" }}</span>
            <span
                v-else-if="item.isCommonClick && scope.row[item.prop]"
                class="sel-name"
                @click="selCommonClick(scope.row)"
            >{{ scope.row[item.prop] }}</span
              v-else-if="item.isCommonClick && scope.row[item.prop]"
              class="sel-name"
              @click="selCommonClick(scope.row)"
              >{{ scope.row[item.prop] }}</span
            >
            <div v-else-if="item.isProductName" class="product-view">
              <ul v-if="scope.row.products && scope.row.products.length > 0">
@@ -103,15 +107,8 @@
    <div class="overSpread1" v-show="iscolopen" @click="onMaskClick"></div>
    <div class="styleBtn">
      <i @click="checkCol()" class="label">...</i>
      <el-checkbox-group
          v-model="showcol"
          v-show="iscolopen"
          class="checkbox-group"
          @change="selectCheckBoxList"
      >
        <el-checkbox v-for="item in tableList.allcol" :label="item" :key="item"
        >{{ item }}
        </el-checkbox>
      <el-checkbox-group v-model="showcol" v-show="iscolopen" class="checkbox-group" @change="selectCheckBoxList">
        <el-checkbox v-for="item in tableList.allcol" :label="item" :key="item">{{ item }} </el-checkbox>
      </el-checkbox-group>
    </div>
  </div>
@@ -160,27 +157,27 @@
  data() {
    return {
      iscolopen: false,
      showcol:[]
      showcol: []
    }
  },
  watch: {
    'tableList.showcol':{
      handler(newVal){
        this.showcol=newVal
    "tableList.showcol": {
      handler(newVal) {
        this.showcol = newVal
      },
      immediate:true
      immediate: true
    }
  },
  computed: {},
  methods: {
    onMaskClick() {
      this.iscolopen = false;
      this.iscolopen = false
    },
    checkCol() {
      this.iscolopen = !this.iscolopen;
      this.iscolopen = !this.iscolopen
    },
    selectCheckBoxList(val) {
      this.$emit("selTableCol", val);
      this.$emit("selTableCol", val)
    },
    handleReserve(row) {
      return row._id ? row._id : row.id
@@ -316,6 +313,10 @@
    selCommonClick(row) {
      this.$emit("selCommonClick", row)
    },
    // 行点击
    tableRowClick(row, column, event) {
      this.$emit("tableRowClick", row, column, event)
    },
    // 单选行相关
    tableRowClassName({ row }) {
      if (Object.keys(this.selectClassRow).length > 0) {
@@ -324,9 +325,6 @@
        }
      }
      this.$emit("tableRowClassName", row)
    },
    tableRowClick(row) {
      this.$emit("tableRowClick", row)
    }
  }
}
@@ -398,8 +396,8 @@
  text-align: center;
}
::v-deep{
  .el-table .cell .el-button--text.el-button--small{
::v-deep {
  .el-table .cell .el-button--text.el-button--small {
    padding: 4px 0;
  }
}
src/views/purchaseManage/purchase/components/SelectSupplierDialog.vue
@@ -31,7 +31,9 @@
        >
        </TableCommonView>
        <div slot="footer" class="dialog-footer">
          <div class="remark">说明:支持多字段模糊查询,仅显示符合条件的前5条数据</div>
          <div class="btn-pager">
            <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
          </div>
        </div>
      </div>
    </el-dialog>
@@ -40,8 +42,11 @@
<script>
import { getSupplierList } from "@/api/supplierManage/supplier"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
  name: "EditSelClientDialog",
  mixins: [pageMixin],
  props: {
    editCommonConfig: {
      type: Object,
@@ -58,7 +63,7 @@
  computed: {},
  data() {
    return {
      dialogWidth: "50%",
      dialogWidth: "40%",
      editConfig: this.editCommonConfig,
      queryInput: "",
      select: "1",
@@ -69,8 +74,8 @@
      tableList: {},
      search_map: {},
      tableColumn: [
        { label: "供应商编号", prop: "number", min: 190, isCommonClick: true },
        { label: "供应商名称", prop: "name", min: 130 },
        { label: "供应商编号", prop: "number", min: 190 },
        { label: "供应商名称", prop: "name", min: 130, isCommonClick: true },
        { label: "供应商类型", prop: "supplierType", min: 130 },
        { label: "所属行业", prop: "industry", min: 130 },
        { label: "联系人", prop: "contact", min: 130 },
@@ -78,25 +83,23 @@
        { label: "状态", prop: "status_name", min: 130 },
        { label: "创建时间", prop: "member_name", min: 130 }
      ],
      showCol: ['供应商编号', '供应商名称', '供应商类型', '所属行业', '联系人', '联系电话','状态','创建时间']
      showCol: ["供应商编号", "供应商名称", "供应商类型", "联系人", "联系电话", "状态"]
    }
  },
  created() {
    this.setTable()
    this.getData()
  },
  mounted(){
  },
  mounted() {},
  methods: {
    setTable() {
      this.tableList = {
        tableInfomation: [],
        tableColumn:this.setColumnVisible(this.showCol),
        tableColumn: this.setColumnVisible(this.showCol),
        showcol: this.showCol,
        allcol:[]
        allcol: []
      }
      this.tableList.allcol = this.tableList.tableColumn.filter(ele=>!ele.default).map(ele=>ele.label);
      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
@@ -105,14 +108,14 @@
      }
    },
    selTableCol(val) {
      this.showcol = val;
      this.tableList.tableColumn = this.setColumnVisible(val);
      this.showcol = val
      this.tableList.tableColumn = this.setColumnVisible(val)
    },
    setColumnVisible(showCol){
      return  this.tableColumn.map(ele=>{
    setColumnVisible(showCol) {
      return this.tableColumn.map((ele) => {
        return {
          ...ele,
          isShowColumn:showCol.includes(ele.label)
          isShowColumn: showCol.includes(ele.label)
        }
      })
    },
@@ -122,22 +125,23 @@
    // 请求数据
    async getData(val, content) {
      this.loading = true
      await getSupplierList({
        [val]: content,
        page:1,
        pageSize: 10
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
        .then((res) => {
          if (res.data.code == 200) {
            if (res.data.data.list && res.data.data.list.length > 0) {
              const list = res.data.data.list.map((item) => {
          if (res.code == 200) {
            if (res.data.list && res.data.list.length > 0) {
              const list = res.data.list.map((item) => {
                return {
                  ...item,
                  status_name: item.status === 0 ? "未启用" : "启用"
                }
              })
              // this.tableList.tableInfomation = list.slice(0, 5) || []
              this.tableList.tableInfomation = list
              this.pagerOptions.totalCount = res.data.total
            } else {
              this.tableList.tableInfomation = []
            }
@@ -192,9 +196,16 @@
  cursor: pointer;
}
.dialog-footer {
  height: 40px;
  line-height: 40px;
  height: 50px;
  line-height: 50px;
  color: red;
  .btn-pager {
    display: flex;
    margin-top: 0px;
    .page {
      margin-left: auto;
    }
  }
}
::v-deep {
  .input-with-select .el-input-group__prepend {
src/views/supplierManage/supplier/index.vue
@@ -22,8 +22,9 @@
              ref="tableSupplier"
              :table-list="tableList"
              @selCommonClick="selCommonClick"
              @tableRowClick="tableRowClick"
              @selTableCol="selTableCol"
              @tableRowClick="tableRowClick"
              :selectClassRow="selectRow"
            >
              <template slot="tableButton">
                <el-table-column label="操作" width="100">
@@ -62,7 +63,7 @@
          >
            <template slot="leftButton">
              <div class="sub-title"><span class="sub-title-decorator"></span>可提供的产品</div>
              <el-button type="primary" size="mini">创建采购单</el-button>
              <el-button type="primary" size="mini" @click="creatPurchase">创建采购单</el-button>
            </template>
            <template slot="rightButton">
              <el-button type="primary" size="mini" @click="addNewProductClick">添加新产品</el-button>
@@ -110,6 +111,8 @@
    <RaleteSupplierList v-if="raleteSupplierConfig.visible" :common-config="raleteSupplierConfig" />
    <!-- 添加新产品 -->
    <AddNewProduct v-if="newProductConfig.visible" :add-common-config="newProductConfig" />
    <!-- 新建/编辑 -->
    <AddPurchase v-if="editPurchaseConfig.visible" :edit-common-config="editPurchaseConfig" />
  </div>
</template>
@@ -121,11 +124,12 @@
import RaleteSupplierList from "@/views/supplierManage/supplier/RaleteSupplierList"
import AddNewProduct from "@/views/supplierManage/supplier/AddNewProduct"
import { getProductList, deleteProduct } from "@/api/productManage/product"
import AddPurchase from "@/views/purchaseManage/purchase/components/AddPurchase"
export default {
  name: "SupplierManage",
  props: {},
  components: { DetailSupplier, AddSupplier, RaleteSupplierList, AddNewProduct },
  components: { DetailSupplier, AddSupplier, RaleteSupplierList, AddNewProduct, AddPurchase },
  mixins: [pageMixin],
  computed: {},
  data() {
@@ -180,7 +184,16 @@
        { label: "采购价格", prop: "purchasePrice", min: 130 },
        { label: "供货时长(天)", prop: "deliveryTime", min: 130 },
        { label: "物流时长(天)", prop: "shippingDuration", min: 130 }
      ]
      ],
      editPurchaseConfig: {
        // 创建采购
        visible: false,
        title: "创建",
        infomation: {
          supplierName: ""
        }
      },
      selectRow: {}
    }
  },
  created() {
@@ -269,6 +282,7 @@
          const list = res.data.list.map((item) => {
            return {
              ...item,
              id: item.ID,
              status_name: item.status === 0 ? "未启用" : "启用"
            }
          })
@@ -277,12 +291,13 @@
          this.pagerOptions.totalCount = res.data.total
          if (list && list.length > 0) {
            this.supplierId = this.tableList.tableInfomation[0].ID
            this.selectRow = this.tableList.tableInfomation.length > 0 ? this.tableList.tableInfomation[0] : {}
          } else {
            this.supplierId = 0
          }
          this.$nextTick(() => {
            this.$refs.tableSupplier.$refs.table.setCurrentRow(this.tableList.tableInfomation[0])
          })
          // this.$nextTick(() => {
          //   this.$refs.tableSupplier.$refs.table.setCurrentRow(this.tableList.tableInfomation[0])
          // })
          // 重新获取供应商列表后应该重置产品列表页码
          this.productPagerOptions.currPage = 1
@@ -401,6 +416,7 @@
    tableRowClick(row) {
      console.log(row)
      this.productPagerOptions.currPage = 1
      this.selectRow = row
      this.supplierId = row.ID
      this.getProductList()
    },
@@ -419,6 +435,15 @@
    currentProductHandler(val) {
      this.productPagerOptions.currPage = val
      this.getProductList()
    },
    // 创建采购单
    creatPurchase() {
      this.editPurchaseConfig.visible = true
      this.editPurchaseConfig.title = "创建"
      this.editPurchaseConfig.infomation = {
        supplierId: this.selectRow.ID,
        supplierName: this.selectRow.name
      }
    }
  }
}