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.

2641 lines
92 KiB

6 days ago
6 days ago
6 days ago
1 week ago
4 days ago
6 days ago
1 week ago
1 week ago
6 days ago
2 weeks ago
1 week ago
6 days ago
6 days ago
6 days ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 条件查询 -->
  4. <el-form :inline="true" label-position="top" :model="searchData">
  5. <!-- <el-form-item :label="'BU'">
  6. <el-select v-model="searchData.buDesc" placeholder="请选择" clearable style="width: 80px">
  7. <el-option
  8. v-for = "i in userBuList"
  9. :key = "i.buNo"
  10. :label = "i.buDesc"
  11. :value = "i.buDesc">
  12. </el-option>
  13. </el-select>
  14. </el-form-item> -->
  15. <el-form-item :label="'物料编码'">
  16. <el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
  17. </el-form-item>
  18. <el-form-item :label="'SKU'">
  19. <el-input v-model="searchData.sku" clearable style="width: 120px"></el-input>
  20. </el-form-item>
  21. <el-form-item :label="'物料名称'">
  22. <el-input v-model="searchData.partDesc" clearable style="width: 200px"></el-input>
  23. </el-form-item>
  24. <!-- <el-form-item :label="'PN'">
  25. <el-input v-model="searchData.cinvSourceCode" clearable style="width: 120px"></el-input>
  26. </el-form-item> -->
  27. <el-form-item :label="'类别名称'">
  28. <el-input v-model="searchData.familyName" clearable style="width: 120px"></el-input>
  29. </el-form-item>
  30. <el-form-item :label="' '">
  31. <el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
  32. <el-button v-if="!authSave" type="primary" @click="addModal()">新增</el-button>
  33. </el-form-item>
  34. <el-form-item :label="' '">
  35. <!-- <el-button type="primary" icon="el-icon-upload" @click="qcUpload()">导入</el-button>-->
  36. <download-excel
  37. :fields="fields()"
  38. :data="exportData"
  39. type="xls"
  40. :name="exportName"
  41. :header="exportHeader"
  42. :footer="exportFooter"
  43. :fetch="createExportData"
  44. :before-generate="startDownload"
  45. :before-finish="finishDownload"
  46. worksheet="导出信息"
  47. class="el-button el-button--primary el-button--medium">
  48. {{ "导出" }}
  49. </download-excel>
  50. </el-form-item>
  51. </el-form>
  52. <!-- 展示列表 -->
  53. <el-table
  54. :height="height"
  55. :data="dataList"
  56. border
  57. style="width: 100%;">
  58. <el-table-column
  59. v-for="(item,index) in columnList" :key="index"
  60. :sortable="item.columnSortable"
  61. :prop="item.columnProp"
  62. :header-align="item.headerAlign"
  63. :show-overflow-tooltip="item.showOverflowTooltip"
  64. :align="item.align"
  65. :fixed="item.fixed === ''?false:item.fixed"
  66. :min-width="item.columnWidth"
  67. :label="item.columnLabel">
  68. <template slot-scope="scope">
  69. <span v-if="!item.columnHidden">
  70. <span v-if="columnsProp.includes(item.columnProp)">{{ scope.row[`${item.columnProp}Desc`] }}</span>
  71. <span v-else>
  72. {{ scope.row[item.columnProp] }}
  73. </span>
  74. </span>
  75. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. fixed="right"
  80. header-align="center"
  81. align="center"
  82. width="240"
  83. label="操作">
  84. <template slot-scope="scope">
  85. <a v-if="!authDetail" type="text" size="small" @click="detailModal(scope.row)">检验模板</a>
  86. <a v-if="!authUpdate" type="text" size="small" @click="updateModal(scope.row)">编辑</a>
  87. <a v-if="!authDelete" type="text" size="small" @click="deletePropertiesModel(scope.row)">删除</a>
  88. <!-- <a type="text" size="small" @click="sopFileList(scope.row)">SOP文件</a>-->
  89. <a type="text" size="small" @click="openPartSopFileList(scope.row)">物料SOP</a>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <!-- 分页栏 -->
  94. <el-pagination
  95. @size-change="sizeChangeHandle"
  96. @current-change="currentChangeHandle"
  97. :current-page="pageIndex"
  98. :page-sizes="[20, 50, 100, 200, 500]"
  99. :page-size="pageSize"
  100. :total="totalPage"
  101. layout="total, sizes, prev, pager, next, jumper">
  102. </el-pagination>
  103. <!-- 物料属性新增/修改 -->
  104. <el-dialog title="物料属性设置" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="430px">
  105. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  106. <!-- <el-form-item label="BU" prop="bu" :rules="rules.bu">
  107. <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 295px">
  108. <el-option
  109. v-for = "i in userBuList"
  110. :key = "i.buNo"
  111. :label = "i.sitename"
  112. :value = "i.buNo">
  113. <span style="float: left;width: 100px">{{ i.sitename }}</span>
  114. <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
  115. {{ i.buDesc }}
  116. </span>
  117. </el-option>
  118. </el-select>
  119. </el-form-item> -->
  120. <!-- <el-form-item style="margin-top: 23px;margin-left: 2px">-->
  121. <!-- <el-checkbox v-model="modalData.exemptInspection" true-label="Y">是否免检</el-checkbox><br>-->
  122. <!-- </el-form-item>-->
  123. </el-form>
  124. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  125. <el-form-item prop="partNo" :rules="rules.partNoType">
  126. <span v-if="modalDisableFlag === false" slot="label" @click="searchPartInfo()"><a herf="#">物料编码:</a></span>
  127. <span v-if="modalDisableFlag === true" slot="label">物料编码:</span>
  128. <el-input v-model="modalData.partNo" :disabled="modalDisableFlag" style="width: 120px"></el-input>
  129. </el-form-item>
  130. <el-form-item label="物料名称:" prop="partDesc" :rules="rules.partDescType">
  131. <el-input v-model="modalData.partDesc" disabled style="width: 250px"></el-input>
  132. </el-form-item>
  133. </el-form>
  134. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  135. <el-form-item label="备注:">
  136. <el-input v-model="modalData.attributeRemark" style="width: 385px"></el-input>
  137. </el-form-item>
  138. <!-- <el-form-item label="是否免检">-->
  139. <!-- <input type="checkbox" value="Y" name="isExemptInspection" v-model="modalData.exemptInspection"/>-->
  140. <!-- </el-form-item>-->
  141. </el-form>
  142. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  143. <el-button type="primary" @click="saveData()">保存</el-button>
  144. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  145. </el-footer>
  146. </el-dialog>
  147. <!-- 检验模板 -->
  148. <el-dialog title="检验模板清单" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="1400px">
  149. <el-form :inline="true" label-position="top">
  150. <el-form-item :label="'物料编码'">
  151. <el-input v-model="detailData.partNo" readonly style="width: 120px"></el-input>
  152. </el-form-item>
  153. <el-form-item :label="'物料名称'">
  154. <el-input v-model="detailData.partDesc" readonly style="width: 300px"></el-input>
  155. </el-form-item>
  156. <el-form-item :label="' '">
  157. <el-button type="primary" @click="addFastModal()">新增</el-button>
  158. </el-form-item>
  159. </el-form>
  160. <!-- 检验项目展示列表 -->
  161. <div class="rq ">
  162. <el-table
  163. :height="300"
  164. :data="detailList"
  165. border
  166. style="width: 100%;">
  167. <el-table-column
  168. v-for="(item,index) in columnDetailList" :key="index"
  169. :sortable="item.columnSortable"
  170. :prop="item.columnProp"
  171. :header-align="item.headerAlign"
  172. :show-overflow-tooltip="item.showOverflowTooltip"
  173. :align="item.align"
  174. :fixed="item.fixed===''?false:item.fixed"
  175. :min-width="item.columnWidth"
  176. :label="item.columnLabel">
  177. <template slot-scope="scope">
  178. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  179. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  180. </template>
  181. </el-table-column>
  182. <el-table-column
  183. prop=""
  184. header-align="center"
  185. align="center"
  186. min-width="170"
  187. label="检验水平">
  188. <template slot-scope="scope">
  189. <el-button type="primary" @click="chooseLevel(scope.row)" style="width:18%;padding: 3px 7px">·&nbsp;·&nbsp;·</el-button>
  190. <el-input v-model="scope.row.samplingLevelDesc" readonly style="width:77%"></el-input>
  191. </template>
  192. </el-table-column>
  193. <el-table-column
  194. prop=""
  195. header-align="center"
  196. align="center"
  197. min-width="60"
  198. label="检验周期(h)">
  199. <template slot-scope="scope">
  200. <el-input v-model="scope.row.inspectionCycle" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  201. </template>
  202. </el-table-column>
  203. <el-table-column
  204. prop=""
  205. header-align="center"
  206. align="center"
  207. min-width="170"
  208. label="抽样方案">
  209. <template slot-scope="scope">
  210. <el-button type="primary" @click="chooseProgrammeRow(scope.row)" style="width:18%;padding: 3px 7px" >·&nbsp;·&nbsp;·</el-button>
  211. <el-input v-model="scope.row.samplingProgrammeDesc" readonly style="width:77%"></el-input>
  212. </template>
  213. </el-table-column>
  214. <!-- <el-table-column
  215. prop=""
  216. header-align="center"
  217. align="center"
  218. min-width="60"
  219. label="AQL">
  220. <template slot-scope="scope">
  221. <el-input v-model="scope.row.aql" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  222. </template>
  223. </el-table-column>
  224. <el-table-column
  225. prop=""
  226. header-align="center"
  227. align="center"
  228. min-width="60"
  229. label="AC">
  230. <template slot-scope="scope">
  231. <el-input v-model="scope.row.ac" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  232. </template>
  233. </el-table-column>
  234. <el-table-column
  235. prop=""
  236. header-align="center"
  237. align="center"
  238. min-width="60"
  239. label="RE">
  240. <template slot-scope="scope">
  241. <el-input v-model="scope.row.re" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  242. </template>
  243. </el-table-column> -->
  244. <el-table-column
  245. prop="templateRemark"
  246. header-align="center"
  247. align="center"
  248. label="备注">
  249. </el-table-column>
  250. <el-table-column
  251. fixed="right"
  252. header-align="center"
  253. align="center"
  254. width="150"
  255. label="操作">
  256. <template slot-scope="scope">
  257. <a type="text" size="small" style="margin-right: 8px" @click="inspectionStandardListModal(scope.row)">检验标准</a>
  258. <a type="text" size="small" @click="deletePartAttributeDetails(scope.row)">删除模板</a>
  259. </template>
  260. </el-table-column>
  261. </el-table>
  262. </div>
  263. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  264. <el-button type="primary" @click="saveDetail()">保存</el-button>
  265. <el-button type="primary" @click="detailModelFlag = false">关闭</el-button>
  266. </el-footer>
  267. </el-dialog>
  268. <!-- 物料模板检验标准 -->
  269. <el-dialog title="检验标准清单" :close-on-click-modal="false" v-drag :visible.sync="inspectionStandardListFlag" width="1200px">
  270. <el-form :inline="true" label-position="top">
  271. <el-form-item label="物料编码">
  272. <el-input v-model="standardHeader.attributeNo" readonly style="width: 120px"></el-input>
  273. </el-form-item>
  274. <el-form-item label="物料名称">
  275. <el-input v-model="standardHeader.partDesc" readonly style="width: 300px"></el-input>
  276. </el-form-item>
  277. <el-form-item label="模板编码">
  278. <el-input v-model="standardHeader.templateId" readonly style="width: 120px"></el-input>
  279. </el-form-item>
  280. <el-form-item label="检验类型">
  281. <el-input v-model="standardHeader.inspectionTypeName" readonly style="width: 120px"></el-input>
  282. </el-form-item>
  283. </el-form>
  284. <el-table :height="360" :data="standardList" border style="width: 100%;">
  285. <el-table-column prop="itemNo" header-align="center" align="center" width="130" label="检验项目编码"></el-table-column>
  286. <el-table-column prop="itemDesc" header-align="center" align="left" min-width="260" label="检验项目名称"></el-table-column>
  287. <el-table-column prop="valueType" header-align="center" align="center" width="110" label="检测值类型"></el-table-column>
  288. <el-table-column prop="" header-align="center" align="right" width="140" label="标准值">
  289. <template slot-scope="scope"><el-input v-model="scope.row.defaultValue" style="width: 100%"></el-input></template>
  290. </el-table-column>
  291. <el-table-column prop="" header-align="center" align="right" width="120" label="最大值">
  292. <template slot-scope="scope"><el-input v-model="scope.row.maxValue" style="width: 100%"></el-input></template>
  293. </el-table-column>
  294. <el-table-column prop="" header-align="center" align="right" width="120" label="最小值">
  295. <template slot-scope="scope"><el-input v-model="scope.row.minValue" style="width: 100%"></el-input></template>
  296. </el-table-column>
  297. </el-table>
  298. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  299. <el-button type="primary" @click="saveStandardList()">保存</el-button>
  300. <el-button type="primary" @click="inspectionStandardListFlag = false">关闭</el-button>
  301. </el-footer>
  302. </el-dialog>
  303. <!-- 检验模板->快速新增append-to-body 避免嵌套弹窗关闭后父弹窗表格不刷新/空白 -->
  304. <el-dialog title="新增" append-to-body @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="fastAddFlag" width="1100px">
  305. <div style="font-size: 12px">
  306. <el-form :inline="true" label-position="top" :model="detailData">
  307. <el-form-item :label="'模板编码'">
  308. <el-input v-model="detailData.templateId" clearable style="width: 120px"></el-input>
  309. </el-form-item>
  310. <el-form-item :label="'模板名称'">
  311. <el-input v-model="detailData.templateName" clearable style="width: 120px"></el-input>
  312. </el-form-item>
  313. <el-form-item label="检验类型">
  314. <el-select v-model="detailData.inspectionTypeNo" :disabled="lineInspectionRoleFlag" @change="checkInspectionType()" placeholder="请选择">
  315. <el-option
  316. v-for = "i in options"
  317. :key = "i.inspectionTypeNo"
  318. :label = "i.inspectionTypeName"
  319. :value = "i.inspectionTypeNo">
  320. </el-option>
  321. </el-select>
  322. </el-form-item>
  323. <el-form-item :label="' '">
  324. <el-button type="primary" @click="checkInspectionType()">查询</el-button>
  325. </el-form-item>
  326. <el-form-item style="margin-left: 117px" :label="' '">
  327. <el-button type="primary" @click="getOperationList()" style="width: 63px" v-if="this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107' || this.detailData.inspectionTypeNo === '108'">工序</el-button>
  328. </el-form-item>
  329. <el-form-item :label="' '">
  330. <el-button type="primary" @click="getAllResourceList()" style="width: 63px" v-if="this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107'">机台</el-button>
  331. </el-form-item>
  332. </el-form>
  333. </div>
  334. <el-container style="margin-top: 0px;">
  335. <el-main style="width: 470px;padding: 1px">
  336. <span style="font-size: 12px" >可选模板</span>
  337. <el-table
  338. height="400px"
  339. :data="itemList1"
  340. border
  341. ref="itemTable1"
  342. @row-click="itemClickRow1"
  343. @selection-change="selectionItem1"
  344. highlight-current-row
  345. style="width: 100%">
  346. <el-table-column
  347. type="selection"
  348. header-align="center"
  349. align="center"
  350. :selectable="selectFlag"
  351. width="50">
  352. </el-table-column>
  353. <el-table-column
  354. prop="templateId"
  355. header-align="center"
  356. align="center"
  357. min-width="80"
  358. label="模板编码">
  359. </el-table-column>
  360. <el-table-column
  361. prop="templateName"
  362. header-align="center"
  363. align="center"
  364. min-width="170"
  365. label="模板名称">
  366. </el-table-column>
  367. <el-table-column
  368. prop="inspectionTypeName"
  369. header-align="center"
  370. align="center"
  371. min-width="80"
  372. label="检验类型">
  373. </el-table-column>
  374. </el-table>
  375. </el-main>
  376. <el-main style="width: 100px;padding: 1px">
  377. <div style="margin-top: 180px;margin-left: 18px">
  378. <el-button type="primary" @click="addItem()">添加>></el-button>
  379. </div>
  380. <div style="margin-top: 15px;margin-left: 18px">
  381. <el-button type="primary" @click="deleteItem()">删除<<</el-button>
  382. </div>
  383. </el-main>
  384. <el-main style="width: 470px;padding: 1px">
  385. <span style="font-size: 12px">已有模板</span>
  386. <el-table
  387. height="400px"
  388. :data="itemList2"
  389. border
  390. ref="itemTable2"
  391. @row-click="itemClickRow2"
  392. @selection-change="selectionItem2"
  393. highlight-current-row
  394. style="width: 100%">
  395. <el-table-column
  396. type="selection"
  397. header-align="center"
  398. align="center"
  399. :selectable="selectFlag"
  400. width="50">
  401. </el-table-column>
  402. <el-table-column
  403. prop="templateId"
  404. header-align="center"
  405. align="center"
  406. label="模板编码">
  407. </el-table-column>
  408. <el-table-column
  409. prop="templateName"
  410. header-align="center"
  411. align="center"
  412. label="模板名称">
  413. </el-table-column>
  414. <!-- <el-table-column-->
  415. <!-- prop="operation"-->
  416. <!-- header-align="center"-->
  417. <!-- align="center"-->
  418. <!-- label="工序">-->
  419. <!-- </el-table-column>-->
  420. <!-- <el-table-column-->
  421. <!-- prop="resourceID"-->
  422. <!-- header-align="center"-->
  423. <!-- align="center"-->
  424. <!-- label="机台">-->
  425. <!-- </el-table-column>-->
  426. <el-table-column
  427. prop="inspectionTypeName"
  428. header-align="center"
  429. align="center"
  430. label="检验类型">
  431. </el-table-column>
  432. </el-table>
  433. </el-main>
  434. </el-container>
  435. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  436. <el-button type="primary" @click="fastAddFlag = false">关闭</el-button>
  437. </el-footer>
  438. </el-dialog>
  439. <!-- 工序 -->
  440. <el-dialog title="工序清单" :close-on-click-modal="false" v-drag :visible.sync="operationModelFlag" width="420px">
  441. <div class="rq">
  442. <el-form :inline="true" label-position="top" :model="operationData">
  443. <el-form-item :label="'工序:'">
  444. <el-input v-model="operationData.operationDesc" clearable style="width: 120px"></el-input>
  445. </el-form-item>
  446. <el-form-item :label="' '">
  447. <el-button type="primary" @click="getOperationList2()">查询</el-button>
  448. </el-form-item>
  449. </el-form>
  450. <el-table
  451. :height="300"
  452. :data="operationList"
  453. ref="operationTable"
  454. @row-click="operationClickRow"
  455. @selection-change="selectionOperationChangeHandle"
  456. border
  457. :row-class-name="operationRowClassName"
  458. style="width: 100%;">
  459. <el-table-column type="index" width="50" align="center">
  460. <template slot-scope="scope">
  461. <el-radio v-model="operationCurrent" :label="scope.row.index">{{''}}</el-radio>
  462. </template>
  463. </el-table-column>
  464. <el-table-column
  465. prop="operationDesc"
  466. header-align="center"
  467. align="center"
  468. label="工序">
  469. </el-table-column>
  470. </el-table>
  471. </div>
  472. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  473. <el-button type="primary" @click="confirmOperation()">确认</el-button>
  474. </el-footer>
  475. </el-dialog>
  476. <!-- 机台 -->
  477. <el-dialog title="机台清单" :close-on-click-modal="false" v-drag :visible.sync="resourceModelFlag" width="420px">
  478. <div class="rq">
  479. <el-form :inline="true" label-position="top" :model="resourceData">
  480. <el-form-item :label="'机台编码'">
  481. <el-input v-model="resourceData.resourceId" clearable style="width: 120px"></el-input>
  482. </el-form-item>
  483. <el-form-item :label="'机台名称'">
  484. <el-input v-model="resourceData.resourceDesc" clearable style="width: 120px"></el-input>
  485. </el-form-item>
  486. <el-form-item :label="' '">
  487. <el-button type="primary" @click="getAllResourceList2()">查询</el-button>
  488. </el-form-item>
  489. </el-form>
  490. <el-table
  491. :height="300"
  492. :data="resourceList"
  493. ref="resourceTable"
  494. @row-click="resourceClickRow"
  495. @selection-change="selectionResourceChangeHandle"
  496. border
  497. :row-class-name="resourceRowClassName"
  498. style="width: 100%;">
  499. <el-table-column type="index" width="50" align="center">
  500. <template slot-scope="scope">
  501. <el-radio v-model="resourceCurrent" :label="scope.row.index">{{''}}</el-radio>
  502. </template>
  503. </el-table-column>
  504. <el-table-column
  505. prop="resourceId"
  506. header-align="center"
  507. align="center"
  508. label="机台编码">
  509. </el-table-column>
  510. <el-table-column
  511. prop="resourceDesc"
  512. header-align="center"
  513. align="center"
  514. label="机台名称">
  515. </el-table-column>
  516. </el-table>
  517. </div>
  518. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  519. <el-button type="primary" @click="confirmResource()">确认</el-button>
  520. </el-footer>
  521. </el-dialog>
  522. <!-- 供应商 -->
  523. <el-dialog title="供应商清单" :close-on-click-modal="false" v-drag :visible.sync="manufacturerModelFlag" width="520px">
  524. <div class="rq">
  525. <el-form :inline="true" label-position="top" :model="manufacturerData">
  526. <el-form-item :label="'供应商编码:'">
  527. <el-input v-model="manufacturerData.manufacturerID" clearable style="width: 120px"></el-input>
  528. </el-form-item>
  529. <el-form-item :label="'供应商名称:'">
  530. <el-input v-model="manufacturerData.manufacturerName" clearable style="width: 120px"></el-input>
  531. </el-form-item>
  532. <el-form-item :label="' '">
  533. <el-button type="primary" @click="getManufacturerList()">查询</el-button>
  534. </el-form-item>
  535. </el-form>
  536. <el-table
  537. :height="300"
  538. :data="manufacturerList"
  539. ref="manufacturerTable"
  540. @row-click="manufacturerClickRow"
  541. @selection-change="selectionManufacturerChangeHandle"
  542. border
  543. style="width: 100%;">
  544. <el-table-column
  545. type="selection"
  546. header-align="center"
  547. align="center"
  548. :selectable="selectFlag"
  549. width="50">
  550. </el-table-column>
  551. <el-table-column
  552. prop="manufacturerID"
  553. header-align="center"
  554. align="center"
  555. label="供应商编码">
  556. </el-table-column>
  557. <el-table-column
  558. prop="manufacturerName"
  559. header-align="center"
  560. align="center"
  561. label="供应商名称">
  562. </el-table-column>
  563. </el-table>
  564. </div>
  565. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  566. <el-button type="primary" @click="confirmManufacturer()">确认</el-button>
  567. <el-button type="primary" @click="manufacturerModelFlag = false">关闭</el-button>
  568. </el-footer>
  569. </el-dialog>
  570. <!-- sop文件清单 -->
  571. <el-dialog title="SOP文件清单" :close-on-click-modal="false" v-drag :visible.sync="sopFileModelFlag" width="800px">
  572. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  573. <el-form-item :label="' '">
  574. <el-button type="primary" @click="uploadSopFile">上传文件</el-button>
  575. </el-form-item>
  576. <el-form-item label="检验类型" style="margin-left: 448px">
  577. <el-select v-model="sopData.inspectionTypeNo" :disabled="lineInspectionRoleFlag" placeholder="请选择">
  578. <el-option v-if="!lineInspectionRoleFlag" label="全部" value=""></el-option>
  579. <el-option
  580. v-for = "i in options"
  581. :key = "i.inspectionTypeNo"
  582. :label = "i.inspectionTypeName"
  583. :value = "i.inspectionTypeNo">
  584. </el-option>
  585. </el-select>
  586. </el-form-item>
  587. <el-form-item :label="' '">
  588. <el-button type="primary" @click="getFileContentList">查询</el-button>
  589. </el-form-item>
  590. </el-form>
  591. <el-table
  592. :height="350"
  593. :data="sopList"
  594. border
  595. style="width: 100%; ">
  596. <el-table-column
  597. v-for="(item,index) in sopColumnList" :key="index"
  598. :sortable="item.columnSortable"
  599. :prop="item.columnProp"
  600. :header-align="item.headerAlign"
  601. :show-overflow-tooltip="item.showOverflowTooltip"
  602. :align="item.align"
  603. :fixed="item.fixed===''?false:item.fixed"
  604. :min-width="item.columnWidth"
  605. :label="item.columnLabel">
  606. <template slot-scope="scope">
  607. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  608. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  609. </template>
  610. </el-table-column>
  611. <el-table-column
  612. fixed="right"
  613. header-align="center"
  614. align="center"
  615. width="100"
  616. label="操作">
  617. <template slot-scope="scope">
  618. <a @click="downloadFile(scope.row)">下载</a>
  619. <a type="text" size="small" @click="deleteFile(scope.row)">删除</a>
  620. </template>
  621. </el-table-column>
  622. </el-table>
  623. </el-dialog>
  624. <el-dialog title="物料SOP文件清单" :close-on-click-modal="false" v-drag :visible.sync="partSopFileModelFlag" width="860px">
  625. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  626. <el-form-item :label="' '">
  627. <el-button type="primary" @click="openPartSopUploadDialog">上传文件</el-button>
  628. </el-form-item>
  629. </el-form>
  630. <el-table
  631. :height="350"
  632. :data="partSopList"
  633. border
  634. v-loading="partSopLoading"
  635. style="width: 100%;">
  636. <el-table-column prop="fileName" label="文件名称" min-width="260" show-overflow-tooltip />
  637. <el-table-column prop="createdBy" label="上传人" width="120" align="center" />
  638. <el-table-column prop="createDate" label="上传时间" width="180" align="center" />
  639. <el-table-column prop="cadditionalInfo" label="备注" min-width="180" show-overflow-tooltip />
  640. <el-table-column fixed="right" header-align="center" align="center" width="120" label="操作">
  641. <template slot-scope="scope">
  642. <a @click="previewPartSopFile(scope.row)">查看 |</a>
  643. <a type="text" size="small" @click="removePartSopFile(scope.row)">删除</a>
  644. </template>
  645. </el-table-column>
  646. </el-table>
  647. </el-dialog>
  648. <el-dialog title="上传" :visible.sync="ossVisible" v-drag width="400px" append-to-body :close-on-click-modal="false">
  649. <el-form ref="form" class="rq" label-width="80px" label-position="top">
  650. <el-row :gutter="10">
  651. <slot></slot>
  652. <el-col :span="24">
  653. <el-form-item label=" " class="auto">
  654. <el-upload drag :file-list="fileList2"
  655. action="#" ref="upload"
  656. :on-remove="onRemoveFile"
  657. :on-change="onChangeFile"
  658. multiple
  659. :auto-upload="false">
  660. <i class="el-icon-upload"></i>
  661. <div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
  662. </el-upload>
  663. </el-form-item>
  664. </el-col>
  665. <el-col :span="24" >
  666. <el-form-item label="备注" class="auto" >
  667. <el-input type="textarea" v-model="ossForm.remark" resize="none" :autosize="{minRows: 3, maxRows: 3}"></el-input>
  668. </el-form-item>
  669. </el-col>
  670. </el-row>
  671. </el-form>
  672. <span slot="footer" class="dialog-footer">
  673. <el-button type="primary" :loading="uploadLoading" @click="handleUploadFiles">确认</el-button>
  674. <el-button @click="ossVisible = false">取消</el-button>
  675. </span>
  676. </el-dialog>
  677. <!-- 物料编码 -->
  678. <el-dialog title="物料选择" @close="closeDialog" :close-on-click-modal="false" v-drag :visible.sync="partDisableFlag" width="685px" height="273px">
  679. <el-form :inline="true" label-position="top" :model="partDetailData" style="margin-left: 7px;margin-top: -5px;">
  680. <el-form-item label="物料编码">
  681. <el-input v-model="partDetailData.partNo" clearable style="width: 137px"></el-input>
  682. </el-form-item>
  683. <el-form-item label="物料名称">
  684. <el-input v-model="partDetailData.partDesc" clearable style="width: 137px"></el-input>
  685. </el-form-item>
  686. <el-form-item label="SKU">
  687. <el-input v-model="partDetailData.sku" clearable style="width: 100px"></el-input>
  688. </el-form-item>
  689. <!-- <el-form-item label="PN">-->
  690. <!-- <el-input v-model="partDetailData.cinvSourceCode" clearable style="width: 100px"></el-input>-->
  691. <!-- </el-form-item>-->
  692. <el-form-item>
  693. <el-button type="primary" @click="searchPartInfo()" style="margin-top: 24px">查询</el-button>
  694. </el-form-item>
  695. </el-form>
  696. <el-table
  697. :height="400"
  698. :data="partInfoList"
  699. @row-dblclick="getRowData1"
  700. border
  701. v-loading="dataListLoading"
  702. style="width: 100%;">
  703. <el-table-column
  704. prop="partNo"
  705. header-align="center"
  706. align="center"
  707. label="物料编码">
  708. </el-table-column>
  709. <el-table-column
  710. prop="partDesc"
  711. header-align="center"
  712. align="center"
  713. label="物料名称">
  714. </el-table-column>
  715. <el-table-column
  716. prop="sku"
  717. header-align="center"
  718. align="center"
  719. label="SKU">
  720. </el-table-column>
  721. <!-- <el-table-column-->
  722. <!-- prop="cinvSourceCode"-->
  723. <!-- header-align="center"-->
  724. <!-- align="center"-->
  725. <!-- label="PN">-->
  726. <!-- </el-table-column>-->
  727. </el-table>
  728. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  729. <el-button type="primary" @click="partDisableFlag = false">关闭</el-button>
  730. </el-footer>
  731. </el-dialog>
  732. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  733. <!-- 上传sop文件的modal -->
  734. <qcSOPUploadFile ref="qcSOPUploadFile" @refreshPageTables="getFileContentList()" v-drag></qcSOPUploadFile>
  735. <!-- 导入 -->
  736. <qcUpload ref="qcUpload" @refreshPageTables="getDataList()" v-drag></qcUpload>
  737. </div>
  738. </template>
  739. <script>
  740. import {
  741. qcPartAttributeSearch, // 查询物料属性
  742. qcPartAttributeSave, // 新增物料属性
  743. qcPartAttributeDelete, // 删除物料属性
  744. qcPartAttributeEdit, // 修改物料属性
  745. searchPartAttributeDetails, // 查询物料属性模板
  746. savePartAttributeDetails, // 新增物料属性模板
  747. deletePartAttributeDetails, // 删除物料属性模板
  748. saveAttributeDetailed, // 新增物料属性模板详情
  749. getPartTemplateLists, // 获取模板列表
  750. qcAttributeTemplateItemDetailsSearch, // 查询物料模板检验标准明细
  751. qcAttributeTemplateItemSave, // 保存物料模板检验标准明细
  752. inspectionTypeSearch, // 搜索所有检验类型
  753. getOperationDescList, // 查询工序列表
  754. getManufacturerList, // 查询供应商列表
  755. getAllResourceList, // 查询机台列表
  756. getSiteAndBuByUserName,
  757. searchPartInfo, // 查询物料信息
  758. } from "@/api/qc/qc.js"
  759. import { buildQcBu } from './qcBuUtils'
  760. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  761. import Chooselist from '@/views/modules/common/Chooselist_eam'
  762. import {getFileContentList, downLoadObjectFile} from '@/api/eam/eam_object_list.js'
  763. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  764. import {deleteObjectFile} from '@/api/eam/eam.js'
  765. import {queryOssFilePlus, ossUploadNoSaveOSSForYJY, previewOssFileById, removeOss} from '@/api/oss/oss'
  766. import qcUpload from "./qc_upload"
  767. import qcSOPUploadFile from "./qc_SOP_upload_file"
  768. export default {
  769. components: {
  770. qcSOPUploadFile,
  771. Chooselist,
  772. qcUpload
  773. },
  774. data () {
  775. return {
  776. columnsProp:['createBy', 'updateBy'],
  777. // 是否收藏
  778. favorite: false,
  779. // 导出 start
  780. exportData: [],
  781. exportName: "根据物料设置检验模板" + this.dayjs().format('YYYYMMDDHHmmss'),
  782. exportHeader: ["根据物料设置检验模板"],
  783. exportFooter: [],
  784. exportList: [],
  785. // 导出 end
  786. tagNo: '',
  787. searchData: {
  788. site: this.$store.state.user.site,
  789. userName: this.$store.state.user.name,
  790. partNo: '',
  791. partDesc: '',
  792. cinvSourceCode: '',
  793. sku: '',
  794. familyID: '',
  795. familyName: '',
  796. buDesc: '',
  797. attributeType: 'A',
  798. page: 1,
  799. limit: 10,
  800. },
  801. height: 200,
  802. pageIndex: 1,
  803. pageSize: 20,
  804. totalPage: 0,
  805. modalFlag: false,
  806. modalDisableFlag: false,
  807. partDisableFlag: false,
  808. modalData: {
  809. site: '',
  810. bu: '',
  811. flag: '',
  812. partNo: '',
  813. partDesc: '',
  814. familyID: '',
  815. familyName: '',
  816. cinvSourceCode: '',
  817. sku: '',
  818. umid: '',
  819. supplierNo: '',
  820. supplierDesc: '',
  821. attributeRemark: '',
  822. createTime: '',
  823. createBy: this.$store.state.user.name,
  824. attributeType: 'A',
  825. exemptInspection: ''
  826. },
  827. detailData: {
  828. site: '',
  829. buNo: '',
  830. partNo: '',
  831. attributeNo: '',
  832. partDesc: '',
  833. cinvSourceCode: '',
  834. sku: '',
  835. attributeType: 'A',
  836. inspectionTypeNo: '',
  837. templateId: '',
  838. templateName: '',
  839. createBy: this.$store.state.user.name
  840. },
  841. columnList: [
  842. // {
  843. // userId: this.$store.state.user.name,
  844. // functionId: 301003,
  845. // serialNumber: '301003Table1BuDesc',
  846. // tableId: "301003Table1",
  847. // tableName: "物料属性设置表",
  848. // columnProp: 'buDesc',
  849. // headerAlign: "center",
  850. // align: "center",
  851. // columnLabel: 'BU',
  852. // columnHidden: false,
  853. // columnImage: false,
  854. // columnSortable: false,
  855. // sortLv: 0,
  856. // status: true,
  857. // fixed: '',
  858. // columnWidth: 100,
  859. // },
  860. {
  861. userId: this.$store.state.user.name,
  862. functionId: 301003,
  863. serialNumber: '301003Table1PartNo',
  864. tableId: "301003Table1",
  865. tableName: "物料属性设置表",
  866. columnProp: 'partNo',
  867. headerAlign: "center",
  868. align: "center",
  869. columnLabel: '物料编码',
  870. columnHidden: false,
  871. columnImage: false,
  872. columnSortable: false,
  873. sortLv: 0,
  874. status: true,
  875. fixed: '',
  876. columnWidth: 120,
  877. },
  878. {
  879. userId: this.$store.state.user.name,
  880. functionId: 301003,
  881. serialNumber: '301003Table1SKU',
  882. tableId: "301003Table1",
  883. tableName: "物料属性设置表",
  884. columnProp: 'sku',
  885. headerAlign: "center",
  886. align: "center",
  887. columnLabel: 'SKU',
  888. columnHidden: false,
  889. columnImage: false,
  890. columnSortable: false,
  891. sortLv: 0,
  892. status: true,
  893. fixed: '',
  894. columnWidth: 120,
  895. },
  896. {
  897. userId: this.$store.state.user.name,
  898. functionId: 301003,
  899. serialNumber: '301003Table1PartDesc',
  900. tableId: "301003Table1",
  901. tableName: "物料属性设置表",
  902. columnProp: 'partDesc',
  903. headerAlign: "center",
  904. align: "left",
  905. columnLabel: '物料名称',
  906. columnHidden: false,
  907. columnImage: false,
  908. columnSortable: false,
  909. sortLv: 0,
  910. status: true,
  911. fixed: '',
  912. columnWidth: 300,
  913. },
  914. // {
  915. // userId: this.$store.state.user.name,
  916. // functionId: 301003,
  917. // serialNumber: '301003Table1CinvSourceCode',
  918. // tableId: "301003Table1",
  919. // tableName: "物料属性设置表",
  920. // columnProp: 'cinvSourceCode',
  921. // headerAlign: "center",
  922. // align: "center",
  923. // columnLabel: 'PN',
  924. // columnHidden: false,
  925. // columnImage: false,
  926. // columnSortable: false,
  927. // sortLv: 0,
  928. // status: true,
  929. // fixed: '',
  930. // columnWidth: 120,
  931. // },
  932. {
  933. userId: this.$store.state.user.name,
  934. functionId: 301003,
  935. serialNumber: '301003Table1FamilyName',
  936. tableId: "301003Table1",
  937. tableName: "物料属性设置表",
  938. columnProp: 'familyName',
  939. headerAlign: "center",
  940. align: "left",
  941. columnLabel: '物料类别',
  942. columnHidden: false,
  943. columnImage: false,
  944. columnSortable: false,
  945. sortLv: 0,
  946. status: true,
  947. fixed: '',
  948. columnWidth: 150,
  949. },
  950. {
  951. userId: this.$store.state.user.name,
  952. functionId: 301003,
  953. serialNumber: '301003Table1Spec',
  954. tableId: "301003Table1",
  955. tableName: "物料属性设置表",
  956. columnProp: 'spec',
  957. headerAlign: "center",
  958. align: "left",
  959. columnLabel: '规格型号',
  960. columnHidden: false,
  961. columnImage: false,
  962. columnSortable: false,
  963. sortLv: 0,
  964. status: true,
  965. fixed: '',
  966. columnWidth: 300,
  967. },
  968. {
  969. userId: this.$store.state.user.name,
  970. functionId: 301003,
  971. serialNumber: '301003Table1Umid',
  972. tableId: "301003Table1",
  973. tableName: "物料属性设置表",
  974. columnProp: 'umid',
  975. headerAlign: "center",
  976. align: "left",
  977. columnLabel: '单位',
  978. columnHidden: false,
  979. columnImage: false,
  980. columnSortable: false,
  981. sortLv: 0,
  982. status: true,
  983. fixed: '',
  984. columnWidth: 100,
  985. },
  986. {
  987. userId: this.$store.state.user.name,
  988. functionId: 301003,
  989. serialNumber: '301003Table1ExemptInspection',
  990. tableId: "301003Table1",
  991. tableName: "物料属性设置表",
  992. columnProp: 'exemptInspection',
  993. headerAlign: "center",
  994. align: "center",
  995. columnLabel: '是否免检',
  996. columnHidden: false,
  997. columnImage: false,
  998. columnSortable: false,
  999. sortLv: 0,
  1000. status: true,
  1001. fixed: '',
  1002. columnWidth: 100,
  1003. },
  1004. {
  1005. userId: this.$store.state.user.name,
  1006. functionId: 301003,
  1007. serialNumber: '301003Table1AttributeRemark',
  1008. tableId: "301003Table1",
  1009. tableName: "物料属性设置表",
  1010. columnProp: 'attributeRemark',
  1011. headerAlign: "center",
  1012. align: "left",
  1013. columnLabel: '备注',
  1014. columnHidden: false,
  1015. columnImage: false,
  1016. columnSortable: false,
  1017. sortLv: 0,
  1018. status: true,
  1019. fixed: '',
  1020. columnWidth: 200,
  1021. },
  1022. {
  1023. userId: this.$store.state.user.name,
  1024. functionId: 301003,
  1025. serialNumber: '301003Table1CreateTime',
  1026. tableId: "301003Table1",
  1027. tableName: "物料属性设置表",
  1028. columnProp: 'createTime',
  1029. headerAlign: "center",
  1030. align: "center",
  1031. columnLabel: '创建时间',
  1032. columnHidden: false,
  1033. columnImage: false,
  1034. columnSortable: false,
  1035. sortLv: 0,
  1036. status: true,
  1037. fixed: '',
  1038. columnWidth: 170,
  1039. },
  1040. {
  1041. userId: this.$store.state.user.name,
  1042. functionId: 301003,
  1043. serialNumber: '301003Table1CreateBy',
  1044. tableId: "301003Table1",
  1045. tableName: "物料属性设置表",
  1046. columnProp: 'createBy',
  1047. headerAlign: "center",
  1048. align: "center",
  1049. columnLabel: '创建人',
  1050. columnHidden: false,
  1051. columnImage: false,
  1052. columnSortable: false,
  1053. sortLv: 0,
  1054. status: true,
  1055. fixed: '',
  1056. columnWidth: 100,
  1057. },
  1058. {
  1059. userId: this.$store.state.user.name,
  1060. functionId: 301003,
  1061. serialNumber: '301003Table1UpdateDate',
  1062. tableId: "301003Table1",
  1063. tableName: "物料属性设置表",
  1064. columnProp: 'updateDate',
  1065. headerAlign: "center",
  1066. align: "center",
  1067. columnLabel: '更新时间',
  1068. columnHidden: false,
  1069. columnImage: false,
  1070. columnSortable: false,
  1071. sortLv: 0,
  1072. status: true,
  1073. fixed: '',
  1074. columnWidth: 170,
  1075. },
  1076. {
  1077. userId: this.$store.state.user.name,
  1078. functionId: 301003,
  1079. serialNumber: '301003Table1UpdateBy',
  1080. tableId: "301003Table1",
  1081. tableName: "物料属性设置表",
  1082. columnProp: 'updateBy',
  1083. headerAlign: "center",
  1084. align: "center",
  1085. columnLabel: '更新人',
  1086. columnHidden: false,
  1087. columnImage: false,
  1088. columnSortable: false,
  1089. sortLv: 0,
  1090. status: true,
  1091. fixed: '',
  1092. columnWidth: 100,
  1093. },
  1094. ],
  1095. detailModelFlag: false,
  1096. detailList: [],
  1097. dataList: [],
  1098. dataListLoading: false,
  1099. // 展示列集
  1100. columnDetailList: [
  1101. {
  1102. userId: this.$store.state.user.name,
  1103. functionId: 301003,
  1104. serialNumber: '301003Table2TemplateId',
  1105. tableId: "301003Table2",
  1106. tableName: "检验模板清单表",
  1107. columnProp: 'templateId',
  1108. headerAlign: "center",
  1109. align: "center",
  1110. columnLabel: '模板编码',
  1111. columnHidden: false,
  1112. columnImage: false,
  1113. columnSortable: false,
  1114. sortLv: 0,
  1115. status: true,
  1116. fixed: '',
  1117. columnWidth: 120,
  1118. },
  1119. {
  1120. userId: this.$store.state.user.name,
  1121. functionId: 301003,
  1122. serialNumber: '301003Table2TemplateName',
  1123. tableId: "301003Table2",
  1124. tableName: "检验模板清单表",
  1125. columnProp: 'templateName',
  1126. headerAlign: "center",
  1127. align: "left",
  1128. columnLabel: '模板名称',
  1129. columnHidden: false,
  1130. columnImage: false,
  1131. columnSortable: false,
  1132. sortLv: 0,
  1133. status: true,
  1134. fixed: '',
  1135. columnWidth: 250,
  1136. },
  1137. {
  1138. userId: this.$store.state.user.name,
  1139. functionId: 301003,
  1140. serialNumber: '301003Table2InspectionTypeName',
  1141. tableId: "301003Table2",
  1142. tableName: "检验模板清单表",
  1143. columnProp: 'inspectionTypeName',
  1144. headerAlign: "center",
  1145. align: "center",
  1146. columnLabel: '检验类型',
  1147. columnHidden: false,
  1148. columnImage: false,
  1149. columnSortable: false,
  1150. sortLv: 0,
  1151. status: true,
  1152. fixed: '',
  1153. columnWidth: 100,
  1154. },
  1155. {
  1156. userId: this.$store.state.user.name,
  1157. functionId: 301003,
  1158. serialNumber: '301003Table2TemplateVersion',
  1159. tableId: "301003Table2",
  1160. tableName: "检验模板清单表",
  1161. columnProp: 'templateVersion',
  1162. headerAlign: "center",
  1163. align: "center",
  1164. columnLabel: '版本号',
  1165. columnHidden: false,
  1166. columnImage: false,
  1167. columnSortable: false,
  1168. sortLv: 0,
  1169. status: true,
  1170. fixed: '',
  1171. columnWidth: 100,
  1172. },
  1173. {
  1174. userId: this.$store.state.user.name,
  1175. functionId: 301003,
  1176. serialNumber: '301003Table2DefaultSamplingQuantity',
  1177. tableId: "301003Table2",
  1178. tableName: "检验模板清单表",
  1179. columnProp: 'defaultSamplingQuantity',
  1180. headerAlign: "center",
  1181. align: "right",
  1182. columnLabel: '默认抽样数量',
  1183. columnHidden: false,
  1184. columnImage: false,
  1185. columnSortable: false,
  1186. sortLv: 0,
  1187. status: true,
  1188. fixed: '',
  1189. columnWidth: 100,
  1190. },
  1191. {
  1192. userId: this.$store.state.user.name,
  1193. functionId: 301003,
  1194. serialNumber: '301003Table2DefaultSamplingProportion',
  1195. tableId: "301003Table2",
  1196. tableName: "检验模板清单表",
  1197. columnProp: 'defaultSamplingProportion',
  1198. headerAlign: "center",
  1199. align: "right",
  1200. columnLabel: '默认抽样比例',
  1201. columnHidden: false,
  1202. columnImage: false,
  1203. columnSortable: false,
  1204. sortLv: 0,
  1205. status: true,
  1206. fixed: '',
  1207. columnWidth: 100,
  1208. },
  1209. /* {
  1210. userId: this.$store.state.user.name,
  1211. functionId: 301003,
  1212. serialNumber: '301003Table2Operation',
  1213. tableId: "301003Table2",
  1214. tableName: "检验模板清单表",
  1215. columnProp: 'operation',
  1216. headerAlign: "center",
  1217. align: "left",
  1218. columnLabel: '工序',
  1219. columnHidden: false,
  1220. columnImage: false,
  1221. columnSortable: false,
  1222. sortLv: 0,
  1223. status: true,
  1224. fixed: '',
  1225. columnWidth: 120,
  1226. },
  1227. {
  1228. userId: this.$store.state.user.name,
  1229. functionId: 301003,
  1230. serialNumber: '301003Table2ResourceID',
  1231. tableId: "301003Table2",
  1232. tableName: "检验模板清单表",
  1233. columnProp: 'resourceID',
  1234. headerAlign: "center",
  1235. align: "left",
  1236. columnLabel: '机台',
  1237. columnHidden: false,
  1238. columnImage: false,
  1239. columnSortable: false,
  1240. sortLv: 0,
  1241. status: true,
  1242. fixed: '',
  1243. columnWidth: 120,
  1244. }, */
  1245. ],
  1246. // 快速添加
  1247. fastAddFlag: false,
  1248. itemList1: [],
  1249. itemList2: [],
  1250. itemListRow1: {},
  1251. itemListRow2: {},
  1252. tempLevelRow: '',
  1253. tempProgrammeRow: '',
  1254. options: [],
  1255. itemSelections1: [],
  1256. itemSelections2: [],
  1257. rules: {
  1258. partNoType:[
  1259. {
  1260. required: true,
  1261. message: ' ',
  1262. trigger: ['blur','change']
  1263. }
  1264. ],
  1265. partDescType:[
  1266. {
  1267. required: true,
  1268. message: ' ',
  1269. trigger: ['blur','change']
  1270. }
  1271. ],
  1272. bu: [
  1273. {
  1274. required: true,
  1275. message: ' ',
  1276. trigger: ['blur','change']
  1277. }
  1278. ]
  1279. },
  1280. // 工序
  1281. operationList: [],
  1282. resourceList: [],
  1283. operationModelFlag: false,
  1284. resourceModelFlag: false,
  1285. dataListOperationSelections: [],
  1286. operationData: {
  1287. operationDesc: ''
  1288. },
  1289. resourceData: {
  1290. site: '',
  1291. resourceId: '',
  1292. resourceDesc: ''
  1293. },
  1294. operation: '',
  1295. resourceId: '',
  1296. selectionManufacturer: [],
  1297. // 供应商
  1298. manufacturerList: [],
  1299. manufacturerModelFlag: false,
  1300. dataListManufacturerSelections: [],
  1301. manufacturerData: {
  1302. site: '',
  1303. manufacturerID: '',
  1304. manufacturerName: ''
  1305. },
  1306. // 单选框绑定的值
  1307. operationCurrent: -1,
  1308. resourceCurrent: -1,
  1309. inspectionStandardListFlag: false,
  1310. standardHeader: {
  1311. site: '',
  1312. buNo: '',
  1313. attributeNo: '',
  1314. attributeType: 'A',
  1315. partDesc: '',
  1316. templateId: '',
  1317. inspectionTypeNo: '',
  1318. inspectionTypeName: ''
  1319. },
  1320. standardList: [],
  1321. sopData: {
  1322. site: '',
  1323. buNo: '',
  1324. partNo: '',
  1325. inspectionTypeNo: '',
  1326. inspectionTypeName: ''
  1327. },
  1328. sopList: [],
  1329. sopFileModelFlag: false,
  1330. partSopFileModelFlag: false,
  1331. partSopLoading: false,
  1332. ossVisible: false,
  1333. uploadLoading: false,
  1334. partSopCurrent: {
  1335. site: '',
  1336. partNo: ''
  1337. },
  1338. partSopList: [],
  1339. fileList2: [],
  1340. ossForm: {
  1341. remark: ''
  1342. },
  1343. sopColumnList: [
  1344. {
  1345. columnProp: 'fileName',
  1346. headerAlign: "center",
  1347. align: "center",
  1348. columnLabel: '文件名称',
  1349. columnHidden: false,
  1350. columnImage: false,
  1351. columnSortable: false,
  1352. sortLv: 0,
  1353. status: true,
  1354. fixed: '',
  1355. },
  1356. {
  1357. columnProp: 'createdBy',
  1358. headerAlign: "center",
  1359. align: 'center',
  1360. columnLabel: '上传人',
  1361. columnHidden: false,
  1362. columnImage: false,
  1363. columnSortable: true,
  1364. sortLv: 0,
  1365. status: true,
  1366. fixed: false
  1367. },
  1368. {
  1369. columnProp: 'createDate',
  1370. headerAlign: "center",
  1371. align: 'center',
  1372. columnLabel: '上传时间',
  1373. columnHidden: false,
  1374. columnImage: false,
  1375. columnSortable: true,
  1376. sortLv: 0,
  1377. status: true,
  1378. fixed: false
  1379. },
  1380. {
  1381. columnProp: 'orderRef3',
  1382. headerAlign: "center",
  1383. align: 'center',
  1384. columnLabel: '检验类型',
  1385. columnHidden: false,
  1386. columnImage: false,
  1387. columnSortable: true,
  1388. sortLv: 0,
  1389. status: true,
  1390. fixed: false
  1391. },
  1392. ],
  1393. userBuList: [],
  1394. partInfoList: [],
  1395. partDetailData: {
  1396. bu: '',
  1397. partNo: '',
  1398. partDesc: '',
  1399. seqNo: '',
  1400. sku: '',
  1401. cinvSourceCode:'',
  1402. },
  1403. authSearch: false,
  1404. authSave: false,
  1405. authUpdate: false,
  1406. authDelete: false,
  1407. authDetail: false,
  1408. authFile: false,
  1409. lineInspectionRoleFlag: false,
  1410. pqcInspectionTypeNo: '108',
  1411. menuId: this.$route.meta.menuId,
  1412. }
  1413. },
  1414. mounted () {
  1415. this.$nextTick(() => {
  1416. this.height = window.innerHeight - 180
  1417. })
  1418. },
  1419. created () {
  1420. // 按钮控制
  1421. this.getButtonAuthData()
  1422. // 当前用户是否包含换线点检角色
  1423. this.lineInspectionRoleFlag = this.resolveLineInspectionRoleFlag()
  1424. // 获取用户的 site 和 bu
  1425. this.getSiteAndBuByUserName()
  1426. // 校验用户是否收藏
  1427. this.favoriteIsOk()
  1428. // 获取检验类型
  1429. this.inspectionTypeSearch()
  1430. // 动态列
  1431. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  1432. this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
  1433. if (!this.authSearch) {
  1434. // 获取数据列表
  1435. this.getDataList()
  1436. }
  1437. },
  1438. methods: {
  1439. // 获取用户的bu
  1440. getSiteAndBuByUserName () {
  1441. let tempData = {
  1442. username: this.$store.state.user.name,
  1443. site: this.$store.state.user.site,
  1444. }
  1445. getSiteAndBuByUserName(tempData).then(({data}) => {
  1446. if (data.code === 0) {
  1447. this.userBuList = data.rows
  1448. }
  1449. })
  1450. },
  1451. searchPartInfo () {
  1452. this.partDetailData.bu = this.modalData.bu
  1453. if (!this.partDetailData.partNo && !this.partDetailData.partDesc && !this.partDetailData.sku && !this.partDetailData.cinvSourceCode) {
  1454. this.partInfoList = []
  1455. this.partDisableFlag = true
  1456. }
  1457. else {
  1458. searchPartInfo(this.partDetailData).then(({data}) => {
  1459. if (data.code === 0) {
  1460. this.partInfoList = data.rows
  1461. this.partDisableFlag = true
  1462. } else {
  1463. this.$alert(data.msg, '错误', {
  1464. confirmButtonText: '确定'
  1465. })
  1466. }
  1467. })
  1468. }
  1469. },
  1470. // 查询检验类型
  1471. inspectionTypeSearch () {
  1472. let tempData = {
  1473. site: this.$store.state.user.site
  1474. }
  1475. inspectionTypeSearch(tempData).then(({data}) => {
  1476. if (data.code === 0) {
  1477. this.options = data.rows
  1478. if (this.lineInspectionRoleFlag) {
  1479. const pqcInspectionTypeNo = this.getPqcInspectionTypeNo()
  1480. this.options = this.options.filter(item => item.inspectionTypeNo === pqcInspectionTypeNo)
  1481. this.detailData.inspectionTypeNo = pqcInspectionTypeNo
  1482. this.sopData.inspectionTypeNo = pqcInspectionTypeNo
  1483. }
  1484. }
  1485. })
  1486. },
  1487. chooseLevel (row) {
  1488. this.tempLevelRow = row
  1489. this.getBaseList(208)
  1490. },
  1491. chooseProgrammeRow (row) {
  1492. this.tempProgrammeRow = row
  1493. this.getBaseList(207)
  1494. },
  1495. // 获取基础数据列表S
  1496. getBaseList (val,type) {
  1497. this.tagNo = val
  1498. this.$nextTick(() => {
  1499. let strVal = ''
  1500. // if (val === 507) {
  1501. // strVal = this.modalData.partNo
  1502. // this.$refs.baseList.init(val, strVal)
  1503. // }
  1504. if (val === 208) {
  1505. strVal = this.tempLevelRow.samplingLevelNo
  1506. this.$refs.baseList.init(val, strVal)
  1507. }
  1508. if (val === 207) {
  1509. strVal = this.tempProgrammeRow.samplingProgrammeNo
  1510. this.$refs.baseList.init(val, strVal)
  1511. }
  1512. if (val === 1056) {
  1513. strVal = this.modalData.supplierNo
  1514. this.$refs.baseList.init(val, strVal)
  1515. }
  1516. })
  1517. },
  1518. // 列表方法的回调
  1519. getBaseData (val) {
  1520. if (this.tagNo === 507) {
  1521. this.modalData.partNo = val.part_no
  1522. this.modalData.partDesc = val.part_desc
  1523. }
  1524. if (this.tagNo === 208) {
  1525. this.tempLevelRow.samplingLevelNo = val.sampling_level_no
  1526. this.tempLevelRow.samplingLevelDesc = val.sampling_level_desc
  1527. }
  1528. if (this.tagNo === 207) {
  1529. this.tempProgrammeRow.samplingProgrammeNo = val.sampling_programme_no
  1530. this.tempProgrammeRow.samplingProgrammeDesc = val.sampling_programme_desc
  1531. }
  1532. if (this.tagNo === 1056) {
  1533. this.modalData.supplierNo = val.supplier_id
  1534. this.modalData.supplierDesc = val.supplier_name
  1535. }
  1536. },
  1537. // 获取数据列表
  1538. getDataList () {
  1539. this.searchData.limit = this.pageSize
  1540. this.searchData.page = this.pageIndex
  1541. qcPartAttributeSearch(this.searchData).then(({data}) => {
  1542. if (data.code === 0) {
  1543. this.dataList = data.page.list
  1544. this.pageIndex = data.page.currPage
  1545. this.pageSize = data.page.pageSize
  1546. this.totalPage = data.page.totalCount
  1547. }
  1548. })
  1549. },
  1550. getRowData1 (row) {
  1551. this.modalData.sku = row.sku
  1552. this.modalData.cinvSourceCode = row.cinvSourceCode
  1553. this.modalData.partNo = row.partNo
  1554. this.modalData.partDesc = row.partDesc
  1555. this.partDisableFlag = false
  1556. },
  1557. // 每页数
  1558. sizeChangeHandle (val) {
  1559. this.pageSize = val
  1560. this.pageIndex = 1
  1561. this.getDataList()
  1562. },
  1563. // 当前页
  1564. currentChangeHandle (val) {
  1565. this.pageIndex = val
  1566. this.getDataList()
  1567. },
  1568. addModal () {
  1569. this.modalData = {
  1570. site: '',
  1571. bu: this.userBuList[0].buNo,
  1572. flag: '1',
  1573. partNo: '',
  1574. partDesc: '',
  1575. familyID: '',
  1576. familyName: '',
  1577. umid: '',
  1578. supplierNo: '',
  1579. supplierDesc: '',
  1580. attributeRemark: '',
  1581. createTime: '',
  1582. updateBy: this.$store.state.user.name,
  1583. createBy: this.$store.state.user.name,
  1584. attributeType: 'A',
  1585. exemptInspection: ''
  1586. }
  1587. this.modalDisableFlag = false
  1588. this.modalFlag = true
  1589. },
  1590. updateModal (row) {
  1591. this.modalData = {
  1592. site: row.site,
  1593. bu: buildQcBu(row.site),
  1594. flag: '2',
  1595. partNo: row.partNo,
  1596. partDesc: row.partDesc,
  1597. familyID: row.familyID,
  1598. familyName: row.familyName,
  1599. umid: row.umid,
  1600. supplierNo: row.supplierNo,
  1601. supplierDesc: row.supplierDesc,
  1602. attributeRemark: row.attributeRemark,
  1603. updateBy: this.$store.state.user.name,
  1604. createBy: this.$store.state.user.name,
  1605. attributeType: 'A',
  1606. exemptInspection: row.exemptInspection
  1607. }
  1608. this.modalDisableFlag = true
  1609. this.modalFlag = true
  1610. },
  1611. // 删除
  1612. deletePropertiesModel (row) {
  1613. this.$confirm(`是否删除这个检验模板?`, '提示', {
  1614. confirmButtonText: '确定',
  1615. cancelButtonText: '取消',
  1616. type: 'warning'
  1617. }).then(() => {
  1618. qcPartAttributeDelete(row).then(({data}) => {
  1619. if (data && data.code === 0) {
  1620. this.getDataList()
  1621. this.$message({
  1622. message: '操作成功',
  1623. type: 'success',
  1624. duration: 1500,
  1625. onClose: () => {}
  1626. })
  1627. } else {
  1628. this.$alert(data.msg, '错误', {
  1629. confirmButtonText: '确定'
  1630. })
  1631. }
  1632. })
  1633. }).catch(() => {
  1634. })
  1635. },
  1636. saveData () {
  1637. if (this.modalData.bu === '' || this.modalData.bu == null) {
  1638. this.$message.warning('请选择BU!')
  1639. return
  1640. }
  1641. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1642. this.$message.warning('请选择物料编码!')
  1643. return
  1644. }
  1645. if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
  1646. this.$message.warning('请选择物料名称!')
  1647. return
  1648. }
  1649. // let obj = document.getElementsByName('isExemptInspection')
  1650. // let s = ''
  1651. // for (let i = 0; i < obj.length; i++) {
  1652. // if (obj[i].checked) {
  1653. // s += obj[i].value + ','
  1654. // }
  1655. // }
  1656. // s = s.substring(0, s.length - 1)
  1657. // this.modalData.exemptInspection = s
  1658. if (this.modalData.flag === '1') {
  1659. qcPartAttributeSave(this.modalData).then(({data}) => {
  1660. if (data && data.code === 0) {
  1661. this.getDataList()
  1662. this.modalFlag = false
  1663. this.$message({
  1664. message: '操作成功',
  1665. type: 'success',
  1666. duration: 1500,
  1667. onClose: () => {}
  1668. })
  1669. } else {
  1670. this.$alert(data.msg, '错误', {
  1671. confirmButtonText: '确定'
  1672. })
  1673. }
  1674. })
  1675. } else {
  1676. qcPartAttributeEdit(this.modalData).then(({data}) => {
  1677. if (data && data.code === 0) {
  1678. this.getDataList()
  1679. this.modalFlag = false
  1680. this.$message({
  1681. message: '操作成功',
  1682. type: 'success',
  1683. duration: 1500,
  1684. onClose: () => {}
  1685. })
  1686. } else {
  1687. this.$alert(data.msg, '错误', {
  1688. confirmButtonText: '确定'
  1689. })
  1690. }
  1691. })
  1692. }
  1693. },
  1694. // 保存属性模板
  1695. saveDetail () {
  1696. for (let i = 0; i < this.detailList.length; i++) {
  1697. this.detailList[i].updateBy = this.$store.state.user.name
  1698. saveAttributeDetailed(this.detailList[i]).then(({data}) => {
  1699. if (data && data.code === 0) {
  1700. this.getDataList()
  1701. this.detailModelFlag = false
  1702. this.$message({
  1703. message: '操作成功',
  1704. type: 'success',
  1705. duration: 1500,
  1706. onClose: () => {}
  1707. })
  1708. } else {
  1709. this.$alert(data.msg, '错误', {
  1710. confirmButtonText: '确定'
  1711. }).then(() => {
  1712. return false
  1713. })
  1714. }
  1715. })
  1716. }
  1717. },
  1718. /**
  1719. * 加载检验模板清单表格使用序号丢弃过期响应避免打开弹框时的请求晚于新增关闭后的刷新而把列表覆盖成旧数据
  1720. */
  1721. loadTemplateDetailList () {
  1722. this._detailListLoadSeq = (this._detailListLoadSeq || 0) + 1
  1723. const seq = this._detailListLoadSeq
  1724. const param = {
  1725. site: this.detailData.site,
  1726. buNo: this.detailData.buNo,
  1727. partNo: this.detailData.partNo,
  1728. attributeNo: this.detailData.attributeNo || this.detailData.partNo,
  1729. attributeType: this.detailData.attributeType || 'A',
  1730. createBy: this.detailData.createBy,
  1731. inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : ''
  1732. }
  1733. return searchPartAttributeDetails(param).then(({ data }) => {
  1734. if (seq !== this._detailListLoadSeq) return
  1735. let rows = (data && data.rows) ? data.rows : []
  1736. if (this.lineInspectionRoleFlag) {
  1737. const pqcInspectionTypeNo = this.getPqcInspectionTypeNo()
  1738. rows = rows.filter(item => item.inspectionTypeNo === pqcInspectionTypeNo || (item.inspectionTypeName && item.inspectionTypeName==='PQC'))
  1739. }
  1740. this.detailList = rows.slice()
  1741. })
  1742. },
  1743. // 打开物料模板清单
  1744. detailModal (row) {
  1745. this.detailData.site = row.site
  1746. this.detailData.buNo = row.buNo
  1747. this.detailData.partNo = row.partNo
  1748. this.detailData.attributeNo = row.partNo
  1749. this.detailData.attributeType = row.attributeType || 'A'
  1750. this.detailData.partDesc = row.partDesc
  1751. this.detailModelFlag = true
  1752. this.loadTemplateDetailList()
  1753. },
  1754. checkInspectionType () {
  1755. if (this.lineInspectionRoleFlag) {
  1756. this.detailData.inspectionTypeNo = this.getPqcInspectionTypeNo()
  1757. }
  1758. this.operationData.inspectionTypeNo = this.detailData.inspectionTypeNo
  1759. getPartTemplateLists(this.detailData).then(({data}) => {
  1760. this.operation = ''
  1761. this.resourceId = ''
  1762. this.itemList1 = data.row1
  1763. this.itemList2 = data.row2
  1764. })
  1765. },
  1766. // 快速新增
  1767. addFastModal () {
  1768. this.itemSelections1 = null
  1769. this.itemSelections2 = null
  1770. if (this.lineInspectionRoleFlag) {
  1771. this.detailData.inspectionTypeNo = this.getPqcInspectionTypeNo()
  1772. }
  1773. getPartTemplateLists(this.detailData).then(({data}) => {
  1774. this.itemList1 = data.row1
  1775. this.itemList2 = data.row2
  1776. })
  1777. if (this.lineInspectionRoleFlag) {
  1778. this.detailData.inspectionTypeNo = this.getPqcInspectionTypeNo()
  1779. } else if (this.options.length > 0) {
  1780. this.detailData.inspectionTypeNo = this.options[0].inspectionTypeNo
  1781. } else {
  1782. this.detailData.inspectionTypeNo = ''
  1783. }
  1784. this.checkInspectionType()
  1785. this.dataListOperationSelections = []
  1786. this.operation = ''
  1787. this.resourceId = ''
  1788. this.operationData.operationDesc = ''
  1789. this.resourceData.resourceId = ''
  1790. this.resourceData.resourceDesc = ''
  1791. this.operationCurrent = -1
  1792. this.resourceCurrent = -1
  1793. this.selectionManufacturer = []
  1794. this.dataListManufacturerSelections = []
  1795. this.fastAddFlag = true
  1796. },
  1797. // 可选项目
  1798. itemClickRow1 (row) {
  1799. this.$refs.itemTable1.toggleRowSelection(row)
  1800. },
  1801. // 已有项目
  1802. itemClickRow2 (row) {
  1803. this.$refs.itemTable2.toggleRowSelection(row)
  1804. },
  1805. selectFlag () {
  1806. return true
  1807. },
  1808. selectionItem1 (val) {
  1809. if (val.length > 1) {
  1810. const last = val[val.length - 1]
  1811. this.$refs.itemTable1.clearSelection()
  1812. this.$refs.itemTable1.toggleRowSelection(last, true)
  1813. this.itemSelections1 = [last]
  1814. } else {
  1815. this.itemSelections1 = val
  1816. }
  1817. },
  1818. selectionItem2 (val) {
  1819. this.itemSelections2 = val
  1820. },
  1821. // 添加模板
  1822. addItem () {
  1823. if (this.itemSelections1 == null || this.itemSelections1.length === 0) {
  1824. this.$message.warning('请选择可选模板!')
  1825. return
  1826. }
  1827. if (this.itemSelections1.length > 1) {
  1828. this.$message.warning('每次只能添加一个模板!')
  1829. return
  1830. }
  1831. const selectedTemplateId = this.itemSelections1[0].templateId
  1832. const existingTemplateIds = new Set([
  1833. ...(this.itemList2 || []).map(item => item.templateId),
  1834. ...(this.detailList || []).map(item => item.templateId)
  1835. ])
  1836. if (existingTemplateIds.has(selectedTemplateId)) {
  1837. this.$message.warning(`模板编码【${selectedTemplateId}】已存在,不能重复添加!`)
  1838. return
  1839. }
  1840. if ((this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107' || this.detailData.inspectionTypeNo === '108') && (this.operation == null || this.operation === '')) {
  1841. this.$message.warning('请选择工序!')
  1842. return
  1843. }
  1844. if ((this.detailData.inspectionTypeNo === '101' || this.detailData.inspectionTypeNo === '102' || this.detailData.inspectionTypeNo === '103' || this.detailData.inspectionTypeNo === '104' || this.detailData.inspectionTypeNo === '106' || this.detailData.inspectionTypeNo === '107') && (this.resourceId == null || this.resourceId === '')) {
  1845. this.$message.warning('请选择机台!')
  1846. return
  1847. }
  1848. let inData = {
  1849. site: this.detailData.site,
  1850. buNo: this.detailData.buNo,
  1851. attributeNo: this.detailData.partNo,
  1852. itemList: [this.itemSelections1[0]],
  1853. operation: this.operation,
  1854. resourceID: this.resourceId,
  1855. manufacturerList: ['*'],
  1856. attributeType: this.detailData.attributeType,
  1857. inspectionTypeNo: this.detailData.inspectionTypeNo,
  1858. createBy: this.$store.state.user.name,
  1859. updateBy: this.$store.state.user.name
  1860. }
  1861. savePartAttributeDetails(inData).then(({data}) => {
  1862. if (data && data.code === 0) {
  1863. getPartTemplateLists(this.detailData).then(({data}) => {
  1864. this.itemList1 = data.row1
  1865. this.itemList2 = data.row2
  1866. })
  1867. this.loadTemplateDetailList()
  1868. this.itemSelections1 = []
  1869. this.operation = ''
  1870. this.resourceId = ''
  1871. this.selectionManufacturer = []
  1872. } else {
  1873. this.$alert(data.msg, '错误', {
  1874. confirmButtonText: '确定'
  1875. })
  1876. }
  1877. })
  1878. },
  1879. // 删除模板
  1880. deleteItem () {
  1881. if (this.itemSelections2 == null || this.itemSelections2.length === 0) {
  1882. this.$message.warning('请选择已有模板!')
  1883. return
  1884. }
  1885. let inData = {
  1886. attributeNo:this.detailData.partNo,
  1887. itemList: this.itemSelections2,
  1888. attributeType: this.detailData.attributeType,
  1889. site: this.detailData.site,
  1890. buNo: this.detailData.buNo,
  1891. }
  1892. deletePartAttributeDetails(inData).then(({data}) => {
  1893. if (data && data.code === 0) {
  1894. getPartTemplateLists(this.detailData).then(({data}) => {
  1895. this.itemList1 = data.row1
  1896. this.itemList2 = data.row2
  1897. })
  1898. this.loadTemplateDetailList()
  1899. this.itemSelections2 = []
  1900. } else {
  1901. this.$alert(data.msg, '错误', {
  1902. confirmButtonText: '确定'
  1903. })
  1904. }
  1905. })
  1906. },
  1907. // 关闭「新增」弹框后刷新父弹框清单(与 loadTemplateDetailList 共用防竞态逻辑)
  1908. refreshDetailList () {
  1909. if (!this.detailModelFlag) return
  1910. this.loadTemplateDetailList()
  1911. },
  1912. // 删除物料属性中的模板
  1913. deletePartAttributeDetails (row) {
  1914. this.$confirm(`是否删除这个检验模板?`, '提示', {
  1915. confirmButtonText: '确定',
  1916. cancelButtonText: '取消',
  1917. type: 'warning'
  1918. }).then(() => {
  1919. deletePartAttributeDetails(row).then(({data}) => {
  1920. if (data && data.code === 0) {
  1921. this.loadTemplateDetailList()
  1922. this.$message({
  1923. message: '操作成功',
  1924. type: 'success',
  1925. duration: 1500,
  1926. onClose: () => {}
  1927. })
  1928. } else {
  1929. this.$alert(data.msg, '错误', {
  1930. confirmButtonText: '确定'
  1931. })
  1932. }
  1933. })
  1934. }).catch(() => {
  1935. })
  1936. },
  1937. // 物料模板检验标准弹窗
  1938. inspectionStandardListModal (row) {
  1939. this.standardHeader = {
  1940. site: row.site || this.detailData.site,
  1941. buNo: row.buNo || this.detailData.buNo,
  1942. attributeNo: this.detailData.partNo,
  1943. attributeType: this.detailData.attributeType || 'A',
  1944. partDesc: this.detailData.partDesc,
  1945. templateId: row.templateId,
  1946. inspectionTypeNo: row.inspectionTypeNo || '',
  1947. inspectionTypeName: row.inspectionTypeName || ''
  1948. }
  1949. let req = {
  1950. site: this.standardHeader.site,
  1951. buNo: this.standardHeader.buNo,
  1952. attributeNo: this.standardHeader.attributeNo,
  1953. templateId: this.standardHeader.templateId
  1954. }
  1955. qcAttributeTemplateItemDetailsSearch(req).then(({data}) => {
  1956. if (data && data.code === 0) {
  1957. this.standardList = data.rows || []
  1958. this.inspectionStandardListFlag = true
  1959. } else {
  1960. this.$alert(data.msg || '查询失败', '错误', {
  1961. confirmButtonText: '确定'
  1962. })
  1963. }
  1964. })
  1965. },
  1966. // 保存物料模板检验标准
  1967. saveStandardList () {
  1968. if (!this.standardHeader.templateId) {
  1969. this.$message.warning('请先选择模板!')
  1970. return
  1971. }
  1972. if (this.standardList == null || this.standardList.length === 0) {
  1973. this.$message.warning('当前模板没有可保存的检验项目!')
  1974. return
  1975. }
  1976. let req = {
  1977. site: this.standardHeader.site,
  1978. buNo: this.standardHeader.buNo,
  1979. attributeNo: this.standardHeader.attributeNo,
  1980. attributeType: this.standardHeader.attributeType,
  1981. templateId: this.standardHeader.templateId,
  1982. createBy: this.$store.state.user.name,
  1983. updateBy: this.$store.state.user.name,
  1984. itemList: this.standardList.map(item => ({
  1985. itemNo: item.itemNo,
  1986. defaultValue: item.defaultValue,
  1987. maxValue: item.maxValue,
  1988. minValue: item.minValue,
  1989. orderId: item.orderId
  1990. }))
  1991. }
  1992. qcAttributeTemplateItemSave(req).then(({data}) => {
  1993. if (data && data.code === 0) {
  1994. this.$message({
  1995. message: '操作成功',
  1996. type: 'success',
  1997. duration: 1500,
  1998. onClose: () => {}
  1999. })
  2000. this.inspectionStandardListFlag = false
  2001. } else {
  2002. this.$alert(data.msg || '保存失败', '错误', {
  2003. confirmButtonText: '确定'
  2004. })
  2005. }
  2006. })
  2007. },
  2008. // 校验用户是否收藏
  2009. favoriteIsOk () {
  2010. let userFavorite = {
  2011. userId: this.$store.state.user.id,
  2012. languageCode: this.$i18n.locale
  2013. }
  2014. userFavoriteList(userFavorite).then(({data}) => {
  2015. for (let i = 0; i < data.list.length; i++) {
  2016. if (this.$route.meta.menuId === data.list[i].menuId) {
  2017. this.favorite = true
  2018. }
  2019. }
  2020. })
  2021. },
  2022. // 收藏 OR 取消收藏
  2023. favoriteFunction () {
  2024. let userFavorite = {
  2025. userId: this.$store.state.user.id,
  2026. functionId: this.$route.meta.menuId,
  2027. }
  2028. if (this.favorite) {
  2029. removeUserFavorite(userFavorite).then(({data}) => {
  2030. this.$message.success(data.msg)
  2031. this.favorite = false
  2032. })
  2033. } else {
  2034. // 收藏
  2035. saveUserFavorite(userFavorite).then(({data}) => {
  2036. this.$message.success(data.msg)
  2037. this.favorite = true
  2038. })
  2039. }
  2040. },
  2041. //导出excel
  2042. async createExportData() {
  2043. this.searchData.limit = -1
  2044. this.searchData.page = 1
  2045. await qcPartAttributeSearch(this.searchData).then(({data}) => {
  2046. this.exportList= data.page.list
  2047. })
  2048. return this.exportList
  2049. },
  2050. startDownload() {},
  2051. finishDownload() {},
  2052. fields () {
  2053. let json = "{"
  2054. this.columnList.forEach((item, index) => {
  2055. if (index == this.columnList.length - 1) {
  2056. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  2057. } else {
  2058. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  2059. }
  2060. })
  2061. json += "}"
  2062. let s = eval("(" + json + ")")
  2063. return s
  2064. },
  2065. // 导入
  2066. qcUpload () {
  2067. let currentData = {
  2068. flag: 'partAttribute',
  2069. createBy: this.$store.state.user.name,
  2070. site: this.$store.state.user.site,
  2071. }
  2072. //打开组件 去做新增业务
  2073. this.$nextTick(() => {
  2074. this.$refs.qcUpload.init(currentData)
  2075. })
  2076. },
  2077. // 获取工序列表
  2078. getOperationList () {
  2079. getOperationDescList(this.operationData).then(({data}) => {
  2080. if (data && data.code === 0) {
  2081. this.operationList = data.rows
  2082. // // 回显数据
  2083. // // 先清空缓存选中
  2084. // this.$nextTick(() => this.$refs.operationTable.clearSelection())
  2085. // // 拿到选中的工序
  2086. // let tempDataList = this.operationDesc
  2087. // this.operationList.forEach(val => {
  2088. // // 回显选中的工序
  2089. // if (tempDataList === val.operationDesc) {
  2090. // this.$nextTick(() => this.$refs.operationTable.toggleRowSelection(val, true))
  2091. // }
  2092. // })
  2093. this.operationModelFlag = true
  2094. } else {
  2095. this.$alert(data.msg, '错误', {
  2096. confirmButtonText: '确定'
  2097. })
  2098. }
  2099. })
  2100. },
  2101. // 获取机台列表
  2102. getAllResourceList () {
  2103. this.resourceData.site = this.detailData.site
  2104. getAllResourceList(this.resourceData).then(({data}) => {
  2105. if (data && data.code === 0) {
  2106. this.resourceList = data.rows
  2107. this.resourceModelFlag = true
  2108. } else {
  2109. this.$alert(data.msg, '错误', {
  2110. confirmButtonText: '确定'
  2111. })
  2112. }
  2113. })
  2114. },
  2115. // 条件查询获取工序列表
  2116. getOperationList2 () {
  2117. getOperationDescList(this.operationData).then(({data}) => {
  2118. if (data && data.code === 0) {
  2119. this.operationList = data.rows
  2120. this.operationCurrent = -1
  2121. } else {
  2122. this.$alert(data.msg, '错误', {
  2123. confirmButtonText: '确定'
  2124. })
  2125. }
  2126. })
  2127. },
  2128. // 条件查询获取机台列表
  2129. getAllResourceList2 () {
  2130. this.resourceData.site = this.detailData.site
  2131. getAllResourceList(this.resourceData).then(({data}) => {
  2132. if (data && data.code === 0) {
  2133. this.resourceList = data.rows
  2134. this.resourceCurrent = -1
  2135. } else {
  2136. this.$alert(data.msg, '错误', {
  2137. confirmButtonText: '确定'
  2138. })
  2139. }
  2140. })
  2141. },
  2142. // 点击行选中工序复选框
  2143. operationClickRow (row) {
  2144. this.$refs.operationTable.toggleRowSelection(row)
  2145. },
  2146. // 点击行选中机台复选框
  2147. resourceClickRow (row) {
  2148. this.$refs.resourceTable.toggleRowSelection(row)
  2149. },
  2150. // 多选工序
  2151. selectionOperationChangeHandle (val) {
  2152. this.operation = val[0].operationDesc
  2153. if (val) {
  2154. this.operationCurrent = val.index
  2155. }
  2156. },
  2157. // 多选机台
  2158. selectionResourceChangeHandle (val) {
  2159. this.resourceId = val[0].resourceId
  2160. if (val) {
  2161. this.resourceCurrent = val.index
  2162. }
  2163. },
  2164. operationRowClassName ({row, rowIndex}) {
  2165. row.index = rowIndex // 在原有的数据上加一个index
  2166. },
  2167. resourceRowClassName ({row, rowIndex}) {
  2168. row.index = rowIndex // 在原有的数据上加一个index
  2169. },
  2170. // // 单选
  2171. // clickChange (row) {
  2172. // this.radioOperation = row.operationDesc
  2173. // },
  2174. // 确认选择工序
  2175. confirmOperation () {
  2176. //this.operationDesc = ''
  2177. // this.operationDesc = this.radioOperation
  2178. // this.radioOperation = ''
  2179. // for (let i = 0; i < this.dataListOperationSelections.length; i++) {
  2180. // this.selectionOperation.push(this.dataListOperationSelections[i].operationDesc)
  2181. // }
  2182. this.operationModelFlag = false
  2183. },
  2184. // 确认选择工序
  2185. confirmResource () {
  2186. this.resourceModelFlag = false
  2187. },
  2188. // 获取供应商列表
  2189. getManufacturerList () {
  2190. this.manufacturerData.site = this.detailData.site
  2191. getManufacturerList(this.manufacturerData).then(({data}) => {
  2192. if (data && data.code === 0) {
  2193. this.manufacturerList = data.rows
  2194. // 回显数据
  2195. // 先清空缓存选中
  2196. this.$nextTick(() => this.$refs.manufacturerTable.clearSelection())
  2197. // 拿到选中的供应商
  2198. let tempDataList = this.selectionManufacturer
  2199. this.manufacturerList.forEach(val => {
  2200. // 回显选中的供应商
  2201. if (tempDataList.includes(val.manufacturerID)) {
  2202. this.$nextTick(() => this.$refs.manufacturerTable.toggleRowSelection(val, true))
  2203. }
  2204. })
  2205. this.manufacturerModelFlag = true
  2206. } else {
  2207. this.$alert(data.msg, '错误', {
  2208. confirmButtonText: '确定'
  2209. })
  2210. }
  2211. })
  2212. },
  2213. // 点击行选中复选框
  2214. manufacturerClickRow (row) {
  2215. this.$refs.manufacturerTable.toggleRowSelection(row)
  2216. },
  2217. // 多选
  2218. selectionManufacturerChangeHandle (val) {
  2219. this.dataListManufacturerSelections = val
  2220. },
  2221. // 确认多选供应商
  2222. confirmManufacturer () {
  2223. this.selectionManufacturer = []
  2224. for (let i = 0; i < this.dataListManufacturerSelections.length; i++) {
  2225. this.selectionManufacturer.push(this.dataListManufacturerSelections[i].manufacturerID)
  2226. }
  2227. this.manufacturerModelFlag = false
  2228. },
  2229. // sop文件列表
  2230. sopFileList (row) {
  2231. this.sopData = {
  2232. site: row.site,
  2233. buNo: row.buNo,
  2234. partNo: row.partNo,
  2235. inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : ''
  2236. }
  2237. this.getFileContentList()
  2238. },
  2239. getFileContentList () {
  2240. if (this.lineInspectionRoleFlag) {
  2241. this.sopData.inspectionTypeNo = this.getPqcInspectionTypeNo()
  2242. }
  2243. let tempData = {
  2244. orderRef1: this.sopData.site,
  2245. orderRef2: this.sopData.partNo,
  2246. orderRef3:this.sopData.inspectionTypeNo,
  2247. orderRef4: this.sopData.buNo,
  2248. }
  2249. getFileContentList(tempData).then(({data}) => {
  2250. if (data && data.code === 200) {
  2251. this.sopList = data.rows
  2252. } else {
  2253. this.sopList = []
  2254. }
  2255. })
  2256. this.sopFileModelFlag = true
  2257. },
  2258. // 上传sop文件模态框
  2259. uploadSopFile () {
  2260. let currentData = {
  2261. titleCon: 'SOP文件上传',
  2262. site: this.sopData.site,
  2263. buNo: this.sopData.buNo,
  2264. createBy: this.$store.state.user.name,
  2265. partNo: this.sopData.partNo,
  2266. inspectionTypeNo: this.lineInspectionRoleFlag ? this.getPqcInspectionTypeNo() : '',
  2267. options: this.options
  2268. }
  2269. //打开组件 去做新增业务
  2270. this.$nextTick(() => {
  2271. this.$refs.qcSOPUploadFile.init(currentData)
  2272. })
  2273. },
  2274. // 文件下载
  2275. downloadFile (row) {
  2276. downLoadObjectFile(row).then(({data}) => {
  2277. // 不限制文件下载类型
  2278. const blob = new Blob([data], {type: "application/octet-stream"})
  2279. // 下载文件名称
  2280. const fileName = row.fileName
  2281. // a标签下载
  2282. const linkNode = document.createElement('a')
  2283. // a标签的download属性规定下载文件的名称
  2284. linkNode.download = fileName
  2285. linkNode.style.display = 'none'
  2286. // 生成一个Blob URL
  2287. linkNode.href = URL.createObjectURL(blob)
  2288. document.body.appendChild(linkNode)
  2289. // 模拟在按钮上的一次鼠标单击
  2290. linkNode.click()
  2291. // 释放URL 对象
  2292. URL.revokeObjectURL(linkNode.href)
  2293. document.body.removeChild(linkNode)
  2294. })
  2295. },
  2296. // 删除文件
  2297. deleteFile (row) {
  2298. this.$confirm('确定要删除此文件?', '提示', {
  2299. confirmButtonText: '确定',
  2300. cancelButtonText: '取消',
  2301. type: 'warning'
  2302. }).then(() => {
  2303. deleteObjectFile(row).then(({data}) => {
  2304. if (data && data.code === 0) {
  2305. this.getFileContentList()
  2306. this.$message({
  2307. message: '操作成功',
  2308. type: 'success',
  2309. duration: 1500,
  2310. onClose: () => {}
  2311. })
  2312. } else {
  2313. this.$alert(data.msg, '错误', {
  2314. confirmButtonText: '确定'
  2315. })
  2316. }
  2317. })
  2318. }).catch(() => {
  2319. })
  2320. },
  2321. // 物料SOP文件列表
  2322. openPartSopFileList (row) {
  2323. this.partSopCurrent = {
  2324. site: row.site,
  2325. partNo: row.partNo
  2326. }
  2327. this.fetchPartSopList()
  2328. this.partSopFileModelFlag = true
  2329. },
  2330. fetchPartSopList () {
  2331. if (!this.partSopCurrent || !this.partSopCurrent.site || !this.partSopCurrent.partNo) {
  2332. this.partSopList = []
  2333. return
  2334. }
  2335. const params = {
  2336. orderRef1: this.partSopCurrent.site,
  2337. orderRef2: this.partSopCurrent.partNo,
  2338. orderRef3: '',
  2339. orderReftype: 'PartSop'
  2340. }
  2341. this.partSopLoading = true
  2342. queryOssFilePlus(params).then(({data}) => {
  2343. if (data && data.code === 0) {
  2344. this.partSopList = data.rows || []
  2345. } else {
  2346. this.partSopList = []
  2347. }
  2348. }).catch(() => {
  2349. this.partSopList = []
  2350. }).finally(() => {
  2351. this.partSopLoading = false
  2352. })
  2353. },
  2354. openPartSopUploadDialog () {
  2355. if (!this.partSopCurrent || !this.partSopCurrent.site || !this.partSopCurrent.partNo) {
  2356. this.$message.warning('请先选择物料')
  2357. return
  2358. }
  2359. this.fileList2 = []
  2360. this.ossForm.remark = ''
  2361. this.ossVisible = true
  2362. this.$nextTick(() => {
  2363. if (this.$refs.upload) {
  2364. this.$refs.upload.clearFiles()
  2365. }
  2366. })
  2367. },
  2368. onRemoveFile (file, fileList) {
  2369. this.fileList2 = fileList
  2370. },
  2371. onChangeFile (file, fileList) {
  2372. this.fileList2 = fileList
  2373. },
  2374. handleUploadFiles () {
  2375. if (!this.partSopCurrent || !this.partSopCurrent.site || !this.partSopCurrent.partNo) {
  2376. this.$message.warning('请先选择物料')
  2377. return
  2378. }
  2379. if (!this.fileList2 || this.fileList2.length === 0) {
  2380. this.$message.warning('请选择文件')
  2381. return
  2382. }
  2383. let formData = new FormData()
  2384. for (let i = 0; i < this.fileList2.length; i++) {
  2385. formData.append('file', this.fileList2[i].raw)
  2386. }
  2387. formData.append('orderRef1', this.partSopCurrent.site)
  2388. formData.append('orderRef2', this.partSopCurrent.partNo)
  2389. formData.append('orderRef3', '')
  2390. formData.append('createdBy', this.$store.state.user.name)
  2391. formData.append('CAdditionalInfo', this.ossForm.remark || '')
  2392. formData.append('orderReftype', 'PartSop')
  2393. this.uploadLoading = true
  2394. ossUploadNoSaveOSSForYJY(formData).then(({ data }) => {
  2395. if (data && data.code === 0) {
  2396. this.$message.success('上传成功')
  2397. this.ossVisible = false
  2398. this.fileList2 = []
  2399. this.ossForm.remark = ''
  2400. this.fetchPartSopList()
  2401. } else {
  2402. this.$message.warning(data.msg || '上传失败')
  2403. }
  2404. }).catch(() => {
  2405. this.$message.error('上传失败')
  2406. }).finally(() => {
  2407. this.uploadLoading = false
  2408. })
  2409. },
  2410. previewPartSopFile (row) {
  2411. let params = {
  2412. id: row.id
  2413. }
  2414. previewOssFileById(params).then((response) => {
  2415. const contentType = (response.headers && response.headers['content-type']) || 'application/octet-stream'
  2416. const blob = new Blob([response.data], { type: contentType })
  2417. const link = document.createElement('a')
  2418. link.href = URL.createObjectURL(blob)
  2419. link.setAttribute('download', row.fileName)
  2420. link.target = '_blank'
  2421. link.click()
  2422. URL.revokeObjectURL(link.href)
  2423. })
  2424. },
  2425. removePartSopFile (row) {
  2426. this.$confirm('确定要删除该文件吗?', '提示', {
  2427. confirmButtonText: '确定',
  2428. cancelButtonText: '取消',
  2429. type: 'warning'
  2430. }).then(() => {
  2431. removeOss([row.id]).then(({ data }) => {
  2432. if (data && data.code === 0) {
  2433. this.$message.success('删除成功')
  2434. this.fetchPartSopList()
  2435. } else {
  2436. this.$message.warning(data.msg || '删除失败')
  2437. }
  2438. })
  2439. }).catch(() => {
  2440. })
  2441. },
  2442. // 动态列开始 获取 用户保存的 格式列
  2443. async getTableUserColumn (tableId, columnId) {
  2444. let queryTableUser = {
  2445. userId: this.$store.state.user.name,
  2446. functionId: this.$route.meta.menuId,
  2447. tableId: tableId,
  2448. status: true,
  2449. languageCode: this.$i18n.locale
  2450. }
  2451. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  2452. if (data.rows.length > 0) {
  2453. //this.columnList1 = []
  2454. switch (columnId) {
  2455. case 1:
  2456. this.columnList = data.rows
  2457. break;
  2458. case 2:
  2459. this.columnDetailList = data.rows
  2460. break;
  2461. // case 3:
  2462. // this.columnList2 = data.rows
  2463. // break;
  2464. // case 4:
  2465. // this.columnList3 = data.rows
  2466. // break;
  2467. }
  2468. } else {
  2469. this.getColumnList(tableId, columnId)
  2470. }
  2471. })
  2472. },
  2473. // 获取 tableDefault 列
  2474. async getColumnList (tableId, columnId) {
  2475. let queryTable = {
  2476. functionId: this.$route.meta.menuId,
  2477. tableId: tableId,
  2478. languageCode: this.$i18n.locale
  2479. }
  2480. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  2481. if (!data.rows.length == 0) {
  2482. switch (columnId) {
  2483. case 1:
  2484. this.columnList = data.rows
  2485. break;
  2486. case 2:
  2487. this.columnDetailList = data.rows
  2488. break;
  2489. // case 3:
  2490. // this.columnList2 = data.rows
  2491. // break;
  2492. // case 4:
  2493. // this.columnList3 = data.rows
  2494. // break;
  2495. }
  2496. } else {
  2497. // this.showDefault = true.
  2498. }
  2499. })
  2500. },
  2501. closeDialog () {
  2502. this.partDetailData = {
  2503. partNo: '',
  2504. partDesc: '',
  2505. seqNo: '',
  2506. sku: '',
  2507. }
  2508. this.partInfoList = []
  2509. },
  2510. //获取按钮的权限数据
  2511. getButtonAuthData () {
  2512. let searchFlag = this.isAuth(this.menuId+":search")
  2513. let saveFlag = this.isAuth(this.menuId+":save")
  2514. let updateFlag = this.isAuth(this.menuId+":update")
  2515. let deleteFlag = this.isAuth(this.menuId+":delete")
  2516. let detailFlag = this.isAuth(this.menuId+":detail")
  2517. let fileFlag = this.isAuth(this.menuId+":file")
  2518. //处理页面的权限数据
  2519. this.authSearch = !searchFlag
  2520. this.authSave = !saveFlag
  2521. this.authUpdate = !updateFlag
  2522. this.authDelete = !deleteFlag
  2523. this.authDetail = !detailFlag
  2524. this.authFile = !fileFlag
  2525. },
  2526. // 是否包含换线点检角色
  2527. resolveLineInspectionRoleFlag () {
  2528. return this.$store.state.user.lineInspectionRoleFlag === true || localStorage.getItem('lineInspectionRoleFlag') === 'Y'
  2529. },
  2530. // 获取PQC对应的检验类型编码
  2531. getPqcInspectionTypeNo () {
  2532. const pqcData = this.options.find(item => item.inspectionTypeName && item.inspectionTypeName==='PQC')
  2533. if (pqcData) {
  2534. this.pqcInspectionTypeNo = pqcData.inspectionTypeNo
  2535. }
  2536. return this.pqcInspectionTypeNo
  2537. },
  2538. }
  2539. }
  2540. </script>
  2541. <style scoped>
  2542. .el-table /deep/ .cell{
  2543. height: auto;
  2544. line-height: 1.5;
  2545. }
  2546. .rq .auto /deep/ .el-form-item__content {
  2547. height: auto;
  2548. line-height: 1.5;
  2549. }
  2550. </style>