全局数字验证
This commit is contained in:
81
src/components/AmountInputBox/AmountInputBox.js
Normal file
81
src/components/AmountInputBox/AmountInputBox.js
Normal file
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @desc 验证整数类型数字方法
|
||||
* @param {Object} e
|
||||
* @param {regular} reg 正则
|
||||
* @param {Number} charcode 键盘code
|
||||
* */
|
||||
const checkNumber = (e, reg, charcode) => {
|
||||
if (!reg.test(String.fromCharCode(charcode)) && charcode > 9 && !e.ctrlKey) {
|
||||
if (e.preventDefault) {
|
||||
e.preventDefault()
|
||||
} else {
|
||||
e.returnValue = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc 验证浮点类型小数方法(建议用text类型的表单)
|
||||
* @param {Object} e
|
||||
* @param {regular} reg 正则
|
||||
* @param {Number} charcode 键盘code
|
||||
* @param {Object} el dom对象
|
||||
* */
|
||||
const checkFloat = (e, reg, charcode, el) => {
|
||||
if (charcode === 46) {
|
||||
if (el.children[0].value.includes('.')) {
|
||||
e.preventDefault()
|
||||
}
|
||||
return
|
||||
} else if (
|
||||
!reg.test(String.fromCharCode(charcode)) &&
|
||||
charcode > 9 &&
|
||||
!e.ctrlKey
|
||||
) {
|
||||
if (e.preventDefault) {
|
||||
e.preventDefault()
|
||||
} else {
|
||||
e.returnValue = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author LeeYunxiang
|
||||
* @description 限制数字输入格式 int => 正整数 , num => 自然数(正整数包括0) , float => 正数包括小数(建议用text类型的input表单)
|
||||
* */
|
||||
export default {
|
||||
key: 'positive',
|
||||
func: {
|
||||
inserted(el, bind) {
|
||||
el.addEventListener('keypress', e => {
|
||||
e = e || window.event
|
||||
const charcode = typeof e.charCode === 'number' ? e.charCode : e.keyCode
|
||||
let reg = null
|
||||
switch (bind.value) {
|
||||
case 'num':
|
||||
reg = /\d/
|
||||
checkNumber(e, reg, charcode)
|
||||
break
|
||||
case 'int':
|
||||
if (el.children[0].value.length === 0) {
|
||||
reg = /^[1-9]$/
|
||||
} else {
|
||||
reg = /\d/
|
||||
}
|
||||
checkNumber(e, reg, charcode)
|
||||
break
|
||||
case 'float':
|
||||
reg = /\d/
|
||||
checkFloat(e, reg, charcode, el)
|
||||
break
|
||||
case 'notZero':
|
||||
// reg = (/^([1-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/)
|
||||
reg = (/^(?!(0[0-9]{0,}$))[0-9]{1,}[.]{0,}[0-9]{0,}$/)
|
||||
checkFloat(e, reg, charcode, el)
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
11
src/components/AmountInputBox/index.js
Normal file
11
src/components/AmountInputBox/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import AmountInputBox from './AmountInputBox.js'
|
||||
const directives = [AmountInputBox]
|
||||
export default {
|
||||
install: Vue => {
|
||||
if (directives.length && directives.length > 0) {
|
||||
directives.map(item => {
|
||||
Vue.directive(item.key, item.func)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,10 @@ import 'viewerjs/dist/viewer.css'
|
||||
import VueBarcode from '@xkeshi/vue-barcode'
|
||||
import Direction from 'vue-direction-key'
|
||||
import elDragDialog from '@/directive/el-dragDialog'
|
||||
// 全局数字、金额输入框组件
|
||||
import directive from './components/AmountInputBox/index.js'
|
||||
Vue.use(directive)
|
||||
|
||||
Vue.use(elDragDialog)
|
||||
Vue.component('barcode', VueBarcode)
|
||||
Vue.use(Direction)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<el-select v-model="Machine" filterable clearable size="small" style="margin:0px 10px 0px 10px;width: 185px;" placeholder="机床号" @change="searchGroupList">
|
||||
<el-select v-model="Machine" filterable clearable size="small" style="margin: 10px 10px 5px 0px;width: 150px;" placeholder="机床号" @change="searchGroupList">
|
||||
<el-option
|
||||
v-for="item in Machines"
|
||||
:key="item.value"
|
||||
@@ -11,7 +11,7 @@
|
||||
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="Group" size="small" clearable placeholder="组号" style="margin:0px 10px;width: 100px;" @change="total=0;pageSize=1000;pageCurrent=1;searchData();searchTable()">
|
||||
<el-select v-model="Group" size="small" clearable placeholder="组号" style="width: 150px;" @change="total=0;pageSize=1000;pageCurrent=1;searchData();searchTable()">
|
||||
<el-option
|
||||
v-for="item in Groups"
|
||||
:key="item.value"
|
||||
@@ -21,7 +21,7 @@
|
||||
<div style="float: right; color: #8492a6; font-size: 13px">{{ item.value2 }}</div>
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button type="primary" plain icon="el-icon-search" size="small" style="margin-top: 15px;margin-left: 10px" @click="total=0;pageSize=1000;pageCurrent=1;searchData();searchTable()">查询</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-search" size="small" style="margin-left: 20px" @click="total=0;pageSize=1000;pageCurrent=1;searchData();searchTable()">查询</el-button>
|
||||
</el-card>
|
||||
<el-card>
|
||||
<h3 style="text-align: center;">车间生产</h3>
|
||||
@@ -77,7 +77,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="block" style="margin-top: 10px;">
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
:current-page="pageCurrent"
|
||||
:page-sizes="[10, 20, 30, 40, 50]"
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<el-row>
|
||||
<el-input v-model="workerName" placeholder="操作者" size="small" clearable style="width:200px;margin:0px 10px"/>
|
||||
<!-- <span class="demonstration">完成加工时间:</span>-->
|
||||
<el-input v-model="workerName" placeholder="操作者" size="small" clearable style="width: 150px;margin:10px 10px 3px 0"/>
|
||||
<el-date-picker
|
||||
v-model="startTime"
|
||||
value-format="yyyy-MM-dd"
|
||||
size="small"
|
||||
style="width: 170px;margin:0px 10px"
|
||||
style="width: 150px"
|
||||
type="date"
|
||||
placeholder="选择开始加工日期"/>
|
||||
<span class="demonstration">~</span>
|
||||
@@ -16,28 +15,17 @@
|
||||
v-model="endTime"
|
||||
value-format="yyyy-MM-dd"
|
||||
size="small"
|
||||
style="width: 170px;margin:0px 10px"
|
||||
style="width: 150px"
|
||||
type="date"
|
||||
placeholder="选择加工完成日期"/>
|
||||
<el-button type="primary" plain class="el-icon-search" size="small" style="margin:0px 10px" @click="pageCurrent=1;total = 0;searchTable();">查询</el-button>
|
||||
<el-button type="primary" plain class="el-icon-search" size="small" style="margin-left: 20px" @click="pageCurrent=1;total = 0;searchTable();">查询</el-button>
|
||||
<el-tooltip :open-delay="1000" content="导出人员工时统计表" placement="right">
|
||||
<el-button type="primary" plain size="small" icon="el-icon-download" style="margin:0px 10px" @click="exportUninquirySheet1()">导出</el-button>
|
||||
</el-tooltip>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-card>
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
highlight-current-row
|
||||
height="380"
|
||||
size="mini"
|
||||
stripe
|
||||
style="width: 100%;"
|
||||
border
|
||||
element-loading-text="拼命加载中"
|
||||
@row-click="searchTable2">
|
||||
<el-table v-loading="loading" :data="tableData" highlight-current-row height="370" size="mini" stripe style="width: 100%;" border element-loading-text="拼命加载中" @row-click="searchTable2">
|
||||
<el-table-column label="操作者" align="center" width="110px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.姓名 }}
|
||||
@@ -54,7 +42,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="margin: 10px">
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
v-if="!loading"
|
||||
:current-page="pageCurrent"
|
||||
@@ -65,8 +53,8 @@
|
||||
@current-change="handleCurrentChange"/>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="17" style="margin-left: 30px;">
|
||||
<el-table v-loading="loading2" :data="tableData2" height="380" size="mini" highlight-current-row style="width: 100%;" border element-loading-text="拼命加载中">
|
||||
<el-col :span="17">
|
||||
<el-table v-loading="loading2" :data="tableData2" height="370" size="mini" highlight-current-row style="width: 100%;" border element-loading-text="拼命加载中">
|
||||
<el-table-column label="零件图号" align="center" width="150px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.零件图号 }}
|
||||
@@ -103,7 +91,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="margin: 10px">
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
v-if="!loading2"
|
||||
:current-page="pageCurrent2"
|
||||
@@ -114,10 +102,11 @@
|
||||
@current-change="handleCurrentChange2"/>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
<el-card>
|
||||
<!-- <span style="margin-left: 10px">机床编号:</span>-->
|
||||
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" style="margin:0px 10px" clearable @change="searchTable4();searchTable6()">
|
||||
<el-row>
|
||||
<el-select v-model="machineNumberValue" filterable placeholder="机床编号" size="small" style="width: 150px;margin:10px 0px 3px 0" clearable @change="searchTable4();searchTable6()">
|
||||
<el-option
|
||||
v-for="item in machineNumber"
|
||||
:key="item.value"
|
||||
@@ -128,15 +117,15 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-tooltip :open-delay="1000" content="导出机床工时统计明细表" placement="top">
|
||||
<el-button type="primary" size="mini" icon="el-icon-download" plain style="margin-left:10px" @click="exportUninquirySheet2()">机床导出</el-button>
|
||||
<el-button type="primary" size="mini" icon="el-icon-download" plain style="margin-left:20px" @click="exportUninquirySheet2()">机床导出</el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip :open-delay="1000" content="导出组件工时统计明细表" placement="top">
|
||||
<el-button type="primary" size="mini" icon="el-icon-download" style="margin-left:10px" plain @click="exportUninquirySheet3()">组件导出</el-button>
|
||||
</el-tooltip>
|
||||
</el-card>
|
||||
<el-card>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-table v-loading="loading3" :data="tableData3" stripe size="mini" highlight-current-row height="380" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="searchTable5">
|
||||
<el-table v-loading="loading3" :data="tableData3" stripe size="mini" highlight-current-row height="335" style="width: 100%;" border element-loading-text="拼命加载中" @row-click="searchTable5">
|
||||
<el-table-column label="机床编号" align="center" width="110px">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.机床图号 }}
|
||||
@@ -153,19 +142,9 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <div style="margin: 10px">-->
|
||||
<!-- <el-pagination-->
|
||||
<!-- v-if="!loading3"-->
|
||||
<!-- :current-page="pageCurrent3"-->
|
||||
<!-- :page-size="pageSize3"-->
|
||||
<!-- :total="total3"-->
|
||||
<!-- layout="total"-->
|
||||
<!-- @size-change="handleSizeChange3"-->
|
||||
<!-- @current-change="handleCurrentChange3"/>-->
|
||||
<!-- </div>-->
|
||||
</el-col>
|
||||
<el-col :span="17" style="margin-left: 30px;">
|
||||
<el-table v-loading="loading4" :data="tableData4" size="mini" height="380" highlight-current-row style="width: 100%;" border element-loading-text="拼命加载中">
|
||||
<el-col :span="17">
|
||||
<el-table v-loading="loading4" :data="tableData4" size="mini" height="335" highlight-current-row style="width: 100%;" border element-loading-text="拼命加载中">
|
||||
<el-table-column label="机床编号" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.机床图号 }}
|
||||
@@ -187,17 +166,8 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- <div style="margin: 10px">-->
|
||||
<!-- <el-pagination-->
|
||||
<!-- v-if="!loading4"-->
|
||||
<!-- :current-page="pageCurrent4"-->
|
||||
<!-- :page-size="pageSize4"-->
|
||||
<!-- :total="total4"-->
|
||||
<!-- layout="total"-->
|
||||
<!-- @size-change="handleSizeChange4"-->
|
||||
<!-- @current-change="handleCurrentChange4"/>-->
|
||||
<!-- </div>-->
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -207,6 +177,7 @@ import { searchtable, searchtable2, searchtable4, searchtable5, initProject, sea
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
AmountInputBox: 231,
|
||||
workerName: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<span>厂家名称:</span>
|
||||
<el-input v-model="ManufacturerName" clearable size="small" style="width:200px" @keyup.enter.native="pageCurrent=1;pageSize=50;searchTable()" @clear="pageCurrent=1;pageSize=50;searchTable()"/>
|
||||
<el-input v-model="ManufacturerName" clearable placeholder="外协厂家名称" size="small" style="width:200px;margin: 10px 0 3px 0;" @keyup.enter.native="pageCurrent=1;pageSize=50;searchTable()" @clear="pageCurrent=1;pageSize=50;searchTable()"/>
|
||||
<el-button type="primary" size="small" icon="el-icon-search" style="margin-left:20px" plain @click="getList()">查询</el-button>
|
||||
<el-tooltip :open-delay="1200" effect="dark" content="新增外协厂家" placement="top">
|
||||
<el-button type="distribution" icon="el-icon-circle-plus-outline" size="small" @click="editType1('form');param = 0">新增</el-button>
|
||||
<el-button type="distribution" icon="el-icon-circle-plus-outline" style="margin-left: 10px" size="small" @click="editType1('form');param = 0">新增</el-button>
|
||||
</el-tooltip>
|
||||
</el-card>
|
||||
<el-card>
|
||||
<el-table v-loading="loading0" :data="tableData" height="550" style="width: 100%;" border>
|
||||
<el-table-column label="序号" align="center" type="index" width="50"/>
|
||||
<el-table-column label="外协厂家名称" align="center" width="280px">
|
||||
@@ -45,19 +43,9 @@
|
||||
{{ scope.row.备注 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="150px" fixed="right">
|
||||
<el-table-column label="操作" align="center" width="70px" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
plain
|
||||
class="el-icon-edit"
|
||||
@click="handleChange1(scope.$index, scope.row, 'form');param = 1">编辑</el-button>
|
||||
<!--<el-button-->
|
||||
<!--size="mini"-->
|
||||
<!--type="danger"-->
|
||||
<!--class="el-icon-delete"-->
|
||||
<!--@click="handleDelete(scope.$index, scope.row)">删除</el-button>-->
|
||||
<el-button size="mini" type="text" plain class="el-icon-edit" @click="handleChange1(scope.$index, scope.row, 'form');param = 1"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<!--<span>项目名称</span>-->
|
||||
<!--<el-select v-model="projectValue" placeholder="请选择项目名称" filterable size="small">-->
|
||||
<!--<el-option-->
|
||||
<!--v-for="item in project"-->
|
||||
<!--:key="item.value"-->
|
||||
<!--:label="item.label"-->
|
||||
<!--:value="item.value"/>-->
|
||||
<!--</el-select>-->
|
||||
<span>机床图号</span>
|
||||
<el-select v-model="machineValue" placeholder="请选择机床图号" filterable size="small">
|
||||
<el-select v-model="machineValue" placeholder="机床图号" style="width: 150px" filterable size="small">
|
||||
<el-option
|
||||
v-for="item in machine"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
<span>组号</span>
|
||||
<el-select v-model="groupValue" placeholder="请选择组号" filterable size="small">
|
||||
<el-select v-model="groupValue" placeholder="组号" style="width: 150px;margin-top: 10px;margin-bottom: 5px" filterable size="small">
|
||||
<el-option
|
||||
v-for="item in group"
|
||||
:key="item.value"
|
||||
@@ -34,7 +24,7 @@
|
||||
<div class="content">
|
||||
<div class="action"/>
|
||||
<div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
|
||||
<div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
|
||||
<div v-else-if="file.suffix==='docx'|| file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
|
||||
<div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
|
||||
<div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
|
||||
<div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
|
||||
|
||||
Reference in New Issue
Block a user