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.

1538 lines
52 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 收藏 -->
  4. <div>
  5. <span @click="favoriteFunction()">
  6. <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
  7. </span>
  8. </div>
  9. <!-- 条件查询 -->
  10. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  11. <el-form-item :label="'物料编码'">
  12. <el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
  13. </el-form-item>
  14. <el-form-item :label="'物料名称'">
  15. <el-input v-model="searchData.partDesc" clearable style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="'类别名称'">
  18. <el-input v-model="searchData.familyName" clearable style="width: 120px"></el-input>
  19. </el-form-item>
  20. <el-form-item :label="' '">
  21. <el-button type="primary" @click="getDataList()">查询</el-button>
  22. <el-button type="primary" @click="addModal()">新增</el-button>
  23. </el-form-item>
  24. <el-form-item :label="' '">
  25. <el-button type="primary" icon="el-icon-upload" @click="qcUpload()">导入</el-button>
  26. <download-excel
  27. :fields="fields()"
  28. :data="exportData"
  29. type="xls"
  30. :name="exportName"
  31. :header="exportHeader"
  32. :footer="exportFooter"
  33. :fetch="createExportData"
  34. :before-generate="startDownload"
  35. :before-finish="finishDownload"
  36. worksheet="导出信息"
  37. class="el-button el-button--primary el-button--medium">
  38. {{ "导出" }}
  39. </download-excel>
  40. </el-form-item>
  41. </el-form>
  42. <!-- 展示列表 -->
  43. <el-table
  44. :height="height"
  45. :data="dataList"
  46. border
  47. v-loading="dataListLoading"
  48. style="width: 100%;">
  49. <!-- <el-table-column-->
  50. <!-- prop="partNo"-->
  51. <!-- header-align="center"-->
  52. <!-- align="center"-->
  53. <!-- label="物料编码"-->
  54. <!-- width="100">-->
  55. <!-- </el-table-column>-->
  56. <!-- <el-table-column-->
  57. <!-- prop="partDesc"-->
  58. <!-- header-align="center"-->
  59. <!-- align="left"-->
  60. <!-- label="物料名称"-->
  61. <!-- :width="flexColumnWidth('物料名称','partDesc')">-->
  62. <!-- </el-table-column>-->
  63. <el-table-column
  64. v-for="(item,index) in columnList" :key="index"
  65. :sortable="item.columnSortable"
  66. :prop="item.columnProp"
  67. :header-align="item.headerAlign"
  68. :show-overflow-tooltip="item.showOverflowTooltip"
  69. :align="item.align"
  70. :fixed="item.fixed === ''?false:item.fixed"
  71. :width="item.columnWidth"
  72. :label="item.columnLabel">
  73. <template slot-scope="scope">
  74. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  75. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. fixed="right"
  80. header-align="center"
  81. align="center"
  82. width="160"
  83. label="操作">
  84. <template slot-scope="scope">
  85. <a type="text" size="small" @click="detailModal(scope.row)">检验模板</a>
  86. <a type="text" size="small" @click="deletePropertiesModel(scope.row)">删除</a>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <!-- 分页栏 -->
  91. <el-pagination
  92. @size-change="sizeChangeHandle"
  93. @current-change="currentChangeHandle"
  94. :current-page="pageIndex"
  95. :page-sizes="[20, 50, 100, 200, 500]"
  96. :page-size="pageSize"
  97. :total="totalPage"
  98. layout="total, sizes, prev, pager, next, jumper">
  99. </el-pagination>
  100. <!-- 物料属性新增/修改 -->
  101. <el-dialog title="物料属性设置" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="430px">
  102. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  103. <el-form-item prop="partNo" :rules="rules.partNoType">
  104. <span slot="label" @click="getBaseList(1043)"><a herf="#">物料编码:</a></span>
  105. <el-input v-model="modalData.partNo" style="width: 120px"></el-input>
  106. </el-form-item>
  107. <el-form-item label="物料名称:" prop="partDesc" :rules="rules.partDescType">
  108. <el-input v-model="modalData.partDesc" disabled style="width: 240px"></el-input>
  109. </el-form-item>
  110. </el-form>
  111. <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
  112. <el-form-item label="备注:">
  113. <el-input v-model="modalData.attributeRemark" style="width: 315px"></el-input>
  114. </el-form-item>
  115. <el-form-item label="是否免检">
  116. <input type="checkbox" value="Y" name="isExemptInspection" v-model="modalData.exemptInspection"/>
  117. </el-form-item>
  118. </el-form>
  119. <el-footer style="height:40px;margin-top: 10px;text-align:center">
  120. <el-button type="primary" @click="saveData()">保存</el-button>
  121. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  122. </el-footer>
  123. </el-dialog>
  124. <!-- 检验模板 -->
  125. <el-dialog title="检验模板清单" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="1400px">
  126. <el-form :inline="true" label-position="top" @keyup.enter.native="getDataList()">
  127. <el-form-item :label="'物料编码'">
  128. <el-input v-model="detailData.partNo" readonly style="width: 120px"></el-input>
  129. </el-form-item>
  130. <el-form-item :label="'物料名称'">
  131. <el-input v-model="detailData.partDesc" readonly style="width: 300px"></el-input>
  132. </el-form-item>
  133. <el-form-item :label="' '">
  134. <el-button type="primary" @click="addFastModal()">新增</el-button>
  135. </el-form-item>
  136. </el-form>
  137. <!-- 检验项目展示列表 -->
  138. <div class="rq ">
  139. <el-table
  140. :height="300"
  141. :data="detailList"
  142. border
  143. v-loading="dataListLoading"
  144. style="width: 100%;">
  145. <el-table-column
  146. prop="templateId"
  147. header-align="center"
  148. align="center"
  149. label="模板编码">
  150. </el-table-column>
  151. <el-table-column
  152. prop="templateName"
  153. header-align="center"
  154. align="left"
  155. label="模板名称"
  156. :width="flexColumnWidth2('模板名称','templateName')">
  157. </el-table-column>
  158. <el-table-column
  159. v-for="(item,index) in columnDetailList" :key="index"
  160. :sortable="item.columnSortable"
  161. :prop="item.columnProp"
  162. :header-align="item.headerAlign"
  163. :show-overflow-tooltip="item.showOverflowTooltip"
  164. :align="item.align"
  165. :fixed="item.fixed===''?false:item.fixed"
  166. :min-width="item.columnWidth"
  167. :label="item.columnLabel">
  168. <template slot-scope="scope">
  169. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  170. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  171. </template>
  172. </el-table-column>
  173. <el-table-column
  174. prop="operation"
  175. header-align="center"
  176. align="center"
  177. label="工序">
  178. </el-table-column>
  179. <el-table-column
  180. prop="resourceID"
  181. header-align="center"
  182. align="center"
  183. label="机台">
  184. </el-table-column>
  185. <el-table-column
  186. prop="manufacturerName"
  187. header-align="center"
  188. align="center"
  189. label="供应商">
  190. </el-table-column>
  191. <el-table-column
  192. prop=""
  193. header-align="center"
  194. align="center"
  195. min-width="170"
  196. label="检验水平">
  197. <template slot-scope="scope">
  198. <el-button type="primary" @click="chooseLevel(scope.row)" style="width:18%;padding: 3px 7px">·&nbsp;·&nbsp;·</el-button>
  199. <el-input v-model="scope.row.samplingLevelDesc" readonly style="width:77%"></el-input>
  200. </template>
  201. </el-table-column>
  202. <el-table-column
  203. prop=""
  204. header-align="center"
  205. align="center"
  206. min-width="60"
  207. label="检验周期(h)">
  208. <template slot-scope="scope">
  209. <el-input v-model="scope.row.inspectionCycle" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  210. </template>
  211. </el-table-column>
  212. <el-table-column
  213. prop=""
  214. header-align="center"
  215. align="center"
  216. min-width="170"
  217. label="抽样方案">
  218. <template slot-scope="scope">
  219. <el-button type="primary" @click="chooseProgrammeRow(scope.row)" style="width:18%;padding: 3px 7px" >·&nbsp;·&nbsp;·</el-button>
  220. <el-input v-model="scope.row.samplingProgrammeDesc" readonly style="width:77%"></el-input>
  221. </template>
  222. </el-table-column>
  223. <el-table-column
  224. prop=""
  225. header-align="center"
  226. align="center"
  227. min-width="60"
  228. label="AQL">
  229. <template slot-scope="scope">
  230. <el-input v-model="scope.row.aql" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  231. </template>
  232. </el-table-column>
  233. <el-table-column
  234. prop=""
  235. header-align="center"
  236. align="center"
  237. min-width="60"
  238. label="AC">
  239. <template slot-scope="scope">
  240. <el-input v-model="scope.row.ac" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  241. </template>
  242. </el-table-column>
  243. <el-table-column
  244. prop=""
  245. header-align="center"
  246. align="center"
  247. min-width="60"
  248. label="RE">
  249. <template slot-scope="scope">
  250. <el-input v-model="scope.row.re" type="number" style="height: 11px;padding: 0px " allow-create>;width:98%"</el-input>
  251. </template>
  252. </el-table-column>
  253. <el-table-column
  254. prop="templateRemark"
  255. header-align="center"
  256. align="center"
  257. label="备注">
  258. </el-table-column>
  259. <el-table-column
  260. fixed="right"
  261. header-align="center"
  262. align="center"
  263. width="80"
  264. label="操作">
  265. <template slot-scope="scope">
  266. <a type="text" size="small" @click="deletePartAttributeDetails(scope.row)">删除模板</a>
  267. </template>
  268. </el-table-column>
  269. </el-table>
  270. </div>
  271. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  272. <el-button type="primary" @click="saveDetail()">保存</el-button>
  273. <el-button type="primary" @click="detailModelFlag = false">关闭</el-button>
  274. </el-footer>
  275. </el-dialog>
  276. <!-- 检验模板->快速新增 -->
  277. <el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="fastAddFlag" width="1100px">
  278. <div style="font-size: 12px">
  279. <el-form :inline="true" label-position="top" :model="detailData">
  280. <el-form-item :label="'模板编码'">
  281. <el-input v-model="detailData.templateId" clearable style="width: 120px"></el-input>
  282. </el-form-item>
  283. <el-form-item :label="'模板名称'">
  284. <el-input v-model="detailData.templateName" clearable style="width: 120px"></el-input>
  285. </el-form-item>
  286. <el-form-item label="检验类型">
  287. <el-select v-model="detailData.inspectionTypeNo" @change="checkInspectionType()" placeholder="请选择">
  288. <el-option
  289. v-for = "i in options"
  290. :key = "i.inspectionTypeNo"
  291. :label = "i.inspectionTypeName"
  292. :value = "i.inspectionTypeNo">
  293. </el-option>
  294. </el-select>
  295. </el-form-item>
  296. <el-form-item :label="' '">
  297. <el-button type="primary" @click="checkInspectionType()">查询</el-button>
  298. </el-form-item>
  299. <el-form-item style="margin-left: 117px" :label="' '">
  300. <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'">工序</el-button>
  301. <el-button type="primary" @click="getManufacturerList()" v-if="this.detailData.inspectionTypeNo === '105'" style="width: 63px">供应商</el-button>
  302. </el-form-item>
  303. <el-form-item :label="' '">
  304. <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>
  305. </el-form-item>
  306. </el-form>
  307. </div>
  308. <el-container style="margin-top: 0px;">
  309. <el-main style="width: 470px;padding: 1px">
  310. <span style="font-size: 12px" >可选模板</span>
  311. <el-table
  312. height="400px"
  313. :data="itemList1"
  314. border
  315. ref="itemTable1"
  316. @row-click="itemClickRow1"
  317. @selection-change="selectionItem1"
  318. highlight-current-row
  319. v-loading="dataListLoading"
  320. style="width: 100%">
  321. <el-table-column
  322. type="selection"
  323. header-align="center"
  324. align="center"
  325. :selectable="selectFlag"
  326. width="50">
  327. </el-table-column>
  328. <el-table-column
  329. prop="templateId"
  330. header-align="center"
  331. align="center"
  332. min-width="80"
  333. label="模板编码">
  334. </el-table-column>
  335. <el-table-column
  336. prop="templateName"
  337. header-align="center"
  338. align="center"
  339. min-width="170"
  340. label="模板名称">
  341. </el-table-column>
  342. <el-table-column
  343. prop="inspectionTypeName"
  344. header-align="center"
  345. align="center"
  346. min-width="80"
  347. label="检验类型">
  348. </el-table-column>
  349. </el-table>
  350. </el-main>
  351. <el-main style="width: 100px;padding: 1px">
  352. <div style="margin-top: 180px;margin-left: 18px">
  353. <el-button type="primary" @click="addItem()">添加>></el-button>
  354. </div>
  355. <div style="margin-top: 15px;margin-left: 18px">
  356. <el-button type="primary" @click="deleteItem()">删除<<</el-button>
  357. </div>
  358. </el-main>
  359. <el-main style="width: 470px;padding: 1px">
  360. <span style="font-size: 12px">已有模板</span>
  361. <el-table
  362. height="400px"
  363. :data="itemList2"
  364. border
  365. ref="itemTable2"
  366. @row-click="itemClickRow2"
  367. @selection-change="selectionItem2"
  368. highlight-current-row
  369. v-loading="dataListLoading"
  370. style="width: 100%">
  371. <el-table-column
  372. type="selection"
  373. header-align="center"
  374. align="center"
  375. :selectable="selectFlag"
  376. width="50">
  377. </el-table-column>
  378. <el-table-column
  379. prop="templateId"
  380. header-align="center"
  381. align="center"
  382. label="模板编码">
  383. </el-table-column>
  384. <el-table-column
  385. prop="templateName"
  386. header-align="center"
  387. align="center"
  388. label="模板名称">
  389. </el-table-column>
  390. <el-table-column
  391. prop="operation"
  392. header-align="center"
  393. align="center"
  394. label="工序">
  395. </el-table-column>
  396. <el-table-column
  397. prop="resourceID"
  398. header-align="center"
  399. align="center"
  400. label="机台">
  401. </el-table-column>
  402. <el-table-column
  403. prop="manufacturerName"
  404. header-align="center"
  405. align="center"
  406. label="供应商">
  407. </el-table-column>
  408. <el-table-column
  409. prop="inspectionTypeName"
  410. header-align="center"
  411. align="center"
  412. label="检验类型">
  413. </el-table-column>
  414. </el-table>
  415. </el-main>
  416. </el-container>
  417. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  418. <el-button type="primary" @click="fastAddFlag = false">关闭</el-button>
  419. </el-footer>
  420. </el-dialog>
  421. <!-- 工序 -->
  422. <el-dialog title="工序清单" :close-on-click-modal="false" v-drag :visible.sync="operationModelFlag" width="420px">
  423. <div class="rq">
  424. <el-form :inline="true" label-position="top" :model="operationData">
  425. <el-form-item :label="'工序:'">
  426. <el-input v-model="operationData.operationDesc" clearable style="width: 120px"></el-input>
  427. </el-form-item>
  428. <el-form-item :label="' '">
  429. <el-button type="primary" @click="getOperationList2()">查询</el-button>
  430. </el-form-item>
  431. </el-form>
  432. <el-table
  433. :height="300"
  434. :data="operationList"
  435. ref="operationTable"
  436. @row-click="operationClickRow"
  437. @selection-change="selectionOperationChangeHandle"
  438. border
  439. v-loading="dataListLoading"
  440. :row-class-name="operationRowClassName"
  441. style="width: 100%;">
  442. <el-table-column type="index" width="50" align="center">
  443. <template slot-scope="scope">
  444. <el-radio v-model="operationCurrent" :label="scope.row.index">{{''}}</el-radio>
  445. </template>
  446. </el-table-column>
  447. <el-table-column
  448. prop="operationDesc"
  449. header-align="center"
  450. align="center"
  451. label="工序">
  452. </el-table-column>
  453. </el-table>
  454. </div>
  455. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  456. <el-button type="primary" @click="confirmOperation()">确认</el-button>
  457. </el-footer>
  458. </el-dialog>
  459. <!-- 机台 -->
  460. <el-dialog title="机台清单" :close-on-click-modal="false" v-drag :visible.sync="resourceModelFlag" width="420px">
  461. <div class="rq">
  462. <el-form :inline="true" label-position="top" :model="resourceData">
  463. <el-form-item :label="'机台编码'">
  464. <el-input v-model="resourceData.resourceId" clearable style="width: 120px"></el-input>
  465. </el-form-item>
  466. <el-form-item :label="'机台名称'">
  467. <el-input v-model="resourceData.resourceDesc" clearable style="width: 120px"></el-input>
  468. </el-form-item>
  469. <el-form-item :label="' '">
  470. <el-button type="primary" @click="getAllResourceList2()">查询</el-button>
  471. </el-form-item>
  472. </el-form>
  473. <el-table
  474. :height="300"
  475. :data="resourceList"
  476. ref="resourceTable"
  477. @row-click="resourceClickRow"
  478. @selection-change="selectionResourceChangeHandle"
  479. border
  480. v-loading="dataListLoading"
  481. :row-class-name="resourceRowClassName"
  482. style="width: 100%;">
  483. <el-table-column type="index" width="50" align="center">
  484. <template slot-scope="scope">
  485. <el-radio v-model="resourceCurrent" :label="scope.row.index">{{''}}</el-radio>
  486. </template>
  487. </el-table-column>
  488. <el-table-column
  489. prop="resourceId"
  490. header-align="center"
  491. align="center"
  492. label="机台编码">
  493. </el-table-column>
  494. <el-table-column
  495. prop="resourceDesc"
  496. header-align="center"
  497. align="center"
  498. label="机台名称">
  499. </el-table-column>
  500. </el-table>
  501. </div>
  502. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  503. <el-button type="primary" @click="confirmResource()">确认</el-button>
  504. </el-footer>
  505. </el-dialog>
  506. <!-- 供应商 -->
  507. <el-dialog title="供应商清单" :close-on-click-modal="false" v-drag :visible.sync="manufacturerModelFlag" width="520px">
  508. <div class="rq">
  509. <el-form :inline="true" label-position="top" :model="manufacturerData">
  510. <el-form-item :label="'供应商编码:'">
  511. <el-input v-model="manufacturerData.manufacturerID" clearable style="width: 120px"></el-input>
  512. </el-form-item>
  513. <el-form-item :label="'供应商名称:'">
  514. <el-input v-model="manufacturerData.manufacturerName" clearable style="width: 120px"></el-input>
  515. </el-form-item>
  516. <el-form-item :label="' '">
  517. <el-button type="primary" @click="getManufacturerList()">查询</el-button>
  518. </el-form-item>
  519. </el-form>
  520. <el-table
  521. :height="300"
  522. :data="manufacturerList"
  523. ref="manufacturerTable"
  524. @row-click="manufacturerClickRow"
  525. @selection-change="selectionManufacturerChangeHandle"
  526. border
  527. v-loading="dataListLoading"
  528. style="width: 100%;">
  529. <el-table-column
  530. type="selection"
  531. header-align="center"
  532. align="center"
  533. :selectable="selectFlag"
  534. width="50">
  535. </el-table-column>
  536. <el-table-column
  537. prop="manufacturerID"
  538. header-align="center"
  539. align="center"
  540. label="供应商编码">
  541. </el-table-column>
  542. <el-table-column
  543. prop="manufacturerName"
  544. header-align="center"
  545. align="center"
  546. label="供应商名称">
  547. </el-table-column>
  548. </el-table>
  549. </div>
  550. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  551. <el-button type="primary" @click="confirmManufacturer()">确认</el-button>
  552. <el-button type="primary" @click="manufacturerModelFlag = false">关闭</el-button>
  553. </el-footer>
  554. </el-dialog>
  555. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  556. <!-- 导入 -->
  557. <qcUpload ref="qcUpload" @refreshPageTables="getDataList()" v-drag></qcUpload>
  558. </div>
  559. </template>
  560. <script>
  561. import {
  562. qcPartAttributeSearch, // 查询物料属性
  563. qcPartAttributeSave, // 新增物料属性
  564. qcPartAttributeDelete, // 删除物料属性
  565. searchPartAttributeDetails, // 查询物料属性模板
  566. savePartAttributeDetails, // 新增物料属性模板
  567. deletePartAttributeDetails, // 删除物料属性模板
  568. saveAttributeDetailed, // 新增物料属性模板详情
  569. //getItemLists, // 获取项目列表
  570. getPartTemplateLists, // 获取模板列表
  571. InspectionTypeSearch, // 搜索所有检验类型
  572. getOperationDescList, // 查询工序列表
  573. getManufacturerList, // 查询供应商列表
  574. getAllResourceList // 查询机台列表
  575. } from "@/api/qc/qc.js"
  576. import Chooselist from '@/views/modules/common/Chooselist_eam'
  577. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  578. import qcUpload from "./qc_upload";
  579. export default {
  580. components: {
  581. Chooselist,
  582. qcUpload
  583. },
  584. data () {
  585. return {
  586. // 是否收藏
  587. favorite: false,
  588. // 导出 start
  589. exportData: [],
  590. exportName: "根据物料设置检验模板" + this.dayjs().format('YYYYMMDDHHmmss'),
  591. exportHeader: ["根据物料设置检验模板"],
  592. exportFooter: [],
  593. exportList:[],
  594. // 导出 end
  595. tagNo: '',
  596. searchData: {
  597. site: this.$store.state.user.site,
  598. partNo: '',
  599. partDesc: '',
  600. familyID: '',
  601. familyName: '',
  602. attributeType: 'A',
  603. page: 1,
  604. limit: 10,
  605. },
  606. height: 200,
  607. pageIndex: 1,
  608. pageSize: 50,
  609. totalPage: 0,
  610. modalFlag: false,
  611. modalDisableFlag: false,
  612. modalData:{
  613. flag: '',
  614. partNo: '',
  615. partDesc: '',
  616. familyID: '',
  617. familyName: '',
  618. umid: '',
  619. supplierNo: '',
  620. supplierDesc: '',
  621. attributeRemark: '',
  622. createTime: '',
  623. createBy: this.$store.state.user.name,
  624. attributeType: 'A',
  625. exemptInspection: ''
  626. },
  627. detailData:{
  628. site: this.$store.state.user.site,
  629. partNo: '',
  630. attributeNo: '',
  631. partDesc: '',
  632. attributeType: 'A',
  633. inspectionTypeNo: '',
  634. templateId: '',
  635. templateName: '',
  636. createBy: this.$store.state.user.name
  637. },
  638. columnList: [
  639. {
  640. columnProp: 'partNo',
  641. headerAlign: "center",
  642. align: "center",
  643. columnLabel: '物料编码',
  644. columnHidden: false,
  645. columnImage: false,
  646. columnSortable: false,
  647. sortLv: 0,
  648. status: true,
  649. fixed: '',
  650. },
  651. {
  652. columnProp: 'partDesc',
  653. headerAlign: "center",
  654. align: "left",
  655. columnLabel: '物料名称',
  656. columnHidden: false,
  657. columnImage: false,
  658. columnSortable: false,
  659. sortLv: 0,
  660. status: true,
  661. fixed: '',
  662. },
  663. {
  664. columnProp: 'familyName',
  665. headerAlign: "center",
  666. align: "center",
  667. columnLabel: '物料类别',
  668. columnHidden: false,
  669. columnImage: false,
  670. columnSortable: false,
  671. sortLv: 0,
  672. status: true,
  673. fixed: '',
  674. },
  675. {
  676. columnProp: 'umid',
  677. headerAlign: "center",
  678. align: "center",
  679. columnLabel: '规格型号',
  680. columnHidden: false,
  681. columnImage: false,
  682. columnSortable: false,
  683. sortLv: 0,
  684. status: true,
  685. fixed: '',
  686. },
  687. {
  688. columnProp: 'supplierDesc',
  689. headerAlign: "center",
  690. align: "center",
  691. columnLabel: '供应商',
  692. columnHidden: false,
  693. columnImage: false,
  694. columnSortable: false,
  695. sortLv: 0,
  696. status: true,
  697. fixed: '',
  698. },
  699. {
  700. columnProp: 'exemptInspection',
  701. headerAlign: "center",
  702. align: "center",
  703. columnLabel: '是否免检',
  704. columnHidden: false,
  705. columnImage: false,
  706. columnSortable: false,
  707. sortLv: 0,
  708. status: true,
  709. fixed: '',
  710. },
  711. {
  712. columnProp: 'attributeRemark',
  713. headerAlign: "center",
  714. align: "center",
  715. columnLabel: '备注',
  716. columnHidden: false,
  717. columnImage: false,
  718. columnSortable: false,
  719. sortLv: 0,
  720. status: true,
  721. fixed: '',
  722. },
  723. {
  724. columnProp: 'createTime',
  725. headerAlign: "center",
  726. align: "center",
  727. columnLabel: '创建时间',
  728. columnHidden: false,
  729. columnImage: false,
  730. columnSortable: false,
  731. sortLv: 0,
  732. status: true,
  733. fixed: '',
  734. },
  735. {
  736. columnProp: 'createBy',
  737. headerAlign: "center",
  738. align: "center",
  739. columnLabel: '创建人',
  740. columnHidden: false,
  741. columnImage: false,
  742. columnSortable: false,
  743. sortLv: 0,
  744. status: true,
  745. fixed: '',
  746. },
  747. {
  748. columnProp: 'updateDate',
  749. headerAlign: "center",
  750. align: "center",
  751. columnLabel: '更新时间',
  752. columnHidden: false,
  753. columnImage: false,
  754. columnSortable: false,
  755. sortLv: 0,
  756. status: true,
  757. fixed: '',
  758. },
  759. {
  760. columnProp: 'updateBy',
  761. headerAlign: "center",
  762. align: "center",
  763. columnLabel: '更新人',
  764. columnHidden: false,
  765. columnImage: false,
  766. columnSortable: false,
  767. sortLv: 0,
  768. status: true,
  769. fixed: '',
  770. },
  771. ],
  772. detailModelFlag:false,
  773. detailList: [],
  774. dataListLoading: false,
  775. dataList:[],
  776. // 展示列集
  777. columnDetailList: [
  778. {
  779. columnProp: 'inspectionTypeName',
  780. headerAlign: "center",
  781. align: "center",
  782. columnLabel: '检验类型',
  783. columnHidden: false,
  784. columnImage: false,
  785. columnSortable: false,
  786. sortLv: 0,
  787. status: true,
  788. fixed: '',
  789. },
  790. {
  791. columnProp: 'templateVersion',
  792. headerAlign: "center",
  793. align: "center",
  794. columnLabel: '版本号',
  795. columnHidden: false,
  796. columnImage: false,
  797. columnSortable: false,
  798. sortLv: 0,
  799. status: true,
  800. fixed: '',
  801. },
  802. {
  803. columnProp: 'defaultSamplingQuantity',
  804. headerAlign: "center",
  805. align: "right",
  806. columnLabel: '默认检验数量',
  807. columnHidden: false,
  808. columnImage: false,
  809. columnSortable: false,
  810. sortLv: 0,
  811. status: true,
  812. fixed: '',
  813. },
  814. {
  815. columnProp: 'defaultSamplingProportion',
  816. headerAlign: "center",
  817. align: "right",
  818. columnLabel: '默认检验比例',
  819. columnHidden: false,
  820. columnImage: false,
  821. columnSortable: false,
  822. sortLv: 0,
  823. status: true,
  824. fixed: '',
  825. },
  826. ],
  827. // 快速添加
  828. fastAddFlag:false,
  829. itemList1:[],
  830. itemList2:[],
  831. itemListRow1:{},
  832. itemListRow2:{},
  833. tempLevelRow:'',
  834. tempProgrammeRow:'',
  835. options: [],
  836. itemSelections1: [],
  837. itemSelections2: [],
  838. rules:{
  839. partNoType:[
  840. {
  841. required: true,
  842. message: ' ',
  843. trigger: 'change'
  844. }
  845. ],
  846. partDescType:[
  847. {
  848. required: true,
  849. message: ' ',
  850. trigger: 'change'
  851. }
  852. ]
  853. },
  854. // 工序
  855. operationList: [],
  856. resourceList: [],
  857. operationModelFlag: false,
  858. resourceModelFlag: false,
  859. dataListOperationSelections: [],
  860. operationData:{
  861. operationDesc: ''
  862. },
  863. resourceData: {
  864. site: this.$store.state.user.site,
  865. resourceId: '',
  866. resourceDesc: ''
  867. },
  868. operation: '',
  869. resourceId: '',
  870. selectionManufacturer: [],
  871. // 供应商
  872. manufacturerList: [],
  873. manufacturerModelFlag: false,
  874. dataListManufacturerSelections: [],
  875. manufacturerData:{
  876. site: this.$store.state.user.site,
  877. manufacturerID: '',
  878. manufacturerName: ''
  879. },
  880. // 单选框绑定的值
  881. operationCurrent: -1,
  882. resourceCurrent: -1
  883. }
  884. },
  885. mounted () {
  886. this.$nextTick(() => {
  887. this.height = window.innerHeight - 210
  888. })
  889. },
  890. created () {
  891. this.getDataList();
  892. this.favoriteIsOk();
  893. this.InspectionTypeSearch();
  894. },
  895. methods: {
  896. /**
  897. * 自适应
  898. * @param label
  899. * @param prop
  900. * @returns {string}
  901. */
  902. flexColumnWidth (label, prop) {
  903. // 1.获取该列的所有数据
  904. const arr = this.dataList.map(x => x[prop])
  905. arr.push(label) // 把每列的表头也加进去算
  906. // 2.计算每列内容最大的宽度 + 表格的内间距(依据实际情况而定)
  907. return (this.getMaxLength(arr) + 25) + 'px'
  908. },
  909. flexColumnWidth2 (label, prop) {
  910. // 1.获取该列的所有数据
  911. const arr = this.detailList.map(x => x[prop])
  912. arr.push(label) // 把每列的表头也加进去算
  913. // 2.计算每列内容最大的宽度 + 表格的内间距(依据实际情况而定)
  914. return (this.getMaxLength(arr) + 25) + 'px'
  915. },
  916. getTextWidth (str) {
  917. let width = 0
  918. const html = document.createElement('span')
  919. html.innerText = str
  920. html.className = 'getTextWidth'
  921. document.querySelector('body').appendChild(html)
  922. width = document.querySelector('.getTextWidth').offsetWidth
  923. document.querySelector('.getTextWidth').remove()
  924. return width
  925. },
  926. getMaxLength (arr) {
  927. return arr.reduce((acc, item) => {
  928. if (item) {
  929. const calcLen = this.getTextWidth(item)
  930. if (acc < calcLen) {
  931. acc = calcLen
  932. }
  933. }
  934. return acc
  935. }, 0)
  936. },
  937. // 查询检验类型
  938. InspectionTypeSearch(){
  939. InspectionTypeSearch().then(({data}) => {
  940. if (data.code === 0) {
  941. this.options = data.rows
  942. }
  943. })
  944. },
  945. chooseLevel(row){
  946. this.tempLevelRow = row;
  947. this.getBaseList(1048);
  948. },
  949. chooseProgrammeRow(row){
  950. this.tempProgrammeRow = row;
  951. this.getBaseList(1051);
  952. },
  953. // 获取基础数据列表S
  954. getBaseList (val,type) {
  955. this.tagNo = val
  956. this.$nextTick(() => {
  957. let strVal = ''
  958. if (val === 1043) {
  959. strVal = this.modalData.partNo
  960. this.$refs.baseList.init(val, strVal)
  961. }
  962. if (val === 1048) {
  963. strVal = this.tempLevelRow.samplingLevelNo
  964. this.$refs.baseList.init(val, strVal)
  965. }
  966. if (val === 1051) {
  967. strVal = this.tempProgrammeRow.samplingProgrammeNo
  968. this.$refs.baseList.init(val, strVal)
  969. }
  970. if (val === 1056) {
  971. strVal = this.modalData.supplierNo
  972. this.$refs.baseList.init(val, strVal)
  973. }
  974. })
  975. },
  976. /* 列表方法的回调 */
  977. getBaseData (val) {
  978. if (this.tagNo === 1043) {
  979. this.modalData.partNo = val.part_no
  980. this.modalData.partDesc = val.part_desc
  981. }
  982. if (this.tagNo === 1048) {
  983. this.tempLevelRow.samplingLevelNo = val.sampling_level_no
  984. this.tempLevelRow.samplingLevelDesc = val.sampling_level_desc
  985. }
  986. if (this.tagNo === 1051) {
  987. this.tempProgrammeRow.samplingProgrammeNo = val.sampling_programme_no
  988. this.tempProgrammeRow.samplingProgrammeDesc = val.sampling_programme_desc
  989. }
  990. if (this.tagNo === 1056) {
  991. this.modalData.supplierNo = val.supplier_id
  992. this.modalData.supplierDesc = val.supplier_name
  993. }
  994. },
  995. // 获取数据列表
  996. getDataList () {
  997. this.searchData.limit = this.pageSize
  998. this.searchData.page = this.pageIndex
  999. qcPartAttributeSearch(this.searchData).then(({data}) => {
  1000. if (data.code === 0) {
  1001. this.dataList = data.page.list
  1002. this.pageIndex = data.page.currPage
  1003. this.pageSize = data.page.pageSize
  1004. this.totalPage = data.page.totalCount
  1005. }
  1006. this.dataListLoading = false
  1007. })
  1008. },
  1009. // 每页数
  1010. sizeChangeHandle (val) {
  1011. this.pageSize = val
  1012. this.pageIndex = 1
  1013. this.getDataList()
  1014. },
  1015. // 当前页
  1016. currentChangeHandle (val) {
  1017. this.pageIndex = val
  1018. this.getDataList()
  1019. },
  1020. addModal(){
  1021. this.modalData = {
  1022. site: this.$store.state.user.site,
  1023. flag: '1',
  1024. partNo: '',
  1025. partDesc: '',
  1026. familyID: '',
  1027. familyName: '',
  1028. umid: '',
  1029. supplierNo: '',
  1030. supplierDesc: '',
  1031. attributeRemark: '',
  1032. createTime: '',
  1033. updateBy: this.$store.state.user.name,
  1034. createBy: this.$store.state.user.name,
  1035. attributeType: 'A',
  1036. exemptInspection: ''
  1037. };
  1038. this.modalDisableFlag = false;
  1039. this.modalFlag = true;
  1040. },
  1041. // 删除
  1042. deletePropertiesModel (row) {
  1043. this.$confirm(`是否删除这个检验模板?`, '提示', {
  1044. confirmButtonText: '确定',
  1045. cancelButtonText: '取消',
  1046. type: 'warning'
  1047. }).then(() => {
  1048. qcPartAttributeDelete(row).then(({data}) => {
  1049. if (data && data.code === 0) {
  1050. this.getDataList()
  1051. this.$message({
  1052. message: '操作成功',
  1053. type: 'success',
  1054. duration: 1500,
  1055. onClose: () => {
  1056. }
  1057. })
  1058. } else {
  1059. this.$alert(data.msg, '错误', {
  1060. confirmButtonText: '确定'
  1061. })
  1062. }
  1063. })
  1064. }).catch(() => {
  1065. })
  1066. },
  1067. saveData(){
  1068. if (this.modalData.partNo === '' || this.modalData.partNo == null) {
  1069. this.$message.warning('请选择物料编码!')
  1070. return
  1071. }
  1072. if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
  1073. this.$message.warning('请选择物料名称!')
  1074. return
  1075. }
  1076. let obj = document.getElementsByName('isExemptInspection')
  1077. let s = ''
  1078. for (let i = 0; i < obj.length; i++) {
  1079. if (obj[i].checked) {
  1080. s += obj[i].value + ','
  1081. }
  1082. }
  1083. s = s.substring(0, s.length - 1)
  1084. this.modalData.exemptInspection = s
  1085. if(this.modalData.flag === '1'){
  1086. qcPartAttributeSave(this.modalData).then(({data}) => {
  1087. if (data && data.code === 0) {
  1088. this.getDataList()
  1089. this.modalFlag = false
  1090. this.$message({
  1091. message: '操作成功',
  1092. type: 'success',
  1093. duration: 1500,
  1094. onClose: () => {
  1095. }
  1096. })
  1097. } else {
  1098. this.$alert(data.msg, '错误', {
  1099. confirmButtonText: '确定'
  1100. })
  1101. }
  1102. })
  1103. }
  1104. },
  1105. // 保存属性模板
  1106. saveDetail(){
  1107. for (let i = 0; i < this.detailList.length; i++) {
  1108. this.detailList[i].updateBy = this.$store.state.user.name
  1109. saveAttributeDetailed(this.detailList[i]).then(({data}) => {
  1110. if (data && data.code === 0) {
  1111. this.getDataList()
  1112. this.detailModelFlag = false
  1113. this.$message({
  1114. message: '操作成功',
  1115. type: 'success',
  1116. duration: 1500,
  1117. onClose: () => {
  1118. }
  1119. })
  1120. } else {
  1121. this.$alert(data.msg, '错误', {
  1122. confirmButtonText: '确定'
  1123. }).then(() => {
  1124. return false
  1125. })
  1126. }
  1127. })
  1128. }
  1129. },
  1130. //打开物料模板清单
  1131. detailModal (row) {
  1132. this.detailData.partNo = row.partNo
  1133. this.detailData.attributeNo = row.partNo
  1134. this.detailData.partDesc = row.partDesc
  1135. searchPartAttributeDetails(this.detailData).then(({data}) => {
  1136. this.detailList = data.rows
  1137. })
  1138. this.detailModelFlag = true;
  1139. },
  1140. checkInspectionType(){
  1141. getPartTemplateLists(this.detailData).then(({data}) => {
  1142. this.operation = ''
  1143. this.resourceId = ''
  1144. this.itemList1 = data.row1;
  1145. this.itemList2 = data.row2;
  1146. })
  1147. },
  1148. // 快速新增
  1149. addFastModal(){
  1150. this.itemSelections1 = null
  1151. this.itemSelections2 = null
  1152. getPartTemplateLists(this.detailData).then(({data}) => {
  1153. this.itemList1 = data.row1
  1154. this.itemList2 = data.row2
  1155. })
  1156. this.detailData.inspectionTypeNo = this.options[0].inspectionTypeNo
  1157. this.checkInspectionType()
  1158. this.dataListOperationSelections = []
  1159. this.operation = ''
  1160. this.resourceId = ''
  1161. this.operationData.operationDesc = ''
  1162. this.resourceData.resourceId = ''
  1163. this.resourceData.resourceDesc = ''
  1164. this.operationCurrent = -1
  1165. this.resourceCurrent = -1
  1166. this.selectionManufacturer = []
  1167. this.dataListManufacturerSelections = []
  1168. this.fastAddFlag = true
  1169. },
  1170. // 可选项目
  1171. itemClickRow1(row){
  1172. this.$refs.itemTable1.toggleRowSelection(row);
  1173. },
  1174. // 已有项目
  1175. itemClickRow2(row){
  1176. this.$refs.itemTable2.toggleRowSelection(row);
  1177. },
  1178. selectFlag(){
  1179. return true;
  1180. },
  1181. selectionItem1(val){
  1182. this.itemSelections1 = val
  1183. },
  1184. selectionItem2(val){
  1185. this.itemSelections2 = val
  1186. },
  1187. // 添加模板
  1188. addItem(){
  1189. if(this.itemSelections1 == null || this.itemSelections1.length === 0){
  1190. this.$message.warning('请选择可选模板!')
  1191. return
  1192. }
  1193. 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.operation == null || this.operation === '')){
  1194. this.$message.warning('请选择工序!')
  1195. return
  1196. }
  1197. 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 === '')){
  1198. this.$message.warning('请选择机台!')
  1199. return
  1200. }
  1201. if((this.detailData.inspectionTypeNo === '105') && (this.selectionManufacturer == null || this.selectionManufacturer.length === 0)){
  1202. this.$message.warning('请选择供应商!')
  1203. return
  1204. }
  1205. let inData = {
  1206. site: this.$store.state.user.site,
  1207. attributeNo: this.detailData.partNo,
  1208. itemList: this.itemSelections1,
  1209. operation: this.operation,
  1210. resourceID: this.resourceId,
  1211. manufacturerList: this.selectionManufacturer,
  1212. attributeType: this.detailData.attributeType,
  1213. inspectionTypeNo: this.detailData.inspectionTypeNo
  1214. }
  1215. savePartAttributeDetails(inData).then(({data}) => {
  1216. if (data && data.code === 0) {
  1217. getPartTemplateLists(this.detailData).then(({data}) => {
  1218. this.itemList1 = data.row1;
  1219. this.itemList2 = data.row2;
  1220. })
  1221. this.itemSelections1 = []
  1222. this.operation = ''
  1223. this.resourceId = ''
  1224. this.selectionManufacturer = []
  1225. } else {
  1226. this.$alert(data.msg, '错误', {
  1227. confirmButtonText: '确定'
  1228. })
  1229. }
  1230. })
  1231. },
  1232. // 删除模板
  1233. deleteItem(){
  1234. if(this.itemSelections2 == null || this.itemSelections2.length === 0){
  1235. this.$message.warning('请选择已有模板!')
  1236. return
  1237. }
  1238. let inData = {
  1239. attributeNo:this.detailData.partNo,
  1240. itemList: this.itemSelections2,
  1241. attributeType: this.detailData.attributeType,
  1242. site:this.$store.state.user.site
  1243. }
  1244. deletePartAttributeDetails(inData).then(({data}) => {
  1245. if (data && data.code === 0) {
  1246. getPartTemplateLists(this.detailData).then(({data}) => {
  1247. this.itemList1 = data.row1;
  1248. this.itemList2 = data.row2;
  1249. })
  1250. this.itemSelections2 = []
  1251. } else {
  1252. this.$alert(data.msg, '错误', {
  1253. confirmButtonText: '确定'
  1254. })
  1255. }
  1256. })
  1257. },
  1258. // 关闭后刷新列表
  1259. refreshDetailList(){
  1260. searchPartAttributeDetails(this.detailData).then(({data}) => {
  1261. this.detailList = data.rows
  1262. })
  1263. },
  1264. // 删除物料属性中的模板
  1265. deletePartAttributeDetails(row){
  1266. this.$confirm(`是否删除这个检验模板?`, '提示', {
  1267. confirmButtonText: '确定',
  1268. cancelButtonText: '取消',
  1269. type: 'warning'
  1270. }).then(() => {
  1271. deletePartAttributeDetails(row).then(({data}) => {
  1272. if (data && data.code === 0) {
  1273. searchPartAttributeDetails(this.detailData).then(({data}) => {
  1274. this.detailList = data.rows
  1275. })
  1276. this.$message({
  1277. message: '操作成功',
  1278. type: 'success',
  1279. duration: 1500,
  1280. onClose: () => {
  1281. }
  1282. })
  1283. } else {
  1284. this.$alert(data.msg, '错误', {
  1285. confirmButtonText: '确定'
  1286. })
  1287. }
  1288. })
  1289. }).catch(() => {
  1290. })
  1291. },
  1292. // 校验用户是否收藏
  1293. favoriteIsOk() {
  1294. let userFavorite = {
  1295. userId: this.$store.state.user.id,
  1296. languageCode: this.$i18n.locale
  1297. }
  1298. userFavoriteList(userFavorite).then(({data}) => {
  1299. for (let i = 0; i < data.list.length; i++) {
  1300. if(this.$route.meta.menuId==data.list[i].menuId){
  1301. this.favorite = true
  1302. }
  1303. }
  1304. })
  1305. },
  1306. // 收藏 OR 取消收藏
  1307. favoriteFunction() {
  1308. let userFavorite = {
  1309. userId: this.$store.state.user.id,
  1310. functionId: this.$route.meta.menuId,
  1311. }
  1312. if (this.favorite) {
  1313. removeUserFavorite(userFavorite).then(({data}) => {
  1314. this.$message.success(data.msg)
  1315. this.favorite = false
  1316. })
  1317. } else {
  1318. // 收藏
  1319. saveUserFavorite(userFavorite).then(({data}) => {
  1320. this.$message.success(data.msg)
  1321. this.favorite = true
  1322. })
  1323. }
  1324. },
  1325. //导出excel
  1326. async createExportData() {
  1327. this.searchData.limit = -1
  1328. this.searchData.page = 1
  1329. await qcPartAttributeSearch(this.searchData).then(({data}) => {
  1330. this.exportList= data.page.list;
  1331. })
  1332. return this.exportList;
  1333. },
  1334. startDownload() {
  1335. },
  1336. finishDownload() {
  1337. },
  1338. fields() {
  1339. let json = "{"
  1340. this.columnList.forEach((item, index) => {
  1341. if (index == this.columnList.length - 1) {
  1342. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  1343. } else {
  1344. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  1345. }
  1346. })
  1347. json += "}"
  1348. let s = eval("(" + json + ")")
  1349. return s
  1350. },
  1351. // 导出 end
  1352. // 导入
  1353. qcUpload(){
  1354. let currentData = {
  1355. flag: 'partAttribute',
  1356. createBy: this.$store.state.user.name,
  1357. site: this.$store.state.user.site,
  1358. };
  1359. //打开组件 去做新增业务
  1360. this.$nextTick(() => {
  1361. this.$refs.qcUpload.init(currentData);
  1362. })
  1363. },
  1364. // 获取工序列表
  1365. getOperationList(){
  1366. getOperationDescList(this.operationData).then(({data}) => {
  1367. if (data && data.code === 0) {
  1368. this.operationList = data.rows;
  1369. // // 回显数据
  1370. // // 先清空缓存选中
  1371. // this.$nextTick(() => this.$refs.operationTable.clearSelection())
  1372. // // 拿到选中的工序
  1373. // let tempDataList = this.operationDesc
  1374. // this.operationList.forEach(val => {
  1375. // // 回显选中的工序
  1376. // if (tempDataList === val.operationDesc) {
  1377. // this.$nextTick(() => this.$refs.operationTable.toggleRowSelection(val, true))
  1378. // }
  1379. // })
  1380. this.operationModelFlag = true;
  1381. } else {
  1382. this.$alert(data.msg, '错误', {
  1383. confirmButtonText: '确定'
  1384. })
  1385. }
  1386. })
  1387. },
  1388. // 获取机台列表
  1389. getAllResourceList () {
  1390. getAllResourceList(this.resourceData).then(({data}) => {
  1391. if (data && data.code === 0) {
  1392. this.resourceList = data.rows
  1393. this.resourceModelFlag = true;
  1394. } else {
  1395. this.$alert(data.msg, '错误', {
  1396. confirmButtonText: '确定'
  1397. })
  1398. }
  1399. })
  1400. },
  1401. // 条件查询获取工序列表
  1402. getOperationList2(){
  1403. getOperationDescList(this.operationData).then(({data}) => {
  1404. if (data && data.code === 0) {
  1405. this.operationList = data.rows
  1406. this.operationCurrent = -1
  1407. } else {
  1408. this.$alert(data.msg, '错误', {
  1409. confirmButtonText: '确定'
  1410. })
  1411. }
  1412. })
  1413. },
  1414. // 条件查询获取机台列表
  1415. getAllResourceList2 () {
  1416. getAllResourceList(this.resourceData).then(({data}) => {
  1417. if (data && data.code === 0) {
  1418. this.resourceList = data.rows
  1419. this.resourceCurrent = -1
  1420. } else {
  1421. this.$alert(data.msg, '错误', {
  1422. confirmButtonText: '确定'
  1423. })
  1424. }
  1425. })
  1426. },
  1427. // 点击行选中工序复选框
  1428. operationClickRow (row) {
  1429. this.$refs.operationTable.toggleRowSelection(row);
  1430. },
  1431. // 点击行选中机台复选框
  1432. resourceClickRow (row) {
  1433. this.$refs.resourceTable.toggleRowSelection(row);
  1434. },
  1435. // 多选工序
  1436. selectionOperationChangeHandle (val) {
  1437. this.operation = val[0].operationDesc
  1438. if (val) {
  1439. this.operationCurrent = val.index;
  1440. }
  1441. },
  1442. // 多选机台
  1443. selectionResourceChangeHandle (val) {
  1444. this.resourceId = val[0].resourceId
  1445. if (val) {
  1446. this.resourceCurrent = val.index;
  1447. }
  1448. },
  1449. operationRowClassName ({row, rowIndex}) {
  1450. row.index = rowIndex; // 在原有的数据上加一个index
  1451. },
  1452. resourceRowClassName ({row, rowIndex}) {
  1453. row.index = rowIndex; // 在原有的数据上加一个index
  1454. },
  1455. // // 单选
  1456. // clickChange (row) {
  1457. // this.radioOperation = row.operationDesc
  1458. // },
  1459. // 确认选择工序
  1460. confirmOperation () {
  1461. //this.operationDesc = ''
  1462. // this.operationDesc = this.radioOperation
  1463. // this.radioOperation = ''
  1464. // for (let i = 0; i < this.dataListOperationSelections.length; i++) {
  1465. // this.selectionOperation.push(this.dataListOperationSelections[i].operationDesc)
  1466. // }
  1467. this.operationModelFlag = false
  1468. },
  1469. // 确认选择工序
  1470. confirmResource () {
  1471. this.resourceModelFlag = false
  1472. },
  1473. // 获取供应商列表
  1474. getManufacturerList(){
  1475. getManufacturerList(this.manufacturerData).then(({data}) => {
  1476. if (data && data.code === 0) {
  1477. this.manufacturerList = data.rows;
  1478. // 回显数据
  1479. // 先清空缓存选中
  1480. this.$nextTick(() => this.$refs.manufacturerTable.clearSelection())
  1481. // 拿到选中的供应商
  1482. let tempDataList = this.selectionManufacturer
  1483. this.manufacturerList.forEach(val => {
  1484. // 回显选中的供应商
  1485. if (tempDataList.includes(val.manufacturerID)) {
  1486. this.$nextTick(() => this.$refs.manufacturerTable.toggleRowSelection(val, true))
  1487. }
  1488. })
  1489. this.manufacturerModelFlag = true;
  1490. } else {
  1491. this.$alert(data.msg, '错误', {
  1492. confirmButtonText: '确定'
  1493. })
  1494. }
  1495. })
  1496. },
  1497. // 点击行选中复选框
  1498. manufacturerClickRow(row){
  1499. this.$refs.manufacturerTable.toggleRowSelection(row);
  1500. },
  1501. // 多选
  1502. selectionManufacturerChangeHandle (val) {
  1503. this.dataListManufacturerSelections = val
  1504. },
  1505. // 确认多选供应商
  1506. confirmManufacturer(){
  1507. this.selectionManufacturer = []
  1508. for (let i = 0; i < this.dataListManufacturerSelections.length; i++) {
  1509. this.selectionManufacturer.push(this.dataListManufacturerSelections[i].manufacturerID)
  1510. }
  1511. this.manufacturerModelFlag = false
  1512. }
  1513. }
  1514. }
  1515. </script>