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.

3131 lines
112 KiB

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