Commit 82a366bc by cwq0219

create

1 parent 63e6a143
import request from './request'
const path = 'dj.api.'
export function getList(data) {
data.method = `${path}basegoods.page`
return request(data)
}
// 分页查找服务门店
export function commodityAddSeviceMerchant(data) {
data.method = `${path}servicemerchantref.page`
return request(data)
}
// 根据基础商品Id查询商品
export function getGoodsInfoById(data) {
data.method = `${path}basegoods.get.byId`
return request(data)
}
// 根据基础商品id获取分配门店列表 - 查看门店
export function getMerchantList(data) {
data.method = 'dj.basegoodsmerchantref.list.byBaseGoodsId'
return request(data)
}
// 查询产品列表
export function getGoodsList(data) {
data.method = `${path}goodsinfo.list`
return request(data)
}
// 新增商品
export function baseGoodsAdd(data) {
data.method = `${path}basegoods.add`
return request(data, 'post')
}
// 修改商品
export function baseGoodsUpdate(data) {
data.method = `${path}basegoods.update`
return request(data, 'post')
}
// 导出
export function exportBaseList(data) {
data.method = `${path}basegoods.export`
return request(data, 'post')
}
import request from './request'
const path = 'dj.api.'
/**获取服务门店列表 */
export function getServiceStore(data) {
data.method = `${path}servicemerchantref.list`
return request(data)
}
/**根据门店商户号获取员工列表 */
export function getStaff(data) {
data.method = `${path}employee.getByMerchantId`
return request(data)
}
/**获取车型车系 */
export function getCarInfo(data) {
data.method = `${path}car.series.list`
return request(data)
}
/**根据车系id获取车辆类型 */
export function getCarType(data) {
data.method = `${path}car.type.list`
return request(data)
}
/**根据门店商户号获取基础商品列表 */
export function getGoods(data) {
data.method = `${path}basegoods.list`
return request(data)
}
/**预录订单 */
export function addOrder(data) {
data.method = `${path}order.advanceCreate`
return request(data, 'post')
}
import request from './request'
const path = 'dj.api.'
export function getUserInfo(data) {
data.method = `${path}user.info`
return request(data)
}
import request from './request'
const path = 'dj.api.'
export function getList(data) {
data.method = `${path}goodsinfo.page`
return request(data)
}
export function getType(data) {
data.method = `${path}goods.type.list`
return request(data)
}
// 添加产品
export function addGoods(data) {
data.method = `${path}goodsinfo.add`
return request(data, 'post')
}
// 编辑产品
export function editGoods(data) {
data.method = `${path}goodsinfo.update`
return request(data, 'post')
}
import request from './request'
const path = 'fims.'
export function searchReportLog(data) {
data.method = `${path}reportlog.search`
return request(data)
}
export function searchDepot(data) {
data.method = 'fims.configuration.from.conftype'
return request(data)
}
import request from './request'
import RequestMethods from './request.methods'
const path = 'dj.api.'
export function getList(data) {
data.method = `${path}servicemerchantref.page`
return request(data)
}
// 删除门店
export function deleteMerchant(data) {
data.method = `${path}servicemerchantref.delete.byId`
return request(data)
}
// 获取商户列表
export function serviceGetMerchantList(data) {
data.method = `${path}merchant.page`
return request(data)
}
// 新增商户门店
export function addServiceMerchant(data) {
data.method = `${path}servicemerchantref.add`
return request(data, RequestMethods.POST)
}
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: chenwq
* @Last Modified time: 2020-11-13 15:32:17
* @Last Modified time: 2020-12-14 10:51:11
*/
import request from './request'
......@@ -22,24 +22,15 @@ export const ROLE_LIST_URL = `${ROLE_PATH}list`
*/
export function AccountLogin(data) {
data.method = LOGIN_URL
return request(data)
// return new Promise(resolve => {
// resolve({
// roleId: 7,
// roleType: 2,
// mobile: '15234057707',
// userName: 'wxw',
// loginName: 'foutouren',
// authes: []
// // authes: [{
// // authId: '10101',
// // parentId: '101'
// // }, {
// // authId: '102',
// // parentId: '0'
// // }]
// })
// })
// return request(data, RequestMethods.POST)
return new Promise(resolve => {
resolve({
roleType: 1,
userName: 'wxw',
loginName: 'foutouren',
authes: []
})
})
}
// 权限
......
import request from './request'
const path = 'fims.order.'
function getListApi(data) {
data.method = `${path}search`
return request(data)
}
function editApi(data) {
data.method = `${path}edit`
return request(data)
}
function removeApi(data) {
data.method = `${path}delete`
return request(data)
}
export {
getListApi,
editApi,
removeApi
}
import request from './request'
const path = 'fims.material.'
function getListApi(data) {
data.method = `${path}list`
return request(data)
}
export {
getListApi
}
<!-- 编辑商品弹窗 -->
<template>
<d2-dialog
title="关联升级商品"
:isVisible.sync="relateProVisible"
btnOkLabel="关联"
@confirmDialog="handleRelateProConfirm"
@closeDialog="handleRelateProClose"
>
<div class="relateProDialog flex">
<img :src="proInfo.thumbUrl" />
<el-form
:model="proInfo"
:rules="rules"
label-width="110px"
ref="proRuleForm"
>
<el-form-item
label="关联升级商品"
prop="goodsCode"
>
<el-select
v-model="proInfo.goodsCode"
placeholder="请选择关联商品"
value-key="goodsCode"
@change="handleChangeGood"
>
<el-option
v-for="item in proList"
:key="item.goodsCode"
:label="item.goodsName"
:value="item.goodsCode"
:disabled="item.disabled"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="类别">
<el-input
disabled
value="升级"
class="dis-in-block"
></el-input>
</el-form-item>
<el-form-item
label="建议升级价"
prop="upgradePrice"
>
<el-input
v-model="proInfo.upgradePrice"
placeholder="请输入建议升级价"
class="dis-in-block"
@input="handleUpgradePrice"
></el-input>
<span>元</span>
</el-form-item>
<el-form-item
label="到店价"
prop="shopPrice"
>
<el-input
v-model="proInfo.shopPrice"
placeholder="请输入建议到店价"
class="dis-in-block"
@input="handleShopPrice"
></el-input>
<span>元</span>
</el-form-item>
<el-form-item label="升级最大折扣">
<el-input
v-model="proInfo.maxUpgradeDiscount"
placeholder="请输入升级最大折扣"
clearable
class="dis-in-block"
@input="handleMaxUpgradeDiscount"
></el-input>
<span>折</span>
</el-form-item>
</el-form>
</div>
</d2-dialog>
</template>
<script>
import _ from 'lodash'
import { limitPrice } from '@/common/constants'
export default {
name: 'relateProDialog',
data() {
return {
goodVal: {},
proInfo: {
// thumbUrl: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1244233290,1050095100&fm=26&gp=0.jpg',
thumbUrl: '',
goodsCode: '',
goodsName: '',
type: '',
upgradePrice: '',
shopPrice: '',
maxUpgradeDiscount: ''
},
rules: {
goodsCode: [{ required: true, message: '请选择关联升级商品', trigger: 'change' }],
upgradePrice: [{ required: true, message: '请输入建议升级价', trigger: 'blur' }],
shopPrice: [{ required: true, message: '请输入到店价', trigger: 'blur' }]
},
oldVal: {
upgradePrice: '',
shopPrice: '',
maxUpgradeDiscount: ''
}
}
},
// watch: {
// 'proInfo.upgradePrice'(val, oldVal) {
// this.proInfo.upgradePrice = limitPrice(val, oldVal, 8, 2)
// },
// 'proInfo.shopPrice'(val, oldVal) {
// this.proInfo.shopPrice = limitPrice(val, oldVal, 6, 2)
// },
// 'proInfo.maxUpgradeDiscount'(val, oldVal) {
// this.proInfo.maxUpgradeDiscount = limitPrice(val, oldVal, 1, 1, 1)
// }
// },
props: {
relateProVisible: {
type: Boolean,
default: false
},
proList: {
type: Array,
default: () => []
},
originProInfo: {
type: Object,
default: () => { }
}
},
mounted() {
this.proInfo = _.cloneDeep(this.originProInfo) || _.cloneDeep(this.proInfo)
// console.log(this.proInfo)
// console.log(this.proList)
},
methods: {
handleChangeGood(value) {
var targetItem = this.proList.find(item => item.goodsCode === value)
this.proInfo.goodsName = targetItem.goodsName
this.proInfo.goodsCode = targetItem.goodsCode
this.proInfo.thumbUrl = targetItem.thumbUrl
// console.log(value)
},
handleRelateProConfirm() {
// console.log(this.proInfo)
this.$refs.proRuleForm.validate(valid => {
if (valid) {
this.$emit('handleRelateProConfirm', this.proInfo)
}
})
},
handleRelateProClose() {
this.$emit('handleRelateProClose')
},
handleUpgradePrice(newVal) {
this.proInfo.upgradePrice = limitPrice(newVal, this.oldVal.upgradePrice, 8, 2)
this.oldVal.upgradePrice = this.proInfo.upgradePrice
},
handleShopPrice(newVal) {
this.proInfo.shopPrice = limitPrice(newVal, this.oldVal.shopPrice, 6, 2)
this.oldVal.shopPrice = this.proInfo.shopPrice
},
handleMaxUpgradeDiscount(newVal) {
this.proInfo.maxUpgradeDiscount = limitPrice(newVal, this.oldVal.maxUpgradeDiscount, 1, 1, 1)
this.oldVal.maxUpgradeDiscount = this.proInfo.maxUpgradeDiscount
}
}
}
</script>
<style scoped>
.relateProDialog.flex {
display: flex;
}
.relateProDialog img {
width: 160px;
height: 160px;
margin-right: 20px;
}
.relateProDialog .dis-in-block {
display: inline-block;
width: 75%;
margin-right: 6px;
}
</style>
<!-- 关联门店弹窗 -->
<template>
<d2-dialog
title="关联门店"
:isVisible.sync="relateStoreVisible"
width="70%"
btnOkLabel="关联"
@confirmDialog="handleRelateStoreConfirm"
@closeDialog="handleRelateStoreClose"
class="relateStore"
>
<slot></slot>
<el-row>
<el-col :span="12">
<el-table
ref="seletingTable"
:data="selectingData"
height="500px"
class="table"
border
@select="handleChange"
@select-all="handleAll"
>
<el-table-column
type="selection"
width="55"
align="center"
:selectable="selectable"
></el-table-column>
<!-- <el-table-column>
<template slot-scope="scope">{{scope.row.beServed}}</template>
</el-table-column> -->
<el-table-column
prop="merchantName"
label="门店名称"
align="center"
></el-table-column>
</el-table>
<el-pagination
small
background
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
:page-size="pageSize"
layout="total, prev, pager, next"
:total="total"
></el-pagination>
</el-col>
<el-col :span="12">
<el-table
:data="selectedData"
class="table"
border
height="500px"
>
<el-table-column
prop="merchantName"
align="center"
label="门店名称"
></el-table-column>
</el-table>
</el-col>
</el-row>
</d2-dialog>
</template>
<script>
export default {
name: 'relateStoreDialog',
data() {
return {
selectedData: [],
selectingData: [],
// 分页
total: 0,
currentPage: 1,
pageSize: 10
}
},
props: {
relateStoreVisible: {
type: Boolean,
default: false
},
storeApi: {
type: Function,
default: () => { }
},
storeSelected: {
type: Array,
default: () => []
},
storeSearchForm: {
type: Object,
default: () => { }
}
// 限制个数
// maxLength: {
// type: String,
// default: '-1'
// }
},
mounted() {
this.selectedData = this.storeSelected
this.getSelectingList()
},
methods: {
selectable(row, index) {
return row.hasOwnProperty('beServed') ? !row.beServed : true
},
recoverySelection() {
var exitIds = this.selectedData.map(item => item.merchantId)
this.selectingData.forEach(item => {
exitIds.includes(item.merchantId) && this.$refs.seletingTable.toggleRowSelection(item, true)
})
},
getSelectingList() {
this.storeApi({
...this.storeSearchForm,
currentPage: this.currentPage,
pageSize: this.pageSize
}).then(res => {
console.log(res)
this.selectingData = res.list
this.total = res.total
this.$nextTick(() => {
this.recoverySelection()
})
})
},
handleChange(selection, row) {
var addOrDelete = !!selection.find(item => item.merchantId === row.merchantId)
// var item = selection.find(item => item.merchantId === row.merchantId)
// if (addOrDelete) {
// if (this.maxLength !== '-1' && this.selectedData.length > this.maxLength - 1) {
// this.$message.error(`只能选择${this.maxLength}个门店`)
// this.$refs.seletingTable.toggleRowSelection(item, false)
// return true
// }
// this.selectedData.push(row)
// return true
// }
// this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId)
addOrDelete
? this.selectedData.push(row)
: (this.selectedData = this.selectedData.filter(item => item.merchantId !== row.merchantId))
},
handleAll(selection) {
// if (this.selectingData[0].hasOwnProperty('beServed') && ((selection.map(i => i.beServed === true).length + this.selectedData.length) > (this.maxLength - 1)) && selection.length) {
// this.$message.error(`只能选择${this.maxLength}个门店`)
// this.selectingData.forEach(item => {
// this.$refs.seletingTable.toggleRowSelection(item, false)
// })
// console.log(this.selectedData)
// return true
// }
// this.selectingData.forEach(item => {
// var isExit = this.selectedData.findIndex(subItem => subItem.merchantId === item.merchantId)
// var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
// if (selection.length && (isExit === -1) && !isServed) {
// this.selectedData.push(item)
// } else if (!selection.length && (isExit !== -1) && !isServed) {
// this.selectedData.splice(isExit, 1)
// }
// })
this.selectingData.forEach(item => {
var isExit = this.selectedData.findIndex(subItem => subItem.merchantId === item.merchantId)
var isServed = item.hasOwnProperty('beServed') ? item.beServed : false
if (selection.length && (isExit === -1) && !isServed) {
this.selectedData.push(item)
} else if (!selection.length && (isExit !== -1)) {
this.selectedData.splice(isExit, 1)
}
})
},
handleCurrentChange(val) {
this.currentPage = val
this.getSelectingList()
},
handleRelateStoreConfirm() {
this.$emit('handleRelateStoreConfirm', this.selectedData)
},
handleRelateStoreClose() {
this.$emit('handleRelateStoreClose')
}
}
}
</script>
<style>
.relateStore .table {
margin: 0 auto 20px !important;
width: 98%;
}
.relateStore .el-table .cell {
line-height: 26px !important;
}
.relateStore .el-table .cell {
padding: 0 8px !important;
}
</style>
......@@ -11,6 +11,4 @@ Vue.component('d2-icon-svg', () => import('./d2-icon-svg/index.vue'))
Vue.component('d2-table-header', () => import('./d2-table-header/index.vue'))
Vue.component('d2-table', () => import('./d2-table/index.vue'))
Vue.component('d2-dialog', () => import('./d2-dialog/index.vue'))
Vue.component('d2-form', () => import('./d2-form/index.vue'))
Vue.component('relateStoreDialog', () => import('./d2-form/relateStoreDialog.vue'))
Vue.component([authButton.name], authButton)
......@@ -11,7 +11,7 @@
</el-dropdown-menu>
</el-dropdown>-->
<div v-popover:popover-personal class="d2-mr personal-wrap">
<span v-if="show" class="btn-text">{{info && info.userType ? (info.userType == 1 ? `${info.detail.name}` : `${info.detail.merchantName}`) : '未登录'}} <d2-el-icon name="caret-bottom"/></span>
<span v-if="show" class="btn-text">{{info && info.userName ? `${info.userName}` : '未登录'}} <d2-el-icon name="caret-bottom"/></span>
<el-popover ref="popover-personal" placement="bottom-end" trigger="hover">
<personal-panel :user="info"></personal-panel>
</el-popover>
......
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-27 19:16:26
* @Last Modified by: chenwq
* @Last Modified time: 2020-11-13 09:44:00
* @Last Modified time: 2020-12-14 11:01:26
*/
const permision = {}
/**
......@@ -78,7 +78,7 @@ const _loop = function(res, fnGetMenu) {
if (!__oMenu) { // 不存在 可能是 按钮 直接继续循环
return true
}
if (+(__oMenu.parentId) === 1) { // 取出1级菜单
if (+(__oMenu.parentId) === 0) { // 取出1级菜单
__aParent.push(__oMenu)
} else { // 取出子菜单
__aSub.push(__oMenu)
......
......@@ -23,14 +23,23 @@ export const home = {
name: 'index',
icon: 's-home',
meta: {
title: '预录客户',
authId: '901',
parentId: '1',
title: 'echats',
authId: '101',
parentId: '0',
cache: true
},
component: _import('flow/editCustomer')
component: _import('index')
}
export const sys = [
// 系统 前端日志
// {
// path: '/log',
// name: 'log',
// meta: {
// title: '前端日志',
// },
// component: _import('system/log')
// },
// 刷新页面 必须保留
{
path: '/refresh',
......@@ -49,169 +58,169 @@ export const sys = [
/**
* 所有需动态过滤的资源点
* 101 - 工作台
* 102 - 流量管理
* 103 - 商品库
* 104 - 订单管理
* 105 - 财务管理
* 106 - 系统设置
*/
export const resources = {
'903': {
path: '/goods',
name: 'goods',
icon: 's-goods',
meta: {
title: '商品库',
authId: '903',
parentId: '1',
cache: true
}
},
'90301': {
path: '/product',
name: 'product',
icon: 'document',
meta: {
title: '产品管理',
authId: '90301',
parentId: '903',
cache: true
},
auth: [{
authId: '9030101',
parentId: '90301',
label: '新增产品',
category: 'Button',
type: 'primary',
handle: 'handleAdd'
},
// {
// authId: '1030102',
// parentId: '10301',
// label: '导出',
// category: 'Button',
// handle: 'handleExport'
// },
{
authId: '9030102',
parentId: '90301',
label: '修改',
handle: 'handleEdit'
}],
component: _import('goods/product')
},
'90304': {
path: '/editProduct',
name: 'editProduct',
icon: 'document',
meta: {
title: '产品编辑',
authId: '90304',
parentId: '903',
cache: true,
sideHidden: true
},
component: _import('goods/editProduct')
},
'90302': {
path: '/commodity',
name: 'commodity',
icon: 'document',
meta: {
title: '商品管理',
authId: '90302',
parentId: '903',
cache: true
},
auth: [{
authId: '9030201',
parentId: '90302',
label: '新增商品',
category: 'Button',
type: 'primary',
handle: 'handleAdd'
}, {
authId: '9030202',
parentId: '90302',
label: '导出',
category: 'Button',
handle: 'handleExport'
// rule:{0: '上架',}
}, {
authId: '9030203',
parentId: '90302',
label: '编辑',
handle: 'handleEdit'
}, {
authId: '9030204',
parentId: '90302',
label: '查看门店',
handle: 'handleDetail'
}],
component: _import('goods/commodity')
},
'90305': {
path: '/editCommodity',
name: 'editCommodity',
icon: 'document',
meta: {
title: '商品编辑',
authId: '90305',
parentId: '903',
// cache: true,
sideHidden: true
},
component: _import('goods/editCommodity')
},
'906': {
path: '/systemConfig',
name: 'systemConfig',
icon: 's-tools',
meta: {
title: '系统设置',
authId: '906',
parentId: '1',
cache: true
}
},
'90601': {
path: '/personalInfo',
name: 'personalInfo',
icon: 'user-solid',
meta: {
title: '个人信息',
authId: '90601',
parentId: '906',
cache: true
},
component: _import('systemConfig/personalInfo')
},
'90602': {
path: '/serviceStore',
name: 'serviceStore',
icon: 'office-building',
meta: {
title: '服务4s店',
authId: '90602',
parentId: '906',
cache: true
},
auth: [{
authId: '9060201',
parentId: '90602',
label: '新增服务门店',
category: 'Button',
type: 'primary',
handle: 'handleAdd'
}, {
authId: '9060202',
parentId: '90602',
label: '删除',
handle: 'handleDelete'
}],
component: _import('systemConfig/serviceStore')
}
// '102': {
// path: '/bb',
// icon: 'document',
// name: '表格组件',
// meta: {
// title: '表格组件',
// authId: '102',
// parentId: '0'
// }
// },
// '10201': {
// path: '/table1',
// icon: 'document-copy',
// name: 'fimsTable1',
// meta: {
// title: '默认使用',
// authId: '10201',
// parentId: '102',
// cache: true
// },
// component: _import('table1'),
// auth: [{
// authId: '1020101',
// parentId: '10201',
// label: '编辑',
// handle: 'handleEdit'
// }, {
// authId: '1020102',
// parentId: '10201',
// label: '删除',
// color: '#FF0000',
// handle: 'handleDelete'
// }, {
// authId: '1020103',
// parentId: '10201',
// label: '添加',
// category: 'Button',
// type: 'button',
// handle: 'handleEdit',
// icon: 'plus'
// }, {
// authId: '1020104',
// parentId: '10201',
// label: '批量操作',
// category: 'Button',
// type: 'button',
// handle: 'handleOperate'
// }]
// },
// '10202': {
// path: '/table2',
// icon: 'finished',
// name: 'fimsTable2',
// meta: {
// title: '外部数据传入',
// authId: '10202',
// parentId: '102',
// cache: true
// },
// component: _import('table2')
// },
// '107': {
// path: '/users',
// icon: 'user',
// name: '帐号管理',
// meta: {
// title: '用户管理',
// authId: '107',
// parentId: '0'
// }
// },
// '10701': {
// path: '/user',
// name: 'FimsUsers',
// icon: 'user-solid',
// meta: {
// title: '用户管理',
// authId: '10701',
// parentId: '107',
// cache: true
// },
// auth: [{ // 列表操作
// authId: '1070101',
// parentId: '10701',
// label: '审核',
// handle: 'handleVerify'
// }, { //
// authId: '1070102',
// parentId: '10701',
// label: '重置密码',
// handle: 'handleOperation'
// }, { //
// authId: '1070103',
// parentId: '10701',
// label: '编辑',
// handle: 'handleEdit'
// }, { //
// authId: '1070104',
// parentId: '10701',
// label: '延期',
// handle: 'handleOperation'
// }, { //
// authId: '1070105',
// parentId: '10701',
// label: '禁用',
// color: '#FF0000',
// handle: 'handleOperation'
// }, { //
// authId: '1070106',
// parentId: '10701',
// label: '激活',
// handle: 'handleOperation'
// }, { // 列表操作
// authId: '1070107',
// parentId: '10701',
// label: '创建用户',
// category: 'action',
// type: 'button',
// handle: 'handleRegister',
// icon: 'plus'
// }],
// component: _import('userManage/user')
// },
// '10702': {
// path: '/role',
// name: 'FimsRoles',
// icon: 'open',
// meta: {
// title: '权限管理',
// authId: '10702',
// parentId: '107'
// },
// auth: [{
// authId: '1070201',
// parentId: '10702',
// label: '创建角色',
// category: 'action',
// handle: 'handleEdit',
// type: 'button',
// icon: 'plus'
// }, {
// authId: '1070202',
// parentId: '10702',
// label: '权限编辑',
// handle: 'handleEdit',
// type: 'text'
// }],
// component: _import('userManage/role')
// },
// '10703': {
// path: '/loginLogs',
// name: 'FimsLoginLogs',
// icon: 'tickets',
// meta: {
// title: '登录日志',
// authId: '10703',
// parentId: '107',
// cache: true
// },
// component: _import('userManage/loginLogs')
// }
}
/**
......
import util from '@/libs/util.js'
import { AccountLogin, getAuths, getUserInfo } from '@api/sys.account'
import { SUPPER_ADMIN } from '@/common/constants'
import { localRoutes } from '@/router/routes'
import { baseConfig } from '@/main'
import {
AccountLogin,
getAuths,
getUserInfo
} from '@api/sys.account'
import {
SUPPER_ADMIN
} from '@/common/constants'
import {
localRoutes
} from '@/router/routes'
import {
baseConfig
} from '@/main'
export default {
namespaced: true,
actions: {
......@@ -23,33 +33,22 @@ export default {
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
// token 代表用户当前登录状态 建议在网络请求中携带 token
// 如有必要 token 需要定时更新,默认保存一天
// util.cookies.set('uuid', data.loginName)
util.cookies.set('token', data.sessionId)
getAuths({}).then(async res => {
// console.log(res)
!res.map(i => i.authId).includes('901') && res.unshift({
authId: '901',
name: '预录客户',
parentId: '1'
})
data.roleType = baseConfig.hasAuth ? data.roleType : SUPPER_ADMIN
const authes = (+data.roleType === SUPPER_ADMIN)
? util.permision.flatten(Object.values(localRoutes))
.map(obj => ({ authId: obj.authId, parentId: obj.parentId }))
: _.cloneDeep(res)
await dispatch('d2admin/auth/set', authes, { root: true })
// delete data.authes
// 初始化权限
await dispatch('d2admin/auth/init', null, { root: true })
// // 用户登录后从持久化数据加载一系列的设置
await dispatch('load')
// 结束
resolve()
})
getUserInfo({}).then(async res => {
// // 设置 vuex 用户信息
await dispatch('d2admin/user/set', res, { root: true })
})
util.cookies.set('uuid', data.loginName)
// data.roleType = baseConfig.hasAuth ? data.roleType : SUPPER_ADMIN
const authes = (+data.roleType === SUPPER_ADMIN)
? util.permision.flatten(Object.values(localRoutes))
.map(obj => ({ authId: obj.authId, parentId: obj.parentId }))
: _.cloneDeep(data.authes)
await dispatch('d2admin/auth/set', authes, { root: true })
// // 设置 vuex 用户信息
delete data.authes
await dispatch('d2admin/user/set', data, { root: true })
// 初始化权限
await dispatch('d2admin/auth/init', null, { root: true })
// // 用户登录后从持久化数据加载一系列的设置
await dispatch('load')
// 结束
resolve()
})
.catch(err => {
console.log('err: ', err)
......@@ -62,15 +61,24 @@ export default {
* @param {Object} context
* @param {Object} payload confirm {Boolean} 是否需要确认
*/
logout({ commit, dispatch }, { confirm = false } = {}) {
logout({
commit,
dispatch
}, {
confirm = false
} = {}) {
/**
* @description 注销
*/
return new Promise(async resolve => {
// 删除cookie
// util.cookies.remove('uuid')
await dispatch('d2admin/user/clear', null, { root: true })
await dispatch('d2admin/base/clear', null, { root: true })
await dispatch('d2admin/user/clear', null, {
root: true
})
await dispatch('d2admin/base/clear', null, {
root: true
})
// await commit('d2admin/page/setCurrent', null, { root: true })
// await commit('d2admin/auth/set', null, { root: true })
resolve()
......@@ -80,20 +88,34 @@ export default {
* @description 用户登录后从持久化数据加载一系列的设置
* @param {Object} context
*/
load({ dispatch }) {
load({
dispatch
}) {
return new Promise(async resolve => {
// DB -> store 加载用户名
await dispatch('d2admin/user/load', null, { root: true })
await dispatch('d2admin/user/load', null, {
root: true
})
// DB -> store 加载主题
await dispatch('d2admin/theme/load', null, { root: true })
await dispatch('d2admin/theme/load', null, {
root: true
})
// DB -> store 加载页面过渡效果设置
await dispatch('d2admin/transition/load', null, { root: true })
await dispatch('d2admin/transition/load', null, {
root: true
})
// DB -> store 持久化数据加载上次退出时的多页列表
await dispatch('d2admin/page/openedLoad', null, { root: true })
await dispatch('d2admin/page/openedLoad', null, {
root: true
})
// DB -> store 持久化数据加载侧边栏折叠状态
await dispatch('d2admin/menu/asideCollapseLoad', null, { root: true })
await dispatch('d2admin/menu/asideCollapseLoad', null, {
root: true
})
// DB -> store 持久化数据加载全局尺寸
await dispatch('d2admin/size/load', null, { root: true })
await dispatch('d2admin/size/load', null, {
root: true
})
// DB - > 初始化 基础数据
// await dispatch('d2admin/base/init', null, { root: true })
// 后台接口 -> store
......
<!-- 产品管理 -->
<template>
<d2-container class="product">
<el-form
:inline="true"
v-model="searchForm"
label-width="85px"
slot="header"
>
<el-form-item label="产品名称">
<el-input
v-model="searchForm.goodsName"
placeholder="请输入产品名称"
clearable
></el-input>
</el-form-item>
<el-form-item label="分类">
<el-select
v-model="searchForm.goodsType"
placeholder="请选择产品分类"
>
<el-option
v-for="item in baseData.productTypeList"
:key="item.goodsType"
:value="item.goodsType"
:label="item.goodsTypeName"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="品牌商">
<el-select
v-model="searchForm.brandMerchantCode"
placeholder="请选择品牌商"
>
<el-option
v-for="item in baseData.brandList"
:key="item.confId"
:label="item.confValue"
:value="item.confId"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
:id="tableParams.btnId"
type="primary"
icon="el-icon-search"
>查询</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<d2-table-header>
<auth-button
category="Button"
:data="editFormReset"
></auth-button>
</d2-table-header>
<d2-table
ref="productTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
>
<img
slot="img"
slot-scope="scope"
class="pro-img"
:src="scope.scope.thumbUrl"
/>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
</d2-container>
</template>
<script>
import _ from 'lodash'
import { getList } from '@api/product'
import { BaseData, brandMerchantList } from '@/common/constants.js'
import { mapActions } from 'vuex'
export default {
name: 'product',
data() {
return {
searchForm: {
goodsName: '',
goodsType: '',
brandMerchantCode: ''
},
editFormReset: {
aa: ''
},
getListApi: getList,
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [{
label: '缩略图',
prop: 'thumbUrl',
addHtml: 'img'
}, {
label: '产品名称',
prop: 'goodsName'
}, {
label: '产品ID',
prop: 'id'
}, {
label: '分类',
prop: 'goodsTypeName'
}, {
label: '品牌商',
prop: 'brandMerchantName'
}, {
label: '创建时间',
prop: 'createDateStr'
}, {
label: '产品状态',
prop: 'state',
formatter: (cellValue) => {
// return {
// 0: '上架',
// 1: '下架'
// }[cellValue.state]
return '上架'
}
}]
},
// 查看门店
detailVisible: false,
// 基本数据
baseData: {
productTypeList: [],
brandList: []
}
}
},
mounted() {
// this.getProductType()
this.getBaseData()
// console.log(storeDetail)
// var allOpt = { confId: '', confKey: '全部' }
// this.baseData.product.unshift(allOpt)
// this.baseData.brandList.unshift(allOpt)
this.baseData.brandList = _.cloneDeep(brandMerchantList)
var allOpt = { confId: '', confValue: '全部' }
this.baseData.brandList.unshift(allOpt)
},
methods: {
// getProductType(){
// let prarms = {}
// getType(prarms).then(res => {
// this.baseData.productTypeList = res || []
// });
// },
...mapActions('d2admin/base', ['get']),
async getBaseData() {
this.baseData.productTypeList = _.cloneDeep(await this.get(BaseData.productType))
this.baseData.productTypeList.unshift({
goodsType: '',
goodsTypeName: '全部'
})
},
beforeSearchFn() {
return new Promise(resolve => {
console.log('搜索前操作--')
resolve()
})
},
handleReset() {
this.searchForm = {
goodsName: '',
goodsType: '',
brandMerchantCode: ''
}
},
handleAdd(form) {
// console.log(form)
this.$router.push({
name: 'editProduct',
params: {
addOrEdit: 'add',
form: form
}
})
},
// handleExport() { },
handleEdit(row) {
// console.log(row)
this.$router.push({
name: 'editProduct',
params: {
addOrEdit: 'edit',
form: row
}
})
},
handleDetail(row) {
this.detailData = row
this.detailVisible = true
},
handleDetailClose() {
this.detailVisible = false
}
}
}
</script>
<style scoped>
.product .pro-img {
width: 80px;
height: 80px;
}
</style>
<!-- 商品管理 -->
<template>
<d2-container class="commodity">
<el-form
:inline="true"
v-model="searchForm"
label-width="85px"
slot="header"
>
<el-form-item label="商品名称">
<el-input
v-model="searchForm.goodsName"
placeholder="请输入商品名称"
clearable
></el-input>
</el-form-item>
<el-form-item label="分类">
<el-select
v-model="searchForm.goodsType"
placeholder="请选择产品分类"
clearable
>
<el-option
v-for="item in baseData.goodsType"
:key="item.goodsType"
:label="item.goodsTypeName"
:value="item.goodsType"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="品牌商">
<el-select
v-model="searchForm.brandMerchantCode"
placeholder="请选择品牌商"
>
<el-option
v-for="item in baseData.brandList"
:key="item.confId"
:label="item.confValue"
:value="item.confId"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
:id="tableParams.btnId"
type="primary"
icon="el-icon-search"
>查询</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<d2-table-header>
<auth-button
category="Button"
:data="editFormReset"
></auth-button>
</d2-table-header>
<d2-table
ref="commodityTable"
:hasNum="false"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
>
<img
slot="img"
slot-scope="scope"
class="pro-img"
:src="scope.scope.goodsInfo.thumbUrl"
/>
<auth-button
v-if="Object.keys(scope.scope).includes('upgradeGoodsList')"
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
<!-- <auth-button
v-if="Object.keys(scope.scope).includes('upgradeGoodsList')"
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
<el-button
v-else
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
type="text"
@click="handleUpOrDown"
>{{scope.scope.state ? '上架' : '下架'}}</el-button> -->
</d2-table>
<d2-dialog
title="门店列表"
:className="storeDetail"
:isVisible.sync="detailVisible"
:showClose="showClose"
noCancel="true"
@closeDialog="handleDetailClose"
@confirmDialog="handleDetailClose"
>
<store-detail
v-if="detailVisible"
:detailData="detailData"
></store-detail>
</d2-dialog>
</d2-container>
</template>
<script>
import { getList, exportBaseList } from '@api/commodity'
import { BaseData, brandMerchantList } from '@/common/constants.js'
import { export_json_to_excel } from '@/common/Export2Excel.js'
import { mapActions } from 'vuex'
import _ from 'lodash'
import storeDetail from './storeDetail'
export default {
name: 'commodity',
data() {
return {
searchForm: {
goodsName: '',
goodsType: '',
brandMerchantCode: ''
},
editFormReset: {
aa: ''
},
getListApi: getList,
// 表格参数
tableParams: {
needUnique: true,
mutiSelectUniqueKey: 'uniqueVal',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [{
label: '序号',
prop: 'index'
}, {
label: '商品ID',
prop: 'goodsCode'
}, {
label: '商品图片',
prop: 'img',
addHtml: 'img'
}, {
label: '商品名称',
parentProp: 'goodsInfo',
prop: 'goodsName'
}, {
label: '分类',
parentProp: 'goodsInfo',
prop: 'goodsTypeName'
}, {
label: '品牌商',
parentProp: 'goodsInfo',
prop: 'brandMerchantName'
}, {
label: '属性',
prop: 'attribute'
}, {
label: '关联商品数',
prop: 'upgradeGoodsNum'
}, {
label: '关联商户数',
prop: 'merchantNum'
}, {
label: '产品状态',
prop: 'goodsStatus',
formatter: (cellValue) => {
// return {
// 0: '上架',
// 1: '下架'
// }[cellValue.state]
return '上架'
}
}, {
label: '创建时间',
prop: 'createDateStr'
}]
},
// 查看门店
detailVisible: false,
showClose: false,
// 基本数据
baseData: {
goodsType: [],
brandList: []
}
}
},
components: {
storeDetail
},
mounted() {
this.getBaseData()
this.baseData.brandList = _.cloneDeep(brandMerchantList)
var allOpt = { confId: '', confValue: '全部' }
this.baseData.brandList.unshift(allOpt)
},
methods: {
...mapActions('d2admin/base', ['get']),
async getBaseData() {
this.baseData.goodsType = _.cloneDeep(await this.get(BaseData.productType))
this.baseData.goodsType.unshift({
goodsType: '',
goodsTypeName: '全部'
})
},
beforeSearchFn() {
return new Promise(resolve => {
console.log('搜索前操作--')
resolve()
})
},
handleReset() {
var keys = Object.keys(this.searchForm)
keys.forEach(item => {
this.searchForm[item] = ''
})
},
handleAdd(form) {
this.$router.push({
name: 'editCommodity',
params: {
addOrEdit: 'add',
form: form
}
})
},
handleExport() {
const tHeader = ['序号', '商品ID', '商品名称', '分类', '品牌商', '属性', '关联商品数', '关联商户数', '产品状态', '创建时间']
const fieldVal = ['index', 'goodsCode', 'goodsName', 'goodsTypeName', 'brandMerchantName', 'attribute', 'upgradeGoodsNum', 'merchantNum', 'goodsStatus', 'createdDate']
exportBaseList(this.searchForm).then(res => {
// console.log(res)
require.ensure([], () => {
const data = this.formatJson(fieldVal, res)
export_json_to_excel(tHeader, data, '基础商品列表')
})
})
},
formatJson(filterVal, jsonData) {
return jsonData.map(v => filterVal.map(j => v[j]))
},
handleEdit(row) {
this.$router.push({
name: 'editCommodity',
params: {
addOrEdit: 'edit',
row: row
}
})
},
handleDetail(row) {
this.detailData = _.cloneDeep(row)
this.detailVisible = true
},
handleDetailClose() {
this.detailVisible = false
}
}
}
</script>
<style scoped>
.commodity .pro-img {
width: 80px;
height: 80px;
}
</style>
<!-- 商品编辑 -->
<template>
<d2-container class="edit-commodity">
<d2-form
v-if="show"
ref="d2Form"
:formItemWidth="formItemWidth"
:storeApi="commodityAddSeviceMerchant"
:rules="rules"
:addOrEdit="addOrEdit"
:originData="editData"
:formList="editForm"
:formRef="comFormRef"
:headImg="headImg"
@handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose"
></d2-form>
</d2-container>
</template>
<script>
import { mapActions } from 'vuex'
import { limitPrice } from '@/common/constants'
import { commodityAddSeviceMerchant, getGoodsList, baseGoodsAdd, baseGoodsUpdate, getGoodsInfoById } from '@/api/commodity'
export default {
name: 'editCommodity',
data() {
return {
show: false,
commodityAddSeviceMerchant: commodityAddSeviceMerchant,
editData: {
goodsCode: '',
goodsName: '',
goodsTypeName: '',
thumbUrl: '',
spsx: '基础商品',
retailPrice: '',
maxRetailDiscount: '',
upgradeGoods: [],
linkMerchantIds: []
},
markOldVal: {
retailPrice: '',
shopPrice: '',
maxRetailDiscount: ''
},
formItemWidth: '200px',
rules: {
goodsCode: [{ required: true, message: '请选择商品名称', trigger: 'change' }],
shopPrice: [{ required: true, message: '请输入到店价', trigger: 'blur' }],
linkMerchantIds: [{ required: true, message: '请选择关联门店', trigger: 'change' }]
},
headImg: {
isHas: true,
attr: 'thumbUrl'
},
comFormRef: 'com',
editForm: [{
title: '商品基本信息',
formBlock: [{
name: 'goodsCode',
label: '商品名称',
isRequired: true,
type: 'select',
tips: '选择基础商品',
isClear: false,
optionList: [],
isDisabled: true,
optionId: 'goodsCode',
optionLabel: 'goodsName'
}, {
name: 'goodsTypeName',
label: '类别',
type: 'input',
isDisabled: true
}, {
name: 'spsx',
label: '商品属性',
type: 'input',
isDisabled: true
}, {
name: 'sapCode',
label: 'sap编号',
type: 'input',
isDisabled: true
}]
}, {
title: '价格信息',
formBlock: [{
name: 'retailPrice',
label: '商品零售价',
type: 'input',
unit: '元',
tips: '(前端展示给车主)',
handleInput: (newVal) => {
this.$refs.d2Form.formData.retailPrice = limitPrice(newVal, this.markOldVal.retailPrice, 6, 2)
this.markOldVal.retailPrice = this.$refs.d2Form.formData.retailPrice
}
}, {
name: 'shopPrice',
label: '到店价',
type: 'input',
unit: '元',
tips: '(商品最终交易价格)',
handleInput: (newVal) => {
this.$refs.d2Form.formData.shopPrice = limitPrice(newVal, this.markOldVal.shopPrice, 6, 2)
this.markOldVal.shopPrice = this.$refs.d2Form.formData.shopPrice
}
}, {
name: 'maxRetailDiscount',
label: '到店零售折扣',
type: 'input',
unit: '折',
handleInput: (newVal) => {
this.$refs.d2Form.formData.maxRetailDiscount = limitPrice(newVal, this.markOldVal.maxRetailDiscount, 1, 1, 1)
this.markOldVal.maxRetailDiscount = this.$refs.d2Form.formData.maxRetailDiscount
}
}]
}, {
title: '关联升级商品信息',
formBlock: [{
name: 'upgradeGoods',
label: '关联升级商品',
type: 'relatePro',
optionValue: 'goodsCode',
relateAttr: 'goodsCode'
}]
}, {
title: '关联门店信息',
formBlock: [{
name: 'linkMerchantIds',
label: '分配关联门店',
btnTxt: '点击选择关联门店',
type: 'button',
handleName: 'relateStore',
optionValue: 'merchantId'
}]
}]
}
},
mounted() {
this.show = false
// this.$route.params.row && (this.editData = _.cloneDeep(this.$route.params.row))
// console.log(this.editData)
// add - 新增;edit - 编辑
this.addOrEdit = this.$route.params.addOrEdit
this.getGoodsList()
if (this.addOrEdit === 'edit') {
getGoodsInfoById({ id: this.$route.params.row.id }).then(res => {
// console.log(res)
this.editForm[0].formBlock[0].isDisabled = true
this.editData = {
id: res.id,
goodsCode: res.goodsCode,
goodsName: res.goodsInfo.goodsName,
thumbUrl: res.goodsInfo.thumbUrl,
goodsTypeName: res.goodsInfo.goodsTypeName,
spsx: '基础商品',
retailPrice: res.retailPrice,
shopPrice: res.shopPrice,
maxRetailDiscount: res.maxRetailDiscount,
upgradeGoods: res.upgradeGoodsList.map(item => {
item['goodsName'] = item.goodsInfo.goodsName
item['thumbUrl'] = item.goodsInfo.thumbUrl
item.profitValue = item.profitValue + ''
return item
}),
linkMerchantIds: res.merchantRefList.length ? res.merchantRefList.map(item => Object.assign(item, item.merchantInfo)) : []
}
console.log(this.editData)
this.$nextTick(() => {
this.show = true
})
})
} else {
this.editForm[0].formBlock[0].isDisabled = false
this.$nextTick(() => {
this.show = true
})
}
},
methods: {
...mapActions({ close: 'd2admin/page/close' }),
// ...mapActions('d2admin/page', ['close']),
getGoodsList() {
// var params = this.addOrEdit === 'edit' ? {} : { exceptBase: true }
getGoodsList({}).then(res => {
// console.log(res)
this.editForm[0].formBlock[0].optionList = res
})
},
handleAddClose(isRefresh = false) {
this.close({ tagName: '/commodity' })
this.$router.push({ name: 'commodity' })
this.close({ tagName: '/editCommodity' })
},
handleAddConfirm(data) {
var upgradeGoodsAttr = ['goodsCode', 'shopPrice', 'maxUpgradeDiscount', 'upgradePrice', 'profitType', 'profitValue']
var params = {
goodsCode: data.goodsCode,
retailPrice: data.retailPrice,
maxRetailDiscount: data.maxRetailDiscount,
shopPrice: data.shopPrice,
upgradeGoods: data.upgradeGoods.length ? data.upgradeGoods.map(item => {
const tempVal = {}
upgradeGoodsAttr.forEach(i => {
item[i] && (tempVal[i] = item[i])
})
return {
...tempVal
}
}) : [],
linkMerchantIds: data.linkMerchantIds ? data.linkMerchantIds.map(item => String(item.merchantId)) : []
}
// console.log(_.cloneDeep(params))
if (this.addOrEdit === 'edit') {
params.id = data.id
baseGoodsUpdate(params).then(res => {
console.log(res)
this.notice.okTips()
this.handleAddClose()
})
} else {
baseGoodsAdd(params).then(res => {
console.log(res)
this.notice.okTips()
this.handleAddClose(true)
})
}
}
}
}
</script>
<style>
.edit-commodity {
margin: 0 20px;
position: relative;
}
</style>
<!-- 产品编辑 -->
<template>
<d2-container class="edit-product">
<d2-form
v-if="show"
ref="d2ProductForm"
:formItemWidth="formItemWidth"
:rules="rules"
addOrEdit="add"
:originData="editData"
:formList="editForm"
:formRef="proFormRef"
@handleAddConfirm="handleAddConfirm"
@handleClose="handleAddClose"
></d2-form>
</d2-container>
</template>
<script>
import _ from 'lodash'
import { mapActions } from 'vuex'
import { BaseData, brandMerchantList } from '@/common/constants.js'
import { addGoods, editGoods } from '@/api/product'
export default {
name: 'editProduct',
data() {
return {
show: false,
addOrEdit: 'add',
rules: {
goodsName: [{ required: true, message: '请输入产品名称', trigger: 'change' }],
goodsType: [{ required: true, message: '请选择分类', trigger: 'change' }],
// thumbUrl: [{ required: true, message: '请选择缩略图', trigger: 'change' }],
thumbUrlList: [{ required: true, message: '请选择缩略图', trigger: 'blur' }],
goodsImgList: [{ required: true, message: '请选择产品主图', trigger: 'blur' }]
},
editData: {
goodsName: '',
goodsType: '',
goodsTypeName: '',
sapCode: '',
brandMerchantCode: '',
brandMerchantName: '',
thumbUrl: '',
thumbUrlList: [],
goodsImgList: [],
goodsDescList: [{
resType: 2,
orderNo: 0,
content: ''
}]
},
proFormRef: 'pro',
editForm: [{
title: '产品基本信息',
formBlock: [{
name: 'goodsName',
label: '产品名称',
type: 'input',
maxlength:32
}, {
name: 'goodsType',
label: '分类',
isRequired: true,
type: 'select',
// tips: '选择产品分类',
isClear: false,
optionList: [],
optionId: 'goodsType',
optionLabel: 'goodsTypeName'
}, {
name: 'sapCode',
label: 'SAP编码',
type: 'input',
maxlength:32
}, {
name: 'brandMerchantCode',
label: '品牌商',
isRequired: true,
type: 'select',
// tips: '选择品牌商',
isClear: true,
optionList: [],
optionId: 'confId',
optionLabel: 'confValue'
}, {
name: 'thumbUrlList',
label: '缩略图',
type: 'photo',
topTips: '用于在小程序主页的商品列表展示',
maxPhotoNum: 1
}, {
name: 'goodsImgList',
label: '产品主图',
type: 'photo',
topTips: '用于在小程序商品详情页的顶部展示',
maxPhotoNum: 10
}, {
name: 'goodsDescList',
label: '产品描述',
type: 'descList',
maxlength:256
}]
}],
baseData: {
productType: []
}
}
},
mounted() {
this.addOrEdit = this.$route.params.addOrEdit
if (this.addOrEdit === 'edit') {
this.show = false
this.editData = _.cloneDeep(this.$route.params.form)
this.editData.thumbUrlList = [{
content: ''
}]
this.editData.thumbUrlList[0].content = this.editData.thumbUrl
console.log(this.editData)
this.$nextTick(() => {
this.show = true
})
} else {
this.show = true
}
this.getBaseData()
this.editForm[0].formBlock[3].optionList = brandMerchantList
},
methods: {
...mapActions({
get: 'd2admin/base/get',
close: 'd2admin/page/close'
}),
async getBaseData() {
const temp = await this.get(BaseData.productType)
this.baseData.productType = temp
this.editForm[0].formBlock[1].optionList = temp
console.log(this.baseData.productType)
},
handleAddClose(isRefresh = false) {
this.close({ tagName: '/product' })
this.$router.push({ name: 'product' })
this.close({ tagName: '/editProduct' })
},
handleAddConfirm(data) {
data.goodsDescList = data.goodsDescList.filter(item => item.content)
data.goodsTypeName = this.baseData.productType.find(item => item.goodsType === data.goodsType).goodsTypeName
data.thumbUrl = data.thumbUrlList[0].content
console.log(data)
data.brandMerchantCode && (data.brandMerchantName = brandMerchantList.find(item => item.confId === data.brandMerchantCode).confValue)
if (this.addOrEdit === 'edit') {
var params = {
id: data.id,
goodsName: data.goodsName,
goodsType: data.goodsType,
goodsTypeName: data.goodsTypeName,
brandMerchantCode: data.brandMerchantCode,
brandMerchantName: data.brandMerchantName,
sapCode: data.sapCode,
thumbUrl: data.thumbUrl,
goodsImgList: data.goodsImgList,
goodsDescList: data.goodsDescList
}
params.goodsImgList.forEach(i => {
delete i.createdDate
delete i.updatedDate
})
params.goodsDescList.forEach(i => {
delete i.createdDate
delete i.updatedDate
})
editGoods(params).then(res => {
console.log(res)
this.notice.okTips()
this.handleAddClose(true)
})
} else {
addGoods(data).then(res => {
this.notice.okTips()
this.handleAddClose(true)
})
}
}
}
}
</script>
<style scoped>
</style>
<!-- 产品管理 -->
<template>
<d2-container class="product">
<el-form
:inline="true"
v-model="searchForm"
label-width="85px"
slot="header"
>
<el-form-item label="产品名称">
<el-input
v-model="searchForm.goodsName"
placeholder="请输入产品名称"
clearable
></el-input>
</el-form-item>
<el-form-item label="分类">
<el-select
v-model="searchForm.goodsType"
placeholder="请选择产品分类"
>
<el-option
v-for="item in baseData.productTypeList"
:key="item.goodsType"
:value="item.goodsType"
:label="item.goodsTypeName"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="品牌商">
<el-select
v-model="searchForm.brandMerchantCode"
placeholder="请选择品牌商"
>
<el-option
v-for="item in baseData.brandList"
:key="item.confId"
:label="item.confValue"
:value="item.confId"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
:id="tableParams.btnId"
type="primary"
icon="el-icon-search"
>查询</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<d2-table-header>
<auth-button
category="Button"
:data="editFormReset"
></auth-button>
</d2-table-header>
<d2-table
ref="productTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
>
<img
slot="img"
slot-scope="scope"
class="pro-img"
:src="scope.scope.thumbUrl"
/>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
</d2-container>
</template>
<script>
import _ from 'lodash'
import { getList } from '@api/product'
import { BaseData, brandMerchantList } from '@/common/constants.js'
import { mapActions } from 'vuex'
export default {
name: 'product',
data() {
return {
searchForm: {
goodsName: '',
goodsType: '',
brandMerchantCode: ''
},
editFormReset: {
aa: ''
},
getListApi: getList,
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [{
label: '缩略图',
prop: 'thumbUrl',
addHtml: 'img'
}, {
label: '产品名称',
prop: 'goodsName'
}, {
label: '产品ID',
prop: 'id'
}, {
label: '分类',
prop: 'goodsTypeName'
}, {
label: '品牌商',
prop: 'brandMerchantName'
}, {
label: '创建时间',
prop: 'createDateStr'
}, {
label: '产品状态',
prop: 'state',
formatter: (cellValue) => {
// return {
// 0: '上架',
// 1: '下架'
// }[cellValue.state]
return '上架'
}
}]
},
// 查看门店
detailVisible: false,
// 基本数据
baseData: {
productTypeList: [],
brandList: []
}
}
},
mounted() {
// this.getProductType()
this.getBaseData()
// console.log(storeDetail)
// var allOpt = { confId: '', confKey: '全部' }
// this.baseData.product.unshift(allOpt)
// this.baseData.brandList.unshift(allOpt)
this.baseData.brandList = _.cloneDeep(brandMerchantList)
var allOpt = { confId: '', confValue: '全部' }
this.baseData.brandList.unshift(allOpt)
},
methods: {
// getProductType(){
// let prarms = {}
// getType(prarms).then(res => {
// this.baseData.productTypeList = res || []
// });
// },
...mapActions('d2admin/base', ['get']),
async getBaseData() {
this.baseData.productTypeList = _.cloneDeep(await this.get(BaseData.productType))
this.baseData.productTypeList.unshift({
goodsType: '',
goodsTypeName: '全部'
})
},
beforeSearchFn() {
return new Promise(resolve => {
console.log('搜索前操作--')
resolve()
})
},
handleReset() {
this.searchForm = {
goodsName: '',
goodsType: '',
brandMerchantCode: ''
}
},
handleAdd(form) {
// console.log(form)
this.$router.push({
name: 'editProduct',
params: {
addOrEdit: 'add',
form: form
}
})
},
// handleExport() { },
handleEdit(row) {
// console.log(row)
this.$router.push({
name: 'editProduct',
params: {
addOrEdit: 'edit',
form: row
}
})
},
handleDetail(row) {
this.detailData = row
this.detailVisible = true
},
handleDetailClose() {
this.detailVisible = false
}
}
}
</script>
<style scoped>
.product .pro-img {
width: 80px;
height: 80px;
}
</style>
<!-- 查看门店弹窗 -->
<template>
<div class="storeDetail">
<!-- <div>门店列表</div> -->
<div class="detail-rows">
<el-scrollbar>
<div
v-for="(item, index) in detailArr"
:key="index"
class="flex"
>
<img
class="img"
:src="item.shopPhoto"
/>
<block>
<p><span class="txt-order">{{index + 1}}</span>{{item.merchantName}}</p>
<p>
<span class="txt-num">商户号{{item.merchantId}}</span>
<span>{{item.phone}}</span>
</p>
<p>{{item.provinceName || ''}}{{item.cityName || ''}}{{item.address}}</p>
</block>
</div>
</el-scrollbar>
</div>
</div>
</template>
<script>
import { getMerchantList } from '@api/commodity'
export default {
name: 'storeDetail',
data() {
return {
detailArr: []
}
},
props: {
detailData: {
type: Object,
default: () => { }
}
},
mounted() {
// console.log(this.detailData)
this.getMerchantList()
},
methods: {
getMerchantList() {
this.detailArr = []
getMerchantList({
baseGoodsId: this.detailData.id
}).then(res => {
// console.log(res)
res.forEach(item => {
this.detailArr.push(item.merchantInfo)
})
})
}
}
}
</script>
<style>
.flex {
display: flex;
align-items: center;
}
.storeDetail .detail-rows {
width: 100%;
height: 540px;
}
.storeDetail .txt-order {
display: inline-block;
width: 18px;
height: 18px;
line-height: 18px;
border: 1px solid #999999;
border-radius: 50%;
text-align: center;
margin-right: 8px;
}
.el-scrollbar {
height: 100%;
}
.el-scrollbar__wrap {
overflow-y: scroll;
overflow-x: hidden;
margin-bottom: 0 !important;
}
.storeDetail .img {
width: 100px;
height: 100px;
margin: 0 20px;
}
.storeDetail .txt-num {
padding-right: 20px;
}
</style>
<!-- 首页 -->
<template>
<d2-container class="indexPage">
adsfasdfasdf
<div class="echarts">
<el-row>
<el-col :span="24">
<div id="totalEcharts" style="width: 100%; height: 400px;"></div>
<div
id="totalEcharts"
style="width: 100%; height: 400px;"
></div>
</el-col>
</el-row>
</div>
......@@ -58,9 +62,9 @@ export default {
},
mounted() {
this.$echarts = echarts
this.totalECharts = this.$echarts.init(document.getElementById('totalEcharts'))
this.getPie()
// this.$echarts = echarts
// this.totalECharts = this.$echarts.init(document.getElementById('totalEcharts'))
// this.getPie()
},
methods: {
......
......@@ -122,11 +122,11 @@ export default {
time: dayjs().format('HH:mm:ss'),
// 表单
formLogin: {
// userName: 'dongdao',
userName: 'dongdao',
// userName: 'houlai',
// password: '123456'
userName: '',
password: ''
password: '123456'
// userName: '',
// password: ''
},
// 表单校验
rules: Object.freeze({
......
<!-- 个人信息 -->
<template>
<d2-container class="personalInfo">
<p class="title">个人信息</p>
<el-form>
<template v-for="(item, index) in (formData.userType === 1 ? userformList : formList)">
<el-form-item
:key="index"
:label="item.label"
label-width="120px"
v-show="!item.hasOwnProperty('isDisabled') || formData[item.isDisabled]"
>
<template v-if="item.type === 'photo'">
<img
class="info-img"
v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
:src="subItem.mediaUrl"
/>
</template>
<template v-else-if="Array.isArray(formData[item.name])">
<el-tag
class="tag"
type="warning"
v-for="(subItem, subIndex) in formData[item.name]"
:key="subIndex"
>{{item.attrName ? subItem.brandName : subItem}}</el-tag>
</template>
<span v-else-if="item.formatter">{{item.formatter(formData)}}</span>
<span v-else-if="item.parentName">{{formData[item.parentName][item.name]}}</span>
<span v-else>{{formData[item.name]}}</span>
</el-form-item>
</template>
<el-form-item
v-if="formData.userType !== 1"
>
<a
class="info-link"
href="http://dj.glsx.com.cn/web-dj-site/#/system/personallnfo"
target="_blank"
>修改个人信息请到嘀加平台修改,点击快速修改</a>
</el-form-item>
</el-form>
</d2-container>
</template>
<script>
import { getUserInfo } from '@api/personalInfo'
import { userType, ghUserType } from '@/common/constants'
export default {
name: 'personalInfo',
data() {
return {
formData: {},
formList: [{
name: 'accountName',
label: '登录账户'
}, {
name: 'loginPhone',
label: '登录手机号'
}, {
name: 'merchantId',
label: '商户号'
}, {
name: 'merchantName',
label: '商户全称'
}, {
name: 'shortName',
label: '商户简称'
}, {
name: 'userTypeName',
label: '商户分类'
}, {
name: 'addr',
label: '商户地址'
}, {
name: 'phone',
label: '商户电话'
}, {
name: 'businessHours',
label: '营业时间'
}, {
name: 'shopMedias',
label: '门店照片',
type: 'photo'
}, {
name: 'carBrandListNoRepeat',
label: '主营品牌'
// attrName: 'brandName'
}, {
name: 'mainBusiness',
label: '营业范围'
}, {
parentName: 'role',
name: 'name',
label: '角色权限'
}],
userformList: [{
name: 'accountName',
label: '登录账户'
}, {
name: 'loginPhone',
label: '登录手机号'
}, {
name: 'name',
label: '姓名/名称'
}, {
name: 'merchantName',
label: '所属商户'
}, {
parentName: 'role',
name: 'name',
label: '角色权限'
}, {
name: 'isOpenCard',
label: '名片',
formatter: (cellValue) => {
return cellValue.isOpenCard ? '开通' : '未开通'
}
}, {
name: 'duty',
isDisabled: 'isOpenCard',
label: '职务'
}, {
name: 'photoHead',
label: '头像',
isDisabled: 'isOpenCard',
type: 'photo'
}, {
name: 'phone',
label: '电话',
isDisabled: 'isOpenCard'
}, {
name: 'wechatNum',
label: '微信',
isDisabled: 'isOpenCard'
}, {
name: 'userLabelListArr',
label: '标签',
isDisabled: 'isOpenCard'
}]
}
},
mounted() {
getUserInfo({}).then(res => {
this.formData = res.detail
this.formData.userType = res.userType
if (this.formData.userType !== 1) {
this.formData.addr = (this.formData.provinceName || '') + (this.formData.cityName || '') + (this.formData.areaName || '') + (this.formData.address || '')
this.formData.carBrandListNoRepeat = [...new Set(this.formData.carBrandList.map(item => item.brandName))]
var typeList = this.formData.channelId === 2 ? ghUserType : userType
this.formData.userTypeName = typeList[this.formData.userType]
} else {
this.formData.photoHead = [{ mediaUrl: this.formData.photo }]
this.formData.userLabelListArr = this.formData.userLabelList.map(item => item.labelName)
}
})
},
methods: {}
}
</script>
<style>
.personalInfo .title {
font-size: 22px;
color: #666666;
letter-spacing: 1.38px;
}
.personalInfo .info-img {
width: 120px;
height: 120px;
margin-right: 5px;
}
.personalInfo .tag {
margin-right: 10px;
color: #333333;
/* width: 20px;
height: 20px;
font-size: 14px;
color: #333333;
background: #fff8ef;
border: 1px solid #ffdfb8;
border-radius: 6px; */
}
.personalInfo .info-link {
color: #003a00;
cursor: pointer;
}
</style>
<!-- 服务4S店 -->
<template>
<d2-container class="service-store">
<el-form
:inline="true"
v-model="searchForm"
label-width="85px"
slot="header"
>
<el-form-item label="商户名称">
<el-input
v-model="searchForm.merchantName"
placeholder="请输入商户名称"
clearable
></el-input>
</el-form-item>
<el-form-item>
<el-button
:id="tableParams.btnId"
type="primary"
icon="el-icon-search"
>查询</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
<d2-table-header>
<auth-button category="Button"></auth-button>
</d2-table-header>
<d2-table
ref="serviceStoreTable"
:searchForm="searchForm"
:tableParams="tableParams"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
<relate-store-dialog
v-if="relateStoreVisible"
ref="relateStore"
:relateStoreVisible="relateStoreVisible"
:storeApi="storeApi"
:storeSearchForm="storeSearchForm"
:storeSelected="storeSelected"
@handleRelateStoreConfirm="handleRelateStoreConfirm"
@handleRelateStoreClose="handleRelateStoreClose"
>
<el-row slot>
<el-col
class="service-search"
:span="6"
>
<el-select v-model="storeSearchForm.channelType">
<el-option
v-for="item in baseData.channelType"
:key="item.value"
:label="item.name"
:value="item.value"
></el-option>
</el-select>
</el-col>
<el-col :span="8">
<el-input
v-model="storeSearchForm.merchantIdName"
placeholder="支持按门店、商户号搜索"
clearable
></el-input>
</el-col>
<el-button
type="primary"
@click="handleSearchStore"
>搜索</el-button>
</el-row>
</relate-store-dialog>
</d2-container>
</template>
<script>
import { Util } from '@/common/util'
import { getList, deleteMerchant, serviceGetMerchantList, addServiceMerchant } from '@api/serviceStore'
import { mapActions } from 'vuex'
import { BaseData, userType, ghUserType } from '@/common/constants.js'
export default {
name: 'serviceStore',
data() {
return {
searchForm: {
merchantName: ''
},
maxLength: 10,
getListApi: getList,
// 表格参数
tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list',
tableOption: true,
tableColumns: [{
label: '登录账户',
prop: 'accountName',
width: '160'
}, {
label: '商户号',
prop: 'merchantId',
width: '200'
}, {
label: '商户名称',
prop: 'merchantName',
width: '200'
}, {
label: '商户简称',
prop: 'shortName',
width: '200'
}, {
label: '商户类型',
prop: 'userType',
width: '76',
formatter: (cellValue) => {
var typeList = cellValue.channelType === 2 ? ghUserType : userType
return typeList[cellValue.userType]
}
}, {
label: '联系人',
prop: 'contactName'
}, {
label: '手机号',
prop: 'phone',
width: '110'
}, {
label: '商户地址',
prop: 'fullAddress',
width: '200'
}, {
label: '更新时间',
prop: 'updatedDate',
width: '160',
formatter: (cellValue) => {
return Util.dateFormate(cellValue.updatedDate, 'YYYY-MM-DD HH:mm:ss')
}
}, {
label: '渠道',
prop: 'channelType',
formatter: (cellValue) => {
return this.baseData.channelType.find(item => item.value === cellValue.channelType).name
}
}]
},
// 关联门店
storeSearchForm: {
channelType: 1,
merchantIdName: ''
},
relateStoreVisible: false,
storeApi: serviceGetMerchantList,
storeSelected: [],
baseData: {
channelType: []
}
}
},
components: {
},
created() {
this.getBaseData()
},
mounted() { },
methods: {
...mapActions('d2admin/base', ['get']),
beforeSearchFn() {
return new Promise(resolve => {
console.log('搜索前操作--')
resolve()
})
},
async getBaseData() {
this.baseData.channelType = await this.get(BaseData.channelType)
},
handleReset() {
this.searchForm = {
merchantName: ''
}
},
handleAdd() {
// console.log(form)
this.relateStoreVisible = true
},
relateCloseReset() {
this.storeSearchForm = {
channelType: 1,
merchantIdName: ''
}
this.storeSelected = []
},
handleRelateStoreConfirm(selectedData) {
// console.log(selectedData)
if (!selectedData.length) {
// this.notice.warningTips('请选择关联门店')
this.$message({
message: '请选择关联门店',
type: 'warning',
showClose: true
})
return true
}
if (selectedData.length > this.maxLength) {
this.$message.error(`一次只能选择${this.maxLength}个门店`)
return true
}
addServiceMerchant({ list: selectedData }).then(res => {
this.relateStoreVisible = false
this.$refs.serviceStoreTable.refreshTable()
this.notice.okTips()
this.relateCloseReset()
})
},
handleRelateStoreClose() {
this.relateStoreVisible = false
this.relateCloseReset()
},
handleSearchStore() {
this.$refs.relateStore.getSelectingList()
},
handleDelete(row) {
// console.log(row)
this.$confirm('是否要进行删除操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteMerchant({ id: row.id }).then(res => {
this.notice.okTips()
this.$refs.serviceStoreTable.refreshTable()
})
}).catch(err => {
console.log(err)
})
}
}
}
</script>
<style>
.service-store .service-search {
margin-bottom: 10px;
}
.service-store .el-table--medium td {
padding: 6px 8px !important;
}
.service-store .el-checkbox__input.is-disabled .el-checkbox__inner {
background-color: #CECECE;
border-color: #CECECE;
}
</style>
<!-- 查看详情 -->
<template>
<div class="detailDialog">
<el-dialog
:visible.sync="isVisible"
:title="title"
:before-close="handleClose"
:close-on-click-modal="false"
width="860px"
>
<iframe width="100%" height="700px" scrolling="yes" frameborder="0" :src="pdfUrl"></iframe>
</el-dialog>
</div>
</template>
<script>
export default {
name: 'DetailDialog',
data() {
return {
}
},
props: {
isVisible: {
type: Boolean,
default: false
},
title: String,
pdfUrl: String
},
mounted() {},
methods: {
handleClose() {
this.$emit('closeDialog')
}
}
}
</script>
<style lang="scss">
.detailDialog{
.el-dialog__header {
padding: 10px 16px 4px;
background-color: #141516;
.el-dialog__title{
color: #fff;
font-size: 16px;
}
}
.el-dialog__body {
padding: 0;
background-color: #202223
}
}
</style>
<!-- 新增/编辑车辆弹窗 -->
<template>
<div>
<el-dialog
:title="title"
:visible.sync="isVisible"
:before-close="handleClose"
:close-on-click-modal="false"
width="580px"
>
<el-form
:model="editForm"
:rules="rules"
ref="editRuleForm"
label-width="110px"
>
<el-form-item label="订单编号" prop="orderCode">
<el-input v-model="editForm.orderCode" maxlength="14"
:show-word-limit="true" placeholder="请输入订单编号" clearable></el-input>
</el-form-item>
<el-form-item label="申请人" prop="userName">
<el-input v-model="editForm.userName" maxlength="32"
:show-word-limit="true" placeholder="请输入申请人" clearable></el-input>
</el-form-item>
</el-form>
<div slot="footer">
<el-button
type="primary"
@click="handleConfirm"
:loading="$store.state.d2admin.loading.value"
>保存</el-button>
<el-button
@click="handleClose"
>取消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
// import { isExistApi } from '@api/subSysManagement'
// import { isTrafficExistApi } from '@api/trafficManagement'
export default {
name: 'EditDialog',
data() {
return {
disabled: false,
title: '添加子系统',
rules: {
orderCode: [
{ required: true, message: '请输入订单编号', trigger: 'change' }
],
userName: [
{ required: true, message: '请输入申请人', trigger: 'blur' }
]
}
}
},
props: {
isVisible: {
type: Boolean,
default: false
},
editForm: Object
},
watch: {
isVisible(val) {
// this.disabled = !!this.editForm.subsystemCode
this.title = !this.editForm.id ? '添加子系统' : '编辑子系统'
this.$refs.editRuleForm && this.$refs.editRuleForm.resetFields()
}
},
methods: {
// async isCodeExist(rule, value, callback) {
// if (this.editForm.trafficCode && !this.editForm.id) {
// const res = await isExistApi({ subsystemCode: value, trafficCode: this.editForm.trafficCode })
// res.subsystemCode ? callback(new Error(rule.message)) : callback()
// }
// },
// async isTrafficCodeExist(rule, value, callback) {
// if (!this.editForm.id) {
// const res = await isTrafficExistApi({ trafficCode: value })
// res.trafficCode ? callback() : callback(new Error(rule.message))
// }
// },
// isNum(rule, value, callback) {
// const regNum = /^[\d]{4,4}$/
// regNum.test(value) ? callback() : callback(new Error(rule.message))
// },
// isNumOrString(rule, value, callback) {
// const regNum = /^[A-Z\d]{14,14}$/
// regNum.test(value) ? callback() : callback(new Error(rule.message))
// },
// validateCode(value) {
// this.$refs.editRuleForm.validateField('subsystemCode')
// },
handleClose() {
this.$emit('closeDialog')
},
handleConfirm() {
this.$refs.editRuleForm.validate((vaild) => {
if (vaild) {
this.$emit('confirmDialog')
}
})
}
}
}
</script>
<style scoped>
</style>
<!-- 表格组件-使用 -->
<template>
<d2-container>
<el-form
:inline="true"
:model="searchForm"
label-width="85px"
slot="header"
>
<el-form-item label="名称">
<el-input
v-model="searchForm.name"
placeholder="请输入名称"
clearable
></el-input>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="createTime"
type="daterange"
value-format="yyyy-MM-dd"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
:id="tableParams.btnId"
>查询</el-button>
</el-form-item>
</el-form>
<d2-table-header title="列表标题">
<auth-button
category="Button"
:data="editFormReset"
></auth-button>
</d2-table-header>
<d2-table
ref="table"
:searchForm="searchForm"
:tableParams="tableParams"
:layout="layout"
:getListApi="getListApi"
:beforeSearchFn="beforeSearchFn"
>
<el-button
type="text"
slot="userName"
slot-scope="scope"
@click="handleClick(scope.scope.userName)"
></el-button>
<auth-button
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
></auth-button>
</d2-table>
<edit-dialog
:isVisible="editVisible"
:editForm="editForm"
@closeDialog="handleEditClose"
@confirmDialog="handleEditConfirm"
></edit-dialog>
</d2-container>
</template>
<script>
import EditDialog from './editDialog'
import { getListApi, editApi, removeApi } from '@api/table1'
import notice from '@/common/notice'
import util from '@/libs/util'
export default {
name: 'fimsTable1',
components: {
EditDialog
},
data() {
return {
editVisible: false,
// 搜索
createTime: '',
searchForm: {
name: '',
startTime: '',
endTime: ''
},
editFormReset: {
orderCode: '',
userName: ''
},
editForm: {
id: '',
orderCode: '',
userName: ''
},
// 表格参数
tableParams: {
mutiSelectName: 'table1',
mutiSelectUniqueKey: 'id',
btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'orderList',
tag: Object.freeze({
type: ['', '', 'info', 'danger', 'warning', 'success'],
label: ['', '状态一', '状态二', '状态三', '状态四', '状态五']
}),
otherTag: Object.freeze({
type: ['', '', 'info', 'danger', 'warning', 'success'],
label: ['', '一', '二', '三', '四', '五']
}),
tableOption: true,
tableColumns: [{
label: '订单编号',
prop: 'orderCode',
minWidth: '200'
}, {
label: '销量',
prop: 'sales',
minWidth: '180',
sortable: 'custom',
// momFlag: 'salesMom',
addSymbol: '元'
}, {
label: '类型',
prop: 'orderType',
width: '120',
formatter: (cellValue) => {
if (cellValue.orderType) {
return {
1: '物料申请',
2: '物料报废'
}[cellValue.orderType]
}
}
}, {
label: '申请人',
prop: 'userName',
addHtml: 'userName',
width: '140'
}, {
label: '状态',
prop: 'status',
tagLabel: true
}, {
label: '状态2',
prop: 'status2',
tagLabel: true,
tagName: 'otherTag'
}]
},
layout: 'sizes, prev, pager, next, jumper, ->, total',
getListApi: getListApi
}
},
watch: {
'createTime'(value) {
Object.assign(this.searchForm, util.formatTime(this.createTime))
}
},
mounted() { },
methods: {
// 在搜索前,特殊操作函数
beforeSearchFn() {
return new Promise((resolve, reject) => {
this.searchForm.name = '改变值--'
resolve()
})
},
handleEditClose() {
this.editVisible = !this.editVisible
},
handleEditConfirm() {
var editParams = JSON.parse(JSON.stringify(this.editForm))
editApi(editParams).then(res => {
notice.okTips()
this.editVisible = false
// 删除操作后,删除表格。d2-admin设置一个ref
this.$refs.table.refreshTable()
}).catch(() => { })
},
// 表格-编辑
handleEdit(row) {
this.editForm = JSON.parse(JSON.stringify(row))
this.handleEditClose()
},
// 批量操作
handleOperate(row) {
this.$notify({
title: '表格中选中的数据如下:',
message: this.$refs.table.mutiSelectArr[this.tableParams.mutiSelectName],
duration: 0
})
},
handleClick(item) {
this.$notify({
title: '申请人:',
message: item,
duration: 0
})
},
handleDelete(row) {
this.$confirm('确认删除?', '删除', {
comfirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
removeApi({
orderCode: row.orderCode
}).then(() => {
// 删除操作后,删除表格。d2-admin设置一个ref
this.$refs.table.refreshTable()
notice.okTips()
}).catch(() => {
notice.errorTips()
})
}).catch(() => { })
}
}
}
</script>
<style scoped>
</style>
<!-- 物料列表 -->
<template>
<d2-container>
<el-form
:inline="true"
:model="searchForm"
label-width="85px"
slot="header"
>
<el-form-item label="名称">
<el-input v-model="searchForm.keyWord" placeholder="请输入名称" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="getList">查询</el-button>
</el-form-item>
</el-form>
<d2-table-header title="物料列表"></d2-table-header>
<d2-table
ref="table"
:searchForm="searchForm"
:tableData="tableData"
:tableTotal="tableTotal"
:tableParams="tableParams"
@refreshTable="getList"
></d2-table>
</d2-container>
</template>
<script>
import { getListApi } from '@api/table2'
import notice from '@/common/notice'
export default {
name: 'fimsTable2',
data() {
return {
searchForm: {
keyWord: ''
},
getListApi: getListApi,
// 表格
tableData: [],
tableTotal: 10,
tableParams: {
listName: 'deviceList',
tableColumns: [{
label: '物料代码',
prop: 'deviceNum',
width: '170'
}, {
label: '物料编码',
prop: 'deviceCode',
width: '170'
}, {
label: 'CRC物料号',
prop: 'crcCode',
width: '170'
}, {
label: '图号',
prop: 'drawNum',
width: '170'
}, {
label: '物料名称',
prop: 'deviceName',
minWidth: '200'
}, {
label: '规格',
prop: 'specifications',
width: '140'
}, {
label: '责任人',
prop: 'responsible',
width: '120'
}]
}
}
},
mounted() {
this.getList()
},
methods: {
getList(page) {
const params = {
...(page || { pageCount: 10, pageSize: 1 }),
...this.searchForm
}
getListApi(params).then(res => {
// console.log(res)
this.tableData = res.data
this.tableTotal = res.pagination.totalCount
}).catch(() => {
notice.errorTips()
})
}
}
}
</script>
<style scoped>
</style>
......@@ -81,7 +81,7 @@ export default {
const clone = util.deepClone(Object.values(localRoutes))
const { menus } = util.permision.packMenusBtns(clone)
const all = util.permision.flatten(clone)
menus.find(o => o.authId === '901').disabled = true
menus.find(o => o.authId === '101').disabled = true
return { menus, all }
}
},
......
......@@ -50,7 +50,7 @@ export default {
handler(value) {
if (!value) return
const chk = []
const treeChk = ['901']
const treeChk = ['101']
this.$nextTick(() => {
value.forEach(v => {
v.authId += ''
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!