增加租户界面、单据优化

This commit is contained in:
季圣华
2021-06-01 23:33:36 +08:00
parent 15245791c8
commit 6d7cbe7612
19 changed files with 279 additions and 26 deletions

View File

@@ -6,6 +6,10 @@ import {UI_CACHE_DB_DICT_DATA } from "@/store/mutation-types"
const getBuyAndSaleStatistics = (params)=>getAction("/depotHead/getBuyAndSaleStatistics",params);
const buyOrSalePrice = (params)=>getAction("/depotItem/buyOrSalePrice",params);
//租户管理
const checkTenant = (params)=>getAction("/tenant/checkIsNameExist",params);
const editTenant = (params)=>putAction("/tenant/update",params);
//角色管理
const addRole = (params)=>postAction("/role/add",params);
const editRole = (params)=>putAction("/role/update",params);
@@ -14,6 +18,7 @@ const findUserRole = (params)=>getAction("/role/findUserRole",params);
const queryall = (params)=>getAction("/sys/role/queryall",params);
//用户管理
const registerUser = (params)=>postAction("/user/registerUser",params);
const addUser = (params)=>postAction("/user/addUser",params);
const editUser = (params)=>putAction("/user/updateUser",params);
const getUserList = (params)=>getAction("/user/getUserList",params);
@@ -165,10 +170,13 @@ const findFinancialDetailByNumber = (params)=>getAction("/accountHead/getDetailB
export {
getBuyAndSaleStatistics,
buyOrSalePrice,
checkTenant,
editTenant,
addRole,
editRole,
checkRole,
findUserRole,
registerUser,
addUser,
editUser,
getUserList,

View File

@@ -102,12 +102,13 @@ export const JEditableTableMixin = {
httpAction(url, formData, method).then((res) => {
if(res.code === 200){
this.$emit('ok')
this.confirmLoading = false
this.close()
} else {
this.$message.warning(res.data.message);
this.confirmLoading = false
}
}).finally(() => {
this.confirmLoading = false
this.close()
})
},

View File

@@ -20,6 +20,7 @@ export const BillModalMixin = {
accountList: [],
accountIdList: [],
accountMoneyList: [],
billUnitPirce: '',
spans: {
labelCol1: {span: 2},
wrapperCol1: {span: 22},
@@ -165,6 +166,7 @@ export const BillModalMixin = {
//单元值改变一个字符就触发一次
onValueChange(event) {
let that = this
debugger
const { type, row, column, value, target } = event
let param,operNumber,unitPrice,taxUnitPrice,allPrice,taxRate,taxMoney,taxLastMoney
switch(column.key) {
@@ -176,7 +178,8 @@ export const BillModalMixin = {
case "barCode":
param = {
barCode: value,
mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性
mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
prefixNo: this.prefixNo
}
getMaterialByBarCode(param).then((res) => {
if (res && res.code === 200) {
@@ -190,12 +193,12 @@ export const BillModalMixin = {
materialOther: res.data.materialOther,
unit: res.data.commodityUnit,
operNumber: 1,
unitPrice: res.data.purchaseDecimal,
taxUnitPrice: res.data.purchaseDecimal,
allPrice: res.data.purchaseDecimal,
unitPrice: res.data.billPrice,
taxUnitPrice: res.data.billPrice,
allPrice: res.data.billPrice,
taxRate: 0,
taxMoney: 0,
taxLastMoney: res.data.purchaseDecimal
taxLastMoney: res.data.billPrice,
}
}]);
that.getStockByDepotBarCode(row, target)

View File

@@ -74,6 +74,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'DBCK',
model: {},
labelCol: {
xs: { span: 24 },
@@ -130,7 +131,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("DBCK")
this.addInit(this.prefixNo)
} else {
this.model.operTime = this.model.operTimeStr
this.$nextTick(() => {

View File

@@ -75,6 +75,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'ZZD',
model: {},
labelCol: {
xs: { span: 24 },
@@ -131,7 +132,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("ZZD")
this.addInit(this.prefixNo)
} else {
this.model.operTime = this.model.operTimeStr
this.model.debt = (this.model.discountLastMoney - this.model.changeAmount).toFixed(2)

View File

@@ -75,6 +75,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'CXD',
model: {},
labelCol: {
xs: { span: 24 },
@@ -131,7 +132,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("CXD")
this.addInit(this.prefixNo)
} else {
this.model.operTime = this.model.operTimeStr
this.$nextTick(() => {

View File

@@ -82,6 +82,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'QTRK',
model: {},
labelCol: {
xs: { span: 24 },
@@ -137,7 +138,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("QTRK")
this.addInit(this.prefixNo)
} else {
this.model.operTime = this.model.operTimeStr
this.$nextTick(() => {

View File

@@ -82,6 +82,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'QTCK',
model: {},
labelCol: {
xs: { span: 24 },
@@ -137,7 +138,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("QTCK")
this.addInit(this.prefixNo)
} else {
this.model.operTime = this.model.operTimeStr
this.$nextTick(() => {

View File

@@ -136,6 +136,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'CGTH',
model: {},
labelCol: {
xs: { span: 24 },
@@ -200,7 +201,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("CGTH")
this.addInit(this.prefixNo)
} else {
this.model.operTime = this.model.operTimeStr
this.model.debt = (this.model.discountLastMoney + this.model.otherMoney - this.model.changeAmount).toFixed(2)

View File

@@ -145,6 +145,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'CGRK',
model: {},
labelCol: {
xs: { span: 24 },
@@ -210,7 +211,7 @@
editAfter() {
if (this.action === 'add') {
let that = this
this.addInit("CGRK")
this.addInit(this.prefixNo)
} else {
this.model.operTime = this.model.operTimeStr
this.model.debt = (this.model.discountLastMoney + this.model.otherMoney - this.model.changeAmount).toFixed(2)

View File

@@ -84,6 +84,7 @@
supList: [],
depotList: [],
operTimeStr: '',
prefixNo: 'CGDD',
model: {},
labelCol: {
xs: { span: 24 },
@@ -140,7 +141,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("CGDD")
this.addInit(this.prefixNo)
} else {
this.model.operTime = this.model.operTimeStr
this.$nextTick(() => {

View File

@@ -115,6 +115,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'LSTH',
model: {},
labelCol: {
xs: { span: 24 },
@@ -170,7 +171,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("LSTH")
this.addInit(this.prefixNo)
} else {
this.model.operTime = this.model.operTimeStr
this.model.getAmount = this.model.changeAmount

View File

@@ -122,6 +122,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'LSCK',
model: {},
labelCol: {
xs: { span: 24 },
@@ -177,7 +178,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("LSCK")
this.addInit(this.prefixNo)
this.$nextTick(() => {
this.form.setFieldsValue({'payType': '现付'})
})

View File

@@ -141,6 +141,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'XSTH',
model: {},
labelCol: {
xs: { span: 24 },
@@ -205,7 +206,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("XSTH")
this.addInit(this.prefixNo)
this.personList.value = ''
} else {
this.model.operTime = this.model.operTimeStr

View File

@@ -88,6 +88,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'XSDD',
model: {},
labelCol: {
xs: { span: 24 },
@@ -143,7 +144,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("XSDD")
this.addInit(this.prefixNo)
this.personList.value = ''
} else {
this.model.operTime = this.model.operTimeStr

View File

@@ -149,6 +149,7 @@
addDefaultRowNum: 1,
visible: false,
operTimeStr: '',
prefixNo: 'XSCK',
model: {},
labelCol: {
xs: { span: 24 },
@@ -213,7 +214,7 @@
//调用完edit()方法之后会自动调用此方法
editAfter() {
if (this.action === 'add') {
this.addInit("XSCK")
this.addInit(this.prefixNo)
this.personList.value = ''
} else {
this.model.operTime = this.model.operTimeStr

View File

@@ -33,10 +33,10 @@
</div>
<!-- 操作按钮区域 -->
<div class="table-operator" style="margin-top: 5px">
<a-button @click="myHandleAdd" type="primary" icon="plus">新增</a-button>
<a-button v-if="btnEnableList.indexOf(1)>-1" @click="myHandleAdd" type="primary" icon="plus">新增</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
<a-menu-item key="1" v-if="btnEnableList.indexOf(1)>-1"@click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px">
批量操作 <a-icon type="down" />
@@ -58,10 +58,10 @@
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<a @click="myHandleDetail(record, '收入')">查看</a>
<a-divider type="vertical" />
<a @click="myHandleEdit(record)">编辑</a>
<a-divider type="vertical" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />
<a v-if="btnEnableList.indexOf(1)>-1" @click="myHandleEdit(record)">编辑</a>
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />
<a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</span>

View File

@@ -0,0 +1,99 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="12">
<a-form-item label="登录名称">
<a-input placeholder="输入登录名称模糊查询" v-model="queryParam.loginName"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery">查询</a-button>
<a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 操作按钮区域 -->
<div class="table-operator" style="border-top: 5px">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
</div>
<!-- table区域-begin -->
<div>
<a-table
ref="table"
bordered
size="middle"
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
</span>
</a-table>
</div>
<!-- table区域-end -->
<tenant-modal ref="modalForm" @ok="modalFormOk"></tenant-modal>
</a-card>
</template>
<script>
import TenantModal from './modules/TenantModal'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import JInput from '@/components/jeecg/JInput'
export default {
name: "TenantList",
mixins: [JeecgListMixin],
components: {
TenantModal,
JInput
},
data() {
return {
queryParam: {
loginName: ""
},
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:40,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{ title: '登录名称', dataIndex: 'loginName', width: 100, align: "center"},
{ title: '用户数量限制', dataIndex: 'userNumLimit', width: 100, align: "center"},
{ title: '单据数量限制', dataIndex: 'billsNumLimit', width: 100, align: "center"},
{ title: '创建时间', dataIndex: 'createTimeStr', width: 100, align: "center"},
{
title: '操作',
dataIndex: 'action',
scopedSlots: {customRender: 'action'},
align: "center",
width: 100
}
],
url: {
list: "/tenant/list"
},
}
},
created () {
},
methods: {
}
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>

View File

@@ -0,0 +1,129 @@
<template>
<a-modal
:title="title"
:width="600"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭"
wrapClassName="ant-modal-cust-warp"
style="top:15%;height: 70%;overflow-y: hidden">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="登录名称">
<a-input placeholder="请输入登录名称" v-decorator.trim="[ 'loginName', validatorRules.loginName]" :readOnly="!!model.id"
suffix="初始密码123456" />
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="用户数量限制">
<a-input-number style="width:50%" placeholder="请输入用户数量限制" v-decorator.trim="[ 'userNumLimit' ]" />
</a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="单据数量限制">
<a-input-number style="width:50%" placeholder="请输入单据数量限制" v-decorator.trim="[ 'billsNumLimit' ]" />
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import pick from 'lodash.pick'
import {registerUser,editTenant,checkTenant } from '@/api/api'
export default {
name: "TenantModal",
data () {
return {
title:"操作",
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
validatorRules:{
loginName:{
rules: [
{ required: true, message: '请输入登录名称!' },
{ min: 2, max: 30, message: '长度在 2 30 个字符', trigger: 'blur' },
{ validator: this.validateLoginName}
]
}
},
}
},
created () {
},
methods: {
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'loginName', 'userNumLimit', 'billsNumLimit'))
});
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
let formData = Object.assign(this.model, values);
let obj;
if(!this.model.id){
formData.password = '123456'
obj=registerUser(formData);
}else{
obj=editTenant(formData);
}
obj.then((res)=>{
if(res.code === 200){
that.$emit('ok');
}else{
that.$message.warning(res.data.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
},
validateLoginName(rule, value, callback){
let params = {
name: value,
id: this.model.id?this.model.id:0
};
checkTenant(params).then((res)=>{
if(res && res.code===200) {
if(!res.data.status){
callback();
} else {
callback("登录名称已经存在");
}
} else {
callback(res.data);
}
});
}
}
}
</script>
<style scoped>
</style>