You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1480 lines
52 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 收藏 -->
  4. <div>
  5. <span @click="favoriteFunction()">
  6. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
  7. </span>
  8. </div>
  9. <!-- 条件查询 -->
  10. <el-form :inline="true" label-position="top" :model="searchData" >
  11. <el-form-item :label="'检验单号:'">
  12. <el-input v-model="searchData.inspectionNo" clearable style="width: 120px"></el-input>
  13. </el-form-item>
  14. <el-form-item :label="'状态:'">
  15. <el-select v-model="searchData.state" style="width: 100px">
  16. <el-option label="全部" value=""></el-option>
  17. <el-option label="待检验" value="待检验"></el-option>
  18. <el-option label="待审核" value="待审核"></el-option>
  19. <el-option label="已完成" value="已完成"></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item :label="'检验结论:'">
  23. <el-select v-model="searchData.inspectionResult" style="width: 100px">
  24. <el-option label="全部" value=""></el-option>
  25. <el-option label="合格" value="合格"></el-option>
  26. <el-option label="不合格" value="不合格"></el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item :label="'物料编码:'">
  30. <el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
  31. </el-form-item>
  32. <el-form-item :label="'物料名称:'">
  33. <el-input v-model="searchData.partDesc" clearable style="width: 120px"></el-input>
  34. </el-form-item>
  35. <el-form-item :label="'检验时间:'">
  36. <el-date-picker style="width: 150px" v-model="searchData.startDate" type="datetime" value-format='yyyy-MM-dd HH:mm' format='yyyy-MM-dd HH:mm' placeholder="开始日期"></el-date-picker>
  37. -
  38. <el-date-picker style="width: 150px" v-model="searchData.endDate" type="datetime" value-format='yyyy-MM-dd HH:mm' format='yyyy-MM-dd HH:mm' placeholder="结束日期"></el-date-picker>
  39. </el-form-item>
  40. <el-form-item :label="' '">
  41. <el-button type="primary" @click="getDataList()">查询</el-button>
  42. <el-button type="primary" @click="submitResult()">审核</el-button>
  43. <el-button type="primary" @click="deleteModal()">删除</el-button>
  44. <download-excel
  45. :fields="fields()"
  46. :data="exportData"
  47. type="xls"
  48. :name="exportName"
  49. :header="exportHeader"
  50. :footer="exportFooter"
  51. :fetch="createExportData"
  52. :before-generate="startDownload"
  53. :before-finish="finishDownload"
  54. worksheet="导出信息"
  55. class="el-button el-button--primary el-button--medium">
  56. {{ "导出" }}
  57. </download-excel>
  58. </el-form-item>
  59. </el-form>
  60. <!-- 检验记录展示列表 -->
  61. <el-table
  62. :height="height"
  63. :data="dataList"
  64. border
  65. ref="IQCTable"
  66. @row-click="IQCClickRow"
  67. @selection-change="selectionIQC"
  68. v-loading="dataListLoading"
  69. style="width: 100%;">
  70. <el-table-column
  71. type="selection"
  72. header-align="center"
  73. align="center"
  74. :selectable="selectFlag"
  75. width="50">
  76. </el-table-column>
  77. <el-table-column
  78. prop="state"
  79. header-align="center"
  80. align="center"
  81. label="状态">
  82. <template slot-scope="scope">
  83. <div :style="{fontWeight:'bold', color: scope.row.state === '待检验' ? 'red' : scope.row.state === '待审核' ? '#ffa500e0' : scope.row.state === '已完成' ? '#3ac252' : ''}">
  84. {{ scope.row.state }}
  85. </div>
  86. </template>
  87. </el-table-column>
  88. <el-table-column
  89. v-for="(item,index) in columnList" :key="index"
  90. :sortable="item.columnSortable"
  91. :prop="item.columnProp"
  92. :header-align="item.headerAlign"
  93. :show-overflow-tooltip="item.showOverflowTooltip"
  94. :align="item.align"
  95. :fixed="item.fixed===''?false:item.fixed"
  96. :min-width="item.columnWidth"
  97. :label="item.columnLabel">
  98. <template slot-scope="scope">
  99. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  100. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column
  104. fixed="right"
  105. header-align="center"
  106. align="center"
  107. width="200"
  108. label="操作">
  109. <template slot-scope="scope">
  110. <a type="text" size="small" @click="detailModal(scope.row)">检验单</a>
  111. <a type="text" size="small" @click="getFileContentData(scope.row)">工作文件</a>
  112. <!-- <a type="text" size="small" @click="submitResult(scope.row)">审核</a>-->
  113. <!-- <a type="text" size="small" @click="deleteModal(scope.row)">删除</a>-->
  114. </template>
  115. </el-table-column>
  116. </el-table>
  117. <!-- 分页-->
  118. <el-pagination
  119. @size-change="sizeChangeHandle"
  120. @current-change="currentChangeHandle"
  121. :current-page="pageIndex"
  122. :page-sizes="[20, 50, 100, 200, 500]"
  123. :page-size="pageSize"
  124. :total="totalPage"
  125. layout="total, sizes, prev, pager, next, jumper">
  126. </el-pagination>
  127. <!-- 检验单详情页 -->
  128. <el-dialog title="检验明细清单" :close-on-click-modal="false" v-drag :visible.sync="detailInformationFlag" width="1200px">
  129. <el-form :inline="true" label-position="top" @keyup.enter.native="getDataList()">
  130. <el-form-item :label="'物料编码'">
  131. <el-input v-model="detailData.partNo" disabled style="width: 100px"></el-input>
  132. </el-form-item>
  133. <el-form-item :label="'物料名称'">
  134. <el-input v-model="detailData.partDesc" disabled style="width: 200px"></el-input>
  135. </el-form-item>
  136. <el-form-item :label="'送检数量'">
  137. <el-input v-model="detailData.rollQty" disabled style="width: 80px"></el-input>
  138. </el-form-item>
  139. <el-form-item :label="'抽样数量'">
  140. <el-input v-model="detailData.samplingQty" disabled style="width: 80px"></el-input>
  141. </el-form-item>
  142. </el-form>
  143. <el-form :inline="true" label-position="top" @keyup.enter.native="getDataList()">
  144. <el-form-item :label="'不合格项目数量'">
  145. <el-input v-if="detailData.submitFlag === 'Y'" v-model="detailData.unqualifiedQty" disabled type="number" style="width: 80px"></el-input>
  146. <el-input v-if="detailData.submitFlag != 'Y'" v-model="detailData.unqualifiedQty" type="number" style="width: 80px"></el-input>
  147. </el-form-item>
  148. <el-form-item :label="'处置措施'">
  149. <el-select v-if="detailData.submitFlag === 'Y'" v-model="detailData.disposalMeasures" disabled style="width: 100px">
  150. <el-option label="请选择" value=""></el-option>
  151. <el-option label="特采" value="特采"></el-option>
  152. <el-option label="拒收" value="拒收"></el-option>
  153. </el-select>
  154. <el-select v-if="detailData.submitFlag != 'Y'" v-model="detailData.disposalMeasures" style="width: 100px">
  155. <el-option label="请选择" value=""></el-option>
  156. <el-option label="特采" value="特采"></el-option>
  157. <el-option label="拒收" value="拒收"></el-option>
  158. </el-select>
  159. </el-form-item>
  160. <el-form-item :label="'处置说明'">
  161. <el-input v-if="detailData.submitFlag === 'Y'" v-model="detailData.disposalRemark" disabled style="width: 200px"></el-input>
  162. <el-input v-if="detailData.submitFlag != 'Y'" v-model="detailData.disposalRemark" style="width: 200px"></el-input>
  163. </el-form-item>
  164. <el-form-item :label="'检验结论'">
  165. <el-select v-if="detailData.submitFlag === 'Y'" v-model="detailData.inspectionResult" disabled style="width: 100px" placeholder="请选择">
  166. <el-option label="合格" value="合格"></el-option>
  167. <el-option label="不合格" value="不合格"></el-option>
  168. </el-select>
  169. <el-select v-if="detailData.submitFlag != 'Y'" v-model="detailData.inspectionResult" style="width: 100px" placeholder="请选择">
  170. <el-option label="合格" value="合格"></el-option>
  171. <el-option label="不合格" value="不合格"></el-option>
  172. </el-select>
  173. </el-form-item>
  174. <el-form-item label="检验员">
  175. <el-select v-if="detailData.submitFlag === 'Y'" v-model="detailData.inspectorNo" disabled placeholder="请选择" style="width: 100px">
  176. <el-option
  177. v-for = "i in options"
  178. :key = "i.inspectorNo"
  179. :label = "i.inspectorName"
  180. :value = "i.inspectorNo">
  181. </el-option>
  182. </el-select>
  183. <el-select v-if="detailData.submitFlag != 'Y'" v-model="detailData.inspectorNo" placeholder="请选择" style="width: 100px">
  184. <el-option
  185. v-for = "i in options"
  186. :key = "i.inspectorNo"
  187. :label = "i.inspectorName"
  188. :value = "i.inspectorNo">
  189. </el-option>
  190. </el-select>
  191. </el-form-item>
  192. <el-form-item :label="'质检备注'">
  193. <el-input v-if="detailData.submitFlag === 'Y'" v-model="detailData.inspectionRemark" disabled style="width: 200px"></el-input>
  194. <el-input v-if="detailData.submitFlag != 'Y'" v-model="detailData.inspectionRemark" style="width: 200px"></el-input>
  195. </el-form-item>
  196. <el-form-item :label="' '">
  197. <el-button type="primary" @click="addUploadFileModal()">上传文件</el-button>
  198. </el-form-item>
  199. <el-form-item :label="' '"></el-form-item>
  200. </el-form>
  201. <!-- 展示列表 -->
  202. <div class="rq ">
  203. <el-table
  204. :height="500"
  205. :data="detailList"
  206. border
  207. v-loading="dataListLoading"
  208. style="width: 100%;">
  209. <el-table-column
  210. v-for="(item,index) in detailColumnList" :key="index"
  211. :sortable="item.columnSortable"
  212. :prop="item.columnProp"
  213. :header-align="item.headerAlign"
  214. :show-overflow-tooltip="item.showOverflowTooltip"
  215. :align="item.align"
  216. :fixed="item.fixed===''?false:item.fixed"
  217. :min-width="item.columnWidth"
  218. :label="item.columnLabel">
  219. <template slot-scope="scope">
  220. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  221. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  222. </template>
  223. </el-table-column>
  224. <el-table-column
  225. prop=""
  226. header-align="center"
  227. align="center"
  228. min-width="80"
  229. label="子明细">
  230. <template slot-scope="scope">
  231. <el-button v-if="scope.row.subDetailRecordNum <= 0" type="primary" @click="subDetailModal(scope.row) ">点击输入</el-button>
  232. <el-button v-if="scope.row.subDetailRecordNum > 0" type="success" @click="subDetailModal(scope.row) ">点击输入</el-button>
  233. </template>
  234. </el-table-column>
  235. <el-table-column
  236. prop=""
  237. header-align="center"
  238. align="right"
  239. min-width="80"
  240. label="不合格数量">
  241. <template slot-scope="scope">
  242. <el-input v-if="detailData.submitFlag === 'Y'" v-model="scope.row.unqualifiedQuantity" disabled type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
  243. <el-input v-if="detailData.submitFlag != 'Y'" v-model="scope.row.unqualifiedQuantity" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"></el-input>
  244. </template>
  245. </el-table-column>
  246. <el-table-column
  247. prop=""
  248. header-align="center"
  249. align="right"
  250. min-width="75"
  251. label="项目检验结论">
  252. <template slot-scope="scope">
  253. <el-select v-if="detailData.submitFlag === 'Y'" v-model="scope.row.itemResult" disabled style="height: 11px;padding: 0px" >
  254. <el-option label="合格" value="Y" style="color: green"></el-option>
  255. <el-option label="不合格" value="N" style="color: red"></el-option>
  256. </el-select>
  257. <el-select v-if="detailData.submitFlag != 'Y'" v-model="scope.row.itemResult" style="height: 11px;padding: 0px" placeholder="合格">
  258. <el-option label="合格" value="Y" style="color: green"></el-option>
  259. <el-option label="不合格" value="N" style="color: red"></el-option>
  260. </el-select>
  261. </template>
  262. </el-table-column>
  263. </el-table>
  264. </div>
  265. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  266. <el-button type="primary" @click="Transfer()">保存</el-button>
  267. <el-button type="primary" @click="detailInformationFlag=false">关闭</el-button>
  268. </el-footer>
  269. </el-dialog>
  270. <!-- 文件清单 -->
  271. <el-dialog title="文件清单" :close-on-click-modal="false" v-drag :visible.sync="fileFlag" width="800px">
  272. <el-table
  273. :height="350"
  274. :data="fileContentList"
  275. border
  276. v-loading="dataListLoading"
  277. style="width: 100%; ">
  278. <el-table-column
  279. v-for="(item,index) in fileColumnList" :key="index"
  280. :sortable="item.columnSortable"
  281. :prop="item.columnProp"
  282. :header-align="item.headerAlign"
  283. :show-overflow-tooltip="item.showOverflowTooltip"
  284. :align="item.align"
  285. :fixed="item.fixed===''?false:item.fixed"
  286. :min-width="item.columnWidth"
  287. :label="item.columnLabel">
  288. <template slot-scope="scope">
  289. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  290. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  291. </template>
  292. </el-table-column>
  293. <el-table-column
  294. fixed="right"
  295. header-align="center"
  296. align="center"
  297. width="100"
  298. label="操作">
  299. <template slot-scope="scope">
  300. <a @click="downloadFile(scope.row)">下载</a>
  301. <a type="text" size="small" @click="deleteFile(scope.row)">删除</a>
  302. </template>
  303. </el-table-column>
  304. </el-table>
  305. </el-dialog>
  306. <!-- 子明细信息 -->
  307. <el-dialog title="子明细信息" :close-on-click-modal="false" v-drag :visible.sync="subDetailFlag" width="572px">
  308. <el-button type="success" icon="el-icon-plus" size="mini" @click="handleAddBtn(subDetailData)">添加</el-button>
  309. <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteBtn(subDetailData)">删除</el-button>
  310. <el-button type="primary" icon="el-icon-more" size="mini" @click="batchHandleAdd(subDetailData)">批量新增</el-button>
  311. <div class="rq ">
  312. <el-table
  313. :height="400"
  314. :data="tableData"
  315. border
  316. :row-class-name="rowClassName"
  317. @selection-change="handleDetailSelectionChange"
  318. style="width: 100%;">
  319. <el-table-column type="selection" align="center" width="50"></el-table-column>
  320. <el-table-column label="序号" align="center" prop="xh" width="50"></el-table-column>
  321. <el-table-column prop="samplingLocation" header-align="center" align="center" :required="true" label="抽样位置A" width="150">
  322. <template slot-scope="{row}">
  323. <el-input v-if="tableData[row.xh-1].isSubmit === 'Y'" v-model="tableData[row.xh-1].samplingLocation" readonly placeholder="请输入抽样位置A"></el-input>
  324. <el-input v-if="tableData[row.xh-1].isSubmit!='Y'" v-model="tableData[row.xh-1].samplingLocation" placeholder="请输入抽样位置A"></el-input>
  325. </template>
  326. </el-table-column>
  327. <el-table-column prop="samplingLocationB" header-align="center" align="center" :required="true" label="抽样位置B" width="150">
  328. <template slot-scope="{row}">
  329. <el-input v-if="tableData[row.xh-1].isSubmit === 'Y'" v-model="tableData[row.xh-1].samplingLocationB" readonly placeholder="请输入抽样位置B"></el-input>
  330. <el-input v-if="tableData[row.xh-1].isSubmit!='Y'" v-model="tableData[row.xh-1].samplingLocationB" placeholder="请输入抽样位置B"></el-input>
  331. </template>
  332. </el-table-column>
  333. <el-table-column prop="subDetailValue" header-align="center" align="center" :required="true" label="实测值" width="200">
  334. <template slot-scope="{row}">
  335. <el-input v-if="tableData[row.xh-1].isSubmit === 'Y'" v-model="tableData[row.xh-1].subDetailValue" readonly placeholder="请输入实测值"></el-input>
  336. <el-input :ref="`${row.xh-1}`" v-if="tableData[row.xh-1].isSubmit!='Y'" v-model="tableData[row.xh-1].subDetailValue" @keyup.enter.native="nextFocus(row.xh-1)" placeholder="请输入实测值"></el-input>
  337. </template>
  338. </el-table-column>
  339. </el-table>
  340. </div>
  341. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  342. <el-button type="primary" @click="saveSubDetailResult()">保存</el-button>
  343. <el-button type="primary" @click="subDetailFlag = false">关闭</el-button>
  344. </el-footer>
  345. </el-dialog>
  346. <!-- 批量新增子明细操作-->
  347. <el-dialog title="批量新增" :close-on-click-modal="false" v-drag :visible.sync="batchHandleAddModalFlag" width="510px">
  348. <el-form :inline="true" label-position="top">
  349. <el-form-item :label="'默认抽样位置A'">
  350. <el-input v-model="batchAddData.samplingLocation" style="width: 150px"></el-input>
  351. </el-form-item>
  352. <el-form-item :label="'默认抽样位置B'">
  353. <el-input v-model="batchAddData.samplingLocationB" style="width: 150px"></el-input>
  354. </el-form-item>
  355. <el-form-item :label="'抽样数量'">
  356. <el-input type="number" v-model="batchAddData.samplingNumber" style="width: 150px"></el-input>
  357. </el-form-item>
  358. </el-form>
  359. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  360. <el-button type="primary" @click="batchHandleAddModal()">保存</el-button>
  361. <el-button type="primary" @click="batchHandleAddModalFlag = false">关闭</el-button>
  362. </el-footer>
  363. </el-dialog>
  364. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  365. <!-- 上传文件的modal -->
  366. <qcFAIUploadFile ref="qcFAIUploadFile" @refreshPageTables="getDataList()" v-drag></qcFAIUploadFile>
  367. </div>
  368. </template>
  369. <script>
  370. import {
  371. qcIQCInspectionSearch, // IQC检验记录查询
  372. iqcDetailSearch, // iqc检验记录查询
  373. inspectorSearch, // 检验员查询
  374. selectIQCSubDetailedRecord, // 查询子明细记录
  375. checkIQCSubDetailValue, // 检查子明细中的实测值是否在规定范围
  376. saveIQCDetailedRecord, // 新增明细信息
  377. checkIQCIsSubmit, // 检查是否已提交
  378. saveIQCSubDetailed, // 新增子明细信息
  379. saveIQCSubmitResult, // 审核
  380. iqcRecordDelete, // 删除检验记录
  381. } from "@/api/qc/qc.js"
  382. import Chooselist from '@/views/modules/common/Chooselist_eam'
  383. import {getFileContentList, downLoadObjectFile} from '@/api/eam/eam_object_list.js';
  384. import {deleteObjectFile} from '@/api/eam/eam.js';
  385. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  386. import qcFAIUploadFile from "./qc_FAI_upload_file";
  387. import axios from 'axios'
  388. import Vue from 'vue'
  389. export default {
  390. components: {
  391. Chooselist,
  392. qcFAIUploadFile
  393. },
  394. watch: {
  395. },
  396. data () {
  397. return {
  398. // 是否收藏
  399. favorite: false,
  400. // 导出 start
  401. exportData: [],
  402. exportName: "IQC检验录入" + this.dayjs().format('YYYYMMDDHHmmss'),
  403. exportHeader: ["IQC检验录入"],
  404. exportFooter: [],
  405. exportList:[],
  406. // 导出 end
  407. submitData:{
  408. site: this.$store.state.user.site,
  409. inspectionNo: '',
  410. isQualified: '',
  411. isQualifiedChinese: '',
  412. submitList: [],
  413. },
  414. tagNo:'',
  415. searchData: {
  416. site: this.$store.state.user.site,
  417. inspectionNo: '',
  418. inspectionTypeNo:'105',
  419. isQualified: '',
  420. startDate: '',
  421. endDate: '',
  422. partNo:'',
  423. partDesc:'',
  424. state: '',
  425. page: 1,
  426. limit: 10,
  427. },
  428. pageIndex: 1,
  429. pageSize: 50,
  430. totalPage: 0,
  431. height: 200,
  432. dataList: [],
  433. dataListLoading: false,
  434. dataListSelections: [],
  435. submitFlag: false,
  436. modalData: {
  437. flag:'',
  438. functionType:'',
  439. site: this.$store.state.user.site,
  440. inspectionNo:'',
  441. workOrderNumber: '',
  442. workOrderQuantity: '',
  443. reelNumber: '',
  444. partNo: '',
  445. rollingQuantity: '',
  446. sampleQuantity: '',
  447. detailCodeNo:'',
  448. detailCodeDesc:'',
  449. inspectionTypeNo:'105',
  450. inspectionTypeName:'IQC',
  451. inspectorNo:'',
  452. inspectorName:'',
  453. isQualified:'',
  454. isQualifiedChinese:''
  455. },
  456. // 展示列集
  457. columnList: [
  458. {
  459. columnProp: 'inspectionNo',
  460. headerAlign: "center",
  461. align: "center",
  462. columnLabel: '检验单号',
  463. columnHidden: false,
  464. columnImage: false,
  465. columnSortable: false,
  466. sortLv: 0,
  467. status: true,
  468. fixed: '',
  469. },
  470. {
  471. columnProp: 'inspectionResult',
  472. headerAlign: "center",
  473. align: "center",
  474. columnLabel: '检验结论',
  475. columnHidden: false,
  476. columnImage: false,
  477. columnSortable: false,
  478. sortLv: 0,
  479. status: true,
  480. fixed: '',
  481. },
  482. {
  483. columnProp: 'taskDate',
  484. headerAlign: "center",
  485. align: "center",
  486. columnLabel: '任务生成日期',
  487. columnHidden: false,
  488. columnImage: false,
  489. columnSortable: false,
  490. sortLv: 0,
  491. status: true,
  492. fixed: '',
  493. },
  494. {
  495. columnProp: 'inspectionCycle',
  496. headerAlign: "center",
  497. align: "center",
  498. columnLabel: '检验周期(h)',
  499. columnHidden: false,
  500. columnImage: false,
  501. columnSortable: false,
  502. sortLv: 0,
  503. status: true,
  504. fixed: '',
  505. },
  506. {
  507. columnProp: 'rollNo',
  508. headerAlign: "center",
  509. align: "center",
  510. columnLabel: '标签条码',
  511. columnHidden: false,
  512. columnImage: false,
  513. columnSortable: false,
  514. sortLv: 0,
  515. status: true,
  516. fixed: '',
  517. },
  518. {
  519. columnProp: 'partNo',
  520. headerAlign: "center",
  521. align: "center",
  522. columnLabel: '物料编码',
  523. columnHidden: false,
  524. columnImage: false,
  525. columnSortable: false,
  526. sortLv: 0,
  527. status: true,
  528. fixed: '',
  529. },
  530. {
  531. columnProp: 'partDesc',
  532. headerAlign: "center",
  533. align: "center",
  534. columnLabel: '物料名称',
  535. columnHidden: false,
  536. columnImage: false,
  537. columnSortable: false,
  538. sortLv: 0,
  539. status: true,
  540. fixed: '',
  541. },
  542. {
  543. columnProp: 'rollQty',
  544. headerAlign: "center",
  545. align: "right",
  546. columnLabel: '送检数量',
  547. columnHidden: false,
  548. columnImage: false,
  549. columnSortable: false,
  550. sortLv: 0,
  551. status: true,
  552. fixed: '',
  553. },
  554. {
  555. columnProp: 'samplingQty',
  556. headerAlign: "center",
  557. align: "right",
  558. columnLabel: '抽样数量',
  559. columnHidden: false,
  560. columnImage: false,
  561. columnSortable: false,
  562. sortLv: 0,
  563. status: true,
  564. fixed: '',
  565. },
  566. {
  567. columnProp: 'poOrderNo',
  568. headerAlign: "center",
  569. align: "right",
  570. columnLabel: '单据号',
  571. columnHidden: false,
  572. columnImage: false,
  573. columnSortable: false,
  574. sortLv: 0,
  575. status: true,
  576. fixed: '',
  577. },
  578. {
  579. columnProp: 'poItemNo',
  580. headerAlign: "center",
  581. align: "right",
  582. columnLabel: '单据行号',
  583. columnHidden: false,
  584. columnImage: false,
  585. columnSortable: false,
  586. sortLv: 0,
  587. status: true,
  588. fixed: '',
  589. },
  590. {
  591. columnProp: 'supplierDesc',
  592. headerAlign: "center",
  593. align: "center",
  594. columnLabel: '供应商',
  595. columnHidden: false,
  596. columnImage: false,
  597. columnSortable: false,
  598. sortLv: 0,
  599. status: true,
  600. fixed: '',
  601. },
  602. {
  603. columnProp: 'inspectionRemark',
  604. headerAlign: "center",
  605. align: "center",
  606. columnLabel: '质检备注',
  607. columnHidden: false,
  608. columnImage: false,
  609. columnSortable: false,
  610. sortLv: 0,
  611. status: true,
  612. fixed: '',
  613. },
  614. {
  615. columnProp: 'disposalMeasures',
  616. headerAlign: "center",
  617. align: "center",
  618. columnLabel: '处置措施',
  619. columnHidden: false,
  620. columnImage: false,
  621. columnSortable: false,
  622. sortLv: 0,
  623. status: true,
  624. fixed: '',
  625. },
  626. {
  627. columnProp: 'disposalRemark',
  628. headerAlign: "center",
  629. align: "center",
  630. columnLabel: '处置说明',
  631. columnHidden: false,
  632. columnImage: false,
  633. columnSortable: false,
  634. sortLv: 0,
  635. status: true,
  636. fixed: '',
  637. },
  638. {
  639. columnProp: 'inspectorDate',
  640. headerAlign: "center",
  641. align: "center",
  642. columnLabel: '检验时间',
  643. columnHidden: false,
  644. columnImage: false,
  645. columnSortable: false,
  646. sortLv: 0,
  647. status: true,
  648. fixed: '',
  649. },
  650. {
  651. columnProp: 'inspectorNo',
  652. headerAlign: "center",
  653. align: "center",
  654. columnLabel: '质检员',
  655. columnHidden: false,
  656. columnImage: false,
  657. columnSortable: false,
  658. sortLv: 0,
  659. status: true,
  660. fixed: '',
  661. },
  662. ],
  663. detailColumnList: [
  664. {
  665. columnProp: 'itemDesc',
  666. headerAlign: "center",
  667. align: "center",
  668. columnLabel: '检验项目',
  669. columnHidden: false,
  670. columnImage: false,
  671. columnSortable: false,
  672. sortLv: 0,
  673. status: true,
  674. fixed: '',
  675. },
  676. {
  677. columnProp: 'samplingLevelDesc',
  678. headerAlign: "center",
  679. align: "center",
  680. columnLabel: '检验水平',
  681. columnHidden: false,
  682. columnImage: false,
  683. columnSortable: false,
  684. sortLv: 0,
  685. status: true,
  686. fixed: '',
  687. },
  688. {
  689. columnProp: 'samplingProgrammeDesc',
  690. headerAlign: "center",
  691. align: "center",
  692. columnLabel: '检验方案',
  693. columnHidden: false,
  694. columnImage: false,
  695. columnSortable: false,
  696. sortLv: 0,
  697. status: true,
  698. fixed: '',
  699. },
  700. {
  701. columnProp: 'objectDesc',
  702. headerAlign: "center",
  703. align: "center",
  704. columnLabel: '检测仪器',
  705. columnHidden: false,
  706. columnImage: false,
  707. columnSortable: false,
  708. sortLv: 0,
  709. status: true,
  710. fixed: '',
  711. },
  712. {
  713. columnProp: 'aql',
  714. headerAlign: "center",
  715. align: "center",
  716. columnLabel: 'AQL',
  717. columnHidden: false,
  718. columnImage: false,
  719. columnSortable: false,
  720. sortLv: 0,
  721. status: true,
  722. fixed: '',
  723. },
  724. {
  725. columnProp: 'ac',
  726. headerAlign: "center",
  727. align: "center",
  728. columnLabel: 'AC',
  729. columnHidden: false,
  730. columnImage: false,
  731. columnSortable: false,
  732. sortLv: 0,
  733. status: true,
  734. fixed: '',
  735. },
  736. {
  737. columnProp: 're',
  738. headerAlign: "center",
  739. align: "center",
  740. columnLabel: 'RE',
  741. columnHidden: false,
  742. columnImage: false,
  743. columnSortable: false,
  744. sortLv: 0,
  745. status: true,
  746. fixed: '',
  747. },
  748. {
  749. columnProp: 'defaultValue',
  750. headerAlign: "center",
  751. align: "center",
  752. columnLabel: '标准值',
  753. columnHidden: false,
  754. columnImage: false,
  755. columnSortable: false,
  756. sortLv: 0,
  757. status: true,
  758. fixed: '',
  759. },
  760. {
  761. columnProp: 'maxValue',
  762. headerAlign: "center",
  763. align: "center",
  764. columnLabel: '最大值',
  765. columnHidden: false,
  766. columnImage: false,
  767. columnSortable: false,
  768. sortLv: 0,
  769. status: true,
  770. fixed: '',
  771. },
  772. {
  773. columnProp: 'minValue',
  774. headerAlign: "center",
  775. align: "center",
  776. columnLabel: '最小值',
  777. columnHidden: false,
  778. columnImage: false,
  779. columnSortable: false,
  780. sortLv: 0,
  781. status: true,
  782. fixed: '',
  783. },
  784. {
  785. columnProp: 'valueType',
  786. headerAlign: "center",
  787. align: "center",
  788. columnLabel: '检测值类型',
  789. columnHidden: false,
  790. columnImage: false,
  791. columnSortable: false,
  792. sortLv: 0,
  793. status: true,
  794. fixed: '',
  795. },
  796. ],
  797. fileColumnList: [
  798. {
  799. columnProp: 'fileName',
  800. headerAlign: "center",
  801. align: "center",
  802. columnLabel: '文件名称',
  803. columnHidden: false,
  804. columnImage: false,
  805. columnSortable: false,
  806. sortLv: 0,
  807. status: true,
  808. fixed: '',
  809. },
  810. {
  811. columnProp: 'createdBy',
  812. headerAlign: "center",
  813. align: 'center',
  814. columnLabel: '上传人',
  815. columnHidden: false,
  816. columnImage: false,
  817. columnSortable: true,
  818. sortLv: 0,
  819. status: true,
  820. fixed: false
  821. },
  822. {
  823. columnProp: 'createDate',
  824. headerAlign: "center",
  825. align: 'center',
  826. columnLabel: '上传时间',
  827. columnHidden: false,
  828. columnImage: false,
  829. columnSortable: true,
  830. sortLv: 0,
  831. status: true,
  832. fixed: false
  833. },
  834. {
  835. columnProp: 'orderRef3',
  836. headerAlign: "center",
  837. align: 'center',
  838. columnLabel: '备注',
  839. columnHidden: false,
  840. columnImage: false,
  841. columnSortable: true,
  842. sortLv: 0,
  843. status: true,
  844. fixed: false
  845. },
  846. ],
  847. detailData:{
  848. site: this.$store.state.user.site,
  849. inspectionNo: '',
  850. partNo: '',
  851. partDesc: '',
  852. rollQty: '',
  853. samplingQty: '',
  854. unqualifiedQty: 0,
  855. unqualifiedQuantity: '',
  856. disposalMeasures: '',
  857. disposalRemark: '',
  858. inspectionResult: '',
  859. inspectorNo: '',
  860. inspectionRemark: '',
  861. submitFlag: '',
  862. supplierNo: '',
  863. },
  864. detailInformationFlag: false,
  865. detailList:[],
  866. saveInformationData:{
  867. site: this.$store.state.user.site,
  868. inspectionNo:'',
  869. disposalMeasures: '',
  870. disposalRemark: '',
  871. inspectorNo: '',
  872. inspectionRemark: '',
  873. itemList:[],
  874. },
  875. // 子明细数据对象
  876. tableData: [],
  877. checkedDetail: [],
  878. subDetailFlag: false,
  879. subDetailData: {
  880. site: this.$store.state.user.site,
  881. inspectionNo: '',
  882. itemNo: '',
  883. itemDesc: '',
  884. defaultValue: '',
  885. maxValue: '',
  886. minValue: '',
  887. subDetailValues:[]
  888. },
  889. options: [],
  890. fileFlag: false,
  891. fileContentList: [],
  892. IQCSelections: [],
  893. batchHandleAddModalFlag: false,
  894. batchAddData: {
  895. samplingLocation: '',
  896. samplingLocationB: '',
  897. samplingNumber: ''
  898. }
  899. }
  900. },
  901. mounted () {
  902. this.$nextTick(() => {
  903. this.height = window.innerHeight - 210
  904. })
  905. },
  906. created () {
  907. this.getDataList()
  908. this.favoriteIsOk()
  909. },
  910. methods: {
  911. selectFlag(){
  912. return true;
  913. },
  914. // 单机选中
  915. IQCClickRow(row){
  916. this.$refs.IQCTable.toggleRowSelection(row);
  917. },
  918. // 复选
  919. selectionIQC(val){
  920. this.IQCSelections = val
  921. },
  922. //刷新派设备文档的列表
  923. getFileContentData(row) {
  924. let currentData = {
  925. orderRef1: row.site,
  926. orderRef2: row.inspectionNo
  927. };
  928. getFileContentList(currentData).then(({data}) => {
  929. //区分请求成功和失败的状况
  930. if (data && data.code === 200) {
  931. this.fileContentList = data.rows;
  932. } else {
  933. this.fileContentList = [];
  934. }
  935. })
  936. this.fileFlag = true;
  937. },
  938. /*新增文件的modal*/
  939. addUploadFileModal(){
  940. let currentData = {
  941. titleCon: 'IQC文件上传',
  942. site: this.$store.state.user.site,
  943. createBy: this.$store.state.user.name,
  944. inspectionNo: this.detailData.inspectionNo,
  945. remark: '',
  946. folder: 'qcIQC',
  947. };
  948. //打开组件 去做新增业务
  949. this.$nextTick(() => {
  950. this.$refs.qcFAIUploadFile.init(currentData);
  951. })
  952. },
  953. downloadFile(row){
  954. downLoadObjectFile(row)
  955. .then(({data}) => {
  956. // 不限制文件下载类型
  957. const blob = new Blob([data], {type: "application/octet-stream"})
  958. // 下载文件名称
  959. const fileName = row.fileName
  960. // a标签下载
  961. const linkNode = document.createElement('a')
  962. // a标签的download属性规定下载文件的名称
  963. linkNode.download = fileName
  964. linkNode.style.display = 'none'
  965. // 生成一个Blob URL
  966. linkNode.href = URL.createObjectURL(blob)
  967. document.body.appendChild(linkNode)
  968. // 模拟在按钮上的一次鼠标单击
  969. linkNode.click()
  970. // 释放URL 对象
  971. URL.revokeObjectURL(linkNode.href)
  972. document.body.removeChild(linkNode)
  973. })
  974. },
  975. // 删除文件
  976. deleteFile(row){
  977. let tempData = {
  978. site: row.orderRef1,
  979. inspectionNo: row.orderRef2
  980. }
  981. this.$confirm('确定要删除此文件?', '提示', {
  982. confirmButtonText: '确定',
  983. cancelButtonText: '取消',
  984. type: 'warning'
  985. }).then(() => {
  986. deleteObjectFile(row).then(({data}) => {
  987. if (data && data.code == 0) {
  988. this.getFileContentData(tempData);
  989. this.$message({
  990. message: '操作成功',
  991. type: 'success',
  992. duration: 1500,
  993. onClose: () => {
  994. }
  995. })
  996. } else {
  997. this.$alert(data.msg, '错误', {
  998. confirmButtonText: '确定'
  999. })
  1000. }
  1001. })
  1002. }).catch(() => {
  1003. })
  1004. },
  1005. // 获取基础数据列表S
  1006. getBaseList (val,type) {
  1007. this.tagNo = val
  1008. this.$nextTick(() => {
  1009. let strVal = ''
  1010. if (val === 1037) {
  1011. strVal = this.modalData.detailCodeNo
  1012. this.$refs.baseList.init(val, strVal)
  1013. }
  1014. if (val === 1040) {
  1015. strVal = this.modalData.inspectorNo
  1016. this.$refs.baseList.init(val, strVal)
  1017. }
  1018. })
  1019. },
  1020. /* 列表方法的回调 */
  1021. getBaseData (val) {
  1022. if (this.tagNo === 1037) {
  1023. this.modalData.detailCodeNo = val.code_no
  1024. this.modalData.detailCodeDesc = val.code_desc
  1025. }
  1026. if (this.tagNo === 1040) {
  1027. this.modalData.inspectorNo = val.inspector_no
  1028. this.modalData.inspectorName = val.inspector_name
  1029. }
  1030. },
  1031. // 获取主信息数据列表
  1032. getDataList () {
  1033. this.searchData.limit = this.pageSize
  1034. this.searchData.page = this.pageIndex
  1035. qcIQCInspectionSearch(this.searchData).then(({data}) => {
  1036. if (data.code === 0) {
  1037. this.dataList = data.page.list
  1038. this.pageIndex = data.page.currPage
  1039. this.pageSize = data.page.pageSize
  1040. this.totalPage = data.page.totalCount
  1041. }
  1042. this.dataListLoading = false
  1043. })
  1044. },
  1045. // 每页数
  1046. sizeChangeHandle (val) {
  1047. this.pageSize = val
  1048. this.pageIndex = 1
  1049. this.getDataList()
  1050. },
  1051. // 当前页
  1052. currentChangeHandle (val) {
  1053. this.pageIndex = val
  1054. this.getDataList()
  1055. },
  1056. // 多选
  1057. selectionChangeHandle (val) {
  1058. this.dataListSelections = val
  1059. },
  1060. // 查询检验类型
  1061. inspectorSearch(){
  1062. inspectorSearch().then(({data}) => {
  1063. if (data.code === 0) {
  1064. this.options = data.rows
  1065. }
  1066. })
  1067. },
  1068. async Transfer(){
  1069. if (this.detailData.inspectionResult === '' || this.detailData.inspectionResult == null) {
  1070. this.$message.warning('请选择检验结论!')
  1071. return
  1072. }
  1073. if (this.detailData.inspectorNo === '' || this.detailData.inspectorNo == null) {
  1074. this.$message.warning('请选择检验员!')
  1075. return
  1076. }
  1077. // if (this.detailData.inspectionResult == 'Y' && (this.detailData.disposalMeasures == '特采' || this.detailData.disposalMeasures == '拒收')) {
  1078. // this.$alert('合格不予处置措施,请查看!', '错误', {
  1079. // confirmButtonText: '确定'
  1080. // })
  1081. // return false
  1082. // }
  1083. let num = 0 // 记录结论为不合格的项目数
  1084. for (let i = 0; i < this.detailList.length; i++) {
  1085. if(this.detailList[i].valueTypeDb === 'N') { // 如果检验值类型为数字
  1086. await checkIQCSubDetailValue(this.detailList[i]).then(({data}) => {
  1087. if (data.flag === 2 && this.detailList[i].itemResult === 'Y') { // 如果项目实测值超出范围且项目结论为合格
  1088. this.detailList[i].itemResult = 'N'
  1089. num = num + 1
  1090. }
  1091. })
  1092. }
  1093. if(this.detailList[i].itemResult === '' || this.detailList[i].itemResult == null){ // 默认结论为合格
  1094. this.detailList[i].itemResult = 'Y'
  1095. }
  1096. }
  1097. if (this.detailData.inspectionResult === '合格' && num > 0){
  1098. this.$confirm('存在不合格项目,是否将检验记录保存为合格', '提示', {
  1099. confirmButtonText: '确定',
  1100. cancelButtonText: '取消',
  1101. type: 'warning'
  1102. }).then(() => {
  1103. this.saveDetailInformation()
  1104. })
  1105. }else {
  1106. this.saveDetailInformation()
  1107. }
  1108. },
  1109. // 新增明细信息
  1110. saveDetailInformation(){
  1111. this.saveInformationData.inspectionNo = this.detailData.inspectionNo
  1112. this.saveInformationData.disposalMeasures = this.detailData.disposalMeasures
  1113. this.saveInformationData.disposalRemark = this.detailData.disposalRemark
  1114. this.saveInformationData.inspectorNo = this.detailData.inspectorNo
  1115. this.saveInformationData.inspectionResult = this.detailData.inspectionResult
  1116. this.saveInformationData.inspectionRemark = this.detailData.inspectionRemark
  1117. this.saveInformationData.itemList = JSON.parse(JSON.stringify(this.detailList))
  1118. saveIQCDetailedRecord(this.saveInformationData).then(({data}) => {
  1119. if (data && data.code === 0) {
  1120. this.getDataList()
  1121. this.detailInformationFlag = false
  1122. this.$message({
  1123. message: '操作成功',
  1124. type: 'success',
  1125. duration: 1500,
  1126. onClose: () => {}
  1127. })
  1128. } else {
  1129. this.$alert(data.msg, '错误', {
  1130. confirmButtonText: '确定'
  1131. })
  1132. }
  1133. })
  1134. },
  1135. // 明细记录信息查询
  1136. detailModal(row){
  1137. this.detailData.site = this.$store.state.user.site
  1138. this.detailData.inspectionNo = row.inspectionNo
  1139. this.detailData.partNo = row.partNo
  1140. this.detailData.partDesc = row.partDesc
  1141. this.detailData.rollQty = row.rollQty
  1142. this.detailData.samplingQty = row.samplingQty
  1143. this.detailData.unqualifiedQty = row.unqualifiedQty
  1144. this.detailData.unqualifiedQuantity = row.unqualifiedQuantity
  1145. this.detailData.submitFlag = row.submitFlag
  1146. this.detailData.disposalMeasures = row.disposalMeasures
  1147. this.detailData.disposalRemark = row.disposalRemark
  1148. this.detailData.inspectionResult = row.inspectionResult
  1149. this.detailData.inspectorNo = row.inspectorNo
  1150. this.detailData.inspectionRemark = row.inspectionRemark
  1151. iqcDetailSearch(this.detailData).then(({data}) => {
  1152. this.detailList = data.rows
  1153. })
  1154. this.inspectorSearch();
  1155. this.detailInformationFlag = true;
  1156. },
  1157. // 子明细记录信息查询
  1158. subDetailModal(row){
  1159. this.subDetailData.inspectionNo = row.inspectionNo;
  1160. this.subDetailData.itemNo = row.itemNo;
  1161. this.subDetailData.itemDesc = row.itemDesc;
  1162. this.subDetailData.defaultValue = row.defaultValue;
  1163. this.subDetailData.maxValue = row.maxValue;
  1164. this.subDetailData.minValue = row.minValue;
  1165. selectIQCSubDetailedRecord(this.subDetailData).then(({data}) => {
  1166. this.tableData = data.rows
  1167. })
  1168. this.batchAddData = {
  1169. samplingLocation: '',
  1170. samplingLocationB: '',
  1171. samplingNumber: ''
  1172. }
  1173. this.subDetailFlag = true
  1174. },
  1175. // 删除检验记录
  1176. deleteModal () {
  1177. if(this.IQCSelections.length === 0){
  1178. this.$message.warning('请勾选要删除的检验单!')
  1179. return
  1180. }
  1181. this.$confirm(`是否删除该 `+ this.IQCSelections.length +` 条检验记录?`, '提示', {
  1182. confirmButtonText: '确定',
  1183. cancelButtonText: '取消',
  1184. type: 'warning'
  1185. }).then(() => {
  1186. let tempData = {
  1187. site: this.$store.state.user.site,
  1188. submitList: this.IQCSelections
  1189. }
  1190. iqcRecordDelete(tempData).then(({data}) => {
  1191. if (data && data.code === 0) {
  1192. this.getDataList()
  1193. this.IQCSelections = []
  1194. this.$message({
  1195. message: '操作成功',
  1196. type: 'success',
  1197. duration: 1500,
  1198. onClose: () => {
  1199. }
  1200. })
  1201. } else {
  1202. this.$alert(data.msg, '错误', {
  1203. confirmButtonText: '确定'
  1204. })
  1205. }
  1206. })
  1207. }).catch(() => {
  1208. })
  1209. },
  1210. // 审核按钮
  1211. submitResult(){
  1212. let tempData1 = '' // 记录不是待审核状态的单号
  1213. let tempData2 = '' // 记录处置措施未填写的单号
  1214. if(this.IQCSelections.length === 0){
  1215. this.$message.warning('请勾选要审核的检验单!')
  1216. return
  1217. }
  1218. for (let i = 0; i < this.IQCSelections.length; i++) {
  1219. if (this.IQCSelections[i].state != '待审核'){
  1220. tempData1 = tempData1 + this.IQCSelections[i].inspectionNo + '、'
  1221. }
  1222. if (this.IQCSelections[i].inspectionResult === '不合格' && (this.IQCSelections[i].disposalMeasures === '' || this.IQCSelections[i].disposalMeasures == null)){
  1223. tempData2 = tempData2 + this.IQCSelections[i].inspectionNo + '、'
  1224. }
  1225. }
  1226. if (tempData1 != ''){
  1227. tempData1 = tempData1.substring(0, tempData1.length - 1)
  1228. this.$message.warning('检验单号 ' + tempData1 + ' 不是待审核状态!')
  1229. return
  1230. }
  1231. if (tempData2 != ''){
  1232. tempData2 = tempData2.substring(0, tempData2.length - 1)
  1233. this.$message.warning('检验单号 ' + tempData2 + ' 的处置措施未选择!')
  1234. return
  1235. }
  1236. // this.submitData.site = row.site
  1237. // this.submitData.inspectionNo = row.inspectionNo
  1238. // this.submitData.inspectionResult = row.inspectionResult
  1239. // if (row.inspectionResult == '不合格' && (row.disposalMeasures == '' || row.disposalMeasures == null)){
  1240. // this.$alert('处置措施未选择!', '错误', {
  1241. // confirmButtonText: '确定'
  1242. // })
  1243. // return false
  1244. // }
  1245. this.$confirm(`已确认单据信息无误,确定审核该 ` + this.IQCSelections.length + ` 条记录`, '提示', {
  1246. confirmButtonText: '确定',
  1247. cancelButtonText: '取消',
  1248. type: 'warning'
  1249. }).then(() => {
  1250. this.submitData.submitList = this.IQCSelections
  1251. saveIQCSubmitResult(this.submitData).then(({data}) => {
  1252. if (data && data.code === 0) {
  1253. this.getDataList()
  1254. this.IQCSelections = []
  1255. this.$message({
  1256. message: '操作成功',
  1257. type: 'success',
  1258. duration: 1500,
  1259. onClose: () => {}
  1260. })
  1261. } else {
  1262. this.$alert(data.msg, '错误', {
  1263. confirmButtonText: '确定'
  1264. })
  1265. }
  1266. })
  1267. }).catch(() => {
  1268. })
  1269. },
  1270. // 子明细方法
  1271. // 表格的新增
  1272. rowClassName({ row, rowIndex }) {
  1273. row.xh = rowIndex + 1;
  1274. },
  1275. // 单选框选中数据
  1276. handleDetailSelectionChange(selection) {
  1277. this.checkedDetail = selection;
  1278. },
  1279. // 点击新增更多
  1280. handleAddBtn (td) {
  1281. checkIQCIsSubmit(td).then(({data}) => {
  1282. if (data.flag != 1) {
  1283. let obj = {};
  1284. obj.subDetailValue = "";
  1285. obj.samplingLocation = "";
  1286. this.tableData.push(obj);
  1287. } else {
  1288. this.$alert("记录已提交!", '错误', {
  1289. confirmButtonText: '确定'
  1290. })
  1291. }
  1292. })
  1293. },
  1294. // 批量新增操作
  1295. batchHandleAdd (td) {
  1296. checkIQCIsSubmit(td).then(({data}) => {
  1297. if (data.flag != 1) {
  1298. this.batchHandleAddModalFlag = true
  1299. } else {
  1300. this.$alert("记录已提交!", '错误', {
  1301. confirmButtonText: '确定'
  1302. })
  1303. }
  1304. })
  1305. },
  1306. // 批量新增行
  1307. batchHandleAddModal () {
  1308. for (let i = 0; i < this.batchAddData.samplingNumber; i++) {
  1309. let obj = {}
  1310. obj.samplingLocation = this.batchAddData.samplingLocation
  1311. obj.samplingLocationB = this.batchAddData.samplingLocationB
  1312. obj.subDetailValue = ""
  1313. this.tableData.push(obj)
  1314. }
  1315. this.batchHandleAddModalFlag = false
  1316. },
  1317. // 回车事件
  1318. nextFocus(index) {
  1319. let aaa = `${index + 1}`
  1320. this.$nextTick(() => {
  1321. this.$refs[aaa].focus()
  1322. })
  1323. },
  1324. //删除
  1325. handleDeleteBtn(td) {
  1326. checkIQCIsSubmit(td).then(({data}) => {
  1327. if (data.flag != 1) {
  1328. if (this.checkedDetail.length === 0) {
  1329. this.$alert("请先选择要删除的数据", "提示", {
  1330. confirmButtonText: "确定",
  1331. })
  1332. } else {
  1333. this.$confirm("请是否确认删除该子明细记录?", "提示", {
  1334. confirmButtonText: "确定",
  1335. cancelButtonText: "取消",
  1336. type: "warning",
  1337. callback: (action) => {
  1338. if (action === "confirm") {
  1339. let val = this.checkedDetail;
  1340. val.forEach((val, index) => {
  1341. this.tableData.forEach((v, i) => {
  1342. if (val.xh === v.xh) {
  1343. this.tableData.splice(i, 1);
  1344. }
  1345. });
  1346. });
  1347. this.$message({
  1348. message: "删除成功!",
  1349. type: "success",
  1350. });
  1351. return;
  1352. } else {
  1353. this.$message({
  1354. message: "已取消删除操作",
  1355. type: "warning",
  1356. });
  1357. return;
  1358. }
  1359. },
  1360. });
  1361. }
  1362. } else {
  1363. this.$alert("记录已提交!", '错误', {
  1364. confirmButtonText: '确定'
  1365. })
  1366. }
  1367. })
  1368. },
  1369. // 新增子明细记录
  1370. saveSubDetailResult(){
  1371. for (let i = 0; i < this.tableData.length; i++) {
  1372. if(this.tableData[i].subDetailValue === '' || this.tableData[i].subDetailValue == null){
  1373. this.$message.warning('序号' + (i+1) +'未填写实测值!')
  1374. return
  1375. }
  1376. }
  1377. this.subDetailData.subDetailValues = this.tableData
  1378. saveIQCSubDetailed(this.subDetailData).then(({data}) => {
  1379. if (data && data.code === 0) {
  1380. iqcDetailSearch(this.detailData).then(({data}) => {
  1381. this.detailList = data.rows
  1382. })
  1383. this.subDetailFlag = false
  1384. this.tableData = []
  1385. this.$message({
  1386. message: '操作成功',
  1387. type: 'success',
  1388. duration: 1500,
  1389. onClose: () => {}
  1390. })
  1391. } else {
  1392. this.$alert(data.msg, '错误', {
  1393. confirmButtonText: '确定'
  1394. })
  1395. }
  1396. })
  1397. },
  1398. // 校验用户是否收藏
  1399. favoriteIsOk() {
  1400. let userFavorite = {
  1401. userId: this.$store.state.user.id,
  1402. languageCode: this.$i18n.locale
  1403. }
  1404. userFavoriteList(userFavorite).then(({data}) => {
  1405. for (let i = 0; i < data.list.length; i++) {
  1406. if(this.$route.meta.menuId == data.list[i].menuId){
  1407. this.favorite = true
  1408. }
  1409. }
  1410. })
  1411. },
  1412. // 收藏 OR 取消收藏
  1413. favoriteFunction() {
  1414. let userFavorite = {
  1415. userId: this.$store.state.user.id,
  1416. functionId: this.$route.meta.menuId,
  1417. }
  1418. if (this.favorite) {
  1419. removeUserFavorite(userFavorite).then(({data}) => {
  1420. this.$message.success(data.msg)
  1421. this.favorite = false
  1422. })
  1423. } else {
  1424. // 收藏
  1425. saveUserFavorite(userFavorite).then(({data}) => {
  1426. this.$message.success(data.msg)
  1427. this.favorite = true
  1428. })
  1429. }
  1430. },
  1431. //导出excel
  1432. async createExportData() {
  1433. this.searchData.limit = -1
  1434. this.searchData.page = 1
  1435. await qcIQCInspectionSearch(this.searchData).then(({data}) => {
  1436. this.exportList= data.page.list;
  1437. })
  1438. return this.exportList;
  1439. },
  1440. startDownload() {
  1441. },
  1442. finishDownload() {
  1443. },
  1444. fields() {
  1445. let json = "{"
  1446. this.columnList.forEach((item, index) => {
  1447. if (index == this.columnList.length - 1) {
  1448. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  1449. } else {
  1450. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  1451. }
  1452. })
  1453. json += "}"
  1454. let s = eval("(" + json + ")")
  1455. return s
  1456. },
  1457. // 导出 end
  1458. }
  1459. }
  1460. </script>
  1461. <style scoped>
  1462. </style>