src/components/do/a6-device/calibration.vue
@@ -1,13 +1,300 @@ <template> <div>设备校准</div> <div> <div class="search"> <div class="search_thing"> <el-button size="small" type="primary" @click="dialogVisible0=true">校准项目维护</el-button> </div> <div class="btns"> <el-button size="small" type="primary">添加校准记录</el-button> <el-button size="small" type="primary">导出</el-button> </div> </div> <div class="tables" style="margin-top: 16px;"> <ValueTable ref="ValueTable" :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex"/> </div> <el-dialog title="校准项目维护" :visible.sync="dialogVisible0" width="60%" style="max-height: 80vh;margin-top: 10vh;" :close-on-click-modal="false" :close-on-press-escape="false"> <h4> <div style="display: flex; align-items: center;"><span class="line"></span><span>设备校准参数维护</span></div> <el-button type="primary" size="small" @click="addCalibrate">添 加</el-button> </h4> <div class="search"> <div class="search_thing"> <div class="search_label">计量参数:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="form0.value"></el-input></div> </div> <div class="search_thing"> <div class="search_label">量程范围:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="form0.value"></el-input></div> </div> <div class="search_thing"> <div class="search_label" style="width: 100px;">最大允许误差:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="form0.value"></el-input></div> </div> <div class="search_thing"> <div class="search_label">判定标准:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="form0.value"></el-input></div> </div> </div> <h4> <div style="display: flex; align-items: center;"><span class="line"></span><span>设备校准参数</span></div> </h4> <ValueTable ref="ValueTable0" :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData0" :key="upIndex0"/> <span slot="footer" class="dialog-footer"> <el-button @click="dialogVisible0 = false">取 消</el-button> <el-button type="primary" @click="dialogVisible0 = false">确 定</el-button> </span> </el-dialog> </div> </template> <script> import ValueTable from '../../tool/value-table.vue' export default { components: { ValueTable }, data(){ return { componentData: { entity: { week: null, weekDay: null, dateTime: null, name:null, orderBy: { field: 'id', order: 'desc' } }, isIndex: true, showSelect: false, select: false, do: [{ id: 'handleLook', font: '查看详情', type: 'text', method: 'handleLook' }], tagField: { shift:{ select:[] }, state:{ select:[ { label:'已提交', value:'已提交', type:'primary' }, { label:'已审核', value:'已审核', type:'warning' }, { label:'已批准', value:'已批准', type:'success' }, ] }, weekDay:{ select:[] } }, linkEvent: {}, selectField: { shift:{ select:[] }, state:{ select:[ { label:'已提交', value:'已提交', type:'primary' }, { label:'已审核', value:'已审核', type:'warning' }, { label:'已批准', value:'已批准', type:'success' }, ] }, weekDay:{ select:[] } }, requiredAdd: [], requiredUp: [] }, upIndex:0, componentData0: { entity: { week: null, weekDay: null, dateTime: null, name:null, orderBy: { field: 'id', order: 'desc' } }, isIndex: true, showSelect: false, select: false, isPage:false, do: [{ id: 'delete', font: '删除', type: 'text', method: 'doDiy', }], tagField: { shift:{ select:[] }, state:{ select:[ { label:'已提交', value:'已提交', type:'primary' }, { label:'已审核', value:'已审核', type:'warning' }, { label:'已批准', value:'已批准', type:'success' }, ] }, weekDay:{ select:[] } }, linkEvent: {}, selectField: { shift:{ select:[] }, state:{ select:[ { label:'已提交', value:'已提交', type:'primary' }, { label:'已审核', value:'已审核', type:'warning' }, { label:'已批准', value:'已批准', type:'success' }, ] }, weekDay:{ select:[] } }, requiredAdd: [], requiredUp: [] }, upIndex0:0, dialogVisible0:false, form0:{ value:'' } } }, methods:{ addCalibrate(){ if(!this.form0.value){ this.$message.error('请输入计量参数') return } // 保存 // 更新列表 } } } </script> <style scoped> .tables{ width: calc(100vw - 390px); height: calc(100vh - 230px); } .search { background-color: #fff; height: 40px; display: flex; align-items: center; position: relative; } .search_thing { display: flex; align-items: center; height: 40px; } .search_label { width: 70px; font-size: 14px; text-align: right; } .search_input { width: calc(100% - 110px); } .btns{ position: absolute; right: 40px; top: 50%; transform: translate(0,-50%); } h4{ font-weight: 400; font-size: 16px; display: flex; justify-content: space-between; margin: 10px 0; } h4 .line{ display: inline-block; width: 3px; height: 16px; background: #3A7BFA; margin-right: 4px; } </style> src/components/do/a6-device/check-and-accept.vue
@@ -1,13 +1,168 @@ <template> <div>设备验收</div> <div> <div class="search"> <div class="search_thing"> <div class="search_label">关键字:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="value" @keyup.enter.native="refreshTable()"></el-input></div> </div> <div class="search_thing" style="padding-left: 30px;"> <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button> </div> <div class="btns"> <el-button size="small" type="primary">新建</el-button> <el-button size="small" type="primary">导出</el-button> </div> </div> <div class="tables" style="margin-top: 16px;"> <ValueTable ref="ValueTable" :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex"/> </div> </div> </template> <script> import ValueTable from '../../tool/value-table.vue' export default { components: { ValueTable }, data(){ return { value:'', componentData: { entity: { week: null, weekDay: null, dateTime: null, name:null, orderBy: { field: 'id', order: 'desc' } }, isIndex: true, showSelect: false, select: false, do: [{ id: 'getFile', font: '附件', type: 'text', method: 'getFile' }, { id: 'handleLook', font: '查看', type: 'text', method: 'handleLook' },{ id: 'delete', font: '删除', type: 'text', method: 'doDiy', disabFun: (row, index) => { return row.state === '已审核' || row.state === '已批准' } }], tagField: { shift:{ select:[] }, state:{ select:[ { label:'已提交', value:'已提交', type:'primary' }, { label:'已审核', value:'已审核', type:'warning' }, { label:'已批准', value:'已批准', type:'success' }, ] }, weekDay:{ select:[] } }, linkEvent: {}, selectField: { shift:{ select:[] }, state:{ select:[ { label:'已提交', value:'已提交', type:'primary' }, { label:'已审核', value:'已审核', type:'warning' }, { label:'已批准', value:'已批准', type:'success' }, ] }, weekDay:{ select:[] } }, requiredAdd: [], requiredUp: [] }, upIndex:0, } }, methods:{ refreshTable(){} } } </script> <style scoped> .tables{ width: calc(100vw - 390px); height: calc(100vh - 230px); } .search { background-color: #fff; height: 40px; display: flex; align-items: center; position: relative; } .search_thing { display: flex; align-items: center; height: 40px; } .search_label { width: 70px; font-size: 14px; text-align: right; } .search_input { width: calc(100% - 120px); } .btns{ position: absolute; right: 40px; top: 50%; transform: translate(0,-50%); } </style> src/components/do/a6-device/files.vue
@@ -3,8 +3,20 @@ <div class="page-header"> <h4><span class="line"></span><span>设备档案</span></h4> <div class="btns"> <el-button type="primary" size="small">修订档案</el-button> <el-button type="primary" size="small">添加附件</el-button> <el-button type="primary" size="small" @click="dialogVisible=true" style="margin-right: 16px;">修订档案</el-button> <!-- <el-button type="primary" size="small">添加附件</el-button> --> <el-upload class="upload-demo" :action="action" :headers="headers" :show-file-list="false" :limit="1" :before-upload="beforeUpload" :on-success="handleSuccess" ref="upload" :on-error="onError"> <el-button size="small" type="primary" :loading="inLoading">添加附件</el-button> </el-upload> </div> </div> <el-divider></el-divider> @@ -136,6 +148,152 @@ :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex" style="min-height: 400px;"/> </div> <el-dialog title="档案修订" :visible.sync="dialogVisible" width="70%" :before-close="handleClose"> <el-row style="display:flex;justify-content: space-around;"> <!-- 左边布局 --> <el-col :span="7"> <el-col> <!-- 图片 --> <el-image class="img" style="width:100%;height: 320px;marginBottom:16px" :src="javaApi+'/img/'+formData.imageUpload"> <div slot="error" class="image-error" style="width: calc(100% -2px); height: 318px; border-radius: 16px; display: flex; align-items: center; justify-content: center; border: 1px solid #EEEEEE;"> <i class="el-icon-picture-outline" style="font-size:60px;color:#666666;"></i> </div> </el-image> <!-- 表单 --> <el-form :model="formData" label-width="120px"> <el-form-item label="仪器名称:" required> <el-input v-model="formData.deviceName" size="small"></el-input> </el-form-item> <el-form-item label="仪器名称EN:" required> <el-input v-model="formData.enDeviceName" size="small"></el-input> </el-form-item> <el-form-item label="规格型号:" required> <el-input v-model="formData.specificationModel" size="small"></el-input> </el-form-item> <el-form-item label="生产厂家:"> <el-input v-model="formData.manufacturer" size="small"></el-input> </el-form-item> </el-form> </el-col> </el-col> <!-- 中间布局 --> <el-col :span="7"> <el-form :model="formData" label-width="116px"> <el-form-item label="校准服务机构:"> <el-input v-model="formData.calibrationServices" size="small"></el-input> </el-form-item> <el-form-item label="出厂编号:"> <el-input v-model="formData.factoryNo" size="small"></el-input> </el-form-item> <el-form-item label="管理编号:" required> <el-input v-model="formData.managementNumber" size="small"></el-input> </el-form-item> <el-form-item label="购置日期:"> <el-date-picker style="width:100%" v-model="formData.acquisitionDate" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期"> </el-date-picker> </el-form-item> <el-form-item label="启用日期:" required> <el-date-picker style="width:100%" v-model="formData.activationDate" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期"> </el-date-picker> </el-form-item> <el-form-item label="管理人:"> <el-select v-model="formData.equipmentManager" placeholder="请选择" size="small" style="width:100%"> <el-option v-for="item in responsiblePersonList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> </el-form-item> <el-form-item label="存放点:"> <el-input v-model="formData.storagePoint" size="small"></el-input> </el-form-item> <el-form-item label="技术指标:"> <el-input v-model="formData.technicalIndicators" :rows="7" type="textarea" size="small"></el-input> </el-form-item> </el-form> </el-col> <!-- 右边布局 --> <el-col :span="7"> <el-form :model="formData" label-width="140px" ref="ruleForm"> <!-- 实验室列表 --> <el-form-item label="所属部门:"> <el-select v-model="formData.subordinateDepartmentsId" placeholder="请选择" size="small" style="width:100%"> <el-option v-for="item in subordinateDepartmentsList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> </el-form-item> <el-form-item label="检测项目:"> <el-cascader v-model="formData.insProductIds" :options="options" :show-all-levels="false" :props="props" placeholder="请选择" size="small" style="width:100%;" :collapse-tags="true" separator="," filterable clearable></el-cascader> </el-form-item> <el-form-item label="最近校准日期:"> <el-date-picker style="width:100%" v-model="formData.latestTraceability" format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="date" size="small" placeholder="选择日期"> </el-date-picker> </el-form-item> <el-form-item label="下次校准日期:"> <el-date-picker style="width:100%" v-model="formData.latestTraceability" format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="date" size="small" placeholder="选择日期"> </el-date-picker> </el-form-item> <el-form-item label="设备类型:"> <el-select v-model="formData.largeCategory" placeholder="请选择" size="small" style="width:100%"> <el-option v-for="item in equipmentList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> </el-form-item> <el-form-item label="单价(万元):"> <el-input v-model="formData.unitPrice" size="small"></el-input> </el-form-item> <el-form-item label="当前状态:" required> <el-select v-model="formData.deviceStatus" placeholder="请选择" size="small" style="width:100%"> <el-option v-for="item in deviceStatusList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> </el-form-item> <el-form-item label="校准周期(月):" required> <el-input v-model="formData.calibrationDate" size="small"></el-input> </el-form-item> <el-form-item label="图片:"> <div style="border: 1px solid #DCDFE6;border-radius:4px;height:32px;lineHeight:32px;display:flex;justify-content: space-around;font-size: 13px;"> <div v-show="formData.imageName" class="picName">{{formData.imageName}}</div> <el-upload :action="action" :on-success="handleSuccessUpImg2" :show-file-list="false" accept='image/jpg,image/jpeg,image/png' :headers="headers" :on-change="beforeUpload" :on-error="onError" ref='upload'> <el-button type="text" style="height:30px;padding-top:8px">上传</el-button> </el-upload> </div> </el-form-item> </el-form> </el-col> </el-row> <span slot="footer" class="dialog-footer"> <el-row> <el-button @click="handleClose">取 消</el-button> <el-button type="primary" @click="submitForm" :loading="upLoad">确 定</el-button> </el-row> </span> </el-dialog> </div> </template> @@ -240,10 +398,36 @@ requiredUp: [] }, upIndex:0, dialogVisible:false, inLoading:false, form: { value1:'' } }, upLoad:false, formData:{}, responsiblePersonList:[], subordinateDepartmentsList:[], options:[], equipmentList:[], deviceStatusList:[], props: { multiple: true,emitPath:false,value:'id',label:'name' }, } }, computed: { headers() { return { 'token': sessionStorage.getItem('token') } }, action() { return this.javaApi + this.$api.deviceScope.uploadFile } }, mounted(){ this.selectDevicePrincipal() this.obtainItemParameterList() this.getInsProductIds() this.selectEnumByCategory() }, methods: { handleData(m){ @@ -252,7 +436,161 @@ }else{ return '-' } } }, handleClose(){ this.dialogVisible = false }, handleSuccess(response,){ this.inLoading = false; if (response.code == 200) { this.$message.success('上传成功') // 更新页面 }else{ this.$message.error(response.message) } }, submitForm(){ if(!this.formData.deviceName){ this.$message.error('未输入仪器名称') return } if(!this.formData.enDeviceName){ this.$message.error('未输入仪器名称EN') return } if(!this.formData.specificationModel){ this.$message.error('未输入规格型号') return } if(!this.formData.managementNumber){ this.$message.error('未输入管理编号') return } if(!this.formData.activationDate){ this.$message.error('未输入启用日期') return } if(this.formData.deviceStatus==='' || this.formData.deviceStatus===null){ this.$message.error('未选择当前状态') return } if(!this.formData.calibrationDate){ this.$message.error('未输入校准周期(月)') return } delete this.formData.createTime delete this.formData.updateTime delete this.formData.createUser delete this.formData.updateUser this.formData.insProductIds = this.formData.insProductIds?this.formData.insProductIds.join():'' this.upLoad = true; this.$axios.post(this.$api.deviceScope.upDeviceParameter, this.formData, { headers: { 'Content-Type': 'application/json' } }).then(res => { if (res.code === 201) { this.upLoad = false return } this.$message.success('修改成功') this.upLoad = false this.dialogVisible = false }).catch(e => { this.$message.error('修改失败') this.dialogVisible = false this.upLoad = false }) }, handleSuccessUpImg2(response) { if (response.code == 200) { this.$nextTick(() => { this.formData.imageUpload = response.data.url; this.formData.imageName = response.data.name; }) } }, beforeUpload(file) { if (file.size > 1024 * 1024 * 10) { this.$message.error('上传文件不超过10M'); this.$refs.upload.clearFiles() return false; } else { return true; } }, onError(err, file, fileList) { this.$message.error('上传失败') this.$refs.upload.clearFiles() }, // 获取负责人列表 selectDevicePrincipal() { this.$axios.get(this.$api.deviceScope.selectDevicePrincipal).then(res => { let data = [] res.data.forEach(a => { data.push({ label: a.name, value: a.id }) }) this.responsiblePersonList = data }) }, obtainItemParameterList() { this.$axios.get(this.$api.laboratoryScope.obtainItemParameterList).then(res => { let data = [] res.data.forEach(a=>{ data.push({ label: a.laboratoryName, value: a.id }) }) this.subordinateDepartmentsList = data }) }, getInsProductIds(){ this.$axios.post(this.$api.capacityScope.getInsProduction).then(res => { this.options = res.data.map((m,i)=>{ m.id = m.name; return m }) this.options.forEach(item=>{ if(item.children.length==0){ item.children = null; }else{ item.children.forEach(m=>{ if(m.children.length==0){ m.children = null; }else{ m.children.forEach(n=>{ if(n.children&&n.children.length==0){ n.children = null; } }) } }) } }) }) }, // 获取字典 selectEnumByCategory() { this.$axios.post(this.$api.enums.selectEnumByCategory, { category: "设备状态" }).then(res => { this.deviceStatusList = res.data this.deviceStatusList.forEach(a=>{ if(!isNaN(a.value)){ a.value = parseInt(a.value) } }) }) this.$axios.post(this.$api.enums.selectEnumByCategory, { category: "设备分类" }).then(res => { this.equipmentList = res.data }) }, } } </script> @@ -304,4 +642,8 @@ margin-right: 20px; color: #999; } .btns { display: flex; align-items: center; } </style> src/components/do/a6-device/maintenance.vue
@@ -1,13 +1,238 @@ <template> <div>设备维护</div> <div> <div class="search"> <div class="search_thing"> <div class="search_label">关键字:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="value" @keyup.enter.native="refreshTable()"></el-input></div> </div> <div class="search_thing" style="padding-left: 30px;"> <el-button size="small" type="primary" @click="refreshTable()">查 询</el-button> </div> <div class="btns"> <el-button size="small" type="primary" @click="dialogVisible=true">新建</el-button> <el-button size="small" type="primary">导出</el-button> </div> </div> <div class="tables" style="margin-top: 16px;"> <ValueTable ref="ValueTable" :url="$api.auxiliaryWorkingHoursDay.selectAuxiliaryWorkingHoursDay" :delUrl="$api.auxiliaryWorkingHoursDay.deleteAuxiliaryWorkingHoursDay" :componentData="componentData" :key="upIndex"/> </div> <el-dialog title="仪器设备维护记录表" :visible.sync="dialogVisible" width="30%" style="max-height: 80vh;margin-top: 10vh;" :close-on-click-modal="false" :close-on-press-escape="false"> <div class="form"> <div class="search_thing"> <div class="search_label">设备编号:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="value"></el-input></div> </div> <div class="search_thing"> <div class="search_label">设备名称:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="value"></el-input></div> </div> <div class="search_thing"> <div class="search_label">统一编号:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="value"></el-input></div> </div> <div class="search_thing" style="margin: 10px 0;"> <div class="search_label">维护内容:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="value" type="textarea" :rows="2"></el-input></div> </div> <div class="search_thing"> <div class="search_label">维护时间:</div> <div class="search_input"> <el-date-picker style="width:100%" v-model="value" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期"> </el-date-picker> </div> </div> <div class="search_thing"> <div class="search_label">维护类型:</div> <div class="search_input"> <el-radio-group v-model="value"> <el-radio :label="0">使用前后维护</el-radio> <el-radio :label="1">计划中维护</el-radio> </el-radio-group> </div> </div> <div class="search_thing"> <div class="search_label">下次维护时间:</div> <div class="search_input"> <el-date-picker style="width:100%" v-model="value" type="date" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" size="small" placeholder="选择日期"> </el-date-picker> </div> </div> <div class="search_thing"> <div class="search_label">维护人:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="value"></el-input></div> </div> <div class="search_thing" style="margin: 10px 0;"> <div class="search_label">备注:</div> <div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="value" type="textarea" :rows="2"></el-input></div> </div> </div> <span slot="footer" class="dialog-footer"> <el-button @click="dialogVisible = false">取 消</el-button> <el-button type="primary" @click="dialogVisible = false">确 定</el-button> </span> </el-dialog> </div> </template> <script> import ValueTable from '../../tool/value-table.vue' export default { components: { ValueTable }, data(){ return { value:'', componentData: { entity: { week: null, weekDay: null, dateTime: null, name:null, orderBy: { field: 'id', order: 'desc' } }, isIndex: true, showSelect: false, select: false, do: [{ id: 'handleLook', font: '查看', type: 'text', method: 'handleLook' },{ id: 'delete', font: '删除', type: 'text', method: 'doDiy', disabFun: (row, index) => { return row.state === '已审核' || row.state === '已批准' } }], tagField: { shift:{ select:[] }, state:{ select:[ { label:'已提交', value:'已提交', type:'primary' }, { label:'已审核', value:'已审核', type:'warning' }, { label:'已批准', value:'已批准', type:'success' }, ] }, weekDay:{ select:[] } }, linkEvent: {}, selectField: { shift:{ select:[] }, state:{ select:[ { label:'已提交', value:'已提交', type:'primary' }, { label:'已审核', value:'已审核', type:'warning' }, { label:'已批准', value:'已批准', type:'success' }, ] }, weekDay:{ select:[] } }, requiredAdd: [], requiredUp: [] }, upIndex:0, dialogVisible:true } }, methods:{ refreshTable(){} } } </script> <style scoped> .tables{ width: calc(100vw - 390px); height: calc(100vh - 230px); } .search { background-color: #fff; height: 40px; display: flex; align-items: center; position: relative; } .search_thing { display: flex; align-items: center; height: 40px; } .search_label { width: 70px; font-size: 14px; text-align: right; } .search_input { width: calc(100% - 120px); } .btns{ position: absolute; right: 40px; top: 50%; transform: translate(0,-50%); } .form .search_label{ width: 120px; } </style> src/components/do/b1-ins-order/add.vue
@@ -620,7 +620,8 @@ </el-row> </span> </el-dialog> <fiberOpticConfig :currentId="currentId" @saveFiberopticConfig="getTotal()" v-if="configShow" :active="active" /> <fiberOpticConfig :currentId="currentId" @saveFiberopticConfig="getTotal()" v-if="configShow && examine==0" :active="active" :inspectionItemST='inspectionItemST' /> <fiberOpticConfigTwo :currentId="currentId" v-if="configShow && examine==1" :active="active" /> <equipConfig :currentId="currentId" v-if="equipConfigShow" :active="active" /> <cableConfig v-if="cableConfigShow" :active="active" /> <!-- 单选特殊值处理框--> @@ -881,6 +882,15 @@ <el-button type="primary" @click="spliceData">保存</el-button> </span> </el-dialog> <el-dialog title="单根垂直燃烧检测次数填写" :visible.sync="singleVerticalCombustionShow" width="900px" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="beforeCirculateShowClose" :show-close="false"> <div>111</div> <span slot="footer" class="dialog-footer"> <el-button @click="cleanSpliceData">取消</el-button> <el-button type="primary" @click="spliceData">保存</el-button> </span> </el-dialog> <!-- 电力试验室---温升试验/热循环 --> <el-dialog :title="temperatureTitle" :visible.sync="temperatureShow" :close-on-click-modal="false" :close-on-press-escape="false" @@ -936,6 +946,7 @@ }, data() { return { inspectionItemST: null, sampleSelectionList: [],//样品表格选中数据 editTable:[], template: null, @@ -1085,6 +1096,7 @@ entrustNum: '', entrustPoint: '' }, singleVerticalCombustionShow: false, isBsm2Val2:false, opticalProject: [], // 温度循环弹框光纤项目列表 opticalProjectList: [], // 温度循环弹框光纤项目选中的数组 @@ -1128,6 +1140,25 @@ }) this.filters = arr } } }, productListSelected: { deep: true, handler(val) { if(val.length>0){ for(let i =0 ; i< val.length; i++){ if(val[i].inspectionItem.includes('松套管')){ this.inspectionItemST = 1 break; }else{ this.inspectionItemST = 0 } } }else{ this.inspectionItemST = 0 } console.log('0000',this.inspectionItemST); } }, sampleList: { @@ -1600,19 +1631,21 @@ } // console.log('isHaveBushing===', this.totalArr) let spcialItem = this.totalArr.find(a => a.state == 1 && a.inspectionItem.includes('松套管')) if (productListSelected && select[2] === '光缆' && isHaveBushing === false) { let spcialItem = this.totalArr.filter(a => a.state == 1 && a.inspectionItem.includes('松套管')) if (productListSelected && select[2] === '光缆' && isHaveBushing === false&&spcialItem.length==0) { this.$message.error('光缆温度循环项目必须进行光纤配置') this.$refs.sampleTable.setCurrentRow(this.currentMethod, true) this.rowClick(this.currentMethod) this.sampleIds = [this.currentMethod.id] this.openConfig() return }else if(spcialItem&& isHaveBushing === false){ }else if(spcialItem.length>0&& isHaveBushing === false){ this.$message.error('松套管项目必须进行光纤配置') this.$refs.sampleTable.setCurrentRow(this.currentMethod, true) this.rowClick(this.currentMethod) this.sampleIds = [this.currentMethod.id] // this.$refs.sampleTable.setCurrentRow(this.currentMethod, true) // this.rowClick(this.currentMethod) spcialItem.forEach(item=>{ this.sampleIds.push(item.id) }) this.openConfig() return } @@ -1653,6 +1686,7 @@ if(['≤','≥','>','<','='].includes(ele.ask[0])){ const askVal = ele.ask.substring(1,ele.ask.length) if(isNaN(askVal) || ele.tell.indexOf(askVal)<0){ console.log(1111); isTrue = false } } @@ -1660,8 +1694,10 @@ if(ele.ask.indexOf('-')>0 && ele.ask.length>1){ //要求描述的~和要求值的-,等效 let tell = ele.tell if(ele.tell.indexOf('~')>0){ tell = ele.tell.replace('~','-') if(ele.tell.indexOf('~')>0 || ele.tell.indexOf('(') || ele.tell.indexOf(')')){ tell = tell.replace('~','-') tell = tell.replace('(','(') tell = tell.replace(')',')') } const splits = ele.ask.split('-') //满足格式要求,并且两个都是数字 @@ -1677,35 +1713,65 @@ let min = Math.min(...splits) let max = Math.max(...splits) if(min==max){ console.log(2222); isTrue = false } //要求描述中不包含±以及区间的数字,则返回false if((tell.indexOf('±')<0&&tell.indexOf('-')<0)){ if(tell.indexOf('±')<0&&tell.indexOf('-')<0){ console.log(3333,ele); console.log(3333333,tell,tell.indexOf('±')<0,tell.indexOf('-')<0); isTrue = false }else if(ele.tell.indexOf('-')==0){ console.log(4444); isTrue = false }else if(tell.indexOf('-')>0){ const splitTells = tell.split('-') if(splitTells[0].indexOf(min)<0 || splitTells[1].indexOf(max)<0){ isTrue = false } }else if(tell.indexOf('±')>0&&tell!=ele.ask){ //校验要求描述为10±5这种写法的情况 let splitNums = ele.tell.split('±') if(splitNums.length<2){ isTrue = false if(tell.indexOf('±')>0){ ////校验要求描述为(10-15)±5这种写法的情况 const num = tell.split('±')[1] const startIndex = tell.indexOf('(') const endIndex = tell.indexOf(')') if(startIndex>-1 && endIndex>0 ){ const str = tell.substring(startIndex,endIndex) if(str && str.indexOf('-')>0){ let strList = str.split('-') const minNum = Number(strList[0]-num) const maxNum = Number(strList[1]+num) if(minNum>min || maxNum<max){ console.log(555555); isTrue = false } } }else{ //校验要求描述为10±5这种写法的情况 let splitNums = ele.tell.split('±') if(splitNums.length<2){ console.log(66666); isTrue = false }else{ let minTell = Number(splitNums[0])-Number(splitNums[1]) let maxTell = Number(splitNums[0])+Number(splitNums[1]) if(minTell!=min || maxTell!=max){ console.log(7777777); isTrue = false } } } }else{ let minTell = Number(splitNums[0])-Number(splitNums[1]) let maxTell = Number(splitNums[0])+Number(splitNums[1]) if(minTell!=min || maxTell!=max){ const splitTells = tell.split('-') if(splitTells[0].indexOf(min)<0 || splitTells[1].indexOf(max)<0){ console.log(88888888); isTrue = false } } } }else{ console.log(89999999); isTrue = false } } // else if(ele.ask.indexOf('&')>0 && ele.ask.length>1){ // //判断 // } }) }catch(error){ console.log(error); @@ -2079,7 +2145,23 @@ this.selectTree = '' this.models = val.children this.getNodeParent(node) let flag = false if (node.level == 3) { if(node.data.children.length>0){ node.data.children.forEach(a => { let key = Object.keys(a) if(!key.includes('level')) { flag = true } }) } } this.selectTree = this.selectTree.replace(' - ', '') if(flag) { this.selectTree = '- - ' + this.selectTree } let data = this.selectTree.split(' - ') let data2 = '' for (let index = data.length - 1; index >= 0; index--) { @@ -2118,7 +2200,7 @@ this.addObj.factory = trees[0] this.addObj.laboratory = trees[1] this.addObj.sampleType = trees[2] if (trees[3] === undefined || trees[3] === '') { if (trees[3] === undefined || trees[3] === '' || trees[3] === '- ') { this.addObj.sample = trees[2] } else { this.addObj.sample = trees[3] @@ -2180,12 +2262,12 @@ this.sample.unit = this.addObj.unit this.sample.standardMethodListId = null this.sample.insProduct = [] this.sample.id = this.count this.sample.id = parseInt(i+1) this.sample.childSampleList = [] this.sample.insulating = null this.sample.sheath = null this.sampleList.push(this.HaveJson(this.sample)) this.count++ // this.count++ } this.computationalPairing(this.sampleList.length) this.bsm2Val2 = this.HaveJson(this.bsm2Val3) @@ -2334,6 +2416,13 @@ } else if ((row.inspectionItem === '温升试验' || row.inspectionItem === '热循环') && row.state === 0) { this.temperatureShow = false; } // if (row.inspectionItem === '单根垂直燃烧' && select[2] === '光缆' && row.state === 1) { // this.singleVerticalCombustionShow = true; // return // } else if (row.inspectionItem === '单根垂直燃烧' && select[2] === '光缆' && row.state === 0) { // this.singleVerticalCombustionShow = false; // } this.changeProductList0() this.currentMethod.insProduct = this.productList0 this.getProNum() @@ -2492,6 +2581,8 @@ this.getProductLoad = true let selectTreeList = this.selectTree.split(" - ") this.addObj.model&&(selectTreeList[selectTreeList.length - 1] = this.addObj.model) console.log( this.selectTree); this.$axios.post(this.$api.standardTree.selectStandardProductList, { model: (this.addObj.model?this.addObj.model:row.model) + '-' + row.modelNum, standardMethodListId: val, @@ -2564,17 +2655,27 @@ }, // 要求值变化时 requestChange(e, row,type) { this.sampleList.map(item => { if (this.sampleIds.indexOf(item.id) > -1) { item.insProduct.map(m => { if (m.id == row.id) { m[type] = e; //this.currentMethod 当前样品id this.sampleList.forEach(item=>{ if(item.id == this.currentMethod.id){ item.insProduct.forEach(i=>{ if(i.id == row.id){ i[type] = e } return m; }) } return item }) // this.sampleList.map(item => { // if (this.sampleIds.indexOf(item.id) > -1) { // item.insProduct.map(m => { // if (m.id == row.id) { // m[type] = e; // } // return m; // }) // } // return item // }) }, selectStandardMethods() { this.$axios.get(this.$api.standardTree.selectStandardMethodEnum).then(res => { src/components/do/b1-ins-order/fiberoptic-config.vue
@@ -110,7 +110,7 @@ </el-col> </el-row> <el-row :gutter="10"> <el-col :span="12" v-if="packageInfo.ismiers"> <el-col :span="12" v-if="packageInfo.ismiers && inspectionItemST != 1"> <div class="grid-content"> <h5>光纤带 <el-button size="mini" type="primary" class="btns" @click="addFibers" @@ -192,7 +192,7 @@ </el-table> </div> </el-col> <el-col :span="!packageInfo.ismiers?24:12"> <el-col :span="!packageInfo.ismiers?24:12" v-if=" inspectionItemST != 1"> <div class="grid-content"> <h5>光纤 <el-button size="mini" type="primary" class="btns" @click="addFiber" @@ -365,6 +365,10 @@ type: Number, default: () => 0 }, inspectionItemST: { type: Number, default: () => 0 } }, data() { return { @@ -449,6 +453,7 @@ // } }, mounted() { console.log('inspectionItemST',this.inspectionItemST); this.$parent.sampleIds.forEach(a => { for (var i = 0; i < this.$parent.sampleList.length; i++) { if (this.$parent.sampleList[i].id == a) { @@ -618,18 +623,35 @@ } } } // 如果检测要求含有≤ < ≥ > 符号 // 如果要求描述含有≤ < ≥ > 符号 const regex = /[≤<≥>]/ const match = row.tell.match(regex) if(match) { // 符号不一致 if( row.ask.indexOf(match[0]) != 0) { this.$message.error('检测要求不符合要求描述') row.ask = match[0] return }else { // 符号一致 const regex = new RegExp(`${match[0]}(\\d+(\\.\\d+)?)`, 'g') // 如果检测要求含有正负号 并且含有&号 ≥0.69&≤0.76 要求描述 if(row.tell.indexOf('&') != -1) { if(row.ask.indexOf('&') == -1) { this.$message.error('检测要求不符合要求描述') row.ask = row.tell return }else{ let left = row.tell.substring(0,row.tell.indexOf('&')) let right = row.tell.substring(row.tell.indexOf('&')+1) let leftAsk = row.ask.substring(0,row.ask.indexOf('&')) let rightAsk = row.ask.substring(row.ask.indexOf('&')+1) if(leftAsk != left || rightAsk != right) { this.$message.error('检测要求不符合要求描述') } } }else { // 没有&号 const regex = new RegExp(`${match[0]}(\\d+(\\.\\d+)?)`, 'g') const matchTow = row.tell.match(regex); let right = Number(matchTow[0].split(match[0])[1]) let left = row.ask.substring(row.ask.indexOf(match[0])+1) @@ -638,7 +660,19 @@ row.ask = match[0] + right } } } } // 如果要求描述含有范围 const regexTwo = /[~-]/ const matchTwo = row.tell.match(regexTwo) @@ -1723,8 +1757,15 @@ // }) // this.$message.success('已保存') // this.$emit('saveFiberopticConfig') if(this.inspectionItemST == 1) { console.log('this.bushing',this.bushing); this.$message.success('已保存') this.sample.forEach(a=>{ a.bushing = this.bushing }) this.$emit('saveFiberopticConfig') return } let flag = true let flags = true @@ -1796,13 +1837,35 @@ return }else { // 符号一致 // 如果检测要求含有正负号 并且含有&号 ≥0.69&≤0.76 要求描述 if(row.tell.indexOf('&') != -1) { console.log(11111); if(row.ask.indexOf('&') == -1) { this.$message.error('检测要求不符合要求描述') row.ask = row.tell return }else{ let left = row.tell.substring(0,row.tell.indexOf('&')) let right = row.tell.substring(row.tell.indexOf('&')+1) let leftAsk = row.ask.substring(0,row.ask.indexOf('&')) let rightAsk = row.ask.substring(row.ask.indexOf('&')+1) console.log('&',left,right,leftAsk,rightAsk); if(leftAsk != left || rightAsk != right) { flag = false } } }else{ const regex = new RegExp(`${match[0]}(\\d+(\\.\\d+)?)`, 'g') const matchTow = row.tell.match(regex); console.log('matchTow',matchTow); let right = Number(matchTow[0].split(match[0])[1]) let left = row.ask.substring(row.ask.indexOf(match[0])+1) if(Number(left) != Number(right)) { // this.$message.error('666666') flag = false } } } } @@ -1893,6 +1956,24 @@ return }else { // 符号一致 if(row.tell.indexOf('&') != -1) { console.log(11111); if(row.ask.indexOf('&') == -1) { this.$message.error('检测要求不符合要求描述') row.ask = row.tell return }else{ let left = row.tell.substring(0,row.tell.indexOf('&')) let right = row.tell.substring(row.tell.indexOf('&')+1) let leftAsk = row.ask.substring(0,row.ask.indexOf('&')) let rightAsk = row.ask.substring(row.ask.indexOf('&')+1) console.log('&',left,right,leftAsk,rightAsk); if(leftAsk != left || rightAsk != right) { flags = false } } }else { const regex = new RegExp(`${match[0]}(\\d+(\\.\\d+)?)`, 'g') const matchTow = row.tell.match(regex); let right = Number(matchTow[0].split(match[0])[1]) @@ -1901,6 +1982,8 @@ // this.$message.error('666666') flags = false } } } } // 如果要求描述含有范围 @@ -1922,10 +2005,6 @@ }) } }) if(this.bushing.length === 0){ this.$message.error('缺少套管无法保存') return @@ -1944,11 +2023,12 @@ item.fiber = this.fiberList // 光纤 } }) this.sample.forEach(a=>{ a.bushing = this.bushing }) if(flag && flags) { this.$message.success('已保存') this.sample.forEach(a=>{ a.bushing = this.bushing }) this.$emit('saveFiberopticConfig') }else if(!flag) { this.$message.error('光纤保存的检测项中含有不符合要求的数据') src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -1,4 +1,16 @@ <style scoped> .custom-table .el-table__header-wrapper th { background-color: #87CEEB; /* 只对带有my-custom-table类的表格生效 */ color: #fff; } .container { overflow: auto; /* 确保容器能包裹浮动元素 */ margin-bottom: 10px; } .right-button { float: right; } .inspection { height: 100%; overflow-y: auto; @@ -23,6 +35,7 @@ .search .form-inline { padding-top: 20px; padding-left: 0px; text-align: left; } .center { @@ -187,6 +200,7 @@ .inspection .el-drawer__header { color: #303133; text-align: left; } .inspection .el-input-group__append { @@ -344,7 +358,8 @@ <el-button :type="dataAcquisitionEidtAble?'':'primary'" size="small" v-if="(isGet||(tableLists.find(m=>m.templateId==currentTable)&&tableLists.find(m=>m.templateId==currentTable).templateName=='温度循环检验原始记录'))&&PROJECT=='检测中心'&&collected&&state==1" @click="dataAcquisitionEidtAble=!dataAcquisitionEidtAble">{{dataAcquisitionEidtAble?'关闭编辑':'编辑数采'}}</el-button> </div> </div> <div class="center-box" id="nav" v-loading="tableLoading" v-if="!tableLists.find(m=>m.templateId==currentTable)||(tableLists.find(m=>m.templateId==currentTable).templateName!='温度循环检验原始记录'&&!tableLists.find(m=>m.templateId==currentTable).templateName.includes('热循环')&&!tableLists.find(m=>m.templateId==currentTable).templateName.includes('温升试验'))"> <!-- 常规检验原始记录 --> <div class="center-box" id="nav" v-loading="tableLoading" v-if="!tableLists.find(m=>m.templateId==currentTable)||(tableLists.find(m=>m.templateId==currentTable).templateName!='温度循环检验原始记录'&&!tableLists.find(m=>m.templateId==currentTable).templateName.includes('热循环')&&!tableLists.find(m=>m.templateId==currentTable).templateName.includes('温升试验'))&&(tableLists.find(m=>m.templateId==currentTable).templateName!='弧垂特性检验原始记录')"> <table border="1" class="tables" cellpadding="10" v-for="(item,index) in tableList" :key="index+currentTable+currentSample.id"> <tbody> <tr v-for="(m,i) in item.arr" :key="i"> @@ -359,7 +374,7 @@ :disabled="(getInspectionItemType(n.i) == 1 && !dataAcquisitionEidtAble )|| (n.u != userId && n.u != undefined && n.u != '')" @input="handleInput(n)" @change="m=>changeInput(m,`${item.templateId}-${n.r}-${n.c}-${n.i}`, n,'getDataType')" @mousewheel.native.prevent :key="'abc-'+'000'+index+'000'+i+'000'+j" @keydown.enter="changeInput('',`${item.templateId}-${n.r}-${n.c}-${n.i}`, n)"> @keydown.enter="changeInput('',`${item.templateId}-${n.r}-${n.c}-${n.i}`, n, 'getDataType')"> <!-- <el-button slot="append" type="primary" icon="el-icon-edit" size="mini" v-if="getInspectionItemType(n.i) == 1" @click="getSystemValue(n)"></el-button> --> </el-input> @@ -458,6 +473,88 @@ </tbody> </table> </div> <!-- 弧垂特性检验原始记录 --> <div v-loading="tableLoading" v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName=='弧垂特性检验原始记录'"> <el-divider></el-divider> <h4 style="margin-bottom: 20px;font-size: 24px;font-weight: 400;text-align: center;">弧垂特性检验原始记录</h4> <el-form :inline="true" :model="sagForm" class="form-inline" label-width="120px" style="justify-content: flex-start;display: flex;align-items: center;width: 100%;"> <el-form-item label="样品编号" style="margin-bottom: 0;"> <el-input clearable v-model="sagForm.sampleCode" disabled size="small" placeholder=""></el-input> </el-form-item> <el-form-item label="型号" style="margin-bottom: 0;"> <el-input clearable v-model="sagForm.model" disabled size="small" placeholder=""></el-input> </el-form-item> <el-form-item label="检验依据" style="margin-bottom: 0;"> <el-input clearable v-model="sagForm.inspection" disabled size="small" placeholder=""></el-input> </el-form-item> <el-form-item label="设备编号" style="margin-bottom: 0;"> <el-input clearable v-model="sagForm.methodName" disabled size="small" placeholder=""></el-input> </el-form-item> <el-form-item label="额定拉断力/kN" style="margin-bottom: 0;"> <el-input clearable v-model="sagForm.tensileForce" disabled size="small" placeholder=""></el-input> </el-form-item> <el-form-item label="跨距长度/m" style="margin-bottom: 0;"> <el-input clearable v-model="sagForm.spanLength" disabled size="small" placeholder=""></el-input> </el-form-item> <el-form-item label="载荷/kN" style="margin-bottom: 0;"> <el-input clearable v-model="sagForm.load" disabled size="small" placeholder=""></el-input> </el-form-item> </el-form> <el-divider></el-divider> <div class="container"> <el-button class="right-button" type="primary" size="small" @click="addSag">添 加</el-button> </div> <el-table :data="sagData" class="custom-table" border> <el-table-column label="高度 h mm" prop="height" align="center"> </el-table-column> <el-table-column label="弧垂 mm" prop="sag" align="center"> </el-table-column> <el-table-column label="导线温度℃" align="center"> <el-table-column label="1" prop="one" align="center"> <template slot-scope="scope"> <el-input v-model="scope.row.one" style="width: 100%;"></el-input> </template> </el-table-column> <el-table-column label="2" prop="two" align="center"> <template slot-scope="scope"> <el-input v-model="scope.row.two" style="width: 100%;"></el-input> </template> </el-table-column> <el-table-column label="3" prop="three" align="center"> <template slot-scope="scope"> <el-input v-model="scope.row.three" style="width: 100%;"></el-input> </template> </el-table-column> <el-table-column label="4" prop="four" align="center"> <template slot-scope="scope"> <el-input v-model="scope.row.four" style="width: 100%;"></el-input> </template> </el-table-column> <el-table-column label="5" prop="five" align="center"> <template slot-scope="scope"> <el-input v-model="scope.row.five" style="width: 100%;"></el-input> </template> </el-table-column> <el-table-column label="6" prop="six" align="center"> <template slot-scope="scope"> <el-input v-model="scope.row.six" style="width: 100%;"></el-input> </template> </el-table-column> </el-table-column> <el-table-column label="平均温度℃" prop="average" align="center"> </el-table-column> <el-table-column label="室温℃" prop="temperature" align="center"> </el-table-column> <el-table-column label="张力kN" prop="remark" align="center"> </el-table-column> <el-table-column label="操作" align="center"> <template slot-scope="scope"> <el-button type="text" size="small" @click="deleteSag(scope.$index)"><span style="color:red">删除</span></el-button> </template> </el-table-column> </el-table> </div> <!-- 温度循环检验原始记录 --> <div v-loading="tableLoading" v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName=='温度循环检验原始记录'"> <el-divider></el-divider> <h4 style="margin-bottom: 20px;font-size: 24px;font-weight: 400;text-align: center;">温度循环检验原始记录</h4> @@ -620,6 +717,7 @@ </template> </el-table> </div> <!-- 热循环/温升试验检验原始记录 --> <div v-loading="tableLoading" v-else-if="tableLists.find(m=>m.templateId==currentTable).templateName.includes('热循环')||tableLists.find(m=>m.templateId==currentTable).templateName.includes('温升试验')"> <el-divider></el-divider> <h4 style="margin-bottom: 20px;font-size: 24px;font-weight: 400;text-align: center;">{{tableLists.find(m=>m.templateId==currentTable).templateName}}</h4> @@ -862,6 +960,16 @@ }, data() { return { sagData: [], sagForm: { sampleCode: null, model: null, inspection: null, methodName: null, tensileForce: null, spanLength: null, load: null }, dataGetDia:false, wareTableDataLoading:false, fileAdd:false, @@ -1061,6 +1169,7 @@ getDataType:null } }, // 用于上传文件的信息 computed: { headers() { return { @@ -1086,6 +1195,7 @@ this.startWorker() }, watch: { // 监听任务id,获取任务信息 id(val) { this.loading = true this.$axios.post(this.$api.insOrderPlan.doInsOrder, { @@ -1104,9 +1214,11 @@ if(!res.data.sampleProduct||res.data.sampleProduct.length==0){ return this.$message.error('该任务没有样品信息') } // 赋值当前样品列表 this.sampleProduct = res.data.sampleProduct this.currentSample = this.HaveJson(this.sampleProduct[0]) let insProduct = this.HaveJson(this.currentSample.insProduct) // 温度、湿度赋值 if(insProduct&&insProduct.length>0){ let {temperature,humidity} = insProduct[0]; this.otherForm = { @@ -1114,11 +1226,14 @@ humidity:humidity?humidity:null, } } // 获取当前样品的检验项 let list = await this.getCurrentProduct(this.currentSample.id,0) this.currentSample.insProduct = this.HaveJson(list) // 初始化传递到后端的参数 this.param = {} this.changeType = 0; this.currentSample.insProduct.forEach(a => { // 是否为成品电缆下的松套管项目,不是则执行初始化 if(this.handleCasing(a.inspectionItem)){ this.param[a.id] = { insValue: [], @@ -1130,15 +1245,15 @@ } } }) this.determineWhetherToCollectData() this.getReportModel(this.currentSample.id) this.determineWhetherToCollectData()//是否需要数采 this.getReportModel(this.currentSample.id)//获取套管、光纤带、光纤信息 if (this.currentSample.index == undefined) this.currentSample['index'] = 1 let bushing = this.currentSample.bushing this.getTableLists(); this.getTableLists();//处理模板列表信息 this.componentData.currentId = val; this.currentKey = 1; // 清空光纤配置相关数据 // 清空光纤配置相关数据---下面信息暂时可忽略 this.fiberOpticTape = [] this.currentFiberOpticTape = null; this.fiberOptic = [] @@ -1151,23 +1266,25 @@ } }) }, // 监听当前模板变化 currentTable(val1, val0) { if (val0 != null && val1 != val0) { if(this.tableLists.find(m=>m.templateId==val1)&&(this.tableLists.find(m=>m.templateId==val1).templateName=='成品缆检验原始记录')){ if(this.casing.length>0){ this.handleChange(this.casing[0].id,3) } return } // if(this.tableLists.find(m=>m.templateId==val1)&&(this.tableLists.find(m=>m.templateId==val1).templateName=='成品缆检验原始记录')){ // if(this.casing.length>0){ // this.handleChange(this.casing[0].id,3) // } // return // } if(this.changeType&&this.changeType>0){ // 如果是光纤、光纤带,则不执行下面操作 return } this.tableLists.forEach(async (m, i) => { if (m.templateId == val1) { let list = await this.getCurrentProduct(this.currentSample.id,0) this.currentSample.insProduct = this.HaveJson(list) this.param = {} this.currentSample.insProduct.forEach(a => { this.currentSample.insProduct = this.HaveJson(list)//赋值当前样品的检验项 this.param = {}//初始化传到后端的参数 this.currentSample.insProduct.forEach((a, j) => { if(this.handleCasing(a.inspectionItem)){ this.param[a.id] = { insValue: [], @@ -1179,7 +1296,8 @@ } } }) this.getReportModel(this.currentSample.id) this.getReportModel(this.currentSample.id)//获取套管、光纤带、光纤信息 // 去重模板,返回有几个模板 const mySet1 = new Set(); this.tableLists = this.currentSample.insProduct.filter(m => { let num0 = mySet1.size; @@ -1201,19 +1319,23 @@ if (this.tableLists && this.tableLists.length > 0) { this.tableList = null; this.tableList = this.tableLists.filter(m => m.templateId == val1) // 对模板进行处理 this.handleTableData() } } }) } }, // 特殊检验项--监听设备信息改变 equipForm:{ deep:true, handler(val){ if(this.tableLists.find(m=>m.templateId==this.currentTable)&&(this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'||this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('热循环')||this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('温升试验'))&&this.equipOptions&&this.equipOptions.length>0){ // 初始化设备信息 this.param[this.currentSample.insProduct[0].id].equipValue = [] this.param[this.currentSample.insProduct[0].id].equipName = [] if(this.equipForm.code0){ // 赋值第一个设备的信息 this.equipForm.value0 = this.equipOptions.find(m=>m.value==this.equipForm.code0).label this.param[this.currentSample.insProduct[0].id].equipValue.push({ i:this.currentSample.insProduct[0].id, @@ -1229,6 +1351,7 @@ }) } if(this.equipForm.code1){ // 赋值第二个设备的信息 this.equipForm.value1 = this.equipOptions.find(m=>m.value==this.equipForm.code1).label this.param[this.currentSample.insProduct[0].id].equipValue.push({ i:this.currentSample.insProduct[0].id, @@ -1243,6 +1366,7 @@ } }) } // 保存数据 this.saveInsContext() } } @@ -1253,6 +1377,22 @@ this.stopWorker(); }, methods: { // 删除行 deleteSag(index) { this.sagData.splice(index, 1) }, // 添加弧垂检测 addSag() { this.sagData.push({ sampleCode: null, model: null, inspection: null, methodName: null, tensileForce: null, spanLength: null, load: null }) }, // 数据采集 getDataAcquisitionDevice(){ if(this.tableLists.find(m=>m.templateId==this.currentTable)&&this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'){ @@ -1280,7 +1420,7 @@ if(res.code!=200){ return } // console.log(res.data) // 赋值回显PK8000的数据 this.wareFormChange() }) }else{ @@ -1292,11 +1432,13 @@ return } this.dataAcquisitionInfoNew = this.HaveJson(res.data) // 对数采回来的值进行处理 this.handleDataAcquisition(res.data) }) } }, handleDataAcquisition(data){ // 是否可以编辑数采数据 if(this.dataAcquisitionEidtAble){ this.getDataType = 1; }else{ @@ -1309,7 +1451,9 @@ faName:i, child:[] } // 循环数采数据 for(let j in data[i]){ // 拼接字符串 检验项+检验子项 let str0 = '' if(i==j){ str0 = i+',' @@ -1317,11 +1461,13 @@ str0 = i+','+j } if(j!='frequency'&&data[i][j]&&typeof data[i][j].result == 'string'){ // 处理数采信息格式 this.dataAcquisitionInfo[str0] = { value:data[i][j].result, frequency:data[i].frequency } let list = this.tableList[0].arr // 循环页面列表信息,判断数采数据对应页面列表信息的检验项是哪个,并给当前检验项绑定设备信息 list.forEach((item,index)=>{ let num0 = 0; let str = '' @@ -1339,6 +1485,7 @@ } } } // 绑定设备信息 if(data[i][j].equipName&&data[i][j].equipValue&&m.v&&m.v.ps&&m.v.ps.value=='设备编码'&&str0==str){ if(!m.v.v){ this.changeEquip(data[i][j].equipValue,m,data[i][j].equipName) @@ -1347,6 +1494,8 @@ }) }) }else if(j!='frequency'&&data[i][j]&&Array.isArray(data[i][j].result)){ // 如果返回的数采数据是数组,则处理数组 // 以下逻辑为获取每个检验项可输入的检验值的最大个数 let str0 = '' if(i==j){ str0 = i+',' @@ -1381,6 +1530,7 @@ maxNum = num } } // 绑定设备 if(data[i][j].equipName&&data[i][j].equipValue&&m.v&&m.v.ps&&m.v.ps.value=='设备编码'&&str0==str){ if(!m.v.v){ this.changeEquip(data[i][j].equipValue,m,data[i][j].equipName) @@ -1395,12 +1545,14 @@ // value: // }) // } // 获取到最大检验值输入个数后重组数据 let obj0 = { name:j, arr:data[i][j].result, maxNum:maxNum, value:[] } // 如果数采返回的数组长度大于最大输入个数,则将数采数据在弹框中展示,用户选择需要手动选择数采的信息 if(data[i][j].result&&Array.isArray(data[i][j].result)&&data[i][j].result.length>maxNum){ obj.child.push(obj0) }else{ @@ -1414,10 +1566,12 @@ this.getData.push(obj) } } // 如果存在数采返回的数组长度大于最大输入个数,则弹出弹框选择 if(this.getData.length>0){ this.dataGetDia = true this.getDataIndex = [] }else{ // 如果都不存在,则,进入处理数采线程里去处理数据 try { // 向 Worker 发送消息,开始处理逻辑 this.getDataIndexLoading = false @@ -1435,14 +1589,17 @@ this.worker0.onmessage = (event) => { let result = JSON.parse(event.data); if(result.method=='changeInput'){ // 采集后的数据,需要进行计算的线程进行计算 let {list,n} = result.value this.$set(this.tableList[0],'arr',list) this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n) }else if(result.getDataTypeId){ // 获取到数采最后一项,检验项的ID this.getDataTypeId = result.getDataTypeId } }; }, // 如果存在数采返回的数组长度大于最大输入个数,则弹出弹框选择,这里是弹框的提交 submitDataGet(){ if(this.getDataIndex.length==0){ this.$message.error('请选择需要采集的数据') @@ -1451,6 +1608,7 @@ this.getDataIndex.sort((a, b) => a - b); for (let i=0;i<this.getData.length;i++){ for(let j=0;j<this.getData[i].child.length;j++){ // 对用户选择的数采信息进行处理,赋值 let arr = [] for(let k=0;k<this.getDataIndex.length;k++){ arr.push( this.dataAcquisitionInfoNew[this.getData[i].faName][this.getData[i].child[j].name].result[this.getDataIndex[k]]) @@ -1459,6 +1617,7 @@ } } this.getDataIndexLoading = true // 赋值完成后需要再次进入处理数采线程里去处理数据 this.handleDataAcquisition(this.dataAcquisitionInfoNew) }, // 多线程 @@ -1474,6 +1633,7 @@ // 创建 Worker 实例 this.worker0 = new Worker('/static/js/worker0.js'); }, // 停止多线程 stopWorker() { if (this.worker) { this.worker.terminate(); @@ -1486,15 +1646,23 @@ }, // 温度循环---开始 changeItem(row){ // 内端、外端进行赋值逻辑处理 // 赋值到页面 if(row.value0&&!row.value1){ // 赋值内端 this.$set(row,'comValue',Number(row.value0).toFixed(3)) }else if(!row.value0&&row.value1){ // 赋值外端 this.$set(row,'comValue',Number(row.value1).toFixed(3)) }else if(row.value0&&row.value1){ // 赋值计算值 this.$set(row,'comValue',((Number(row.value0)+Number(row.value1))/2).toFixed(3)) }else{ return } // 赋值到传到后端的参数---特殊项目必须严格按照这种格式传参,否则后端识别不了 // 赋值内外端 this.param[row.id].insValue = [ { i:row.id, @@ -1509,15 +1677,20 @@ } } ] // 赋值计算值 this.param[row.id].comValue = [{ i:row.id, v:{ v:row.comValue } }] // 判断结果,得出结论 if(this.wareForm.inspectionItemSubclass!='20(常温)'){ // 给页面列表赋值最终值 row.resValue = row.comValue?Math.abs(row.comValue-Number(row.insProduct.complue)).toFixed(3):'' // 给传递到后端的参数赋值最终值 this.param[row.id].resValue.v.v = row.resValue // 判断结论,给页面列表赋值结论 if(row.ask&&row.resValue){ if(row.ask.includes('<')){ row.insResult = row.resValue<row.ask.split('<')[1]?1:0 @@ -1530,14 +1703,18 @@ }else if(row.ask.includes('≤')){ row.insResult = row.resValue<=row.ask.split('≤')[1]?1:0 } // 给传递到后端的参数赋值结论 this.param[row.id].insResult.v.v = row.insResult } }else{ // 20(常温)默认合格 this.param[row.id].insResult.v.v = 1 } this.$refs.wareTableData.doLayout() // 进行数据的保存 this.saveInsContext() }, // 当循环次数、温度点变化、PK8000数采时会调用,主要是获取信息进行回显 wareFormChange(m,type){ if(this.PROJECT!='检测中心'||!this.tableLists.find(m=>m.templateId==this.currentTable)||this.tableLists.find(m=>m.templateId==this.currentTable).templateName!='温度循环检验原始记录'){ return @@ -1560,6 +1737,7 @@ if (res.code == 201) return let {productVos,sampleVo} = res.data this.wareForm0 = sampleVo // 初始化传到后端的参数 productVos = productVos.map(m=>{ let obj = {...m,...m.insProduct} this.param[obj.id] = { @@ -1581,12 +1759,15 @@ } } let insProductResult = obj.insProductResult // 给传递到后端的参数进行赋值,给页面数据赋值 if(insProductResult){ for(let i in insProductResult){ switch (i) { // 检验值赋值 case 'insValue': let insValue = JSON.parse(insProductResult[i]) if(insValue&&insValue.length>1){ // 后端的参数进行赋值 this.param[obj.id].insValue = [ { i:obj.id, @@ -1601,9 +1782,11 @@ } } ] // 页面数据赋值 obj.value0 = insValue[0].v obj.value1 = insValue[1].v }else if(insValue&&insValue.length==1){ // 后端的参数进行赋值 this.param[obj.id].insValue = [ { i:obj.id, @@ -1618,13 +1801,16 @@ } } ] // 页面数据赋值 obj.value0 = insValue[0].v obj.value1 = '' } break; // 计算值赋值 case 'comValue': let comValue = JSON.parse(insProductResult[i]) if(comValue&&comValue.length>0){ // 后端的参数进行赋值 this.param[obj.id].comValue = [ { i:obj.id, @@ -1633,6 +1819,7 @@ } } ] // 页面数据赋值 obj.comValue = comValue[0].v } break; @@ -1640,13 +1827,18 @@ break; } } // 最终值赋值 // 后端的参数进行赋值 this.param[obj.id].resValue = { i:obj.id, v:{ v:obj.lastValue } } // 页面数据赋值 obj.resValue = obj.lastValue // 结论赋值 // 后端的参数进行赋值 this.param[obj.id].insResult = { i:obj.id, v:{ @@ -1656,6 +1848,7 @@ } return obj }) // 以下是对温度循环页面呈现进行处理,去重、数据重置等等 let arr = [] let arr0 = [] let mySet = new Set() @@ -1701,13 +1894,16 @@ } arr2.push(obj) }) // 这是页面最终呈现的格式 this.wareTableData = arr2 }) // 获取设备列表 this.getEquipOptions(true,this.currentSample.insProduct[0].id) // this.$refs.wareTableData&&this.$refs.wareTableData.doLayout() }, // 温度循环---结束 // 热循环---开始 // 循环次数切换时调用 thermalCyclingChange(){ this.thermalCyclingLoading = true this.$axios.post(this.$api.insOrderPlan.temCycle,{ @@ -1727,6 +1923,7 @@ } if(productVos.length>0){ this.thermalCyclingInfo.inspectionItemClass = productVos[0].insProduct.inspectionItemClass // 根据检验项,初始化传到后端的参数 productVos.forEach(item=>{ this.param[item.insProduct.id] = { insValue: [], @@ -1752,9 +1949,11 @@ let obj = {...item,...item.insProduct} let insProductResult = obj.insProductResult if(insProductResult){ // 给页面列表赋值,给后端传参赋值 for(let i in insProductResult){ switch (i) { case 'insValue': // 给页面列表赋值 let insValue = JSON.parse(insProductResult[i]) if(insValue&&insValue.length>0){ this.thermalCyclingInfo.length = 0 @@ -1771,6 +1970,7 @@ a.insResult = obj.insResult } }) // 给后端传参赋值 this.param[obj.id].insValue = [] insValue.forEach(m=>{ this.param[obj.id].insValue.push({ @@ -1787,6 +1987,7 @@ break; } } // 给后端传参赋值 this.param[obj.id].insResult = { i:obj.id, v:{ @@ -1794,6 +1995,7 @@ } } }else{ // 给页面列表赋值 this.thermalCyclingInfo.arr.forEach(a=>{ a.insResult = null a.arr = [] @@ -1808,9 +2010,11 @@ } }) } // 获取设备列表 this.getEquipOptions(true,this.currentSample.insProduct[0].id) }) }, // 添加检验值 handleAddThermal(){ this.thermalCyclingInfo.length++ this.thermalCyclingInfo.arr.forEach(item=>{ @@ -1820,6 +2024,7 @@ }) }) }, // 删除检验值 handleDeleteThermal(){ if(this.thermalCyclingInfo.length==1){ this.$message.error('最后一条数据不能删除') @@ -1829,6 +2034,7 @@ this.thermalCyclingInfo.arr.forEach(item=>{ item.arr.pop() }) // 删除后需要保存一下数据 this.saveThermalCycling(true,{name:'导线温度'},true) } }, @@ -1846,6 +2052,7 @@ num0 = c.arr[i].value0 } }) // 判断结论 if(!num0||!b.value0){ b.state = null }else if(Number(num0)>Number(b.value0)){ @@ -1858,10 +2065,13 @@ let state0 = a.arr.filter(b=>b.state==0).length let state1 = a.arr.filter(b=>b.state==1).length if(state>0){ // 待定 a.insResult = null }else if(state0>0){ // 不合格 a.insResult = 0 }else if(state1==a.arr.length){ // 合格 a.insResult = 1 } } @@ -1896,7 +2106,7 @@ }) } } // 赋值 // 给后端传参赋值 this.thermalCyclingInfo.arr.forEach(item=>{ for (let i in this.param){ if(this.param[i].inspectionItemSubclass==item.name){ @@ -1964,10 +2174,11 @@ } } }) // console.log(1111,this.param) // 保存数据 this.saveInsContext() }, // 热循环---结束 // 保存湿度、温度数据 subOtherForm(m,type){ let ids = [] for (let i in this.param) { @@ -1986,6 +2197,7 @@ this.$message.success('保存成功') }) }, // 权限获取 getPower(){ let power = JSON.parse(sessionStorage.getItem('power')) let fileDel = false @@ -2021,6 +2233,7 @@ this.sampleProduct = res.data.sampleProduct }) }, // 根据类型、任务id、实验室来获取样品的检验项信息 async getCurrentProduct(id,type){ this.tableLoading = true; let res = await this.$axios.post(this.$api.insOrderPlan.getInsProduct+'?id='+id+'&type='+type+'&laboratory='+this.sonLaboratory) @@ -2084,7 +2297,9 @@ } this.currentKey1 = row.index }, // 切换样品 async handleChangeSample(row, column, event) { // 初始化数据 this.param = {} // 清空光纤配置相关数据 this.fiberOpticTape = [] @@ -2094,12 +2309,15 @@ this.bushing = [] this.currentBushing = null; this.sampleVisible = false; // 赋值样品 this.currentSample = this.HaveJson(row) let list = await this.getCurrentProduct(row.id,0) // 赋值样品检验项 this.currentSample.insProduct = this.HaveJson(list) // 初始化后端传参 this.param = {} this.changeType = 0; this.currentSample.insProduct.forEach(a => { this.currentSample.insProduct.forEach((a,j) => { if(this.handleCasing(a.inspectionItem)){ this.param[a.id] = { insValue: [], @@ -2111,15 +2329,17 @@ } } }) // 获取套管,光纤带,光纤数据 this.getReportModel(row.id) let bushing = this.currentSample.bushing if(bushing&&bushing.length>0){ this.bushing = bushing } // this.handleTableData() // 处理页面列表数据 this.getTableLists(); this.currentKey = row.index this.currentTab = null; // 向多线程去保存页面列表数据,后端传参,当前模板信息 this.worker.postMessage(JSON.stringify({ type: 'saveData', tableList:this.tableList, @@ -2127,6 +2347,7 @@ currentTable:this.currentTable })); }, // 松套管的判断\如果changeType不等于3那么页面不展示松套管检验项 handleCasing(inspectionItem){ if(this.changeType!=3){ if(inspectionItem.includes('松套管')){ @@ -2138,6 +2359,7 @@ return true } }, // 获取套管,光纤带,光纤数据 getReportModel(id){ if(this.PROJECT!='检测中心'){ return @@ -2150,11 +2372,14 @@ this.casing = res.data['套管'] }) }, // 套管,光纤带,光纤等切换,对应原始记录模板也要切换 async handleChange(m,type){ this.changeType = type if(m){ // 获取检验项 let list = await this.getCurrentProduct(m,type) if(list.length>0){ // 初始化后端传参 this.param = {} list.forEach(a => { this.param[a.id] = { @@ -2166,8 +2391,11 @@ insResult: null } }) // 页面列表数据处理 this.getTableLists0(list) // 获取套管,光纤带,光纤数据 this.getReportModel(this.currentSample.id) // 向多线程保存数据 this.worker.postMessage(JSON.stringify({ type: 'saveData', tableList:this.tableList, @@ -2182,10 +2410,12 @@ } } }, // 改变任务 handleChangeTask(row) { if (row.length > 0) this.id = row[0].id; this.taskVisible = false; }, // 字典获取信息 getTypeDicts() { this.$axios.post(this.$api.enums.selectEnumByCategory, { category: "紧急程度" @@ -2204,6 +2434,7 @@ this.componentData.tagField.type.select = data }) }, // 字典获取信息 getInsStateDicts() { this.$axios.post(this.$api.enums.selectEnumByCategory, { category: "检验任务状态" @@ -2223,6 +2454,7 @@ this.componentData.tagField.insState.select = data }) }, // 字典获取信息 getComparisonList() { this.$axios.post(this.$api.enums.selectEnumByCategory, { category: "表格坐标转换" @@ -2231,6 +2463,7 @@ this.comparisonList = data; }) }, // 获取检验值为下拉时的下拉列表 selectEnumByCategoryOfSelect(val) { this.enumList = [] if (val === undefined || val === null) { @@ -2248,6 +2481,7 @@ }) { row.index = rowIndex + 1; }, // 处理页面列表数据--去重,生成检验模板切换列表 getTableLists() { const mySet1 = new Set(); this.tableLists = this.currentSample.insProduct.filter(m => { @@ -2271,6 +2505,7 @@ this.tableList = null; this.tableList = [this.tableLists[0]] this.currentTable = this.tableLists[0].templateId; // 处理页面列表数据 this.handleTableData() } }, @@ -2299,16 +2534,20 @@ this.tableList = [this.tableLists[0]] this.currentTable = this.tableLists[0].templateId; this.currentSample.insProduct = this.HaveJson(list) // 处理页面列表数据 this.handleTableData() } }, // 处理页面列表数据 handleTableData() { this.excelMethodList = [] this.widthList = this.tableList[0].style.columnlen; this.excelMethodList = []//excel函数列表 this.widthList = this.tableList[0].style.columnlen;//页面宽度--根据模板来的 // 温度循环检验原始记录--开始 if(this.tableLists.find(m=>m.templateId==this.currentTable)&&this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'){ // 对要求值进行拆分处理,进而得出页面内容 let ask = this.currentSample.insProduct[0].ask let askList = ask.split(';') // 获取循环次数 this.numOptions = [] for (let i = 1; i <= askList[askList.length-1]; i++) { this.numOptions.push({ @@ -2322,6 +2561,7 @@ mySet1.add(m.split(',')[0].replace('℃','')) } }) // 获取温度点列表 this.temperatureOptions = [] mySet1.forEach(m => { this.temperatureOptions.push({ @@ -2329,6 +2569,7 @@ label:m }) }) // 初始化页面数据 this.wareTableDataLoading = true this.$axios.post(this.$api.deviceScope.temDataAcquisition2,{ entrustCode:this.insOrder.entrustCode, @@ -2348,6 +2589,7 @@ // 温度循环检验原始记录---结束 // 热循环检验原始记录---开始 if(this.tableLists.find(m=>m.templateId==this.currentTable)&&(this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('热循环')||this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('温升试验'))){ // 根据要求值拆分数据,得到页面渲染的信息 let ask = this.currentSample.insProduct[0].ask let askList = ask.split(';') this.thermalCyclingInfo.max = Number(askList[askList.length-1]) @@ -2370,10 +2612,11 @@ return obj }) this.thermalCyclingInfo.arr = arr; // console.log(this.thermalCyclingInfo) // 初始化页面数据 this.thermalCyclingChange() } // 热循环检验原始记录---结束 // 本次循环主要做页面渲染层面的处理--单元格合并预处理 this.tableList.forEach(a => { let mcList = [] a.template.forEach(b => { @@ -2402,9 +2645,10 @@ count++ }) }) // 本次循环主要是控制合并,以及控制检验项信息是否展示出来,以便后续检验 this.tableList.forEach(a => { let dels = new Set() let ids = [] let dels = new Set()//需要删除的行 let ids = []//所有检验项的id let set3 = new Set() a.template.forEach(b => { let size1 = set3.size @@ -2414,6 +2658,7 @@ let count4 = 0 let isThree = 0 a.template.forEach(c => { // 获取到 检验项分类+检验项+检验子项的拼接,如果模板里的信息跟接口返回的检验项信息能够匹配则展示出来 if (b.r === c.r) { if(c.v.ps != undefined && c.v.ps.value === '检验项分类'&&count4 === 0){ // 三级分类 @@ -2466,6 +2711,7 @@ .insProduct[i].inspectionItemSubclass==null||this.currentSample .insProduct[i].inspectionItemSubclass==undefined?'':this.currentSample .insProduct[i].inspectionItemSubclass // 如果相等,那么说明找到了,并且把id存起来,后续检验项也会在页面中显示出来 if (this.currentSample.insProduct[i].templateId === a.templateId && inspectionItemClass +inspectionItem+inspectionItemSubclass === str) { ids.push({ @@ -2483,6 +2729,7 @@ } } }) // 操作删除 dels.forEach(del => { for (let b = 0; b < a.template.length; b++) { if (a.template[b].r === del) { @@ -2491,6 +2738,7 @@ } } }) // 操作赋值--主要赋值单位,试验方法等信息 ids.forEach(id => { for (let b = 0; b < a.template.length; b++) { if (a.template[b].r === id.r) { @@ -2506,6 +2754,7 @@ } }) let set2 = new Set() // 合并的数据处理,cs rs 代表合并的数量 a.template.forEach(b => { let size1 = set2.size let size2 = set2.add(b.mc).size @@ -2525,73 +2774,74 @@ } }) }) // 本次循环主要是对后端传参进行初始化,样式逻辑修改 this.tableList.forEach(a => { let arrs = [] let set = new Set() let count1 = 0 let conclusionList = []; //结论列表 let finalList = []; //最终值列表 conclusionList = a.template.filter(n => n.v.ps != undefined && n.v.ps.value === '结论') finalList = a.template.filter(n => n.v.ps != undefined && n.v.ps.value === '最终值') // 结论与最终值在这里一一对应,以下两个列表长度肯定是一样的,如果有不一样,那么多半是模板配置得问题 conclusionList = a.template.filter(n => n.v.ps != undefined && n.v.ps.value === '结论')//结论列表 finalList = a.template.filter(n => n.v.ps != undefined && n.v.ps.value === '最终值')//最终值列表 a.template.forEach( b => { if (b.v.ps != undefined && b.v.ps.value === '序号' && (b.v.mc == undefined || Object.keys(b.v.mc).length === 4)) { // 对序号进行赋值 count1++ b.v.v = count1 } if (b.v.ps != undefined && b.v.ps.value === '要求值') { // 对要求值进行赋值 b.v.v = this.getAsk(b.i) } // 对页面的和给后端传参的检验值,计算值,设备编码,设备名称,最终值,结论进行初始化 if (b.v.ps != undefined && typeof b.v.ps.value ==='string'&&b.v.ps.value.includes('检验值')) { this.$set(b.v, 'v','' ) // b.v.v = '' b.u = '' b.i && this.param[b.i].insValue.push(b) b.i && this.param[b.i]&&this.param[b.i].insValue.push(b) } if (b.v.ps != undefined && b.v.ps.value === '计算值') { this.$set(b.v, 'v','' ) // b.v.v = '' b.i && this.param[b.i].comValue.push(b) b.i && this.param[b.i]&&this.param[b.i].comValue.push(b) } if (b.v.ps != undefined && b.v.ps.value === '设备编码') { // b.v.v = '' this.$set(b.v, 'v', '' ) b.i && this.param[b.i].equipValue.push(b) b.i && this.param[b.i]&&this.param[b.i].equipValue.push(b) } if (b.v.ps != undefined && b.v.ps.value === '设备名称') { this.$set(b.v, 'v', '' ) // b.v.v = '' b.i && this.param[b.i].equipName.push(b) b.i && this.param[b.i]&&this.param[b.i].equipName.push(b) } if (b.v.ps != undefined && b.v.ps.value === '最终值') { // b.v.v = '' this.$set(b.v, 'v', '' ) /* if (b.i === undefined) { for (var c in this.param) { this.param[c].resValue = b } } else { this.param[b.i].resValue = b } */ if (b.i !== undefined&&!this.param[b.i].resValue) { if (b.i !== undefined&&this.param[b.i]&&!this.param[b.i].resValue) { this.param[b.i].resValue = b } } if (b.v.ps != undefined && b.v.ps.value === '结论') { if (b.i !== undefined&&!this.param[b.i].insResult) { if (b.i !== undefined&&this.param[b.i]&&!this.param[b.i].insResult) { this.param[b.i].insResult = b conclusionList.forEach((n, i) => { if (n.r == b.r && n.c == b.c) { b.v.f = `(${this.comparisonList.find(j=>j.value==(finalList[i].c)).label}${finalList[i].r+1})` } }) } } set.add(b.r) // 如果模板列表的函数存在,那么加入到excel函数列表里面 if (b.v.f) { this.excelMethodList.push(b) } }) // 以下是样式处理逻辑 set = Array.sort(set) set.forEach(b => { let arr = [] @@ -2608,14 +2858,17 @@ this.tableWidth += (a.style.columnlen[i] === undefined ? 100 : a.style.columnlen[i]) } }) // 本次循环主要是对页面及后端传参进行初始化赋值 this.currentSample.insProduct.forEach(async a => { try { // 计算值赋值 let comValue = JSON.parse(a.insProductResult.comValue) for (var i = 0; i < comValue.length; i++) { this.param[a.id].comValue[i].v.v = this.toFixed(comValue[i].v,this.param[a.id].comValue[i].v.ct) } } catch (e) {} try { // 检验值赋值 let insValue = JSON.parse(a.insProductResult.insValue) for (let i = 0; i < insValue.length; i++) { if(this.param[a.id].insValue.find(m=>m.c==insValue[i].c&&m.r==insValue[i].r)){ @@ -2627,8 +2880,10 @@ } } catch (e) {} try { // 设备编号赋值 let equipValue = JSON.parse(a.insProductResult.equipValue) if(this.tableLists.find(m=>m.templateId==this.currentTable)&&(this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'||this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('热循环')||this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('温升试验'))){ // 特殊项目初始化 this.param[a.id].equipValue = [] for (let i = 0; i < equipValue.length; i++) { this.param[a.id].equipValue.push({ @@ -2644,14 +2899,16 @@ this.$set(this.equipForm,`code`+i,equipValue[i].v) this.param[a.id].equipValue[i].v.v = equipValue[i].v }else{ // 普通设备赋值 this.param[a.id].equipValue[i].v.v = equipValue[i].v } } } catch (e) {} try { // 设备名称赋值 let equipName = JSON.parse(a.insProductResult.equipName) // console.log(2222222,equipName) if(this.tableLists.find(m=>m.templateId==this.currentTable)&&(this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'||this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('热循环')||this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('温升试验'))){ // 设备名称初始化 this.param[a.id].equipName = [] for (let i = 0; i < equipName.length; i++) { this.param[a.id].equipName.push({ @@ -2663,84 +2920,46 @@ } for (let i = 0; i < equipName.length; i++) { if(this.tableLists.find(m=>m.templateId==this.currentTable)&&(this.tableLists.find(m=>m.templateId==this.currentTable).templateName=='温度循环检验原始记录'||this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('热循环')||this.tableLists.find(m=>m.templateId==this.currentTable).templateName.includes('温升试验'))){ console.log(2222222,equipName) // 温度循环赋值 this.$set(this.equipForm,`value`+i,equipName[i].v) this.param[a.id].equipName[i].v.v = equipName[i].v }else{ // 普通设备名称赋值 this.param[a.id].equipName[i].v.v = equipName[i].v } } } catch (e) {} try { // 最终值赋值 this.param[a.id].resValue.v.v = this.toFixed(a.lastValue,this.param[a.id].resValue.v.ct) // 结论赋值 this.param[a.id].insResult.v.v = a.insResult } catch (e) {} }) // 对excel函数进行处理 this.handleExcelMethod() }, // 检验值输入后触发的函数 changeInput(m, code, n,getDataType) { // 为数采定义一个逻辑参数 if(getDataType=='getDataType'){ this.getDataType = 2; } // let str = code.split('-') // let pId = str[3] // if(!this.param[pId].equipValue||this.param[pId].equipValue.length==0||!this.param[pId].equipValue[0].v.v){ // let inspectionItem = '' // let idS = [] // let child = 0 // for (let i in this.currentSample.insProduct) { // if(this.currentSample.insProduct[i].id==pId){ // inspectionItem = this.currentSample.insProduct[i].inspectionItem // } // } // for (let i in this.currentSample.insProduct) { // if(this.currentSample.insProduct[i].inspectionItem==inspectionItem&&this.currentSample.insProduct[i].id!=pId){ // idS.push(this.currentSample.insProduct[i].id) // } // } // for (let i = 0;i<idS.length;i++) { // if(this.param[idS[i]].equipValue&&this.param[idS[i]].equipValue.length>0&&this.param[idS[i]].equipValue[0].v.v){ // child++ // } // } // if(child==0){ // n.v.v = null // this.$message.error('请先填写设备信息') // return // } // } let str = code.split('-') let pId = str[3] for(let i =0;i<this.currentSample.insProduct.length;i++){ if(this.currentSample.insProduct[i].id==pId&&(this.currentSample.insProduct[i].ask=='-'||this.currentSample.insProduct[i].ask=='/'||this.currentSample.insProduct[i].ask=='—')){ this.tableList[0].arr.forEach(item=>{ item.forEach(m=>{ if(m.i==pId&&m.v.ps&&m.v.ps.value=='结论'){ this.$set(m.v,'v',3) } }) }) if(this.param[pId].insResult&&this.param[pId].insResult.v){ this.param[pId].insResult.v.v = 3 } this.saveInsContext() return } } // this.currentTable. // if(!this.param[pId].equipValue||this.param[pId].equipValue.length==0||!this.param[pId].equipValue[0].v.v){} if (n) { // if (this.PROJECT === '装备电缆') { // let num2 = new this.$Big(n.v.v) // n.v.v = num2.toExponential() // } // 需要科学计数法的可以走这里 if (this.PROJECT === '检测中心') { if(this.tableList.find(ele=>ele.inspectionItem=='体积电阻率')){ if(parseFloat(n.v.v)>=100000){ let num2 = new this.$Big(n.v.v) n.v.v = num2.toExponential() } } } // 定义一个函数来验证分数是否有效 function isValidFraction(fraction) { const [numerator, denominator] = fraction.split('/'); // 分子和分母 return !(!denominator || !numerator); } console.log("aaa------>>>>",n); const isTrue = isValidFraction(n.v.v) if (!isTrue) { n.v.v = n.v.v.replace('/', '') @@ -2768,10 +2987,12 @@ this.result = JSON.parse(event.data); switch (this.result.method){ case 'saveInsContext': console.log(`output->`,11111111111111) this.$nextTick(()=>{ // this.$delete(this.tableList[0],'arr') this.$set(this.tableList[0],'arr',this.result.value.tableList[0].arr) this.param = this.result.value.param // 特殊处理一下结论,会有这种特殊情况 for (var i in this.param){ if(this.param[i].insResult&&this.param[i].insResult.v&&this.param[i].insResult.v.v){ if(this.param[i].insResult.v.v=='合格'){ @@ -2781,60 +3002,55 @@ } } } console.log(99999,this.result.value.getDataTypeId) if(this.isGet&&!this.dataAcquisitionEidtAble){ if(this.result.value.getDataTypeId==''){ return } setTimeout(()=>{ this.saveInsContext() },2000) }else if(this.isGet&&this.dataAcquisitionEidtAble){ if(this.getDataType==1){ // 如果是数采可编辑输入的情况,可以直接保存数据 if(this.getDataType==2){ this.saveInsContext() }else{ if(this.isGet&&!this.dataAcquisitionEidtAble){ if(this.result.value.getDataTypeId==''){ // 如果是数采不可编辑输入的情况,且最后一个数采没有完成,则不保存数据 return } // 保存数据 setTimeout(()=>{ this.saveInsContext() },2000) }else if(this.isGet&&this.dataAcquisitionEidtAble){ if(this.getDataType==1){ if(this.result.value.getDataTypeId==''){ // 如果是数采可编辑输入的情况,且最后一个数采没有完成,则不保存数据 return } this.saveInsContext() }else{ this.saveInsContext() } }else{ this.saveInsContext() } }else{ this.saveInsContext() } }) break; case 'tableList': this.$nextTick(()=>{ // 更新数据 this.$delete(this.tableList[0],'arr') this.$set(this.tableList[0],'arr',this.result.value[0].arr) }) break; case 'getCurrentInsProduct': // 更新页面数据 this.getCurrentInsProduct(this.result.value) break; } }; }, // 是否需要数采 async determineWhetherToCollectData(){ let res = await this.$axios.get(this.$api.deviceScope.determineWhetherToCollectData+"?managementNumber=''") this.isGet = res.data }, handleFraction(str){ if(str&&typeof(str)=='string'&&str.includes('/')){ return eval(str.split('/')[0]/str.split('/')[1]) } else if (str && typeof(str) == 'string' && str.includes('*') && str.includes('^')) { const num1 = str.split('*') const num2 = num1[1].split('^') let num3 = new this.$Big(num2[0]); let num4 = new this.$Big(num2[1]); let num5 = Math.pow(num3, num4) // 计算次方 return num1[0] * num5 // 最后计算乘法 } else{ return str } }, // 根据后端传参更新页面数据 param => this.tableList[0].insProductResult getCurrentInsProduct(pId) { if (!this.tableList[0].insProductResult) { this.tableList[0].insProductResult = {} @@ -2843,6 +3059,7 @@ let value = this.param[pId][m] switch (m) { case 'comValue': // 赋值计算值 if (value && value.length > 0) { this.tableList[0].insProductResult[m] = []; value.forEach((a, i) => { @@ -2858,6 +3075,7 @@ } } break; // 赋值检验值 case 'insValue': if (value && value.length > 0) { this.tableList[0].insProductResult[m] = []; @@ -2875,6 +3093,7 @@ } } break; // 赋值设备编号 case 'equipValue': if (value && value.length > 0) { this.tableList[0].insProductResult[m] = []; @@ -2891,6 +3110,7 @@ } } break; // 赋值设备名称 case 'equipName': if (value && value.length > 0) { this.tableList[0].insProductResult[m] = []; @@ -2907,39 +3127,31 @@ } } break; // 赋值最终值 case 'resValue': this.tableList[0].lastValue = value?value.v.v:'' break; // 赋值结论 case 'insResult': this.tableList[0].insResult = value?value.v.v:'' break; } } }, // 对EXCEL函数进行处理 handleExcelMethod() { if (this.excelMethodList.length > 0) { this.excelMethodList.map(item => { // 得到每个函数的参数列表 item.valueList = excelFunction.changeParameter(item.v.f); return item; }) } }, median(arr) { // 对数组进行排序 const sortedArr = arr.sort((a, b) => a - b); // 计算数组长度的一半 const half = Math.floor(sortedArr.length / 2); // 如果数组长度为奇数,返回中间的元素;如果为偶数,返回中间两个元素的平均值 if (sortedArr.length % 2) { // 奇数位置的元素 return sortedArr[half]; } else { // 偶数位置的平均值 return (sortedArr[half - 1] + sortedArr[half]) / 2; } }, getValue(v){ // 对页面展示数据进行处理,@,代表换行 let str = v.v?v.v:(v.v===0?v.v:(v.ct&&v.ct.s?v.ct.s.length>0&&v.ct.s[0].v.replace(new RegExp('\n', 'g'), '<br/>').replace(new RegExp('@', 'g'), '<br/>'):'')) // 对数据保留小数点进行处理 if(v.ct&&v.ct.fa&&v.ct.fa.includes('.')&&str){ let num = 0 let str0 = v.ct.fa.split('.')[1] @@ -2951,6 +3163,7 @@ } return str }, // 获取当前输入框类型 getInspectionValueType(id) { for (var a in this.currentSample.insProduct) { if (this.currentSample.insProduct[a].id == id) { @@ -2958,6 +3171,7 @@ } } }, // 获取要求描述 getTell(id) { for (var a in this.currentSample.insProduct) { if (this.currentSample.insProduct[a].id == id) { @@ -2965,6 +3179,7 @@ } } }, // 动态获取单元格宽度 handleWidth(n) { let sum = 0; if (n.v.mc && n.v.mc.cs && n.v.mc.c != undefined) { @@ -2977,6 +3192,7 @@ } return sum }, // 对输入值进行格式校验 handleInput (n) { try { n.v.v = n.v.v.replace(/[^\d.^e\-/+]/g, ''); @@ -2996,6 +3212,7 @@ } } }, // 获取要求值 getAsk(id) { for (var a in this.currentSample.insProduct) { if (this.currentSample.insProduct[a].id == id) { @@ -3033,6 +3250,7 @@ } } */ }, // 获取设备 getEquipOptions(e, id) { if (e) { this.equipOptions = [] @@ -3195,12 +3413,14 @@ }) return }, // 统一在这里保存数据 saveInsContext() { try { console.log(1111,this.param) if(this.param){ this.$axios.post(this.$api.insOrderPlan.saveInsContext, { param: JSON.stringify(this.param) param: JSON.stringify(this.param), currentTable:this.currentTable }).then(res => { if (res.code == 201) { this.$message.error('保存失败') @@ -3220,6 +3440,7 @@ console.log(999,error); } }, // 设备改变 changeEquip(val, n,v) { this.$set(n.v,'v',val) this.tableList[0].arr.forEach((item,index)=>{ @@ -3266,6 +3487,7 @@ } } } // 保存数据 this.saveInsContext() }, getAuthorizedPerson() { @@ -3310,6 +3532,7 @@ flag = false; }); }, // 页面里面切换样品 async caretSample(num){ let index = this.currentKey + num if(index < 1){ @@ -3321,11 +3544,13 @@ } this.currentKey = index this.currentSample = this.HaveJson(this.sampleProduct[index - 1]) // 获取检验项 let list = await this.getCurrentProduct(this.currentSample.id,0) this.currentSample.insProduct = this.HaveJson(list) // 初始化后端传参 this.param = {} this.changeType = 0; this.currentSample.insProduct.forEach(a => { this.currentSample.insProduct.forEach((a, j) => { if(this.handleCasing(a.inspectionItem)){ this.param[a.id] = { insValue: [], @@ -3337,7 +3562,9 @@ } } }) // 页面数据处理 this.getTableLists() // 更新到多线程 this.worker.postMessage(JSON.stringify({ type: 'saveData', tableList:this.tableList, src/components/tool/value-table.vue
@@ -116,7 +116,7 @@ <el-table ref="eltable" :data="tableData" style="width: 100%;" height="100%" tooltip-effect="dark" border @selection-change="selectChange" @select="select" v-loading="loading" @sort-change="sortChange" @row-click="rowClick" :show-summary="data.countFleid!=undefined && data.countFleid.length > 0" :summary-method="getSummaries" :row-class-name="tableRowClassName" :row-key="record=>record.id" :summary-method="getSummaries" :row-class-name="tableRowClassName" :row-key="record=>record[rowKey]" :current-row-key="data.currentId" :highlight-current-row="data.highlight===undefined||data.highlight" :span-method="spanMethod" :key="specialKey"> <el-table-column type="selection" :width="selectionWidth" v-if="data.showSelect" :key="Math.random()"> @@ -359,6 +359,12 @@ tableRowClassName: { type: Function }, rowKey: { type: String, default: ()=>{ return 'id' } }, url: { type: String, default: () => null src/components/view/b1-inspect-order-plan.vue
@@ -205,7 +205,7 @@ <Inspection v-if="state>0" @goback="goback" :orderId="orderId" :inspectorList="inspectorList" :sonLaboratory="componentData.entity.sonLaboratory" :state="state"/> <el-dialog title="数据查看" :visible.sync="dataDialogVisible" width="80%"> <div style="height: 70vh;overflow-y: auto;" v-if="dataDialogVisible"> <ValueTable ref="ValueTableDataLook" :url="$api.insOrder.selectSampleAndProductByOrderId" <ValueTable ref="ValueTableDataLook" :rowKey="'insProductId'" :url="$api.insOrder.selectSampleAndProductByOrderId" :componentData="componentDataDataLook"/> </div> </el-dialog> @@ -265,6 +265,10 @@ value: 0, label: '不合格', type: 'danger' },{ value: 3, label: '不判定', type: '' }] } }, src/components/view/b1-inspection-order.vue
@@ -321,7 +321,7 @@ </el-dialog> <el-dialog title="数据查看" :visible.sync="dataDialogVisible" width="80%"> <div style="height: 70vh;overflow-y: auto;" v-if="dataDialogVisible"> <ValueTable ref="ValueTableDataLook" :url="$api.insOrder.selectSampleAndProductByOrderId" <ValueTable ref="ValueTableDataLook" :rowKey="'insProductId'" :url="$api.insOrder.selectSampleAndProductByOrderId" :componentData="componentDataDataLook"/> </div> </el-dialog> @@ -644,6 +644,10 @@ value: 0, label: '不合格', type: 'danger' },{ value: 3, label: '不判定', type: '' }] } }, src/components/view/b2-standard.vue
@@ -190,7 +190,7 @@ style="height:calc(100% - 30px);overflow-y: scroll;scrollbar-width: none;"> <div class="custom-tree-node" slot-scope="{ node, data }"> <el-row style="width: 100%;"> <el-col :span="21" :class="{sort:node.level>3}" :title="data.label"> <el-col :span="21" :class="{sort:node.level>3}" :title="data.label" style="text-align: left;"> <span> <i :class="`node_i ${data.children != undefined ? (data.code==='[1]'?'el-icon-folder-opened':'el-icon-folder') : 'el-icon-tickets'}`"></i> {{ data.label }} src/components/view/notice-detail.vue
@@ -1,8 +1,8 @@ <template> <div class="notice-detail-page"> <div class="notice-detail-head"> <h4 style="margin-bottom: 16px;" v-if="noticeInfo.theme">{{ noticeInfo.theme }} <el-tag style="margin-left: 10px;" :type="options.find(m=>m.value==noticeInfo.messageType).type" v-if="options.find(m=>m.value==noticeInfo.messageType)">{{ options.find(m=>m.value==noticeInfo.messageType).label }}</el-tag></h4> <p style="font-size: 12px;color: #999;margin-bottom: 20px;"> <h4 style="margin-bottom: 16px;text-align:left;" v-if="noticeInfo.theme">{{ noticeInfo.theme }} <el-tag style="margin-left: 10px;" :type="options.find(m=>m.value==noticeInfo.messageType).type" v-if="options.find(m=>m.value==noticeInfo.messageType)">{{ options.find(m=>m.value==noticeInfo.messageType).label }}</el-tag></h4> <p style="font-size: 12px;color: #999;margin-bottom: 20px;text-align:left;"> <!-- <span>消息类型:审批 </span> --> <span>发送人:{{ noticeInfo.createUser }} </span> <span> </span> @@ -10,7 +10,7 @@ <span> </span> <span>发件时间:{{ noticeInfo.createTime }}</span> </p> <div class="notice-detail-head-content"> <div class="notice-detail-head-content" style="text-align:left;"> <label>内容:</label> <div>{{ noticeInfo.content }}</div> </div> src/components/view/person-manage.vue
@@ -130,7 +130,7 @@ @node-collapse="nodeClose" v-loading="treeLoad" :expand-on-click-node="false" default-expand-all> <div class="custom-tree-node" slot-scope="{ node, data }"> <el-row style="width: 100%;"> <el-col :span="21" :class="{sort:node.level>3}"> <el-col :span="21" :class="{sort:node.level>3}" style="text-align: left;"> <span><i :class="`node_i ${data.children != undefined&&data.children.length>0 ? 'el-icon-folder-opened' : 'el-icon-tickets'}`"></i> {{ data.name }}</span> src/components/view/role-manage.vue
@@ -64,14 +64,14 @@ <el-dialog :title="type" :visible.sync="addDia" width="550px" @closed="closed"> <div style="max-height: 550px;overflow-y: auto;padding: 10px 20px;" v-if="addDia"> <el-row style="line-height: 42px;"> <el-col :span="7" style="font-size: 14px;"><span class="required-span">* </span>角色名</el-col> <el-col :span="7" style="font-size: 14px;text-align: left;"><span class="required-span">* </span>角色名</el-col> <el-col :span="17"> <el-input v-model="addData.roleName" size="medium" placeholder="需唯一角色名" clearable :disabled="type=='查看'"></el-input> </el-col> </el-row> <el-row style="line-height: 42px;margin-bottom: 20px;"> <el-col :span="7" style="font-size: 14px;"><span class="required-span">* </span>角色分类</el-col> <el-col :span="7" style="font-size: 14px;text-align: left;"><span class="required-span">* </span>角色分类</el-col> <el-col :span="17"> <el-select v-model="addData.category" size="medium" :disabled="type=='查看'" style="width: 100%;"> <el-option v-for="(a, i) in deaprtEnum" :key="i" :label="a.name" :value="a.id"></el-option> src/main.js
@@ -18,13 +18,12 @@ Vue.prototype.PROJECT = '检测中心' // Vue.prototype.PROJECT = '装备电缆' //本地 // Vue.prototype.LOCATIONVUE = "http://10.193.48.211:80"; // const javaApi = 'http://10.193.48.211:8001'; const javaApi = 'http://127.0.0.1:8001'; // Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80"; // const javaApi = 'http://127.0.0.1:8001'; // const javaApi = 'http://192.168.0.104:8001'; //云 // Vue.prototype.LOCATIONVUE = "http://114.132.189.42:8080"; // const javaApi = 'http://114.132.189.42:1234'; const javaApi = 'http://114.132.189.42:1234'; // //检测中心正式库 // Vue.prototype.LOCATIONVUE = "http://10.1.200.86:8080"; @@ -34,10 +33,6 @@ // Vue.prototype.LOCATIONVUE = "http://10.16.173.59"; // const javaApi = 'http://10.16.173.59:8001'; // const javaApi = 'http://192.168.92.249:8001'; // 通信中心正式库 // Vue.prototype.LOCATIONVUE = "http://10.1.13.77:8080"; // const javaApi = 'http://10.1.13.77:8001'; Vue.prototype.HaveJson = (val) => { return JSON.parse(JSON.stringify(val)) @@ -130,19 +125,11 @@ return Promise.reject(err) }) router.beforeEach(async(to, from, next) => { router.beforeEach((to, from, next) => { if(to.path.indexOf('/test') == 0){ next() return } // 浪潮系统登录逻辑 // if(to.query.code) { // await axios({ // url: javaApi + "/tide/tideLogin", // method: 'post', // data: {code: to.query.code} // }) // } if (to.path.indexOf('/enter') != 0) { if (sessionStorage.getItem('token') == null || sessionStorage.getItem('token') == '' || sessionStorage.getItem( 'token') == undefined) { @@ -163,3 +150,4 @@ Vue.prototype.$bus = this } }); src/view/enter.vue
@@ -111,7 +111,7 @@ <el-input v-model="ruleForm.pwd" placeholder="请输入密码" clearable show-password @keyup.enter.native="submitForm('ruleForm')"></el-input> </el-form-item> <el-form-item style="margin-bottom: 8px;"> <el-col :span="12"><el-checkbox v-model="ruleForm.remumberme">记住密码</el-checkbox></el-col> <el-col :span="12" style="text-align: left;"><el-checkbox v-model="ruleForm.remumberme">记住密码</el-checkbox></el-col> <el-col :span="12" style="text-align: right;"><el-checkbox v-model="ruleForm.autoenter">自动登录</el-checkbox></el-col> </el-form-item> src/view/index.vue
@@ -357,11 +357,11 @@ <el-col :span="24"> <el-card :body-style="{padding: '6px'}"> <ul> <li @click="removeTab(activeIndex)" v-show="menuId!=0"><i class="el-icon-close"></i>关闭</li> <li @click="allDel"><i class="el-icon-delete"></i>关闭所有</li> <li @click="rightDel(activeIndex)"><i class="el-icon-d-arrow-right"></i>关闭右侧页签</li> <li @click="removeTab(activeIndex)" v-show="menuId!=0" style="text-align: left;"><i class="el-icon-close"></i>关闭</li> <li @click="allDel" style="text-align: left;"><i class="el-icon-delete"></i>关闭所有</li> <li @click="rightDel(activeIndex)" style="text-align: left;"><i class="el-icon-d-arrow-right"></i>关闭右侧页签</li> <el-divider></el-divider> <li @click="refreshTable"><i class="el-icon-refresh"></i>刷新</li> <li @click="refreshTable" style="text-align: left;"><i class="el-icon-refresh"></i>刷新</li> </ul> </el-card> </el-col> src/view/notice.vue
@@ -228,6 +228,7 @@ >>>.el-drawer__header { color: #303133; text-align: left; } >>>.el-drawer__body{ height: calc(100vh - 82px); static/js/worker.js
@@ -1,30 +1,45 @@ // 多线程里面需要保存的数据 let code = '' // 表格数据(渲染) let tableList = null // 方法列表 let excelMethodList = [] // excel坐标比较列表 let comparisonList = [] // 当前样品信息 let currentSample = {} // 当前项目:检测中心、装备电缆 let PROJECT = '' // 套管 let bushing = '' // 多线程传递到主线程的数据 let result = { method:'', value:null } // 保存时传到后端参数 let param = null // 当前的模板 let currentTable = '' // 优化数采较多数据时-记录最后一个检验项的id let getDataTypeId = null // 接收到主线程处理逻辑的消息 self.onmessage = function(event) { // 保存主线程传过来的值 const data = JSON.parse(event.data); if(currentTable!=data.currentTable){ // 检验模板改变后需要刷新表格 tableList = data.tableList; } currentTable = data.currentTable; if(data.type&&data.type=='saveData'){ // 更新表格数据和传递到后端的参数 tableList = data.tableList; param = data.param; return } if(data.bushing&&(data.bushing!=bushing)&&data.type=='saveData'){ // 更新表格数据、传递到后端的参数和套管数据 tableList = data.tableList; param = data.param; bushing = data.bushing; @@ -32,11 +47,13 @@ } code = data.code; if(data.getDataTypeId){ // 记录 优化数采较多数据时-记录最后一个检验项的id getDataTypeId = data.getDataTypeId }else{ getDataTypeId = null } if(tableList){ // 如果表格数据存在,则更新当前修改检验项的表格数据 let str = code.split('-') let r = str[1] let c = str[2] @@ -48,48 +65,56 @@ }) }) }else{ // 如果初始化表格数据不存在,直接赋值 tableList = data.tableList; } if(param){ // 如果传递到后端的参数存在,则更新当前修改检验项的传递到后端的参数 let str = code.split('-') let pId = str[3] param[pId] = data.param[pId] }else{ // 初始化传递到后端的参数 param = data.param; } // tableList = data.tableList; // param = data.param; // 更新方法列表、坐标比较列表、当前样品信息、项目 excelMethodList = JSON.parse(JSON.stringify(data.excelMethodList)); comparisonList = JSON.parse(JSON.stringify(data.comparisonList)); currentSample = JSON.parse(JSON.stringify(data.currentSample)); PROJECT = data.PROJECT // 执行计算方法 changeInput('', code); }; function changeInput(m, code){ let str = code.split('-') let r = str[1] let c = str[2] let r = str[1]//当前行 let c = str[2]//当前列 let id = str[0] let pId = str[3] var list = [] let pId = str[3]//当前检验项id,param[pId]为当前检验项的所有值,包含:过程值insValue、计算值comValue、设备编码equipValue、设备名称equipName、最终值resValue、结论insResult var list = []//一个双层数组,里面保存有当前页面渲染的所有数据 // 赋值当前模板的表格数据 for (let a in tableList) { if (tableList[a].templateId == id) { list = tableList[a].arr break } } let isToExponential = '' let list2 = [] let isPoint = '' let isToExponential = ''//是否为科学计数法 let list2 = [] //一个数组,里面保存有当前检验项的所有参数值 let isPoint = '' //是否为小数点 // 循环所有excel方法,找到当前行、列的检验项,如果此单元格(r,c)是某个excel方法里面的参数,则执行此方法 excelMethodList.forEach(item => { // item.valueList 是当前excel方法的参数列表,找到当前填入的值是否是参数 if (item.valueList&&item.valueList.length>0&&item.valueList.find(m => m.r == r && m.c == c)) { // 如果是,则定义一个参数的对象集合,用于保存当前excel方法参数的值 var comValue = {} item.valueList.forEach(a => { list.forEach(b => { if (b[0].r == a.r) { b.forEach(c => { if (c.c == a.c) { // 获取当前参数的Execl行坐标(ABCD)等等 var tableCode = '' for (var d in comparisonList) { if (c.c == comparisonList[d].value) { @@ -98,14 +123,18 @@ } } list2.push(c.v.v) // 组装参数的对象集合并赋值,列如{A3:12,B4:15} if(getInspectionValueType(item.i)==1&&!isNaN(parseFloat(c.v.v))){ // 如果是数字输入框 let n = String(c.v.v) if(n.includes('/')){ // 如果是分数,则赋值 comValue[(tableCode + (c.r + 1))] = c.v.v }else{ comValue[(tableCode + (c.r + 1))] = parseFloat(c.v.v) } }else{ // 如果是文本、下拉框等等 comValue[(tableCode + (c.r + 1))] = c.v.v } } @@ -113,12 +142,16 @@ } }) }) // 如果此excel方法是结论判断方法,则执行此方法 if (item.v.ps != undefined && item.v.ps.value == '结论') { try { if (currentSample.insProduct.find(m => m.id == item.i)) { // 如果当前检验项是产品检验项,则执行此方法,找到此检验项的要求值 let ask = currentSample.insProduct.find(m => m.id == item.i).ask?currentSample.insProduct.find(m => m.id == item.i).ask.split('&'):null; // 获取当前结论的参数,也就是当前检验项的最终值 let res = Object.values(comValue)[0] let comp = [] // 判断当前结论的参数(当前检验项的最终值)是否为空,如果为空,则直接赋值 if(res===''||res===null||res===undefined||res==='Infinity'){ item.v.v = null list.forEach(a => { @@ -132,185 +165,209 @@ } }) }else{ // console.log(ask,res,item.v.f) if(ask){ comp = ask.map((m, i) => { // console.log('m----', m) if (m.includes('RTS')) { m = m.replace('RTS*', '') // 如果不为空,则判断当前结论就需要进行判断 //要求值为-,/,—,则结论设置为不判定,结论赋值为3 if(ask[0]=='-' || ask[0]=='/' || ask[0]=='—'){ item.v.v = 3 list.forEach(a => { if (a[0].r == item.r) { for (let b=0; b<a.length; b++) { if (a[b].c == item.c) { a[b].v.v = 3 break } } } if (m.includes('=')) { let str = handleFraction(m.split('=')[1]) if(typeof res == 'string'&&typeof str == 'string'){ if(res.includes('/')){ if (m.includes('/')) { return eval(res) == eval(str) } else { return handleMoreParam(res,m.split('=')[1],'=') }) }else{ // 要求值不为-,/,—,则进行判断 if(ask){ // 循环要求值列表,判断当前结论的参数是否符合要求 comp = ask.map((m, i) => { // 装备特有的判断方法(需要科学计数法的),要求值进行替换 if (m.includes('RTS')) { m = m.replace('RTS*', '') } // 如果要求值包含=,则判断当前结论的参数是否等于要求值, // 以下判断基本一致,只是判断类型不一样,就不做注释了 if (m.includes('=')) { // 处理要求值 let str = handleFraction(m.split('=')[1]) if(typeof res == 'string'&&typeof str == 'string'){ // 如果要求值和当前结论的参数都是字符串,则执行 if(res.includes('/')){ // 如果结论的参数是分数,则判断 if (m.includes('/')) { // 如果要求值是分数,则判断 return eval(res) == eval(str) } else { // 如果要求值不是分数,则判断 return handleMoreParam(res,m.split('=')[1],'=') } }else{ // 如果结论的参数不是分数,则判断 return res.trim().replace(/[.,。、;:'";??“,]/g, '') == str.trim().replace(/[.,。、;:'";??“,]/g, '') } }else{ // console.log(res.trim().replace(/[.,。、;:'";??“,]/g, ''),' == ',str.trim().replace(/[.,。、;:'";??“,]/g, '')) return res.trim().replace(/[.,。、;:'";??“,]/g, '') == str.trim().replace(/[.,。、;:'";??“,]/g, '') // 如果要求值和当前结论的参数有一个是数字,则执行 return eval(res) == eval(str) } }else{ return eval(res) == eval(str) } } else if (m.includes('≥')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { // console.log('eval(res)----', eval(res)) } else if (m.includes('≥')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { let str = handleFraction(m.split('≥')[1]) return eval(res) >= eval(str) } else { return handleMoreParam(res,m.split('≥')[1],'≥') } }else{ let str = handleFraction(m.split('≥')[1]) // console.log('eval(str)----', eval(str)) return eval(res) >= eval(str) } else { return handleMoreParam(res,m.split('≥')[1],'≥') } }else{ let str = handleFraction(m.split('≥')[1]) return eval(res) >= eval(str) } }else if (m.includes('≤')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { }else if (m.includes('≤')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { let str = handleFraction(m.split('≤')[1]) return eval(res) <= eval(str) } else { return handleMoreParam(res,m.split('≤')[1],'≤') } }else{ let str = handleFraction(m.split('≤')[1]) return eval(res) <= eval(str) } else { return handleMoreParam(res,m.split('≤')[1],'≤') } }else{ let str = handleFraction(m.split('≤')[1]) console.log(555555,res,str) return eval(res) <= eval(str) } }else if (m.includes('<')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { }else if (m.includes('<')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { let str = handleFraction(m.split('<')[1]) return eval(res) < eval(str) } else { return handleMoreParam(res,m.split('<')[1],'<') } }else{ let str = handleFraction(m.split('<')[1]) return eval(res) < eval(str) } else { return handleMoreParam(res,m.split('<')[1],'<') } }else{ let str = handleFraction(m.split('<')[1]) return eval(res) < eval(str) } }else if (m.includes('>')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { }else if (m.includes('>')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { let str = handleFraction(m.split('>')[1]) return eval(res) > eval(str) } else { return handleMoreParam(res,m.split('>')[1],'>') } }else{ let str = handleFraction(m.split('>')[1]) return eval(res) > eval(str) } else { return handleMoreParam(res,m.split('>')[1],'>') } }else{ let str = handleFraction(m.split('>')[1]) return eval(res) > eval(str) } }else if (m.includes('~')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { }else if (m.includes('~')) { if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { let k = m.split('~') return eval(res) >= eval(handleFraction((k[0]))) && eval(res) <= eval(handleFraction(k[1])) } else { return handleMoreParam(res,m,'~') } }else{ let k = m.split('~') return eval(res) >= eval(handleFraction((k[0]))) && eval(res) <= eval(handleFraction(k[1])) } else { return handleMoreParam(res,m,'~') } }else{ let k = m.split('~') return eval(res) >= eval(handleFraction((k[0]))) && eval(res) <= eval(handleFraction(k[1])) } }else if(m.includes('-')){ if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { }else if(m.includes('-')){ if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { let k = m.split('-') return eval(res) >= eval(handleFraction(k[0])) && eval(res) <= eval(handleFraction(k[1])) } else { return handleMoreParam(res,m,'-') } }else{ let k = m.split('-') // console.log(k,eval(res),eval(res) >= eval(handleFraction(k[0])) && eval(res) <= eval(handleFraction(k[1]))) return eval(res) >= eval(handleFraction(k[0])) && eval(res) <= eval(handleFraction(k[1])) } else { return handleMoreParam(res,m,'-') } }else{ let k = m.split('-') // console.log(k,eval(res),eval(res) >= eval(handleFraction(k[0])) && eval(res) <= eval(handleFraction(k[1]))) return eval(res) >= eval(handleFraction(k[0])) && eval(res) <= eval(handleFraction(k[1])) } }else if(m.includes('±')){ if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { }else if(m.includes('±')){ if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { let k = m.split('±') return eval(res) >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && eval(res) <= eval(Number((handleFraction(k[0])) + Number(handleFraction(k[1])))) } else { return handleMoreParam(res,m,'±') } }else{ let k = m.split('±') return eval(res) >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && eval(res) <= eval((handleFraction(k[0]) + handleFraction(k[1]))) } else { return handleMoreParam(res,m,'±') return eval(res) >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && eval(res) <= eval(Number((handleFraction(k[0]) )+ Number(handleFraction(k[1])))) } }else{ let k = m.split('±') return eval(res) >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && eval(res) <= eval((handleFraction(k[0]) + handleFraction(k[1]))) } }else if(m.includes('>')){ if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { }else if(m.includes('>')){ if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { let str = handleFraction(m.split('>')[1]) return eval(res) > eval(str) } else { return handleMoreParam(res,m.split('>')[1],'>') } }else{ let str = handleFraction(m.split('>')[1]) return eval(res) > eval(str) } else { return handleMoreParam(res,m.split('>')[1],'>') } }else{ let str = handleFraction(m.split('>')[1]) return eval(res) > eval(str) } }else if(m.includes('<')){ if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { }else if(m.includes('<')){ if(typeof res =='string'&&res.includes('/')){ if (m.includes('/')) { let str = handleFraction(m.split('<')[1]) return eval(res) < eval(str) } else { return handleMoreParam(res,m.split('<')[1],'<') } }else{ let str = handleFraction(m.split('<')[1]) return eval(res) < eval(str) } else { return handleMoreParam(res,m.split('<')[1],'<') } }else{ let str = handleFraction(m.split('<')[1]) return eval(res) < eval(str) } } }) }) } // 如果要求值的每个条件都符合,则给结论赋值为1,合格 if (comp.every(m => m)) { item.v.v = 1 list.forEach(a => { if (a[0].r == item.r) { for (let b=0; b<a.length; b++) { if (a[b].c == item.c) { a[b].v.v = 1 break } } } }) }else { // 否则给结论赋值为0,不合格 item.v.v = 0 list.forEach(a => { if (a[0].r == item.r) { for (let b=0; b<a.length; b++) { if (a[b].c == item.c) { a[b].v.v = 0 break } } } }) } } if (comp.every(m => m)) { item.v.v = 1 list.forEach(a => { if (a[0].r == item.r) { for (let b=0; b<a.length; b++) { if (a[b].c == item.c) { a[b].v.v = 1 break } } } }) } else { item.v.v = 0 list.forEach(a => { if (a[0].r == item.r) { for (let b=0; b<a.length; b++) { if (a[b].c == item.c) { a[b].v.v = 0 break } } } }) } // console.log(5555,tableList) } // console.log('1234567789', tableList,getParam()) // console.log('1234567789', item) let getDataType0 = false // 优化数采较多数据时-记录最后一个检验项的id,如果当前检验项的id与记录的id相同,则多传一个参数到主线程,进行数据保存,否则数采就不进行保存 if(item.i==getDataTypeId){ getDataType0 = true } // 赋值传递到主线程的数据,method:saveInsContext表示此消息需要保存数据 result = { method:'saveInsContext', value:{ tableList, param:getParam(), tableList,// 表格数据 param:getParam(),//传给后端的参数 getDataTypeId:getDataType0?getDataTypeId:'' } } // 发消息给主线程 self.postMessage(JSON.stringify(result)) } } catch (error) { @@ -318,27 +375,36 @@ } } else { let comResult = '' // 如果是函数方法,则执行此方法 let comResult = ''//初始化计算结果 try { if(getInspectionValueType(item.i)==1){ // 如果检验值类型是数字输入框 let tell = currentSample.insProduct.find(m => m.id == item.i).tell?currentSample.insProduct.find(m => m.id == item.i).tell.split('&'):null; isPoint = PROJECT=='装备电缆'&&tell&&tell.length>0&&typeof tell[0] =='string'&&tell[0].includes('/') // 判断要求值是否为分数 isPoint = PROJECT=='装备电缆'&&tell&&tell.length>0&&typeof tell[0] =='string'&&tell[0].includes('/') // 装备电缆--判断要求值是否为分数 // 根据输入的数值,进行计算 comResult = compute(item.v.f.replace(/=/g, ' '),comValue, isPoint) let list3 = list2.map(item=>item+'') // 判断是否为科学计数法,如果为科学计数法,则进行转化 isToExponential = list3.some(val => val.includes('e+')||val.includes('e-')) // 装备项目检验值转化 if (PROJECT === '装备电缆' && isToExponential) { // 检验值转化 let findProduct = currentSample.insProduct.find(i=>i.inspectionItem=='体积电阻率') // 判断检验项是否为体积电阻率,如果为体积电阻率且大于100000,则进行转化 if (findProduct && isToExponential && comResult>=100000) { let num2 = new Big(comResult) comResult = num2.toExponential(1) } }else{ // 如果检验值类型是文本输入框、下拉框 let valueList = []; // 处理excel函数参数列表 item.valueList.forEach(a => { valueList.push({ name: `${comparisonList.find(e=>e.value==a.c).label}${a.r+1}`, value: 0, }) }) // 给excel函数参数赋文本值 for (var a in comValue) { valueList.forEach(b => { if (b.name == a) { @@ -346,37 +412,44 @@ } }) } // 计算公式,去掉excel函数的等号,并替换参数,列如:=A1 变成 A1 变成 ‘文本输入的值’ let str = item.v.f.replace(/=/g, ' ') valueList.forEach(b => { str = str.replace(b.name, b.value) }) // 计算结果赋值 comResult = str } } catch (error) { console.log('error---', error) } try { // 循环表格数据,给表格数据进行赋值 list.forEach(a => { if (a[0].r == item.r && comResult !== '') { // 判断当前行是否为当前检验项所在行,如果为当前行,则给表格数据赋值 for (var b in a) { if (a[b].c == item.c) { try{ if(comResult==0){ // 判断计算结果是否为0,如果为0,则给表格数据赋值为0 a[b].v.v = 0 }else if(a[b].v.ct&&a[b].v.ct.fa&&typeof a[b].v.ct.fa == 'string'&&a[b].v.ct.fa.includes('.')){ // 判断当前单元格是否保留小数点,如果为保留小数点,则给表格数据赋值为保留小数点,这个是根据模板配置小数点来的 let num = 0 let str = a[b].v.ct.fa.split('.')[1] num = str.length a[b].v.v = comResult?Number(comResult).toFixed(num):comResult }else if(typeof comResult == 'string' && (comResult.includes('e+')|| comResult.includes('e-'))){ // 判断计算结果是否为科学计数法,如果为科学计数法,则给表格数据赋值为科学计数法 a[b].v.v = comResult }else{ // 判断计算结果是否为数字,如果为数字,则给表格数据赋值为数字 let val = parseFloat(Number(comResult).toFixed(3)) a[b].v.v = isNaN(val) ? comResult : val } // console.log('a[b].v.ct', comResult) // console.log('a[b].v.v', a[b]) }catch(error){ // 如果以上判断都不支持,则直接赋值 a[b].v.v = comResult console.log('error---', error) } @@ -385,6 +458,7 @@ } } }) // 如果此计算结果所属单元格,同时也是另一个excel函数的参数,那么就需要递归进行计算 changeInput(comResult, `${id}-${item.r}-${item.c}-${pId}`) //改变最终值 } catch (error) { console.log('error---', error) @@ -392,22 +466,31 @@ } } }) // 赋值多线程传输数据 result = { method:'tableList', value:tableList } // 发送主线程数据 self.postMessage(JSON.stringify(result)) try { // 赋值多线程传输数据 result = { method:'getCurrentInsProduct', value:pId } // 发送主线程数据 self.postMessage(JSON.stringify(result)) } catch (error) { console.log('error---', error) } } /** * 获取检测值类型 * * @param id 检测值类型对应的id * @returns 返回检测值类型 */ function getInspectionValueType(id) { for (var a in currentSample.insProduct) { if (currentSample.insProduct[a].id == id) { @@ -423,8 +506,10 @@ */ function handleFraction(str){ if(str&&typeof(str)=='string'&&str.includes('/')){ // 处理分数 return eval(str.split('/')[0]/str.split('/')[1]) } else if (str && typeof(str) == 'string' && str.includes('*') && str.includes('^')) { // 计算乘方 const num1 = str.split('*') const num2 = num1[1].split('^') let num3 = new Big(num2[0]); @@ -460,7 +545,7 @@ return item <= handleFraction(str) case '±': let k = str.split('±') return item >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && item <= eval((handleFraction(k[0]) + handleFraction(k[1]))) return item >= eval((handleFraction(k[0]) - handleFraction(k[1]))) && item <= eval(Number((handleFraction(k[0])) + Number(handleFraction(k[1])))) case '~': let j = str.split('~') return item >= eval(handleFraction((j[0]))) && item <= eval(handleFraction(j[1])) @@ -484,6 +569,7 @@ function getParam(){ tableList[0].arr.forEach(a=>{ a.forEach(b=>{ // 初始化传递到后端的参数 if(param[b.i]){ param[b.i].insValue = [] param[b.i].comValue = [] @@ -496,24 +582,31 @@ }) tableList[0].arr.forEach(a => { a.forEach(b=>{ // 根据表格数据,赋值传递到后端的参数 if (b.v.ps != undefined &&typeof b.v.ps.value =='string'&& b.v.ps.value.includes('检验值')) { // 赋值检验值 b.i &&b.v.v&& param[b.i].insValue.push(b) } if (b.v.ps != undefined && b.v.ps.value === '计算值') { // 赋值计算值 b.i &&b.v.v&&b.valueList&&b.valueList.length>0&& param[b.i].comValue.push(b) } if (b.v.ps != undefined && b.v.ps.value === '设备编码') { // 赋值设备编码 b.i &&b.v&& param[b.i].equipValue.push(b) } if (b.v.ps != undefined && b.v.ps.value === '设备名称') { // 赋值设备名称 b.i &&b.v&& param[b.i].equipName.push(b) } if (b.v.ps != undefined && b.v.ps.value === '最终值') { // 赋值最终值 b.i &&b.v&&b.valueList&&b.valueList.length>0&& (param[b.i].resValue = b) } if (b.v.ps != undefined && b.v.ps.value === '结论') { if(b.i &&(b.v.v||b.v.v===0||b.v.v==='0')){ if(b.v.v != '合格'&&b.v.v != '不合格'){ // 赋值结论 param[b.i].insResult = b } } @@ -755,6 +848,7 @@ let arr = getABCList(f) let arr2 = [] arr.forEach(item=>{ // 判断是否为范围,列如MAX(A1:B2) if(item.includes(':')){ let r0 = getIdFromColumnName(item.split(':')[0]).r; let c0 = getIdFromColumnName(item.split(':')[0]).c; @@ -769,6 +863,7 @@ } } }else{ // 没有则直接获取 arr2.push(getIdFromColumnName(item)) } }) @@ -786,6 +881,7 @@ function getABCList(f){ try { let regex = /[=\+\-\*\%\(\)\/\^\s]/g; // 上面计算函数新增后,这里也要同步增加 let fouList = [ "SUM", 'MAX', @@ -793,6 +889,7 @@ 'AVERAGE', 'ABS', ] // 替换特殊字符 f = f.replace(regex, ',').replace(new RegExp('"&', 'g'),'').replace(new RegExp('&"', 'g'),'') fouList.forEach(item=>{ f = f.replace(new RegExp(item, 'g'),',') @@ -892,13 +989,22 @@ if(str.includes(',,')){ str = str.replace(new RegExp(',,', 'g'),',') } if(str.includes(',,')){ str = str.replace(new RegExp(',,', 'g'),',') } if(str.includes(',,')){ str = str.replace(new RegExp(',,', 'g'),',') } // console.log('str', str) if(str.includes('&"/"&')){ // 计算带斜杠的 return str.replace(new RegExp('&"/"&', 'g'),'/').replace(new RegExp('//', 'g'),'') } else if (isPoint) { // 计算带小数点的 return str.replace('ABS', '').replace(/\(|\)/g, '') }else { console.log('str', str) // 计算常规的 return eval(str) } } catch (error) { static/js/worker0.js
@@ -1,22 +1,30 @@ // 此线程为数据采集线程 // 保存数据 // 数据采集信息 let dataAcquisitionInfo = null; // 数据列表 let list = null; // 传递到主线程的数据 let result = { method:'', value:null } // 优化数采较多数据时--记录数采项目的Id数组,目的是取最后一个数采项目,传到主线程进行批量的数据采集保存 let arrSpecial = [] let numSpecial = 0; // 接收主线程传递过来的数据 self.onmessage = function(event) { const data = JSON.parse(event.data); dataAcquisitionInfo = data.dataAcquisitionInfo; list = data.list; // console.log(111,dataAcquisitionInfo) arrSpecial = [] numSpecial = 0 // 处理数据 handleData() } function handleData(){ // 遍历数据列表 list.forEach((item,index)=>{ let num = 0; let str = '' @@ -33,8 +41,9 @@ str = str+m.v.v } } // 上面在记录检验项+检验子项的名称,如果数采包含检验项+检验子项的数据,则执行 if(dataAcquisitionInfo[str]){ let num = 0; let num = 0;//该检验项对应检验值的个数,用用判断最多有多少个检验值,如果多次采集超过了该个数,则赋值给最后一个检验值 list[index].forEach(n=>{ if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('检验值')){ num++ @@ -44,19 +53,23 @@ if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('检验值')){ let arr = n.v.ps.value.split('值') if(Array.isArray(dataAcquisitionInfo[str].value)){ // 如果数据源为数组,则执行 for (let i = 0; i < dataAcquisitionInfo[str].value.length; i++) { if(i+1==arr[1]){ // 赋值数采优化检验项列表 arrSpecial.push(n.i) numSpecial++ setTimeout(()=>{ let num0 = 0 if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){ // 保留模板配置的小数点位数 let str0 = n.v.ct.fa.split('.')[1] num0 = str0.length n.v.v = dataAcquisitionInfo[str].value[i]?Number(dataAcquisitionInfo[str].value[i]).toFixed(num0):dataAcquisitionInfo[str].value[i] }else{ // 直接赋值 n.v.v = dataAcquisitionInfo[str].value[i] } // 传递给主线程 result = { method:'changeInput', value:{ @@ -69,18 +82,22 @@ } } }else{ // 如果数据源为字符或数字,则执行 if(arr[1] ==dataAcquisitionInfo[str].frequency){ // 如果数采次数等于检验值序号,则赋值给当前检验值 arrSpecial.push(n.i) numSpecial++ setTimeout(()=>{ let num0 = 0 if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){ // 保留模板配置的小数点位数 let str0 = n.v.ct.fa.split('.')[1] num0 = str0.length n.v.v = dataAcquisitionInfo[str].value?Number(dataAcquisitionInfo[str].value).toFixed(num0):dataAcquisitionInfo[str].value }else{ // 直接赋值 n.v.v = dataAcquisitionInfo[str].value } // 传递给主线程 result = { method:'changeInput', value:{ @@ -91,18 +108,21 @@ self.postMessage(JSON.stringify(result)) },2000) }else if(Number(dataAcquisitionInfo[str].frequency)>num){ // 如果数采次数大于检验值序号,则赋值给最后一个检验值 if(n.v.ps.value.includes(num)){ arrSpecial.push(n.i) numSpecial++ setTimeout(()=>{ let num0 = 0 if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){ // 保留模板配置的小数点位数 let str0 = n.v.ct.fa.split('.')[1] num0 = str0.length n.v.v = dataAcquisitionInfo[str].value?Number(dataAcquisitionInfo[str].value).toFixed(num0):dataAcquisitionInfo[str].value }else{ // 直接赋值 n.v.v = dataAcquisitionInfo[str].value } // 传递给主线程 result = { method:'changeInput', value:{ @@ -121,10 +141,11 @@ } }) }) if(arrSpecial[numSpecial-1]){ if(arrSpecial[arrSpecial.length-1]){ //优化数采较多数据时-记录最后一个检验项的id,用于后续处理 setTimeout(()=>{ result = { getDataTypeId:arrSpecial[numSpecial-1], getDataTypeId:arrSpecial[arrSpecial.length-1], } self.postMessage(JSON.stringify(result)) },0)