优化单据中仓库、账户之类的下拉框

This commit is contained in:
季圣华 2021-07-13 22:52:43 +08:00
parent ee21de663c
commit 23f231c167
21 changed files with 104 additions and 63 deletions

View File

@ -37,12 +37,6 @@ export const BillModalMixin = {
};
},
created () {
this.initSupplier()
this.initCustomer()
this.initRetail()
this.initSalesman()
this.initDepot()
this.initAccount()
},
computed: {
readOnly: function() {
@ -112,13 +106,14 @@ export const BillModalMixin = {
getAction('/depot/findDepotByCurrentUser').then((res) => {
if(res.code === 200){
let arr = res.data
for(let i=0; i<arr.length; i++) {
let depotInfo = {};
depotInfo.value = arr[i].id+'' //注意-此处value必须为字符串格式
depotInfo.text = arr[i].depotName
depotInfo.title = arr[i].depotName
for(let item of that.materialTable.columns){
if(item.key == 'depotId' || item.key == 'anotherDepotId') {
for(let item of that.materialTable.columns){
if(item.key == 'depotId' || item.key == 'anotherDepotId') {
item.options = []
for(let i=0; i<arr.length; i++) {
let depotInfo = {};
depotInfo.value = arr[i].id + '' //注意-此处value必须为字符串格式
depotInfo.text = arr[i].depotName
depotInfo.title = arr[i].depotName
item.options.push(depotInfo)
}
}

View File

@ -101,7 +101,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -111,7 +111,7 @@
{ title: '型号', key: 'model', width: '5%', type: FormTypes.input, readonly: true },
{ title: '扩展信息', key: 'materialOther', width: '6%', type: FormTypes.input, readonly: true },
{ title: '库存', key: 'stock', width: '5%', type: FormTypes.input, readonly: true },
{ title: '调入仓库', key: 'anotherDepotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: []},
{ title: '调入仓库', key: 'anotherDepotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [], allowSearch:true},
{ title: '单位', key: 'unit', width: '4%', type: FormTypes.input, readonly: true },
{ title: '数量', key: 'operNumber', width: '5%', type: FormTypes.inputNumber, statistics: true,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -164,6 +164,7 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initDepot()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -103,7 +103,7 @@
columns: [
{ title: '商品类型',key: 'mType',width:'7%', type: FormTypes.input, readonly: true },
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -166,6 +166,7 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initDepot()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -103,7 +103,7 @@
columns: [
{ title: '商品类型',key: 'mType',width:'7%', type: FormTypes.input, readonly: true },
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -165,6 +165,7 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initDepot()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -110,7 +110,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -172,6 +172,8 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initSupplier()
this.initDepot()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -110,7 +110,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -172,6 +172,8 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initCustomer()
this.initDepot()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -172,7 +172,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -252,6 +252,9 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initSupplier()
this.initDepot()
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -173,7 +173,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -253,6 +253,9 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initSupplier()
this.initDepot()
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -113,7 +113,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '12%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -174,6 +174,8 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initSupplier()
this.initDepot()
},
/** 整理成formData */
classifyIntoFormData(allValues) {

View File

@ -154,7 +154,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -218,6 +218,9 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initRetail()
this.initDepot()
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -154,7 +154,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -226,6 +226,9 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initRetail()
this.initDepot()
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -177,7 +177,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -259,6 +259,10 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initCustomer()
this.initSalesman()
this.initDepot()
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -116,7 +116,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -180,6 +180,9 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initCustomer()
this.initSalesman()
this.initDepot()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -177,7 +177,7 @@
dataSource: [],
columns: [
{ title: '仓库名称', key: 'depotId', width: '8%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '条码', key: 'barCode', width: '10%', type: FormTypes.popupJsh, multi: false,
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -259,6 +259,10 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.materialTable);
}
this.initCustomer()
this.initSalesman()
this.initDepot()
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -29,10 +29,6 @@ export const FinancialModalMixin = {
};
},
created () {
this.initSupplier()
this.initCustomer()
this.initRetail()
this.initPerson()
},
computed: {
readOnly: function() {
@ -97,13 +93,14 @@ export const FinancialModalMixin = {
let that = this;
findInOutItemByParam({type:type}).then((res)=>{
if(res) {
for(let i=0; i<res.length; i++) {
let inOutItemInfo = {};
inOutItemInfo.value = res[i].id+'' //注意-此处value必须为字符串格式
inOutItemInfo.text = res[i].name
inOutItemInfo.title = res[i].name
for(let item of that.accountTable.columns){
if(item.key == 'inOutItemId') {
for(let item of that.accountTable.columns){
if(item.key == 'inOutItemId') {
item.options = []
for(let i=0; i<res.length; i++) {
let inOutItemInfo = {};
inOutItemInfo.value = res[i].id + '' //注意-此处value必须为字符串格式
inOutItemInfo.text = res[i].name
inOutItemInfo.title = res[i].name
item.options.push(inOutItemInfo)
}
}
@ -126,13 +123,14 @@ export const FinancialModalMixin = {
getAccount({}).then((res)=>{
if(res && res.code === 200) {
let list = res.data.accountList;
for(let i=0; i<list.length; i++) {
let accountInfo = {};
accountInfo.value = list[i].id+'' //注意-此处value必须为字符串格式
accountInfo.text = list[i].name
accountInfo.title = list[i].name
for(let item of that.accountTable.columns){
if(item.key == 'accountId') {
for(let item of that.accountTable.columns){
if(item.key == 'accountId') {
item.options = []
for(let i=0; i<list.length; i++) {
let accountInfo = {};
accountInfo.value = list[i].id + '' //注意-此处value必须为字符串格式
accountInfo.text = list[i].name
accountInfo.title = list[i].name
item.options.push(accountInfo)
}
}

View File

@ -129,7 +129,7 @@
dataSource: [],
columns: [
{ title: '账户名称',key: 'accountId',width: '20%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '金额',key: 'eachAmount', width: '10%', type: FormTypes.inputNumber, statistics: true, placeholder: '请选择${title}',
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -163,7 +163,6 @@
}
},
created () {
this.initDetailAccount()
},
methods: {
//调用完edit()方法之后会自动调用此方法
@ -185,6 +184,9 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.accountTable);
}
this.initRetail()
this.initPerson()
this.initDetailAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -58,7 +58,8 @@
<a-row class="form-row" :gutter="24">
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="付款账户">
<a-select placeholder="选择付款账户" v-decorator="[ 'accountId', validatorRules.accountId ]" :dropdownMatchSelectWidth="false">
<a-select placeholder="选择付款账户" v-decorator="[ 'accountId', validatorRules.accountId ]"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children">
<a-select-option v-for="(item,index) in accountList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
@ -125,7 +126,7 @@
dataSource: [],
columns: [
{ title: '账户名称',key: 'accountId',width: '20%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '金额',key: 'eachAmount', width: '10%', type: FormTypes.inputNumber, statistics: true, placeholder: '请选择${title}',
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -164,8 +165,6 @@
}
},
created () {
this.initAccount()
this.initDetailAccount()
},
methods: {
//调用完edit()方法之后会自动调用此方法
@ -187,6 +186,9 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.accountTable);
}
this.initPerson()
this.initAccount()
this.initDetailAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -66,7 +66,8 @@
<a-row class="form-row" :gutter="24">
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收入账户">
<a-select placeholder="选择收入账户" v-decorator="[ 'accountId', validatorRules.accountId ]" :dropdownMatchSelectWidth="false">
<a-select placeholder="选择收入账户" v-decorator="[ 'accountId', validatorRules.accountId ]"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children">
<a-select-option v-for="(item,index) in accountList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
@ -133,7 +134,7 @@
dataSource: [],
columns: [
{ title: '收入项目',key: 'inOutItemId',width: '20%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '金额',key: 'eachAmount', width: '10%', type: FormTypes.inputNumber, statistics: true, placeholder: '请选择${title}',
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -177,8 +178,6 @@
}
},
created () {
this.initInOutItem('in')
this.initAccount()
},
methods: {
//调用完edit()方法之后会自动调用此方法
@ -200,6 +199,10 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.accountTable);
}
this.initCustomer()
this.initPerson()
this.initInOutItem('in')
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -66,7 +66,8 @@
<a-row class="form-row" :gutter="24">
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="支出账户">
<a-select placeholder="选择支出账户" v-decorator="[ 'accountId', validatorRules.accountId ]" :dropdownMatchSelectWidth="false">
<a-select placeholder="选择支出账户" v-decorator="[ 'accountId', validatorRules.accountId ]"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children">
<a-select-option v-for="(item,index) in accountList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
@ -133,7 +134,7 @@
dataSource: [],
columns: [
{ title: '支出项目',key: 'inOutItemId',width: '20%', type: FormTypes.select, placeholder: '请选择${title}', options: [],
validateRules: [{ required: true, message: '${title}不能为空' }]
allowSearch:true, validateRules: [{ required: true, message: '${title}不能为空' }]
},
{ title: '金额',key: 'eachAmount', width: '10%', type: FormTypes.inputNumber, statistics: true, placeholder: '请选择${title}',
validateRules: [{ required: true, message: '${title}不能为空' }]
@ -177,8 +178,6 @@
}
},
created () {
this.initInOutItem('out')
this.initAccount()
},
methods: {
//调用完edit()方法之后会自动调用此方法
@ -200,6 +199,10 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.accountTable);
}
this.initSupplier()
this.initPerson()
this.initInOutItem('out')
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -81,7 +81,8 @@
<a-row class="form-row" :gutter="24">
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收款账户">
<a-select placeholder="选择收款账户" v-decorator="[ 'accountId', validatorRules.accountId ]" :dropdownMatchSelectWidth="false">
<a-select placeholder="选择收款账户" v-decorator="[ 'accountId', validatorRules.accountId ]"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children">
<a-select-option v-for="(item,index) in accountList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
@ -192,7 +193,6 @@
}
},
created () {
this.initAccount()
},
methods: {
//调用完edit()方法之后会自动调用此方法
@ -214,6 +214,9 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.accountTable);
}
this.initCustomer()
this.initPerson()
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {

View File

@ -81,7 +81,8 @@
<a-row class="form-row" :gutter="24">
<a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="付款账户">
<a-select placeholder="选择付款账户" v-decorator="[ 'accountId', validatorRules.accountId ]" :dropdownMatchSelectWidth="false">
<a-select placeholder="选择付款账户" v-decorator="[ 'accountId', validatorRules.accountId ]"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children">
<a-select-option v-for="(item,index) in accountList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
@ -195,7 +196,6 @@
}
},
created () {
this.initAccount()
},
methods: {
//调用完edit()方法之后会自动调用此方法
@ -217,6 +217,9 @@
let url = this.readOnly ? this.url.detailList : this.url.detailList;
this.requestSubTableData(url, params, this.accountTable);
}
this.initSupplier()
this.initPerson()
this.initAccount()
},
//提交单据时整理成formData
classifyIntoFormData(allValues) {