代码优化

This commit is contained in:
BianLzhaoMin 2024-09-09 14:44:36 +08:00
parent f97ccbc0bc
commit 4af2fdeefe
7 changed files with 273 additions and 132 deletions

View File

@ -8,12 +8,36 @@
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<div class="content"> <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-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>
<el-form-item label="单位名称" size="small" prop="materialReqUnitValue"> <el-form-item
<el-select v-model="formData.materialReqUnitValue" placeholder="请选择单位" size="small" clearable filterable @change="handleUnit"> label="单位名称"
size="small"
prop="materialReqUnitValue"
>
<el-select
v-model="formData.materialReqUnitValue"
placeholder="请选择单位"
size="small"
clearable
filterable
@change="handleUnit"
>
<el-option <el-option
v-for="item in formData.materialReqUnitList" v-for="item in formData.materialReqUnitList"
:key="item.unitId" :key="item.unitId"
@ -22,8 +46,19 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="工程名称" size="small" prop="materialReqProjectValue"> <el-form-item
<el-select v-model="formData.materialReqProjectValue" placeholder="请选择工程名称" size="small" clearable filterable @change="handleProject"> label="工程名称"
size="small"
prop="materialReqProjectValue"
>
<el-select
v-model="formData.materialReqProjectValue"
placeholder="请选择工程名称"
size="small"
clearable
filterable
@change="handleProject"
>
<el-option <el-option
v-for="item in formData.materialReqProjectList" v-for="item in formData.materialReqProjectList"
:key="item.projectId" :key="item.projectId"
@ -32,19 +67,40 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备类型" size="small" prop="materialReqTypeValue"> <el-form-item
<el-select v-model="formData.materialReqTypeValue" placeholder="请选择设备类型" size="small" clearable filterable @change="handleType"> label="设备类型"
<el-option v-for="item in formData.materialReqTypeList" 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" :key="item.typeId"
:label="item.typeName" :label="item.typeName"
:value="item.typeId"> :value="item.typeId"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="small" @click="handleSearch">查询</el-button> <el-button
<el-button icon="el-icon-refresh" size="small" @click="handleReset">重置</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-item>
</el-form> </el-form>
@ -58,7 +114,7 @@
:align="item.align" :align="item.align"
:type="item.type" :type="item.type"
show-overflow-tooltip show-overflow-tooltip
> >
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -69,7 +125,6 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</div> </div>
<!-- <span slot="footer" class="dialog-footer"> <!-- <span slot="footer" class="dialog-footer">
<el-button @click="open = false"> </el-button> <el-button @click="open = false"> </el-button>
@ -80,12 +135,17 @@
<script> <script>
import Pagination from '../Pagination/index.vue' import Pagination from '../Pagination/index.vue'
import { getTypeList, getDetails, getUnitList, getProjectList } from '../../api/dialog' import {
getTypeList,
getDetails,
getUnitList,
getProjectList,
} from '../../api/dialog'
export default { export default {
name: 'getMaterialsDialog', name: 'getMaterialsDialog',
components: { components: {
Pagination Pagination,
}, },
data() { data() {
return { return {
@ -105,68 +165,67 @@ export default {
label: '序号', label: '序号',
type: 'index', type: 'index',
width: 60, width: 60,
align: 'center' align: 'center',
}, },
{ {
label: '出库时间', label: '出库时间',
prop: 'materialTime', prop: 'materialTime',
align: 'center' align: 'center',
}, },
{ {
label: '设备类型', label: '设备类型',
prop: 'typeName', prop: 'typeName',
align: 'center' align: 'center',
}, },
{ {
label: '规格型号', label: '规格型号',
prop: 'typeModelName', prop: 'typeModelName',
align: 'center' align: 'center',
}, },
{ {
label: '出库数量', label: '出库数量',
prop: 'num', prop: 'num',
align: 'center' align: 'center',
}, },
{ {
label: '设备负责人', label: '设备负责人',
prop: 'userName', prop: 'userName',
align: 'center' align: 'center',
}, },
{ {
label: '领料单号', label: '领料单号',
prop: 'materialCode', prop: 'materialCode',
align: 'center' align: 'center',
}, },
{ {
label: '领料申请单位', label: '领料申请单位',
prop: 'unitName', prop: 'unitName',
align: 'center' align: 'center',
}, },
{ {
label: '领料申请工程', label: '领料申请工程',
prop: 'projectName', prop: 'projectName',
align: 'center' align: 'center',
} },
], ],
total: 0, total: 0,
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10 pageSize: 10,
}, },
maType: 1 maType: 1,
}; }
}, },
created() { created() {
this.getUnit() this.getUnit()
this.getProject() this.getProject()
this.getType() this.getType()
}, },
methods: { methods: {
setOpen(params) { setOpen(params) {
this.open = params.open this.open = params.open
this.maType = params.maType this.maType = params.maType
console.log('🚀 ~ setOpen ~ this.maType:', this.maType); console.log('🚀 ~ setOpen ~ this.maType:', this.maType)
this.tableData = [] this.tableData = []
this.total = 0 this.total = 0
setTimeout(() => { setTimeout(() => {
@ -182,15 +241,15 @@ export default {
materialCode: this.formData.materialReqNo.trim(), materialCode: this.formData.materialReqNo.trim(),
unitId: this.formData.materialReqUnitValue, unitId: this.formData.materialReqUnitValue,
projectId: this.formData.materialReqProjectValue, 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.tableData = data.rows
this.total = data.total this.total = data.total
}) })
}, },
getUnit() { getUnit() {
getUnitList().then(res => { getUnitList().then((res) => {
this.formData.materialReqUnitList = res.data this.formData.materialReqUnitList = res.data
}) })
}, },
@ -198,7 +257,7 @@ export default {
this.formData.materialReqUnitValue = val this.formData.materialReqUnitValue = val
}, },
getProject() { getProject() {
getProjectList().then(res => { getProjectList().then((res) => {
this.formData.materialReqProjectList = res.data this.formData.materialReqProjectList = res.data
}) })
}, },
@ -206,7 +265,7 @@ export default {
this.formData.materialReqProjectValue = val this.formData.materialReqProjectValue = val
}, },
getType() { getType() {
getTypeList({ level: '3' }).then(res => { getTypeList({ level: '3' }).then((res) => {
this.formData.materialReqTypeList = res.data this.formData.materialReqTypeList = res.data
}) })
}, },
@ -220,13 +279,13 @@ export default {
handleReset() { handleReset() {
this.$refs.form.resetFields() this.$refs.form.resetFields()
this.getList() this.getList()
} },
} },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.content{ .content {
padding: 20px; padding: 20px;
} }
</style> </style>

View File

@ -825,7 +825,7 @@ export default {
submitApply() { submitApply() {
let costAll = 0 let costAll = 0
this.applyList.forEach((item) => { this.applyList.forEach((item) => {
costAll = costAll + item.cost costAll = costAll + item.cost * 1
}) })
console.log(costAll) console.log(costAll)
let param = { let param = {

View File

@ -272,7 +272,7 @@
> >
<span>供应商</span> <span>供应商</span>
<span v-if="printTableData.length > 0">{{ <span v-if="printTableData.length > 0">{{
printTableData[0].supplier supplierStr
}}</span> }}</span>
</div> </div>
</div> </div>
@ -468,6 +468,7 @@ export default {
}, },
], ],
}, },
supplierStr: '',
} }
}, },
created() { created() {
@ -581,6 +582,16 @@ export default {
getAccessoryAcceptanceForm({ taskId: taskId }).then((response) => { getAccessoryAcceptanceForm({ taskId: taskId }).then((response) => {
this.printData = response.data this.printData = response.data
this.printTableData = response.data.partDetailsList 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(',')
}) })
}, },
// //

View File

@ -171,7 +171,7 @@
<el-input v-model="form.typeId" disabled v-show="false" /> <el-input v-model="form.typeId" disabled v-show="false" />
<el-form-item label="编码前缀" prop="exCode"> <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>
<el-form-item label="后缀起始值" prop="suffixOneCode"> <el-form-item label="后缀起始值" prop="suffixOneCode">
@ -185,9 +185,7 @@
<el-form-item label="编码数量" prop="codeNum"> <el-form-item label="编码数量" prop="codeNum">
<el-input <el-input
v-model="form.codeNum" v-model="form.codeNum"
type="number"
style="width: 120px" style="width: 120px"
@change="onChangeCodeNum"
clearable clearable
/> />
</el-form-item> </el-form-item>
@ -388,6 +386,7 @@ export default {
// pageSize: 10, // pageSize: 10,
typeName: undefined, typeName: undefined,
}, },
codeInfo: null,
// //
form: { form: {
exCode: '', exCode: '',
@ -396,9 +395,9 @@ export default {
fixCode: '1', fixCode: '1',
typeId: '', typeId: '',
suffixOneCode: 0, suffixOneCode: '',
suffixTwoCode: 0, suffixTwoCode: 0,
codeNum: 0, codeNum: '',
}, },
codeList: [], //list codeList: [], //list
getCodeList: [], //list getCodeList: [], //list
@ -424,6 +423,17 @@ export default {
trigger: 'blur', trigger: 'blur',
}, },
], ],
codeNum: [
{
required: true,
message: '请输入编码数量',
trigger: 'blur',
},
{
pattern: /^[1-9][0-9]*$/,
message: '请输入大于0且不能以0开头的正整数',
},
],
suffixOneCode: [ suffixOneCode: [
{ {
required: true, required: true,
@ -489,8 +499,12 @@ export default {
}, },
// //
cancel() { cancel() {
this.reset() // this.reset()
this.resetForm('formCodeRef')
this.open = false this.open = false
// this.form.suffixOneCode = ''
// this.form.codeNum = ''
}, },
// //
reset() { reset() {
@ -526,36 +540,37 @@ export default {
}, //getCodeList newCodeList }, //getCodeList newCodeList
/** 编码按钮操作 */ handleCode(row) { /** 编码按钮操作 */ handleCode(row) {
console.log(row) console.log(row)
this.reset() // this.reset()
this.form = row // this.form = row
this.codeInfo = row
if (!this.form.fixCode) { if (!this.form.fixCode) {
this.form.fixCode = '1' this.form.fixCode = '1'
} }
this.$set(this.form, 'str', '') // this.$set(this.form, 'str', '')
this.$set(this.form, 'str1', '') // this.$set(this.form, 'str1', '')
// this.$set(this.form,'fixCode','1') // this.$set(this.form,'fixCode','1')
let arr = this.form.arrivalTime.split('-') let arr = row.arrivalTime.split('-')
// this.form.exCode = ; // this.form.exCode = ;
// this.form.typeCode=111 // this.form.typeCode=111
if (!this.form.typeCode) { // if (!this.form.typeCode) {
this.form.typeCode = '' // this.form.typeCode = ''
} // }
if (!this.form.specsCode) { // if (!this.form.specsCode) {
this.form.specsCode = '' // this.form.specsCode = ''
} // }
this.$set( // this.$set(
this.form, // this.form,
'exCode', // 'exCode',
'NSJJ' + // 'NSJJ' +
this.form.typeCode + // this.form.typeCode +
this.form.specsCode + // this.form.specsCode +
arr[0][2] + // arr[0][2] +
arr[0][3] + // arr[0][3] +
arr[1], // 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.codeList = []
this.open = true this.open = true
this.title = '生成编码' this.title = '生成编码'
@ -570,7 +585,7 @@ export default {
// }); // });
this.surplusNoBindNum = this.surplusNoBindNum =
parseInt(this.form.checkNum) - parseInt(this.form.bindNum) parseInt(row.checkNum) - parseInt(row.bindNum)
}, },
//codeList //codeList
createCodeList() { createCodeList() {
@ -608,9 +623,15 @@ export default {
}, },
// //
fillingCodeList() { fillingCodeList() {
this.codeList = [] this.$message.closeAll()
this.$refs['formCodeRef'].validate((valid) => { this.$refs['formCodeRef'].validate((valid) => {
if (valid) { if (valid) {
if (this.form.codeNum * 1 > this.surplusNoBindNum) {
this.$message.error('编码数量不能大于待编码数量')
this.form.codeNum = this.surplusNoBindNum
return
}
this.codeList = []
let codeNum = 0 let codeNum = 0
if ( if (
!this.form.codeNum || !this.form.codeNum ||
@ -622,10 +643,10 @@ export default {
} }
for (let i = 0; i < codeNum; i++) { for (let i = 0; i < codeNum; i++) {
let obj = { let obj = {
typeName: this.form.typeName, typeName: this.codeInfo.typeName,
specificationType: this.form.specificationType, specificationType: this.codeInfo.specificationType,
typeId: this.form.typeId, typeId: this.codeInfo.typeId,
taskId: this.form.taskId, taskId: this.codeInfo.taskId,
maCode: this.form.suffixOneCode * 1 + i, maCode: this.form.suffixOneCode * 1 + i,
assetsCode: '', assetsCode: '',
fixCode: this.form.fixCode, fixCode: this.form.fixCode,
@ -895,9 +916,9 @@ export default {
open: { open: {
handler(newValue) { handler(newValue) {
if (!newValue) { if (!newValue) {
this.form.suffixOneCode = 0 this.form.suffixOneCode = ''
// this.form.suffixTwoCode = '' // this.form.suffixTwoCode = ''
this.form.codeNum = 0 this.form.codeNum = ''
this.form.fixCode = '1' this.form.fixCode = '1'
} }
}, },

View File

@ -659,14 +659,13 @@ export default {
this.printTableData = response.data.checkDetailsList this.printTableData = response.data.checkDetailsList
let supplierList = [] let supplierList = []
this.printTableData.map((e) => { this.printTableData.forEach((e) => {
if (e.supplier) { if (e.supplier) {
supplierList.push(e.supplier) supplierList.push(e.supplier)
} }
}) })
supplierList = [...new Set(supplierList)]
const supplierListNew = [...new Set(supplierList)] this.supplierStr = supplierList.join(',')
this.supplierListNew = supplierListNew.join('')
}) })
}, },
// //

View File

@ -54,7 +54,6 @@
</el-form> </el-form>
<el-table <el-table
v-loading="loading"
:data="returnList" :data="returnList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
border border
@ -249,7 +248,7 @@
<el-col :span="10"> <el-col :span="10">
<el-form-item <el-form-item
label="后缀范围" label="后缀起始值"
label-width="130px" label-width="130px"
prop="codeSuffixStart" prop="codeSuffixStart"
v-if="!isNumCheck" v-if="!isNumCheck"
@ -257,15 +256,12 @@
<el-input <el-input
v-model="codeForm.codeSuffixStart" v-model="codeForm.codeSuffixStart"
clearable clearable
placeholder="请输入后缀范围起始值" placeholder="请输入后缀起始值"
maxlength="10" maxlength="99999999"
style="width: 185px" style="width: 400px"
@change="
changeSuffixStart(codeForm.codeSuffixStart)
"
/> />
</el-form-item> </el-form-item>
<el-form-item <!-- <el-form-item
label="~" label="~"
label-width="auto" label-width="auto"
prop="codeSuffixEnd" prop="codeSuffixEnd"
@ -279,7 +275,7 @@
style="width: 185px" style="width: 185px"
@change="changeSuffixEnd" @change="changeSuffixEnd"
/> />
</el-form-item> </el-form-item> -->
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
<el-form-item <el-form-item
@ -360,10 +356,17 @@
if (codeForm.thisCheckTime) { if (codeForm.thisCheckTime) {
let today = new Date() let today = new Date()
today.setHours(0, 0, 0, 0) 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 return false
} },
}" }"
/> />
</el-form-item> </el-form-item>
@ -478,7 +481,7 @@
type="textarea" type="textarea"
placeholder="请输入备注" placeholder="请输入备注"
maxlength="100" maxlength="100"
rows="4" rows="1"
show-word-limit show-word-limit
style="width: 400px" style="width: 400px"
/> />
@ -533,10 +536,10 @@
</el-col> </el-col>
</el-row> --> </el-row> -->
<el-table <el-table
v-loading="loading"
:data="codeTableList" :data="codeTableList"
v-if="!isNumCheck" v-if="!isNumCheck"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
height="400"
:stripe="true" :stripe="true"
> >
<!-- <el-table-column type="selection" width="55" align="center" /> --> <!-- <el-table-column type="selection" width="55" align="center" /> -->
@ -552,7 +555,7 @@
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
> >
<template v-slot:header> <template v-slot:header>
<span style="color: red;">* </span>设备编码 <span style="color: red">* </span>设备编码
</template> </template>
<template v-slot:default="{ row }" v-if="!isNumCheck"> <template v-slot:default="{ row }" v-if="!isNumCheck">
<el-input <el-input
@ -633,10 +636,16 @@
if (row.thisCheckTime) { if (row.thisCheckTime) {
let today = new Date() let today = new Date()
today.setHours(0, 0, 0, 0) 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 return false
} },
}" }"
></el-date-picker> ></el-date-picker>
</template> </template>
@ -930,7 +939,7 @@ export default {
remarks: undefined, remarks: undefined,
typeId: undefined, typeId: undefined,
num: undefined, num: undefined,
codePrefix: undefined, codePrefix: 'PD-CODE',
codeSuffixStart: undefined, codeSuffixStart: undefined,
codeSuffixEnd: undefined, codeSuffixEnd: undefined,
buyPrice: undefined, buyPrice: undefined,
@ -960,6 +969,20 @@ export default {
], ],
}, },
codeFormRules: { codeFormRules: {
codePrefix: [
{ required: true, message: '请输入前缀', trigger: 'blur' },
],
codeSuffixStart: [
{
required: true,
message: '请输入后缀起始值',
trigger: 'blur',
},
{
pattern: /^[1-9][0-9]*$/,
message: '请输入大于0且不能以0开头的正整数',
},
],
putInType: [ putInType: [
{ {
required: true, required: true,
@ -1054,7 +1077,7 @@ export default {
remarks: undefined, remarks: undefined,
typeId: null, typeId: null,
num: undefined, num: undefined,
codePrefix: undefined, codePrefix: 'PD-CODE',
codeSuffixStart: undefined, codeSuffixStart: undefined,
codeSuffixEnd: undefined, codeSuffixEnd: undefined,
buyPrice: undefined, buyPrice: undefined,
@ -1096,23 +1119,23 @@ export default {
this.numTableList.push(this.numTable) this.numTableList.push(this.numTable)
} else { } else {
// this.codeForm.num, this.codeTableListthis.codeForm // this.codeForm.num, this.codeTableListthis.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 // let suffix = parseInt(this.codeForm.codeSuffixStart) + i
if (suffix > parseInt(this.codeForm.codeSuffixEnd)) { // if (suffix > parseInt(this.codeForm.codeSuffixEnd)) {
suffix = parseInt(this.codeForm.codeSuffixEnd) // suffix = parseInt(this.codeForm.codeSuffixEnd)
} // }
suffix = suffix // suffix = suffix
.toString() // .toString()
.padStart( // .padStart(
this.codeForm.codeSuffixStart?.length, // this.codeForm.codeSuffixStart?.length,
'0', // '0',
) // )
// console.log('🚀 ~ fillCodeForm ~ suffix:', suffix); // // console.log('🚀 ~ fillCodeForm ~ suffix:', suffix);
suffix = isNaN(suffix) ? '' : suffix // suffix = isNaN(suffix) ? '' : suffix
const maCode = `${ // const maCode = `${
this.codeForm.codePrefix || '' // this.codeForm.codePrefix || ''
}${suffix}` // }${suffix}`
// //
const outFacCode = '' const outFacCode = ''
// //
@ -1129,7 +1152,7 @@ export default {
// : codeForm.buyPrice // : codeForm.buyPrice
const buyPrice = this.codeForm.buyPrice || 0 const buyPrice = this.codeForm.buyPrice || 0
this.codeTableList.push({ this.codeTableList.push({
maCode, maCode: this.codeForm.codeSuffixStart * 1 + i,
outFacCode, outFacCode,
maVender, maVender,
thisCheckTime, thisCheckTime,
@ -1137,6 +1160,21 @@ export default {
buyPrice, 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 =
this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') 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.$message.error('后缀范围请输入整数类型')
this.codeForm.codeSuffixStart = '' this.codeForm.codeSuffixStart = ''
} }
@ -1156,7 +1197,10 @@ export default {
if (!this.codeForm.codeSuffixStart) { if (!this.codeForm.codeSuffixStart) {
this.$message.error('请输入后缀范围起始值') this.$message.error('请输入后缀范围起始值')
this.codeForm.codeSuffixEnd = '' 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.$message.error('后缀范围请输入整数类型')
this.codeForm.codeSuffixEnd = this.codeForm.codeSuffixEnd =
this.codeForm.codeSuffixStart.replace(/[^\d]/g, '') this.codeForm.codeSuffixStart.replace(/[^\d]/g, '')
@ -1415,24 +1459,28 @@ export default {
} }
const res = await getDeviceTypeTree(params) const res = await getDeviceTypeTree(params)
if (type) { if (type) {
this.disableNodes(res.data, '1'); this.disableNodes(res.data, '1')
} else { } else {
this.disableNodes(res.data, '0'); this.disableNodes(res.data, '0')
} }
this.deviceTypeTree = res.data this.deviceTypeTree = res.data
}, },
// //
disableNodes(nodes, manageType, level = 1) { disableNodes(nodes, manageType, level = 1) {
nodes.forEach(node => { nodes.forEach((node) => {
node.level = level node.level = level
if (node.children) { if (node.children) {
this.disableNodes(node.children, manageType, level + 1); this.disableNodes(node.children, manageType, level + 1)
} else if (!node.children && node.level < 4) { } else if (!node.children && node.level < 4) {
node.disabled = true 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 node.disabled = true
} }
}); })
}, },
/////// ///////
deviceTypeChange(val) { deviceTypeChange(val) {
@ -1571,7 +1619,10 @@ export default {
}, },
// //
changeCheckTime() { 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.codeForm.nextCheckTime = ''
this.$message.warning('下次检验日期不能早于检验日期!') this.$message.warning('下次检验日期不能早于检验日期!')
} else if (!this.codeForm.thisCheckTime) { } else if (!this.codeForm.thisCheckTime) {

View File

@ -48,7 +48,7 @@ module.exports = {
// target: `http://192.168.2.82:28080`,//旭/ // target: `http://192.168.2.82:28080`,//旭/
// target: `http://192.168.2.248:28080`, //帅 // target: `http://192.168.2.248:28080`, //帅
// target: `http://192.168.2.218: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; //1.全局替换qrUrl二维码扫码提供的网址-发布服务器的地址target;