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.

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