<template>
  <div>
    
	    <header>
			<el-button type="primary" @click="onBZ">班组维护</el-button>
			<el-button type="primary" @click="onzhicheng"  >制程检验</el-button>
			<el-button type="primary" @click="onDel">删除</el-button>
			<el-button type="primary" @click="onxuncha">管理巡查</el-button>
			<el-button type="primary" @click="ondianjian">设备点检</el-button>
			<el-button type="primary" @click="onyinban">印版领退</el-button>
			<el-button type="primary" @click="onstatus" >设置机台状态</el-button>
			<el-button type="primary" @click="oncomplaints" >客诉记录</el-button>
			<el-button type="primary" @click="onClear" >换型清场</el-button>
		</header>
    <el-container>
      <el-aside width="200px">
        <div class="JKWTree-tree">

          <h3  >设备运行跟踪</h3>
          <el-tree :data="treeData" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
        </div>

      </el-aside>
      <el-container>
        <el-main>

          
<div class="gva-search-box" v-if="JTMCOn" style="overflow: hidden; padding: 0; display: flex;">

			<div style="flex: 1; border: 0px magenta solid; margin: 0; padding: 0;">

			  <el-row :gutter="20">
				<el-col :span="24">
				  <el-form-item label="工单编号" prop="name">
					<el-row :gutter="20">
					  <el-col :span="6">
						<el-input v-model="formData.工单编号" :clearable="true"  />							
					  </el-col>
					  <el-col :span="18">
						<el-input v-model="formData.产品名称" :clearable="true"  />
					  </el-col>
					</el-row>
					
				  </el-form-item>
				</el-col>
			  </el-row>
			  
			  <el-row :gutter="20">
				<el-col :span="6">
				 <el-form-item label="印件编号" prop="id">
				   <el-input v-model="formData.印件编号" :clearable="true"  />
				 </el-form-item>
				</el-col>
			  <el-col :span="17">
				 <el-form-item label="工序名称" prop="name">
				   <el-input v-model="formData.工序名称" :clearable="true"  />
				 </el-form-item>
				</el-col>			    
			  </el-row>
			  
			  <el-row :gutter="20">
				<el-col :span="4">
				 <el-form-item label="班组成员" prop="id">				  					   
				 </el-form-item>
				</el-col>				  			    
			  </el-row>
                                 				  
<el-row :gutter="1">
			 
			 <el-col :span="4">
			   <el-input v-model="formData.sczl_bh1" :clearable="true"  />
			 </el-col>
			<el-col :span="4">
			  <el-input v-model="formData.sczl_bh2" :clearable="true"  />
			</el-col>
			  <el-col :span="4">			  			
				<el-input v-model="formData.sczl_bh3" :clearable="true"  />
			  </el-col>
			  
			 <el-col :span="4">
				<el-input v-model="formData.sczl_bh4" :clearable="true"  />
			  </el-col>
			  <el-col :span="4">
				<el-input v-model="formData.sczl_bh5" :clearable="true"  />
			  </el-col>
			  <el-col :span="4">
				<el-input v-model="formData.sczl_bh6" :clearable="true"  />
			  </el-col> 
		   </el-row>
		   
		   <el-row :gutter="1">
		 
		 <el-col :span="4">
		   <el-input v-model="formData.sczl_name1" :clearable="true"  />
		 </el-col>
		<el-col :span="4">
		  <el-input v-model="formData.sczl_name2" :clearable="true"  />
		</el-col>
		  <el-col :span="4">			  			
			<el-input v-model="formData.sczl_name3" :clearable="true"  />
		  </el-col>
		  <el-col :span="4">
		  			<el-input v-model="formData.sczl_name4" :clearable="true"  />
		  </el-col>
		  <el-col :span="4">
		  			<el-input v-model="formData.sczl_name5" :clearable="true"  />
		  </el-col>
		  <el-col :span="4">
		  			<el-input v-model="formData.sczl_name6" :clearable="true"  />
		  </el-col>
	   </el-row>
                                 		                    
</div>
                    
	<div  style="flex: 1; border: 0px lawngreen solid; margin: 0; padding: 0; overflow: hidden;">

	 <el-table
	   tooltip-effect="dark"
	   :data="selectData"
	   row-key="ID"
	   highlight-current-row="true"
	   border
	   style="width:100%;height: 30vh;"
	   @row-dblclick="handleSelectClick"
	 >
	   <el-table-column
	     prop="process"
	     label="印件及工序"
	     width="340"
	   />
	   <el-table-column
	     prop="completed"
	     label="已完成板数"
	     width="150"
	   />			 
	 </el-table>

	</div>
                    
</div>
          <div v-if="JTMCOn" class="gva-table-box">
            <div class="gva-btn-list">
            </div>
            <el-tabs v-model="activName" type="card" @tab-click="handleClick">
            
                        <el-tab-pane label="设备作业清单"  @click="showTable('印件资料')"  name="first">
                          <el-table ref="multipleTable"
                                    :show-overflow-tooltip="true"
                                    highlight-current-row="true"
                                    :row-style="{ height: '20px' }"
                                    :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                                    :header-cell-style="{ padding: '0px' }"
                                    @row-click="yjupdateCompanyFunc"
                                    style="width: 100%;height: 330px" border tooltip-effect="dark" :data="sbzyData" row-key="ID" @selection-change="handleSelectionChange">
            <!--                <el-table-column type="selection" width="55" />-->
                            <!-- <el-table-column align="left" label="选择" prop="bh"  width="80"/> -->
                            <el-table-column align="left" sortable label="工单编号|质量信息" prop="工单编号|质量信息" width="145" />
							<el-table-column align="left" sortable label="印件资料" prop="印件资料" width="240" />
                            <el-table-column align="left" sortable label="工序名称" prop="工序名称" width="100" />
                            <el-table-column align="left" sortable label="计划产量/已完成" prop="计划产量/已完成" width="130"/>
                            <el-table-column align="left" sortable label="装版时数" prop="装版时数" width="85"/>
                            <el-table-column align="left" sortable label="工序产能" prop="工序产能" width="85"/>
                            <el-table-column align="left" sortable label="计划工时" prop="计划工时" width="85"/>
                            <el-table-column align="left" sortable label="计划生产时段" prop="计划生产时段" width="210" />
                            <el-table-column align="left" sortable label="排产备注" prop="排产备注" width="100" />
                            <el-table-column align="left" sortable label="产品名称" prop="产品名称" width="240" />
                          </el-table>
                        </el-tab-pane>
            
                        <el-tab-pane label="班组人员及分配比例" @click="showTable('工艺资料')" name="second">
                          <el-table ref="multipleTable"
                                    highlight-current-row="true"
                                    :show-overflow-tooltip="true"
                                    :row-style="{ height: '20px' }"
                                    :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                                    :header-cell-style="{ padding: '0px' }"
                                    @row-dblclick="gyupdateCompanyFunc"
                                    :row-class-name="rowClassStyle"
                                    style="width: 100%;height: 400px" border tooltip-effect="dark" :data="FPData" row-key="ID" @selection-change="handleSelectionChange"
                                    @row-click="clickybupdate">
            <!--                <el-table-column type="selection" width="55" />-->
                            <!-- <el-table-column align="left" label="选择" prop="方案"  width="70"/> -->
                            <el-table-column align="left" sortable label="班组号" prop="班组号" width="70" />
                            <el-table-column align="left" sortable label="组员1" prop="0" width="200" />
                            <el-table-column align="left" sortable label="组员2" prop="1" width="200" />
                            <el-table-column align="left" sortable label="组员3" prop="2" width="200" />
                            <el-table-column align="left" sortable label="组员4" prop="3" width="200" />
                            <el-table-column align="left" sortable label="组员5" prop="4" width="200" />
                            <el-table-column align="left" sortable label="组员6" prop="5" width="70" />
                            <el-table-column align="left" sortable label="组员7" prop="6" width="70" />
                            <el-table-column align="left" sortable label="组员8" prop="7" width="70" />
                            <el-table-column align="left" sortable label="组员9" prop="8" width="70" />
                            <el-table-column align="left" sortable label="组员10" prop="9_正品版" width="70" />
                          </el-table>
                        </el-tab-pane>
            
                        <el-tab-pane label="当班产量明细" @click="showTable('印版资料')" name="third">
                        <el-table ref="multipleTable"
                                  highlight-current-row="true"
                                  :show-overflow-tooltip="true"
                                  :row-style="{ height: '20px' }"
                                  :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                                  :header-cell-style="{ padding: '0px' }"
                                  @row-dblclick="ybupdateCompanyFunc"
                                  style="width: 100%;height: 400px" border tooltip-effect="dark" :data="CLMXData" row-key="ID" @selection-change="handleSelectionChange"
                                  >
            <!--              <el-table-column type="selection" width="55" />-->
                          <el-table-column align="left" sortable label="生产时段" prop="生产时间段"  width="180"/>
                          <el-table-column align="left" sortable label="工单编号" prop="工单编号" width="85" />
                          <el-table-column align="left" sortable label="产品名称" prop="产品名称" width="150" />
                          <el-table-column align="left" sortable label="印件及工序" prop="印件及工序" width="320"/>
                          <el-table-column align="left" sortable label="标牌号" prop="标牌号"  width="80"/>
                          <el-table-column align="left" sortable label="产量" prop="产量" width="100"/>
                          <el-table-column align="left" sortable label="制程废品" prop="制程废品" width="100" />
                          <el-table-column align="left" sortable label="制程次品" prop="制程次品" width="100" />
                          <el-table-column align="left" sortable label="前工序废" prop="前工序废" width="100" />
						  <el-table-column align="left" sortable label="来料异常" prop="来料异常"  width="100"/>
						  <el-table-column align="left" sortable  label="装版工时" prop="装版工时" width="100" />
						  <el-table-column align="left" sortable  label="保养工时" prop="保养工时" width="100" />
						  <el-table-column align="left" sortable  label="打样工时" prop="打样工时" width="100"/>
						  <el-table-column align="left"  sortable label="异常停机工时" prop="异常停机工时"  width="120"/>
						  <el-table-column align="left" sortable  label="通电工时" prop="通电工时" width="100"/>
						  <el-table-column align="left" sortable  label="码开始行" prop="码开始行" width="100" />
						  <el-table-column align="left" sortable  label="码结束行" prop="码结束行" width="100" />
						  <el-table-column align="left" sortable  label="码包" prop="码包" width="100" />
						  <el-table-column align="left" sortable  label="主电表" prop="主电表"  width="100"/>
						  <el-table-column align="left" sortable  label="辅电表" prop="辅电表" width="100" />
						  <el-table-column align="left" sortable  label="色度数" prop="色度数" width="100" />
                        </el-table>
                        </el-tab-pane>
            
                        <el-tab-pane label="检验记录" @click="showTable('技术资料附件')" name="fourth">
                        <el-table ref="multipleTable"
                                  :row-style="{ height: '20px' }"
                                  :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                                  :header-cell-style="{ padding: '0px' }"
                                  :show-overflow-tooltip="true"
                                  highlight-current-row="true"
                                  style="width: 100%;height: 400px" border tooltip-effect="dark" :data="JYData" row-key="ID" @selection-change="handleSelectionChange">
            <!--              <el-table-column type="selection" width="55" />-->
                          <el-table-column align="left" sortable label="工单编号" prop="工单编号"  width="85"/>
                          <el-table-column align="left" sortable label="印件号" prop="印件号" width="70" />
                          <el-table-column align="left" sortable label="工序名称" prop="工序名称" width="85" />
                          <el-table-column align="left" sortable label="检验项目" prop="检验项目" width="85"/>
                          <el-table-column
                             v-for="time in columnNames"
                             :key="time"
                             :label="time"
                             :prop="time"
                             align="center"
                             width="80"
                           ></el-table-column>
                        </el-table>
                        </el-tab-pane>
            
                      </el-tabs>
          </div>
		  
          <el-dialog v-model="detailShow" style="width: 1000px" lock-scroll :before-close="closeDetailShow" title="机台班组维护" destroy-on-close>
            <el-table ref="multipleTable"
                        :row-style="{ height: '20px' }"
                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                        :header-cell-style="{ padding: '0px' }"
                        :show-overflow-tooltip="true"
                        highlight-current-row="true" @row-click="BZhandle"
                        style="width: 100%;height: 250px;margin-top: 0px;" border tooltip-effect="dark" 
          						:data="bzData" row-key="ID" @selection-change="BZSelectionChange">
              <!-- <el-table-column type="selection" width="55" /> -->
              <el-table-column align="left" label="机台" prop="JTMC" width="70"/>
              <el-table-column align="left" label="班组" prop="班组号" width="60"/>
              <el-table-column align="left" label="组员1" prop="0" width="195"/>
              <el-table-column align="left" label="组员2" prop="1" width="195"/>
          			  <el-table-column align="left" label="组员3" prop="2" width="195"/>
              <el-table-column align="left" label="组员4" prop="3" width="195"/>
              <el-table-column align="left" label="组员5" prop="4" width="70"/>
              <el-table-column align="left" label="组员6" prop="5" width="70"/>
              <el-table-column align="left" label="组员7" prop="6" width="70"/>
              <el-table-column align="left" label="组员8" prop="7" width="70"/>
              <el-table-column align="left" label="组员9" prop="8" width="70"/>
              <el-table-column align="left" label="特殊组员" prop="9" width="85"/>
              <el-table-column align="left" label="UNIQID" prop="ID" width="75"/>
            </el-table>
          			
          			
          			 
          				
          			<el-row :gutter="20">
          			 <el-col :span="10">
          			   <el-form-item label="机台编号" prop="id">
          			 <el-select v-model="selectedOption" placeholder="请选择">
          			   <el-option
          			     v-for="item in dropdownOptions"
          			     :key="item.value"
          			     :label="item.label"
          			     :value="item.value"
          			   ></el-option>
          			 </el-select>
          			   </el-form-item>
          			 </el-col>
          			 <el-col :span="10">
          			   <el-form-item label="班组编号" prop="id">
          				<el-input v-model="BZMC" :clearable="true" placeholder="" />			 
          			   </el-form-item>
          			 </el-col>
          			</el-row> 	
          			<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">
          								   <span></span>
          								 </el-col>
          								<el-col :span="2">
          								  
          								</el-col>
          								<el-col :span="2">
          								  
          								</el-col>
          								<el-col :span="2">
          								  
          								</el-col>
          								<el-col :span="2">
          								  
          								</el-col>
          								<el-col :span="2">
          								 
          								</el-col>
          								<el-col :span="2">
          								 
          								</el-col>
          								<el-col :span="2">
          								  
          								</el-col>
          								<el-col :span="2">
          								  
          								</el-col>
          								<el-col :span="3">
          								  
          								</el-col>
          								<el-col :span="3">
          								 <el-form-item label="特殊组员" prop="id">
          								 						 
          								 </el-form-item>
          								</el-col>
          				</el-row>
          				<el-row :gutter="10" style="margin-top: 0px;">
          				 <!-- <el-col :span="1">
          				   <span></span>
          				 </el-col> -->
          				 
          				 
          				
          				
          				
          				
          				
          				<el-col :span="3">
          				  <el-input v-model="formDatas.code1" :clearable="true" placeholder="" />
          				</el-col>
          				<el-col :span="3">
          				  <el-input v-model="formDatas.code2" :clearable="true" placeholder="" />
          				</el-col>
          				<el-col :span="3">
          				  <el-input v-model="formDatas.code3" :clearable="true" placeholder="" />
          				</el-col>
          				<el-col :span="3">
          				  <el-input v-model="formDatas.code4" :clearable="true" placeholder="" />
          				</el-col>
          				<el-col :span="3">
          				  <el-input v-model="formDatas.code5" :clearable="true" placeholder="" />
          				</el-col>
          				<el-col :span="3">
          				  <el-input v-model="formDatas.code6" :clearable="true" placeholder="" />
          				</el-col>
          				<el-col :span="3">
          				  <el-input v-model="formDatas.code7" :clearable="true" placeholder="" />
          				</el-col>
          				<el-col :span="3">
          				  <el-input v-model="formDatas.code8" :clearable="true" placeholder="" />
          				</el-col>
          				<!-- <el-col :span="2">
          				  <el-input v-model="formData.name" :clearable="true" placeholder="瞿春生" />
          				</el-col>
          				<el-col :span="2">
          				  <el-input v-model="percentage" :clearable="true" placeholder="11.0" />
          				</el-col>
          				<el-col :span="2">
          				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="打包废纸" />
          				</el-col>
          				<el-col :span="2">
          				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="是" />
          				</el-col>
          				<el-col :span="2">
          				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="ZI00401" />
          				</el-col>
          				<el-col :span="2">
          				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="瞿春生" />
          				</el-col>
          				<el-col :span="2">
          				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="11.0" />
          				</el-col>
          				<el-col :span="2">
          				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="11.0" />
          				</el-col>
          				<el-col :span="2">
          				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="11.0" />
          				</el-col> -->
          			  </el-row>
          			 <el-row :gutter="10" style="margin-top: 1px;">
          			  				 <!-- <el-col :span="2">
          			  				   <span></span>
          			  				 </el-col> -->
          			  				<el-col :span="3">
          			  				  <el-input v-model="formDatas.name1" :clearable="true" placeholder="" />
          			  				</el-col>
          			  				<el-col :span="3">
          			  				  <el-input v-model="formDatas.name2" :clearable="true" placeholder="" />
          			  				</el-col>
          			  				<el-col :span="3">
          			  				  <el-input v-model="formDatas.name3" :clearable="true" placeholder="" />
          			  				</el-col>
          			  				<el-col :span="3">
          			  				  <el-input v-model="formDatas.name4" :clearable="true" placeholder="" />
          			  				</el-col>
          							<el-col :span="3">
          							  <el-input v-model="formDatas.name5" :clearable="true" placeholder="" />
          							</el-col>
          							<el-col :span="3">
          							  <el-input v-model="formDatas.name6" :clearable="true" placeholder="" />
          							</el-col>
          							<el-col :span="3">
          							  <el-input v-model="formDatas.name7" :clearable="true" placeholder="" />
          							</el-col>
          							<el-col :span="3">
          							  <el-input v-model="formDatas.name8" :clearable="true" placeholder="" />
          							</el-col>
          			  	<!-- 			<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="是" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="ZI00401" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="瞿春生" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="11.0" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="11.0" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="11.0" />
          			  				</el-col> -->
          			  </el-row>
          			  <el-row :gutter="10" style="margin-top: 1px;">
          			  				 <!-- <el-col :span="2">
          			  				   <span></span>
          			  				 </el-col> -->
          			  				<el-col :span="3">
          			  				  <el-input v-model="formDatas.percentage1" :clearable="true" placeholder="" />
          			  				</el-col>
          			  				<el-col :span="3">
          			  				  <el-input v-model="formDatas.percentage2" :clearable="true" placeholder="" />
          			  				</el-col>
          			  				<el-col :span="3">
          			  				  <el-input v-model="formDatas.percentage3" :clearable="true" placeholder="" />
          			  				</el-col>
          			  				<el-col :span="3">
          			  				  <el-input v-model="formDatas.percentage4" :clearable="true" placeholder="" />
          			  				</el-col>
          							<el-col :span="3">
          							  <el-input v-model="formDatas.percentage5" :clearable="true" placeholder="" />
          							</el-col>
          							<el-col :span="3">
          							  <el-input v-model="formDatas.percentage6" :clearable="true" placeholder="" />
          							</el-col>
          							<el-col :span="3">
          							  <el-input v-model="formDatas.percentage5" :clearable="true" placeholder="" />
          							</el-col>
          							<el-col :span="3">
          							  <el-input v-model="formDatas.percentage6" :clearable="true" placeholder="" />
          							</el-col>
          			  			<!-- 	<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="是" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="ZI00401" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="瞿春生" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="11.0" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="11.0" />
          			  				</el-col>
          			  				<el-col :span="2">
          			  				  <el-input v-model="formData.qczl_NumDesc" :clearable="true" placeholder="11.0" />
          			  				</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>


        <el-dialog
          v-model="dianjianVisible"
          title="设备点检记录"
          destroy-on-close
          width="1300px"
		  style="height: 80%;"
        >
          <el-row :gutter="24">
            <el-col :span="3">
              <el-form-item label="设备编号" prop="id">
                <el-input v-model="formData.JTMC" :clearable="true" />
              </el-form-item>
            </el-col>
            <el-col :span="10">
              <el-row>
                <el-col>
                  <el-input v-model="formData.产品名称" :clearable="true"  />
                </el-col>
              </el-row>
            </el-col>
          </el-row>
        
          <div style="display: flex;">
            <div style="flex: 0.1;">
              <el-aside width="200px" style="margin: 0;">
                <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>
                </div>
              </el-aside>
            </div>
            <div style="flex: 1; margin: 0;">
              <el-table
                tooltip-effect="dark"
                :data="dianjianselectData"
                row-key="ID"
                highlight-current-row="true"
				:show-overflow-tooltip="true"
                border  @row-click="dianjianhandle"
                style="width:100%; height:400px;"
                @row-dblclick="handleSelectClick"
                :row-class-name="rowClassName"
              >
                <el-table-column
                  prop="检验项目"
                  label="检验项目"
                  width="300"
                />
                <el-table-column
                  prop="点检方法"
                  label="点检方法"
                  width="180"
                />
                <el-table-column
                  v-slot="scope"
				  label="正常"
                  width="80"
                >
                  
                 <el-checkbox v-model="scope.row.zc" @change="zcClick(scope.row)"></el-checkbox>
                
                </el-table-column>
                <el-table-column
                  v-slot="scope"
                  label="异常" 
                  width="80"
                >
                   <el-checkbox v-model="scope.row.yc" @change="ycClick(scope.row)"></el-checkbox>
                </el-table-column>
                <el-table-column
                  label="备注说明"
                  width="180"
                >
				</el-table-column>
                <el-table-column
				  v-slot="scope"
                  label="不检测" 
                  width="80"
                >
                   <el-checkbox v-model="scope.row.notjc" @change="notjcClick(scope.row)"></el-checkbox>
                </el-table-column>
              </el-table>
			  <el-row :gutter="20">
			    <el-col :span="20">			      
			        <el-input v-model="pandingfangfa"  style="height: 50px;" :clearable="true"  />			      
			    </el-col>
			  </el-row>
            </div>
          </div>
        </el-dialog>
		
		<el-dialog
		  v-model="yinbanVisible"
		  title="选择"
		  destroy-on-close
		  width="1300px"
		  style="height: 110%;"
		>
		  <el-row :gutter="24">
		    <el-col :span="4">
		      <el-form-item label="工单编号" prop="id">
		        <el-input v-model="formData.工单编号" :clearable="true" />
		      </el-form-item>
		    </el-col>
			<el-col :span="6">
			  <el-form-item prop="id">
			    <el-input v-model="formData.productCode" :clearable="true"  />
			  </el-form-item>
			</el-col>
			<el-col :span="14">
			  <el-form-item prop="id">
			    <el-input v-model="formData.产品名称" :clearable="true" />
			  </el-form-item>
			</el-col>
		  </el-row>
		
		  <div style="display: flex;">
		    <div style="flex: 1;">
		      <el-aside width="250px" style="margin: 0;">
		        <div class="JKWTree-tree" style="height: 100%; border-right: 1px solid #ebeef5;">		          
		          <el-tree :data="yinbantreeData" :props="defaultProps" highlight-current="true"
		            @node-click="yinbanNodeClick" @node-dblclick="handleNodeDoubleClick"></el-tree>
		        </div>
		      </el-aside>
		    </div>
		    <div style="flex: 1; margin: 0;">
		      <el-table
		        tooltip-effect="dark"
		        :data="yinbanselectData"
		        row-key="ID"
		        highlight-current-row="true"
		        border  @row-click="dianjianhandle"
		        style="width:1000px; height:400px;"
		        @row-dblclick="handleSelectClick"
		        :row-class-name="rowClassName"
		      >
		        <el-table-column
		          prop="存货编码"
		          label="存货编码"
		          width="180"
		        />
		        <el-table-column
		          prop="存货名称"
		          label="存货名称"
		          width="180"
		        />
		        
		        <el-table-column
				  prop="印版名称"
		          label="印版名称"
		          width="180"
		        />
				<el-table-column
				  prop="供方批号"
				  label="供方批号"
				  width="180"
				/>
				<el-table-column
				  prop="制造日期"
				  label="制造日期"
				  width="180"
				/>
				
				<el-table-column
				  prop="印数"
				  label="印数"
				  width="180"
				/>
				<el-table-column
				  prop="印版类别"
				  label="印版类别"
				  width="180"
				/>
				<el-table-column
				  prop="客户编号"
				  label="客户编号"
				  width="180"
				/>
				
				<el-table-column
				  prop="客户名称"
				  label="客户名称"
				  width="180"
				/>
				<el-table-column
				  prop="产品编号"
				  label="产品编号"
				  width="180"
				/>
				<el-table-column
				  prop="产品名称"
				  label="产品名称"
				  width="180"
				/>
				
				<el-table-column
				  prop="点检方法"
				  label="备注说明"
				  width="180"
				/>
				<el-table-column
				  prop="点检方法"
				  label="备注说明"
				  width="180"
				/>
		        
		      </el-table>
		    </div>
		  </div>
		</el-dialog>
		
		<el-dialog
		  v-model="xunchaVisible"
		  title="管理人员现场巡查记录"
		  destroy-on-close
		  width="1300px"
		  style="height: 65%;"
		>
		  
		
		<div style="display: flex;">
		  <div style="flex: 1;">
		    <el-aside width="250px" style="margin: 0;">
		      <div class="JKWTree-tree" style="height: 100%; border-right: 1px solid #ebeef5;">		          
		        <el-tree :data="xunchatreeData" :props="defaultProps" highlight-current="true"
		          @node-click="xunchaNodeClick"></el-tree>
		      </div>
		    </el-aside>
		  </div>
		  <div style="flex: 1; margin: 0;">
		    <el-table
		      tooltip-effect="dark"
		      :data="xunchaselectData"
		      row-key="ID"
		      highlight-current-row="true"
		      border  @row-click="dianjianhandle"
		      style="width:1000px; height:400px;"
		      @row-dblclick="handleSelectClick"
		      :row-class-name="rowClassName"
			  :show-overflow-tooltip="true"
		    >
		      <el-table-column
		        prop="工单编号"
		        label="工序编号"
		        width="85"
		      />
		      <el-table-column
		        prop="印件号"
		        label="印件号"
		        width="70"
		      />
		      
			  <el-table-column
				prop="工序名称"
				label="工序名称"
				width="180"
			  />
			<el-table-column
			  prop="流程单号"
			  label="流程单号"
			  width="85"
			/>
			<el-table-column
			  prop="设备编号"
			  label="设备编号"
			  width="85"
			/>
			
			<el-table-column
			  prop="班组编号"
			  label="班组编号"
			  width="85"
			/>
			<el-table-column
			  prop="检验备注"
			  label="检验备注"
			  width="85"
			/>
			<el-table-column
			  prop="现场管理人员"
			  label="现场管理人员"
			  width="145"
			/>
			<el-table-column
			  prop="提交时间"
			  label="提交时间"
			  width="160"
			/>
			<el-table-column
			  prop="开工时间"
			  label="开工时间"
			  width="160"
			/>
			<el-table-column
			  prop="分钟差数"
			  label="分钟差数"
			  width="85"
			/>
			<el-table-column
			  prop="归属时段"
			  label="归属时段"
			  width="160"
			/>
		    </el-table>
		  </div>
		</div>
		  <template #footer>
		    <div class="dialog-footer">
		      <!-- <el-button @click="closeDialog">关 闭</el-button> -->
		      <!-- <el-button type="primary" @click="xunjianerDialog">提 交</el-button> -->
		    </div>
		  </template>
		</el-dialog>
		
		
		<el-dialog
		  v-model="zhichengVisible"
		  title="制程检验记录"
		  destroy-on-close
		  width="1100px"
		  style="height: 78%;"
		>
		  <el-row :gutter="24" style="margin-top=0px; margin-bottom: 1px;">
		    <el-col :span="4" style="margin-top=0px; margin-bottom: 0px;">
		      <el-form-item label="工单编号" prop="id" style="margin-top=0px; margin-bottom: 0px;">
		        <el-input v-model="xunchaData.order" :clearable="true" placeholder="" style="margin-top=0px; margin-bottom: 0px;"/>
		      </el-form-item>
		    </el-col>
		  
		    <el-col :span="9" style="margin-top=0px; margin-bottom: 0px;">
		      <el-row style="margin-top=0px; margin-bottom: 0px;">
		        <el-col style="margin-top=0px; margin-bottom: 0px;">
		          <el-input v-model="xunchaData.product_name" :clearable="true" placeholder="" style="margin-top=0px; margin-bottom: 0px;"/>
		        </el-col>
		      </el-row>
		    </el-col>
				<el-col :span="4" style="margin-top=0px; margin-bottom: 0px;">
				  <el-form-item label="流程单" prop="id" style="margin-top=0px; margin-bottom: 0px;">
					<el-input v-model="xunchaData.lcdh" :clearable="true" placeholder="" style="margin-top=0px; margin-bottom: 0px;"/>
				  </el-form-item>
				</el-col>
		  			
		  </el-row>
		  
		  <el-row :gutter="24" style="margin-top=0px; margin-bottom: 1px;">
		    <el-col :span="3" style="margin-top=0px; margin-bottom: 0px;">
		      <el-form-item label="印件编号" prop="id" style="margin-top=0px; margin-bottom: 0px;">
		        <el-input v-model="xunchaData.yjno" :clearable="true" placeholder="" style="margin-top=0px; margin-bottom: 0px;"/>
		      </el-form-item>
		    </el-col>
		    <el-col :span="10" style="margin-top=0px; margin-bottom: 0px;">
		      <el-row style="margin-top=0px; margin-bottom: 0px;">
		        <el-col style="margin-top=0px; margin-bottom: 0px;">
		          <el-input v-model="xunchaData.gxmc" :clearable="true" placeholder="" style="margin-top=0px; margin-bottom: 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 class="JKWTree-tree" style="height: 100%; border-right: 1px solid #ebeef5;">		          
		          <el-tree :data="zhichengtreeData" :props="defaultProps" highlight-current="true"
		            @node-click="zhichengNodeClick"></el-tree>
		        </div>
		      </el-aside>
		    </div>
		    <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="zhibiaoselectData"
		            row-key="ID"
		            highlight-current-row="true"
		          				:show-overflow-tooltip="true"
		            border  @row-click="dianjianhandle"
		            style="width:100%; height:310px;"
		            @row-dblclick="handleSelectClick"
		            :row-class-name="rowClassName"
		          >
		            <el-table-column
		              prop="检验项目"
		              label="检验项目"
		              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="60"
		            >
		              
		             <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
					  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-table
		            tooltip-effect="dark"
		            :data="fujiaselectData"
		            row-key="ID"
		            highlight-current-row="true"
		          				:show-overflow-tooltip="true"
		            border  @row-click="dianjianhandle"
		            style="width:100%; height:320px;"
		            @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="720"
		            />
		            <el-table-column
		              prop="编号"
		              label="编号"
		              width="80"
		            />
		          </el-table>
		        </el-tab-pane>
		      </el-tabs>
		    </div>
		  </div>
		  <template #footer>
		    <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>
		
		
		<div v-if="dateOn" >
					  <el-tabs v-model="activName" type="card" @tab-click="handleClick">
					    <el-tab-pane label="当日上报产量"  @click="showTable('工艺资料')"  name="first">
					      <el-table ref="multipleTable"
					                :show-overflow-tooltip="true"
					                :row-style="{ height: '20px' }"
					                :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
					                :header-cell-style="{ padding: '0px' }"
					                highlight-current-row="true"
					                style="width: 100%;height: 400px" border tooltip-effect="dark" :data="gytableData" row-key="ID" @selection-change="handleSelectionChange">
					        <el-table-column type="selection" width="55" />
					        <!-- <el-table-column align="left" label="选择" prop="工单编号"  width="100"/> -->
					        <el-table-column align="left" label="产品名称" prop="产品名称"  width="200"/>
					        <el-table-column align="left" label="工序" prop="工序"  width="100"/>
					        <el-table-column align="left" label="备注" prop="备注"  width="100"/>
					        <el-table-column align="left" label="产量" prop="产量"  width="70"/>
					        <el-table-column align="left" label="千件工价" prop="千件工价"  width="85"/>
					        <el-table-column align="left" label="日定额" prop="日定额"  width="85"/>
					        <el-table-column align="left" label="补产标准" prop="补产标准"  width="85"/>
					        <el-table-column align="left" label="难度系数" prop="难度系数"  width="85"/>
					        <el-table-column align="left" label="印刷方式" prop="印刷方式"  width="85"/>
					        <el-table-column align="left" label="组员1" prop="组员1" width="170" />
					        <el-table-column align="left" label="组员2" prop="组员2" width="170" />
					        <el-table-column align="left" label="组员3" prop="组员3" width="170" />
					        <el-table-column align="left" label="组员4" prop="组员4" width="170" />
					        <el-table-column align="left" label="组员5" prop="组员5" width="70" />
					        <el-table-column align="left" label="组员6" prop="组员6" width="70" />
					        <el-table-column align="left" label="组员7" prop="组员7" width="70" />
					        <el-table-column align="left" label="组员8" prop="组员8" width="70" />
					        <el-table-column align="left" label="组员9" prop="组员9" width="70" />
					        <el-table-column align="left" label="组员10" prop="组员10" width="70" />
					  				<el-table-column align="left" label="制程废品" prop="制程废品" width="85" />
					  				<el-table-column align="left" label="制程次品" prop="制程次品" width="85" />
					  				<el-table-column align="left" label="前工序废" prop="前工序废" width="85" />
					  				<el-table-column align="left" label="来料异常" prop="来料异常"  width="85"/>
					  				<el-table-column align="left" label="装版工时" prop="装版工时" width="85" />
					  				<el-table-column align="left" label="保养工时" prop="保养工时" width="85" />
					  				<el-table-column align="left" label="打样工时" prop="打样工时" width="85"/>
					  				<el-table-column align="left" label="异常停机工时" prop="异常总工时"  width="110"/>
					  				<el-table-column align="left" label="通电工时" prop="通电工时" width="85"/>
					  				<el-table-column align="left" label="码开始行" prop="码开始行" width="85" />
					  				<el-table-column align="left" label="码结束行" prop="码结束行" width="85" />
					  				<el-table-column align="left" label="码包" prop="码包" width="70" />
					  				<el-table-column align="left" label="主电表" prop="主电表"  width="70"/>
					  				<el-table-column align="left" label="辅电表" prop="辅电表" width="70" />
					  				<el-table-column align="left" label="色度数" prop="色度数" width="70" />
					  				<el-table-column align="left" label="用户" prop="用户" width="210" />
					  				<el-table-column align="left" label="更新时间" prop="更新时间" width="160" />
					      </el-table>
					    </el-tab-pane>
					  
					    <el-tab-pane label="当日制程检验记录"  @click="showTable('印件资料')"  name="second">
					      <el-table ref="multipleTable"
					                :row-style="{ height: '20px' }"
					                :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
					                :header-cell-style="{ padding: '0px' }"
					                :show-overflow-tooltip="true"
					                highlight-current-row="true"
					                style="width: 100%;height: 400px" border tooltip-effect="dark" :data="drzcDatas" row-key="ID" @selection-change="handleSelectionChange">
					        <el-table-column type="selection" width="55" />
					        <el-table-column align="left" label="工单编号" prop="工单编号"  width="85"/>
					        <el-table-column align="left" label="印件号" prop="印件号" width="70" />
					        <el-table-column align="left" label="工序名称" prop="工序名称" width="85" />
					        <el-table-column align="left" label="检验项目" prop="检验项目" width="85"/>
					  				 <el-table-column
					  				    v-for="time in columnNames"
					  				    :key="time"
					  				    :label="time"
					  				    :prop="time"
					  				    align="center"
					  				    width="80"
					  				  ></el-table-column>
					      </el-table>
					    </el-tab-pane>
					  </el-tabs>
		</div>
		<el-dialog v-model="complaintsShow" style="width: 1000px" lock-scroll :before-close="closecomplaintsShow" title="=客诉记录" destroy-on-close>
		  <el-table ref="multipleTable"
		              :row-style="{ height: '20px' }"
		              :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
		              :header-cell-style="{ padding: '0px' }"
		              :show-overflow-tooltip="true"
		              highlight-current-row="true" @row-click="complaintshandle"
		              style="width: 100%;height: 250px;margin-top: 0px;" border tooltip-effect="dark" 
								:data="complaintsData" row-key="ID" @selection-change="complaintsSelectionChange">
		    <!-- <el-table-column type="selection" width="55" /> -->
		    <el-table-column align="left" label="产品编号" prop="产品编号" width="120"/>
		    <el-table-column align="left" label="产品名称" prop="产品名称" width="200"/>
		    <el-table-column align="left" label="客诉日期" prop="客诉日期" width="120"/>
		    <el-table-column align="left" label="客诉单号" prop="客诉单号" width="120"/>
			<el-table-column align="left" label="客诉方式" prop="客诉方式" width="100"/>
		    <el-table-column align="left" label="订单编号" prop="订单编号" width="100"/>
		    <el-table-column align="left" label="缺陷关键字" prop="缺陷关键字" width="140"/>
		    <el-table-column align="left" label="客诉性质" prop="客诉性质" width="100"/>
		    <el-table-column align="left" label="主要责任部门" prop="主要责任部门" width="140"/>
		    <el-table-column align="left" label="次要责任部门" prop="次要责任部门" width="140"/>
		  </el-table>
				<el-row :gutter="20">
				 <el-col :span="6">
				   <el-form-item label="客户编号" prop="id">
				   <el-input v-model="selectedRowData.客户编号" :clearable="true" placeholder="" />
				   </el-form-item>
				 </el-col>
				 <el-col :span="15">
				   <el-form-item label="客户名称" prop="id">
					<el-input v-model="selectedRowData.客户名称" :clearable="true" placeholder="" />			 
				   </el-form-item>
				 </el-col>
				</el-row>	
					
					 
				<el-row :gutter="20">
				 <el-col :span="6">
				   <el-form-item label="客诉单号" prop="id">
				   <el-input v-model="selectedRowData.客诉单号" :clearable="true" placeholder="" />
				   </el-form-item>
				 </el-col>
				 <el-col :span="5">
				   <el-form-item label="客诉日期" prop="id">
					<el-input v-model="selectedRowData.客诉日期" :clearable="true" placeholder="" />			 
				   </el-form-item>
				 </el-col>
				 <el-col :span="5">
				   <el-form-item label="方式" prop="id">
				 	<el-input v-model="selectedRowData.客诉方式" :clearable="true" placeholder="" />			 
				   </el-form-item>
				 </el-col>
				 <el-col :span="5">
				   <el-form-item label="批次号" prop="id">
				 	<el-input v-model="selectedRowData.订单编号" :clearable="true" placeholder="" />			 
				   </el-form-item>
				 </el-col>
				</el-row>		
				
				
				<el-row :gutter="20">
				 <el-col :span="20">
				   <el-form-item label="反馈问题" prop="id">
				   <el-input v-model="selectedRowData.客诉描述" :clearable="true" placeholder="" />
				   </el-form-item>
				 </el-col>				 
				</el-row>
				
				<el-row :gutter="20">
				 <el-col :span="20">
				   <el-form-item label="缺陷关键字" prop="id">
				   <el-input v-model="selectedRowData.缺陷关键字" :clearable="true" placeholder="" />
				   </el-form-item>
				 </el-col>				 
				</el-row>
				
				<el-row :gutter="20">
				 <el-col :span="5">
				   <el-form-item label="性质" prop="id">
				   <el-input v-model="selectedRowData.客诉性质" :clearable="true" placeholder="" />
				   </el-form-item>
				 </el-col>
				 <el-col :span="5">
				   <el-form-item label="扣分" prop="id">
					<el-input v-model="selectedRowData.扣分" :clearable="true" placeholder="" />			 
				   </el-form-item>
				 </el-col>
				</el-row>
					<div style="display: flex;">
					
					
					</div>
		</el-dialog>
		
		
		<el-dialog
		  v-model="huanxingVisible"
		  title="换型清场"
		  destroy-on-close
		  width="1100px"
		  style="height: 78%;"
		>
		  <div style="display: flex;">
		    <div style="flex: 0.1;">
		      <el-aside width="180px" style="margin: 0;">
		        <div class="JKWTree-tree" style="height: 55vh; border-right: 1px solid #ebeef5;">		          
		          <el-tree :data="huanxingtreeData" :props="defaultProps" highlight-current="true"
		            @node-click="huanxingNodeClick"></el-tree>
		        </div>
		      </el-aside>
		    </div>
		    <div v-if="huanxingstatus" style="flex: 0; margin: 0;">
		      <el-tabs v-model="activNames" type="card" @tab-click="handleClick">
		        <el-tab-pane label="换型清场明细信息"  @click="showTable('换型清场明细信息')"  name="first">
		          
		        </el-tab-pane>
		      
		        <el-tab-pane label="当前设备换型记录" style="width: 110%;"  @click="showTable('当前设备换型记录')"  name="second">
		          <el-table
		            tooltip-effect="dark"
		            :data="huanxingselectData"
		            row-key="ID" 
		            highlight-current-row="true"
		          	:show-overflow-tooltip="true"
		            border  @row-click="dianjianhandle"
		            style="width:30%; height:50vh;"
		            @row-dblclick="handleSelectClick"
		            :row-class-name="rowClassName"
		          >
		            <el-table-column
		              prop="日期"
		              label="日期"
		              width="160"
		            />
		            <el-table-column
		              prop="机台编号"
		              label="机台编号"
		              width="90"
		            />
					<el-table-column
					  prop="班组"
					  label="班组"
					  width="70"
					/>
					<el-table-column
					  prop="工单编号A"
					  label="工单编号A"
					  width="95"
					/>
					<el-table-column
					  prop="印件名称A"
					  label="印件名称A"
					  width="130"
					/>
					<el-table-column
					  prop="印件工序A"
					  label="印件工序A"
					  width="150"
					/>
					<el-table-column
					  prop="码包号A"
					  label="码包号A"
					  width="80"
					/>
					<el-table-column
					  prop="工单编号B"
					  label="工单编号B"
					  width="100"
					/>
					<el-table-column
					  prop="印件名称B"
					  label="印件名称B"
					  width="100"
					/>
					<el-table-column
					  prop="印件工序B"
					  label="印件工序B"
					  width="150"
					/>
					<el-table-column
					  prop="码包号B"
					  label="码包号B"
					  width="80"
					/>
					<el-table-column
					  prop="清场项目A"
					  label="菲林_标样_签样品_留样品"
					  width="190"
					/>
					<el-table-column
					  prop="清场项目B"
					  label="版材_纸张_电化铝_油墨"
					  width="190"
					/>
					<el-table-column
					  prop="清场项目C"
					  label="过版纸_废品_次品"
					  width="170"
					/>
					<el-table-column
					  prop="清场项目D"
					  label="半成品_成品_零头"
					  width="170"
					/>
					<el-table-column
					  prop="清场项目E"
					  label="操作台桌面_抽屉_地面"
					  width="180"
					/>
					<el-table-column
					  prop="机长"
					  label="机长"
					  width="80"
					/>
					<el-table-column
					  prop="班长"
					  label="带班长"
					  width="80"
					/>
					<el-table-column
					  prop="质量巡查员"
					  label="质量巡查员"
					  width="100"
					/>
					<el-table-column
					  prop="创建时间"
					  label="创建时间"
					  width="120"
					/>
					<el-table-column
					  prop="UNIQID"
					  label="UNIQID"
					  width="80"
					/>
		          </el-table>
		        </el-tab-pane>
		      </el-tabs>
		    </div>
		  </div>
		</el-dialog>
		
		<Shebeizhuangtai
		  v-if="dialogSbyxgl"
		  v-model="dialogSbyxgl"
		  title="【01.30 08:30】【JY01#--海德堡对开八色平版胶印机(JY08-01)】【2311116-->钻石(荷花）盒包装纸】【01--胶印】"
		  :formData="formData"
		/>
		
        </el-main>

      </el-container>
    </el-container>





  </div>
</template>

<script setup>
import {
  createCompany,
  deleteCompany,
  deleteCompanyByIds,
  updateCompany,
  findCompany,
  getCompanyList
} from '@/api/company'

import {
  facilityTab,
  facilitychanLiang,
  facilityInspect,
  facilityProduction,
  facilityTeam,
  facilityMachineList,
  facilitySpotCheckItem,
  facilityInspectionItem,
  reportProduceInfo,
  reportName,
  reportInfo,
  reportMachineMac,
  facilityWorklist,
  setProcessStatus,
  submitDailyProduction,
  facilityDetail,
  inspectionRecord,
  getYg,
  facilityProcedure,
  facilityPrintGetTab,
  facilityPrintDetail,
  ProcessInspectionRecordsItem,
   MachineDetailList,
   ComplaintRecord,
   remodelGetTab,
   ModelChangeRecord
} from '@/api/jixiaoguanli/jitairibaobiao'

import {
  FieldInspectionRecord
} from "@/api/mes/job";
import Shebeizhuangtai from '@/view/performance/09-workOrderVerification/componets/shebeizhuangtai.vue'
// 全量引入格式化工具 请按需保留
import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
import { ElMessage, ElMessageBox } from 'element-plus'
import { ref, reactive } from 'vue'

defineOptions({
    name: 'Company'
})
const gytableData = ref([])
const drzcDatas =ref([])
const detailData = reactive([])
const treeData=ref([])
const yinbantreeData=ref([])
let  dianjiantreeData;
let JTMC=ref()
let date=ref()
let JTMCOn=ref()
let dateOn=ref()
const  activName  = ref('first')
let productCode=ref()
const sbzyData = reactive([])
const FPData = reactive([])
const CLMXData = reactive([])
let JYData = reactive([])
const selectData = ref([])
const handleNodeClick = (nodeData,node) => {
  //存放当前节点的nodeId
   if (nodeData.level === 1) {
        console.log(node.label); // 第一级节点
      } else if (nodeData.level === 2) {
        console.log(node.label); // 第二级节点
		JTMC=node.label.split("-")[0]
		JTMCOn.value=true
		dateOn.value=false
		FacilityProduction()
		FacilityWorklist()
		
		
		// FacilityTeam(JTMC)
		// console.log('123')
		// console.log(JTMC)
      } else if (nodeData.level === 3) {
		  JTMC=nodeData.machineName.split("-")[0]
		  JTMCOn.value=false
		  dateOn.value=true
		  date=node.label
		  gytableData.value=[]
		  drzcDatas.value=[]
		  columnNames=[]
		  drzcData=[]
		  FacilityInspect()
		  FacilitychanLiang()
		  
		  // FacilityTeam(JTMC)
		  // InspectionRecord()
		  // FacilityDetail()
          console.log(node.label); // 第三级节点
	   }      
}
//当前生产订单
const FacilityProduction = async () => {
  const response = await facilityProduction({machine:JTMC});
  if (response.code === 0) {
	console.log(response)
	// 填充formData对象的基本字段
	    formData.value.工单编号 = response.data.工单编号;
	    formData.value.印件编号 = response.data.印件号;
	    formData.value.工序名称 = response.data.工序名称;
	    formData.value.产品名称 = response.data.产品名称;
		formData.value.班组 = response.data.班组编号;
		let sczl_bhkey=''
		let sczl_namekey=''
		if (response.data.班组成员) {
		  for (let i = 1; i <= Math.min(Object.keys(response.data.班组成员).length, 6); i++) {
						 sczl_bhkey=`sczl_bh${i}`
						 sczl_namekey=`sczl_name${i}`
		    formData.value[sczl_bhkey] = response.data.班组成员[i]['编号'];
		    formData.value[sczl_namekey] = response.data.班组成员[i]['姓名'];
		  }
		}
		formData.value.JTMC=JTMC
		const responses = await MachineDetailList({workshop:'胶印车间'});
		if(responses.code===0){
				   responses.data.map(item=>{
					   if(item.设备编号==JTMC){
						   formData.value.status=item.状态
					   }
				   })
		}
		// console.log(formData.value.工单编号)
		
  }
  // getTableData()
}
let CJMC=ref()
//设备工作清单
const FacilityWorklist = async () => {
  const response = await facilityWorklist({machine:JTMC});
  if (response.code === 0) {
	console.log(response)
	sbzyData.splice(0, sbzyData.length, ...response.data);
	const res = await facilityProcedure({ Gd_gdbh: sbzyData[0]['工单编号|质量信息'].substring(0, 7) })
	formData.value.productCode= response.data[0]['产品代号']
	console.log(res)
	if (res.code === 0) {
	    selectData.value = res.data
	}
	console.log('22222222')
	FacilityTeam(JTMC)
  }
}
//检验记录
const InspectionRecord = async () => {
	console.log(formData.value.班组)
  // const response = await inspectionRecord({machine:JTMC,Gd_gdbh:formData.value.工单编号,team:formData.value.班组});
  const response = await inspectionRecord({machine:'JY01#',Gd_gdbh:'2311114',team:'A班'});
  // const response = await inspectionRecord({machine:'JY01#',Gd_gdbh:'2312191',team:'A班'});
  console.log(response)
  if(response.code==0){
	 // 提取 inspectiontime 作为列名
	        // Extract inspectiontime as columnNames
	  columnNames = response.data.inspectiontime;

	  // Populate drzcData with row data
	  for (const key in response.data) {
		if (key !== 'inspectiontime') {
		  const item = response.data[key];
		  const rowData = {
			'工单编号': item['工单编号'],
			'印件号': item['印件号'],
			'工序名称': item['工序名称'],
			'检验项目': item['检验项目']
		  };

		  // Initialize time columns with '—'
		 columnNames.forEach(time => {
			rowData[time] = '';
		  });

		  // Split inspectresult and fill the corresponding time columns
		  const results = item['inspectresult'].split(',');
		  results.forEach(result => {
			if (columnNames.includes(result)) {
			  rowData[result] = '√';
			}else{rowData[result] = ''}
		  });

		  // Add the row data to drzcData
		  JYData.push(rowData);
		}
	  }
	  console.log(JYData);
  }
}
//当班产量明细
const FacilityDetail = async () => {
	console.log('123123')
	console.log(JTMC)
	console.log('123123')
	console.log(formData.value.工单编号)
	console.log('123123')
	console.log(formData.value.班组)
  // const response = await facilityDetail({ machine: JTMC, Gd_gdbh: formData.value.工单编号, team: formData.value.班组 });
   const response = await facilityDetail({ machine: 'JY01#', Gd_gdbh: '2312191', team: 'A班' });
  // const response = await facilityDetail({ machine: JTMC, Gd_gdbh: '2311114', team:'A班' });
  if (response.code === 0) {
	console.log('123123')
    console.log(response);
    CLMXData.splice(0, CLMXData.length, ...Object.values(response.data));
  }
};
//员工编号回车事件
const getygsubmit = (event, inputName) => {

	  console.log(inputName)
	 
		  let combinedString = 'sczl_bh' + inputName;
		   console.log(combinedString)
		  //  let variableName = 'sczl_gdbh'+inputName;
		   let variableValue = eval('formData3.value.' + combinedString);
		   console.log(variableValue)
		   GetYg(variableValue,inputName)  
}
//获取员工信息
const GetYg = async (value,inputName) => {
  const response = await getYg({sczl_bh:value});
  console.log(response) 
  if (response.code === 0) {
	console.log(response.data.ygxm) 
	let Bname = 'sczl_name' + inputName;
	formData3.value[Bname]=response.data.ygxm
	// console.log(formData.value[Bname])
  }
}

// 验证规则
const rule = reactive({
})

const searchRule = reactive({
  createdAt: [
    { validator: (rule, value, callback) => {
      if (searchInfo.value.startCreatedAt && !searchInfo.value.endCreatedAt) {
        callback(new Error('请填写结束日期'))
      } else if (!searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt) {
        callback(new Error('请填写开始日期'))
      } else if (searchInfo.value.startCreatedAt && searchInfo.value.endCreatedAt && (searchInfo.value.startCreatedAt.getTime() === searchInfo.value.endCreatedAt.getTime() || searchInfo.value.startCreatedAt.getTime() > searchInfo.value.endCreatedAt.getTime())) {
        callback(new Error('开始日期应当早于结束日期'))
      } else {
        callback()
      }
    }, trigger: 'change' }
  ],
})

const elFormRef = ref()
const elSearchFormRef = ref()

// =========== 表格控制部分 ===========
const page = ref(1)
const total = ref(0)
const pageSize = ref(10)
const tableData = ref([])
const searchInfo = ref({})
const xunchaVisible = ref(false)
const xunchatreeData=ref([{label: '现场巡查记录',} ])

// 重置
const onReset = () => {
  searchInfo.value = {}
  getTableData()
}

// 搜索
const onSubmit = () => {
  elSearchFormRef.value?.validate(async(valid) => {
    if (!valid) return
    page.value = 1
    pageSize.value = 10
    getTableData()
  })
}

// 分页
const handleSizeChange = (val) => {
  pageSize.value = val
  getTableData()
}

// 修改页面容量
const handleCurrentChange = (val) => {
  page.value = val
  getTableData()
}

const getTableData = async () => {
  const response = await facilityTab();
  if (response.code === 0 && response.data) {
    const workshops = response.data; // 车间数据

    // 在推送新项之前将 treeData 重置为空数组
    treeData.value = []; // 使用 .value 访问响应式引用的值

    for (const workshopName in workshops) {
      const workshopNode = {
        label: workshopName,
        children: [],
        level: 1 // 添加层级属性
      };

      const machines = workshops[workshopName]; // 车间下的机器

      for (const machineName in machines) {
         const machineNode = {
           label: machineName,
           children: [],
           level: 2, // 添加层级属性
           parentNode: workshopNode
         };
      
        // Now that machineNode is initialized, you can refer to it
         const childrenNodes = machines[machineName].map(dateTime => {
             const dateOnly = dateTime.split(' ')[0];
             return {
               label: dateOnly,
			   machineName:machineName,
               level: 3, // 添加层级属性
               parentNode: machineNode
             };
           });
      
        // Assign the childrenNodes to the machineNode's children property
        machineNode.children = childrenNodes;
      
        // Finally, push the machineNode to the workshopNode's children array
        workshopNode.children.push(machineNode);
      }

      // 将 workshopNode 推送到响应式 treeData 数组
      treeData.value.push(workshopNode);
    }
  }
};
// 查询
const getTableList = async() => {
  const table = await getCompanyList({ page: page.value, pageSize: pageSize.value, ...searchInfo.value })
  if (table.code === 0) {
    tableData.value = table.data.list
    total.value = table.data.total
    page.value = table.data.page
    pageSize.value = table.data.pageSize
  }
}

getTableData()
//删除
function onDel() {
	
}

//制程检验
const zhichengstatus=ref(false)
const xunchaData = ref([]);
const zhichengVisible = ref(false)
const zhichengtreeData=ref([{
	label: '首件与过程确认'
},{
	label: '机台检验'
},{
	label: 'IPQC检验'
}])
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 category =ref()
const zhibiaoselectData=ref([])
const fujiaselectData=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 dialogSbyxgl=ref(false)
function onstatus() {
	dialogSbyxgl.value=true
	 SetMachineStatus()
	 // ReportProduceInfo()
}

//设置机台状态
const SetMachineStatus = async () => {
  // const response = await setMachineStatus({
	 //  machine:'JY03',
	 //  gy_name:'02-胶印〖白、黑、哑油【预干】、NT光油',
	 //  order:'2311114',
	 //  yjno:'1',
	 //  class:'ZM00545,ZM01351,ZM01170',
	 //  status:'维修',
	 //  production_now:'',
	 //  production_all:'',
  // });
  // if (response.code === 0) {
  // }
}

//客诉记录
const complaintsShow = ref(false)
const complaintsData = reactive([])
function oncomplaints() {
	Complaints()
	
}
// 客诉记录表格填充
const Complaints = async() => {
	// console.log(sbzyData[0].产品代号)
	// console.log(sbzyData[0].产品代号)
	// console.log(sbzyData[0].产品代号)
    // const res = await ComplaintRecord({productCode :cpcode.value})
	const res = await ComplaintRecord({productCode :'100601011'})
    if (res.code === 0) {			
		if(res.data==null){
			console.log('暂无客诉记录')
		}else{
			complaintsData.splice(0, complaintsData.length, ...res.data);
			console.log(complaintsData);
			console.log(complaintsData[0].产品编号)
			selectedRowData.value=complaintsData[0]
			console.log(selectedRowData)
			complaintsShow.value=true
		}
		
    }
}
const selectedRowData = ref({

})
//客诉表格单击
const complaintshandle = (val, row) => {
	console.log(val)
	selectedRowData.value=val
};
//换型清场
const huanxingVisible = ref(false)
const huanxingtreeData=ref([])
const huanxingselectData = ref([])
const huanxingstatus=ref(false)
const activNames=ref('first')
function onClear() {
	huanxingVisible.value=true
	 RemodelGetTab()
}
const RemodelGetTab = async() => {
  const response = await remodelGetTab()
  let arr=[]
  if (response.code === 0) {
	  for(let key in response.data){
		  if(response.data[key][0]){
			  let children =[]
			  for (let i = 0; i < response.data[key].length; i++) {
				  children.push({label:response.data[key][i],machine:key})
			  }
			  arr.push({
				  label:key,
				  children:children
			  })
			  console.log(response.data[key].length)
		  }else{
			 arr.push({label:key}) 
		  }
	  }
	  huanxingtreeData.value=arr
  }
}

const huanxingNodeClick = (node) => {
  //存放当前节点的nodeId
  if(node.machine){
	  huanxingstatus.value=true
	  modelChangeRecord(node.machine)
  }else{
	  console.log('2')
  }
}
const modelChangeRecord = async (val) => {
  const response = await ModelChangeRecord({machine:val});
  if (response.code === 0) {
	huanxingselectData.value=response.data
  }
}
import { nextTick } from 'vue';
//设备点检
function ondianjian() {
  getSpotCheckItem(JTMC).then(treeData  => {
    if (treeData) {
      // 如果获取成功，treeData 就是我们需要的树形结构数据
      dianjiantreeData = treeData;
      console.log('222');
      console.log(dianjiantreeData);
      // 使用 nextTick 来确保在更新 dianjianVisible 后立即刷新视图
      nextTick(() => {
        dianjianVisible.value = true;
      });
      // 这里可以处理treeData，例如将其赋值给某个状态管理变量或者用于渲染界面
    } else {
      // 如果获取失败，则treeData为null
      console.log('获取巡检项目树形结构数据失败');
    }
  });
  
}

const onyinban = async() => {
	const res = await facilityPrintGetTab({productCode:formData.value.productCode})
	if(res.code===0){
		yinbantreeData.value=[{
			label:'产品印版库',
			children:res.data.map(item=>({
			label:item.印版分类,
			code:item.编号
		}))
		}]
		console.log(res.data.map(item=>({
			label:item.印版分类,
			code:item.编号
		})))
		yinbanVisible.value = true;
	}
}
const onxuncha = async() => {
	xunchaVisible.value=true
}

//获取设备点检->检验项目
// const FacilityInspectionItem = async (value) => {
//   try {
//     // 调用接口获取巡检项目数据
//     const response = await facilityInspectionItem({ unitName: value });
//     // 检查接口返回的状态码
//     if (response.code === 0) {
// 	 dianjianselectData.splice(0, dianjianselectData.length, ...response.data.map(item=>{
// 		 item.notjc=true;
// 		 item.zc=false;
// 		 item.yc=false;
// 		 return item
// 	 }))
// 	 console.log(dianjianselectData)
//     }
//   } catch (error) {
//     // 捕获并打印异常
//     console.error("获取巡检项目数据出错：" + error);
//     return null;
//   }
// };
//获取设备点检->检验项目
const FacilityInspectionItem = async (value) => {
  try {
    // 调用接口获取巡检项目数据
    const response = await facilityInspectionItem({ unitName: value ,machine:JTMC.split("#")[0]});
    // 检查接口返回的状态码
    if (response.code === 0) {
     console.log(response)
	 dianjianselectData.splice(0, dianjianselectData.length, ...response.data.map(item=>{
		 item.notjc=true;
		 item.zc=false;
		 item.yc=false;
		 item.remark=''
		 item.unitName=value
		 item.team=BZMC.value
		 item.machine=JTMC
		 return item
	 }))
    }
  } catch (error) {
    // 捕获并打印异常
    console.error("获取巡检项目数据出错：" + error);
    return null;
  }
};
//机台印版领用->右侧详情
const facilityPrintDetailItem = async (value) => {
  try {
    // 调用接口获取巡检项目数据
    // const response = await facilityPrintDetail({ workOrder: formData.value.工单编号,code:value,productCode:productCode.value });
	const response = await facilityPrintDetail({ workOrder: '2312165',code:'0521',productCode:'104601001' });
    // 检查接口返回的状态码
    if (response.code === 0) {
     console.log(response)
	 yinbanselectData.value=response.data
    }
  } catch (error) {
    // 捕获并打印异常
    console.error("获取数据出错：" + error);
    return null;
  }
};

//树形结构单机
const dianjianselectData = reactive([])
const yinbanselectData = ref([])
const xunchaselectData = ref([])
const dianjianNodeClick = (node, check, nodeData) => {
  if (node.children && node.children.length > 0) {
    // 点击的是父节点，且有子节点
    // 执行相应的父节点单击事件处理逻辑
    // 这里可以添加你想要的处理逻辑，比如展开/折叠节点等
  } else {
    // 点击的是子节点，或者没有子节点
    // 执行相应的子节点单击事件处理逻辑
	console.log(node.label)
	console.log(JTMC.split("#")[0])
	 // FacilityInspectionItem({unitName:node.label ,machine:JTMC.split("#")[0]})
	
     FacilityInspectionItem(node.label,)
	 
  }
};
const yinbanNodeClick = (node, check, nodeData) => {
  if (node.children && node.children.length > 0) {
    // 点击的是父节点，且有子节点
    // 执行相应的父节点单击事件处理逻辑
    // 这里可以添加你想要的处理逻辑，比如展开/折叠节点等
  } else {
    // 点击的是子节点，或者没有子节点
    // 执行相应的子节点单击事件处理逻辑
     facilityPrintDetailItem(node.code)
  }
};
const xunchaNodeClick = (node, check, nodeData) => {
	if(node){
		fieldInspectionRecord()
	}
}

const fieldInspectionRecord = async () => {
	const response = await FieldInspectionRecord({ workOrder: '2311114',team:'A班',start:'2024-01-19 08:30:00' });
	if (response.code === 0) {
		xunchaselectData.value=response.data
	}
}

let pandingfangfa=ref()
//检验项目单击
const dianjianhandle =  (val, row) => {
  try {
    pandingfangfa.value = val.判定标准;
  } catch (error) {
    console.error('An error occurred:', error);
  }
};
const notjcClick =  (val) => {
  try {
	if(val.notjc==false){
		val.zc=true
	}else{
		val.zc=false
		val.yc==false
	}
  } catch (error) {
    console.error('An error occurred:', error);
  }
};
const zcClick =  (val) => {
  try {
	if(val.zc==false){
		val.zc=true
	}else{
		val.zc=false
		val.yc==false
	}
  } catch (error) {
    console.error('An error occurred:', error);
  }
};
const ycClick =  (val) => {
  try {
	if(val.yc==false){
		val.zc=true
	}else{
		val.zc=false
		val.notjc==false
	}
  } catch (error) {
    console.error('An error occurred:', error);
  }
};

const rowClassName = (row, column) => {
  try {
    if (row.unchecked) {
      return 'row-yellow';
    }
    return '';
  } catch (error) {
    console.error('An error occurred:', error);
    return '';
  }
};

// 异步函数，用于获取指定设备的巡检项目，并且将结果格式化为树形结构数据
const getSpotCheckItem = async (machineName) => {
  try {
    // 调用接口获取巡检项目数据
    const response = await facilitySpotCheckItem({ machine: machineName });
    // 检查接口返回的状态码
    if (response.code === 0) {
      // 构建树形结构数据
      const childrenData = Object.entries(response.data).map(([id, label]) => {
        return {
          id,    // 子节点的唯一标识
          label, // 子节点的标签
          children: [] // 初始化子节点数组
        };
      });

      // 创建包含父节点的树形结构数据
      const treeData = [{
        id: machineName,    // 父节点的唯一标识
        label: machineName, // 父节点的标签
        children: childrenData // 子节点数据
      }];

      // 返回构建好的树形结构数据
      return treeData;
    } else {
      // 如果接口返回的状态码不是0，打印错误信息
      console.error("接口返回错误：" + response.msg);
      return null;
    }
  } catch (error) {
    // 捕获并打印异常
    console.error("获取巡检项目数据出错：" + error);
    return null;
  }
};

// 班组人员及分配比例
const FacilityTeam = async (value) => {
  const response = await facilityTeam({ machine: value });
  if (response.code === 0) {
	// formData.value.班组 = response.data[0]['班组号'];
	BZMC.value=response.data[0]['班组号']
	// if(response.data[0][2]){
	// 	// console.log(response.data[0][2].split(' '));
	// 	for (let i = 1; i <= 3; i++) {
	// 	  const sczl_bh = `sczl_bh${i}`;
	// 	  const sczl_name = `sczl_name${i}`;
	// 	  formData.value[sczl_bh] = response.data[0][i-1].split(' ')[0];
	// 	  formData.value[sczl_name] = response.data[0][i-1].split(' ')[1];
		 
	// 	}
	// }
	// if(response.data[0][0]){
	// 	// console.log(response.data[0][2].split(' '));
	// 	for (let i = 1; i <= 1; i++) {
	// 	  const sczl_bh = `sczl_bh${i}`;
	// 	  const sczl_name = `sczl_name${i}`;
	// 	  formData.value[sczl_bh] = response.data[0][i-1].split(' ')[0];
	// 	  formData.value[sczl_name] = response.data[0][i-1].split(' ')[1];
		 
	// 	}
	// }
	// if(response.data[0][1]){
	// 	// console.log(response.data[0][2].split(' '));
	// 	for (let i = 1; i <= 2; i++) {
	// 	  const sczl_bh = `sczl_bh${i}`;
	// 	  const sczl_name = `sczl_name${i}`;
	// 	  formData.value[sczl_bh] = response.data[0][i-1].split(' ')[0];
	// 	  formData.value[sczl_name] = response.data[0][i-1].split(' ')[1];
		 
	// 	}
	// }
	// if(response.data[0][3]){
	// 	// console.log(response.data[0][2].split(' '));
	// 	for (let i = 1; i <= 4; i++) {
	// 	  const sczl_bh = `sczl_bh${i}`;
	// 	  const sczl_name = `sczl_name${i}`;
	// 	  formData.value[sczl_bh] = response.data[0][i-1].split(' ')[0];
	// 	  formData.value[sczl_name] = response.data[0][i-1].split(' ')[1];
		 
	// 	}
	// }

	InspectionRecord()
	FacilityDetail()
    // 清空 bzData 数组
    bzData.splice(0, bzData.length);

    // 遍历接口返回的数据，并给每个对象添加 JTMC 属性
    const updatedData = response.data.map(item => {
      return { ...item, JTMC: value }; // 添加 JTMC 属性
    });

    // 将更新后的数据添加到 bzData 数组
    bzData.push(...updatedData);
	FPData.push(...updatedData)
	return 1
  }
};
//班组维护
function onBZ() {
	FacilityTeam(JTMC)
	fetchData()
	detailShow.value=true
	console.log('2222')
}
const currentBz ={}
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 dropdownOptions = ref([]);
    // 选中的选项
    const selectedOption = ref('');
 // 获取接口数据并转换为下拉框需要的格式
const fetchData = async () => {
  try {
    // Simulate API call
    const response = await facilityMachineList();
    if (response.code === 0) {
      // Transform data format
      const options = response.data.map((item) => ({
        label: item,
        value: item
      }));
      dropdownOptions.value = options;

      // Default to selecting the first option
       const defaultOption = options.find(option => option.value === JTMC);
		if (defaultOption) {
		  selectedOption.value = defaultOption.value;
		} else if (options.length > 0) {
		  // 如果 myDefaultValue 不在选项中，选择第一个选项
		  selectedOption.value = options[0].value;
		}
    }
  } catch (error) {
    console.error('Error fetching data:', error);
    // Handle the error appropriately
  }
};
// formData
let BZMC=ref()
let lastCellValue=ref()
let parts =reactive([])
// 自动化生成的字典（可能为空）以及字段
const formData= ref({
	工单编号:'',
	印件编号:'',
	工序名称:'',
	产品名称:'',
	sczl_bh1:'',
	sczl_bh2:'',
	sczl_bh3:'',
	sczl_bh4:'',
	sczl_bh5:'',
	sczl_bh6:'',
	sczl_bh7:'',
	sczl_bh8:'',
	sczl_bh9:'',
	sczl_bh10:'',
	sczl_name1:'',
	sczl_name2:'',
	sczl_name3:'',
	sczl_name4:'',
	sczl_name5:'',
	sczl_name6:'',
	sczl_name7:'',
	sczl_name8:'',
	sczl_name9:'',
	sczl_name10:'',
})
const formDatasData= reactive([])

const formDatas = ref({
  code1:'',
  code2:'',
  code3:'',
  code4:'',
  code5:'',
  code6:'',
  code7:'',
  code8:'',
  code9:'',
  code10:'',
  name1:'',
  name2:'',
  name3:'',
  name4:'',
  name5L:'',
  name6:'',
  name7:'',
  name8:'',
  name9:'',
  name10:'',
  percentage1:'',
  percentage2:'',
  percentage3:'',
  percentage4:'',
  percentage5:'',
  percentage6:'',
  percentage7:'',
  percentage8:'',
  percentage9:'',
  percentage10:'',
})


//班组单击
const BZhandle = (val, row) => {
  formDatas.value  = {};
  for (const key in val) {
    if (val[key] === 0) {
      break;
    }
    const parts = val[key].split(/[\s()]+/);
    const code = parts[0];
    const name = parts[1];
    const percentage = parts[2];

    // 根据索引填充不同的字段
    const index = parseInt(key) + 1; // 索引从1开始
    formDatas.value['code' + index] = code;
    formDatas.value['name' + index] = name;
    formDatas.value['percentage' + index] = percentage;
  }
};

	

// ============== 表格控制部分结束 ===============

// 获取需要的字典 可能为空 按需保留
const setOptions = async () =>{
}

// 获取需要的字典 可能为空 按需保留
setOptions()


// 多选数据
const multipleSelection = ref([])
// 多选
const handleSelectionChange = (val) => {
    multipleSelection.value = val
}

// 删除行
const deleteRow = (row) => {
    ElMessageBox.confirm('确定要删除吗?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
    }).then(() => {
            deleteCompanyFunc(row)
        })
    }


// 批量删除控制标记
const deleteVisible = ref(false)

// 多选删除
const onDelete = async() => {
      const ids = []
      if (multipleSelection.value.length === 0) {
        ElMessage({
          type: 'warning',
          message: '请选择要删除的数据'
        })
        return
      }
      multipleSelection.value &&
        multipleSelection.value.map(item => {
          ids.push(item.ID)
        })
      const res = await deleteCompanyByIds({ ids })
      if (res.code === 0) {
        ElMessage({
          type: 'success',
          message: '删除成功'
        })
        if (tableData.value.length === ids.length && page.value > 1) {
          page.value--
        }
        deleteVisible.value = false
        getTableData()
      }
    }

// 行为控制标记（弹窗内部需要增还是改）
const type = ref('')

// 更新行
const updateCompanyFunc = async(row) => {
    const res = await findCompany({ ID: row.ID })
    type.value = 'update'
    if (res.code === 0) {
        formData.value = res.data.recompany
        dialogFormVisible.value = true
    }
}
const cpcode=ref('')
const yjupdateCompanyFunc = async(row) => {
    const res = await facilityProcedure({ Gd_gdbh: row['工单编号|质量信息'].substring(0, 7) })
	console.log(res)
    if (res.code === 0) {
        selectData.value = res.data
    }
	console.log(row)
	cpcode.value=row.产品代号
    console.log(cpcode)
}

// 删除行
const deleteCompanyFunc = async (row) => {
    const res = await deleteCompany({ ID: row.ID })
    if (res.code === 0) {
        ElMessage({
                type: 'success',
                message: '删除成功'
            })
            if (tableData.value.length === 1 && page.value > 1) {
            page.value--
        }
        getTableData()
    }
}

// 弹窗控制标记
const dialogFormVisible = ref(false)
const dianjianVisible = ref(false)
const yinbanVisible = ref(false)
// 查看详情控制标记
const detailShow = ref(false)
const bzData = reactive([])
// 打开详情弹窗
const openDetailShow = () => {
  detailShow.value = true
}


// 打开详情
const getDetails = async (row) => {
  // 打开弹窗
  const res = await findCompany({ ID: row.ID })
  if (res.code === 0) {
    formData.value = res.data.recompany
    openDetailShow()
  }
}


// 关闭详情弹窗
const closeDetailShow = () => {
  detailShow.value = false
}


// 打开弹窗
const openDialog = () => {
    // type.value = 'create'
	console.log('222')
	FacilityInspect()
	FacilitychanLiang()
    dialogFormVisible.value = true
}
let drzcData=[]
let columnNames=[]
//当日制程检验记录
const FacilityInspect = async () => {
  const response = await facilityInspect({machine:JTMC,date:date});
  console.log(response)
  if(response.code==0){
	 // 提取 inspectiontime 作为列名
	        // Extract inspectiontime as columnNames
	  columnNames = response.data.InspectionTime;
	  // Populate drzcData with row data
	  for (const key in response.data.row[0]) {
		if (key !== 'InspectionTime') {
		  const item = response.data.row[0][key];
		  const rowData = {
			'工单编号': item['工单编号'],
			'印件号': item['印件号'],
			'工序名称': item['工序名称'],
			'检验项目': item['检验项目']
		  };
		  // Initialize time columns with '—'
		 columnNames.forEach(time => {
			rowData[time] = '';
		  });

		  // Split inspectresult and fill the corresponding time columns
		  const results = item['time'].split(',');
		  results.forEach(result => {
			if (columnNames.includes(result)) {
			  rowData[result] = '√';
			}else{rowData[result] = ''}
		  });

		  // Add the row data to drzcData
		  drzcData.push(rowData);
		}
	  }
	  drzcDatas.value=drzcData
	  console.log(drzcData);
  }
}
const FacilitychanLiang = async () => {
  const response = await facilitychanLiang({machine:JTMC,date:date});
  if(response.code==0){
	 delete response.data['totalA']
	 delete response.data['totalB']
	 gytableData.value=Object.values(response.data)
  }
}

// 关闭弹窗
const closeDialog = () => {
    dialogFormVisible.value = false
    formData.value = {
        address: '',
        image: '',
        name: '',
        }
}
// 弹窗确定
const enterDialog = async () => {
     elFormRef.value?.validate( async (valid) => {
             if (!valid) return
              let res
              switch (type.value) {
                case 'create':
                  res = await createCompany(formData.value)
                  break
                case 'update':
                  res = await updateCompany(formData.value)
                  break
                default:
                  res = await createCompany(formData.value)
                  break
              }
              if (res.code === 0) {
                ElMessage({
                  type: 'success',
                  message: '创建/更改成功'
                })
                closeDialog()
                getTableData()
              }
      })
}

</script>

<style>
.JKWTree-container {
  display: flex;
}

.JKWTree-tree {
  width: 300px;
  background-color: #fff;
  padding: 10px;
  margin-right: 20px;
}

.JKWTree-tree h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 10px 0;
}

.JKWTree-content {
  flex: 1;
}
/* 选中某行时的背景色*/
.el-table__body tr.current-row>td {
  background: #ff80ff !important;
}
.groupbox
      {margin:10px;
      width:500px;
      height:500px;
     border:thin solid black;
     padding:10px}
  .grouptitle
      {display:block;
     margin-top:-24px;
     margin-left:20px;
     width:150px;
     text-align:center;
     background-color:white}
</style>