Browse Source

Merge branch 'master' of https://git.7in6.com/Minong/mes-admin-backend-ui

tty 1 year ago
parent
commit
f8c1fa41f2
2 changed files with 304 additions and 86 deletions
  1. 23 0
      src/api/jixiaoguanli/baogong.js
  2. 281 86
      src/view/performance/chejianbaogong.vue

+ 23 - 0
src/api/jixiaoguanli/baogong.js

@@ -0,0 +1,23 @@
+import service from '@/utils/request'
+
+export const ProcessInspectionRecordsItemAdd = (data) => {
+  return service({
+    url:'/mes_server/facility/ProcessInspectionRecordsItemAdd',
+    method: 'post',
+    data
+  })
+}
+export const AdditionalInspectionRecordAdd = (data) => {
+  return service({
+    url:'/mes_server/facility/AdditionalInspectionRecordAdd',
+    method: 'post',
+    data
+  })
+}
+export const getMac = (data) => {
+  return service({
+    url: 'http://127.0.0.1:8090/init',
+    method: 'get',
+    data
+  })
+}

+ 281 - 86
src/view/performance/chejianbaogong.vue

@@ -359,8 +359,8 @@
 			   </el-form-item>
 			 </el-col>
 			</el-row> 	
-				
-			<div class="groupbox" style="height: 18vh; width: 920px;">
+			<div style="display: flex;">
+			<div class="groupbox float-div" style="height: 17vh; width: 800px;">
 			    <span class="grouptitle">组员及分配比例</span>
 				<el-row :gutter="10" style="margin-top: 0px; height: 5vh;">
 								 <el-col :span="2">
@@ -557,6 +557,13 @@
 			  				</el-col> -->
 			  </el-row>
 			</div>
+			<div style="height: 17vh; width: 100px;margin-top: 30px;">
+				<el-button type="text"></el-button>
+				<!-- <el-button style="margin-bottom: 5px;" @click="" >新增</el-button> -->
+				<el-button style="margin-bottom: 5px;" @click="selectBz" >更新当前班组</el-button>
+				<!-- <el-button @click="delBz" >删除当前班组</el-button> -->
+			</div>
+			</div>
           </el-dialog>
 
 
@@ -570,24 +577,24 @@
 		  width="1100px"
 		  style="height: 78%;"
 		>
-		  <el-row :gutter="24">
-		    <el-col :span="4">
-		      <el-form-item label="设备编号" prop="id">
-		        <el-input v-model="JTMC" :clearable="true" placeholder="" />
+		  <el-row :gutter="24" style="margin-bottom: 0px;margin-top: 0px;">
+		    <el-col :span="4" style="margin-bottom: 0px;margin-top: 0px;">
+		      <el-form-item label="设备编号" prop="id" style="margin-bottom: 0px;margin-top: 0px;">
+		        <el-input v-model="JTMC" :clearable="true" placeholder="" style="margin-bottom: 0px;margin-top: 0px;"/>
 		      </el-form-item>
 		    </el-col>
-		    <el-col :span="10">
-		      <el-row >
-		        <el-col>
-		          <el-input v-model="formData.产品名称" :clearable="true" placeholder="" />
+		    <el-col :span="10" style="margin-bottom: 0px;margin-top: 0px;">
+		      <el-row style="margin-bottom: 0px;margin-top: 0px;">
+		        <el-col style="margin-bottom: 0px;margin-top: 0px;">
+		          <el-input v-model="formData.产品名称" :clearable="true" placeholder="" style="margin-bottom: 0px;margin-top: 0px;"/>
 		        </el-col>
 		      </el-row>
 		    </el-col>
 		  </el-row>
 		
 		  <div style="display: flex;">
-		    <div style="flex: 0.1;">
-		      <el-aside width="180px" style="margin: 0;">
+		    <div style="flex: 0.1;margin-top: 0px;">
+		      <el-aside width="180px" style="margin: 0; margin-top: 0px;">
 		        <div class="JKWTree-tree" style="height: 100%; border-right: 1px solid #ebeef5;">		          
 		          <el-tree :data="dianjiantreeData" :props="defaultProps" highlight-current="true"
 		            @node-click="dianjianNodeClick" @node-dblclick="handleNodeDoubleClick"></el-tree>
@@ -602,7 +609,7 @@
 		        highlight-current-row="true"
 				:show-overflow-tooltip="true"
 		        border  @row-click="dianjianhandle"
-		        style="width:100%; height:320px;"
+		        style="width:100%; height:320px; margin-top: 5px;"
 		        @row-dblclick="handleSelectClick"
 		        :row-class-name="rowClassName"
 		      >
@@ -711,38 +718,40 @@
 		      <el-aside width="180px" style="margin: 0;">
 		        <div class="JKWTree-tree" style="height: 100%; border-right: 1px solid #ebeef5;">		          
 		          <el-tree :data="zhichengtreeData" :props="defaultProps" highlight-current="true"
-		            @node-click="dianjianNodeClick"></el-tree>
+		            @node-click="zhichengNodeClick"></el-tree>
 		        </div>
 		      </el-aside>
 		    </div>
-		    <div style="flex: 1; margin: 0;">
-		      <el-tabs v-model="activName" type="card" @tab-click="handleClick">
+		    <div v-if="zhichengstatus" style="flex: 0; margin: 0;">
+		      <el-tabs v-model="activNames" type="card" @tab-click="handleClick">
 		        <el-tab-pane label="指标检验"  @click="showTable('指标检验')"  name="first">
 		          <el-table
 		            tooltip-effect="dark"
-		            :data="dianjianselectData"
+		            :data="zhibiaoselectData"
 		            row-key="ID"
 		            highlight-current-row="true"
 		          				:show-overflow-tooltip="true"
 		            border  @row-click="dianjianhandle"
-		            style="width:100%; height:320px;"
+		            style="width:100%; height:310px;"
 		            @row-dblclick="handleSelectClick"
 		            :row-class-name="rowClassName"
 		          >
 		            <el-table-column
 		              prop="检验项目"
 		              label="检验项目"
-		              width="320"
-		            />
-		            <el-table-column
-		              prop="点检方法"
-		              label="点检方法"
-		              width="180"
+		              width="270"
 		            />
+					<el-table-column
+					  v-slot="scope"
+					  label="不检测" 
+					  width="70"
+					>
+					   <el-checkbox v-model="scope.row.notjc" @click="notjcClick(scope.row)"></el-checkbox>
+					</el-table-column>
 		            <el-table-column
 		              v-slot="scope"
-		              label="正常"
-		              width="70"
+		              label="合格"
+		              width="60"
 		            >
 		              
 		             <el-checkbox v-model="scope.row.zc" @click="zcClick(scope.row)"></el-checkbox>
@@ -750,32 +759,33 @@
 		            </el-table-column>
 		            <el-table-column
 		              v-slot="scope"
-		              label="异常" 
+		              label="不合格" 
 		              width="70"
 		            >
 		               <el-checkbox v-model="scope.row.yc" @click="ycClick(scope.row)"></el-checkbox>
 		            </el-table-column>
-		            <el-table-column
-		          				  v-slot="scope"
-		              label="备注说明"
-		              width="180"
-		            >
-		          				<el-input v-model="scope.row.remark"/>
-		            </el-table-column>
-		            <el-table-column
-		              v-slot="scope"
-		              label="不检测" 
-		              width="75"
-		            >
-		               <el-checkbox v-model="scope.row.notjc" @click="notjcClick(scope.row)"></el-checkbox>
-		            </el-table-column>
+					<el-table-column
+					  prop="检测方法"
+					  label="检测方法"
+					  width="90"
+					/>
+					<el-table-column
+					  prop="检验频率"
+					  label="检验频率"
+					  width="150"
+					/>
+					<el-table-column
+					  prop="相关标准"
+					  label="相关标准"
+					  width="180"
+					/>
 		          </el-table>
 		        </el-tab-pane>
 		      
-		        <el-tab-pane label="附件检验记录"  @click="showTable('附件检验记录')"  name="second">
+		        <el-tab-pane label="附加检验记录"  @click="showTable('附加检验记录')"  name="second">
 		          <el-table
 		            tooltip-effect="dark"
-		            :data="dianjianselectData"
+		            :data="fujiaselectData"
 		            row-key="ID"
 		            highlight-current-row="true"
 		          				:show-overflow-tooltip="true"
@@ -784,55 +794,32 @@
 		            @row-dblclick="handleSelectClick"
 		            :row-class-name="rowClassName"
 		          >
+				    <el-table-column
+				      v-slot="scope"
+				      label="不检测" 
+				      width="75"
+				    >
+				       <el-checkbox v-model="scope.row.notjc"></el-checkbox>
+				    </el-table-column>
 		            <el-table-column
-		              prop="检验项目"
-		              label="检验项目"
-		              width="320"
+		              prop="缺陷备注"
+		              label="缺陷及记录"
+		              width="720"
 		            />
 		            <el-table-column
-		              prop="点检方法"
-		              label="点检方法"
-		              width="180"
+		              prop="编号"
+		              label="编号"
+		              width="80"
 		            />
-		            <el-table-column
-		              v-slot="scope"
-		              label="正常"
-		              width="70"
-		            >
-		              
-		             <el-checkbox v-model="scope.row.zc" @click="zcClick(scope.row)"></el-checkbox>
-		            
-		            </el-table-column>
-		            <el-table-column
-		              v-slot="scope"
-		              label="异常" 
-		              width="70"
-		            >
-		               <el-checkbox v-model="scope.row.yc" @click="ycClick(scope.row)"></el-checkbox>
-		            </el-table-column>
-		            <el-table-column
-		          				  v-slot="scope"
-		              label="备注说明"
-		              width="180"
-		            >
-		          				<el-input v-model="scope.row.remark"/>
-		            </el-table-column>
-		            <el-table-column
-		              v-slot="scope"
-		              label="不检测" 
-		              width="75"
-		            >
-		               <el-checkbox v-model="scope.row.notjc" @click="notjcClick(scope.row)"></el-checkbox>
-		            </el-table-column>
 		          </el-table>
 		        </el-tab-pane>
 		      </el-tabs>
 		    </div>
 		  </div>
 		  <template #footer>
-		    <div class="dialog-footer">
-		      <el-button @click="closedianjianDialog">关 闭</el-button>
-		      <el-button type="primary" @click="dianjianDialog">提 交</el-button>
+		    <div v-if="zhichengstatus" class="dialog-footer">
+		      <el-button @click="closezhichengDialog">关 闭</el-button>
+		      <el-button type="primary" @click="zhichengDialog">提 交</el-button>
 		    </div>
 		  </template>
 		</el-dialog>
@@ -1450,6 +1437,12 @@ import {
   getCompanyList
 } from '@/api/company'
 
+import {
+  ProcessInspectionRecordsItemAdd,
+  AdditionalInspectionRecordAdd,
+  getMac
+} from '@/api/jixiaoguanli/baogong'
+
 import {
   facilityTab,
   facilitychanLiang,
@@ -1489,11 +1482,13 @@ import { ref, reactive } from 'vue'
 import Shebeizhuangtai from '@/view/performance/09-workOrderVerification/componets/shebeizhuangtai.vue'
 
 const dialogSbyxgl=ref(false)
+const zhichengstatus=ref(false)
 defineOptions({
     name: 'Company'
 })
 const xunchatreeData=ref([{label: '现场巡查记录',} ])
 const activName=ref('first')
+const activNames=ref('first')
 let checked3=ref(false)
 const detailData = reactive([])
 const treeData=ref([])
@@ -1750,6 +1745,8 @@ const page = ref(1)
 const total = ref(0)
 const pageSize = ref(10)
 const tableData = ref([])
+const zhibiaoselectData=ref([])
+const fujiaselectData=ref([])
 const searchInfo = ref({})
 
 // 重置
@@ -1884,8 +1881,21 @@ function ondianjian() {
   });
   
 }
-function onzhicheng() {
-  zhichengVisible.value = true;
+const onzhicheng = async () => {
+	zhichengstatus.value=false
+	xunchaData.value=[]
+	const response = await reportProduceInfo({machine:JTMC.split("#")[0]});
+	if (response.code === 0) {
+		xunchaData.value.order=response.data.order
+		xunchaData.value.yjno=response.data.yjno
+		xunchaData.value.product_name=response.data.product_name
+		xunchaData.value.gxmc=response.data.gxmc
+		xunchaData.value.lcdh=0
+		xunchaData.value.sczl_bh=''
+		xunchaData.value.sczl_name=''
+		xunchaData.value.remark=''
+		zhichengVisible.value = true;
+	}
 }
 
 const chanliangselectData = reactive([])
@@ -1957,9 +1967,96 @@ const dianjianDialog = async () => {
 		  dianjianVisible.value=false
 	}
 }
+const zhichengDialog = async () => {
+	console.log(fujiaselectData.value)
+	let arr =[]
+	zhibiaoselectData.value.map(item=>{
+		if(item.zc==true){
+			item.result='合格'
+			item.item=item.检验项目
+			item.instrument=item.检测方法
+			item.standard=item.相关标准
+			delete item.notjc
+			delete item.zc
+			delete item.yc
+			delete item.检验项目
+			delete item.检测方法
+			delete item.相关标准
+			delete item.检验频率
+			arr.push(item)
+			return item
+		}
+		if(item.yc==true){
+			item.result='不合格'
+			item.item=item.检验项目
+			item.instrument=item.检测方法
+			item.standard=item.相关标准
+			delete item.notjc
+			delete item.zc
+			delete item.yc
+			delete item.检验项目
+			delete item.检测方法
+			delete item.相关标准
+			delete item.检验频率
+			arr.push(item)
+			return item
+		}
+		if(item.notjc==true){
+			item.result='不检测'
+			item.item=item.检验项目
+			item.instrument=item.检测方法
+			item.standard=item.相关标准
+			delete item.notjc
+			delete item.zc
+			delete item.yc
+			delete item.检验项目
+			delete item.检测方法
+			delete item.相关标准
+			delete item.检验频率
+			// arr.push(item)
+			return item
+		}
+		
+	})
+	let arrs=[]
+	let fujiastatus=0
+	fujiaselectData.value.map(item=>{
+		if(item.notjc==true){
+			return item
+		}else{
+			fujiastatus=1
+			item.remark=item.缺陷备注
+			delete item.notjc
+			delete item.缺陷备注
+			delete item.编号
+			arrs.push(item)
+			return item
+		}
+		
+	})
+	if(fujiastatus==1){
+		const responses = await AdditionalInspectionRecordAdd(arrs);
+		fujiastatus=0
+	}
+	// const response = await ProcessInspectionRecordsItemAdd(arr);
+	const response = await ProcessInspectionRecordsItemAdd(zhibiaoselectData.value);
+	// const responses = await AdditionalInspectionRecordAdd(zhibiaoselectData.value);
+	if (response.code === 0) {
+		  ElMessage({
+		    type: 'success',
+		    message: '成功'
+		  })
+		  zhichengVisible.value=false
+		  zhibiaoselectData.value=[]
+		  fujiaselectData.value=[]
+	}
+}
 const closedianjianDialog = async () => {
 	dianjianVisible.value=false
 }
+const closezhichengDialog = async () => {
+	zhichengVisible.value=false
+}
 
 //获取机台生产信息
 const ReportProduceInfo = async (value,inputName) => {
@@ -1991,6 +2088,30 @@ const FieldInspectionRecord = async () => {
 }
 //获取机台编号
 const GetMachineMac = async () => {
+	var xmlhttp = null;
+	var res;
+	if (window.XMLHttpRequest) {
+		xmlhttp = new XMLHttpRequest();
+	} else if (window.ActiveXObject) {
+		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+	}
+	// 2. 设置回调函数
+	xmlhttp.onreadystatechange = function() {
+		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
+			res = eval('('+xmlhttp.response+')');
+			let result = ''
+			  for (let i = 0; i < res.macAddress.length; i++) {
+				if (i % 2 === 0 && i !== 0) {
+				  result += '-' // 根据实际需求修改分隔符
+				}
+				result += res.macAddress[i]
+			  }
+		}
+	}
+	// 3. 打开一个连接http://10.10.4.42/
+	xmlhttp.open("get", "http://127.0.0.1:8090/init")
+	// 5. 发送
+	xmlhttp.send();
   const response = await getMachineMac({ addr: '68-ED-A4-26-5F-37' });
   console.log(response);
   if (response.code === 0) {
@@ -2222,6 +2343,41 @@ const dianjianNodeClick = (node, check, nodeData) => {
      FacilityInspectionItem(node.label)
   }
 };
+const category =ref()
+const zhichengNodeClick = (node, check) => {
+	if(node.label){
+		zhichengstatus.value=true
+		category.value=node.label
+		processInspectionRecordsItem()
+	}
+};
+const processInspectionRecordsItem = async (value) => {
+  const response = await ProcessInspectionRecordsItem({ process: xunchaData.value.gxmc });
+  if (response.code === 0) {
+	zhibiaoselectData.value=response.data.首件.指标检验.map(item=>{
+		 item.notjc=true;
+		 item.zc=false;
+		 item.yc=false;
+		 item.remark=''
+		 item.category=category.value
+		 item.workOrder=xunchaData.value.order
+		 item.yjno=xunchaData.value.yjno
+		 item.flow=xunchaData.value.lcdh
+		 item.team=BZMC.value
+		 item.machine=JTMC.split("#")[0]
+		 return item
+	 })
+	 fujiaselectData.value=response.data.首件.附加.map(item=>{
+	 	 item.notjc=true;
+	 	 item.workOrder=xunchaData.value.order
+	 	 item.yjno=xunchaData.value.yjno
+	 	 item.flow=xunchaData.value.lcdh
+	 	 item.machine=JTMC.split("#")[0]
+	 	 return item
+	  })
+    
+  }
+};
 const notjcClick =  (val) => {
   try {
 	if(val.notjc==false){
@@ -2529,9 +2685,12 @@ const formDatas = ref({
   percentage10:'',
 })
 
-
+const currentBz ={}
 //班组单击
 const BZhandle = (val, row) => {
+	console.log(val.ID)
+	console.log(val)
+  currentBz.value=val
   formDatas.value  = {};
   for (const key in val) {
     if (val[key] === 0) {
@@ -2550,7 +2709,43 @@ const BZhandle = (val, row) => {
 	BZMC.value=val.班组号
   }
 };
-
+const selectBz = async() => {
+	if(currentBz.value){
+		BZMC.value=currentBz.value.班组号
+		let sczl_bhkey=''
+		let sczl_namekey=''
+		if (currentBz.value) {
+		  for (let i = 1; i <= 6; i++) {
+		  	sczl_bhkey=`sczl_bh${i}`
+		    sczl_namekey=`sczl_name${i}`
+		    formData.value[sczl_bhkey] = '';
+		    formData.value[sczl_namekey] = '';
+		  }
+		  for (let i = 1; i <= Math.min(Object.keys(currentBz.value).length-4, 6); i++) {
+			sczl_bhkey=`sczl_bh${i}`
+			sczl_namekey=`sczl_name${i}`
+			console.log(currentBz.value[i-1].split(' '))
+		    formData.value[sczl_bhkey] = currentBz.value[i-1].split(' ')[0];
+		    formData.value[sczl_namekey] = currentBz.value[i-1].split(' ')[1];
+		    classbz.value[i-1]=currentBz.value[i-1].split(' ')[0]
+		  }
+		  formData.value.class=classbz.value.join(',')
+		}
+		currentBz.value={}
+	}
+}
+const delBz = async() => {
+	if(currentBz.value){
+		ElMessageBox.confirm('确定要删除吗?', '提示', {
+		    confirmButtonText: '确定',
+		    cancelButtonText: '取消',
+		    type: 'warning'
+		}).then(() => {
+		        teamDel(currentBz.value.ID)
+		    })
+	currentBz.value={}
+	}
+}
 	
 
 // ============== 表格控制部分结束 ===============