|
@@ -0,0 +1,3951 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <!-- 上传表单-->
|
|
|
+ <el-dialog
|
|
|
+ :title="upload.title"
|
|
|
+ :visible.sync="upload.open"
|
|
|
+ width="400px"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <el-upload
|
|
|
+ ref="upload"
|
|
|
+ :limit="1"
|
|
|
+ accept=".xlsx, .xls"
|
|
|
+ :headers="upload.headers"
|
|
|
+ :action="
|
|
|
+ upload.url +
|
|
|
+ '?updateSupport=' +
|
|
|
+ upload.updateSupport +
|
|
|
+ '&tableName=' +
|
|
|
+ tableName +
|
|
|
+ '&sqlKey=' +
|
|
|
+ tableKey
|
|
|
+ "
|
|
|
+ v-loading="upload.isUploading"
|
|
|
+ :disabled="upload.isUploading"
|
|
|
+ :on-progress="handleFileUploadProgress"
|
|
|
+ :on-success="handleFileSuccess"
|
|
|
+ :auto-upload="false"
|
|
|
+ :onChange="handleChange"
|
|
|
+ drag
|
|
|
+ >
|
|
|
+ <i class="el-icon-upload"></i>
|
|
|
+ <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
|
|
+ <div class="el-upload__tip text-center" slot="tip">
|
|
|
+ <!-- <div class="el-upload__tip" slot="tip">-->
|
|
|
+ <!-- <el-checkbox v-model="upload.updateSupport"/>-->
|
|
|
+ <!-- 是否更新已经存在的用户数据-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <span>仅允许导入xls、xlsx格式文件。</span>
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ style="font-size: 12px; vertical-align: baseline"
|
|
|
+ @click="importTemplate"
|
|
|
+ >下载模板
|
|
|
+ </el-link>
|
|
|
+ </div>
|
|
|
+ </el-upload>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitFileForm">确 定</el-button>
|
|
|
+ <el-button @click="upload.open = false">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <el-form :model="wTQueryParams" ref="wtQueryForm" size="small" :inline="true" v-show="showSearch" label-width="95px" style="margin-top: 20px;margin-bottom: 20px">
|
|
|
+ <el-form-item label="委托单号:" prop="orderNumber" >
|
|
|
+ <el-input
|
|
|
+ v-model="wTQueryParams.orderNumber"
|
|
|
+ placeholder="请输入委托单号"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="wThandleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="批号:" prop="orderNumber" >
|
|
|
+ <el-input
|
|
|
+ v-model.trim="wTQueryParams.lot"
|
|
|
+ placeholder="请输入批号"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="wThandleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="申请人:" prop="createBy" >
|
|
|
+ <el-input
|
|
|
+ v-model.trim="wTQueryParams.createBy"
|
|
|
+ placeholder="请输入申请人"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="wThandleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="样品名称:" prop="sampleName" >
|
|
|
+ <el-input
|
|
|
+ v-model="wTQueryParams.sampleName"
|
|
|
+ placeholder="请输入样品名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="wThandleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="样品PN:" prop="samplePn" >
|
|
|
+ <el-input
|
|
|
+ v-model="wTQueryParams.samplePn"
|
|
|
+ placeholder="请输入样品PN名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="wThandleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="样品类型:" prop="sampleType" >
|
|
|
+ <el-select
|
|
|
+ v-model="wTQueryParams.sampleType"
|
|
|
+ size="small"
|
|
|
+ style="width: 215px"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item,index) in dict.type.sample_type"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="样品来源" prop="sampleSource" >
|
|
|
+ <el-select
|
|
|
+ v-model="wTQueryParams.sampleSource"
|
|
|
+ size="small"
|
|
|
+ style="width: 215px"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item,index) in dict.type.sample_source"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="实验室:" prop="laboratory" >
|
|
|
+ <el-input
|
|
|
+ v-model="wTQueryParams.laboratory"
|
|
|
+ placeholder="请输入实验室名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter.native="wThandleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+<!-- <el-form-item label="供应商:" prop="orderNumber" >-->
|
|
|
+<!-- <el-input-->
|
|
|
+<!-- v-model="wTQueryParams.supplier"-->
|
|
|
+<!-- placeholder="请输入供应商信息:"-->
|
|
|
+<!-- clearable-->
|
|
|
+<!-- @keyup.enter.native="wThandleQuery"-->
|
|
|
+<!-- />-->
|
|
|
+<!-- </el-form-item>-->
|
|
|
+
|
|
|
+ <el-form-item label="创建时间:" >
|
|
|
+ <el-date-picker
|
|
|
+ v-model="wTQueryParams.createTimeHe"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ @keyup.enter.native="wThandleQuery"
|
|
|
+ end-placeholder="结束日期">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="wtHandleQuery" style="margin-left: 8px">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="wtResetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-row >
|
|
|
+ <el-radio-group v-model="tabPosition" style="margin-bottom: 30px;float: right" @change="tabHandleClick" >
|
|
|
+ <el-radio-button label="1">待送样</el-radio-button>
|
|
|
+ <el-radio-button label="2">已送样</el-radio-button>
|
|
|
+ <el-radio-button label="3">待测试</el-radio-button>
|
|
|
+ <el-radio-button label="5">测试中</el-radio-button>
|
|
|
+ <el-radio-button label="6">测试完成</el-radio-button>
|
|
|
+ <el-radio-button label="7">已退回</el-radio-button>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-row>
|
|
|
+ <!-- 头部按钮-->
|
|
|
+ <el-row :gutter="10" class="mb8" style="margin-bottom:30px">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="el-icon-plus"
|
|
|
+ size="mini"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['lims:wtxx:wtdxx:INSERT']"
|
|
|
+ >新增
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getListInformation"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+ <!-- 表格-->
|
|
|
+ <el-table v-loading="loading" :data="informationList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+<!-- <el-table-column label="主键" align="center" prop="id" />-->
|
|
|
+ <el-table-column label="委托单编号" align="center" prop="orderNumber" />
|
|
|
+ <el-table-column label="批号" align="center" prop="lot" />
|
|
|
+ <el-table-column label="样品名称" align="center" prop="sampleName" />
|
|
|
+<!-- <el-table-column label="样品PN" align="center" prop="samplePn" />-->
|
|
|
+<!-- <el-table-column label="检测地点" align="center" prop="detectionSite" />-->
|
|
|
+ <el-table-column label="送检部门" align="center" prop="submittingDepartment" />
|
|
|
+ <el-table-column label="实验室" align="center" prop="laboratory" />
|
|
|
+<!-- <el-table-column label="样品分类" align="center" prop="sampleClassification" />-->
|
|
|
+<!-- <el-table-column label="样品来源" align="center" prop="sampleSource" >-->
|
|
|
+<!-- <template slot-scope="scope" >-->
|
|
|
+<!-- <dict-tag :options="dict.type.sample_source" :value="scope.row.sampleSource"/>-->
|
|
|
+<!-- </template>-->
|
|
|
+<!-- </el-table-column>-->
|
|
|
+<!-- <el-table-column label="检测类型" align="center" prop="detectionType" />-->
|
|
|
+<!-- <el-table-column label="物料组" align="center" prop="materialSection" />-->
|
|
|
+<!-- <el-table-column label="物料号" align="center" prop="materialNumber" />-->
|
|
|
+ <el-table-column label="车间工序" align="center" prop="shopProcess" >
|
|
|
+ <template v-slot="scope">
|
|
|
+ <dict-tag :options="dict.type.shop_process" :value="scope.row.shopProcess"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="送检总数" align="center" prop="totalNumberOfInspection" />
|
|
|
+ <el-table-column label="供应商" align="center" prop="supplier" />
|
|
|
+<!-- <el-table-column label="样品处理方式" align="center" prop="sampleHandlingMethod" />-->
|
|
|
+
|
|
|
+<!-- <el-table-column label="委托单状态" align="center" />-->
|
|
|
+ <el-table-column label="委托单状态" align="center" prop="orderStatus">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <dict-tag :options="dict.type.order_status" :value="scope.row.orderStatus"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="检测类型项" align="center" prop="detectionTypeItemList" width="200px">
|
|
|
+ <template v-slot="scope">
|
|
|
+<!-- <dict-tag :options="dict.type.order_status" :value="scope.row.orderStatus"/>-->
|
|
|
+<!-- <dict-tag v-for="a in scope.row.jclxxtype" :options="dict.type.jclxxtype" :value="a"/>-->
|
|
|
+ <dict-tag style="margin-top:5px" v-for="item in scope.row.detectionTypeItemList" :options="dict.type.jclxxtype" :value="item"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" />
|
|
|
+ <el-table-column label="创建时间" align="center" prop="createTime" />
|
|
|
+ <el-table-column label="申请人" align="center" prop="createBy" />
|
|
|
+ <el-table-column label="申请时间" align="center" prop="orderApplicationTime" />
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-dropdown @command="(command)=>{handleCommand(command, scope.row)}">
|
|
|
+ <el-button type="warning">
|
|
|
+ 操作<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item v-hasPermi="['lims:wtxx:wtdxx:UPDATE']" command="update" v-if="scope.row.orderStatus==1|| scope.row.orderStatus==7">修改</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-hasPermi="['lims:wtxx:wtdxx:print']" command="print" v-if="scope.row.orderStatus==1" >打印标签</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-hasPermi="['lims:wtxx:wtdxx:print']" command="print100/100" v-if="scope.row.orderStatus==1" >打印标签(100*100)</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-hasPermi="['lims:wtxx:wtdxx:DELETE']" command="del" v-if="scope.row.orderStatus==1|| scope.row.orderStatus==7" >删除</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-hasPermi="['lims:wtxx:wtdxx:tj']" command="tj" v-if="scope.row.orderStatus==7||scope.row.orderStatus==1" >提交</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-hasPermi="['lims:wtxx:wtdxx:thxq']" command="thxq" v-if="scope.row.orderStatus==7">退回详情</el-dropdown-item>
|
|
|
+ <el-dropdown-item v-hasPermi="['lims:ckwtd:info']" command="wtdxq" >委托单详情</el-dropdown-item>
|
|
|
+
|
|
|
+
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <!-- 分页器-->
|
|
|
+ <pagination
|
|
|
+ v-show="total > 0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="wTQueryParams.pageNum"
|
|
|
+ :limit.sync="wTQueryParams.pageSize"
|
|
|
+ @pagination="getListInformation"
|
|
|
+ />
|
|
|
+ <!-- k-form-build 组件渲染弹窗-->
|
|
|
+ <el-dialog :title="title" :visible.sync="open" append-to-body>
|
|
|
+ <!-- <iframe
|
|
|
+ :src="iframeUrl"
|
|
|
+ width="100%"
|
|
|
+ height="600px"
|
|
|
+ style="border: none"
|
|
|
+ scrolling="no"
|
|
|
+ >
|
|
|
+ </iframe> -->
|
|
|
+ <!-- <template v-else> -->
|
|
|
+ <template>
|
|
|
+ <FormList
|
|
|
+ v-show="formType == 'dragFormGroup'"
|
|
|
+ ref="formGroupRef"
|
|
|
+ :formList="formList"
|
|
|
+ ></FormList>
|
|
|
+ <!-- <el-button @click="showValue">test</el-button> -->
|
|
|
+ </template>
|
|
|
+ <template>
|
|
|
+ <k-form-build
|
|
|
+ v-if="jsonData && formType == 'dragForm'"
|
|
|
+ class="formBuild"
|
|
|
+ ref="addFromRef"
|
|
|
+ :dynamicData="dynamicData"
|
|
|
+ :defaultValue="defaultValue"
|
|
|
+ @submit="tempSubBtn"
|
|
|
+ @change="formChangeHandler"
|
|
|
+ :value="jsonData"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="editConfirmHandler">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+<!-- <button v-print="printObj">Print local range</button><div id="loading" v-show="printLoading"></div>-->
|
|
|
+
|
|
|
+<!-- <div id="printMe" style="background:red;">-->
|
|
|
+<!-- <p>葫芦娃,葫芦娃</p>-->
|
|
|
+<!-- <p>一根藤上七朵花 </p>-->
|
|
|
+<!-- <p>小小树藤是我家 啦啦啦啦 </p>-->
|
|
|
+<!-- <p>叮当当咚咚当当 浇不大</p>-->
|
|
|
+<!-- <p> 叮当当咚咚当当 是我家</p>-->
|
|
|
+<!-- <p> 啦啦啦啦</p>-->
|
|
|
+<!-- <p>...</p>-->
|
|
|
+<!-- </div>-->
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 绑定按钮dialog -->
|
|
|
+ <el-dialog
|
|
|
+ title="提示"
|
|
|
+ :visible.sync="btnDialogVisible"
|
|
|
+ :before-close="handleClose"
|
|
|
+ >
|
|
|
+ <DialogTemplate
|
|
|
+ ref="dialogRef"
|
|
|
+ :groupKey="groupKey"
|
|
|
+ :rowobj="rowobj"
|
|
|
+ :subCount="subCount"
|
|
|
+ :tableCount="tableCount"
|
|
|
+ :subTableName="subTableName"
|
|
|
+ @addList="addListHandler"
|
|
|
+ >
|
|
|
+ </DialogTemplate>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="btnDialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="btnComfirm">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 自定义弹窗 -->
|
|
|
+ <el-dialog
|
|
|
+ title="提示"
|
|
|
+ :visible.sync="btnDialogVisible"
|
|
|
+ :before-close="handleClose"
|
|
|
+ >
|
|
|
+ <DialogTemplate
|
|
|
+ ref="dialogRef"
|
|
|
+ :groupKey="groupKey"
|
|
|
+ :rowobj="rowobj"
|
|
|
+ :subCount="subCount"
|
|
|
+ :tableCount="tableCount"
|
|
|
+ :subTableName="subTableName"
|
|
|
+ @addList="addListHandler"
|
|
|
+ >
|
|
|
+ </DialogTemplate>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="btnDialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="btnComfirm">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 自定义新增弹窗 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="insertFromTitle"
|
|
|
+ :visible.sync="insertFrom"
|
|
|
+ :before-close="insertFromClose"
|
|
|
+ width="800px"
|
|
|
+ >
|
|
|
+ <div style="width: 800px">
|
|
|
+ <el-form
|
|
|
+ ref="form"
|
|
|
+ :label-position="labelPosition"
|
|
|
+ label-width="100px"
|
|
|
+ :model="insertFormData"
|
|
|
+ >
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="供应商:" prop="supplier">
|
|
|
+ <el-select
|
|
|
+ v-model="insertFormData.supplierNo"
|
|
|
+ style="width: 200px"
|
|
|
+ placeholder="请选择供应商"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(option, index) in suppliers"
|
|
|
+ :key="option.id"
|
|
|
+ :label="option.supplierName"
|
|
|
+ :value="option.supplierNo"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="批号:" prop="lotNumber">
|
|
|
+ <el-input
|
|
|
+ v-model="insertFormData.lotNumber"
|
|
|
+ style="width: 200px"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="使用部门:" prop="useDepartment">
|
|
|
+ <el-input
|
|
|
+ v-model="insertFormData.useDepartment"
|
|
|
+ style="width: 200px"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="采购时间:" prop="procurementTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="insertFormData.procurementTime"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择采购时间">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="预计到货时间:" prop="estimatedDeliveryTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="insertFormData.estimatedDeliveryTime"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择预计到货时间">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="备注:" prop="remark">
|
|
|
+ <el-input
|
|
|
+ v-model="insertFormData.remark"
|
|
|
+ style="width: 200px"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <el-table :data="insertTable" style="width: 100%">
|
|
|
+ <!-- -->
|
|
|
+ <!-- <el-table-column-->
|
|
|
+ <!-- align="center"-->
|
|
|
+ <!-- prop="id"-->
|
|
|
+ <!-- label="序号"-->
|
|
|
+ <!-- width="80">-->
|
|
|
+ <!-- </el-table-column>-->
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ prop="materielId"
|
|
|
+ label="物料信息"
|
|
|
+ width="180"
|
|
|
+ >
|
|
|
+ <template v-slot:default="scope">
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.materielId"
|
|
|
+ size="small"
|
|
|
+ placeholder="请选择物料"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(option, index) in materiels"
|
|
|
+ :key="index"
|
|
|
+ :label="option.materielName"
|
|
|
+ :value="option.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ prop="quantity"
|
|
|
+ label="数量/重量"
|
|
|
+ width="180"
|
|
|
+ >
|
|
|
+ <template v-slot:default="scope">
|
|
|
+ <el-input v-model="scope.row.quantity" size="small"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column align="center" prop="remark" label="备注">
|
|
|
+ <template v-slot:default="scope">
|
|
|
+ <el-input v-model="scope.row.remark" size="small"></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
+ <template v-slot:default="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="danger"
|
|
|
+ @click="handleRowDelete(scope.$index, scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <!-- 添加一行数据 -->
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ class="buttonAdd"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="addRow"
|
|
|
+ >添加一行</el-button
|
|
|
+ >
|
|
|
+
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="insertFrom = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="insertTableRequest">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 创建委托单 -->
|
|
|
+ <el-dialog
|
|
|
+ :title="dynamicHeading"
|
|
|
+ :visible.sync="viewWtFormDetailsShow"
|
|
|
+ width="1300px"
|
|
|
+ >
|
|
|
+ <div class="dl-dCon">
|
|
|
+ <el-form ref="wtform1" :model="wtform" :rules="wtformRules" label-width="120px" style="margin-top: 20px">
|
|
|
+ <el-tabs v-model="activeName" @tab-click="activeNameHandleClick" :before-leave="beforeLeave" ref="yourTabsRefName">
|
|
|
+ <el-tab-pane label="委托单信息" name="first">
|
|
|
+
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="批号" prop="lot">
|
|
|
+ <el-input v-model.trim="wtform.lot" @blur="lotChange" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="车间工序" prop="shopProcess">
|
|
|
+ <!-- <el-input v-model="wtform.shopProcess" :disabled="true"></el-input>-->
|
|
|
+ <el-select
|
|
|
+ v-model="wtform.shopProcess"
|
|
|
+ size="small"
|
|
|
+ style="width: 300px"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ @change="bgx"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in dict.type.shop_process"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="送检总数">
|
|
|
+ <el-input v-model="wtform.totalNumberOfInspection"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="供应商">
|
|
|
+ <el-input v-model="wtform.supplier"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样品处理方式">
|
|
|
+ <el-select
|
|
|
+ v-model="wtform.sampleHandlingMethod"
|
|
|
+ size="small"
|
|
|
+ style="width: 300px"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item,index) in dict.type.sample_handling_method"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="备注">
|
|
|
+ <el-input type="textarea" v-model="wtform.remark"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="检测地点">
|
|
|
+ <el-input v-model="wtform.detectionSite" :disabled="true" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="送检部门">
|
|
|
+ <el-input v-model="wtform.submittingDepartment" :disabled="true" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="送样人">
|
|
|
+ <el-input v-model="wtform.sampleSender"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="物料信息" name="second">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="实验室" >
|
|
|
+ <el-input v-model="wtform.laboratory" :disabled="true" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="批号">
|
|
|
+ <el-input v-model="wtform.lot" :disabled="true" placeholder="批次号跟委托单输入批次号相同"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样品名称">
|
|
|
+ <el-input v-model="wtform.sampleName" :disabled="true" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样品重量">
|
|
|
+ <el-input v-model="wtform.weight"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="厚度">
|
|
|
+ <el-input v-model="wtform.thickness"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="实际厚度">
|
|
|
+ <el-input v-model="wtform.actualThickness"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="规格" >
|
|
|
+ <el-input v-model="wtform.specification"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样品类型">
|
|
|
+ <el-select
|
|
|
+ v-model="wtform.sampleType"
|
|
|
+ size="small"
|
|
|
+ style="width: 300px"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item,index) in dict.type.sample_type"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="紧急度">
|
|
|
+ <!-- <el-input v-model="wtform.name"></el-input>-->
|
|
|
+ <el-select
|
|
|
+ v-model="wtform.emergencyDegree"
|
|
|
+ size="small"
|
|
|
+ style="width: 300px"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item,index) in dict.type.emergency_degree"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样品来源">
|
|
|
+ <el-select
|
|
|
+ v-model="wtform.sampleSource"
|
|
|
+ size="small"
|
|
|
+ style="width: 300px"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item,index) in dict.type.sample_source"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样品PN">
|
|
|
+ <el-input v-model="wtform.samplePn"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="样品描述">
|
|
|
+ <el-input v-model="wtform.sampleDescription"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8" v-if="wtform.shopProcess==4">
|
|
|
+ <el-form-item label="合金" >
|
|
|
+ <el-input v-model="wtform.alloy" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户名称" prop="khOne">
|
|
|
+ <el-input v-model="wtform.khOne"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户名称2">
|
|
|
+ <el-input v-model="wtform.khTwo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户名称3">
|
|
|
+ <el-input v-model="wtform.khThree"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户名称4">
|
|
|
+ <el-input v-model="wtform.khFour"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户名称5">
|
|
|
+ <el-input v-model="wtform.khFive"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户名称6">
|
|
|
+ <el-input v-model="wtform.khSix"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户名称7">
|
|
|
+ <el-input v-model="wtform.khSeven"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户名称8">
|
|
|
+ <el-input v-model="wtform.khEight"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户编号" prop="customerNumber">
|
|
|
+ <el-input v-model="wtform.customerNumber"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户主标识" prop="customerMasterTag">
|
|
|
+ <el-input v-model="wtform.customerMasterTag" ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="客户副标识" prop="customerViceTag">
|
|
|
+ <el-input v-model="wtform.customerViceTag"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="手输客户" prop="inputkh">
|
|
|
+ <el-input v-model="wtform.inputkh" @blur="inputNr(wtform.inputkh)"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="手输厚度" prop="inputhd">
|
|
|
+ <el-input v-model="wtform.inputhd" @blur="inputNr(wtform.inputhd)"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="手输合金" prop="inputhj" v-if="wtform.shopProcess==4">
|
|
|
+ <el-input v-model="wtform.inputhj" @blur="inputNr(wtform.inputhj)"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="检测信息" name="third">
|
|
|
+ <div style="margin-bottom: 50px">
|
|
|
+ <el-table
|
|
|
+ align="center"
|
|
|
+ :data="jctableData"
|
|
|
+ border
|
|
|
+ :row-key="getRowKey"
|
|
|
+ ref="multipleTable"
|
|
|
+ style="width: 100%"
|
|
|
+ @selection-change="handleSelectionChange2"
|
|
|
+ >
|
|
|
+ <el-table-column :reserve-selection="true" type="selection" align="center" width="55"></el-table-column>
|
|
|
+ <el-table-column prop="testItem" align="center" label="检测项目"></el-table-column>
|
|
|
+ <el-table-column label="合金" align="center" prop="alloy" />
|
|
|
+ <el-table-column label="厚度" align="center" prop="thickness" />
|
|
|
+ <el-table-column label="工序" align="center" prop="process">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <dict-tag :options="dict.type.shop_process" :value="scope.row.process"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="客户" align="center" prop="customerOne" />
|
|
|
+ <el-table-column label="客户编号" align="center" prop="customerNumber" />
|
|
|
+ <el-table-column label="客户主标识" align="center" prop="customerMasterTag" />
|
|
|
+ <el-table-column label="客户副标识" align="center" prop="customerViceTag" ></el-table-column>
|
|
|
+ <el-table-column label="检测指标" align="center" prop="detectionIndex" ></el-table-column>
|
|
|
+ <el-table-column label="检测周期" align="center" prop="detectionCycle"></el-table-column>
|
|
|
+ <el-table-column label="规格上限" align="center" prop="upperSpecificationLimit" />
|
|
|
+ <el-table-column label="规格下限" align="center" prop="lowerSpecificationLimit" />
|
|
|
+ <el-table-column label="规格单位" align="center" prop="specificationUnit" />
|
|
|
+ <el-table-column label="检测方法名称" align="center" prop="detectionMethodName" ></el-table-column>
|
|
|
+ <el-table-column label="检测方法编号" align="center" prop="testMethodNumber" ></el-table-column>
|
|
|
+ <el-table-column label="方法版本号" align="center" prop="methodVersionNumber" />
|
|
|
+ <el-table-column label="检测项费用" align="center" prop="testItemCost" />
|
|
|
+ <el-table-column label="内控上限" align="center" prop="upperLimitOfInternalControl" />
|
|
|
+ <el-table-column label="内控下限" align="center" prop="lowerLimitOfInternalControl" />
|
|
|
+ <el-table-column label="检测组" align="center" prop="detectiongroup" ></el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="检测设备型号" align="center" prop="testingEquipmentType" />
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" />
|
|
|
+ </el-table>
|
|
|
+ <pagination
|
|
|
+ v-show="jcTotal > 0"
|
|
|
+ :total="jcTotal"
|
|
|
+ :page.sync="jcQueryParams.pageNum"
|
|
|
+ :limit.sync="jcQueryParams.pageSize"
|
|
|
+ :page-sizes="[2,4,6,10,15]"
|
|
|
+ @pagination="getDetectionInformatio"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="qx">取 消</el-button>
|
|
|
+ <el-button type="primary" v-show="dynamicHeading!='查看委托单详情'" @click="wtFormDetailsAdd">确认</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 查看委托单退回详情-->
|
|
|
+ <!--样品退回表单 -->
|
|
|
+ <el-dialog
|
|
|
+ title="样品退回详情"
|
|
|
+ :visible.sync="sampleReturnShow"
|
|
|
+ width="40%"
|
|
|
+ :before-close="isSampleReturnHandleClose">
|
|
|
+ <div>
|
|
|
+ <el-form ref="form" :model="returnFrom" label-width="120px" style="margin-top: 20px">
|
|
|
+ <el-form-item label="退回原因">
|
|
|
+ <el-select
|
|
|
+ v-model="returnFrom.reasonForReturn"
|
|
|
+ size="small"
|
|
|
+ style="width: 400px"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ :disabled="true"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in dict.type.reason_for_return"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="退回原因备注">
|
|
|
+ <el-input type="textarea" :disabled="true" v-model="returnFrom.reasonForReturnRemark"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="sampleReturnShow=false">确认</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!--输入打印信息 -->
|
|
|
+ <el-dialog
|
|
|
+ title="打印备注信息"
|
|
|
+ :visible.sync="isPrintNoteShow"
|
|
|
+ width="30%"
|
|
|
+ :before-close="isPrintNoteHandleClose">
|
|
|
+ <div>
|
|
|
+ <el-form ref="isPrintNoteForm" :model="isPrintNoteForm" label-width="80px">
|
|
|
+ <el-form-item label="打印原因">
|
|
|
+ <el-input type="textarea" v-model="isPrintNoteForm.remark"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="isPrintNoteShow = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="isPrintNoteShowClick">确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- print -->
|
|
|
+ <div id="printDom" style="width: 160px; height: 160px"></div>
|
|
|
+
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ delTableData,
|
|
|
+ dragTableInfo,
|
|
|
+ listTable,
|
|
|
+ unionListTableData,
|
|
|
+ getInfoBySqlKey,
|
|
|
+ btnCommonApi,
|
|
|
+ addTableData,
|
|
|
+ batchEdit,
|
|
|
+} from "@/api/tablelist/commonTable";
|
|
|
+import {
|
|
|
+ getListSupplier,
|
|
|
+ getListMateriel,
|
|
|
+ addPurchase,
|
|
|
+ getPurchaseInfos,
|
|
|
+ updatePurchase,
|
|
|
+} from "@/api/supplier/supplier";
|
|
|
+import { listData } from "@/api/system/tenant/data";
|
|
|
+import { getPurchaseInfo } from "@/api/tablelist/purchaseInfo";
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
+import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
|
|
|
+import { camelCase, toUnderline } from "@/utils";
|
|
|
+import { inputDisableComplete } from "@/utils/other";
|
|
|
+import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
|
|
|
+import BtnMenuList from "@/views/tablelist/commonTable/BtnMenuList.vue";
|
|
|
+import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
|
|
|
+import FormList from "@/components/FormGroup/formList.vue";
|
|
|
+import { v4 as uuidv4 } from "uuid";
|
|
|
+import printHtml from "./print";
|
|
|
+import qrCodeList from "@/utils/print/qrCodeList2";
|
|
|
+import qrCodeList3 from "@/utils/print/qrCodeList3";
|
|
|
+import qrCodeList10060 from "@/utils/print/qrCodeList10060";
|
|
|
+import {userInfoAndSection} from "@/api/system/user";
|
|
|
+import _ from 'lodash';
|
|
|
+// 引入 Day.js
|
|
|
+import dayjs from 'dayjs';
|
|
|
+import {
|
|
|
+ addSamplePrintingInfo,
|
|
|
+ addVoWt, delDateWtInformation,
|
|
|
+ getDetectionInformation, getDetectionInformationListOrderBy,
|
|
|
+ getInformationOne,
|
|
|
+ getMateriel, getOrderInformation,
|
|
|
+ listInformation, putSamplePrintingInfo, selectSamplePrintingInfo, updateDateWtInformation, upDateWtInformation
|
|
|
+} from "@/api/lims/materielInfo/materiel";
|
|
|
+import JsBarcode from 'jsbarcode'
|
|
|
+import {Base64} from 'js-base64'
|
|
|
+export default {
|
|
|
+ name: "wtFormIndex",
|
|
|
+ dicts: ["jclxxtype","detection_site", "submitting_department",'sample_type','order_status',
|
|
|
+ 'detection_type','shop_process','sample_handling_method','laboratory','sample_source','emergency_degree','sample_fl','reason_for_return'],
|
|
|
+ components: { Queryfrom, Menu, DialogTemplate, FormList, BtnMenuList },
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ phisFlag:"",
|
|
|
+ tabPosition:1,
|
|
|
+ // printLoading: true,
|
|
|
+ // printObj: {
|
|
|
+ // id: "printMe",
|
|
|
+ // popTitle: 'good print',
|
|
|
+ // extraCss: "https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.css, https://cdn.bootcdn.net/ajax/libs/hover.css/2.3.1/css/hover-min.css",
|
|
|
+ // extraHead: '<meta http-equiv="Content-Language"content="zh-cn"/>',
|
|
|
+ // beforeOpenCallback (vue) {
|
|
|
+ // vue.printLoading = true
|
|
|
+ // console.log('打开之前')
|
|
|
+ // },
|
|
|
+ // openCallback (vue) {
|
|
|
+ // vue.printLoading = false
|
|
|
+ // console.log('执行了打印')
|
|
|
+ // },
|
|
|
+ // clickMounted: () => {
|
|
|
+ // console.log("点击了确认回到");
|
|
|
+ // },
|
|
|
+ // closeCallback (vue) {
|
|
|
+ // console.log('关闭了打印工具')
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ printOption:"",
|
|
|
+ beforeFalg:true,
|
|
|
+ wtformRules:{
|
|
|
+ lot:[
|
|
|
+ { required: true, message: '批号不能为空', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ shopProcess:[
|
|
|
+ { required: true, message: '请选择车间工序', trigger: 'change' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ returnFrom:{},
|
|
|
+ sampleReturnShow:false,
|
|
|
+ isPrintNoteForm:{},
|
|
|
+ isDyWtDId:"",
|
|
|
+ isPrintNoteShow:false,
|
|
|
+ jcxString:[],
|
|
|
+ wTQueryParams:{
|
|
|
+ pageNum: 1, // 第几页
|
|
|
+ pageSize: 5, // 每页大小
|
|
|
+ },
|
|
|
+ wTshowSearch:true,
|
|
|
+ jctableData: [],
|
|
|
+ informationList:[],
|
|
|
+ dynamicHeading:"",
|
|
|
+ wtform:{
|
|
|
+ detectionSite:"杭州五星",
|
|
|
+ laboratory:"五星1号实验室",
|
|
|
+ khOne:"",
|
|
|
+ sampleName:"",
|
|
|
+ weight:"",
|
|
|
+ materialNumber:"",
|
|
|
+ alloy:"",
|
|
|
+ thickness:"",
|
|
|
+ specification:"",
|
|
|
+ sampleSource:"1", //样品来源
|
|
|
+ emergencyDegree:"1", //紧急度
|
|
|
+ },
|
|
|
+ jcTotal:0,
|
|
|
+ jcids:[],
|
|
|
+ activeName: 'first',
|
|
|
+ insertTable: [],
|
|
|
+ viewWtFormDetailsShow:false,
|
|
|
+ labelPosition: "right",
|
|
|
+ insertFromTitle: "",
|
|
|
+ insertFormData: {},
|
|
|
+ suppliers: [{ id: 1, name: "供应商1" }],
|
|
|
+ insertFrom: false,
|
|
|
+ materiels: [],
|
|
|
+ particularsOfSalesNote: {
|
|
|
+ purchaseOrderNumber: "",
|
|
|
+ supplierName: "",
|
|
|
+ purchaseLotNumber: "",
|
|
|
+ procurementTime: "采购时间",
|
|
|
+ },
|
|
|
+ purchaseInfo: [],
|
|
|
+ //是否显示销售单详情表单
|
|
|
+ viewPurchaseOrderDetailsShow: false,
|
|
|
+ // 顶部按钮数据
|
|
|
+ topBtnArr: [], //顶部按钮数据
|
|
|
+ selection: [], //选中数组
|
|
|
+ printShow: false, //打印页面
|
|
|
+ printHtml: "", //打印的html
|
|
|
+ // 自动生成字段
|
|
|
+ theAutoField: [
|
|
|
+ "id",
|
|
|
+ "createBy",
|
|
|
+ "createById",
|
|
|
+ "createTime",
|
|
|
+ "delFlag",
|
|
|
+ "updateBy",
|
|
|
+ "updateById",
|
|
|
+ "updateTime",
|
|
|
+ "del_flag",
|
|
|
+ "create_by",
|
|
|
+ "create_by_id",
|
|
|
+ "create_time",
|
|
|
+ "data_approval_status",
|
|
|
+ "update_by",
|
|
|
+ "update_by_id",
|
|
|
+ "update_time",
|
|
|
+ ],
|
|
|
+ // 绑定按钮dialog
|
|
|
+ btnDialogVisible: false,
|
|
|
+ // 绑定修改dialog
|
|
|
+ groupKey: "",
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示统计
|
|
|
+ showCount: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: false,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 用户表格数据
|
|
|
+ tableList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 日期范围
|
|
|
+ dateRange: [],
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ rules: {},
|
|
|
+ // cru 弹窗
|
|
|
+ open: false,
|
|
|
+ // excel共通导入数据
|
|
|
+ upload: {
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 弹出层标题(
|
|
|
+ title: "",
|
|
|
+ // 是否禁用上传
|
|
|
+ isUploading: false,
|
|
|
+ // 是否更新已经存在的数据
|
|
|
+ updateSupport: 0,
|
|
|
+ // 设置上传的请求头部
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
+ // 上传的地址
|
|
|
+ url: process.env.VUE_APP_BASE_API1 + "common/uploadData",
|
|
|
+ },
|
|
|
+ // 排序方式 默认降序
|
|
|
+ sortOrder: true,
|
|
|
+ // 共通查询参数接受子组件的参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1, // 第几页
|
|
|
+ pageSize: 10, // 每页大小
|
|
|
+ orderStatus:1,
|
|
|
+ orderByColumn: "", // 根据某列排序
|
|
|
+ isAsc: "", // desc(降序)或 asc(升序)
|
|
|
+ // 基本查询参数
|
|
|
+ basicMap: {
|
|
|
+ tableName: "drag_form",
|
|
|
+ },
|
|
|
+ // 当前表字段筛选参数
|
|
|
+ queryMap: {
|
|
|
+ // 当前查询基本参数
|
|
|
+ // ... key : value 当前页面的筛选条件
|
|
|
+ // 超级查询的唯一值
|
|
|
+ queryCriteriaValue: "",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ jcQueryParams:{
|
|
|
+ pageNum: 1, // 第几页
|
|
|
+ pageSize: 4, // 每页大小
|
|
|
+ },
|
|
|
+ addMessage:{},
|
|
|
+ // 列信息
|
|
|
+ columns: {},
|
|
|
+ // 当前模版信息
|
|
|
+ templateInfo: {},
|
|
|
+ // 查询条件
|
|
|
+ queryFromWhere: {},
|
|
|
+ // 当前table唯一标识
|
|
|
+ tableKey: null,
|
|
|
+ // 当前表名称
|
|
|
+ tableName: null,
|
|
|
+ //存放html代码块
|
|
|
+ iframeUrl: "",
|
|
|
+ //存放表单渲染数据
|
|
|
+ jsonData: {},
|
|
|
+ // 回显表格数据,
|
|
|
+ defaultValue: {},
|
|
|
+ // 统计card
|
|
|
+ statisticList: [],
|
|
|
+ // 样式表
|
|
|
+ styleList: [],
|
|
|
+ // 字典样式对象
|
|
|
+ dictStyleObj: {},
|
|
|
+ // 操作列 按钮数据
|
|
|
+ excuteBtnArr: [],
|
|
|
+ // 下拉框动态数据
|
|
|
+ dynamicData: {},
|
|
|
+ // 当前点击按钮的数据
|
|
|
+ currentBtnData: {},
|
|
|
+ // 修改选中行
|
|
|
+ rowobj: {},
|
|
|
+ // 该行的统计信息
|
|
|
+ subCount: [],
|
|
|
+ tableCount: [],
|
|
|
+ // 弹窗新增数据
|
|
|
+ addLists: [],
|
|
|
+ subTableName: "",
|
|
|
+ // 当前点击行的数据
|
|
|
+ currentRow: {},
|
|
|
+ // 操作列是否显示隐藏
|
|
|
+ isShowExcuteCol: false,
|
|
|
+ // 表单组数据
|
|
|
+ formList: [],
|
|
|
+ formType: "dragFormGroup",
|
|
|
+ FormNameList: [], //表单组中表格名称
|
|
|
+ FormListDefaultValue: {}, //表单组的默认表单数据
|
|
|
+ dqwtdId:"",
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ // 得到当前展示的table的唯一标识
|
|
|
+ this.tableKey = this.$route.query.tableKey;
|
|
|
+ //刷新用户列表
|
|
|
+ // this.getList()
|
|
|
+ this.getListInformation()
|
|
|
+ //获取vuex里的用户信息
|
|
|
+ this.getUserInfo();
|
|
|
+
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
+ computed: {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ tabHandleClick() {
|
|
|
+ this.wTQueryParams.orderStatus=this.tabPosition;
|
|
|
+ this.getListInformation()
|
|
|
+ },
|
|
|
+ beforeLeave(){
|
|
|
+ console.log(this.phisFlag)
|
|
|
+ if(this.phisFlag==false||this.phisFlag==undefined||this.phisFlag==""){
|
|
|
+ this.$modal.msgWarning("未有此批号的物料信息");
|
|
|
+ return false; // 阻止切换
|
|
|
+ }else {
|
|
|
+ if(this.wtform.shopProcess==undefined||this.wtform.shopProcess==""||this.wtform.shopProcess==null){
|
|
|
+ this.$modal.msgWarning("请先选择工序");
|
|
|
+ return false; // 阻止切换
|
|
|
+ }else {
|
|
|
+ return true; // 允许切换
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ inputNr(inputhj){
|
|
|
+ if(this.dynamicHeading=="新增委托单信息"){
|
|
|
+ let detectionInformation={};
|
|
|
+ if(this.wtform.shopProcess==4){
|
|
|
+ detectionInformation = {
|
|
|
+ "inputhj": this.wtform.inputhj,
|
|
|
+ "inputkh": this.wtform.inputkh,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag,
|
|
|
+ "inputhd":this.wtform.inputhd
|
|
|
+ };
|
|
|
+ }else {
|
|
|
+ detectionInformation = {
|
|
|
+ "inputkh": this.wtform.inputkh,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag,
|
|
|
+ "inputhd":this.wtform.inputhd
|
|
|
+ };
|
|
|
+ delete this.jcQueryParams.alloy;
|
|
|
+ delete this.jcQueryParams.inputhj;
|
|
|
+ }
|
|
|
+ console.log(this.wtform)
|
|
|
+ this.jcQueryParams={...this.jcQueryParams,...detectionInformation}
|
|
|
+ getDetectionInformationListOrderBy(this.jcQueryParams).then(data => {
|
|
|
+ this.jctableData = data.rows;
|
|
|
+ this.jcTotal = data.total;
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ let detectionInformation={};
|
|
|
+ if(this.wtform.shopProcess==4){
|
|
|
+ detectionInformation = {
|
|
|
+ "inputhj": this.wtform.inputhj,
|
|
|
+ "inputkh": this.wtform.inputkh,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag,
|
|
|
+ "inputhd":this.wtform.inputhd
|
|
|
+ };
|
|
|
+ }else {
|
|
|
+ detectionInformation = {
|
|
|
+ "inputkh": this.wtform.inputkh,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag,
|
|
|
+ "inputhd":this.wtform.inputhd
|
|
|
+ };
|
|
|
+ delete this.jcQueryParams.alloy;
|
|
|
+ delete this.jcQueryParams.inputhj;
|
|
|
+ }
|
|
|
+ console.log(this.wtform)
|
|
|
+ this.jcQueryParams={...this.jcQueryParams,...detectionInformation}
|
|
|
+ getDetectionInformationListOrderBy(this.jcQueryParams).then(data=>{
|
|
|
+ this.jctableData=data.rows;
|
|
|
+ this.jcTotal = data.total;
|
|
|
+ //如果是修改委托单、那么回显的就是当前委托单已经选择的检测信息
|
|
|
+ getInformationOne(this.dqwtdId).then(dataRs=>{
|
|
|
+ //手机检测信息id成为一个新数组
|
|
|
+ this.jcids=dataRs.data.jcids;
|
|
|
+ //检测信息默认回显
|
|
|
+ this.jcids.map(id => {
|
|
|
+ this.jctableData.map(item => {
|
|
|
+ if (item.id==id) {
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ wtdxq(row){
|
|
|
+ this.dynamicHeading="查看委托单详情";
|
|
|
+ this.viewWtFormDetailsShow=true;
|
|
|
+ getInformationOne(row.id).then(dataRs=>{
|
|
|
+ if(dataRs.code=200){
|
|
|
+ this.dqwtdId=row.id
|
|
|
+ this.wtform = _.cloneDeep(dataRs.data);
|
|
|
+ let detectionInformation={};
|
|
|
+ if(this.wtform.shopProcess==4){
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "alloy":this.wtform.alloy,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ // "customerOne":this.wtform.khOne,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+
|
|
|
+ };
|
|
|
+ }else {
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ // "customerOne":this.wtform.khOne,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+ };
|
|
|
+ }
|
|
|
+ console.log(this.wtform)
|
|
|
+ this.jcQueryParams={...this.jcQueryParams,...detectionInformation}
|
|
|
+ getDetectionInformationListOrderBy(this.jcQueryParams).then(data=>{
|
|
|
+ this.jctableData=data.rows;
|
|
|
+ this.jcTotal = data.total;
|
|
|
+ //回显的值绑锭(这个是需要回显的数据id)
|
|
|
+ this.jcids=dataRs.data.jcids;
|
|
|
+ this.jcxString=dataRs.data.jcids;//数据绑定回显
|
|
|
+ this.wtform.jcxString=dataRs.data.jcids.join(",");
|
|
|
+ this.activeName="third"
|
|
|
+ this.activeName="first"
|
|
|
+ // this.activeName="first";
|
|
|
+ //数据加载成功在进行回显操作
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.$refs.multipleTable.clearSelection()
|
|
|
+ this.jcids.map(id => {
|
|
|
+ this.jctableData.map(item => {
|
|
|
+ if (item.id==id) {
|
|
|
+ console.log("相等撸")
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ //如果是修改委托单、那么回显的就是当前委托单已经选择的检测信息
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ cha(){
|
|
|
+ console.log("1111")
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
+ //下拉框工序改变
|
|
|
+ bgx(){
|
|
|
+ if(this.dynamicHeading=="新增委托单信息"){
|
|
|
+ let detectionInformation={};
|
|
|
+ if(this.wtform.shopProcess==4){
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "alloy":this.wtform.alloy,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+ };
|
|
|
+ }else {
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ // "customerOne":this.wtform.khOne,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+ };
|
|
|
+ delete this.jcQueryParams.alloy;
|
|
|
+ }
|
|
|
+ console.log(this.wtform)
|
|
|
+ this.jcQueryParams={...this.jcQueryParams,...detectionInformation}
|
|
|
+ getDetectionInformationListOrderBy(this.jcQueryParams).then(data => {
|
|
|
+ this.jctableData = data.rows;
|
|
|
+ this.jcTotal = data.total;
|
|
|
+ // //根据工序查询对应的检测信息(这是需要默认勾选的)
|
|
|
+ //
|
|
|
+ // let detectionInformation = {"process": this.wtform.shopProcess,"alloy":this.wtform.alloy,"thickness":this.wtform.thickness};
|
|
|
+ // getDetectionInformation(detectionInformation).then(data => {
|
|
|
+ // //手机检测信息id成为一个新数组
|
|
|
+ // let ids = data.rows.map(row => row.id);
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs.multipleTable.clearSelection()
|
|
|
+ // //检测信息默认回显
|
|
|
+ // ids.map(id => {
|
|
|
+ // this.jctableData.map(item => {
|
|
|
+ // if (item.id == id) {
|
|
|
+ // this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ let detectionInformation={};
|
|
|
+ if(this.wtform.shopProcess==4){
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "alloy":this.wtform.alloy,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ // "customerOne":this.wtform.khOne,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+ };
|
|
|
+ }else {
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ // "customerOne":this.wtform.khOne,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+ };
|
|
|
+ delete this.jcQueryParams.alloy;
|
|
|
+ }
|
|
|
+ console.log(this.wtform)
|
|
|
+ this.jcQueryParams={...this.jcQueryParams,...detectionInformation}
|
|
|
+ getDetectionInformationListOrderBy(this.jcQueryParams).then(data=>{
|
|
|
+ this.jctableData=data.rows;
|
|
|
+ this.jcTotal = data.total;
|
|
|
+ //如果是修改委托单、那么回显的就是当前委托单已经选择的检测信息
|
|
|
+ getInformationOne(this.dqwtdId).then(dataRs=>{
|
|
|
+ //手机检测信息id成为一个新数组
|
|
|
+ this.jcids=dataRs.data.jcids;
|
|
|
+ //检测信息默认回显
|
|
|
+ this.jcids.map(id => {
|
|
|
+ this.jctableData.map(item => {
|
|
|
+ if (item.id==id) {
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isSampleReturnHandleClose(){
|
|
|
+ this.sampleReturnShow=false;
|
|
|
+ },
|
|
|
+ qx(){
|
|
|
+ this.viewWtFormDetailsShow=false;
|
|
|
+ },
|
|
|
+ //展示不同的标签
|
|
|
+ getStatusType(status) {
|
|
|
+ switch (status) {
|
|
|
+ case '待送样':
|
|
|
+ return 'warning';
|
|
|
+ case '已送样':
|
|
|
+ return 'success';
|
|
|
+ case '待测试':
|
|
|
+ return 'info';
|
|
|
+ case '测试中':
|
|
|
+ return '';
|
|
|
+ case '取消':
|
|
|
+ return 'danger';
|
|
|
+ case '完成':
|
|
|
+ return 'success';
|
|
|
+ default:
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //得到检测信息(分页用的方法)
|
|
|
+ getDetectionInformatio(){
|
|
|
+ console.log("分页器消息")
|
|
|
+ if(this.dynamicHeading=="新增委托单信息"){//回显的当前工序的默认的检测信息
|
|
|
+ getDetectionInformationListOrderBy(this.jcQueryParams).then(data => {
|
|
|
+ this.jctableData = data.rows;
|
|
|
+ this.jcTotal = data.total;
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ let detectionInformation={};
|
|
|
+ if(this.wtform.shopProcess==4){
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "alloy":this.wtform.alloy,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ // "customerOne":this.wtform.khOne,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+ };
|
|
|
+ }else {
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ // "customerOne":this.wtform.khOne,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+ };
|
|
|
+ delete this.jcQueryParams.alloy;
|
|
|
+ }
|
|
|
+ console.log(this.wtform)
|
|
|
+ this.jcQueryParams={...this.jcQueryParams,...detectionInformation}
|
|
|
+ getDetectionInformationListOrderBy(this.jcQueryParams).then(data=>{
|
|
|
+ this.jctableData=data.rows;
|
|
|
+ this.jcTotal = data.total;
|
|
|
+ //如果是修改委托单、那么回显的就是当前委托单已经选择的检测信息
|
|
|
+ getInformationOne(this.dqwtdId).then(dataRs=>{
|
|
|
+ //手机检测信息id成为一个新数组
|
|
|
+ this.jcids=dataRs.data.jcids;
|
|
|
+ //检测信息默认回显
|
|
|
+ this.jcids.map(id => {
|
|
|
+ this.jctableData.map(item => {
|
|
|
+ if (item.id==id) {
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // getDetectionInformation(this.jcQueryParams).then(data=>{
|
|
|
+ // this.jctableData=data.rows;
|
|
|
+ // this.jcTotal = data.total;
|
|
|
+ // //根据工序查询对应的检测信息(这是需要默认勾选的)
|
|
|
+ // if(this.dynamicHeading=="新增委托单信息"){//回显的当前工序的默认的检测信息
|
|
|
+ // // let detectionInformation={"process":this.wtform.shopProcess};
|
|
|
+ // let detectionInformation = {"process": this.wtform.shopProcess,"alloy":this.wtform.alloy,"thickness":this.wtform.thickness};
|
|
|
+ // getDetectionInformation(detectionInformation).then(dataRs=>{
|
|
|
+ // //手机检测信息id成为一个新数组
|
|
|
+ // let ids = dataRs.rows.map(row => row.id);
|
|
|
+ // console.log("新增逻辑",ids)
|
|
|
+ // //检测信息默认回显
|
|
|
+ // ids.map(id => {
|
|
|
+ // this.jctableData.map(item => {
|
|
|
+ // if (item.id==id) {
|
|
|
+ // this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // }else {
|
|
|
+ // //如果是修改委托单、那么回显的就是当前委托单已经选择的检测信息
|
|
|
+ // getInformationOne(this.dqwtdId).then(dataRs=>{
|
|
|
+ // //手机检测信息id成为一个新数组
|
|
|
+ // this.jcids=dataRs.data.jcids;
|
|
|
+ // //检测信息默认回显
|
|
|
+ // this.jcids.map(id => {
|
|
|
+ // this.jctableData.map(item => {
|
|
|
+ // if (item.id==id) {
|
|
|
+ // this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ },
|
|
|
+ //添加委托单信息
|
|
|
+ wtFormDetailsAdd(){
|
|
|
+ this.$refs['wtform1'].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if(this.dynamicHeading=="新增委托单信息"){
|
|
|
+ this.wtform.wtSampleType=this.wtform.sampleType
|
|
|
+ this.wtform.wtLot=this.wtform.lot
|
|
|
+ console.log("formData",this.jcxString)
|
|
|
+ if(this.jcxString.length<=0){
|
|
|
+ this.$message({
|
|
|
+ message: '请选择一项检测信息',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ addVoWt(this.wtform).then(data=>{
|
|
|
+ console.log(data);
|
|
|
+ this.getListInformation()
|
|
|
+ this.$message({
|
|
|
+ message: '新增成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.viewWtFormDetailsShow=false;
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ if(this.jcxString.length<=0){
|
|
|
+ this.$message({
|
|
|
+ message: '请选择一项检测信息',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.wtform.wtSampleType=this.wtform.sampleType
|
|
|
+ this.wtform.wtLot=this.wtform.lot
|
|
|
+ upDateWtInformation(this.wtform).then(data=>{
|
|
|
+ this.viewWtFormDetailsShow=false;
|
|
|
+ this.getListInformation()
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.$refs.multipleTable.clearSelection()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ //委托单修改逻辑
|
|
|
+ wtUpdate(row){
|
|
|
+ getInformationOne(row.id).then(dataRs=>{
|
|
|
+ if(dataRs.code=200){
|
|
|
+ console.log("先查询委托单信息",dataRs)
|
|
|
+ this.dqwtdId=row.id
|
|
|
+ this.wtform = _.cloneDeep(dataRs.data);
|
|
|
+ let detectionInformation={};
|
|
|
+ if(this.wtform.shopProcess==4){
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "alloy":this.wtform.alloy,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ // "customerOne":this.wtform.khOne
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+ };
|
|
|
+ }else {
|
|
|
+ detectionInformation = {
|
|
|
+ "process": this.wtform.shopProcess,
|
|
|
+ "thickness":this.wtform.thickness,
|
|
|
+ // "customerOne":this.wtform.khOne,
|
|
|
+ "customerNumber":this.wtform.customerNumber,
|
|
|
+ "customerMasterTag":this.wtform.customerMasterTag,
|
|
|
+ "customerViceTag":this.wtform.customerViceTag
|
|
|
+ };
|
|
|
+ delete this.jcQueryParams.alloy;
|
|
|
+ }
|
|
|
+ console.log(this.wtform)
|
|
|
+ this.jcQueryParams={...this.jcQueryParams,...detectionInformation}
|
|
|
+ getDetectionInformationListOrderBy(this.jcQueryParams).then(data=>{
|
|
|
+ this.jctableData=data.rows;
|
|
|
+ this.jcTotal = data.total;
|
|
|
+ //回显的值绑锭(这个是需要回显的数据id)
|
|
|
+ this.jcids=dataRs.data.jcids;
|
|
|
+ this.jcxString=dataRs.data.jcids;//数据绑定回显
|
|
|
+ this.wtform.jcxString=dataRs.data.jcids.join(",");
|
|
|
+ this.dynamicHeading="修改委托单信息"
|
|
|
+ this.viewWtFormDetailsShow=true;
|
|
|
+ this.activeName="third"
|
|
|
+ this.activeName="first"
|
|
|
+ // this.activeName="first";
|
|
|
+ //数据加载成功在进行回显操作
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.$refs.multipleTable.clearSelection()
|
|
|
+ this.jcids.map(id => {
|
|
|
+ this.jctableData.map(item => {
|
|
|
+ if (item.id==id) {
|
|
|
+ console.log("相等撸")
|
|
|
+ this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ //如果是修改委托单、那么回显的就是当前委托单已经选择的检测信息
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //委托单删除逻辑
|
|
|
+ delDateWtInformation(id){
|
|
|
+ this.$confirm('是否删除改委托单数据?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ delDateWtInformation(id).then(data=>{
|
|
|
+ if(data.code=="200"){
|
|
|
+ this.$message({
|
|
|
+ message: '删除成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.getListInformation()
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ //查询委托单信息
|
|
|
+ getListInformation(){
|
|
|
+ /** 查询委托单信息列表 */
|
|
|
+ this.loading = true;
|
|
|
+ if(this.wTQueryParams.createTimeHe!=null){
|
|
|
+ const [startDate, endDate] = this.wTQueryParams.createTimeHe;
|
|
|
+ this.wTQueryParams.startTime = startDate;
|
|
|
+ this.wTQueryParams.endTime = endDate;
|
|
|
+ }
|
|
|
+ listInformation(this.wTQueryParams).then(response => {
|
|
|
+ this.informationList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //输入批号时间
|
|
|
+ lotChange(){
|
|
|
+ if(this.wtform.lot){
|
|
|
+ if(this.dynamicHeading=="新增委托单信息"){
|
|
|
+ getMateriel(this.wtform.lot).then(data=>{
|
|
|
+ this.$nextTick(() => {
|
|
|
+ // DOM 更新完成后的操作
|
|
|
+ if(data.msg=="未有此批号的物料信息"){
|
|
|
+ this.$modal.msgWarning("未有此物料信息");
|
|
|
+ this.phisFlag=false;
|
|
|
+ return;
|
|
|
+ }else {
|
|
|
+ //改工序(0719开会决定去掉)
|
|
|
+ // this.wtform.shopProcess=data.data.process;
|
|
|
+ this.wtform.sampleName=data.data.sampleName;
|
|
|
+ this.$set(this.wtform, 'khOne',data.data.customerName)
|
|
|
+ this.$set(this.wtform, 'weight',data.data.weight)
|
|
|
+ this.$set(this.wtform, 'materialNumber',data.data.materialCode)
|
|
|
+ this.$set(this.wtform, 'alloy',data.data.alloy)
|
|
|
+ this.$set(this.wtform, 'thickness',data.data.thickness)
|
|
|
+ this.$set(this.wtform, 'specification',data.data.specification)
|
|
|
+ this.$set(this.wtform, 'khOne',data.data.customerName)
|
|
|
+ this.$set(this.wtform, 'customerNumber',data.data.customerNumber)
|
|
|
+ this.$set(this.wtform, 'customerMasterTag',data.data.customerMasterTag)
|
|
|
+ this.$set(this.wtform, 'customerViceTag',data.data.customerViceTag)
|
|
|
+ this.jctableData = [];
|
|
|
+ //查询所有的检测信息
|
|
|
+ this.jcQueryParams.pageSize = 2;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ getMateriel(this.wtform.lot).then(data => {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ // DOM 更新完成后的操作
|
|
|
+ if (data.msg == "未有此批号的物料信息") {
|
|
|
+ this.wtform.shopProcess="未有此批号的物料信息"
|
|
|
+ }else {
|
|
|
+ // this.wtform.shopProcess=data.data.process;
|
|
|
+ // this.wtform.sampleName=data.data.sampleName;
|
|
|
+ // this.wtform.khOne=data.data.customerName;
|
|
|
+ // this.wtform.weight=data.data.weight;
|
|
|
+ // this.wtform.materialNumber=data.data.materialCode;
|
|
|
+ // this.wtform.alloy=data.data.alloy;
|
|
|
+ // this.wtform.thickness=data.data.thickness;
|
|
|
+ // this.wtform.specification=data.data.specification;
|
|
|
+
|
|
|
+ this.$set(this.wtform, 'sampleName',data.data.sampleName)
|
|
|
+ this.$set(this.wtform, 'khOne',data.data.customerName)
|
|
|
+ this.$set(this.wtform, 'weight',data.data.weight)
|
|
|
+ this.$set(this.wtform, 'materialNumber',data.data.materialCode)
|
|
|
+ this.$set(this.wtform, 'alloy',data.data.alloy)
|
|
|
+ this.$set(this.wtform, 'thickness',data.data.thickness)
|
|
|
+ this.$set(this.wtform, 'specification',data.data.specification)
|
|
|
+ this.$set(this.wtform, 'khOne',data.data.customerName)
|
|
|
+ this.$set(this.wtform, 'customerNumber',data.data.customerNumber)
|
|
|
+ this.$set(this.wtform, 'customerMasterTag',data.data.customerMasterTag)
|
|
|
+ this.$set(this.wtform, 'customerViceTag',data.data.customerViceTag)
|
|
|
+ this.jctableData=[];
|
|
|
+ //查询所有的检测信息
|
|
|
+ this.jcQueryParams.pageSize=2;
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //下拉菜单点击事件
|
|
|
+ handleCommand(command, row) {
|
|
|
+ // console.log('Command:', command);
|
|
|
+ // console.log('Row data:', row);
|
|
|
+ switch (command) {
|
|
|
+ case "update":
|
|
|
+ //先根据id回显
|
|
|
+ this.wtUpdate(row);
|
|
|
+ //根绝id修改
|
|
|
+ break;
|
|
|
+ case "print":
|
|
|
+ this.toTagPrint(row);
|
|
|
+ break;
|
|
|
+ case "print100/100":
|
|
|
+ this.toTagPrint2(row)
|
|
|
+ break;
|
|
|
+ case "del":
|
|
|
+ this.delDateWtInformation(row.id);
|
|
|
+ break;
|
|
|
+ case "tj":
|
|
|
+ this.updateDateWtInformation(row);
|
|
|
+ break;
|
|
|
+ case "thxq":
|
|
|
+ this.returnReasonInquiry(row)
|
|
|
+ break;
|
|
|
+ case "wtdxq":
|
|
|
+ this.wtdxq(row);
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //查看退回原因
|
|
|
+ returnReasonInquiry(row){
|
|
|
+ getOrderInformation(row.id).then(data=>{
|
|
|
+ if(data.code=="200"){
|
|
|
+ this.returnFrom = _.cloneDeep(data.data);
|
|
|
+ this.sampleReturnShow=true;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //得到用户信息
|
|
|
+ getUserInfo(){
|
|
|
+ //通过用户id查询当前用户的部门信息
|
|
|
+ userInfoAndSection(this.$store.state.user.userId).then(data => {
|
|
|
+ this.wtform.submittingDepartment=data.deptInfo.deptName;
|
|
|
+ if (data.deptInfo.deptName==undefined){
|
|
|
+ this.wtform.submittingDepartment="当前用户未设置部门";
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //回车查询
|
|
|
+ wThandleQuery(){
|
|
|
+ if(this.wTQueryParams.createTimeHe!=null){
|
|
|
+ const [startDate, endDate] = this.wTQueryParams.createTimeHe;
|
|
|
+ this.wTQueryParams.startTime = startDate;
|
|
|
+ this.wTQueryParams.endTime = endDate;
|
|
|
+ }
|
|
|
+ listInformation(this.wTQueryParams).then(response => {
|
|
|
+ this.informationList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //搜索
|
|
|
+ wtHandleQuery(){
|
|
|
+ if(this.wTQueryParams.createTimeHe!=null){
|
|
|
+ const [startDate, endDate] = this.wTQueryParams.createTimeHe;
|
|
|
+ this.wTQueryParams.startTime = startDate;
|
|
|
+ this.wTQueryParams.endTime = endDate;
|
|
|
+ }
|
|
|
+ console.log(this.wTQueryParams,"dddddddd----hmc")
|
|
|
+ listInformation(this.wTQueryParams).then(response => {
|
|
|
+ this.informationList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //重置
|
|
|
+ wtResetQuery(){//重置
|
|
|
+ console.log(this.wTQueryParams,"dddddddd----hmc")
|
|
|
+ this.wTQueryParams={};
|
|
|
+ this.wTQueryParams.pageNum=1;
|
|
|
+ this.wTQueryParams.pageSize=5;
|
|
|
+ listInformation(this.wTQueryParams).then(response => {
|
|
|
+ this.informationList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //行的唯一key
|
|
|
+ getRowKey(row) {
|
|
|
+ return row.id
|
|
|
+ },
|
|
|
+ //检测信息多选方法
|
|
|
+ handleSelectionChange2(selection){
|
|
|
+ this.wtform.jcxString = selection.map(item => item.id).join(",");// 需要根据数据情况调整id名称
|
|
|
+ this.jcxString=this.wtform.jcxString;
|
|
|
+ this.single = selection.length != 1;
|
|
|
+ this.multiple = !selection.length;
|
|
|
+ },
|
|
|
+ //点击切换tab
|
|
|
+ activeNameHandleClick(tab, event) {
|
|
|
+ // console.log("ddddddd")
|
|
|
+ // console.log(tab.label, event);
|
|
|
+ // if(tab.label!="委托单信息") {
|
|
|
+ // if(this.wtform.shopProcess==undefined||this.wtform.shopProcess==""||this.wtform.shopProcess==null){
|
|
|
+ // this.$modal.msgWarning("请先选择工序");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if(tab.label=="检测信息"){
|
|
|
+ // getInformationOne(this.dqwtdId).then(dataRs=>{
|
|
|
+ // if(dataRs.code=200){
|
|
|
+ // console.log("先查询委托单信息",dataRs)
|
|
|
+ // this.dqwtdId=this.dqwtdId
|
|
|
+ // this.wtform = _.cloneDeep(dataRs.data);
|
|
|
+ // //查询所有的检测信息
|
|
|
+ // let detectionInformation = {"process": this.wtform.shopProcess,"alloy":this.wtform.alloy,"thickness":this.wtform.thickness, "customerOne":this.wtform.khOne};
|
|
|
+ // this.jcQueryParams={...this.jcQueryParams,...detectionInformation}
|
|
|
+ // getDetectionInformationListOrderBy(this.jcQueryParams).then(data=>{
|
|
|
+ // this.jctableData=data.rows;
|
|
|
+ // this.jcTotal = data.total;
|
|
|
+ // //回显的值绑锭(这个是需要回显的数据id)
|
|
|
+ // this.jcids=dataRs.data.jcids;
|
|
|
+ // this.jcxString=dataRs.data.jcids;//数据绑定回显
|
|
|
+ // this.wtform.jcxString=dataRs.data.jcids.join(",");
|
|
|
+ // this.dynamicHeading="修改委托单信息"
|
|
|
+ // this.viewWtFormDetailsShow=true;
|
|
|
+ // this.activeName="third"
|
|
|
+ // // this.activeName="first"
|
|
|
+ // this.$refs.multipleTable.clearSelection()
|
|
|
+ // this.jcids.map(id => {
|
|
|
+ // this.jctableData.map(item => {
|
|
|
+ // if (item.id==id) {
|
|
|
+ // console.log("相等撸")
|
|
|
+ // this.$refs.multipleTable.toggleRowSelection(item, true)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ //
|
|
|
+ // // this.activeName="first";
|
|
|
+ // //数据加载成功在进行回显操作
|
|
|
+
|
|
|
+ // //如果是修改委托单、那么回显的就是当前委托单已经选择的检测信息
|
|
|
+ // })
|
|
|
+ //
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ },
|
|
|
+ //委托单新增按钮
|
|
|
+ handleAdd() {
|
|
|
+ this.dynamicHeading="新增委托单信息"
|
|
|
+ this.wtform={}
|
|
|
+ this.activeName="third";
|
|
|
+ this.jcids=[];
|
|
|
+ this.jcxString=[];
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ if(this.$refs.multipleTable!=undefined){
|
|
|
+ this.$refs.multipleTable.clearSelection()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.activeName="first";
|
|
|
+ this.jctableData=[];
|
|
|
+ this.jcTotal=0;
|
|
|
+ this.wtform.detectionSite="杭州五星",
|
|
|
+ this.wtform.laboratory="五星1号实验室",
|
|
|
+ // 初始化数据
|
|
|
+ this.wtform.sampleSource = "1";
|
|
|
+ this.wtform.emergencyDegree = "1";
|
|
|
+
|
|
|
+ //通过用户id查询当前用户的部门信息
|
|
|
+ userInfoAndSection(this.$store.state.user.userId).then(data => {
|
|
|
+ this.wtform.submittingDepartment=data.deptInfo.deptName;
|
|
|
+ if (data.deptInfo.deptName==undefined){
|
|
|
+ this.wtform.submittingDepartment="当前用户未设置部门";
|
|
|
+ }
|
|
|
+ this.viewWtFormDetailsShow=true;
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ //提交委托单信息
|
|
|
+ updateDateWtInformation(row){
|
|
|
+ console.log(row)
|
|
|
+ row.orderStatus="2";
|
|
|
+ updateDateWtInformation( {"id":row.id,"orderStatus":row.orderStatus}).then(data=>{
|
|
|
+ if(data.code){
|
|
|
+ this.getListInformation()
|
|
|
+ this.$message({
|
|
|
+ message: '提交成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //打印备注错号关闭
|
|
|
+ isPrintNoteHandleClose(){
|
|
|
+ this.isPrintNoteShow=false;
|
|
|
+ },
|
|
|
+
|
|
|
+ //标签打印逻辑
|
|
|
+ toTagPrint(row){
|
|
|
+ this.printOption="90/60"
|
|
|
+ //先查询打印是否2次及以上的
|
|
|
+ let wtInfo={"lot":row.lot,"wtId":row.id}
|
|
|
+ // 获取当前时间
|
|
|
+ const now = dayjs();
|
|
|
+ // 格式化为 yyyy-MM-dd HH:mm:ss
|
|
|
+ let formatted = now.format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ //打印日志信息添加
|
|
|
+ let addMessage={"wtId":row.id,
|
|
|
+ //批号
|
|
|
+ "lot":row.lot,
|
|
|
+ //部门
|
|
|
+ "submittingDepartment":row.submittingDepartment,
|
|
|
+ //打印时间
|
|
|
+ "printTime":formatted,
|
|
|
+ }
|
|
|
+ selectSamplePrintingInfo(wtInfo).then(data=>{
|
|
|
+ if(data.code=="200"){
|
|
|
+ if(data.data.length){
|
|
|
+ if(data.data.length>=1){
|
|
|
+ this.isPrintNoteShow=true;
|
|
|
+ console.log(row,"行信息")
|
|
|
+ this.isPrintNoteShow=true;
|
|
|
+ //存当前委托订单的信息
|
|
|
+ this.addMessage=addMessage;
|
|
|
+ //存当前委托单id
|
|
|
+ this.isDyWtDId=row.id;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ // console.log(row,"行信息")
|
|
|
+ //插入打印日志信息
|
|
|
+ addSamplePrintingInfo(addMessage).then(data=>{
|
|
|
+ if(data.code=="200"){
|
|
|
+ this.getInformationOne(row.id,addMessage.printTime);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //标签打印逻辑
|
|
|
+ toTagPrint2(row){
|
|
|
+ this.printOption="100/100"
|
|
|
+ //先查询打印是否2次及以上的
|
|
|
+ let wtInfo={"lot":row.lot,"wtId":row.id}
|
|
|
+ // 获取当前时间
|
|
|
+ const now = dayjs();
|
|
|
+ // 格式化为 yyyy-MM-dd HH:mm:ss
|
|
|
+ let formatted = now.format('YYYY-MM-DD HH:mm:ss');
|
|
|
+ //打印日志信息添加
|
|
|
+ let addMessage={"wtId":row.id,
|
|
|
+ //批号
|
|
|
+ "lot":row.lot,
|
|
|
+ //部门
|
|
|
+ "submittingDepartment":row.submittingDepartment,
|
|
|
+ //打印时间
|
|
|
+ "printTime":formatted,
|
|
|
+ }
|
|
|
+ selectSamplePrintingInfo(wtInfo).then(data=>{
|
|
|
+ if(data.code=="200"){
|
|
|
+ if(data.data.length){
|
|
|
+ if(data.data.length>=1){
|
|
|
+ this.isPrintNoteShow=true;
|
|
|
+ console.log(row,"行信息")
|
|
|
+ this.isPrintNoteShow=true;
|
|
|
+ //存当前委托订单的信息
|
|
|
+ this.addMessage=addMessage;
|
|
|
+ //存当前委托单id
|
|
|
+ this.isDyWtDId=row.id;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ // console.log(row,"行信息")
|
|
|
+ //插入打印日志信息
|
|
|
+ addSamplePrintingInfo(addMessage).then(data=>{
|
|
|
+ if(data.code=="200"){
|
|
|
+ this.getInformationOne(row.id,addMessage.printTime);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //打印信息查询
|
|
|
+ getInformationOne(id,nowTime){
|
|
|
+ var nTime=nowTime;
|
|
|
+ //先查询
|
|
|
+ getInformationOne(id).then(data=>{
|
|
|
+ if(data.code=200){
|
|
|
+ //存储打印日志信息
|
|
|
+ console.log(data,"码里存放的信息");
|
|
|
+ //打印逻辑,
|
|
|
+ let msgArr=[];
|
|
|
+ //委托单号
|
|
|
+ if(data.data.orderNumber){
|
|
|
+ msgArr.push({"label":"委托单号","value":data.data.orderNumber})
|
|
|
+ }
|
|
|
+ //判断工序类型
|
|
|
+ if(data.data.shopProcess=="4"){ //目标厚度+合金
|
|
|
+ msgArr.push({"label":"物料说明","value":data.data.thickness+"|"+data.data.alloy})
|
|
|
+ }else { ////目标厚度+规格
|
|
|
+ msgArr.push({"label":"物料说明","value":data.data.thickness+"|"+data.data.specification})
|
|
|
+ }
|
|
|
+ //实际厚度
|
|
|
+ if(data.data.thickness){
|
|
|
+ msgArr.push({"label":"实际厚度","value":data.data.actualThickness})
|
|
|
+ }
|
|
|
+ //申请时间
|
|
|
+ if(data.data.orderApplicationTime){
|
|
|
+ msgArr.push({"label":"申请时间","value":data.data.orderApplicationTime})
|
|
|
+ }
|
|
|
+ //样品名称
|
|
|
+ if(data.data.sampleName){
|
|
|
+ msgArr.push({"label":"样品名称","value":data.data.sampleName})
|
|
|
+ }
|
|
|
+ //批次信息
|
|
|
+ if(data.data.lot!=null&&data.data.lot!=""){
|
|
|
+ msgArr.push({"label":"样品批次","value":data.data.lot})
|
|
|
+ }
|
|
|
+ //工段信息
|
|
|
+ let shopProcessArray=[];
|
|
|
+ if(data.data.shopProcess!=null&&data.data.shopProcess!=""){
|
|
|
+ this.dict.type.shop_process.forEach(degree => {
|
|
|
+ if(degree.value==data.data.shopProcess){
|
|
|
+ msgArr.push({"label":"工段信息","value":degree.label})
|
|
|
+ shopProcessArray.push(degree.label)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //客户信息
|
|
|
+ if(data.data.khOne){
|
|
|
+ msgArr.push({"label":"客户信息","value":data.data.khOne})
|
|
|
+ }
|
|
|
+
|
|
|
+ let arraySampleTypeArray=[];
|
|
|
+ //样品类型
|
|
|
+ if(data.data.sampleType){
|
|
|
+ this.dict.type.sample_type.forEach(degree => {
|
|
|
+ if(degree.value==data.data.sampleType){
|
|
|
+ msgArr.push({"label":"样品类型","value":degree.label})
|
|
|
+ arraySampleTypeArray.push(degree.label);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //pn不为空添加pn信息
|
|
|
+ if(data.data.samplePn!=null&&data.data.samplePn!=""){
|
|
|
+ msgArr.push({"label":"样品PN","value":data.data.samplePn})
|
|
|
+ }
|
|
|
+ //供应商
|
|
|
+ if(data.data.supplier!=null&&data.data.samplePn!=""){
|
|
|
+ msgArr.push({"label":"供应商","value":data.data.supplier})
|
|
|
+ }
|
|
|
+ //紧急度
|
|
|
+ let emergencyDegreeArray=[];
|
|
|
+ // console.log(this.dict.type.emergency_degree)
|
|
|
+ if(data.data.emergencyDegree){
|
|
|
+ this.dict.type.emergency_degree.forEach(degree => {
|
|
|
+ if(degree.value==data.data.emergencyDegree){
|
|
|
+ msgArr.push({"label":"紧急度","value":degree.label})
|
|
|
+ emergencyDegreeArray.push(degree.label)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //实验室
|
|
|
+ if(data.data.laboratory){
|
|
|
+ msgArr.push({"label":"实验室","value":data.data.laboratory})
|
|
|
+ }
|
|
|
+ //申请人
|
|
|
+ if(data.data.createBy){
|
|
|
+ msgArr.push({"label":"申请人","value":data.data.createBy})
|
|
|
+ }
|
|
|
+ //送样人
|
|
|
+ if(data.data.sampleSender){
|
|
|
+ msgArr.push({"label":"送样人","value":data.data.sampleSender})
|
|
|
+ }
|
|
|
+
|
|
|
+ //打印时间
|
|
|
+ if(nTime){
|
|
|
+ msgArr.push({"label":"打印时间","value":nTime})
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // console.log(msgArr,"msgArr")
|
|
|
+ //样品来源
|
|
|
+ // let sampleSourceArray=[];
|
|
|
+ // if(data.data.sampleSource){
|
|
|
+ // this.dict.type.sample_source.forEach(degree => {
|
|
|
+ // if(degree.value==data.data.sampleSource){
|
|
|
+ // msgArr.push({"label":"样品来源","value":degree.label})
|
|
|
+ // sampleSourceArray.push(degree.label);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // let qObjectAppend=[];
|
|
|
+ // //拼接二维码中的内容
|
|
|
+ // msgArr.forEach(item=>{
|
|
|
+ // console.log(item)
|
|
|
+ // qObjectAppend.push(item.value)
|
|
|
+ // })
|
|
|
+ // let joinString=qObjectAppend.join("@")
|
|
|
+ // console.log(joinString)
|
|
|
+
|
|
|
+ //拼接的物料信息 lot
|
|
|
+ let abc=data.data.orderNumber
|
|
|
+ console.log(abc,"hmc")
|
|
|
+ // console.log(a,"条码内容")
|
|
|
+ //进行base64编码
|
|
|
+ //声明一个数组对象
|
|
|
+ let allPringtData = [];
|
|
|
+ //添加内容
|
|
|
+ allPringtData.push({
|
|
|
+ codeData:abc,
|
|
|
+ showMsg:msgArr,
|
|
|
+ });
|
|
|
+
|
|
|
+ if(this.printOption=="90/60"){
|
|
|
+ qrCodeList(allPringtData, "printDom",data.data.lot);
|
|
|
+ }else {
|
|
|
+ qrCodeList3(allPringtData, "printDom",data.data.lot)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //打印日志信息弹窗事件
|
|
|
+ isPrintNoteShowClick(){
|
|
|
+ //超过一次就需要记录打印日志信息
|
|
|
+ this.addMessage.remark=this.isPrintNoteForm.remark;
|
|
|
+ console.log(this.addMessage)
|
|
|
+ //插入打印日志信息
|
|
|
+ addSamplePrintingInfo(this.addMessage).then(data=>{
|
|
|
+ console.log(data.code,"打印日志是否插入成功")
|
|
|
+ if(data.code==200){
|
|
|
+ this.getInformationOne(this.isDyWtDId,this.addMessage.printTime);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.isPrintNoteShow=false;
|
|
|
+ },
|
|
|
+
|
|
|
+ caiGouUpdate(btnInfo, row) {
|
|
|
+ this.insertFromTitle = "修改采购信息";
|
|
|
+ this.insertFrom = true;
|
|
|
+ this.insertFormData = {};
|
|
|
+ this.insertTable = [];
|
|
|
+ this.getListMateriel();
|
|
|
+ this.getListSupplier();
|
|
|
+ console.log(row);
|
|
|
+ // row.purchaseId getInfoEditPurchaseId PurchaseId
|
|
|
+ getPurchaseInfos(row.purchaseSerialNumber).then((res) => {
|
|
|
+ this.insertFormData = res.data;
|
|
|
+ this.insertTable = res.data.purchaseInfos;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ insertTableRequest() {
|
|
|
+ if (this.insertFromTitle == "新增采购信息") {
|
|
|
+ console.log(this.insertFormData.supplierNo);
|
|
|
+ if (
|
|
|
+ this.insertFormData.supplierNo != undefined &&
|
|
|
+ this.insertFormData.lotNumber != undefined &&
|
|
|
+ this.insertFormData.useDepartment != undefined &&
|
|
|
+ this.insertFormData.remark != undefined
|
|
|
+ ) {
|
|
|
+ //携带表格数据
|
|
|
+ this.insertFormData.purchaseInfos = this.insertTable;
|
|
|
+ addPurchase(this.insertFormData).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: "添加成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ this.insertFrom = false;
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: "添加失败",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: "请完善表单",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log(this.insertFormData.supplierNo);
|
|
|
+ if (
|
|
|
+ this.insertFormData.supplierNo != undefined &&
|
|
|
+ this.insertFormData.lotNumber != undefined &&
|
|
|
+ this.insertFormData.useDepartment != undefined &&
|
|
|
+ this.insertFormData.remark != undefined
|
|
|
+ ) {
|
|
|
+ //携带表格数据
|
|
|
+ this.insertFormData.purchaseInfos = this.insertTable;
|
|
|
+ updatePurchase(this.insertFormData).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ message: "修改成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ this.insertFrom = false;
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: "修改失败",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: "请完善表单",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ //原材料信息
|
|
|
+ getListMateriel() {
|
|
|
+ getListMateriel({
|
|
|
+ isEnablePaging: false,
|
|
|
+ materielSpecies: 1,
|
|
|
+ }).then((res) => {
|
|
|
+ this.materiels = res.data;
|
|
|
+ this.materiels.forEach(item=>{
|
|
|
+ item.materielName=item.materieEncoding+item.materieColorNumber+item.specificationModel;
|
|
|
+ })
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //供应商信息
|
|
|
+ getListSupplier() {
|
|
|
+ getListSupplier({isEnablePaging:false}).then((res) => {
|
|
|
+ this.suppliers = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //删除一行
|
|
|
+ handleRowDelete($index, rwo) {
|
|
|
+ this.insertTable.splice($index, 1);
|
|
|
+ },
|
|
|
+ //添加一行
|
|
|
+ addRow() {
|
|
|
+ // 添加一行数据 id materielId quantity remark
|
|
|
+ const newRow = {
|
|
|
+ id: this.insertTable.length + 1,
|
|
|
+ materielId: undefined,
|
|
|
+ quantity: undefined,
|
|
|
+ remark: undefined,
|
|
|
+ disableInput: false,
|
|
|
+ };
|
|
|
+ this.insertTable.push(newRow);
|
|
|
+ },
|
|
|
+ //关闭逻辑
|
|
|
+ insertFromClose() {
|
|
|
+ this.insertFrom = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ viewPurchaseOrderDetails(btnData, row) {
|
|
|
+ console.log(this.currentRow, btnData, row);
|
|
|
+ this.particularsOfSalesNote.purchaseOrderNumber = row.purchaseId;
|
|
|
+ this.particularsOfSalesNote.supplierName = row.supplierSupplierName;
|
|
|
+ this.particularsOfSalesNote.purchaseLotNumber = row.purchaseLotNumber;
|
|
|
+ this.particularsOfSalesNote.procurementTime = row.purchaseProcurementTime;
|
|
|
+ this.viewPurchaseOrderDetailsShow = true;
|
|
|
+ // console.log(row,"行数据");
|
|
|
+ getPurchaseInfo({ purchaseId: row.purchaseSerialNumber }).then((resp) => {
|
|
|
+ this.purchaseInfo = resp.data;
|
|
|
+ console.log(this.purchaseInfo);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // test
|
|
|
+ showValue() {
|
|
|
+ // console.log(this.$refs.formGroupRef);
|
|
|
+ this.$refs.formGroupRef.setDefaultValue();
|
|
|
+ },
|
|
|
+ // 计算操作列的显示与隐藏
|
|
|
+ calcuteExcuteCol() {
|
|
|
+ if (!this.excuteBtnArr || !this.excuteBtnArr.length) {
|
|
|
+ this.isShowExcuteCol = false;
|
|
|
+ } else {
|
|
|
+ this.isShowExcuteCol = !this.excuteBtnArr?.every(
|
|
|
+ (arr) => arr.children.length == 0
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取row-key
|
|
|
+ /** 查询列表 */
|
|
|
+ getList(queryParams) {
|
|
|
+ this.loading = true;
|
|
|
+ // 序列化当前查询参数列表
|
|
|
+ queryParams && (this.queryParams.queryMap = queryParams.queryMap);
|
|
|
+ // 获取当前表单结构信息
|
|
|
+ dragTableInfo({ queryMap: { tableKey: this.tableKey } })
|
|
|
+ .then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ // 得到当前模版信息 --- sql columns queryWhere
|
|
|
+ this.templateInfo = res.data.resultMap;
|
|
|
+ this.styleList = res.data.resultMap.style?.map((item) => {
|
|
|
+ item.styleField = camelCase(
|
|
|
+ item.styleField.replace(".", "_") || ""
|
|
|
+ );
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ // 获取操作列的按钮数据
|
|
|
+ this.excuteBtnArr = res.data.resultMap.button?.filter(
|
|
|
+ (item) => item.btnGroupType == "right"
|
|
|
+ );
|
|
|
+ this.excuteBtnArr[0].children.push({
|
|
|
+ btnName: "采购单详情",
|
|
|
+ btnType: "viewPurchaseOrderDetails",
|
|
|
+ btnIcon: "el-icon-edit",
|
|
|
+ btnShowCondition: "",
|
|
|
+ children: [],
|
|
|
+ });
|
|
|
+ this.excuteBtnArr[0].children.push({
|
|
|
+ btnName: "采购修改",
|
|
|
+ btnType: "caiGouUpdate",
|
|
|
+ btnIcon: "el-icon-edit",
|
|
|
+ btnShowCondition:
|
|
|
+ '[{"fieldName":"purchase.data_approval_status","mark":"6","refValue":"0"}]',
|
|
|
+ children: [],
|
|
|
+ });
|
|
|
+ console.log(this.excuteBtnArr[0].children,"dddddddddddddddddd")
|
|
|
+ this.topBtnArr = res.data.resultMap.button?.filter(
|
|
|
+ (item) => item.btnGroupType == "top"
|
|
|
+ );
|
|
|
+ console.log(this.topBtnArr, "dddddddddd");
|
|
|
+ this.calcuteExcuteCol();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.tableRef.doLayout();
|
|
|
+ });
|
|
|
+ this.queryParams.orderByColumn =
|
|
|
+ res.data.resultMap.querySql.orderByColumn;
|
|
|
+ this.sortOrder = JSON.parse(res.data.resultMap.querySql.sortOrder);
|
|
|
+ // 根据拖拽时设置当前列表排列顺序
|
|
|
+ this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC";
|
|
|
+ this.tableName = this.templateInfo.template.dtTableName;
|
|
|
+ // 得到查询条件
|
|
|
+ this.queryFromWhere = res.data.resultMap.where;
|
|
|
+ // 得到当前列表信息
|
|
|
+ this.columns = this.columnsHandler(
|
|
|
+ JSON.parse(this.templateInfo.template.dtColumnName)
|
|
|
+ );
|
|
|
+ })
|
|
|
+ .finally((fes) => {
|
|
|
+ if (this.templateInfo == {}) return;
|
|
|
+ // 调用查询需要携带当前table的唯一标识
|
|
|
+ this.queryParams.queryMap.sqlkey = this.templateInfo.template.sqlKey;
|
|
|
+ this.queryParams.orderByColumn = camelCase(
|
|
|
+ this.queryParams.orderByColumn || ""
|
|
|
+ );
|
|
|
+ // 根据sql语句查询当前表数据
|
|
|
+ unionListTableData(this.queryParams).then(async (res) => {
|
|
|
+ this.tableList = [];
|
|
|
+ res.rows.forEach((item) => {
|
|
|
+ this.tableList.push(item.resultMap);
|
|
|
+ });
|
|
|
+ // 驼峰转换
|
|
|
+ let tempTableList = [];
|
|
|
+ tempTableList = this.tableList.map((item) => {
|
|
|
+ let kv = {};
|
|
|
+ for (let itemKey in item) {
|
|
|
+ kv[camelCase(itemKey)] = item[itemKey];
|
|
|
+ }
|
|
|
+ return kv;
|
|
|
+ });
|
|
|
+ this.tableList = await this.setFieldStyleData(tempTableList);
|
|
|
+ this.total = res.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ isUpperCase(char) {
|
|
|
+ return char === char.toUpperCase();
|
|
|
+ },
|
|
|
+ // 下划线命名转驼峰命名
|
|
|
+ toUnderScoreCase(str) {
|
|
|
+ if (str === null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ let sb = "";
|
|
|
+ // 前置字符是否大写
|
|
|
+ let preCharIsUpperCase = true;
|
|
|
+ // 当前字符是否大写
|
|
|
+ let curreCharIsUpperCase = true;
|
|
|
+ // 下一字符是否大写
|
|
|
+ let nexteCharIsUpperCase = true;
|
|
|
+ for (let i = 0; i < str.length; i++) {
|
|
|
+ let c = str.charAt(i);
|
|
|
+ if (i > 0) {
|
|
|
+ preCharIsUpperCase = isUpperCase(str.charAt(i - 1));
|
|
|
+ } else {
|
|
|
+ preCharIsUpperCase = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ curreCharIsUpperCase = isUpperCase(c);
|
|
|
+
|
|
|
+ if (i < str.length - 1) {
|
|
|
+ nexteCharIsUpperCase = isUpperCase(str.charAt(i + 1));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (
|
|
|
+ preCharIsUpperCase &&
|
|
|
+ curreCharIsUpperCase &&
|
|
|
+ !nexteCharIsUpperCase
|
|
|
+ ) {
|
|
|
+ sb += SEPARATOR;
|
|
|
+ } else if (i !== 0 && !preCharIsUpperCase && curreCharIsUpperCase) {
|
|
|
+ sb += SEPARATOR;
|
|
|
+ }
|
|
|
+ sb += c.toLowerCase();
|
|
|
+ }
|
|
|
+
|
|
|
+ return sb;
|
|
|
+ },
|
|
|
+ // 处理列表信息
|
|
|
+ columnsHandler(columns) {
|
|
|
+ let resArr = [];
|
|
|
+ columns.forEach((item) => {
|
|
|
+ for (const key in item) {
|
|
|
+ let tempObj = {};
|
|
|
+ tempObj.key = camelCase(key);
|
|
|
+ tempObj.value = item[key];
|
|
|
+ resArr.push(tempObj);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return resArr;
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ // this.reset();
|
|
|
+ },
|
|
|
+ // 分页查询
|
|
|
+ pageList(row) {
|
|
|
+ // 调用子组件-》携带子组件参数请求后台
|
|
|
+ this.$refs.mychild.pageList(
|
|
|
+ row == undefined
|
|
|
+ ? {
|
|
|
+ limit: this.queryParams.pageSize,
|
|
|
+ page: this.queryParams.pageNum,
|
|
|
+ }
|
|
|
+ : row
|
|
|
+ );
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(
|
|
|
+ (item) =>
|
|
|
+ item[
|
|
|
+ camelCase(
|
|
|
+ this.tableName + "_" + this.templateInfo.template?.primaryKey
|
|
|
+ )
|
|
|
+ ]
|
|
|
+ );
|
|
|
+ this.selection = selection;
|
|
|
+ this.single = selection.length != 1;
|
|
|
+ this.multiple = !selection.length;
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ longestCommonSubstring(strs) {
|
|
|
+ if (!strs || strs.includes("")) return "";
|
|
|
+ let str1_Length = strs[0].length;
|
|
|
+ let str_Nums = strs.length;
|
|
|
+ let flag = 0;
|
|
|
+ for (let i = 0; i < str1_Length && flag == 0; i++) {
|
|
|
+ let char = strs[0][i];
|
|
|
+ for (var j = 1; j < str_Nums; j++) {
|
|
|
+ if (char !== strs[j][i] || i == strs[j].length) {
|
|
|
+ return strs[1].substring(0, i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return strs[0];
|
|
|
+ },
|
|
|
+ // 绑定dialog对话框关闭
|
|
|
+ handleClose() {
|
|
|
+ this.btnDialogVisible = false;
|
|
|
+ },
|
|
|
+ getLastUppercaseWord(text) {
|
|
|
+ const pattern = /\b[A-Z][a-z]*\b/g;
|
|
|
+ const matches = [...text.matchAll(pattern)];
|
|
|
+ if (matches.length > 0) {
|
|
|
+ const lastMatch = matches[matches.length - 1][0];
|
|
|
+ return lastMatch;
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 延迟
|
|
|
+ sleep(ms) {
|
|
|
+ var unixtime_ms = new Date().getTime();
|
|
|
+ while (new Date().getTime() < unixtime_ms + ms) {}
|
|
|
+ return "";
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ async handleUpdate(row, btnData) {
|
|
|
+ let nameTable = this.templateInfo.template.dtTableName;
|
|
|
+ this.rowobj = {};
|
|
|
+ let obj = {};
|
|
|
+ this.formList = [];
|
|
|
+ for (let key in row) {
|
|
|
+ let modifiedTable = key
|
|
|
+ .replace(/[A-Z]/g, (match) => `_${match}`)
|
|
|
+ .toLowerCase();
|
|
|
+
|
|
|
+ this.rowobj[modifiedTable] = row[key];
|
|
|
+
|
|
|
+ let str = modifiedTable.substring(nameTable.length + 1);
|
|
|
+ obj[str] = row[key];
|
|
|
+ }
|
|
|
+ // getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
|
|
|
+ // if (!data || !data.dfVueTemplate) {
|
|
|
+ // this.$message.error("当前表格未绑定表单!");
|
|
|
+ // return;
|
|
|
+ // }});
|
|
|
+
|
|
|
+ // 新的修改请求
|
|
|
+ try {
|
|
|
+ // console.log("btnData", btnData);
|
|
|
+ let { btnFormType } = btnData;
|
|
|
+ this.formType = btnFormType;
|
|
|
+ let payLoad = {};
|
|
|
+ let primary = camelCase(
|
|
|
+ this.tableName + "_" + this.templateInfo.template?.primaryKey
|
|
|
+ );
|
|
|
+ // if (btnFormType == "dragFormGroup") {
|
|
|
+ // payLoad.updateCommonEntityList = {
|
|
|
+ // basicMap: {
|
|
|
+ // btnType: this.currentBtnData.btnType,
|
|
|
+ // btnKey: this.currentBtnData.btnKey,
|
|
|
+ // visible: "false",
|
|
|
+ // sqlKey: this.templateInfo.template.sqlKey,
|
|
|
+ // tableName: this.tableName,
|
|
|
+ // },
|
|
|
+ // conditionMap: {},
|
|
|
+ // };
|
|
|
+ // payLoad.updateCommonEntityList.conditionMap[
|
|
|
+ // this.templateInfo.template?.primaryKey
|
|
|
+ // ] = row[primary];
|
|
|
+ // } else {
|
|
|
+ payLoad = {
|
|
|
+ basicMap: {
|
|
|
+ btnType: this.currentBtnData.btnType,
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
|
+ visible: "false",
|
|
|
+ sqlKey: this.templateInfo.template.sqlKey,
|
|
|
+ tableName: this.tableName,
|
|
|
+ },
|
|
|
+ conditionMap: {},
|
|
|
+ };
|
|
|
+ payLoad.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
+ row[primary];
|
|
|
+ // }
|
|
|
+
|
|
|
+ let res = await btnCommonApi(payLoad);
|
|
|
+ // 判断是否绑定dialog弹窗
|
|
|
+ if (!this.currentBtnData.btnTableFormGroupKey) {
|
|
|
+ if ((!res.data || !res.data.template) && !res.data?.mainForm) {
|
|
|
+ this.$message.error("当前按钮未绑定表单!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (btnFormType == "dragFormGroup") {
|
|
|
+ //表单组
|
|
|
+ if (res.code == 200) {
|
|
|
+ if (res.data.mainForm) {
|
|
|
+ //表单组
|
|
|
+ // console.log(res.data);
|
|
|
+ this.transformDataFormat(res.data);
|
|
|
+ this.tableName = res.data.mainForm.showTemplate.dfTableName;
|
|
|
+ } else {
|
|
|
+ this.formList = res.data;
|
|
|
+ this.tableName = res.data.dfTableName;
|
|
|
+ }
|
|
|
+ // console.log(this.formList);
|
|
|
+ this.open = true;
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // // this.sleep(1000);
|
|
|
+ // this.$refs.formGroupRef.setDefaultValue();
|
|
|
+ // });
|
|
|
+ } else {
|
|
|
+ console.error(res);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //单个表单
|
|
|
+ res.data.template.dfFormSql &&
|
|
|
+ (this.dynamicData = JSON.parse(res.data.template.dfFormSql));
|
|
|
+ this.addRealFieldName(res.data.result.resultMap);
|
|
|
+ let resultMap = res.data.result.resultMap;
|
|
|
+
|
|
|
+ Object.assign(this.defaultValue, resultMap);
|
|
|
+ this.jsonData = JSON.parse(res.data.template.dfVueTemplate);
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改信息";
|
|
|
+ this.form.password = this.initPassword;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.addFromRef.setData(res.data.result.resultMap);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.subTableName = res.data.result.dragTables[1].dtTableName;
|
|
|
+ this.btnDialogVisible = true;
|
|
|
+ this.groupKey = this.currentBtnData.btnTableFormGroupKey;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ let refChild = this.$refs.dialogRef;
|
|
|
+ refChild.getLists(this.groupKey);
|
|
|
+ });
|
|
|
+
|
|
|
+ let tablesubKey = res.data.result.dragTables[1].tableKey;
|
|
|
+
|
|
|
+ // 查询统计信息
|
|
|
+ // getStatisticList({
|
|
|
+ // queryMap: {
|
|
|
+ // tableKey: tablesubKey,
|
|
|
+ // },
|
|
|
+ // }).then((res) => {
|
|
|
+ // this.subCount = res.data;
|
|
|
+ // });
|
|
|
+
|
|
|
+ let prmKey = this.templateInfo.template.primaryKey;
|
|
|
+ let pkey = prmKey.replace(/_([a-z])/g, (match, p1) =>
|
|
|
+ p1.toUpperCase()
|
|
|
+ );
|
|
|
+
|
|
|
+ let data = {
|
|
|
+ queryMap: {
|
|
|
+ tableKey: res.data.result.dragTables[2].tableKey,
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
+ let key =
|
|
|
+ "#{" +
|
|
|
+ this.templateInfo.template.dtTableName +
|
|
|
+ "." +
|
|
|
+ this.templateInfo.template.primaryKey;
|
|
|
+
|
|
|
+ data.queryMap[key] =
|
|
|
+ "'" + obj[this.templateInfo.template.primaryKey] + "'";
|
|
|
+
|
|
|
+ // getStatisticList(data).then((res) => {
|
|
|
+ // this.tableCount = res.data;
|
|
|
+ // });
|
|
|
+ }
|
|
|
+
|
|
|
+ // let fieldList = Object.keys(resultMap);
|
|
|
+ // let tableName = this.longestCommonSubstring(fieldList);
|
|
|
+ // fieldList.forEach((field) => {
|
|
|
+ // let realField = field.replace(tableName, "");
|
|
|
+ // realField = realField[0].toLocaleLowerCase() + realField.substring(1);
|
|
|
+ // resultMap[realField] = resultMap[field];
|
|
|
+ // });
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ // getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
|
|
|
+ // if (!data || !data.dfVueTemplate) {
|
|
|
+ // this.$message.error("当前表格未绑定表单!");
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // // let fieldList = Object.keys(row);
|
|
|
+ // // let tableName = this.longestCommonSubstring(fieldList);
|
|
|
+ // // fieldList.forEach((field) => {
|
|
|
+ // // let realField = field.replace(tableName, "");
|
|
|
+ // // realField = realField[0].toLocaleLowerCase() + realField.substring(1);
|
|
|
+ // // row[realField] = row[field];
|
|
|
+ // // });
|
|
|
+ // this.addRealFieldName(row);
|
|
|
+ // Object.assign(this.defaultValue, row);
|
|
|
+ // this.jsonData = JSON.parse(data.dfVueTemplate);
|
|
|
+ // this.open = true;
|
|
|
+ // this.title = "修改信息";
|
|
|
+ // this.form.password = this.initPassword;
|
|
|
+ // this.$nextTick(() => {
|
|
|
+ // this.$refs.addFromRef.setData(row);
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // return;
|
|
|
+ this.reset();
|
|
|
+ const userId = row.userId || this.ids;
|
|
|
+ getUser(userId).then((response) => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.postOptions = response.posts;
|
|
|
+ this.roleOptions = response.roles;
|
|
|
+ this.$set(this.form, "postIds", response.postIds);
|
|
|
+ this.$set(this.form, "roleIds", response.roleIds);
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改当前信息";
|
|
|
+ this.form.password = "";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 将表单组数据转换成符合单个表单的数据格式
|
|
|
+ transformDataFormat(data) {
|
|
|
+ this.FormNameList = [];
|
|
|
+ let { mainForm, subFormList } = data;
|
|
|
+ this.formList = [];
|
|
|
+ let showValue = null;
|
|
|
+ if (mainForm.showValue) {
|
|
|
+ showValue = mainForm.showValue[0]?.resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (showValue) {
|
|
|
+ for (const key of Object.keys(showValue)) {
|
|
|
+ showValue[toUnderline(key)] = showValue[key];
|
|
|
+ }
|
|
|
+ mainForm.showTemplate.resultMap = [showValue];
|
|
|
+ }
|
|
|
+
|
|
|
+ this.formList.push({
|
|
|
+ template: mainForm.showTemplate,
|
|
|
+ tableName: mainForm.mainFormTable,
|
|
|
+ });
|
|
|
+ this.FormNameList.push({
|
|
|
+ tableName: mainForm.mainFormTable,
|
|
|
+ formItem: mainForm.mainFormItem,
|
|
|
+ relateFormItem: null,
|
|
|
+ formType: mainForm.showTemplate.spare == "2" ? "batch" : "normal",
|
|
|
+ defaultValue: mainForm.showValue ? mainForm.showValue[0].resultMap : {},
|
|
|
+ });
|
|
|
+ if (subFormList && subFormList.length > 0) {
|
|
|
+ subFormList.forEach((item) => {
|
|
|
+ let showValue = null;
|
|
|
+ if (item.showValue) {
|
|
|
+ showValue = item.showValue[0];
|
|
|
+ }
|
|
|
+ let defaultValue = {};
|
|
|
+ if (showValue) {
|
|
|
+ if (item.showTemplate.spare == "2") {
|
|
|
+ //动态表格表单
|
|
|
+ let batch = {},
|
|
|
+ tableName = item.formItem?.split(".")?.[0];
|
|
|
+ batch[tableName] = item.showValue.map((item) => item.resultMap);
|
|
|
+ defaultValue = JSON.parse(JSON.stringify(batch));
|
|
|
+ console.log(JSON.parse(JSON.stringify(batch)));
|
|
|
+ // 所有字段驼峰转下划线
|
|
|
+ batch[tableName].forEach((i) => {
|
|
|
+ for (const key of Object.keys(i)) {
|
|
|
+ i[toUnderline(key)] = i[key];
|
|
|
+ if (toUnderline(key) != key) {
|
|
|
+ delete i[key];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ item.showTemplate.resultMap = [
|
|
|
+ {
|
|
|
+ batch,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ for (const key of Object.keys(item.showValue[0].resultMap)) {
|
|
|
+ item.showValue[0].resultMap[toUnderline(key)] =
|
|
|
+ item.showValue[0].resultMap[key];
|
|
|
+ }
|
|
|
+
|
|
|
+ item.showTemplate.resultMap = [item.showValue[0].resultMap];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.formList.push({
|
|
|
+ template: item.showTemplate,
|
|
|
+ tableName: item.formItem?.split(".")?.[0],
|
|
|
+ });
|
|
|
+ this.FormNameList.push({
|
|
|
+ tableName: item.formItem?.split(".")?.[0],
|
|
|
+ formItem: item.formItem,
|
|
|
+ relateFormItem: item.relateMainItem,
|
|
|
+ formType: item.showTemplate.spare == "2" ? "batch" : "normal",
|
|
|
+ defaultValue,
|
|
|
+ insertMap: item.insertMap,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 添加真正的字段名
|
|
|
+ addRealFieldName(row) {
|
|
|
+ let fieldList = Object.keys(row);
|
|
|
+ // let tableName = this.longestCommonSubstring(fieldList);
|
|
|
+ let tableName = camelCase(this.tableName);
|
|
|
+ fieldList.forEach((field) => {
|
|
|
+ let realField = field.replace(tableName, "");
|
|
|
+ realField = realField[0].toLocaleLowerCase() + realField.substring(1);
|
|
|
+ row[realField] = row[field];
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm: function () {
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.userId != undefined) {
|
|
|
+ updateUser(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addUser(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作
|
|
|
+ * */
|
|
|
+ handleDelete(row, btnData) {
|
|
|
+ let delIds = this.ids;
|
|
|
+ let primary = camelCase(this.templateInfo.template?.primaryKey);
|
|
|
+ // let realyKey=
|
|
|
+ this.addRealFieldName(row);
|
|
|
+ if (row[primary] != undefined && row[primary] != null) {
|
|
|
+ delIds = [];
|
|
|
+ delIds.push(row[primary]);
|
|
|
+ }
|
|
|
+ let data = {
|
|
|
+ basicMap: {
|
|
|
+ btnType: btnData.btnType,
|
|
|
+ btnKey: btnData.btnKey,
|
|
|
+ tableName: this.tableName,
|
|
|
+ },
|
|
|
+ conditionMap: {
|
|
|
+ // id: delIds,
|
|
|
+ },
|
|
|
+ btnParametersMap: {},
|
|
|
+ };
|
|
|
+ if (this.currentBtnData.btnParams) {
|
|
|
+ let btnParams =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
|
|
|
+ let conditionData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams).conditionData || [];
|
|
|
+ conditionData.forEach((item) => {
|
|
|
+ data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
|
|
|
+ });
|
|
|
+ btnParams.forEach((item) => {
|
|
|
+ data.btnParametersMap[item.fieldName.split(".")[1]] = item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
|
|
|
+ this.$modal
|
|
|
+ .confirm('是否确认删除"' + delIds + '"的数据项?')
|
|
|
+ .then(function () {
|
|
|
+ // return delTableData(data);
|
|
|
+ return btnCommonApi(data);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ // 调用子组件查询方法 目的是携带上子组件中的查询参数
|
|
|
+ this.$refs.mychild.pageList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ // 批量删除接口
|
|
|
+ handleBatchDelete() {
|
|
|
+ let delIds = this.ids;
|
|
|
+ let primary = camelCase(this.templateInfo.template?.primaryKey);
|
|
|
+ // if (row && row[primary] != undefined && row[primary] != null) {
|
|
|
+ // delIds = [];
|
|
|
+ // delIds.push(row[primary]);
|
|
|
+ // }
|
|
|
+ let data = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: this.tableName,
|
|
|
+ },
|
|
|
+ conditionMap: {
|
|
|
+ // id: delIds,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ // if (this.currentBtnData.btnParams) {
|
|
|
+ // let btnParams = JSON.parse(this.currentBtnData.btnParams);
|
|
|
+ // btnParams.forEach((item) => {
|
|
|
+ // data.btnParametersMap[
|
|
|
+ // this.formatField(item.fieldName, camelCase(this.tableName))
|
|
|
+ // ] = item.fieldValue
|
|
|
+ // ? item.fieldValue
|
|
|
+ // : this.currentRow[item.fieldName];
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ data.conditionMap[this.templateInfo.template?.primaryKey] = delIds;
|
|
|
+ this.$modal
|
|
|
+ .confirm('是否确认删除"' + delIds + '"的数据项?')
|
|
|
+ .then(function () {
|
|
|
+ return delTableData(data);
|
|
|
+ // return btnCommonApi(data);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ // 调用子组件查询方法 目的是携带上子组件中的查询参数
|
|
|
+ this.$refs.mychild.pageList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ let primary = camelCase(this.templateInfo.template?.primaryKey);
|
|
|
+ let realyKey = camelCase(this.tableName + "_" + primary);
|
|
|
+ if (this.ids.length > 0) {
|
|
|
+ this.queryParams["execlMap"] = [];
|
|
|
+ this.ids.forEach((item) => {
|
|
|
+ this.queryParams.execlMap.push(
|
|
|
+ this.tableList.find((ttem) => {
|
|
|
+ return ttem[realyKey] === item;
|
|
|
+ })
|
|
|
+ );
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message.warning("请至少勾选一条导出数据");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.queryParams.execlMap = JSON.stringify(this.queryParams.execlMap);
|
|
|
+ this.download(
|
|
|
+ process.env.VUE_APP_BASE_API1 + "common/export",
|
|
|
+ {
|
|
|
+ ...this.queryParams,
|
|
|
+ },
|
|
|
+ `文件名称_${new Date().getTime()}.xlsx`
|
|
|
+ );
|
|
|
+ },
|
|
|
+ /** 导入按钮操作 */
|
|
|
+ handleImport() {
|
|
|
+ this.upload.title = "当前导入";
|
|
|
+ this.upload.open = true;
|
|
|
+ },
|
|
|
+ /** 下载模板操作 */
|
|
|
+ importTemplate() {
|
|
|
+ this.download(
|
|
|
+ process.env.VUE_APP_BASE_API1 +
|
|
|
+ `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
|
|
|
+ {},
|
|
|
+ `下载模版名称${new Date().getTime()}.xlsx`
|
|
|
+ );
|
|
|
+ },
|
|
|
+ // 文件上传中处理
|
|
|
+ handleFileUploadProgress(event, file, fileList) {
|
|
|
+ this.upload.isUploading = true;
|
|
|
+ },
|
|
|
+ // 文件上传成功处理
|
|
|
+ handleFileSuccess(response, file, fileList) {
|
|
|
+ this.upload.open = false;
|
|
|
+ this.upload.isUploading = false;
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ this.$alert(
|
|
|
+ "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
+ response.msg +
|
|
|
+ "</div>",
|
|
|
+ "导入结果",
|
|
|
+ { dangerouslyUseHTMLString: true }
|
|
|
+ );
|
|
|
+ this.$refs.mychild.pageList({
|
|
|
+ limit: this.queryParams.pageSize,
|
|
|
+ page: this.queryParams.pageNum,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //重点在这里
|
|
|
+ handleChange(file, fileList) {
|
|
|
+ file.name = this.tableName + "." + file.name.split(".")[1];
|
|
|
+ fileList.forEach((item) => {
|
|
|
+ item.name = this.tableName + "." + file.name.split(".")[1];
|
|
|
+ });
|
|
|
+ let newFile = new File(
|
|
|
+ [file],
|
|
|
+ this.tableName + "." + file.name.split(".")[1]
|
|
|
+ ); //创建出来也是不可编辑的file对象
|
|
|
+ },
|
|
|
+ // 提交上传文件
|
|
|
+ submitFileForm() {
|
|
|
+ this.$refs.upload.submit();
|
|
|
+ },
|
|
|
+ // 弹窗新增的数
|
|
|
+ addListHandler(val) {
|
|
|
+ this.addLists.push(...val);
|
|
|
+ },
|
|
|
+ // 绑定弹窗Dialog确定按钮
|
|
|
+ btnComfirm() {
|
|
|
+ // let data = {
|
|
|
+ // addListMap:[],
|
|
|
+ // basicMap:{
|
|
|
+ // btnType: 10,
|
|
|
+ // tableName: this.subTableName,
|
|
|
+ // visible: true,
|
|
|
+ // },
|
|
|
+ // commMap: {},
|
|
|
+ // conditionMap: {},
|
|
|
+ // }
|
|
|
+ // // data.addListMap =
|
|
|
+ // btnCommonApi(data).then(res => {
|
|
|
+ // // console.log('弹窗确定', res);
|
|
|
+ // })
|
|
|
+ },
|
|
|
+ // 去掉表名 开头字母小写
|
|
|
+ formatField(field = "", tableName) {
|
|
|
+ let temp = field.replace(tableName, "");
|
|
|
+ return toUnderline(temp[0].toLowerCase() + temp.slice(1));
|
|
|
+ },
|
|
|
+ // 处理 动态表单 动态表格 新增数据
|
|
|
+ getInsertBatchData(values, data) {
|
|
|
+ if (Object.keys(values.batch).length == 0) return data;
|
|
|
+ let tableName = Object.keys(values.batch)[0];
|
|
|
+ data.basicMap.tableName = tableName;
|
|
|
+ data.addListMap = values.batch[tableName].map((item) => {
|
|
|
+ delete item.key;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ return data;
|
|
|
+ },
|
|
|
+ // 添加插入的数据
|
|
|
+ addInsertData(insertMap, result, res) {
|
|
|
+ console.log(insertMap, result, res);
|
|
|
+ result.addListMap.forEach((i) => {
|
|
|
+ insertMap.forEach((j) => {
|
|
|
+ i[j.fieldName?.split(".")[1]] = res.find(
|
|
|
+ (k) => k.tableName == j.tableName
|
|
|
+ )?.data[j.relaField.split(".")[1]];
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 处理 动态表单 动态表格 修改数据
|
|
|
+ getEditBatchData(values, data) {},
|
|
|
+ // 处理 表单组 含有动态表格 新增数据
|
|
|
+ getFormGroupBatchData(values, index, result) {
|
|
|
+ console.log(values, index, result);
|
|
|
+ let tableName = Object.keys(values.data.batch)[0];
|
|
|
+ let res = {
|
|
|
+ basicMap: {
|
|
|
+ tableName,
|
|
|
+ },
|
|
|
+ addListMap: [],
|
|
|
+ };
|
|
|
+ let { formItem, relateFormItem } = values;
|
|
|
+ res.addListMap = values.data.batch[tableName].map((item) => {
|
|
|
+ delete item.key;
|
|
|
+ console.log(formItem.split(".")[1], relateFormItem.split(".")[1]);
|
|
|
+ item[formItem.split(".")[1]] =
|
|
|
+ result[0].data[relateFormItem.split(".")[1]]; //将主表单的关联值赋值给从表单
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+ //提交编辑结果按钮回调
|
|
|
+ async editConfirmHandler() {
|
|
|
+ if (this.$refs.addFromRef && this.formType == "dragForm") {
|
|
|
+ this.$refs.addFromRef
|
|
|
+ .getData()
|
|
|
+ .then(async (values) => {
|
|
|
+ // console.log("dragForm", values);
|
|
|
+
|
|
|
+ // return;
|
|
|
+ let data = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: this.tableName,
|
|
|
+ // btnKey: btnData.btnKey,
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
|
+ },
|
|
|
+ addListMap: [values],
|
|
|
+ conditionMap: {},
|
|
|
+ commMap: {},
|
|
|
+ btnParametersMap: {},
|
|
|
+ };
|
|
|
+
|
|
|
+ if (this.currentBtnData.btnParams) {
|
|
|
+ let btnParams =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams)?.commonFieldData ||
|
|
|
+ [];
|
|
|
+ let conditionData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams).conditionData || [];
|
|
|
+ // let
|
|
|
+ btnParams.forEach((item) => {
|
|
|
+ data.btnParametersMap[item.fieldName.split(".")[1]] =
|
|
|
+ item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ conditionData.forEach((item) => {
|
|
|
+ data.conditionMap[item.fieldName.split(".")[1]] =
|
|
|
+ item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (Object.keys(this.defaultValue).length) {
|
|
|
+ //修改
|
|
|
+ // data.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
+ // this.defaultValue[this.templateInfo.template?.primaryKey];
|
|
|
+ if (values.batch) {
|
|
|
+ //动态表单的修改
|
|
|
+ data = this.getEditBatchData(values, data);
|
|
|
+ } else {
|
|
|
+ Object.keys(values).map((k) => {
|
|
|
+ data.commMap[k] = values[k];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
+ data.basicMap.visible = true;
|
|
|
+ } else {
|
|
|
+ // 处理 动态表格
|
|
|
+ // start
|
|
|
+ if (values.batch) {
|
|
|
+ data = this.getInsertBatchData(values, data);
|
|
|
+ }
|
|
|
+ // end
|
|
|
+ //新增
|
|
|
+ data.basicMap.btnType = "INSERT";
|
|
|
+ data.basicMap.visible = true;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ let res = await btnCommonApi(data);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ } else {
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ // console.log(error);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ this.getList();
|
|
|
+ this.defaultValue = {};
|
|
|
+ this.open = false;
|
|
|
+ })
|
|
|
+ .catch((res) => {
|
|
|
+ console.log(res);
|
|
|
+ this.$modal.msgError("表单校验失败,请规范填写数据");
|
|
|
+ });
|
|
|
+ } else if (this.formType == "dragFormGroup") {
|
|
|
+ //表单组
|
|
|
+ // // console.log(this.$refs.formGroupRef);
|
|
|
+
|
|
|
+ let promiseArray = this.FormNameList.map((item) => {
|
|
|
+ return this.$refs.formGroupRef?.getFormData(item);
|
|
|
+ });
|
|
|
+ Promise.all(promiseArray).then(
|
|
|
+ async (res) => {
|
|
|
+ // 获取到所有表单数据
|
|
|
+ // console.log(res);
|
|
|
+ let mainFormData = res[0].data;
|
|
|
+ let data = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: this.tableName,
|
|
|
+ // btnKey: btnData.btnKey,
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
|
+ BpmRunNodeFormDateVo: {},
|
|
|
+ },
|
|
|
+ conditionMap: {},
|
|
|
+ commMap: {},
|
|
|
+ btnParametersMap: {},
|
|
|
+ };
|
|
|
+
|
|
|
+ let btnParams =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
|
|
|
+ let conditionData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams)?.conditionData || [];
|
|
|
+ Object.keys(mainFormData).map((k) => {
|
|
|
+ data.commMap[k] = mainFormData[k];
|
|
|
+ });
|
|
|
+ btnParams.forEach((item) => {
|
|
|
+ data.btnParametersMap[item.fieldName.split(".")[1]] =
|
|
|
+ item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ conditionData.forEach((item) => {
|
|
|
+ data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
|
|
|
+ });
|
|
|
+ data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
+ data.basicMap.visible = true;
|
|
|
+ let payLoad = {
|
|
|
+ insertCommonEntityList: [],
|
|
|
+ updateCommonEntityList: [],
|
|
|
+ deleteCommonEntityList: [],
|
|
|
+ };
|
|
|
+ if (this.currentBtnData.btnType == "UPDATE") {
|
|
|
+ // 准备删除数据
|
|
|
+ res.forEach((item, index) => {
|
|
|
+ let result = {};
|
|
|
+ if (index == 0) {
|
|
|
+ //主表 主表不会是动态表格
|
|
|
+ result = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: item.tableName,
|
|
|
+ },
|
|
|
+ commMap: {
|
|
|
+ ...item.data,
|
|
|
+ },
|
|
|
+ conditionMap: {},
|
|
|
+ };
|
|
|
+ //主表条件
|
|
|
+ let conditionData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams).conditionData ||
|
|
|
+ [];
|
|
|
+ conditionData.forEach((item) => {
|
|
|
+ result.conditionMap[item.fieldName.split(".")[1]] =
|
|
|
+ item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ payLoad.updateCommonEntityList.push(result);
|
|
|
+ } else {
|
|
|
+ // 从表条件
|
|
|
+ let {
|
|
|
+ formItem,
|
|
|
+ relateFormItem,
|
|
|
+ formType,
|
|
|
+ defaultValue,
|
|
|
+ tableName,
|
|
|
+ } = item;
|
|
|
+ if (formType == "batch") {
|
|
|
+ //动态表格的修改
|
|
|
+ let result = {};
|
|
|
+ // 准备删除数据
|
|
|
+ if (defaultValue[tableName]?.length) {
|
|
|
+ let ids = defaultValue[tableName].map((item) => item.id);
|
|
|
+ result = {
|
|
|
+ basicMap: {
|
|
|
+ tableName,
|
|
|
+ },
|
|
|
+ conditionMap: {
|
|
|
+ id: ids,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ payLoad.deleteCommonEntityList.push(result);
|
|
|
+ }
|
|
|
+ // 准备新增数据
|
|
|
+ result = this.getFormGroupBatchData(item, index, res);
|
|
|
+ if (item.insertMap.length) {
|
|
|
+ this.addInsertData(item.insertMap, result, res);
|
|
|
+ }
|
|
|
+ // 去除未修改数据的自动生成字段
|
|
|
+ this.removeAutoField(result);
|
|
|
+ console.log(result);
|
|
|
+ payLoad.insertCommonEntityList.push(result);
|
|
|
+ } else {
|
|
|
+ //普通表格的修改
|
|
|
+ result = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: item.tableName,
|
|
|
+ },
|
|
|
+ commMap: {
|
|
|
+ ...item.data,
|
|
|
+ },
|
|
|
+ conditionMap: {},
|
|
|
+ };
|
|
|
+ let fieldName = formItem.split(".")[1];
|
|
|
+ let value =
|
|
|
+ this.currentRow[
|
|
|
+ camelCase(relateFormItem.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ result.conditionMap[fieldName] = value;
|
|
|
+ payLoad.updateCommonEntityList.push(result);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (this.currentBtnData.btnType == "INSERT") {
|
|
|
+ // 新增
|
|
|
+ let uuid = uuidv4().replace("-", "");
|
|
|
+ // console.log(uuid);
|
|
|
+ res.forEach((item, index) => {});
|
|
|
+ payLoad.insertCommonEntityList = res.map((item, index) => {
|
|
|
+ let result = {};
|
|
|
+ console.log(item);
|
|
|
+ // return;
|
|
|
+ if (item.data.batch) {
|
|
|
+ //动态表格
|
|
|
+ result = this.getFormGroupBatchData(item, index, res);
|
|
|
+ } else {
|
|
|
+ result = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: item.tableName,
|
|
|
+ },
|
|
|
+ addListMap: [
|
|
|
+ {
|
|
|
+ ...item.data,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ let { formItem, relateFormItem } = item;
|
|
|
+ if (index == 0) {
|
|
|
+ //主表单
|
|
|
+ // 添加新增数据的关联条件
|
|
|
+
|
|
|
+ // console.log(formItem);
|
|
|
+ let mainFormKey = res[0].data[formItem.split(".")[1]];
|
|
|
+ if (mainFormKey) {
|
|
|
+ result.addListMap[0][formItem.split(".")[1]] =
|
|
|
+ mainFormKey;
|
|
|
+ } else {
|
|
|
+ res[0].data[formItem.split(".")[1]] = uuid;
|
|
|
+ result.addListMap[0][formItem.split(".")[1]] = uuid;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //子表单
|
|
|
+ result.addListMap[0][formItem.split(".")[1]] =
|
|
|
+ res[0].data[relateFormItem.split(".")[1]];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (item.insertMap?.length) {
|
|
|
+ this.addInsertData(item.insertMap, result, res);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ });
|
|
|
+ } else if (this.currentBtnData.btnType == "INITIATED") {
|
|
|
+ // 按照单独的表单投产逻辑收集主表单数据
|
|
|
+ // let mainFormData = res[0].data;//主表单数据
|
|
|
+ // payLoad = {
|
|
|
+ // basicMap: {
|
|
|
+ // tableName: this.tableName,
|
|
|
+ // // btnKey: btnData.btnKey,
|
|
|
+ // btnKey: this.currentBtnData.btnKey,
|
|
|
+ // },
|
|
|
+ // addListMap: mainFormData,
|
|
|
+ // conditionMap: {},
|
|
|
+ // commMap: {},
|
|
|
+ // btnParametersMap: {},
|
|
|
+ // };
|
|
|
+ // if (this.currentBtnData.btnParams) {
|
|
|
+ // let btnParams =
|
|
|
+ // JSON.parse(this.currentBtnData.btnParams)?.commonFieldData ||
|
|
|
+ // [];
|
|
|
+ // let conditionData =
|
|
|
+ // JSON.parse(this.currentBtnData.btnParams).conditionData || [];
|
|
|
+ // // let
|
|
|
+ // btnParams.forEach((item) => {
|
|
|
+ // payLoad.btnParametersMap[item.fieldName.split(".")[1]] =
|
|
|
+ // item.fieldValue
|
|
|
+ // ? item.fieldValue
|
|
|
+ // : this.currentRow[
|
|
|
+ // camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ // ];
|
|
|
+ // });
|
|
|
+ // conditionData.forEach((item) => {
|
|
|
+ // payLoad.conditionMap[item.fieldName.split(".")[1]] =
|
|
|
+ // item.fieldValue
|
|
|
+ // ? item.fieldValue
|
|
|
+ // : this.currentRow[
|
|
|
+ // camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ // ];
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // if (Object.keys(this.defaultValue).length) {
|
|
|
+ // // data.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
+ // // this.defaultValue[this.templateInfo.template?.primaryKey];
|
|
|
+ // Object.keys(mainFormData).map((k) => {
|
|
|
+ // data.commMap[k] = mainFormData[k];
|
|
|
+ // });
|
|
|
+ // data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
+ // data.basicMap.visible = true;
|
|
|
+ // } else {
|
|
|
+ // data.basicMap.btnType = "INSERT";
|
|
|
+ // data.basicMap.visible = true;
|
|
|
+ // }
|
|
|
+ // 添加表单组数据处理逻辑
|
|
|
+ payLoad.updateCommonEntityList = res.map((item, index) => {
|
|
|
+ let result = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: item.tableName,
|
|
|
+ },
|
|
|
+ commMap: {
|
|
|
+ ...item.data,
|
|
|
+ },
|
|
|
+ conditionMap: {},
|
|
|
+ };
|
|
|
+ if (index == 0) {
|
|
|
+ //主表条件
|
|
|
+ let conditionData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams).conditionData ||
|
|
|
+ [];
|
|
|
+ conditionData.forEach((item) => {
|
|
|
+ result.conditionMap[item.fieldName.split(".")[1]] =
|
|
|
+ item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 从表条件
|
|
|
+ let { formItem, relateFormItem } = item;
|
|
|
+ let fieldName = formItem.split(".")[1];
|
|
|
+ let value =
|
|
|
+ this.currentRow[
|
|
|
+ camelCase(relateFormItem.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ result.conditionMap[fieldName] = value;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ data.basicMap.BpmRunNodeFormDateVo = payLoad;
|
|
|
+ // return;
|
|
|
+ try {
|
|
|
+ let res = await btnCommonApi(data);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ this.getList();
|
|
|
+ this.defaultValue = {};
|
|
|
+ this.open = false;
|
|
|
+ } else {
|
|
|
+ console.log(res);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ // console.log(err);
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ // 没有绑定表单
|
|
|
+ let data = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: this.tableName,
|
|
|
+ // btnKey: btnData.btnKey,
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
|
+ btnType: this.currentBtnData.btnType,
|
|
|
+ visible: true,
|
|
|
+ },
|
|
|
+ addListMap: [],
|
|
|
+ conditionMap: {},
|
|
|
+ commMap: {},
|
|
|
+ btnParametersMap: {},
|
|
|
+ };
|
|
|
+ if (this.currentBtnData.btnParams) {
|
|
|
+ let btnParams =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams)?.commonFieldData || [];
|
|
|
+ let conditionData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams).conditionData || [];
|
|
|
+ conditionData.forEach((item) => {
|
|
|
+ data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
|
|
|
+ });
|
|
|
+ btnParams.forEach((item) => {
|
|
|
+ data.btnParametersMap[item.fieldName.split(".")[1]] =
|
|
|
+ item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
+ // data.basicMap.visible = true;
|
|
|
+ try {
|
|
|
+ let res = await btnCommonApi(data);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("操作成功");
|
|
|
+ } else {
|
|
|
+ console.log(res);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ this.getList();
|
|
|
+ this.defaultValue = {};
|
|
|
+ this.open = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 去除多余字段
|
|
|
+ removeAutoField(result) {
|
|
|
+ result.addListMap.forEach((item) => {
|
|
|
+ this.theAutoField.forEach((field) => {
|
|
|
+ delete item[field];
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 使用提交数据类型的按钮获取数据
|
|
|
+ tempSubBtn(getData) {
|
|
|
+ getData()
|
|
|
+ .then((values) => {
|
|
|
+ // console.log("验证通过", values);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // console.log("验证未通过,获取失败");
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 判断是否生效行样式
|
|
|
+ cellStyle({ row, column, rowIndex, columnIndex }) {
|
|
|
+ let rowStyleList = this.styleList.filter((item) => item.styleType == 0);
|
|
|
+ if (!rowStyleList.length) return "";
|
|
|
+ let mainTableName = this.templateInfo.querySql.tableAlias; //主表名
|
|
|
+ for (let i = 0; i < rowStyleList.length; i++) {
|
|
|
+ let item = rowStyleList[i];
|
|
|
+ let judgeRes = this.determineCondition(item.styleCondtion, row);
|
|
|
+ if (judgeRes) {
|
|
|
+ let styleCode = JSON.parse(item.styleCode);
|
|
|
+ return `background-color:${styleCode.rowBgColor};`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取生效条件组结果
|
|
|
+ determineCondition(conditionStr, row) {
|
|
|
+ let conditionList = JSON.parse(conditionStr);
|
|
|
+ if (!conditionList.length) return false;
|
|
|
+ return conditionList.every((item) => this.judgeOneCondition(item, row));
|
|
|
+ },
|
|
|
+ // 获取单个判断条件结果
|
|
|
+ judgeOneCondition(item, row) {
|
|
|
+ let fullField = camelCase(item.tableName + "_" + item.fieldName);
|
|
|
+ switch (item.condition) {
|
|
|
+ case 1:
|
|
|
+ return row[fullField] > item.flagValue;
|
|
|
+ case 2:
|
|
|
+ return row[fullField] < item.flagValue;
|
|
|
+ case 3:
|
|
|
+ return row[fullField] == item.flagValue;
|
|
|
+ case 4:
|
|
|
+ return row[fullField] >= item.flagValue;
|
|
|
+ case 5:
|
|
|
+ return row[fullField] <= item.flagValue;
|
|
|
+ default:
|
|
|
+ return true; //默认为true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 设置表格字段样式
|
|
|
+ async setFieldStyleData(tableList) {
|
|
|
+ // console.log(JSON.parse(JSON.stringify(tableList)));
|
|
|
+ let fieldConditionList = this.styleList.filter(
|
|
|
+ (item) => item.styleType == 1 || item.styleType == 2
|
|
|
+ );
|
|
|
+ if (!fieldConditionList.length) return tableList;
|
|
|
+ let res = await this.setDictStyleData();
|
|
|
+
|
|
|
+ this.dictStyleObj = res.reduce((pre, item) => {
|
|
|
+ return {
|
|
|
+ ...pre,
|
|
|
+ ...item,
|
|
|
+ };
|
|
|
+ }, {});
|
|
|
+ // // console.log("this.dictStyleObj", this.dictStyleObj);
|
|
|
+ tableList.forEach((row) => {
|
|
|
+ // if (!row.styleFieldObj) row.styleFieldObj = {};
|
|
|
+ for (let i = 0; i < fieldConditionList.length; i++) {
|
|
|
+ let item = fieldConditionList[i];
|
|
|
+ if (item.styleType == 1) {
|
|
|
+ //字段样式
|
|
|
+ let judgeRes = this.determineCondition(item.styleCondtion, row);
|
|
|
+ if (judgeRes) {
|
|
|
+ let styleCode = JSON.parse(item.styleCode);
|
|
|
+ if (!row.styleFieldObj) row.styleFieldObj = {};
|
|
|
+ row.styleFieldObj[item.styleField] = {
|
|
|
+ styleType: item.styleType,
|
|
|
+ fieldStyleType: styleCode.fieldStyleType,
|
|
|
+ fontColor: styleCode.fontColor,
|
|
|
+ isTagFullBg: styleCode.isTagFullBg,
|
|
|
+ tagType: styleCode.tagType,
|
|
|
+ };
|
|
|
+ // row.styleField = item.styleField; //样式生效字段
|
|
|
+ // row.styleType = item.styleType; //0:行样式 1:字段样式 2:字典样式
|
|
|
+ // row.fieldStyleType = styleCode.fieldStyleType; //0:文本 1:标签
|
|
|
+ // row.fontColor = styleCode.fontColor;
|
|
|
+ // row.isTagFullBg = styleCode.isTagFullBg; //true/false
|
|
|
+ // row.tagType = styleCode.tagType; //string
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //字典样式
|
|
|
+ let dicStyle = this.dictStyleObj[item.styleField]?.find((dict) => {
|
|
|
+ return dict.dictValue == row[item.styleField];
|
|
|
+ });
|
|
|
+ if (dicStyle) {
|
|
|
+ if (!row.styleFieldObj) row.styleFieldObj = {};
|
|
|
+ row.styleFieldObj[item.styleField] = dicStyle; //设置该字段应该显示的字典样式
|
|
|
+ row.styleFieldObj[item.styleField].styleType = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return tableList;
|
|
|
+ },
|
|
|
+ //设置表格字典相关数据
|
|
|
+ setDictStyleData() {
|
|
|
+ let fieldConditionList = this.styleList.filter(
|
|
|
+ (item) => item.styleType == 2
|
|
|
+ );
|
|
|
+ if (!fieldConditionList.length) return;
|
|
|
+ let PromiseList = fieldConditionList.map((item) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ let temp = {};
|
|
|
+ try {
|
|
|
+ listData({
|
|
|
+ isEnablePaging: false,
|
|
|
+ dictType: item.styleCondtion,
|
|
|
+ }).then((res) => {
|
|
|
+ temp[item.styleField] = res.rows;
|
|
|
+ resolve(temp);
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ reject(error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return Promise.all(PromiseList);
|
|
|
+ },
|
|
|
+ // 内链页面跳转
|
|
|
+ routerHandler(btnData, type) {
|
|
|
+ let { url, commonFieldData } = JSON.parse(btnData.btnParams);
|
|
|
+ let tempArr = [];
|
|
|
+ if (commonFieldData) {
|
|
|
+ let queryArr = JSON.parse(commonFieldData);
|
|
|
+
|
|
|
+ tempArr = queryArr.map((item) => {
|
|
|
+ let key = this.formatField(item.fieldName, camelCase(this.tableName));
|
|
|
+ let value = item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[item.fieldName];
|
|
|
+ return key + "=" + value;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (tempArr.length) {
|
|
|
+ url += "?" + tempArr.join("&");
|
|
|
+ }
|
|
|
+ // let link = btnData.btnParams;
|
|
|
+ if (type == "INNERLINK") {
|
|
|
+ this.$router.push(url);
|
|
|
+ } else {
|
|
|
+ window.open("http://" + url, "_blank");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 操作列回调
|
|
|
+ excuteHandler(btnData, row) {
|
|
|
+ // console.log("btnData", btnData, row);
|
|
|
+ let { btnType, btnParams, btnFormType } = btnData;
|
|
|
+ this.currentBtnData = btnData;
|
|
|
+ this.currentRow = JSON.parse(JSON.stringify(row));
|
|
|
+ // 无表单
|
|
|
+ if (btnFormType == "noNeed" && btnType != "UPDATE") {
|
|
|
+ this.noNeedHandler(btnData, row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (btnType) {
|
|
|
+ case "INNERLINK":
|
|
|
+ this.routerHandler(btnData, btnType);
|
|
|
+ break;
|
|
|
+ case "OUTLINK":
|
|
|
+ this.routerHandler(btnData, btnType);
|
|
|
+ break;
|
|
|
+ case "UPDATE":
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ break;
|
|
|
+ case "EXECUTE":
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ break;
|
|
|
+ case "INITIATED":
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ break;
|
|
|
+ case "DELETE":
|
|
|
+ this.handleDelete(row, btnData);
|
|
|
+ break;
|
|
|
+ case "INSERT":
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ break;
|
|
|
+ case "PRINT":
|
|
|
+ this.printHandler(btnData, row);
|
|
|
+ break;
|
|
|
+ case "viewPurchaseOrderDetails":
|
|
|
+ this.viewPurchaseOrderDetails(btnData, row);
|
|
|
+ break;
|
|
|
+ case "caiGouUpdate":
|
|
|
+ this.caiGouUpdate(btnData, row);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 顶部按钮回调
|
|
|
+ topBtnHandler(btnData) {
|
|
|
+ console.log(btnData);
|
|
|
+ let { btnType, btnParams, btnFormType } = btnData;
|
|
|
+ let row = this.selection[0] || [];
|
|
|
+ this.currentBtnData = btnData;
|
|
|
+ this.currentRow = JSON.parse(JSON.stringify(row));
|
|
|
+ // 无表单
|
|
|
+ if (
|
|
|
+ btnFormType == "noNeed" &&
|
|
|
+ btnType != "IMPORT" &&
|
|
|
+ btnType != "EXPORT" &&
|
|
|
+ btnType != "DELETE" &&
|
|
|
+ btnType != "UPDATE" &&
|
|
|
+ btnType != "INSERT" &&
|
|
|
+ btnType != "PRINT"
|
|
|
+ ) {
|
|
|
+ this.noNeedHandler(btnData, row);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ switch (btnType) {
|
|
|
+ case "INNERLINK":
|
|
|
+ this.routerHandler(btnData, btnType);
|
|
|
+ break;
|
|
|
+ case "OUTLINK":
|
|
|
+ this.routerHandler(btnData, btnType);
|
|
|
+ break;
|
|
|
+ case "UPDATE":
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ break;
|
|
|
+ case "EXECUTE":
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ break;
|
|
|
+ case "INITIATED":
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ break;
|
|
|
+ case "DELETE":
|
|
|
+ this.handleBatchDelete();
|
|
|
+ break;
|
|
|
+ case "INSERT":
|
|
|
+ //拖拽逻辑
|
|
|
+ this.handleUpdate(row, btnData);
|
|
|
+ //手写逻辑
|
|
|
+ // this.insertFromHander();
|
|
|
+ break;
|
|
|
+ case "IMPORT":
|
|
|
+ this.upload.open = true;
|
|
|
+ break;
|
|
|
+ case "EXPORT":
|
|
|
+ this.handleExport();
|
|
|
+ break;
|
|
|
+ case "PRINT":
|
|
|
+ this.printHandler(btnData, row);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 打印回调
|
|
|
+ printHandler(btnData, row) {
|
|
|
+ // 发送请求获取打印数据
|
|
|
+ this.printShow = true;
|
|
|
+ this.printHtml = printHtml;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.detailTable.innerHTML = this.printHtml;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 确认打印回调
|
|
|
+ confirmPrint() {
|
|
|
+ document.body.innerHTML = document.getElementById("printDom").innerHTML =
|
|
|
+ this.printHtml;
|
|
|
+ window.print(); //打印
|
|
|
+ window.location.reload();
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+ noNeedHandler(btnData, row) {
|
|
|
+ this.$modal
|
|
|
+ .confirm("是否确认执行该操作?")
|
|
|
+ .then(async () => {
|
|
|
+ // 获取默认参数
|
|
|
+ let data = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: this.tableName,
|
|
|
+ // btnKey: btnData.btnKey,
|
|
|
+ btnKey: this.currentBtnData.btnKey,
|
|
|
+ },
|
|
|
+ conditionMap: {},
|
|
|
+ commMap: {},
|
|
|
+ btnParametersMap: {},
|
|
|
+ };
|
|
|
+ // console.log(this.currentBtnData, this.currentRow);
|
|
|
+ if (this.currentBtnData.btnParams) {
|
|
|
+ let conditionData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams).conditionData || [];
|
|
|
+ // let
|
|
|
+ let commonData =
|
|
|
+ JSON.parse(this.currentBtnData.btnParams).commonFieldData || [];
|
|
|
+
|
|
|
+ conditionData.forEach((item) => {
|
|
|
+ data.conditionMap[item.fieldName.split(".")[1]] = item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[camelCase(item.fieldName.replace(".", "_"))];
|
|
|
+ });
|
|
|
+ commonData.forEach((item) => {
|
|
|
+ data.btnParametersMap[item.fieldName.split(".")[1]] =
|
|
|
+ item.fieldValue
|
|
|
+ ? item.fieldValue
|
|
|
+ : this.currentRow[
|
|
|
+ camelCase(item.fieldName.replace(".", "_"))
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ }
|
|
|
+ data.basicMap.btnType = this.currentBtnData.btnType;
|
|
|
+ data.basicMap.visible = true;
|
|
|
+ try {
|
|
|
+ let res = await btnCommonApi(data);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success(res.msg);
|
|
|
+ } else {
|
|
|
+ console.error(res.msg);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.error(error);
|
|
|
+ this.$message.error("网络异常,请稍后再试");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ // 调用子组件查询方法 目的是携带上子组件中的查询参数
|
|
|
+ this.$refs.mychild.pageList();
|
|
|
+ // this.$modal.msgSuccess("操作成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ },
|
|
|
+ // k-form-build表单变化回调
|
|
|
+ formChangeHandler(value, label) {
|
|
|
+ // // console.log(value, label);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ beforeDestroy(){
|
|
|
+ // 清除防抖函数的引用
|
|
|
+ // this.lotChange.cancel();
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.tableDiv {
|
|
|
+ margin-top: 20px;
|
|
|
+}
|
|
|
+.titleDiv {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ i {
|
|
|
+ font-style: normal;
|
|
|
+ font-weight: 900;
|
|
|
+ color: #000000;
|
|
|
+ }
|
|
|
+}
|
|
|
+::v-deep .el-dialog:not(.is-fullscreen) {
|
|
|
+ min-width: 610px !important;
|
|
|
+}
|
|
|
+</style>
|