|
@@ -8,9 +8,6 @@
|
|
|
@close="() => {innerVisible = false; tableData = [];manager = ''; managerid = [];}"
|
|
|
>
|
|
|
<div v-if="tableData && tableData.length > 0" class="tr" style="padding: 10px 0 0 0;display:flex">
|
|
|
- <!-- <el-button :size="'mini'" @click="() => tableData = []">取消</el-button>
|
|
|
- <el-button type="primary" :size="'mini'" @click="onSubmit">提交</el-button> -->
|
|
|
-
|
|
|
<project-manager size="mini" :is-detail="true" :names="manager" :value="managerid" @searchChange="manageridChange" />
|
|
|
|
|
|
<el-button type="warning" size="mini" style="margin-left:10px" @click="batchSetting">批量设置</el-button>
|
|
@@ -33,7 +30,6 @@
|
|
|
|
|
|
<script>
|
|
|
import asyncRequest from '@/apis/service/dataCorrection/managerBatchCorrection'
|
|
|
-import { isMobile, isPhone, isnumber } from '@/utils/validate'
|
|
|
import companyHelper from '@/mixins/companyHelper'
|
|
|
import { MessageBox } from 'element-ui'
|
|
|
import dayjs from 'dayjs'
|
|
@@ -47,7 +43,7 @@ import {
|
|
|
createFieldVerification,
|
|
|
requsetFields,
|
|
|
requiredFields,
|
|
|
- numberFields
|
|
|
+ orderCodeFields
|
|
|
} from './template'
|
|
|
|
|
|
export default {
|
|
@@ -93,7 +89,6 @@ export default {
|
|
|
const newTableData = JSON.parse(JSON.stringify(this.tableData));
|
|
|
const orderCodes = this.selected.map(({orderCode}) => orderCode);
|
|
|
|
|
|
-
|
|
|
newTableData.forEach(item => {
|
|
|
if(orderCodes.includes(item.orderCode)){
|
|
|
item.managerid = this.managerid[0];
|
|
@@ -103,8 +98,6 @@ export default {
|
|
|
|
|
|
|
|
|
this.tableData = newTableData;
|
|
|
-
|
|
|
- console.log(this.tableData)
|
|
|
},
|
|
|
handleSelection(data){
|
|
|
this.selected = data.list
|
|
@@ -133,7 +126,6 @@ export default {
|
|
|
|
|
|
return isHeaderOk
|
|
|
},
|
|
|
- /* 所属平台、商品分类、商品名称、单位、收货人、收货地址、PO编号不能为空 **/
|
|
|
validateRequiredField(requiredFields) {
|
|
|
const verification = createFieldVerification('销售订单编号、导入业务经理名称,不能为空!')
|
|
|
const fields = helper.fields(requiredFields)
|
|
@@ -147,6 +139,20 @@ export default {
|
|
|
|
|
|
return verification
|
|
|
},
|
|
|
+ validateCodeField(orderCodeFields) {
|
|
|
+ const verification = createFieldVerification('销售订单编号应该由字母和数字组成!')
|
|
|
+ const fields = helper.fields(orderCodeFields)
|
|
|
+
|
|
|
+ const reg = /^(?=.*[a-zA-Z])(?=.*\d)[a-zA-Z\d]+$/
|
|
|
+ orderCodeFields[fields[0]].forEach((_, index) => {
|
|
|
+ if (!helper.values(orderCodeFields, fields, index).every(value => value && reg.test(value))) {
|
|
|
+ verification.isValid = false
|
|
|
+ verification.notValidRows.push(index + 1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ return verification
|
|
|
+ },
|
|
|
/* 处理不合法的值,提示错误信息,并返回最终的验证状态 **/
|
|
|
handleNotValidFields(...validStates) {
|
|
|
const messages = {}
|
|
@@ -187,7 +193,8 @@ export default {
|
|
|
}
|
|
|
|
|
|
return this.handleNotValidFields(
|
|
|
- this.validateRequiredField(helper.write(mapTableFieldToTableData, requiredFields))
|
|
|
+ this.validateRequiredField(helper.write(mapTableFieldToTableData, requiredFields)),
|
|
|
+ this.validateCodeField(helper.write(mapTableFieldToTableData, orderCodeFields))
|
|
|
)
|
|
|
},
|
|
|
mapTemplateItemToTableItem(templateItem) {
|
|
@@ -221,7 +228,12 @@ export default {
|
|
|
const tableItem = this.mapTemplateItemToTableItem(templateItem)
|
|
|
this.tableData.push(tableItem)
|
|
|
})
|
|
|
- this.validateFields(this.tableData).message()
|
|
|
+ const {isFinalValid, message} = this.validateFields(this.tableData)
|
|
|
+
|
|
|
+ if(!isFinalValid){
|
|
|
+ message();
|
|
|
+ this.tableData = [];
|
|
|
+ }
|
|
|
},
|
|
|
async onSubmit() {
|
|
|
const { message, isFinalValid } = this.validateFields(this.tableData)
|