123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <template>
- <a-card size="small" :bordered="false" class="dealerAccountList-wrap">
- <!-- 搜索条件 -->
- <div class="table-page-search-wrapper">
- <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
- <a-row :gutter="15">
- <a-col :md="6" :sm="24">
- <a-form-item label="经销商名称">
- <a-input id="dealerAccountList-productBrandName" v-model.trim="queryParam.productBrandName" allowClear placeholder="请输入经销商名称"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="管理员账号">
- <a-input id="dealerAccountList-productBrandName" v-model.trim="queryParam.productBrandName" allowClear placeholder="请输入管理员账号"/>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-form-item label="账号状态">
- <v-select code="ENABLE_FLAG" id="dealerAccountList-state" v-model="queryParam.state" allowClear placeholder="请选择账号状态"></v-select>
- </a-form-item>
- </a-col>
- <a-col :md="6" :sm="24">
- <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="dealerAccountList-refresh">查询</a-button>
- <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="dealerAccountList-reset">重置</a-button>
- </a-col>
- </a-row>
- </a-form>
- </div>
- <!-- 操作按钮 -->
- <div class="table-operator">
- <a-button id="dealerAccountList-add" type="primary" class="button-error" @click="handleEdit()">新增</a-button>
- </div>
- <!-- 列表 -->
- <s-table
- class="sTable"
- ref="table"
- size="default"
- :rowKey="(record) => record.id"
- :columns="columns"
- :data="loadData"
- :scroll="{ x: 1310, y: tableHeight }"
- bordered>
- <!-- 账号状态 -->
- <template slot="enableAction" slot-scope="text, record">
- <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.enabledFlag" @change="changeFlagHandle(text, record)"/>
- <!-- <span v-else>{{ record.loginFlag==1?'已启用':'已禁用' }}</span> -->
- </template>
- <!-- 操作 -->
- <template slot="action" slot-scope="text, record">
- <a-button size="small" type="link" class="button-info" @click="handleEdit(record)" id="dealerAccountList-edit-btn">编辑</a-button>
- <a-button size="small" type="link" class="button-success" @click="handleDetail(record)" id="dealerAccountList-detail-btn">详情</a-button>
- <a-button
- size="small"
- type="link"
- class="button-warning"
- @click="handleReset(record)"
- id="dealerAccountList-reset-btn">重置密码</a-button>
- </template>
- </s-table>
- <!-- 新增/编辑 -->
- <dealer-account-edit-modal :openModal="openModal" :nowData="nowData" :itemId="itemId" @ok="$refs.table.refresh(true)" @close="closeModal" />
- <!-- 查看 -->
- <dealer-account-detail-modal :openModal="openDetailModal" :itemId="itemId" @close="closeDetailModal" />
- </a-card>
- </template>
- <script>
- import { STable, VSelect } from '@/components'
- import dealerAccountEditModal from './editModal.vue'
- import dealerAccountDetailModal from './detailModal.vue'
- import { dealerUserList } from '@/api/dealer'
- export default {
- components: { STable, VSelect, dealerAccountEditModal, dealerAccountDetailModal },
- data () {
- return {
- tableHeight: 0,
- queryParam: { // 查询条件
- // productBrandName: '', // 品牌名称
- // enabledFlag: undefined // 状态
- },
- disabled: false, // 查询、重置按钮是否可操作
- columns: [
- { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
- { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center' },
- { title: '经销商名称', dataIndex: 'productBrandName', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '管理员姓名', dataIndex: 'creatseDate', width: 220, align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
- { title: '管理员账号', dataIndex: 'producstBrandName', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
- { title: '授权用户数', dataIndex: 'productssBrandName', width: 140, align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
- { title: '状态', scopedSlots: { customRender: 'enableAction' }, width: 150, align: 'center' },
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center', fixed: 'right' }
- ],
- // 加载数据方法 必须为 Promise 对象
- loadData: parameter => {
- this.disabled = true
- if (this.tableHeight == 0) {
- this.tableHeight = window.innerHeight - 380
- }
- return dealerUserList(Object.assign(parameter, this.queryParam)).then(res => {
- const data = res.data
- const no = (data.pageNo - 1) * data.pageSize
- for (var i = 0; i < data.list.length; i++) {
- data.list[i].no = no + i + 1
- }
- this.disabled = false
- return data
- })
- },
- openModal: false, // 新增编辑 弹框
- openDetailModal: false, // 详情 弹框
- itemId: '', // 当前id
- nowData: null, // 当前记录数据
- productBrandList: []
- }
- },
- methods: {
- // 重置
- resetSearchForm () {
- this.queryParam.productBrandName = ''
- this.queryParam.enabledFlag = undefined
- this.$refs.table.refresh(true)
- },
- // 新增/编辑
- handleEdit (row) {
- this.itemId = row ? row.id : null
- this.nowData = row || null
- this.openModal = true
- },
- // 详情
- handleDetail (row) {
- this.itemId = row ? row.id : null
- this.openDetailModal = true
- },
- // 关闭弹框
- closeModal () {
- this.itemId = ''
- this.nowData = null
- this.openModal = false
- },
- // 关闭详情弹框
- closeDetailModal () {
- this.itemId = ''
- this.openDetailModal = false
- },
- // 重置密码
- handleReset (row) {
- const _this = this
- this.$confirm({
- title: '提示',
- content: '重置密码后,新的密码会以短信形式发送到【管理员手机】,确定要重置吗?',
- centered: true,
- onOk () {
- // salesDel({ id: row.id }).then(res => {
- // if (res.status == 200) {
- // _this.$message.success(res.message)
- // _this.$refs.table.refresh()
- // }
- // })
- }
- })
- },
- // 修改状态
- changeFlagHandle (text, record) {
- const _data = {
- id: record.id,
- flag: record.enabledFlag ? '1' : '0'
- }
- updateEnableStatus(_data).then(res => {
- if (res.status == 200) {
- this.$message.success(res.message)
- } else {
- record.enabledFlag = !record.enabledFlag
- }
- })
- }
- }
- }
- </script>
|