|
@@ -0,0 +1,231 @@
|
|
|
|
+<template>
|
|
|
|
+ <a-card size="small" :bordered="false">
|
|
|
|
+ <a-spin :spinning="spinning" tip="Loading...">
|
|
|
|
+ <div ref="tableSearch" 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="userList-name" allowClear v-model.trim="queryParam.name" placeholder="请输入货架名称"/>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="配件经销商">
|
|
|
|
+ <a-input id="userList-phone" allowClear v-model.trim="queryParam.phone" placeholder="请输入手机号码"/>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="汽车修理厂">
|
|
|
|
+ <a-input id="userList-phone" allowClear v-model.trim="queryParam.phone" placeholder="请输入手机号码"/>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ <template v-if="advanced">
|
|
|
|
+ <a-col :md="6" :sm="24">
|
|
|
|
+ <a-form-item label="状态">
|
|
|
|
+ <v-select id="userList-loginFlag" code="ENABLE_FLAG" v-model="queryParam.loginFlag" allowClear placeholder="请选择状态"></v-select>
|
|
|
|
+ </a-form-item>
|
|
|
|
+ </a-col>
|
|
|
|
+ </template>
|
|
|
|
+ <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
|
|
|
|
+ <a-button type="primary" @click="$refs.table.refresh(true)" id="userList-search">查询</a-button>
|
|
|
|
+ <a-button type="" @click="reset" id="userList-reset" style="margin-left: 10px;">重置</a-button>
|
|
|
|
+ <a @click="advanced=!advanced" style="margin-left: 8px">
|
|
|
|
+ {{ advanced ? '收起' : '展开' }}
|
|
|
|
+ <a-icon :type="advanced ? 'up' : 'down'"/>
|
|
|
|
+ </a>
|
|
|
|
+ </a-col>
|
|
|
|
+ </a-row>
|
|
|
|
+ </a-form>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="table-operator">
|
|
|
|
+ <a-button v-if="$hasPermissions('B_powerMD_user_add')" type="primary" class="button-error" @click="openModal">新增数字货架</a-button>
|
|
|
|
+ </div>
|
|
|
|
+ <s-table
|
|
|
|
+ class="sTable fixPagination"
|
|
|
|
+ ref="table"
|
|
|
|
+ :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
|
|
|
|
+ size="small"
|
|
|
|
+ rowKey="id"
|
|
|
|
+ :columns="columns"
|
|
|
|
+ :data="loadData"
|
|
|
|
+ :scroll="{ y: tableHeight }"
|
|
|
|
+ :defaultLoadData="false"
|
|
|
|
+ bordered>
|
|
|
|
+ <span slot="status" slot-scope="text, record">
|
|
|
|
+ <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.loginFlag" @change="changeFlagHandle(text, record)"/>
|
|
|
|
+ </span>
|
|
|
|
+ <span slot="action" slot-scope="text, record">
|
|
|
|
+ <a-button type="link" @click="handleEdit(record)">编辑</a-button>
|
|
|
|
+ <a-button type="link" @click="handleSet(record)">货位设置</a-button>
|
|
|
|
+ <!-- <span v-if="!($hasPermissions('B_powerMD_user_edit') && record.superAdmin!=1) && !(record.loginFlag==1 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_restPwd')) && !(record.loginFlag==0 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_del'))">--</span> -->
|
|
|
|
+ </span>
|
|
|
|
+ </s-table>
|
|
|
|
+ </a-spin>
|
|
|
|
+ <!-- 自建账号 新增/编辑 -->
|
|
|
|
+ <addGoodsShelve :visible="showModal" @refresh="$refs.table.refresh(true)" :nowData="itemData" @close="handleUserCancel"></addGoodsShelve>
|
|
|
|
+ </a-card>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { STable, VSelect } from '@/components'
|
|
|
|
+import addGoodsShelve from './addGoodsShelve.vue'
|
|
|
|
+import { resetPSD, updateEnableStatus, getPowerUserList, delectUserPower } from '@/api/power-user.js'
|
|
|
|
+export default {
|
|
|
|
+ name: 'UserList',
|
|
|
|
+ components: {
|
|
|
|
+ STable, VSelect, addGoodsShelve
|
|
|
|
+ },
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ spinning: false,
|
|
|
|
+ advanced: false,
|
|
|
|
+ tableHeight: 0,
|
|
|
|
+ // 查询参数
|
|
|
|
+ queryParam: {
|
|
|
|
+ name: '',
|
|
|
|
+ phone: '',
|
|
|
|
+ loginFlag: undefined
|
|
|
|
+ },
|
|
|
|
+ showModal: false,
|
|
|
|
+ itemData: null, // 编辑行数据
|
|
|
|
+ // 表头
|
|
|
|
+ columns: [
|
|
|
|
+ { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
|
|
|
|
+ { title: '货架名称', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '配件经销商', dataIndex: 'org.name', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '汽车修理厂', dataIndex: 'name', width: '18%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
|
+ { title: '货位数量', dataIndex: 'phone', width: '12%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '创建时间', dataIndex: 'loginName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
|
+ { title: '状态', width: '9%', align: 'center', scopedSlots: { customRender: 'status' } },
|
|
|
|
+ { title: '操作', width: '10%', align: 'center', scopedSlots: { customRender: 'action' } }
|
|
|
|
+ ],
|
|
|
|
+ // 加载数据方法 必须为 Promise 对象
|
|
|
|
+ loadData: parameter => {
|
|
|
|
+ this.spinning = true
|
|
|
|
+ return getPowerUserList(Object.assign(parameter, this.queryParam)).then(res => {
|
|
|
|
+ let data
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ data = res.data
|
|
|
|
+ const no = (data.pageNo - 1) * data.pageSize
|
|
|
|
+ for (let i = 0; i < data.list.length; i++) {
|
|
|
|
+ const _item = data.list[i]
|
|
|
|
+ _item.no = no + i + 1
|
|
|
|
+ _item.loginFlag = _item.loginFlag + '' === '1'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.spinning = false
|
|
|
|
+ return data
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ optionAlertShow: false,
|
|
|
|
+ showSyncModal: false // 同步账号编辑弹框
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ // 新增
|
|
|
|
+ openModal () {
|
|
|
|
+ this.itemData = null
|
|
|
|
+ this.showModal = true
|
|
|
|
+ },
|
|
|
|
+ // 关闭弹框
|
|
|
|
+ handleUserCancel () {
|
|
|
|
+ this.showModal = false
|
|
|
|
+ this.itemData = null
|
|
|
|
+ },
|
|
|
|
+ // 重置
|
|
|
|
+ reset () {
|
|
|
|
+ this.queryParam.name = ''
|
|
|
|
+ this.queryParam.phone = ''
|
|
|
|
+ this.queryParam.loginFlag = undefined
|
|
|
|
+ this.$refs.table.refresh(true)
|
|
|
|
+ },
|
|
|
|
+ // 重置密码
|
|
|
|
+ resetPassword (row) {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$confirm({
|
|
|
|
+ title: '提示',
|
|
|
|
+ content: '确认重置密码吗?',
|
|
|
|
+ centered: true,
|
|
|
|
+ onOk () {
|
|
|
|
+ _this.spinning = true
|
|
|
|
+ resetPSD({
|
|
|
|
+ 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.itemData = row
|
|
|
|
+ if (row.ownerOrgFlag == 1) { // 自建
|
|
|
|
+ this.showModal = true
|
|
|
|
+ } else { // 同步过来的,非自建
|
|
|
|
+ this.showSyncModal = true
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 货位设置
|
|
|
|
+ handleSet (row) {
|
|
|
|
+ this.$router.push({ name: 'goodsAllocationSet', params: { id: row.id } })
|
|
|
|
+ // this.$router.push({ path: `/numsGoodsShelves/goodsShelvesAdministration/goodsAllocationSet/set/${row.id}` })
|
|
|
|
+ },
|
|
|
|
+ // 关闭弹框 同步账号
|
|
|
|
+ handleCancel () {
|
|
|
|
+ this.itemData = null
|
|
|
|
+ this.showSyncModal = false
|
|
|
|
+ },
|
|
|
|
+ // 修改状态
|
|
|
|
+ changeFlagHandle (text, record) {
|
|
|
|
+ const _data = {
|
|
|
|
+ id: record.id,
|
|
|
|
+ flag: record.loginFlag ? '1' : '0'
|
|
|
|
+ }
|
|
|
|
+ this.spinning = true
|
|
|
|
+ updateEnableStatus(_data).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ this.$message.success(res.message)
|
|
|
|
+ this.$refs.table.refresh()
|
|
|
|
+ this.spinning = false
|
|
|
|
+ } else {
|
|
|
|
+ this.$refs.table.refresh()
|
|
|
|
+ this.spinning = false
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ pageInit () {
|
|
|
|
+ const _this = this
|
|
|
|
+ this.$nextTick(() => { // 页面渲染完成后的回调
|
|
|
|
+ _this.setTableH()
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ setTableH () {
|
|
|
|
+ const tableSearchH = this.$refs.tableSearch.offsetHeight
|
|
|
|
+ this.tableHeight = window.innerHeight - tableSearchH - 215
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
|
|
|
|
+ this.setTableH()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted () {
|
|
|
|
+ if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
|
|
|
|
+ this.pageInit()
|
|
|
|
+ this.reset()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ activated () {
|
|
|
|
+ // 如果是新页签打开,则重置当前页面
|
|
|
|
+ if (this.$store.state.app.isNewTab) {
|
|
|
|
+ this.pageInit()
|
|
|
|
+ this.reset()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|