123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- <template>
- <div>
- <a-card size="small" :bordered="false" class="searchBoxNormal">
- <!-- 搜索条件 -->
- <div ref="tableSearch" class="table-page-search-wrapper newTableSearchName">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-model-item label="人员类型">
- <v-select
- v-model="queryParam.bizUserType"
- ref="printStatus"
- id="businessOwnerSettings-printStatus"
- code="BIZ_USER_TYPE"
- placeholder="请选择人员类型"
- allowClear></v-select>
- </a-form-model-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="人员姓名">
- <a-input id="businessOwnerSettings-name" v-model.trim="queryParam.userName" allowClear placeholder="请输入人员姓名"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="businessOwnerSettings-refresh">查询</a-button>
- <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="businessOwnerSettings-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- </a-card>
- <a-card size="small" :bordered="false" class="dealerZoneSearch-wrap">
- <a-spin :spinning="spinning" tip="Loading...">
- <div class="table-operator">
- <a-button id="businessOwnerSettings-add" type="primary" @click="handleAdd">新增</a-button>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable fixPagination"
- ref="table"
- :style="{ height: tableHeight+70+'px' }"
- size="small"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :pageSize="30"
- :scroll="{ y: tableHeight }"
- :defaultLoadData="false"
- bordered>
- <template slot="showWarehouse" slot-scope="text, record">
- <div v-if="record.warehouseList&&record.warehouseList.length>0 ">
- <a-tooltip placement="bottom" class="warehouseBox">
- <template slot="title">
- <span v-for="con in record.warehouseList" :key="con.id">
- {{ con.name }}
- </span>
- </template>
- <span v-for="con in record.warehouseList" :key="con.id">
- {{ con.name }}
- </span>
- </a-tooltip>
- </div>
- <div v-else>--</div>
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button size="small" type="link" class="button-warning" v-if="record.allDealerFlag!=1 || record.allProductFlag!=1 ||record.allSupplierFlag&&record.allSupplierFlag!=1" @click="handleSetCategory(record)">设置管辖范围</a-button>
- <a-button size="small" type="link" class="button-info" @click="handleEdit(record)">编辑</a-button>
- <a-button size="small" type="link" class="button-error" @click="handleDelete(record)">删除</a-button>
- </template>
- </s-table>
- </a-spin>
- </a-card>
- <!-- 新增 -->
- <addModal :itemId="itemId" ref="addUser" :openModal="openAddModal" @close="closeModal" @ok="$refs.table.refresh(true)"></addModal>
- </div>
- </template>
- <script>
- import { commonMixin } from '@/utils/mixin'
- import { STable, VSelect } from '@/components'
- import { queryPage, bizuserDelete } from '@/api/bizuser'
- import addModal from './addModal'
- export default {
- name: 'BusinessOwnerSettings',
- mixins: [commonMixin],
- components: { STable, VSelect, addModal },
- data () {
- return {
- spinning: false,
- disabled: false, // 查询、重置按钮是否可操作
- tableHeight: 0,
- queryParam: {
- bizUserType: '',
- userName: undefined
- },
- columns: [
- { title: '创建时间', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '人员姓名', dataIndex: 'userName', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '人员类型', dataIndex: 'bizUserTypeDictValue', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '管辖经销商', dataIndex: 'allDealerFlagDictValue', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '管辖品类', dataIndex: 'allProductFlagDictValue', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '管辖供应商', dataIndex: 'allSupplierFlagDictValue', width: '18%', align: 'center', customRender: function (text) { return text || '--' } },
- { title: '管辖仓库', scopedSlots: { customRender: 'showWarehouse' }, width: '22%', align: 'center' },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: '20%', align: 'center' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- this.spinning = true
- return queryPage(Object.assign(parameter, this.queryParam)).then(res => {
- let data
- data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- this.total = data.count || 0
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.disabled = false
- this.spinning = false
- return data
- })
- },
- openAddModal: false, // 编辑 弹框
- itemId: ''
- }
- },
- methods: {
- userChange (val) {
- this.queryParam.userSn = val.key
- },
- handleSetCategory (row) {
- this.$router.push({ name: 'categorySet', query: { sn: row.userSn, id: row.id } })
- },
- // 新增
- handleAdd () {
- this.itemId = ''
- this.openAddModal = true
- },
- // 重置
- resetSearchForm () {
- this.queryParam = {
- bizUserType: '',
- userName: ''
- }
- this.itemId = ''
- this.$refs.table.refresh(true)
- },
- // 删除
- handleDelete (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '确定要删除吗?',
- centered: true,
- onOk () {
- _this.spinning = true
- bizuserDelete({ id: row.id }).then(res => {
- if (res.status == 200) {
- _this.$message.success(res.message)
- _this.$refs.table.refresh()
- _this.spinning = false
- } else {
- _this.spinning = false
- }
- })
- }
- })
- },
- // 编辑
- handleEdit (row) {
- this.itemId = row.id
- this.openAddModal = true
- const _this = this
- this.$nextTick(() => {
- _this.$refs.addUser.getEditInfo(row)
- })
- },
- // 关闭弹框
- closeModal () {
- this.itemId = ''
- this.openAddModal = false
- },
- pageInit () {
- const _this = this
- this.$nextTick(() => { // 页面渲染完成后的回调
- _this.setTableH()
- })
- this.resetSearchForm()
- },
- setTableH () {
- const tableSearchH = this.$refs.tableSearch.offsetHeight
- this.tableHeight = window.innerHeight - tableSearchH - 240
- }
- },
- watch: {
- '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
- this.setTableH()
- }
- },
- mounted () {
- if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
- this.pageInit()
- }
- },
- activated () {
- // 如果是新页签打开,则重置当前页面
- if (this.$store.state.app.isNewTab) {
- this.pageInit()
- }
- // 仅刷新列表,不重置页面
- if (this.$store.state.app.updateList) {
- this.pageInit()
- }
- },
- beforeRouteEnter (to, from, next) {
- next(vm => {})
- }
- }
- </script>
- <style lang="less">
- .dealerZoneSearch-wrap{
- height: 100%;
- margin-top:6px;
- .warehouseBox{
- width: 100%;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .warehouseBox span::after{
- content:','
- }
- .warehouseBox span:last-child::after{
- content:''
- }
- }
- </style>
|