|
@@ -0,0 +1,254 @@
|
|
|
+<!-- 供应商管理 -->
|
|
|
+<template>
|
|
|
+ <div class="purchase">
|
|
|
+ <template v-if="!addOrUpdateVisible && !detailVisible && !attachVisible">
|
|
|
+ <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
|
|
|
+ <el-form-item label="供应商名称">
|
|
|
+ <el-input v-model="dataForm.supplierName" placeholder="供应商名称" clearable/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="状态">
|
|
|
+ <el-select
|
|
|
+ v-model="dataForm.supplierState"
|
|
|
+ remote
|
|
|
+ placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in optionsSupplierState"
|
|
|
+ :key="item.code"
|
|
|
+ :label="item.value"
|
|
|
+ :value="item.code">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button @click="search()">查询</el-button>
|
|
|
+ <el-button v-if="isAuth('sale:supplier:save')" type="primary" @click="addOrUpdateHandle(0)">录入</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-table
|
|
|
+ :data="dataList"
|
|
|
+ border
|
|
|
+ v-loading="dataListLoading"
|
|
|
+ style="width: 100%;">
|
|
|
+ <el-table-column
|
|
|
+ label="序号"
|
|
|
+ type="index"
|
|
|
+ width="50"
|
|
|
+ align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="supplierName"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="140"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="供应商名称">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="level"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ label="级别">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="contact"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="100"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="联系人">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="tel"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ min-width="100"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="电话">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="addressWork"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ min-width="140"
|
|
|
+ :show-tooltip-when-overflow="true"
|
|
|
+ label="地址">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="state"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ :formatter="formatState"
|
|
|
+ label="状态">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ label="附件">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button :disabled="!scope.row.attachList || scope.row.attachList.length === 0" type="text" size="small" @click="attachDetails(scope.row)">查看</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="notes"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ min-width="180"
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
+ label="备注">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ fixed="right"
|
|
|
+ header-align="center"
|
|
|
+ align="center"
|
|
|
+ width="150"
|
|
|
+ label="操作">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button v-if="isAuth('sale:supplier:info')" type="text" size="small" @click="detailHandle(scope.row.supplierId)">查看</el-button>
|
|
|
+ <el-button v-if="isAuth('sale:supplier:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.supplierId)">编辑</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination
|
|
|
+ @size-change="sizeChangeHandle"
|
|
|
+ @current-change="currentChangeHandle"
|
|
|
+ :current-page="pageIndex"
|
|
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
+ :page-size="pageSize"
|
|
|
+ :total="totalPage"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper">
|
|
|
+ </el-pagination>
|
|
|
+ </template>
|
|
|
+ <!-- 弹窗, 新增 / 修改 -->
|
|
|
+ <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @onChose="onChose"></add-or-update>
|
|
|
+ <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
|
|
|
+ <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import AddOrUpdate from './purchase-add-or-update'
|
|
|
+ import Detail from './purchase-detail'
|
|
|
+ import { getSupplierList } from '@/api/sale'
|
|
|
+ import AttachDetail from '../common/attach-detail'
|
|
|
+export default {
|
|
|
+ name: 'supplier',
|
|
|
+ components: {
|
|
|
+ AttachDetail,
|
|
|
+ AddOrUpdate,
|
|
|
+ Detail
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ dataForm: {},
|
|
|
+ dataList: [],
|
|
|
+ pageIndex: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ totalPage: 0,
|
|
|
+ dataListLoading: false,
|
|
|
+ dataListSelections: [],
|
|
|
+ addOrUpdateVisible: false,
|
|
|
+ detailVisible: false,
|
|
|
+ attachVisible: false,
|
|
|
+ optionsSupplierState: [ // 供应商状态
|
|
|
+ {
|
|
|
+ code: '1', value: '正常'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ code: '2', value: '待考核'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ optionsState: [] // 审批状态
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.optionsState = this.$store.state.common.approveStates
|
|
|
+ this.getDataList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onChose () {
|
|
|
+ this.addOrUpdateVisible = false
|
|
|
+ this.detailVisible = false
|
|
|
+ this.attachVisible = false
|
|
|
+ },
|
|
|
+ // 查询
|
|
|
+ search () {
|
|
|
+ this.pageIndex = 1
|
|
|
+ this.getDataList()
|
|
|
+ },
|
|
|
+ // 获取数据列表
|
|
|
+ getDataList () {
|
|
|
+ this.dataListLoading = true
|
|
|
+ this.addOrUpdateVisible = false
|
|
|
+ let params = {
|
|
|
+ 'current': this.pageIndex,
|
|
|
+ 'size': this.pageSize,
|
|
|
+ 'supplierName': this.dataForm.supplierName ? this.dataForm.supplierName : null,
|
|
|
+ 'supplierState': this.dataForm.supplierState ? this.dataForm.supplierState : null
|
|
|
+ }
|
|
|
+ getSupplierList(params).then(({data}) => {
|
|
|
+ if (data && data.code === '200') {
|
|
|
+ this.dataList = data.data.records
|
|
|
+ this.totalPage = Number(data.data.total)
|
|
|
+ } else {
|
|
|
+ this.dataList = []
|
|
|
+ this.totalPage = 0
|
|
|
+ }
|
|
|
+ this.dataListLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 每页数
|
|
|
+ sizeChangeHandle (val) {
|
|
|
+ this.pageSize = val
|
|
|
+ this.pageIndex = 1
|
|
|
+ this.getDataList()
|
|
|
+ },
|
|
|
+ // 当前页
|
|
|
+ currentChangeHandle (val) {
|
|
|
+ this.pageIndex = val
|
|
|
+ this.getDataList()
|
|
|
+ },
|
|
|
+ // 多选
|
|
|
+ selectionChangeHandle (val) {
|
|
|
+ this.dataListSelections = val
|
|
|
+ },
|
|
|
+ // 新增 / 修改
|
|
|
+ addOrUpdateHandle (id, disable) {
|
|
|
+ this.addOrUpdateVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.addOrUpdate.init(id, disable)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 转换属性“类别”
|
|
|
+ formatType (row) {
|
|
|
+ if (this.optionsType && row.purchaseType) {
|
|
|
+ const item1 = this.optionsType.find((item) => item.code === row.purchaseType.toString())
|
|
|
+ return item1 ? item1.value : ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 转换属性“是否组合产品”
|
|
|
+ formatState (row) {
|
|
|
+ if (!row.state) return ''
|
|
|
+ const item1 = this.optionsSupplierState.find((item) => item.code === row.state.toString())
|
|
|
+ return item1 ? item1.value : ''
|
|
|
+ },
|
|
|
+ // 详情
|
|
|
+ detailHandle (id) {
|
|
|
+ this.detailVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.detail.init(id)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 附件
|
|
|
+ attachDetails (row) {
|
|
|
+ this.attachVisible = true
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.attachDetail.init(row.attachList)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|