	
	var Wellcomponent = {
		template:`
		<div>
			<div style="display: flex;">
				<!--
				<el-input v-model="value1" placeholder="Y/M/D-Y/M/D" clearable style="width: 160px;"  @change="input_change"></el-input>
				
				<el-input v-model="id_v" placeholder="序号" clearable style="width: 100px;" @change="input_change"></el-input>
				--><el-date-picker
					v-if="false"
					placeholder="下发日期"
					style="width: 135px;"
					 v-model="dispatch_date_v"
					 type="date"
					format="yyyy/MM/dd"
					value-format="yyyy/MM/dd">
				</el-date-picker>
				<el-input v-model="rid_v" placeholder="订单号" clearable style="width: 105px;" @change="input_change"></el-input>
				<el-input v-model="pid_v" placeholder="产品编号" clearable style="width: 105px;" @change="input_change"></el-input>
				<el-input v-model="pname_v" placeholder="产品名称" clearable style="width: 105px;" @change="input_change"></el-input>
				<el-select  v-model="repairer_v" clearable filterable placeholder="维修人员" style="width: 105px;" @change="input_change">
				   <el-option
					 v-for="item in ma_users"
					 :key="item.value"
					 :label="item.label"
					 :value="item.value">
				   </el-option>
				 </el-select>
				<!--<el-input v-model="rs_v" placeholder="维修状态" clearable style="width: 105px;" @change="input_change"></el-input>
				-->
				<el-select clearable v-model="rs_v" clearable placeholder="维修状态" style="width: 105px;" @change="input_change">
					 <el-option
					   v-for="item in rs_data"
					   :key="item.value"
					   :label="item.label"
					   :value="item.value">
					 </el-option>
				</el-select>
				
				<el-input v-model="regional_head_v" placeholder="负责人" clearable style="width: 105px;" @change="input_change"></el-input>
				<!--<el-input v-model="ms_v" placeholder="缺料情况" clearable style="width: 105px;" @change="input_change"></el-input>
				-->
				<el-select v-if="if_do" clearable v-model="asc_v" style="width: 120px;" clearable placeholder="排序字段" @change="input_change">
					 <el-option-group
						   key="1"
						   label="">
						   <el-option label="客户名称" value="客户名称"></el-option>
						   <el-option label="负责人" value="负责人"></el-option>
						   <el-option label="维修人员" value="维修人员"></el-option>
						   <el-option label="维修状态" value="维修状态"></el-option>
						   <el-option label="承诺完成日期" value="承诺完成日期"></el-option>
					 </el-option-group>
				</el-select>
				
				<el-select v-if='level=="1" || level=="3"' clearable v-model="location_v" style="width: 120px;" clearable placeholder="维保位置" @change="input_change">
					 <el-option-group
						   key="1"
						   label="">
						   <el-option label="睿控维保" value="睿控维保"></el-option>
						   <el-option label="现场维保" value="现场维保"></el-option>
					 </el-option-group>
				</el-select>
				
				<el-select v-if='level=="1" || loc=="现场维保"' clearable v-model="m_station_v" style="width: 120px;" clearable placeholder="维保站" @change="input_change">
					 <el-option-group
						   key="1"
						   label="">
						   <el-option label="靖边" value="靖边"></el-option>
						   <el-option label="成都" value="成都"></el-option>
						   <el-option label="大庆" value="大庆"></el-option>
						   <el-option label="端氏" value="端氏"></el-option>
						   <el-option label="克拉玛依" value="克拉玛依"></el-option>
					 </el-option-group>
				</el-select>
				
				<el-checkbox style="margin: 0px;" v-model="checked" @change="if_fin_cahnge" border>已处理</el-checkbox>
				
				<el-button id ="bt_serach" plain type="primary" icon="el-icon-search" @click="get_ma_plan()" style="padding-left: 10px;padding-right: 10px;">搜索</el-button>
				<el-button id ="bt_add" v-if='level!="3"' plain type="primary" icon="el-icon-document-add" @click="importCsv()" style="margin-left: 0px;padding-left: 10px;padding-right: 10px;">导入</el-button>
				<el-button v-if='checked==false' id ="bt_export" plain type="primary" icon="el-icon-document" @click="export_plan()" style="margin-left: 0px;padding-left: 10px;padding-right: 10px;">导出</el-button>
				<el-button v-if='checked==true' id ="bt_export" plain type="primary" icon="el-icon-document" @click="show_export_time()" style="margin-left: 0px;padding-left: 10px;padding-right: 10px;">导出</el-button>
				<!--<el-button id ="bt_export_process" plain type="primary" icon="el-icon-document" @click="export_plan_process()" style="margin-left: 0px;padding-left: 10px;padding-right: 10px;">导出工序</el-button>
				-->
			</div>
			
			<div>
				<el-progress v-if="if_show_process1" :percentage="percent_len1" ></el-progress>
			</div>
			
			<div >
				<div class="span">
					<el-table
					    :data="tableData"
					    style="width: 100%;font-size:14px"
					    :height="tHeight"
						:row-class-name="tableRowClassName"
						@selection-change="handleSelectionChange"
						border
						:row-style="selectedRowStyle"
						@cell-dblclick="celldblclick_1"
						>
						<!--
						<el-table-column
						  type="selection"
						  width="30"
						  >
						</el-table-column>
						-->
						<el-table-column
						  prop="id"
						  label="序号"
						  width="60"
						  :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="recv_date"
						  label="接收日期"
						  width="70"
						  :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="dispath_date"
						  label="下发日期"
						  width="70"
						  :resizable="false">
						</el-table-column>
						
						<el-table-column
						  prop="repair_id"
						  label="维修单号"
						  width="100"
						  :show-overflow-tooltip="true"
						  :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="repair_report_id"
						  label="报告编号"
						  width="90"
						  :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="customer"
						  label="客户名称"
						  width="80"
						  :show-overflow-tooltip="true"
						  :resizable="false">
						</el-table-column>
					    <el-table-column
					      prop="regional_head"
					      label="负责人"
						  width="60"
						  :show-overflow-tooltip="true"
						  :resizable="false">
					    </el-table-column>
						<el-table-column
						  prop="p_id"
						  label="产品编号"
						 width="80"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="p_name"
						  label="产品名称"
						 width="100"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						
						<el-table-column
						  prop="p_serial"
						  label="序列号"
						 width="60"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						
						<!--
						<el-table-column
						  prop="inventory"
						  label="库存"
						 width="50"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>-->
						
						<el-table-column
						  prop="repairer"
						  label="维修人员"
						 width="80"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="rp"
						  label="维修方案"
						 width="100"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						
						<el-table-column
						  prop="rc"
						  label="承诺周期"
						 width="80"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						
						<el-table-column
						  prop="rqd"
						  label="维修报价"
						 width="80"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="rs"
						  label="维修状态"
						 width="80"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						
						<el-table-column
						  prop="rod"
						  label="确认维修"
						 width="80"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="if_repair"
						  label="是否维修"
						 width="80"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						
						<el-table-column
						  prop="ccd"
						  label="承诺完成"
						 width="80"
						 :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="acd"
						  label="实际完成"
						 width="80"
						 :resizable="false">
						</el-table-column>
						
						<el-table-column
						  prop="overdue"
						  label="超期"
						 :width="50"
						 :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="quotation"
						  label="报价耗时(天)"
						 :width="100"
						 :resizable="false">
						</el-table-column>
						
						<el-table-column
						  prop="ms"
						  label="缺料情况"
						 width="80"
						 :show-overflow-tooltip="true"
						 :resizable="false">
						</el-table-column>
						<el-table-column
						  prop="mcd"
						  label="承诺到料"
						 width="70"
						 :resizable="false">
						</el-table-column>
						<!--
						<el-table-column
						  prop="doi"
						  label="发料日期"
						 width="70"
						 :resizable="false">
						</el-table-column>
						-->
						<el-table-column
						  prop="mt"
						  label="物料任务"
						 width="80"
						 :show-overflow-tooltip="true"
						 :resizable="false">
							 <template slot-scope="scope">
								<el-button v-if='scope.row.mt!=""' :style="scope.row.redmine_color" @click="to_redmine(scope.row)" type="text" size="medium">详情</el-button>
							 </template>
						</el-table-column>
						
						<el-table-column
						  prop="link"
						  label="自检记录"
						 width="70"
						 :resizable="false"
						 :show-overflow-tooltip="true">
						 <template slot-scope="scope">
						 	<el-button class="t_hover_button"  @click="to_link(scope.row)" type="text" size="medium" >{{scope.row.link}}</el-button>
						 </template>
						</el-table-column>
						
						<el-table-column
						      label="操作"
						      width="100"
							  :resizable="false">
						      <template slot-scope="scope">
								  <el-button v-if="level!=3" class="t_hover_button"  @click="show_update_dialog(scope.row)" type="text" size="medium" >修改</el-button>
								  <el-button v-if="level==1" style="margin-left: 3px;margin-right: 0px;"  @click="remove_ma_plan(scope.row)" type="text" size="medium" >删除</el-button>
						      </template>
						    </el-table-column>
					  </el-table>
				</div>
				<div class="block">
				    <span class="demonstration"></span>
				    <el-pagination
				      @size-change="handleSizeChange"
				      @current-change="handleCurrentChange"
				      :current-page="currentPage"
					  :page-sizes="[50,100, 200, 300]"
				      :page-size="pagesize"
					  :total="recordTotal"
				      layout="total, sizes, prev, pager, next, jumper"
				      >
				    </el-pagination>
				  </div>
			</div>
			
			<el-dialog
			 title="维保计划"
			 :visible.sync="updatedialogVisible_ex"
			 :lock-scroll ="false"
			 width="95%">
			 <el-form ref="authform_ex" :model="form" :rules="rules" label-width="100px" :inline="false" class="demo-form-inline" size="medium">
				  <el-row :gutter="10">
					  <el-col :span="5">
						  <el-form-item label="序号" prop="id" >
						  <el-input v-model="form.id" :disabled="true" ></el-input>
						  </el-form-item>
					  </el-col>
					  <el-col :span="5">
							<el-form-item label="接收日期" prop="recv_date">
							<el-input v-model="form.recv_date" :disabled="disabled"></el-input>
							</el-form-item>
					  </el-col>
					  <el-col :span="5">
					    <el-form-item label="下发日期" prop="dispath_date" >
						<el-date-picker
							style="width: 150px;"
							 v-model="form.dispath_date"
							 type="date"
							format="yyyy/MM/dd"
							value-format="yyyy/MM/dd"
							:disabled="disabled" >
						</el-date-picker>
						</el-form-item>
					  </el-col>
					  
					  <el-col :span="5">
						  <el-form-item label="维修单号" prop="repair_id" >
						  <el-input v-model="form.repair_id" :disabled="disabled" ></el-input>
						  </el-form-item>
					  </el-col>
					  <el-col :span="4">
						<el-form-item label="报告编号" prop="repair_report_id">
						<el-input v-model="form.repair_report_id" :disabled="disabled"></el-input>
						</el-form-item>
					  </el-col>
					 
				  </el-row>
				  
				  <el-row :gutter="10">
					  
					  <el-col :span="5" >
							<el-form-item label="客户名称" prop="customer">
							<el-input v-model="form.customer" :disabled="disabled"></el-input>
							</el-form-item>
					  </el-col>
					  
					  <el-col :span="5" >
					  						<el-form-item label="负责人" prop="regional_head">
					  						<el-input v-model="form.regional_head" :disabled="disabled"></el-input>
					  						</el-form-item>
					  </el-col>
					  <el-col :span="5">
					  						  <el-form-item label="产品编号" prop="p_id">
					  						  <el-select style="width: 150px;" v-model="form.p_id" :disabled="disabled" clearable filterable placeholder="请选择" remote  :remote-method="remoteMethod" :loading="loading" @change="pid_selectChanged">
					  							 <el-option
					  							   v-for="item in p_id_options"
					  							   :key="item.value"
					  							   :label="item.label"
					  							   :value="item.value">
					  							 </el-option>
					  						   </el-select>
					  						  </el-form-item>
					  </el-col>
					  <el-col :span="5" >
					  							<el-form-item label="产品名称" prop="p_name">
					  							<el-input v-model="form.p_name" :disabled="true"></el-input>
					  							</el-form-item>
					  </el-col>
					  
					  <el-col :span="4" >
					  	<el-form-item label="维保人员" prop="repairer">
					  	<el-select  v-model="form.repairer" clearable filterable placeholder="请选择" :disabled="disabled">
					  	   <el-option
					  		 v-for="item in ma_users"
					  		 :key="item.value"
					  		 :label="item.label"
					  		 :value="item.value">
					  	   </el-option>
					  	 </el-select>
					  	</el-form-item>
					  </el-col>
				  </el-row>
				  
				  <el-row :gutter="10">
						 
						<el-col :span="5" >
						<el-form-item label="序列号" >
						<el-input v-model="form.p_serial"></el-input>
						</el-form-item>
						</el-col>
						<!--						
						<el-col :span="8" >
						<el-form-item label="库存" >
						<el-select  v-model="form.inventory" clearable placeholder="请选择">
						    <el-option label="有" value="有"></el-option>
							<el-option label="无" value="无"></el-option>
						 </el-select>
						</el-form-item>
						</el-col>
						-->
						<el-col :span="5" >
													<el-form-item label="缺料情况" prop="ms">
													<el-input v-model="form.ms" ></el-input>
													</el-form-item>
						</el-col>
						<el-col :span="5" >
													<el-form-item label="承诺周期" prop="rc">
													<el-input v-model="form.rc" @input="mcd_change(form)"></el-input>
													</el-form-item>
						</el-col>
						<el-col :span="5" >
													<el-form-item label="维修报价" prop="rqd">
													<el-date-picker
														style="width: 150px;"
														 v-model="form.rqd"
														 type="date"
														format="yyyy/MM/dd"
														value-format="yyyy/MM/dd">
													</el-date-picker>
													</el-form-item>
						</el-col>
						
						<el-col :span="4" >
												<el-form-item label="维修状态" >
												<el-select clearable v-model="form.rs" clearable >
													 <el-option
													   v-for="item in rs_data"
													   :key="item.value"
													   :label="item.label"
													   :value="item.value">
													 </el-option>
												</el-select>
												</el-form-item>
						</el-col>
				  </el-row>
				  
				  <el-row :gutter="10">
					  <el-col :span="24" >
							<el-form-item label="维修方案" prop="rp">
							<el-input v-model="form.rp"></el-input>
							</el-form-item>
					  </el-col>
				  </el-row>
				 
				  <el-row :gutter="10">
					  <el-col :span="5" >
						<el-form-item label="确认维修" prop="rod">
							<el-date-picker
								style="width: 150px;"
								 v-model="form.rod"
								 type="date"
								format="yyyy/MM/dd"
								value-format="yyyy/MM/dd"
								@input="mcd_change(form)">
							</el-date-picker>
						</el-form-item>
					  </el-col>
					  <el-col :span="5" >
							<el-form-item label="是否维修" prop="if_repair">
							<el-select clearable v-model="form.if_repair" style="width: 150px;" clearable >
								 <el-option-group
									   key="1"
									   label="">
									   <el-option label="保外维修" value="保外维修"></el-option>
									   <el-option label="保内维修" value="保内维修"></el-option>
									   <el-option label="不维修" value="不维修"></el-option>
								 </el-option-group>
							</el-select>
							</el-form-item>
					  </el-col>
					  
					  <el-col :span="5" >
					  							<el-form-item label="承诺完成" prop="ccd">
					  							<el-date-picker
					  								:disabled="true"
					  								style="width: 150px;"
					  								 v-model="form.ccd"
					  								 type="date"
					  								format="yyyy/MM/dd"
					  								value-format="yyyy/MM/dd">
					  							</el-date-picker>
					  							</el-form-item>
					  </el-col>
					  <el-col :span="5" >
					  							<el-form-item label="实际完成" prop="acd">
					  							<el-date-picker
					  								style="width: 150px;"
					  								 v-model="form.acd"
					  								 type="date"
					  								format="yyyy/MM/dd"
					  								value-format="yyyy/MM/dd">
					  							</el-date-picker>
					  							</el-form-item>
					  </el-col>
					  <el-col :span="4" >
					  	<el-form-item label="承诺到料" prop="mcd">
					  	<el-date-picker
					  		style="width: 135px;"
					  		 v-model="form.mcd"
					  		 type="date"
					  		format="yyyy/MM/dd"
					  		value-format="yyyy/MM/dd"
					  							@input="mcd_change(form)">
					  	</el-date-picker>
					  	</el-form-item>
					  </el-col>
				  </el-row>
				  
				  <el-row :gutter="10">
					  <el-col :span="5" >
						<el-form-item label="物料任务" >
						<el-input v-model="form.mt"></el-input>
						</el-form-item>
					</el-col>
					<!--
					<el-col :span="5" >
						<el-form-item label="发料日期" prop="doi">
						<el-date-picker
							:disabled="disabled"
							style="width: 150px;"
							 v-model="form.doi"
							 type="date"
							format="yyyy/MM/dd"
							value-format="yyyy/MM/dd">
						</el-date-picker>
						</el-form-item>
					</el-col>
					-->
					<el-col :span="5" >
						<el-form-item label="自检记录链接" >
						<el-input v-model="form.link"></el-input>
						</el-form-item>
					</el-col>
					
					<el-col :span="5" >
						<el-form-item label="合同号" >
						<el-input v-model="form.mcn"></el-input>
						</el-form-item>
					</el-col>
				  </el-row>
			 </el-form>
			 
			 <div style="margin-top: 20px;">
				<div>
					<el-button id ="bt_add" plain type="primary" icon="el-icon-circle-plus-outline" @click="showAddkpiplan_1()">新增工序</el-button>
					<span style="margin-left: 10px;">总工时：{{form.total_work_time}}</span>
				</div>
				 <el-table
						:data="form.plan_data"
						style="font-size:14px;margin-top: 10px;width: 100%;"
						:row-class-name="tableRowClassName"
						stripe border>
						<el-table-column
						  prop="produce_plan"
						  label="维修工序"
						  width="160"
						  :show-overflow-tooltip="true">
						</el-table-column>
						<el-table-column
						  prop="produce_plan_use_t"
						  label="工时"
						  width="120">
						</el-table-column>
						<el-table-column
						  prop="times"
						  label="次数"
						  width="120">
						</el-table-column>
						
						<el-table-column
						  prop="produce_user"
						  label="维保人员"
						  width="120">
						</el-table-column>
										
						 <el-table-column
						   prop="p_actual_finished_t"
						   label="完成日期"
						  width="120">
						  </el-table-column>
						  
						  <el-table-column
						    prop="state"
						    label="审核状态"
						   width="120">
						   </el-table-column>
						<el-table-column
							  label="操作"
							  width="120">
							  <template slot-scope="scope">
								  <el-button @click="show_updateplan_dialog(scope.row)" type="text" size="medium" >修改</el-button>
								  <el-button @click="delKpiplan(scope.row)" type="text" size="medium" >删除</el-button>
								  <!--<el-button v-if="approve_flag" @click="approve_plan(scope.row)" type="text" size="medium" >审核</el-button>-->
							  </template>
							</el-table-column>
					  </el-table>
			 </div>
			 <span slot="footer" class="dialog-footer">
			 <el-button @click="updatedialogVisible_ex = false">取 消</el-button>
			 <el-button id ="bt_ok" plain type="primary" @click="update_ma_ex();">确 定</el-button>
			 </span>
			</el-dialog>
			
			<el-dialog
			v-dialogDrag
			 title="维修工序"
			 :visible.sync="addplanVisible_1"
			 :lock-scroll ="false"
			 width="45%">
			 <el-form ref="planform_1" :model="planform" :rules="rules" label-width="100px" :inline="false" class="demo-form-inline" size="medium">
				  <el-row :gutter="10">
					  <el-col :span="24">
						  <el-form-item label="维修工序" prop="produce_plan_t">
						  <el-select style="width: 100%;" v-model="planform.produce_plan_t" multiple collapse-tags clearable filterable placeholder="请选择" @change="process_selectChanged" @clear="setValueNull">
						     <el-option
						       v-for="item in p_process_options"
						       :key="item.value"
						       :label="item.label"
						       :value="item.value">
						     </el-option>
						   </el-select>
						  </el-form-item>
					  </el-col>
					  <!--<el-col :span="12">
						  <el-form-item label="工时" prop="produce_plan_use_t">
						  <el-input style="width: 190px;" v-model="planform.produce_plan_use_t" :disabled="true"></el-input>
						  </el-form-item>
					  </el-col>
					  -->
				  </el-row>
				  
				  <el-row :gutter="10">
					 <el-col :span="12">
						  <el-form-item label="维保人员" prop="produce_user">
						   <el-select style="width: 190px;" v-model="planform.produce_user" filterable placeholder="请选择">
							  <el-option
								v-for="item in ma_users"
								:key="item.value"
								:label="item.label"
								:value="item.value">
							  </el-option>
							</el-select>
						  </el-form-item>
					 </el-col>
					  <el-col :span="12">
						  <el-form-item label="完成日期" prop="p_actual_finished_t">
						  <el-date-picker
								v-model="planform.p_actual_finished_t"
								type="date"
								placeholder="完成日期"
							  style="width: 190px;"
							  format="yyyy/MM/dd"
							  value-format="yyyy/MM/dd">
						  </el-date-picker>
						  </el-form-item>
					  </el-col>
					  
					</el-row>
					
					<el-row :gutter="10">
						 <el-col :span="12">
							  <el-form-item label="次数" prop="times">
							  <el-input-number v-model="planform.times" :min="1" :max="1000" ></el-input-number>
							  </el-form-item>
						 </el-col>
					</el-row>
						
			 </el-form>
			 <span slot="footer" class="dialog-footer">
			 <el-button @click="addplanVisible_1 = false">取 消</el-button>
			 <el-button id ="bt_ok" plain type="primary" @click="addkpiplan_1();">确 定</el-button>
			 </span>
			</el-dialog>
			
			<el-dialog
			v-dialogDrag
			 title="维修工序"
			 :visible.sync="updateplanVisible_1"
			 :lock-scroll ="false"
			 width="45%">
			 <el-form ref="planform_1" :model="planform" :rules="rules" label-width="100px" :inline="false" class="demo-form-inline" size="medium">
				  <el-row :gutter="10">
					  <el-col :span="12">
						  <el-form-item label="维修工序" prop="produce_plan">
						  <el-select style="width: 190px;" v-model="planform.produce_plan" clearable filterable placeholder="请选择" @change="process_selectChanged" @clear="setValueNull">
						     <el-option
						       v-for="item in p_process_options"
						       :key="item.value"
						       :label="item.label"
						       :value="item.value">
						     </el-option>
						   </el-select>
						  </el-form-item>
					  </el-col>
					  <el-col :span="12">
						  <el-form-item label="工时" prop="produce_plan_use_t">
						  <el-input style="width: 190px;" v-model="planform.produce_plan_use_t" :disabled="true"></el-input>
						  </el-form-item>
					  </el-col>
				  </el-row>
				  
				  <el-row :gutter="10">
					  <el-col :span="12">
						  <el-form-item label="维保人员" prop="produce_user">
						   <el-select style="width: 190px;" v-model="planform.produce_user" filterable placeholder="请选择">
							  <el-option
								v-for="item in ma_users"
								:key="item.value"
								:label="item.label"
								:value="item.value">
							  </el-option>
							</el-select>
						  </el-form-item>
					  </el-col>
					  <el-col :span="12">
						  <el-form-item label="完成日期" prop="p_actual_finished_t">
						  <el-date-picker
								v-model="planform.p_actual_finished_t"
								type="date"
								placeholder="完成日期"
							  style="width: 190px;"
							  format="yyyy/MM/dd"
							  value-format="yyyy/MM/dd">
						  </el-date-picker>
						  </el-form-item>
					  </el-col>
					</el-row>
					
					<el-row :gutter="10">
						  <el-col :span="12">
							  <el-form-item label="次数" prop="times">
							  <el-input-number v-model="planform.times" :min="1" :max="1000" ></el-input-number>
							  </el-form-item>
						  </el-col>
					</el-row>
						
			 </el-form>
			 <span slot="footer" class="dialog-footer">
			 <el-button @click="updateplanVisible_1 = false">取 消</el-button>
			 <el-button id ="bt_ok" plain type="primary" @click="addkpiplan_1();">确 定</el-button>
			 </span>
			</el-dialog>
			
			<el-dialog
			 title="维保计划导入"
			 :visible.sync="importdialogVisible"
			 :lock-scroll ="false"
			 :before-close="importDialog_close"
			 width="60%">
				<div style="display: flex;">
					<el-upload
					 class="upload-demo"
					 action=""
					 :on-change="handleChange"
					 :file-list="fileListUpload"
					 :show-file-list="false"
					  accept=".csv"
					  :auto-upload="false">
					  <el-button id ="bt_upload" size="small" plain type="primary">点击上传（csv文件）</el-button>
					</el-upload>
					 <el-button id ="bt_import" size="small" plain type="primary" @click="importData" style="margin-left: 10px;">确认导入</el-button>
				<el-button id ="bt_download" size="small" plain type="primary" @click="download_template" style="margin-left: 10px;">下载导入模板文件</el-button>
				</div>
				<div>
					<el-progress v-if="if_show_process" :percentage="percent_len" :stroke-width="2"></el-progress>
				</div>
				<el-table
					    :data="importTableData"
					    style="font-size:14px;margin-top: 10px;width: 100%;"
						:row-class-name="tableRowClassName"
						stripe border>
						
						<el-table-column
						  prop="recv_date"
						  label="接收日期"
						  width="70"
						  :show-overflow-tooltip="true">
						</el-table-column>
						<el-table-column
						  prop="dispath_date"
						  label="下发日期"
						  width="70"
						  :show-overflow-tooltip="true">
						</el-table-column>
						<el-table-column
						  prop="repair_id"
						  label="维修单号"
						 width="80">
						</el-table-column>
						
						<el-table-column
						  prop="repair_report_id"
						  label="报告编号"
						 width="100">
						</el-table-column>
						<el-table-column
						  prop="mcn"
						  label="合同号"
						 width="100">
						</el-table-column>
						
						<el-table-column
						  prop="customer"
						  label="客户名称"
						 width="80">
						</el-table-column>
						<el-table-column
						  prop="regional_head"
						  label="负责人"
						 width="100">
						</el-table-column>
						
						<el-table-column
						  prop="p_id"
						  label="产品编号"
						 width="80">
						</el-table-column>
						<el-table-column
						  prop="p_name"
						  label="产品名称"
						 width="80">
						</el-table-column>
						
						<el-table-column
						  prop="p_serial"
						  label="序列号"
						 width="60"
						 :show-overflow-tooltip="true">
						</el-table-column>
						
						<el-table-column
						  prop="repairer"
						  label="维修人员"
						 width="80"
						 :show-overflow-tooltip="true">
						</el-table-column>
						
						<el-table-column
						  prop="rs"
						  label="维修状态"
						 width="80"
						 :show-overflow-tooltip="true">
						</el-table-column>
						
						<el-table-column
						  prop="if_repair"
						  label="是否维修"
						 width="80"
						 :show-overflow-tooltip="true">
						</el-table-column>
						
						<el-table-column
						  prop="m_station"
						  label="维修站"
						 width="80"
						 :show-overflow-tooltip="true">
						</el-table-column>
					  </el-table>
			</el-dialog>
			
			
			<el-dialog
			v-dialogDrag
			 title="时间选择"
			 :visible.sync="export_time_Visible"
			 :lock-scroll ="false"
			 width="45%">
			 <el-form ref="timeform_1" :model="timeform" :rules="rules" label-width="100px" :inline="false" class="demo-form-inline" size="medium">
				  <el-row :gutter="10">
					  <el-col :span="12">
						  <el-form-item label="开始日期" >
						  <el-date-picker
								v-model="timeform.bt"
								type="date"
								placeholder="开始日期"
							  style="width: 190px;"
							  format="yyyy/MM/dd"
							  value-format="yyyy/MM/dd">
						  </el-date-picker>
						  </el-form-item>
					  </el-col>
					  
					  <el-col :span="12">
						  <el-form-item label="结束日期" >
						  <el-date-picker
								v-model="timeform.et"
								type="date"
								placeholder="结束日期"
							  style="width: 190px;"
							  format="yyyy/MM/dd"
							  value-format="yyyy/MM/dd">
						  </el-date-picker>
						  </el-form-item>
					  </el-col>
					</el-row>
			 </el-form>
			 <span slot="footer" class="dialog-footer">
			 <el-button @click="export_time_Visible = false">取 消</el-button>
			 <el-button id ="bt_ok" plain type="primary" @click="export_plan();">确 定</el-button>
			 </span>
			</el-dialog>
		</div>
		`,
	data(){
		// 获取当前屏幕的分辨率
		let screenW = window.screen.width;
		let screenH = window.screen.height;
		console.log("screen width:",screenW);
		console.log("screen height:",screenH);
	  return {
		tHeight:screenH*0.7,
		tableData: Array(0),
		tableData1: Array(0),
		currentPage: 1,
		pagesize:50,
		pagecnt:1,
		recordTotal:0,
		
		checked:false,
		value1:'',
		value2:'',
		id_v:'',
		dispatch_date_v:'',
		rid_v:'',
		pid_v:'',
		pname_v:'',
		repairer_v:'',
		rs_v:'',
		regional_head_v:'',
		ms_v:'',
		asc_v:'',
		location_v:'',
		m_station_v:'',
		
		updatedialogVisible_ex:false,
		form: {
			id:0,
			recv_date:'',
			dispath_date:'',
			repair_id:'',
			repair_report_id:'',
			customer:'',
			regional_head:'',
			p_id:'',
			p_name:'',
			
			repairer:'',
			rp:'',
			ms:'',
			rc:'',
			rqd:'',
			rs:'',
			rod:'',
			if_repair:'',
			ccd:'',
			acd:'',
			overdue:'',
			quotation:'',
			mcd:'',
			mt:'',
			
			p_serial:'',
			inventory:'',
			
			doi:'',
			link:'',
			mcn:'',
			
			total_work_time:0,
			plan_data:[],
		},
		rules: {
			product_id: [
			    { required: true, message: '产品编号不可为空', trigger: 'blur' }
			],
			produce_plan: [
			    { required: true, message: '工序名称不可为空', trigger: 'blur' }
			],
			produce_user: [
			    { required: true, message: '维保人员不可为空', trigger: 'blur' }
			],
			p_actual_finished_t: [
			    { required: true, message: '完成日期不可为空', trigger: 'blur' }
			],
			times: [
			    { required: true, message: '次数不可为空', trigger: 'blur' }
			],
		},
		
		options: [],
		
		importdialogVisible:false,
		fileTemp: null,
		fileListUpload: [],
		importTableData: [],
		
		multipleSelection: [],

		if_show_processed:true,
		
		if_del_show:false,
		if_del:false,
		
		p_id_options:[],
		
		loading: false,
		percent_len:0,
		if_show_process:false,
		interval:'',
		
		if_show_process1:false,
		percent_len1:0,
		
		ma_users:[],
		disabled:false,
		
		if_do:true,
		rs_data:[],
		
		level:0,
		
		addplanVisible_1:false,
		updateplanVisible_1:false,
		maxid:-1,
		planform: {
			id:0,
			produce_plan:'',
			produce_plan_t:[],
			produce_plan_use_t:'',
			produce_user:'',
			p_actual_finished_t:'',
			times:1,
		},
		plan_op_type:0,
		
		p_process_options:[],
		cur_p_process:'',
		
		approve_flag:false,
		
		loc:'',
		
		timeform:{
			bt:'',
			et:'',
		},
		export_time_Visible:false,
	  }
	},
	mounted() {
		var op_user = localStorage.getItem("online_user");
		if (op_user =="霍涛"){
			this.$data.approve_flag=true;
		}
		var loc = localStorage.getItem("loc");
		this.$data.loc=loc;
		
		var level = localStorage.getItem("level");
		this.$data.level=level;
		var did = localStorage.getItem("did");
		
		if (level==1 ){
			this.$data.if_del_show =true;
		}
		this.get_ma_user();
		this.get_rs();
		this.get_ma_plan();
	},
	methods: {
		show_export_time(){
			this.$data.timeform.bt="";
			this.$data.timeform.et="";
			this.export_time_Visible=true;
		},
		export_plan_process(){
			document.getElementById("bt_export_process").blur();
			
			var _this = this;
			var objs;
			axios.post('/u_ma/export_plan_process', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
			  })
			  .then(function (response) {
				  
				var date = new Date();
				//年 getFullYear()：四位数字返回年份
				var year = date.getFullYear()%2000; //getFullYear()代替getYear()
				console.log(year.toString());
				//月 getMonth()：0 ~ 11
				var month = date.getMonth() + 1;
				if(month<10){
					month='0'+month
				}
				//日 getDate()：(1 ~ 31)
				var day = date.getDate();
				if(day<10){
					day='0'+day;
				}
				//时 getHours()：(0 ~ 23)
				var hour = date.getHours();
				if (hour<10){
					hour='0'+hour;
				}
				//分 getMinutes()： (0 ~ 59)
				var minute = date.getMinutes();
				if (minute<10){
					minute='0'+minute;
				}
				//秒 getSeconds()：(0 ~ 59)
				var second = date.getSeconds();
				if (second<10){
					second='0'+second;
				}
				
				var filename=year.toString()+month.toString()+day.toString() +" " + hour.toString()+minute.toString()+second.toString();
				filename = "工序 "+filename+".xlsx"
				console.log(response.data);
				var fileid = response.data.fileId;
				
				var downUrl = '/u_ma/download_file'+"?id="+fileid;
				downloadUrl(filename,downUrl);
			  })
			  .catch(function (error) {
				console.log(error);
			  });
		},
		
		approve_plan(row){
			for(var i=0;i<this.$data.form.plan_data.length;++i){
				if(this.$data.form.plan_data[i].id==row.id){
					this.$data.form.plan_data[i].state="已审核";
					break;
				}
			}
		},
		
		delKpiplan(row){
			var op_user = localStorage.getItem("online_user");
			if (op_user !="霍涛" && row.state == "已审核"){
				this.$message({
					message: "工序已审核，用户无权限修改",
					type: "warning",
					duration: 1500
				});
				return;
			}
			
			var index =-1;
			for(var i=0;i<this.$data.form.plan_data.length;++i){
				if(this.$data.form.plan_data[i].id==row.id){
					index=i;
					break;
				}
			}
			if (index > -1) { 
				this.$data.form.plan_data.splice(index, 1); 
			} 
			
			var total =0
			for(var i=0;i<this.$data.form.plan_data.length;++i){
				console.log("工时：",parseFloat(this.$data.form.plan_data[i].produce_plan_use_t));
				var t = parseFloat(this.$data.form.plan_data[i].produce_plan_use_t)
				t = t * this.$data.form.plan_data[i].times;
				total = total+t;
			}
			console.log("总工时：",total);
			this.$data.form.total_work_time=total;
		},
		show_updateplan_dialog(row){
			
			var op_user = localStorage.getItem("online_user");
			if (op_user !="霍涛" && row.state == "已审核"){
				this.$message({
					message: "工序已审核，用户无权限修改",
					type: "warning",
					duration: 1500
				});
				return;
			}
			
			var _this = this;
			  
			axios.post('/u_ma/get_p_process_options',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				pid:_this.$data.form.p_id,
			})
			  .then(function (response) {
				_this.$data.p_process_options=[];
				console.log(response.data);
				_this.$data.cur_p_process = response.data;
				objs = response.data.data;
				for(var i=0;i<objs.length;++i){
					var obj ={
						value:objs[i].process_name,
						label:objs[i].process_name,
					}
					_this.$data.p_process_options.push(obj);
				}
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
			  
			this.$data.planform.produce_plan=row.produce_plan;
			this.$data.planform.produce_plan_use_t=row.produce_plan_use_t;
			this.$data.planform.produce_user=row.produce_user;
			this.$data.planform.id =row.id;
			
			this.$data.planform.p_actual_finished_t=row.p_actual_finished_t;
			this.$data.planform.times=row.times;
			
			this.$data.plan_op_type=2;
			this.$nextTick(() => {
				this.$refs['planform_1'].clearValidate()
			});
			
			this.$data.updateplanVisible_1=true;
			/*if(this.$data.planform.produce_user == op_user){
				this.$data.updateplanVisible_1=true;
			}else{
				let s = ""
				let errType = ""
				errType = "error"
				s = "无权限!";
				this.$message({
					message: s,
					type: errType,
					duration: 1500
				});
			}*/
		},
		
		setValueNull(val) {
			this.$data.planform.produce_plan_use_t='';
		},
		process_selectChanged(value){
			console.log("select change");
			console.log(value);
			console.log(this.$data.cur_p_process.data);
			for(var i=0; i <this.$data.cur_p_process.data.length;++i){
				if(this.$data.cur_p_process.data[i].process_name == value){
					this.$data.planform.produce_plan_use_t = this.$data.cur_p_process.data[i].process_t
					console.log("find");
					console.log(this.$data.planform.produce_plan_use_t);
					break;
				}
			}
		},
		addkpiplan_1(){
			
			this.$refs['planform_1'].validate((valid) => {
				if (valid) {
					if (this.$data.plan_op_type==1) {
						
						const sel_map = new Map();
						
						for(var i=0; i <this.$data.cur_p_process.data.length;++i){
							sel_map.set(this.$data.cur_p_process.data[i].process_name, this.$data.cur_p_process.data[i].process_t);
						}
						
						for(var i = 0;i < this.$data.planform.produce_plan_t.length;i++){
							
							var obj ={
								id:this.$data.maxid,
								produce_plan:this.$data.planform.produce_plan_t[i],
								produce_plan_use_t:sel_map.get(this.$data.planform.produce_plan_t[i]),
								produce_user:this.$data.planform.produce_user,
								p_actual_finished_t:this.$data.planform.p_actual_finished_t,
								times:this.$data.planform.times,
							}
							console.log(this.$data.form);
							this.$data.form.plan_data.push(obj);
							
							this.$data.maxid+=1;
							console.log("id:",this.$data.maxid);
						}
						
					} else if (this.$data.plan_op_type==2){
						for(var i=0;i<this.$data.form.plan_data.length;++i){
							if(this.$data.form.plan_data[i].id==this.$data.planform.id){
								this.$data.form.plan_data[i].produce_plan=this.$data.planform.produce_plan;
								this.$data.form.plan_data[i].produce_plan_use_t=this.$data.planform.produce_plan_use_t;
								this.$data.form.plan_data[i].produce_user=this.$data.planform.produce_user;
								this.$data.form.plan_data[i].p_actual_finished_t=this.$data.planform.p_actual_finished_t;
								this.$data.form.plan_data[i].times=this.$data.planform.times;
								console.log(this.$data.form.plan_data);
								break;
							}
						}
					}
					
					var total =0
					for(var i=0;i<this.$data.form.plan_data.length;++i){
						console.log("工时：",parseFloat(this.$data.form.plan_data[i].produce_plan_use_t));
						var t = parseFloat(this.$data.form.plan_data[i].produce_plan_use_t)
						t = t * this.$data.form.plan_data[i].times;
						total = total+t;
					}
					console.log("总工时：",total);
					this.$data.form.total_work_time=total;
					
					if (this.$data.plan_op_type==1) {
						this.$data.addplanVisible_1 = false;
					}  else if (this.$data.plan_op_type==2){
						this.$data.updateplanVisible_1 = false;
					}
					
				}
			});
		},
		showAddkpiplan_1(){
			var _this = this;
			  
			axios.post('/u_ma/get_p_process_options',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				pid:_this.$data.form.p_id,
			})
			  .then(function (response) {
				_this.$data.p_process_options=[];
				console.log(response.data);
				_this.$data.cur_p_process = response.data;
				objs = response.data.data;
				for(var i=0;i<objs.length;++i){
					var obj ={
						value:objs[i].process_name,
						label:objs[i].process_name,
					}
					_this.$data.p_process_options.push(obj);
				}
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
			  
			this.$data.planform.produce_plan='';
			this.$data.planform.produce_plan_t=[];
			this.$data.planform.produce_plan_use_t='';
			this.$data.planform.produce_user='';
			this.$data.planform.p_actual_finished_t='';
			this.$data.planform.times=1;
			this.$data.plan_op_type=1;
			
			for (var i = 0; i < this.$data.form.plan_data.length; i++) {
				 if(this.$data.form.plan_data[i].id >this.$data.maxid){
					 this.$data.maxid = this.$data.form.plan_data[i].id
				 }
			}
			if(this.$data.maxid !=-1){
				this.$data.maxid+=1;
			}else{
				this.$data.maxid = 0;
			}
			
			this.$nextTick(() => {
				this.$refs['planform_1'].clearValidate()
			});
			this.$data.addplanVisible_1=true;
		},
		to_link(row){
			if (row.link ==""){
				return;
			}
			url = encodeURI(row.link);
			window.open(url, "");
		},
		
		mcd_change(form){
			console.log(form);
			
			var bt ="";
			var days = form.rc;
			if(form.mcd !=""){
				bt = form.mcd;
			}else{
				bt = form.rod;
			}
			
			var _this = this;
			axios.post('/u_ma/cal_completion_date',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				bt:bt,
				days:days
			})
			  .then(function (response) {
				_this.form.ccd = response.data.completion_date;
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
		},
		
		get_rs(){
			var _this = this;
			axios.post('/u_ma/get_rs',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
			})
			  .then(function (response) {
				_this.$data.rs_data=[];
				console.log(response.data);
				
				objs = response.data.data;
				for(var i=0;i<objs.length;++i){
					var obj ={
						value:objs[i].rs,
						label:objs[i].rs
					}
					_this.$data.rs_data.push(obj);
				}
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
		},
		
		
		get_ma_user(){
			var _this = this;
			axios.post('/u_ma/get_ma_username',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				location:_this.$data.location_v,
			})
			  .then(function (response) {
				_this.$data.ma_users=[];
				console.log(response.data);
				
				objs = response.data.data;
				for(var i=0;i<objs.length;++i){
					var obj ={
						value:objs[i],
						label:objs[i]
					}
					_this.$data.ma_users.push(obj);
				}
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
		},
		
		celldblclick_1(row, column, cell, event){
		  this.show_update_dialog(row);
		},
		to_redmine(row){
			if(row.mt!=""){
				url = encodeURI("http://123.54.1.214:10010/redmine/issues/"+row.mt);
				window.open(url, "");
			}
		},
		input_change(value) {
			console.log(value);
			this.get_ma_plan();
			
			if(this.$data.location_v !=""){
				this.get_ma_user();
			}
		},
		pid_selectChanged(value){
			console.log("select change");
			this.loading = true;
			var _this=this;
			axios.post('/u_ma/get_p_name',{
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				p_id:value,
			})
			  .then(function (response) {
					_this.$data.form.p_name = response.data.p_name;
			  })
			  .catch(function (error) {
			    console.log(error);
			  });
		},
		remoteMethod(query) {
			  if (query !== '') {
				this.loading = true;
				setTimeout(() => {
				  
				  var _this=this;
				  axios.post('/u_ma/get_p_id_options',{
				  	opuser:localStorage.getItem("online_user"),
				  	opuser_uuid:localStorage.getItem("uuid"),
					p_like_id:query,
				  })
				    .then(function (response) {
						_this.$data.p_id_options=[];
						console.log(response.data);
						objs = response.data.data;
						for(var i=0;i<objs.length;++i){
							var obj ={
								value:objs[i],
								label:objs[i],
							}
							_this.$data.p_id_options.push(obj);
						}
						_this.$data.loading = false;
						console.log(_this.$data.loading)
				    })
				    .catch(function (error) {
				      console.log(error);
					  _this.$data.loading = false;
				    });
				}, 200);
			  } else {
				_this.$data.p_id_options = [];
			  }
		},
		if_fin_cahnge(val){
			if(val){
				this.$data.if_do=false;
			}else{
				this.$data.if_do=true;
			}
			
			this.get_ma_plan();
		},
		selectedRowStyle({ row, rowIndex }) {
			
			if(row.if_warn == 1){
				let styleJson ={
					"color":"#ff0000",
				};
				return styleJson;
			}
		},
		download_template(){
			document.getElementById("bt_download").blur();
			
			var downUrl = '/u_ma/download_file'+"?id="+"导入维保计划.csv";
			downloadUrl("维保计划导入文件模板.csv",downUrl);
		},
		
		handleSelectionChange(val) {
			console.log("已选择");
			console.log(val);
			this.multipleSelection = val;
		},
		importData(){
				document.getElementById("bt_import").blur();
				if(this.$data.importTableData.length==0){
				   this.$message({
					message: "请选择导入文件",
					type: "warning",
					duration: 1500
				   });
				   return;
				}
			   
			   this.$data.percent_len=0;
			   this.$data.if_show_process=true;
			   this.$data.interval= setInterval(()=>{
				   if(this.$data.percent_len>=99){
						clearInterval(this.$data.interval);
						return;
				   }
				   this.$data.percent_len+=1
			   },20)
			   var _this = this;
			   
			   axios.post('/u_ma/import_ma_plan', {
					opuser:localStorage.getItem("online_user"),
					opuser_uuid:localStorage.getItem("uuid"),
					plan:this.$data.importTableData,
			   })
			   .then(function (response) {
			   	
			   	let r = response.data.r;
				console.log("r:",r);
			   	let s = ""
			   	let errType = ""
			   	if (r == 0) {
					let len = _this.$data.importTableData.length;
					 _this.$data.percent_len=100;
					 _this.$data.if_show_process=false;
					 
					 errType = "success"
					 s = "导入"+len+"生产计划成功！";
			   	} else if(r==2){
			   		errType = "error"
					s = response.data.context;
					console.log(s);
					clearInterval(_this.$data.interval);
			   	} else{
			   		errType = "error"
					s = "导入生产计划失败！";
					clearInterval(_this.$data.interval);
			   	}
				
			   	_this.$message({
			   		message: s,
			   		type: errType,
			   		duration: 1500
			   	});
				
				_this.$data.importdialogVisible=false;
			   	//更新页面
			   	_this.get_ma_plan();
			   	
			   })
			   .catch(function (error) {
			     console.log(error);
			   });
		  },
		  importDialog_close(done){
			  console.log("关闭导入对话框");
			  done();
		  },
		  handleChange(file, fileList) {
			   document.getElementById("bt_upload").blur();
			   
				this.fileTemp = file.raw
				console.log("filetype:",this.fileTemp);
		     	if (this.fileTemp) {
					console.log("begin ...")
					console.log(this.fileTemp.type);
		        	if ((this.fileTemp.type == 'text/csv') || (this.fileTemp.type == '.csv') || (this.fileTemp.type == 'application/vnd.ms-excel')) {
						let _this = this//如果需要点击事件结束之后对DOM进行操作使用)_this.xx=xx进行操作
						Papa.parse(_this.fileTemp, {
						  encoding:'gb2312',
						  complete (results) {
							console.log(results)//这个是csv文件的数据
							let data = []
							//遍历csv文件中的数据，存放到data中 方法不唯一，可自己更改
							for (let i = 0; i < results.data.length; ++i) {
								if(i==0){
									continue;
								}
								  let obj = {}
								  obj.recv_date = results.data[i][0]
								  if(obj.recv_date==""|| obj.recv_date==undefined){
									  continue;
								  }
								  obj.dispath_date = results.data[i][1]
								  obj.repair_id = results.data[i][2]
								  obj.repair_report_id = results.data[i][3]
								  obj.mcn = results.data[i][4]
								  obj.customer = results.data[i][5]
								  obj.regional_head = results.data[i][6]
								  obj.p_id=results.data[i][7]
								  obj.p_name=results.data[i][8]
								  obj.p_serial=results.data[i][9]
								  obj.repairer=results.data[i][10]
								  obj.rs=results.data[i][11]
								  obj.if_repair=results.data[i][12]
								  obj.station=results.data[i][13]
								  
								  console.log(obj);
								  data.push(obj)
							}
							//data.splice(0, 1)//将数组第一位的表格名称去除
							let num = 0
							console.log('data', data)
							_this.$data.importTableData=data;
						  }
						})
								
					} else {
						this.$data.fileListUpload=[];
						this.$message({
						type: 'warning',
							message: '附件格式错误，请删除后重新上传！'
						})
					}
		     	} else {
		      	this.$message({
		     			type: 'warning',
		              message: '请上传附件！'
		          	})
		    		}
		  },
		  importCsv(){
			  this.$data.fileListUpload=[];
			  this.$data.importTableData=[];
			  this.$data.importdialogVisible=true;
			  
			   this.$data.if_show_process=false;
		},
		  
		export_plan(){
				document.getElementById("bt_export").blur();
				
				this.export_time_Visible=false;
				
				var _this = this;
				var objs;
				axios.post('/u_ma/export_ma_plan', {
					opuser:localStorage.getItem("online_user"),
					opuser_uuid:localStorage.getItem("uuid"),
					id:this.$data.id_v,
					rid:this.$data.rid_v,
					if_done:this.$data.checked,
					repairer:this.$data.repairer_v,
					rs:this.$data.rs_v,
					regional_head:this.$data.regional_head_v,
					ms:this.$data.ms_v,
					sort_field:this.$data.asc_v,
					location:this.$data.location_v,
					pid:this.$data.pid_v,
					pname:this.$data.pname_v,
					bt:this.$data.timeform.bt,
					et:this.$data.timeform.et,
				  })
				  .then(function (response) {
					  
					var date = new Date();
					//年 getFullYear()：四位数字返回年份
					var year = date.getFullYear()%2000; //getFullYear()代替getYear()
					console.log(year.toString());
					//月 getMonth()：0 ~ 11
					var month = date.getMonth() + 1;
					if(month<10){
						month='0'+month
					}
					//日 getDate()：(1 ~ 31)
					var day = date.getDate();
					if(day<10){
						day='0'+day;
					}
					//时 getHours()：(0 ~ 23)
					var hour = date.getHours();
					if (hour<10){
						hour='0'+hour;
					}
					//分 getMinutes()： (0 ~ 59)
					var minute = date.getMinutes();
					if (minute<10){
						minute='0'+minute;
					}
					//秒 getSeconds()：(0 ~ 59)
					var second = date.getSeconds();
					if (second<10){
						second='0'+second;
					}
					
					var filename=year.toString()+month.toString()+day.toString() +" " + hour.toString()+minute.toString()+second.toString();
					filename = "维保计划 "+filename+".xlsx"
					console.log(response.data);
					var fileid = response.data.fileId;
					
					var downUrl = '/u_ma/download_file'+"?id="+fileid;
					downloadUrl(filename,downUrl);
				  })
				  .catch(function (error) {
					console.log(error);
				  });
		},
		  
		tableRowClassName({row, rowIndex}) {
				var n = rowIndex%2;
				if (n == 1) {
					return 'success-row';
				}
				return '';
		},
		show_update_dialog(row){
			console.log(row.ccd);
			  var recv_date;
			  if(row.recv_date !=undefined &&row.recv_date.length>0){
				  recv_date="20"+row.recv_date
			  }else{
				  recv_date=''
			  }
			  
			  var dispath_date;
			  if (row.dispath_date !=undefined &&row.dispath_date.length>0){
				  dispath_date="20"+row.dispath_date;
			  }else{
				  dispath_date=''
			  }
			  
			  var rqd;
			  if (row.rqd != undefined && row.rqd.length>0){
				   rqd="20"+row.rqd;
			  }else{
				  rqd='';
			  }
			  
			  var rod;
			  if (row.rod != undefined && row.rod.length>0){
					rod="20"+row.rod;
			  }else{
					rod='';
			  }
			  
			  var ccd;
			  if (row.ccd != undefined && row.ccd.length>0){
					ccd="20"+row.ccd;
			  }else{
					ccd='';
			  }
			  
			  var acd;
			  if (row.acd != undefined && row.acd.length>0){
					acd="20"+row.acd;
			  }else{
					acd='';
			  }
			  
			  var mcd;
			  if (row.mcd != undefined && row.mcd.length>0){
					mcd="20"+row.mcd;
			  }else{
					mcd='';
			  }
			  
			  var doi;
			  if (row.doi != undefined && row.doi.length>0){
					doi="20"+row.doi;
			  }else{
					doi='';
			  }
			  
			  this.$data.form = {
			  	id:row.id,
			  	recv_date:recv_date,
			  	dispath_date:dispath_date,
			  	repair_id:row.repair_id,
			  	repair_report_id:row.repair_report_id,
			  	customer:row.customer,
			  	regional_head:row.regional_head,
			  	p_id:row.p_id,
			  	p_name:row.p_name,
			  	
			  	repairer:row.repairer,
			  	rp:row.rp,
			  	ms:row.ms,
			  	rc:row.rc,
			  	rqd:rqd,
			  	rs:row.rs,
			  	rod:rod,
			  	if_repair:row.if_repair,
			  	ccd:ccd,
			  	acd:acd,
			  	overdue:row.overdue,
			  	quotation:row.quotation,
			  	mcd:mcd,
			  	mt:row.mt,
				
				p_serial:row.p_serial,
				inventory:row.inventory,
				
				doi:doi,
				link:row.link,
				mcn:row.mcn,
				
				total_work_time:row.total_work_time,
				plan_data:[],
			  };
			
			for(var i=0;i<row.plan_data.length;++i){
				let times = 1
				if(row.plan_data[i].times>times){
					times=row.plan_data[i].times;
				}
				
				let obj = {
					id:row.plan_data[i].id,
					produce_plan:row.plan_data[i].produce_plan,
					produce_plan_use_t:row.plan_data[i].produce_plan_use_t,
					produce_user:row.plan_data[i].produce_user,
					p_actual_finished_t:row.plan_data[i].p_actual_finished_t,
					state:row.plan_data[i].state,
					times:times,
				}
				this.$data.form.plan_data.push(obj);
			}
			console.log(this.$data.form)
			  
			this.get_ma_user();
			this.get_rs();
			
			var op_user = localStorage.getItem("online_user");
			var level = localStorage.getItem("level");
			var did = localStorage.getItem("did");
			if(level==1){
				this.$data.disabled=false;
			}else{
				this.$data.disabled =true;
			}
			this.$data.updatedialogVisible_ex = true;
		  },
		  
		update_ma_ex(){
			  this.$refs['authform_ex'].validate((valid) => {
				if (valid) {
					var _this = this;
					axios.post('/u_ma/update_ma_plan_ex', {
						opuser:localStorage.getItem("online_user"),
						opuser_uuid:localStorage.getItem("uuid"),
						data:{
							id:_this.form.id,
							recv_date:_this.form.recv_date,
							dispath_date:_this.form.dispath_date,
							repair_id:_this.form.repair_id,
							repair_report_id:_this.form.repair_report_id,
							customer:_this.form.customer,
							regional_head:_this.form.regional_head,
							p_id:_this.form.p_id,
							p_name:_this.form.p_name,
							
							repairer:_this.form.repairer,
							rp:_this.form.rp,
							ms:_this.form.ms,
							rc:_this.form.rc,
							rqd:_this.form.rqd,
							rs:_this.form.rs,
							rod:_this.form.rod,
							if_repair:_this.form.if_repair,
							ccd:_this.form.ccd,
							acd:_this.form.acd,
							overdue:_this.form.overdue,
							quotation:_this.form.quotation,
							mcd:_this.form.mcd,
							mt:_this.form.mt,
							
							p_serial:_this.form.p_serial,
							inventory:_this.form.inventory,
							
							doi:_this.form.doi,
							link:_this.form.link,
							mcn:_this.form.mcn,
							total_work_time:_this.form.total_work_time.toString(),
							plan_data:_this.form.plan_data,
						}
					})
					.then(function (response) {
						
						let r = response.data.r;
						let s = ""
						let errType = ""
						if (r == 0) {
							errType = "success"
							s = "修改成功！";
						} else if(r==1){
							errType = "error"
							s = "无权限!";
						}else{
							errType = "error"
							s = "修改失败！";
						}
						_this.$message({
							message: s,
							type: errType,
							duration: 1500
						});
						//更新页面
						
						if(r==0){
							_this.get_ma_plan(_this.$data.currentPage);
							_this.$data.updatedialogVisible_ex = false;
						}
					})
					.catch(function (error) {
					  console.log(error);
					});
				}
			  });
		  },
		remove_ma_plan(row){
			  
			   this.$confirm('此操作将永久删除, 是否继续?', '提示', {
			            confirmButtonText: '确定',
			            cancelButtonText: '取消',
			            type: 'warning'
			          }).then(() => {
			            var _this = this;
			            axios.post('/u_ma/remove_ma_plan', {
			            	opuser:localStorage.getItem("online_user"),
			            	opuser_uuid:localStorage.getItem("uuid"),
			            	id:row.id
			            })
			            .then(function (response) {
			            	
			            	let r = response.data.r;
			            	let s = ""
			            	let errType = ""
			            	if (r == 0) {
			            		errType = "success"
								s = "删除成功！";
			            	} else{
			            		errType = "error"
								s = "删除失败！";
			            	}
			            	_this.$message({
			            		message: s,
			            		type: errType,
			            		duration: 1500
			            	});
			            	
			            	//更新页面
			            	_this.get_ma_plan();
			            	
			            })
			            .catch(function (error) {
			              console.log(error);
			            });
			          }).catch(() => {
			          });
		  },
		  
		get_ma_plan(cur_page){
			
			console.log("cur_page:",cur_page);
		  
			document.getElementById("bt_serach").blur();
			var _this = this;
			
			if (cur_page==undefined){
				_this.$data.currentPage=1;
			} else {
				_this.$data.currentPage=cur_page;
			}
			
			var objs;
			axios.post('/u_ma/get_ma_plan', {
				opuser:localStorage.getItem("online_user"),
				opuser_uuid:localStorage.getItem("uuid"),
				index: this.$data.currentPage,
				count: this.$data.pagesize,
				id:this.$data.id_v,
				rid:this.$data.rid_v,
				if_done:this.$data.checked,
				repairer:this.$data.repairer_v,
				rs:this.$data.rs_v,
				regional_head:this.$data.regional_head_v,
				ms:this.$data.ms_v,
				sort_field:this.$data.asc_v,
				location:this.$data.location_v,
				pid:this.$data.pid_v,
				pname:this.$data.pname_v,
				station:this.$data.m_station_v,
			  })
			  .then(function (response) {
				console.log(response.data);
				objs = response.data.data;
				rcnt = response.data.total;
				_this.$data.tableData = objs;
				_this.$data.recordTotal = rcnt;
				//_this.$data.pagecnt = response.data.pagecnt;
			  })
			  .catch(function (error) {
				console.log(error);
			  });
		},
		  
		handleSizeChange(val) {
			  //console.log(`每页 ${val} 条`);
			  this.$data.pagesize = val;
			  
			  var _this = this;
			  
			  var objs;
			 axios.post('/u_ma/get_ma_plan', {
			 	opuser:localStorage.getItem("online_user"),
			 	opuser_uuid:localStorage.getItem("uuid"),
			 			index: this.$data.currentPage,
			 			count: this.$data.pagesize,
			 			id:this.$data.id_v,
			 			rid:this.$data.rid_v,
			 			if_done:this.$data.checked,
			 			repairer:this.$data.repairer_v,
			 			rs:this.$data.rs_v,
			 			regional_head:this.$data.regional_head_v,
			 			ms:this.$data.ms_v,
			 			sort_field:this.$data.asc_v,
						location:this.$data.location_v,
						pid:this.$data.pid_v,
						pname:this.$data.pname_v,
						station:this.$data.m_station_v,
			   })
				.then(function (response) {
				  console.log(response.data);
				objs = response.data.data;
				rcnt = response.data.total;
				_this.$data.tableData = objs;
				_this.$data.recordTotal = rcnt;
				})
				.catch(function (error) {
				  console.log(error);
				});
		},
		
		handleCurrentChange(val) {
		  //console.log(`当前页: ${val}`);
		  this.$data.currentPage = val;
		  
		  var _this = this;
		  
		  var objs;
		 axios.post('/u_ma/get_ma_plan', {
		 	opuser:localStorage.getItem("online_user"),
		 	opuser_uuid:localStorage.getItem("uuid"),
			index: this.$data.currentPage,
			count: this.$data.pagesize,
			id:this.$data.id_v,
			rid:this.$data.rid_v,
			if_done:this.$data.checked,
			repairer:this.$data.repairer_v,
			rs:this.$data.rs_v,
			regional_head:this.$data.regional_head_v,
			ms:this.$data.ms_v,
			sort_field:this.$data.asc_v,
			location:this.$data.location_v,
			pid:this.$data.pid_v,
			pname:this.$data.pname_v,
			station:this.$data.m_station_v,
		   })
				.then(function (response) {
				  console.log(response.data);
				objs = response.data.data;
				rcnt = response.data.total;
				_this.$data.tableData = objs;
				_this.$data.recordTotal = rcnt;
				})
				.catch(function (error) {
				  console.log(error);
				});
		},
		
	  }
	}
			