代码优化
This commit is contained in:
parent
f97ccbc0bc
commit
4af2fdeefe
|
|
@ -8,12 +8,36 @@
|
|||
:close-on-click-modal="false"
|
||||
>
|
||||
<div class="content">
|
||||
<el-form :model="formData" ref="form" label-width="80px" :inline="false" size="small" inline>
|
||||
<el-form
|
||||
:model="formData"
|
||||
ref="form"
|
||||
label-width="80px"
|
||||
:inline="false"
|
||||
size="small"
|
||||
inline
|
||||
>
|
||||
<el-form-item label="领料单号" size="small" prop="materialReqNo">
|
||||
<el-input v-model="formData.materialReqNo" placeholder="请输入领料单号" size="small" clearable filterable></el-input>
|
||||
<el-input
|
||||
v-model="formData.materialReqNo"
|
||||
placeholder="请输入领料单号"
|
||||
size="small"
|
||||
clearable
|
||||
filterable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="单位名称" size="small" prop="materialReqUnitValue">
|
||||
<el-select v-model="formData.materialReqUnitValue" placeholder="请选择单位" size="small" clearable filterable @change="handleUnit">
|
||||
<el-form-item
|
||||
label="单位名称"
|
||||
size="small"
|
||||
prop="materialReqUnitValue"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.materialReqUnitValue"
|
||||
placeholder="请选择单位"
|
||||
size="small"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleUnit"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in formData.materialReqUnitList"
|
||||
:key="item.unitId"
|
||||
|
|
@ -22,8 +46,19 @@
|
|||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工程名称" size="small" prop="materialReqProjectValue">
|
||||
<el-select v-model="formData.materialReqProjectValue" placeholder="请选择工程名称" size="small" clearable filterable @change="handleProject">
|
||||
<el-form-item
|
||||
label="工程名称"
|
||||
size="small"
|
||||
prop="materialReqProjectValue"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.materialReqProjectValue"
|
||||
placeholder="请选择工程名称"
|
||||
size="small"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleProject"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in formData.materialReqProjectList"
|
||||
:key="item.projectId"
|
||||
|
|
@ -32,19 +67,40 @@
|
|||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备类型" size="small" prop="materialReqTypeValue">
|
||||
<el-select v-model="formData.materialReqTypeValue" placeholder="请选择设备类型" size="small" clearable filterable @change="handleType">
|
||||
<el-option v-for="item in formData.materialReqTypeList"
|
||||
<el-form-item
|
||||
label="设备类型"
|
||||
size="small"
|
||||
prop="materialReqTypeValue"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.materialReqTypeValue"
|
||||
placeholder="请选择设备类型"
|
||||
size="small"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleType"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in formData.materialReqTypeList"
|
||||
:key="item.typeId"
|
||||
:label="item.typeName"
|
||||
:value="item.typeId">
|
||||
:value="item.typeId"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="small" @click="handleSearch">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="small" @click="handleReset">重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-search"
|
||||
size="small"
|
||||
@click="handleSearch"
|
||||
>查询</el-button
|
||||
>
|
||||
<el-button icon="el-icon-refresh" size="small" @click="handleReset"
|
||||
>重置</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -58,7 +114,7 @@
|
|||
:align="item.align"
|
||||
:type="item.type"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
|
|
@ -69,7 +125,6 @@
|
|||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
</div>
|
||||
<!-- <span slot="footer" class="dialog-footer">
|
||||
<el-button @click="open = false">关 闭</el-button>
|
||||
|
|
@ -80,12 +135,17 @@
|
|||
|
||||
<script>
|
||||
import Pagination from '../Pagination/index.vue'
|
||||
import { getTypeList, getDetails, getUnitList, getProjectList } from '../../api/dialog'
|
||||
import {
|
||||
getTypeList,
|
||||
getDetails,
|
||||
getUnitList,
|
||||
getProjectList,
|
||||
} from '../../api/dialog'
|
||||
|
||||
export default {
|
||||
name: 'getMaterialsDialog',
|
||||
components: {
|
||||
Pagination
|
||||
Pagination,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -105,68 +165,67 @@ export default {
|
|||
label: '序号',
|
||||
type: 'index',
|
||||
width: 60,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: '出库时间',
|
||||
prop: 'materialTime',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: '设备类型',
|
||||
prop: 'typeName',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: '规格型号',
|
||||
prop: 'typeModelName',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: '出库数量',
|
||||
prop: 'num',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: '设备负责人',
|
||||
prop: 'userName',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: '领料单号',
|
||||
prop: 'materialCode',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: '领料申请单位',
|
||||
prop: 'unitName',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
label: '领料申请工程',
|
||||
prop: 'projectName',
|
||||
align: 'center'
|
||||
}
|
||||
align: 'center',
|
||||
},
|
||||
],
|
||||
total: 0,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
pageSize: 10,
|
||||
},
|
||||
maType: 1
|
||||
};
|
||||
maType: 1,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getUnit()
|
||||
this.getProject()
|
||||
this.getType()
|
||||
|
||||
},
|
||||
methods: {
|
||||
setOpen(params) {
|
||||
this.open = params.open
|
||||
this.maType = params.maType
|
||||
console.log('🚀 ~ setOpen ~ this.maType:', this.maType);
|
||||
console.log('🚀 ~ setOpen ~ this.maType:', this.maType)
|
||||
this.tableData = []
|
||||
this.total = 0
|
||||
setTimeout(() => {
|
||||
|
|
@ -182,15 +241,15 @@ export default {
|
|||
materialCode: this.formData.materialReqNo.trim(),
|
||||
unitId: this.formData.materialReqUnitValue,
|
||||
projectId: this.formData.materialReqProjectValue,
|
||||
typeId: this.formData.materialReqTypeValue
|
||||
typeId: this.formData.materialReqTypeValue,
|
||||
}
|
||||
getDetails(params).then(({data}) => {
|
||||
getDetails(params).then(({ data }) => {
|
||||
this.tableData = data.rows
|
||||
this.total = data.total
|
||||
})
|
||||
},
|
||||
getUnit() {
|
||||
getUnitList().then(res => {
|
||||
getUnitList().then((res) => {
|
||||
this.formData.materialReqUnitList = res.data
|
||||
})
|
||||
},
|
||||
|
|
@ -198,7 +257,7 @@ export default {
|
|||
this.formData.materialReqUnitValue = val
|
||||
},
|
||||
getProject() {
|
||||
getProjectList().then(res => {
|
||||
getProjectList().then((res) => {
|
||||
this.formData.materialReqProjectList = res.data
|
||||
})
|
||||
},
|
||||
|
|
@ -206,7 +265,7 @@ export default {
|
|||
this.formData.materialReqProjectValue = val
|
||||
},
|
||||
getType() {
|
||||
getTypeList({ level: '3' }).then(res => {
|
||||
getTypeList({ level: '3' }).then((res) => {
|
||||
this.formData.materialReqTypeList = res.data
|
||||
})
|
||||
},
|
||||
|
|
@ -220,13 +279,13 @@ export default {
|
|||
handleReset() {
|
||||
this.$refs.form.resetFields()
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
.content {
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ export default {
|
|||
submitApply() {
|
||||
let costAll = 0
|
||||
this.applyList.forEach((item) => {
|
||||
costAll = costAll + item.cost
|
||||
costAll = costAll + item.cost * 1
|
||||
})
|
||||
console.log(costAll)
|
||||
let param = {
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@
|
|||
>
|
||||
<span>供应商:</span>
|
||||
<span v-if="printTableData.length > 0">{{
|
||||
printTableData[0].supplier
|
||||
supplierStr
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -468,6 +468,7 @@ export default {
|
|||
},
|
||||
],
|
||||
},
|
||||
supplierStr: '',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
@ -581,6 +582,16 @@ export default {
|
|||
getAccessoryAcceptanceForm({ taskId: taskId }).then((response) => {
|
||||
this.printData = response.data
|
||||
this.printTableData = response.data.partDetailsList
|
||||
|
||||
let supplierList = []
|
||||
this.printTableData.forEach((e) => {
|
||||
if (e.supplier) {
|
||||
supplierList.push(e.supplier)
|
||||
}
|
||||
})
|
||||
supplierList = [...new Set(supplierList)]
|
||||
|
||||
this.supplierStr = supplierList.join(',')
|
||||
})
|
||||
},
|
||||
//查看验收单
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@
|
|||
<el-input v-model="form.typeId" disabled v-show="false" />
|
||||
|
||||
<el-form-item label="编码前缀" prop="exCode">
|
||||
<el-input v-model="form.exCode" @change="fillingCodeList" />
|
||||
<el-input v-model="form.exCode" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="后缀起始值" prop="suffixOneCode">
|
||||
|
|
@ -185,9 +185,7 @@
|
|||
<el-form-item label="编码数量" prop="codeNum">
|
||||
<el-input
|
||||
v-model="form.codeNum"
|
||||
type="number"
|
||||
style="width: 120px"
|
||||
@change="onChangeCodeNum"
|
||||
clearable
|
||||
/>
|
||||
</el-form-item>
|
||||
|
|
@ -388,6 +386,7 @@ export default {
|
|||
// pageSize: 10,
|
||||
typeName: undefined,
|
||||
},
|
||||
codeInfo: null,
|
||||
// 表单参数
|
||||
form: {
|
||||
exCode: '',
|
||||
|
|
@ -396,9 +395,9 @@ export default {
|
|||
fixCode: '1',
|
||||
typeId: '',
|
||||
|
||||
suffixOneCode: 0,
|
||||
suffixOneCode: '',
|
||||
suffixTwoCode: 0,
|
||||
codeNum: 0,
|
||||
codeNum: '',
|
||||
},
|
||||
codeList: [], //弹窗列表list
|
||||
getCodeList: [], //已成过的编码list
|
||||
|
|
@ -424,6 +423,17 @@ export default {
|
|||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
codeNum: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入编码数量',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
pattern: /^[1-9][0-9]*$/,
|
||||
message: '请输入大于0且不能以0开头的正整数',
|
||||
},
|
||||
],
|
||||
suffixOneCode: [
|
||||
{
|
||||
required: true,
|
||||
|
|
@ -489,8 +499,12 @@ export default {
|
|||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.reset()
|
||||
// this.reset()
|
||||
|
||||
this.resetForm('formCodeRef')
|
||||
this.open = false
|
||||
// this.form.suffixOneCode = ''
|
||||
// this.form.codeNum = ''
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
|
|
@ -526,36 +540,37 @@ export default {
|
|||
}, //getCodeList newCodeList
|
||||
/** 编码按钮操作 */ handleCode(row) {
|
||||
console.log(row)
|
||||
this.reset()
|
||||
this.form = row
|
||||
|
||||
// this.reset()
|
||||
// this.form = row
|
||||
this.codeInfo = row
|
||||
if (!this.form.fixCode) {
|
||||
this.form.fixCode = '1'
|
||||
}
|
||||
this.$set(this.form, 'str', '')
|
||||
this.$set(this.form, 'str1', '')
|
||||
// this.$set(this.form, 'str', '')
|
||||
// this.$set(this.form, 'str1', '')
|
||||
// this.$set(this.form,'fixCode','1')
|
||||
let arr = this.form.arrivalTime.split('-')
|
||||
let arr = row.arrivalTime.split('-')
|
||||
// this.form.exCode = ;
|
||||
// this.form.typeCode=111
|
||||
if (!this.form.typeCode) {
|
||||
this.form.typeCode = ''
|
||||
}
|
||||
if (!this.form.specsCode) {
|
||||
this.form.specsCode = ''
|
||||
}
|
||||
this.$set(
|
||||
this.form,
|
||||
'exCode',
|
||||
'NSJJ' +
|
||||
this.form.typeCode +
|
||||
this.form.specsCode +
|
||||
arr[0][2] +
|
||||
arr[0][3] +
|
||||
arr[1],
|
||||
)
|
||||
// if (!this.form.typeCode) {
|
||||
// this.form.typeCode = ''
|
||||
// }
|
||||
// if (!this.form.specsCode) {
|
||||
// this.form.specsCode = ''
|
||||
// }
|
||||
// this.$set(
|
||||
// this.form,
|
||||
// 'exCode',
|
||||
// 'NSJJ' +
|
||||
// this.form.typeCode +
|
||||
// this.form.specsCode +
|
||||
// arr[0][2] +
|
||||
// arr[0][3] +
|
||||
// arr[1],
|
||||
// )
|
||||
|
||||
this.form.count = row.checkNum
|
||||
this.form.exCode = 'NSJJ' + arr[0][2] + arr[0][3] + arr[1]
|
||||
// this.form.count = row.checkNum
|
||||
this.codeList = []
|
||||
this.open = true
|
||||
this.title = '生成编码'
|
||||
|
|
@ -570,7 +585,7 @@ export default {
|
|||
// });
|
||||
|
||||
this.surplusNoBindNum =
|
||||
parseInt(this.form.checkNum) - parseInt(this.form.bindNum)
|
||||
parseInt(row.checkNum) - parseInt(row.bindNum)
|
||||
},
|
||||
//生成列表codeList
|
||||
createCodeList() {
|
||||
|
|
@ -608,9 +623,15 @@ export default {
|
|||
},
|
||||
//填充按钮
|
||||
fillingCodeList() {
|
||||
this.codeList = []
|
||||
this.$message.closeAll()
|
||||
this.$refs['formCodeRef'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.codeNum * 1 > this.surplusNoBindNum) {
|
||||
this.$message.error('编码数量不能大于待编码数量')
|
||||
this.form.codeNum = this.surplusNoBindNum
|
||||
return
|
||||
}
|
||||
this.codeList = []
|
||||
let codeNum = 0
|
||||
if (
|
||||
!this.form.codeNum ||
|
||||
|
|
@ -622,10 +643,10 @@ export default {
|
|||
}
|
||||
for (let i = 0; i < codeNum; i++) {
|
||||
let obj = {
|
||||
typeName: this.form.typeName,
|
||||
specificationType: this.form.specificationType,
|
||||
typeId: this.form.typeId,
|
||||
taskId: this.form.taskId,
|
||||
typeName: this.codeInfo.typeName,
|
||||
specificationType: this.codeInfo.specificationType,
|
||||
typeId: this.codeInfo.typeId,
|
||||
taskId: this.codeInfo.taskId,
|
||||
maCode: this.form.suffixOneCode * 1 + i,
|
||||
assetsCode: '',
|
||||
fixCode: this.form.fixCode,
|
||||
|
|
@ -895,9 +916,9 @@ export default {
|
|||
open: {
|
||||
handler(newValue) {
|
||||
if (!newValue) {
|
||||
this.form.suffixOneCode = 0
|
||||
this.form.suffixOneCode = ''
|
||||
// this.form.suffixTwoCode = ''
|
||||
this.form.codeNum = 0
|
||||
this.form.codeNum = ''
|
||||
this.form.fixCode = '1'
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -659,14 +659,13 @@ export default {
|
|||
this.printTableData = response.data.checkDetailsList
|
||||
|
||||
let supplierList = []
|
||||
this.printTableData.map((e) => {
|
||||
this.printTableData.forEach((e) => {
|
||||
if (e.supplier) {
|
||||
supplierList.push(e.supplier)
|
||||
}
|
||||
})
|
||||
|
||||
const supplierListNew = [...new Set(supplierList)]
|
||||
this.supplierListNew = supplierListNew.join(',')
|
||||
supplierList = [...new Set(supplierList)]
|
||||
this.supplierStr = supplierList.join(',')
|
||||
})
|
||||
},
|
||||
//查看验收单
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@
|
|||
</el-form>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="returnList"
|
||||
@selection-change="handleSelectionChange"
|
||||
border
|
||||
|
|
@ -249,7 +248,7 @@
|
|||
|
||||
<el-col :span="10">
|
||||
<el-form-item
|
||||
label="后缀范围"
|
||||
label="后缀起始值"
|
||||
label-width="130px"
|
||||
prop="codeSuffixStart"
|
||||
v-if="!isNumCheck"
|
||||
|
|
@ -257,15 +256,12 @@
|
|||
<el-input
|
||||
v-model="codeForm.codeSuffixStart"
|
||||
clearable
|
||||
placeholder="请输入后缀范围起始值"
|
||||
maxlength="10"
|
||||
style="width: 185px"
|
||||
@change="
|
||||
changeSuffixStart(codeForm.codeSuffixStart)
|
||||
"
|
||||
placeholder="请输入后缀起始值"
|
||||
maxlength="99999999"
|
||||
style="width: 400px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
<!-- <el-form-item
|
||||
label="~"
|
||||
label-width="auto"
|
||||
prop="codeSuffixEnd"
|
||||
|
|
@ -279,7 +275,7 @@
|
|||
style="width: 185px"
|
||||
@change="changeSuffixEnd"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form-item> -->
|
||||
</el-col>
|
||||
<el-col :span="7">
|
||||
<el-form-item
|
||||
|
|
@ -360,10 +356,17 @@
|
|||
if (codeForm.thisCheckTime) {
|
||||
let today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
return time.getTime() < today.getTime() || time.getTime() < new Date(codeForm.thisCheckTime).getTime()
|
||||
return (
|
||||
time.getTime() <
|
||||
today.getTime() ||
|
||||
time.getTime() <
|
||||
new Date(
|
||||
codeForm.thisCheckTime,
|
||||
).getTime()
|
||||
)
|
||||
}
|
||||
return false
|
||||
}
|
||||
},
|
||||
}"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
|
@ -478,7 +481,7 @@
|
|||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
maxlength="100"
|
||||
rows="4"
|
||||
rows="1"
|
||||
show-word-limit
|
||||
style="width: 400px"
|
||||
/>
|
||||
|
|
@ -533,10 +536,10 @@
|
|||
</el-col>
|
||||
</el-row> -->
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="codeTableList"
|
||||
v-if="!isNumCheck"
|
||||
@selection-change="handleSelectionChange"
|
||||
height="400"
|
||||
:stripe="true"
|
||||
>
|
||||
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
||||
|
|
@ -552,7 +555,7 @@
|
|||
:show-overflow-tooltip="true"
|
||||
>
|
||||
<template v-slot:header>
|
||||
<span style="color: red;">* </span>设备编码
|
||||
<span style="color: red">* </span>设备编码
|
||||
</template>
|
||||
<template v-slot:default="{ row }" v-if="!isNumCheck">
|
||||
<el-input
|
||||
|
|
@ -633,10 +636,16 @@
|
|||
if (row.thisCheckTime) {
|
||||
let today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
return time.getTime() < today.getTime() || time.getTime() < new Date(row.thisCheckTime).getTime()
|
||||
return (
|
||||
time.getTime() < today.getTime() ||
|
||||
time.getTime() <
|
||||
new Date(
|
||||
row.thisCheckTime,
|
||||
).getTime()
|
||||
)
|
||||
}
|
||||
return false
|
||||
}
|
||||
},
|
||||
}"
|
||||
></el-date-picker>
|
||||
</template>
|
||||
|
|
@ -930,7 +939,7 @@ export default {
|
|||
remarks: undefined,
|
||||
typeId: undefined,
|
||||
num: undefined,
|
||||
codePrefix: undefined,
|
||||
codePrefix: 'PD-CODE',
|
||||
codeSuffixStart: undefined,
|
||||
codeSuffixEnd: undefined,
|
||||
buyPrice: undefined,
|
||||
|
|
@ -960,6 +969,20 @@ export default {
|
|||
],
|
||||
},
|
||||
codeFormRules: {
|
||||
codePrefix: [
|
||||
{ required: true, message: '请输入前缀', trigger: 'blur' },
|
||||
],
|
||||
codeSuffixStart: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入后缀起始值',
|
||||
trigger: 'blur',
|
||||
},
|
||||
{
|
||||
pattern: /^[1-9][0-9]*$/,
|
||||
message: '请输入大于0且不能以0开头的正整数',
|
||||
},
|
||||
],
|
||||
putInType: [
|
||||
{
|
||||
required: true,
|
||||
|
|
@ -1054,7 +1077,7 @@ export default {
|
|||
remarks: undefined,
|
||||
typeId: null,
|
||||
num: undefined,
|
||||
codePrefix: undefined,
|
||||
codePrefix: 'PD-CODE',
|
||||
codeSuffixStart: undefined,
|
||||
codeSuffixEnd: undefined,
|
||||
buyPrice: undefined,
|
||||
|
|
@ -1096,23 +1119,23 @@ export default {
|
|||
this.numTableList.push(this.numTable)
|
||||
} else {
|
||||
// 根据this.codeForm.num的数量, 往this.codeTableList中添加this.codeForm的数据
|
||||
for (let i = 0; i < this.codeForm.num; i++) {
|
||||
for (let i = 0; i < this.codeForm.num * 1; i++) {
|
||||
// 设备编码: 前缀 拼接 后缀
|
||||
let suffix = parseInt(this.codeForm.codeSuffixStart) + i
|
||||
if (suffix > parseInt(this.codeForm.codeSuffixEnd)) {
|
||||
suffix = parseInt(this.codeForm.codeSuffixEnd)
|
||||
}
|
||||
suffix = suffix
|
||||
.toString()
|
||||
.padStart(
|
||||
this.codeForm.codeSuffixStart?.length,
|
||||
'0',
|
||||
)
|
||||
// console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
|
||||
suffix = isNaN(suffix) ? '' : suffix
|
||||
const maCode = `${
|
||||
this.codeForm.codePrefix || ''
|
||||
}${suffix}`
|
||||
// let suffix = parseInt(this.codeForm.codeSuffixStart) + i
|
||||
// if (suffix > parseInt(this.codeForm.codeSuffixEnd)) {
|
||||
// suffix = parseInt(this.codeForm.codeSuffixEnd)
|
||||
// }
|
||||
// suffix = suffix
|
||||
// .toString()
|
||||
// .padStart(
|
||||
// this.codeForm.codeSuffixStart?.length,
|
||||
// '0',
|
||||
// )
|
||||
// // console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
|
||||
// suffix = isNaN(suffix) ? '' : suffix
|
||||
// const maCode = `${
|
||||
// this.codeForm.codePrefix || ''
|
||||
// }${suffix}`
|
||||
// 出厂编码
|
||||
const outFacCode = ''
|
||||
// 生产厂家
|
||||
|
|
@ -1129,7 +1152,7 @@ export default {
|
|||
// 单价: codeForm.buyPrice
|
||||
const buyPrice = this.codeForm.buyPrice || 0
|
||||
this.codeTableList.push({
|
||||
maCode,
|
||||
maCode: this.codeForm.codeSuffixStart * 1 + i,
|
||||
outFacCode,
|
||||
maVender,
|
||||
thisCheckTime,
|
||||
|
|
@ -1137,6 +1160,21 @@ export default {
|
|||
buyPrice,
|
||||
})
|
||||
}
|
||||
|
||||
this.codeTableList.forEach((e) => {
|
||||
if (e.maCode < 10) {
|
||||
e.maCode = `000${e.maCode}`
|
||||
} else if (e.maCode < 100) {
|
||||
e.maCode = `00${e.maCode}`
|
||||
} else if (e.maCode < 1000) {
|
||||
e.maCode = `0${e.maCode}`
|
||||
} else {
|
||||
}
|
||||
})
|
||||
|
||||
this.codeTableList.forEach((e) => {
|
||||
e.maCode = this.codeForm.codePrefix + e.maCode
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
@ -1147,7 +1185,10 @@ export default {
|
|||
this.codeForm.codeSuffixStart =
|
||||
this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
|
||||
}
|
||||
if (isNaN(this.codeForm.codeSuffixStart) || this.codeForm.codeSuffixStart.includes('.')) {
|
||||
if (
|
||||
isNaN(this.codeForm.codeSuffixStart) ||
|
||||
this.codeForm.codeSuffixStart.includes('.')
|
||||
) {
|
||||
this.$message.error('后缀范围请输入整数类型')
|
||||
this.codeForm.codeSuffixStart = ''
|
||||
}
|
||||
|
|
@ -1156,7 +1197,10 @@ export default {
|
|||
if (!this.codeForm.codeSuffixStart) {
|
||||
this.$message.error('请输入后缀范围起始值')
|
||||
this.codeForm.codeSuffixEnd = ''
|
||||
} else if (isNaN(this.codeForm.codeSuffixEnd) || this.codeForm.codeSuffixEnd.includes('.')) {
|
||||
} else if (
|
||||
isNaN(this.codeForm.codeSuffixEnd) ||
|
||||
this.codeForm.codeSuffixEnd.includes('.')
|
||||
) {
|
||||
this.$message.error('后缀范围请输入整数类型')
|
||||
this.codeForm.codeSuffixEnd =
|
||||
this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
|
||||
|
|
@ -1415,24 +1459,28 @@ export default {
|
|||
}
|
||||
const res = await getDeviceTypeTree(params)
|
||||
if (type) {
|
||||
this.disableNodes(res.data, '1');
|
||||
this.disableNodes(res.data, '1')
|
||||
} else {
|
||||
this.disableNodes(res.data, '0');
|
||||
this.disableNodes(res.data, '0')
|
||||
}
|
||||
this.deviceTypeTree = res.data
|
||||
},
|
||||
// 递归禁用节点
|
||||
disableNodes(nodes, manageType, level = 1) {
|
||||
nodes.forEach(node => {
|
||||
nodes.forEach((node) => {
|
||||
node.level = level
|
||||
if (node.children) {
|
||||
this.disableNodes(node.children, manageType, level + 1);
|
||||
this.disableNodes(node.children, manageType, level + 1)
|
||||
} else if (!node.children && node.level < 4) {
|
||||
node.disabled = true
|
||||
} else if(node.manageType && node.level == 4 && node.manageType != manageType) {
|
||||
} else if (
|
||||
node.manageType &&
|
||||
node.level == 4 &&
|
||||
node.manageType != manageType
|
||||
) {
|
||||
node.disabled = true
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
/////// 设备类型树 切换
|
||||
deviceTypeChange(val) {
|
||||
|
|
@ -1571,7 +1619,10 @@ export default {
|
|||
},
|
||||
// 校验检验日期
|
||||
changeCheckTime() {
|
||||
if (this.codeForm.nextCheckTime && this.codeForm.thisCheckTime > this.codeForm.nextCheckTime) {
|
||||
if (
|
||||
this.codeForm.nextCheckTime &&
|
||||
this.codeForm.thisCheckTime > this.codeForm.nextCheckTime
|
||||
) {
|
||||
this.codeForm.nextCheckTime = ''
|
||||
this.$message.warning('下次检验日期不能早于检验日期!')
|
||||
} else if (!this.codeForm.thisCheckTime) {
|
||||
|
|
@ -1600,4 +1651,4 @@ export default {
|
|||
::v-deep .el-input-number.is-without-controls .el-input__inner {
|
||||
text-align: start;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ module.exports = {
|
|||
// target: `http://192.168.2.82:28080`,//旭/
|
||||
// target: `http://192.168.2.248:28080`, //帅
|
||||
// target: `http://192.168.2.218:28080`, //福
|
||||
// target: `http://192.168.2.125:39080`, //王
|
||||
// target: `http://192.168.2.118:28080`, //王
|
||||
|
||||
//******** 注意事项 ********* */
|
||||
//1.全局替换qrUrl二维码扫码提供的网址-发布服务器的地址target;
|
||||
|
|
|
|||
Loading…
Reference in New Issue