祥兆质量前端
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.

1304 lines
43 KiB

  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.orderNo" clearable style="width: 150px"></el-input>
  13. </el-form-item>
  14. <el-form-item label="派工单号">
  15. <el-input v-model="searchData.seqNo" clearable style="width: 150px"></el-input>
  16. </el-form-item>
  17. <el-form-item label="物料编码">
  18. <el-input v-model="searchData.partNo" clearable style="width: 150px"></el-input>
  19. </el-form-item>
  20. <el-form-item label="物料名称">
  21. <el-input v-model="searchData.partDesc" clearable style="width: 315px"></el-input>
  22. </el-form-item>
  23. <!-- <el-form-item label="状态">-->
  24. <!-- <el-select v-model="searchData.status" style="width: 100px" placeholder="请选择">-->
  25. <!-- <el-option label="全部" value=""></el-option>-->
  26. <!-- <el-option label="已发料" value="已发料"></el-option>-->
  27. <!-- <el-option label="已关闭" value="已关闭"></el-option>-->
  28. <!-- <el-option label="已计划" value="已计划"></el-option>-->
  29. <!-- <el-option label="已开工" value="已开工"></el-option>-->
  30. <!-- <el-option label="已入库" value="已入库"></el-option>-->
  31. <!-- <el-option label="已下达" value="已下达"></el-option>-->
  32. <!-- </el-select>-->
  33. <!-- </el-form-item>-->
  34. <el-form-item label=" ">
  35. <el-checkbox v-model="searchData.cancelFlag" true-label="Y">显示超出派工数量单据</el-checkbox>
  36. </el-form-item>
  37. </el-form>
  38. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  39. <el-form-item label="车间编码">
  40. <el-input v-model="searchData.departmentID" clearable style="width: 120px"></el-input>
  41. </el-form-item>
  42. <el-form-item label="加工中心">
  43. <el-input v-model="searchData.workCenterNo" clearable style="width: 120px"></el-input>
  44. </el-form-item>
  45. <el-form-item label="工序">
  46. <el-input v-model="searchData.operationDesc" clearable style="width: 120px"></el-input>
  47. </el-form-item>
  48. <el-form-item label="派工单创建人">
  49. <el-input v-model="searchData.operatorName" clearable style="width: 100px"></el-input>
  50. </el-form-item>
  51. <el-form-item :label="'班次'">
  52. <el-select v-model="searchData.shiftDesc" placeholder="请选择" clearable style="width: 80px">
  53. <el-option
  54. v-for = "i in shiftList"
  55. :key = "i.shiftDesc"
  56. :label = "i.shiftDesc"
  57. :value = "i.shiftDesc">
  58. </el-option>
  59. </el-select>
  60. </el-form-item>
  61. <el-form-item label="检验类型">
  62. <el-select v-model="searchData.inspectionTypeNo" style="width: 100px" clearable placeholder="请选择">
  63. <el-option label="IPQC首检" value="首件检"></el-option>
  64. <el-option label="IPQC自检" value="自检"></el-option>
  65. <el-option label="IPQC巡检" value="巡检"></el-option>
  66. <el-option label="IPQC末件检" value="末件检"></el-option>
  67. </el-select>
  68. </el-form-item>
  69. <el-form-item :label="'派工日期'">
  70. <el-date-picker style="width: 125px" v-model="searchData.startDate" type="date" value-format='yyyy-MM-dd' format='yyyy-MM-dd' placeholder="开始日期"></el-date-picker>
  71. -
  72. <el-date-picker style="width: 125px" v-model="searchData.endDate" type="date" value-format='yyyy-MM-dd' format='yyyy-MM-dd' placeholder="结束日期"></el-date-picker>
  73. </el-form-item>
  74. <el-form-item :label="' '">
  75. <el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
  76. </el-form-item>
  77. </el-form>
  78. <!-- 展示列表 -->
  79. <el-table
  80. :height="height"
  81. :data="dataList"
  82. border
  83. :row-style="rowStyle"
  84. @row-click="clickRow"
  85. style="width: 100%;">
  86. <el-table-column
  87. v-for="(item,index) in columnList" :key="index"
  88. :sortable="item.columnSortable"
  89. :prop="item.columnProp"
  90. :header-align="item.headerAlign"
  91. :show-overflow-tooltip="item.showOverflowTooltip"
  92. :align="item.align"
  93. :fixed="item.fixed==''?false:item.fixed"
  94. :min-width="item.columnWidth"
  95. :label="item.columnLabel">
  96. <template slot-scope="scope">
  97. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  98. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column
  102. fixed="right"
  103. header-align="center"
  104. align="center"
  105. width="130"
  106. label="操作">
  107. <template slot-scope="scope">
  108. <a v-if="!authDoInspection" type="text" size="small" @click="doInspectionModal(scope.row)">生成检验任务</a>
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. <el-pagination
  113. @size-change="sizeChangeHandle"
  114. @current-change="currentChangeHandle"
  115. :current-page="pageIndex"
  116. :page-sizes="[20, 50, 100, 200, 500]"
  117. :page-size="pageSize"
  118. :total="totalPage"
  119. layout="total, sizes, prev, pager, next, jumper">
  120. </el-pagination>
  121. <!-- 新增巡检记录 -->
  122. <el-dialog title="新增检验记录" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="495px">
  123. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  124. <el-form-item label="BU" prop="bu" :rules="rules.bu">
  125. <el-select v-model="modalData.bu" placeholder="请选择" @change="buChange" style="width: 221px">
  126. <el-option
  127. v-for = "i in userBuList"
  128. :key = "i.buNo"
  129. :label = "i.buNo"
  130. :value = "i.buNo">
  131. <span style="float: left;width: 100px">{{ i.sitename }}</span>
  132. <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
  133. {{ i.buDesc }}
  134. </span>
  135. </el-option>
  136. </el-select>
  137. </el-form-item>
  138. </el-form>
  139. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  140. <el-form-item prop="orderNo" :rules="rules.seqNoType">
  141. <span slot="label">派工单号</span>
  142. <el-input v-model="modalData.seqNo" disabled style="width: 221px"></el-input>
  143. </el-form-item>
  144. <el-form-item label="工单号" prop="orderNo" :rules="rules.orderNoType">
  145. <el-input v-model="modalData.orderNo" style="width: 221px" disabled></el-input>
  146. </el-form-item>
  147. </el-form>
  148. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  149. <el-form-item label="工序" prop="operationDesc" :rules="rules.operationDescType">
  150. <el-select v-model="modalData.operationDesc" placeholder="请选择" style="width: 221px">
  151. <el-option
  152. v-for = "i in operationList"
  153. :key = "i.operationDesc"
  154. :label = "i.operationDesc"
  155. :value = "i.operationDesc">
  156. </el-option>
  157. </el-select>
  158. </el-form-item>
  159. <el-form-item>
  160. <span style="cursor: pointer" slot="label" @click="getBaseList(505)"><a herf="#">机台</a></span>
  161. <el-input v-model="modalData.resourceDesc" readonly style="width: 221px"></el-input>
  162. </el-form-item>
  163. </el-form>
  164. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  165. <el-form-item label="物料编码" prop="partNo" :rules="rules.partNoType">
  166. <el-input v-model="modalData.partNo" readonly style="width: 221px"></el-input>
  167. </el-form-item>
  168. <el-form-item label="规格型号">
  169. <el-input v-model="modalData.spec" readonly style="width: 221px"></el-input>
  170. </el-form-item>
  171. </el-form>
  172. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  173. <el-form-item label="物料名称">
  174. <el-input v-model="modalData.partDesc" readonly style="width: 456px"></el-input>
  175. </el-form-item>
  176. </el-form>
  177. <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
  178. <el-form-item label="检验类型" prop="inspectionTypeNo" :rules="rules.inspectionTypeNoType">
  179. <el-select v-model="modalData.inspectionTypeNo" style="width: 104px">
  180. <el-option label="首件检" value="首件检"></el-option>
  181. <el-option label="自检" value="自检"></el-option>
  182. <el-option label="巡检" value="巡检"></el-option>
  183. <el-option label="末件检" value="末件检"></el-option>
  184. </el-select>
  185. </el-form-item>
  186. <el-form-item label="送检数量" prop="rollQty" :rules="rules.rollQtyType">
  187. <el-input v-model="modalData.rollQty" type="number" style="width: 104px"></el-input>
  188. </el-form-item>
  189. <el-form-item label="单位" prop="umId" :rules="rules.umIdType">
  190. <el-select v-model="modalData.umId" placeholder="请选择" style="width: 104px">
  191. <el-option
  192. v-for = "i in umList"
  193. :key = "i.umId"
  194. :label = "i.umName"
  195. :value = "i.umId">
  196. </el-option>
  197. </el-select>
  198. </el-form-item>
  199. <el-form-item label=" ">
  200. <el-checkbox v-model="modalData.importantFlag" true-label="Y">重点检验</el-checkbox>
  201. </el-form-item>
  202. </el-form>
  203. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  204. <el-form-item prop="templateId" :rules="rules.templateId">
  205. <span style="cursor: pointer" v-if="this.controlData.baseData === '控制'" slot="label" @click="queryTemplateList"><a>检验模板</a></span>
  206. <span v-else slot="label">检验模板</span>
  207. <el-input v-model="modalData.templateName" readonly style="width: 221px"></el-input>
  208. </el-form-item>
  209. <el-form-item label="送检总数">
  210. <el-input v-model="modalData.sjzs" disabled style="width: 104px"></el-input>
  211. </el-form-item>
  212. </el-form>
  213. <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
  214. <el-form-item label="特殊要求">
  215. <el-input type="textarea" v-model="modalData.specialRequirements" :rows="3" resize='none' show-word-limit style="width: 456px;height: 30px"></el-input>
  216. </el-form-item>
  217. </el-form>
  218. <el-footer style="height:40px;margin-top: 55px;text-align:center">
  219. <el-button :loading="saveLoading" type="primary" @click="saveData">保存</el-button>
  220. <el-button type="primary" @click="modalFlag = false">关闭</el-button>
  221. </el-footer>
  222. </el-dialog>
  223. <!-- 检验模板 -->
  224. <el-dialog title="检验模板清单" :close-on-click-modal="false" v-drag :visible.sync="templateModelFlag" width="520px">
  225. <div class="rq">
  226. <el-form :inline="true" label-position="top" :model="templateData">
  227. <el-form-item :label="'模板编码'">
  228. <el-input v-model="templateData.templateId" clearable style="width: 120px"></el-input>
  229. </el-form-item>
  230. <el-form-item :label="'模板名称'">
  231. <el-input v-model="templateData.templateName" clearable style="width: 120px"></el-input>
  232. </el-form-item>
  233. <el-form-item :label="' '">
  234. <el-button type="primary" @click="queryTemplateList">查询</el-button>
  235. </el-form-item>
  236. </el-form>
  237. <el-table
  238. :height="300"
  239. :data="templateList"
  240. @row-dblclick="getRowData"
  241. border
  242. style="width: 100%;">
  243. <el-table-column
  244. v-for="(item,index) in templateDetailList" :key="index"
  245. :sortable="item.columnSortable"
  246. :prop="item.columnProp"
  247. :header-align="item.headerAlign"
  248. :show-overflow-tooltip="item.showOverflowTooltip"
  249. :align="item.align"
  250. :fixed="item.fixed==''?false:item.fixed"
  251. :min-width="item.columnWidth"
  252. :label="item.columnLabel">
  253. <template slot-scope="scope">
  254. <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
  255. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  256. </template>
  257. </el-table-column>
  258. </el-table>
  259. </div>
  260. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  261. <el-button type="primary" @click="templateModelFlag=false">关闭</el-button>
  262. </el-footer>
  263. </el-dialog>
  264. </div>
  265. </template>
  266. <script>
  267. import {
  268. getSiteAndBuByUserName, // 获取site、bu
  269. searchSeqInfo2, // 派工单号查询
  270. getOperationList, // 查询工序列表
  271. umSearch, // 查询单位列表
  272. queryController, // 检查动控
  273. queryTemplateList, // 获取检验模板列表
  274. saveOsInspection, // 新增检验记录
  275. inspectionTypeSearch, // 搜索所有检验类型
  276. getShiftList, // 获取班次
  277. } from "@/api/qc/qc.js"
  278. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  279. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  280. export default {
  281. data () {
  282. return {
  283. // 是否收藏
  284. favorite: false,
  285. // 导出 start
  286. exportData: [],
  287. exportName: "派工单" + this.dayjs().format('YYYYMMDDHHmmss'),
  288. exportHeader: ["派工单"],
  289. exportFooter: [],
  290. exportList: [],
  291. // 导出 end
  292. searchData: {
  293. userName: this.$store.state.user.name,
  294. orderNo: '',
  295. seqNo: '',
  296. partNo: '',
  297. partDesc: '',
  298. operationDesc: '',
  299. status: '',
  300. cancelFlag: '',
  301. startDate: new Date(),
  302. endDate: new Date(),
  303. workCenterNo: '',
  304. operatorName: '',
  305. departmentID: '',
  306. inspectionTypeNo: '',
  307. shiftDesc: '',
  308. page: 1,
  309. limit: 10
  310. },
  311. pageIndex: 1,
  312. pageSize: 50,
  313. totalPage: 0,
  314. height: 200,
  315. dataList: [],
  316. modalFlag: false,
  317. modalDisableFlag: false,
  318. modalData: {
  319. flag: '',
  320. site: '',
  321. bu: '',
  322. inspectionNo:'',
  323. partNo: '',
  324. partDesc: '',
  325. inspectionTypeNo:'',
  326. inspectionTypeName:'',
  327. inspectorNo:'',
  328. inspectorName:'',
  329. orderNo: '',
  330. operationDesc: '',
  331. resourceId: '',
  332. resourceDesc: '',
  333. rollQty: '',
  334. seqNo: '',
  335. spec: '',
  336. qtyrequired: '',
  337. lotsize:'',
  338. specialRequirements: '',
  339. templateId: '',
  340. templateName: '',
  341. specialTaskFlag: '',
  342. workCenterNo: '',
  343. rollNo: '',
  344. umId: '',
  345. umName: '',
  346. sjzs: '',
  347. boxNo: '',
  348. createBy: '',
  349. importantFlag: ''
  350. },
  351. rules: {
  352. seqNoType: [
  353. {
  354. required: true,
  355. message: ' ',
  356. trigger: 'change'
  357. }
  358. ],
  359. orderNoType: [
  360. {
  361. required: true,
  362. message: ' ',
  363. trigger: 'change'
  364. }
  365. ],
  366. operationDescType: [
  367. {
  368. required: true,
  369. message: ' ',
  370. trigger: 'change'
  371. }
  372. ],
  373. resourceIdType: [
  374. {
  375. required: true,
  376. message: ' ',
  377. trigger: 'change'
  378. }
  379. ],
  380. rollQtyType: [
  381. {
  382. required: true,
  383. message: ' ',
  384. trigger: 'change'
  385. }
  386. ],
  387. inspectionTypeNoType: [
  388. {
  389. required: true,
  390. message: ' ',
  391. trigger: 'change'
  392. }
  393. ],
  394. partNoType: [
  395. {
  396. required: true,
  397. message: ' ',
  398. trigger: 'change'
  399. }
  400. ],
  401. umIdType: [
  402. {
  403. required: true,
  404. message: ' ',
  405. trigger: 'change'
  406. }
  407. ],
  408. templateId: [
  409. {
  410. required: true,
  411. message: ' ',
  412. trigger: 'change'
  413. }
  414. ],
  415. bu:[
  416. {
  417. required: true,
  418. message: ' ',
  419. trigger: 'change'
  420. }
  421. ]
  422. },
  423. templateData: {
  424. site: '',
  425. bu: '',
  426. templateId: '',
  427. templateName: '',
  428. inspectionTypeNo: '',
  429. inspectionTypeName: ''
  430. },
  431. // 标头展示
  432. columnList: [
  433. {
  434. userId: this.$store.state.user.name,
  435. functionId: 3010005001,
  436. serialNumber: '3010005001Table1OrderNo',
  437. tableId: "3010005001Table1",
  438. tableName: "派工单号表",
  439. fixed: '',
  440. columnProp: 'orderNo',
  441. headerAlign: "center",
  442. align: "left",
  443. columnLabel: '工单号',
  444. columnHidden: false,
  445. columnImage: false,
  446. columnSortable: false,
  447. sortLv: 0,
  448. status: true,
  449. columnWidth: 150,
  450. },
  451. {
  452. userId: this.$store.state.user.name,
  453. functionId: 3010005001,
  454. serialNumber: '3010005001Table1SeqNo',
  455. tableId: "3010005001Table1",
  456. tableName: "派工单号表",
  457. fixed: '',
  458. columnProp: 'seqNo',
  459. headerAlign: "center",
  460. align: "left",
  461. columnLabel: '派工单号',
  462. columnHidden: false,
  463. columnImage: false,
  464. columnSortable: false,
  465. sortLv: 0,
  466. status: true,
  467. columnWidth: 150,
  468. },
  469. {
  470. userId: this.$store.state.user.name,
  471. functionId: 3010005001,
  472. serialNumber: '3010005001Table1PartNo',
  473. tableId: "3010005001Table1",
  474. tableName: "派工单号表",
  475. fixed: '',
  476. columnProp: 'partNo',
  477. headerAlign: "center",
  478. align: "left",
  479. columnLabel: '物料编码',
  480. columnHidden: false,
  481. columnImage: false,
  482. columnSortable: false,
  483. sortLv: 0,
  484. status: true,
  485. columnWidth: 150,
  486. },
  487. {
  488. userId: this.$store.state.user.name,
  489. functionId: 3010005001,
  490. serialNumber: '3010005001Table1PartDesc',
  491. tableId: "3010005001Table1",
  492. tableName: "派工单号表",
  493. fixed: '',
  494. columnProp: 'partDesc',
  495. headerAlign: "center",
  496. align: "left",
  497. columnLabel: '物料名称',
  498. columnHidden: false,
  499. columnImage: false,
  500. columnSortable: false,
  501. sortLv: 0,
  502. status: true,
  503. columnWidth: 300,
  504. },
  505. {
  506. userId: this.$store.state.user.name,
  507. functionId: 3010005001,
  508. serialNumber: '3010005001Table1DepartmentID',
  509. tableId: "3010005001Table1",
  510. tableName: "派工单号表",
  511. fixed: '',
  512. columnProp: 'departmentID',
  513. headerAlign: "center",
  514. align: "left",
  515. columnLabel: '车间编码',
  516. columnHidden: false,
  517. columnImage: false,
  518. columnSortable: false,
  519. sortLv: 0,
  520. status: true,
  521. columnWidth: 100,
  522. },
  523. {
  524. userId: this.$store.state.user.name,
  525. functionId: 3010005001,
  526. serialNumber: '3010005001Table1DepartmentName',
  527. tableId: "3010005001Table1",
  528. tableName: "派工单号表",
  529. fixed: '',
  530. columnProp: 'departmentName',
  531. headerAlign: "center",
  532. align: "left",
  533. columnLabel: '车间名称',
  534. columnHidden: false,
  535. columnImage: false,
  536. columnSortable: false,
  537. sortLv: 0,
  538. status: true,
  539. columnWidth: 150,
  540. },
  541. {
  542. userId: this.$store.state.user.name,
  543. functionId: 3010005001,
  544. serialNumber: '3010005001Table1WorkCenterNo',
  545. tableId: "3010005001Table1",
  546. tableName: "派工单号表",
  547. fixed: '',
  548. columnProp: 'workCenterNo',
  549. headerAlign: "center",
  550. align: "left",
  551. columnLabel: '加工中心编码',
  552. columnHidden: false,
  553. columnImage: false,
  554. columnSortable: false,
  555. sortLv: 0,
  556. status: true,
  557. columnWidth: 100,
  558. },
  559. {
  560. userId: this.$store.state.user.name,
  561. functionId: 3010005001,
  562. serialNumber: '3010005001Table1WorkCenterDesc',
  563. tableId: "3010005001Table1",
  564. tableName: "派工单号表",
  565. fixed: '',
  566. columnProp: 'workCenterDesc',
  567. headerAlign: "center",
  568. align: "left",
  569. columnLabel: '加工中心名称',
  570. columnHidden: false,
  571. columnImage: false,
  572. columnSortable: false,
  573. sortLv: 0,
  574. status: true,
  575. columnWidth: 150,
  576. },
  577. {
  578. userId: this.$store.state.user.name,
  579. functionId: 3010005001,
  580. serialNumber: '3010005001Table1OperationDesc',
  581. tableId: "3010005001Table1",
  582. tableName: "派工单号表",
  583. fixed: '',
  584. columnProp: 'operationDesc',
  585. headerAlign: "center",
  586. align: "left",
  587. columnLabel: '工序',
  588. columnHidden: false,
  589. columnImage: false,
  590. columnSortable: false,
  591. sortLv: 0,
  592. status: true,
  593. columnWidth: 100,
  594. },
  595. {
  596. userId: this.$store.state.user.name,
  597. functionId: 3010005001,
  598. serialNumber: '3010005001Table1ResourceId',
  599. tableId: "3010005001Table1",
  600. tableName: "派工单号表",
  601. fixed: '',
  602. columnProp: 'resourceId',
  603. headerAlign: "center",
  604. align: "left",
  605. columnLabel: '机台编码',
  606. columnHidden: false,
  607. columnImage: false,
  608. columnSortable: false,
  609. sortLv: 0,
  610. status: true,
  611. columnWidth: 100,
  612. },
  613. {
  614. userId: this.$store.state.user.name,
  615. functionId: 3010005001,
  616. serialNumber: '3010005001Table1ResourceDesc',
  617. tableId: "3010005001Table1",
  618. tableName: "派工单号表",
  619. fixed: '',
  620. columnProp: 'resourceDesc',
  621. headerAlign: "center",
  622. align: "left",
  623. columnLabel: '机台名称',
  624. columnHidden: false,
  625. columnImage: false,
  626. columnSortable: false,
  627. sortLv: 0,
  628. status: true,
  629. columnWidth: 150,
  630. },
  631. {
  632. userId: this.$store.state.user.name,
  633. functionId: 3010005001,
  634. serialNumber: '3010005001Table1Lotsize',
  635. tableId: "3010005001Table1",
  636. tableName: "派工单号表",
  637. fixed: '',
  638. columnProp: 'lotsize',
  639. headerAlign: "center",
  640. align: "right",
  641. columnLabel: '工单数量',
  642. columnHidden: false,
  643. columnImage: false,
  644. columnSortable: false,
  645. sortLv: 0,
  646. status: true,
  647. columnWidth: 100,
  648. },
  649. {
  650. userId: this.$store.state.user.name,
  651. functionId: 3010005001,
  652. serialNumber: '3010005001Table1Qtyrequired',
  653. tableId: "3010005001Table1",
  654. tableName: "派工单号表",
  655. fixed: '',
  656. columnProp: 'qtyrequired',
  657. headerAlign: "center",
  658. align: "right",
  659. columnLabel: '派工数量',
  660. columnHidden: false,
  661. columnImage: false,
  662. columnSortable: false,
  663. sortLv: 0,
  664. status: true,
  665. columnWidth: 100,
  666. },
  667. {
  668. userId: this.$store.state.user.name,
  669. functionId: 3010005001,
  670. serialNumber: '3010005001Table1RollQty',
  671. tableId: "3010005001Table1",
  672. tableName: "派工单号表",
  673. fixed: '',
  674. columnProp: 'rollQty',
  675. headerAlign: "center",
  676. align: "right",
  677. columnLabel: '送检数量',
  678. columnHidden: false,
  679. columnImage: false,
  680. columnSortable: false,
  681. sortLv: 0,
  682. status: true,
  683. columnWidth: 100,
  684. },
  685. {
  686. userId: this.$store.state.user.name,
  687. functionId: 3010005001,
  688. serialNumber: '3010005001Table1ScheduledDate',
  689. tableId: "3010005001Table1",
  690. tableName: "派工单号表",
  691. fixed: '',
  692. columnProp: 'scheduledDate',
  693. headerAlign: "center",
  694. align: "center",
  695. columnLabel: '派工日期',
  696. columnHidden: false,
  697. columnImage: false,
  698. columnSortable: false,
  699. sortLv: 0,
  700. status: true,
  701. columnWidth: 150,
  702. },
  703. {
  704. userId: this.$store.state.user.name,
  705. functionId: 3010005001,
  706. serialNumber: '3010005001Table1OperatorName',
  707. tableId: "3010005001Table1",
  708. tableName: "派工单号表",
  709. fixed: '',
  710. columnProp: 'operatorName',
  711. headerAlign: "center",
  712. align: "left",
  713. columnLabel: '派工单创建人',
  714. columnHidden: false,
  715. columnImage: false,
  716. columnSortable: false,
  717. sortLv: 0,
  718. status: true,
  719. columnWidth: 150,
  720. },
  721. {
  722. userId: this.$store.state.user.name,
  723. functionId: 3010005001,
  724. serialNumber: '3010005001Table1TypeFlag1',
  725. tableId: "3010005001Table1",
  726. tableName: "派工单号表",
  727. fixed: '',
  728. columnProp: 'typeFlag1',
  729. headerAlign: "center",
  730. align: "center",
  731. columnLabel: 'IPQC首检',
  732. columnHidden: false,
  733. columnImage: false,
  734. columnSortable: false,
  735. sortLv: 0,
  736. status: true,
  737. columnWidth: 80,
  738. },
  739. {
  740. userId: this.$store.state.user.name,
  741. functionId: 3010005001,
  742. serialNumber: '3010005001Table1TypeFlag2',
  743. tableId: "3010005001Table1",
  744. tableName: "派工单号表",
  745. fixed: '',
  746. columnProp: 'typeFlag2',
  747. headerAlign: "center",
  748. align: "center",
  749. columnLabel: 'IPQC自检',
  750. columnHidden: false,
  751. columnImage: false,
  752. columnSortable: false,
  753. sortLv: 0,
  754. status: true,
  755. columnWidth: 80,
  756. },
  757. {
  758. userId: this.$store.state.user.name,
  759. functionId: 3010005001,
  760. serialNumber: '3010005001Table1TypeFlag3',
  761. tableId: "3010005001Table1",
  762. tableName: "派工单号表",
  763. fixed: '',
  764. columnProp: 'typeFlag3',
  765. headerAlign: "center",
  766. align: "center",
  767. columnLabel: 'IPQC巡检',
  768. columnHidden: false,
  769. columnImage: false,
  770. columnSortable: false,
  771. sortLv: 0,
  772. status: true,
  773. columnWidth: 80,
  774. },
  775. {
  776. userId: this.$store.state.user.name,
  777. functionId: 3010005001,
  778. serialNumber: '3010005001Table1TypeFlag4',
  779. tableId: "3010005001Table1",
  780. tableName: "派工单号表",
  781. fixed: '',
  782. columnProp: 'typeFlag4',
  783. headerAlign: "center",
  784. align: "center",
  785. columnLabel: 'IPQC末件检',
  786. columnHidden: false,
  787. columnImage: false,
  788. columnSortable: false,
  789. sortLv: 0,
  790. status: true,
  791. columnWidth: 80,
  792. },
  793. {
  794. userId: this.$store.state.user.name,
  795. functionId: 3010005001,
  796. serialNumber: '3010005001Table1ShiftDesc',
  797. tableId: "3010005001Table1",
  798. tableName: "派工单号表",
  799. fixed: '',
  800. columnProp: 'shiftDesc',
  801. headerAlign: "center",
  802. align: "center",
  803. columnLabel: '班次',
  804. columnHidden: false,
  805. columnImage: false,
  806. columnSortable: false,
  807. sortLv: 0,
  808. status: true,
  809. columnWidth: 80,
  810. },
  811. ],
  812. templateDetailList: [
  813. {
  814. columnProp: 'templateId',
  815. headerAlign: "center",
  816. align: "center",
  817. columnLabel: '模板编码',
  818. columnHidden: false,
  819. columnImage: false,
  820. columnSortable: false,
  821. sortLv: 0,
  822. status: true,
  823. fixed: '',
  824. },
  825. {
  826. columnProp: 'templateName',
  827. headerAlign: "center",
  828. align: "center",
  829. columnLabel: '模板名称',
  830. columnHidden: false,
  831. columnImage: false,
  832. columnSortable: false,
  833. sortLv: 0,
  834. status: true,
  835. fixed: '',
  836. },
  837. {
  838. columnProp: 'inspectionTypeName',
  839. headerAlign: "center",
  840. align: "center",
  841. columnLabel: '检验类型',
  842. columnHidden: false,
  843. columnImage: false,
  844. columnSortable: false,
  845. sortLv: 0,
  846. status: true,
  847. fixed: '',
  848. },
  849. ],
  850. operationList: [],
  851. userBuList: [],
  852. umList: [],
  853. templateList: [],
  854. authSearch: false,
  855. authDoInspection: false,
  856. menuId: this.$route.meta.menuId,
  857. checked: false,
  858. controlData: {},
  859. templateModelFlag: false,
  860. saveLoading: false,
  861. typeOptions: [],
  862. currentRow: {},
  863. shiftList: [],
  864. }
  865. },
  866. mounted () {
  867. this.$nextTick(() => {
  868. this.height = window.innerHeight - 210
  869. })
  870. },
  871. created () {
  872. // 按钮控制
  873. this.getButtonAuthData()
  874. // 获取用户的 site 和 bu
  875. this.getSiteAndBuByUserName()
  876. // 获取班次
  877. this.getShiftList()
  878. // 校验用户是否收藏
  879. this.favoriteIsOk()
  880. // 检验类型
  881. this.inspectionTypeSearch()
  882. // 单位
  883. this.umSearch()
  884. // 查看 质量任务生成规则控制 动控是否开启
  885. this.queryController()
  886. // 动态列
  887. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  888. if (!this.authSearch) {
  889. // 获取数据列表
  890. this.getDataList()
  891. }
  892. },
  893. methods: {
  894. // 获取班次
  895. getShiftList () {
  896. let tempData = {
  897. site: this.$store.state.user.site,
  898. }
  899. getShiftList(tempData).then(({data}) => {
  900. if (data.code === 0) {
  901. this.shiftList = data.rows
  902. }
  903. })
  904. },
  905. // 查询检验类型
  906. inspectionTypeSearch () {
  907. let tempData = {
  908. site: this.$store.state.user.site
  909. }
  910. inspectionTypeSearch(tempData).then(({data}) => {
  911. if (data.code === 0) {
  912. this.typeOptions = data.rows
  913. this.typeOptions.forEach(val => {
  914. if (val.inspectionTypeName.includes('IPQC')) {
  915. this.templateData.inspectionTypeNo = val.inspectionTypeNo
  916. this.templateData.inspectionTypeName = val.inspectionTypeName
  917. }
  918. })
  919. }
  920. })
  921. },
  922. // 检查动控是否开启
  923. queryController () {
  924. let tempData = {
  925. controlNo: '10004',
  926. site: this.$store.state.user.site,
  927. }
  928. queryController(tempData).then(({data}) => {
  929. if (data && data.code === 0) {
  930. this.controlData = data.rows
  931. } else {
  932. this.$alert(data.msg, '错误', {
  933. confirmButtonText: '确定'
  934. })
  935. }
  936. })
  937. },
  938. // 查询单位
  939. umSearch () {
  940. let tempData = {
  941. site: this.$store.state.user.site,
  942. active: 'Y'
  943. }
  944. umSearch(tempData).then(({data}) => {
  945. if (data.code === 0) {
  946. this.umList = data.rows
  947. }
  948. })
  949. },
  950. // 获取用户的bu
  951. getSiteAndBuByUserName () {
  952. let tempData = {
  953. username: this.$store.state.user.name,
  954. }
  955. getSiteAndBuByUserName(tempData).then(({data}) => {
  956. if (data.code === 0) {
  957. this.userBuList = data.rows
  958. }
  959. })
  960. },
  961. // 每页数
  962. sizeChangeHandle (val) {
  963. this.pageSize = val
  964. this.pageIndex = 1
  965. this.getDataList()
  966. },
  967. // 当前页
  968. currentChangeHandle (val) {
  969. this.pageIndex = val
  970. this.getDataList()
  971. },
  972. // 查询获取数据列表
  973. getDataList () {
  974. this.searchData.limit = this.pageSize
  975. this.searchData.page = this.pageIndex
  976. searchSeqInfo2(this.searchData).then(({data}) => {
  977. if (data.code === 0) {
  978. this.dataList = data.page.list
  979. this.pageIndex = data.page.currPage
  980. this.pageSize = data.page.pageSize
  981. this.totalPage = data.page.totalCount
  982. }
  983. })
  984. },
  985. // 生成检验任务
  986. doInspectionModal (row) {
  987. this.modalData = {
  988. flag: 'doInspection',
  989. site: row.site,
  990. bu: this.userBuList[0].buNo,
  991. inspectionNo: '',
  992. partNo: row.partNo,
  993. partDesc: row.partDesc,
  994. inspectionTypeNo: '',
  995. inspectionTypeName: '',
  996. inspectorNo: '',
  997. inspectorName: '',
  998. orderNo: row.orderNo,
  999. operationDesc: row.operationDesc,
  1000. resourceId: row.resourceId,
  1001. resourceDesc: row.resourceDesc,
  1002. rollQty: row.qtyrequired - row.rollQty > 0 ? row.qtyrequired - row.rollQty : 0,
  1003. seqNo: row.seqNo,
  1004. spec: row.spec,
  1005. specialRequirements: '',
  1006. templateId: '',
  1007. templateName: '',
  1008. specialTaskFlag: '',
  1009. workCenterNo: row.workCenterNo,
  1010. rollNo: '',
  1011. umId: row.umId,
  1012. sjzs: row.sjzs,
  1013. boxNo: '',
  1014. createBy: this.$store.state.user.name,
  1015. importantFlag: ''
  1016. }
  1017. this.getOperationList()
  1018. this.modalDisableFlag = false
  1019. this.modalFlag = true
  1020. this.checked = false
  1021. },
  1022. // 新增IPQC巡检记录
  1023. saveData () {
  1024. if (this.modalData.bu === '' || this.modalData.bu == null) {
  1025. this.$message.warning('请选择BU!')
  1026. return
  1027. }
  1028. if (this.modalData.seqNo === '' || this.modalData.seqNo == null) {
  1029. this.$message.warning('请选择派工单!')
  1030. return
  1031. }
  1032. if (this.modalData.orderNo === '' || this.modalData.orderNo == null) {
  1033. this.$message.warning('请选择工单!')
  1034. return
  1035. }
  1036. if (this.modalData.inspectionTypeNo === '' || this.modalData.inspectionTypeNo == null) {
  1037. this.$message.warning('请选择检验类型!')
  1038. return
  1039. }
  1040. if (this.modalData.specialTaskFlag !== 'Y' && (this.modalData.partNo === '' || this.modalData.partNo == null)) {
  1041. this.$message.warning('请选择物料!')
  1042. return
  1043. }
  1044. if (this.modalData.operationDesc === '' || this.modalData.operationDesc == null) {
  1045. this.$message.warning('请选择工序!')
  1046. return
  1047. }
  1048. if (this.modalData.rollQty === '' || this.modalData.rollQty == null) {
  1049. this.$message.warning('请填写送检数量!')
  1050. return
  1051. }
  1052. if (this.modalData.umId === '' || this.modalData.umId == null) {
  1053. this.$message.warning('请选择单位!')
  1054. return
  1055. }
  1056. if (this.controlData.baseData === '控制' && (this.modalData.templateId == null || this.modalData.templateId === '')) {
  1057. this.$message.warning('请选择检验模板!')
  1058. return
  1059. }
  1060. this.saveLoading = true
  1061. saveOsInspection(this.modalData).then(({data}) => {
  1062. if (data && data.code === 0) {
  1063. this.getDataList()
  1064. this.operationList = []
  1065. this.modalFlag = false
  1066. // 跳转IPQC任务
  1067. this.checkOutToIPQC(data.no)
  1068. } else {
  1069. this.$alert(data.msg, '错误', {
  1070. confirmButtonText: '确定'
  1071. })
  1072. }
  1073. this.saveLoading = false
  1074. }).catch(()=>{
  1075. this.saveLoading = false
  1076. })
  1077. },
  1078. // 获取工序列表
  1079. getOperationList () {
  1080. getOperationList(this.modalData).then(({data}) => {
  1081. if (data && data.code === 0) {
  1082. this.operationList = data.rows
  1083. } else {
  1084. this.operationList = []
  1085. }
  1086. })
  1087. },
  1088. // bu内容改变事件
  1089. buChange () {
  1090. if (this.modalData.specialTaskFlag !== 'Y') { // 正常检验
  1091. this.modalData.templateId = ''
  1092. this.modalData.templateName = ''
  1093. } else { // 无工单检验
  1094. this.modalData.partNo = ''
  1095. this.modalData.partDesc = ''
  1096. this.modalData.spec = ''
  1097. this.modalData.templateId = ''
  1098. this.modalData.templateName = ''
  1099. }
  1100. },
  1101. // 获取检验模板列表
  1102. queryTemplateList () {
  1103. this.templateData.bu = this.modalData.bu
  1104. // 查询所有检验模板
  1105. queryTemplateList(this.templateData).then(({data}) => {
  1106. if (data && data.code === 0) {
  1107. this.templateList = data.rows
  1108. this.templateModelFlag = true
  1109. } else {
  1110. this.templateList = []
  1111. }
  1112. })
  1113. },
  1114. // 选中检验模板
  1115. getRowData (row) {
  1116. this.modalData.templateId = row.templateId
  1117. this.modalData.templateName = row.templateName
  1118. this.templateModelFlag = false
  1119. },
  1120. // 单机选中
  1121. clickRow (row) {
  1122. this.currentRow = JSON.parse(JSON.stringify(row))
  1123. },
  1124. rowStyle ({row}) {
  1125. if (this.currentRow.seqNo === row.seqNo) {
  1126. return { 'background-color': '#E8F7F6', cursor: 'pointer' };
  1127. }
  1128. },
  1129. // 切换到IPQC检验单
  1130. checkOutToIPQC (no) {
  1131. this.$router.push({name: "qc-IPQCResultEntry", params: {inspectionNo: no}})
  1132. },
  1133. // 获取基础数据列表S
  1134. getBaseList (val,type) {
  1135. this.tagNo = val
  1136. this.$nextTick(() => {
  1137. let strVal = ''
  1138. if (val === 505) {
  1139. strVal = this.modalData.resourceDesc
  1140. this.$refs.baseList.init(val, strVal)
  1141. }
  1142. if (val === 509) {
  1143. strVal = this.detailData.responsiblePerson
  1144. this.$refs.baseList.init(val, strVal)
  1145. }
  1146. })
  1147. },
  1148. /* 列表方法的回调 */
  1149. getBaseData (val) {
  1150. if (this.tagNo === 505) {
  1151. this.modalData.resourceId = val.ResourceID
  1152. this.modalData.resourceDesc = val.ResourceDesc
  1153. }
  1154. if (this.tagNo === 509) {
  1155. this.detailData.responsiblePerson = val.SupplierID
  1156. }
  1157. },
  1158. // 校验用户是否收藏
  1159. favoriteIsOk () {
  1160. let userFavorite = {
  1161. userId: this.$store.state.user.id,
  1162. languageCode: this.$i18n.locale
  1163. }
  1164. userFavoriteList(userFavorite).then(({data}) => {
  1165. for (let i = 0; i < data.list.length; i++) {
  1166. if(this.$route.meta.menuId === data.list[i].menuId){
  1167. this.favorite = true
  1168. }
  1169. }
  1170. })
  1171. },
  1172. // 收藏 OR 取消收藏
  1173. favoriteFunction () {
  1174. let userFavorite = {
  1175. userId: this.$store.state.user.id,
  1176. functionId: this.$route.meta.menuId,
  1177. }
  1178. if (this.favorite) {
  1179. removeUserFavorite(userFavorite).then(({data}) => {
  1180. this.$message.success(data.msg)
  1181. this.favorite = false
  1182. })
  1183. } else {
  1184. // 收藏
  1185. saveUserFavorite(userFavorite).then(({data}) => {
  1186. this.$message.success(data.msg)
  1187. this.favorite = true
  1188. })
  1189. }
  1190. },
  1191. //导出excel
  1192. async createExportData() {
  1193. this.searchData.limit = -1
  1194. this.searchData.page = 1
  1195. await searchSeqInfo2(this.searchData).then(({data}) => {
  1196. this.exportList= data.rows
  1197. })
  1198. return this.exportList
  1199. },
  1200. startDownload() {},
  1201. finishDownload() {},
  1202. fields () {
  1203. let json = "{"
  1204. this.columnList.forEach((item, index) => {
  1205. if (index == this.columnList.length - 1) {
  1206. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  1207. } else {
  1208. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  1209. }
  1210. })
  1211. json += "}"
  1212. let s = eval("(" + json + ")")
  1213. return s
  1214. },
  1215. // 动态列开始 获取 用户保存的 格式列
  1216. async getTableUserColumn (tableId, columnId) {
  1217. let queryTableUser = {
  1218. userId: this.$store.state.user.name,
  1219. functionId: this.$route.meta.menuId,
  1220. tableId: tableId,
  1221. status: true,
  1222. languageCode: this.$i18n.locale
  1223. }
  1224. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  1225. if (data.rows.length > 0) {
  1226. //this.columnList1 = []
  1227. switch (columnId) {
  1228. case 1:
  1229. this.columnList = data.rows
  1230. break
  1231. }
  1232. } else {
  1233. this.getColumnList(tableId, columnId)
  1234. }
  1235. })
  1236. },
  1237. // 获取 tableDefault 列
  1238. async getColumnList (tableId, columnId) {
  1239. let queryTable = {
  1240. functionId: this.$route.meta.menuId,
  1241. tableId: tableId,
  1242. languageCode: this.$i18n.locale
  1243. }
  1244. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  1245. if (!data.rows.length == 0) {
  1246. switch (columnId) {
  1247. case 1:
  1248. this.columnList = data.rows
  1249. break
  1250. }
  1251. } else {
  1252. // this.showDefault = true.
  1253. }
  1254. })
  1255. },
  1256. //获取按钮的权限数据
  1257. getButtonAuthData () {
  1258. let searchFlag = this.isAuth(this.menuId+":search")
  1259. let doInspectionFlag = this.isAuth(this.menuId+":doInspection")
  1260. //处理页面的权限数据
  1261. this.authSearch = !searchFlag
  1262. this.authDoInspection = !doInspectionFlag
  1263. },
  1264. }
  1265. }
  1266. </script>