index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="报表名称" prop="reportName">
  5. <el-input
  6. v-model="queryParams.reportName"
  7. placeholder="请输入报表名称"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="检验日期" prop="reportDate">
  13. <el-input
  14. v-model="queryParams.reportDate"
  15. placeholder="请输入检验日期"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="检验员" prop="inspector">
  21. <el-input
  22. v-model="queryParams.inspector"
  23. placeholder="请输入检验员"
  24. clearable
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item label="审核人" prop="examine">
  29. <el-input
  30. v-model="queryParams.examine"
  31. placeholder="请输入审核人"
  32. clearable
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  38. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  39. </el-form-item>
  40. </el-form>
  41. <el-row :gutter="10" class="mb8">
  42. <el-col :span="1.5">
  43. <el-button
  44. type="primary"
  45. plain
  46. icon="el-icon-plus"
  47. size="mini"
  48. @click="handleAdd"
  49. v-hasPermi="['qualityinspectioninformation:qualityinspectioninformation:add']"
  50. >新增</el-button>
  51. </el-col>
  52. <el-col :span="1.5">
  53. <el-button
  54. type="success"
  55. plain
  56. icon="el-icon-edit"
  57. size="mini"
  58. :disabled="single"
  59. @click="handleUpdate"
  60. v-hasPermi="['qualityinspectioninformation:qualityinspectioninformation:edit']"
  61. >修改</el-button>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-button
  65. type="danger"
  66. plain
  67. icon="el-icon-delete"
  68. size="mini"
  69. :disabled="multiple"
  70. @click="handleDelete"
  71. v-hasPermi="['qualityinspectioninformation:qualityinspectioninformation:remove']"
  72. >删除</el-button>
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button
  76. type="warning"
  77. plain
  78. icon="el-icon-download"
  79. size="mini"
  80. @click="handleExport"
  81. v-hasPermi="['qualityinspectioninformation:qualityinspectioninformation:export']"
  82. >导出</el-button>
  83. </el-col>
  84. <el-col :span="1.5">
  85. <el-button
  86. type="warning"
  87. plain
  88. icon="el-icon-download"
  89. size="mini"
  90. @click="handleImport"
  91. v-hasPermi="['qualityinspectioninformation:qualityinspectioninformation:export']"
  92. >导入</el-button>
  93. </el-col>
  94. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  95. </el-row>
  96. <el-row :gutter="10" class="mb8">
  97. <el-radio-group v-model="queryParams.manufacturingProcess" style="float: right" @change="handleQuery">
  98. <!-- <el-radio-button label="全部">全部</el-radio-button>-->
  99. <el-radio-button label="来料检验">来料检验</el-radio-button>
  100. <el-radio-button label="白胚检验">白胚检验</el-radio-button>
  101. <el-radio-button label="出厂检验">出厂检验</el-radio-button>
  102. </el-radio-group>
  103. </el-row>
  104. <el-table v-loading="loading" :data="qualityinspectioninformationList" @selection-change="handleSelectionChange">
  105. <el-table-column type="selection" width="55" align="center" />
  106. <!-- <el-table-column label="序号" align="center" prop="id" />-->
  107. <el-table-column label="制程" align="center" prop="manufacturingProcess" />
  108. <!-- <el-table-column label="类型" align="center" prop="type" />-->
  109. <el-table-column label="报表名称" align="center" prop="reportName" />
  110. <el-table-column label="检验日期" align="center" prop="reportDate" />
  111. <el-table-column label="检验员" align="center" prop="inspector" />
  112. <el-table-column label="审核人" align="center" prop="examine" />
  113. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='来料检验'" label="一次不合格批次" align="center" prop="jlOneFailedBatch" />-->
  114. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='来料检验'" label="报检总批次" align="center" prop="jlTotalBatchForInspection" />-->
  115. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='来料检验'" label="废品/退换货数量" align="center" prop="jlQuantityOfRejectsReturns" />-->
  116. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='来料检验'" label="本月合格率批次" align="center" prop="jlQualifiedRateOfTheMonth" />-->
  117. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='白胚检验'" label="一次不合格数" align="center" prop="bpNumberOfFailures" />-->
  118. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='白胚检验'" label="报废数量" align="center" prop="bpScrapQuantity" />-->
  119. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='白胚检验'" label="本月总数" align="center" prop="bpTotalForThe_month" />-->
  120. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='白胚检验'" label="本月合格率" align="center" prop="bpPassRateThisMonth" />-->
  121. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='出厂检验'" label="一次不合格数" align="center" prop="ccNumberOfFailures" />-->
  122. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='出厂检验'" label="报废数量" align="center" prop="ccScrapQuantity" />-->
  123. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='出厂检验'" label="本月总数" align="center" prop="ccTotalForTheMonth" />-->
  124. <!-- <el-table-column v-show="queryParams.manufacturingProcess=='出厂检验'" label="本月合格率" align="center" prop="ccPassRateThisMonth" />-->
  125. <template>
  126. <el-table-column
  127. v-for="(column, index) in tableColumns"
  128. :key="index"
  129. :label="column.label"
  130. :align="column.align"
  131. :prop="column.prop">
  132. </el-table-column>
  133. </template>
  134. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  135. <template slot-scope="scope">
  136. <el-dropdown @command="(command)=>{handleCommand(command, scope.row)}">
  137. <el-button type="warning">
  138. 操作<i class="el-icon-arrow-down el-icon--right"></i>
  139. </el-button>
  140. <el-dropdown-menu slot="dropdown">
  141. <el-dropdown-item icon="el-icon-edit" command="handleUpdate">修改</el-dropdown-item>
  142. <el-dropdown-item icon="el-icon-delete" command="handleDelete">删除</el-dropdown-item>
  143. </el-dropdown-menu>
  144. </el-dropdown>
  145. </template>
  146. </el-table-column>
  147. </el-table>
  148. <pagination
  149. v-show="total>0"
  150. :total="total"
  151. :page.sync="queryParams.pageNum"
  152. :limit.sync="queryParams.pageSize"
  153. @pagination="getList"
  154. />
  155. <!-- 添加或修改质检信息对话框 -->
  156. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  157. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  158. <el-form-item label="制程" prop="manufacturingProcess">
  159. <el-input v-model="form.manufacturingProcess" placeholder="请输入制程" />
  160. </el-form-item>
  161. <el-form-item label="报表名称" prop="reportName">
  162. <el-input v-model="form.reportName" placeholder="请输入报表名称" />
  163. </el-form-item>
  164. <el-form-item label="检验日期" prop="reportDate">
  165. <el-input v-model="form.reportDate" placeholder="请输入检验日期" />
  166. </el-form-item>
  167. <el-form-item label="检验员" prop="inspector">
  168. <el-input v-model="form.inspector" placeholder="请输入检验员" />
  169. </el-form-item>
  170. <el-form-item label="审核人" prop="examine">
  171. <el-input v-model="form.examine" placeholder="请输入审核人" />
  172. </el-form-item>
  173. </el-form>
  174. <div slot="footer" class="dialog-footer">
  175. <el-button type="primary" @click="submitForm">确 定</el-button>
  176. <el-button @click="cancel">取 消</el-button>
  177. </div>
  178. </el-dialog>
  179. <!-- 质检导入对话框 -->
  180. <el-dialog
  181. :title="upload.title"
  182. :visible.sync="upload.open"
  183. width="400px"
  184. append-to-body
  185. >
  186. <el-upload
  187. ref="upload"
  188. :limit="1"
  189. accept=".xlsx, .xls"
  190. :headers="upload.headers"
  191. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  192. :disabled="upload.isUploading"
  193. :on-progress="handleFileUploadProgress"
  194. :on-success="handleFileSuccess"
  195. :auto-upload="false"
  196. drag
  197. >
  198. <i class="el-icon-upload"></i>
  199. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  200. <div class="el-upload__tip text-center" slot="tip">
  201. <span>仅允许导入xls、xlsx格式文件。</span>
  202. <!-- <el-link-->
  203. <!-- type="primary"-->
  204. <!-- :underline="false"-->
  205. <!-- style="font-size: 12px; vertical-align: baseline"-->
  206. <!-- @click="importTemplate"-->
  207. <!-- >下载模板-->
  208. <!-- </el-link>-->
  209. </div>
  210. </el-upload>
  211. <div slot="footer" class="dialog-footer">
  212. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  213. <el-button @click="upload.open = false">取 消</el-button>
  214. </div>
  215. </el-dialog>
  216. </div>
  217. </template>
  218. <script>
  219. import { listQualityinspectioninformation, getQualityinspectioninformation, delQualityinspectioninformation, addQualityinspectioninformation, updateQualityinspectioninformation } from "@/api/amichi/qualityinspectioninformation/qualityinspectioninformation";
  220. import {getToken} from "@/utils/auth";
  221. export default {
  222. name: "Qualityinspectioninformation",
  223. data() {
  224. return {
  225. manufacturingProcess:"来料检验",
  226. // 遮罩层
  227. loading: true,
  228. // 选中数组
  229. ids: [],
  230. // 非单个禁用
  231. single: true,
  232. // 非多个禁用
  233. multiple: true,
  234. // 显示搜索条件
  235. showSearch: true,
  236. // 总条数
  237. total: 0,
  238. // 质检信息表格数据
  239. qualityinspectioninformationList: [],
  240. // 弹出层标题
  241. title: "",
  242. // 是否显示弹出层
  243. open: false,
  244. // 查询参数
  245. queryParams: {
  246. pageNum: 1,
  247. pageSize: 10,
  248. manufacturingProcess: "来料检验",
  249. reportName: null,
  250. reportDate: null,
  251. inspector: null,
  252. examine: null
  253. },
  254. // 质检导入参数
  255. upload: {
  256. // 是否显示弹出层(质检导入)
  257. open: false,
  258. // 弹出层标题(质检导入)
  259. title: "",
  260. // 是否禁用上传
  261. isUploading: false,
  262. // 是否更新已经存在的用户数据
  263. updateSupport: 0,
  264. // 设置上传的请求头部
  265. headers: { Authorization: "Bearer " + getToken() },
  266. // 上传的地址
  267. url: process.env.VUE_APP_BASE_API + "/qualityinspectioninformation/qualityinspectioninformation/importExcelData",
  268. },
  269. // 表单参数
  270. form: {},
  271. // 表单校验
  272. rules: {
  273. }
  274. };
  275. },
  276. created() {
  277. this.getList();
  278. },
  279. computed: {
  280. tableColumns() {
  281. const columns = [];
  282. const process = this.queryParams.manufacturingProcess;
  283. // 来料检验相关的列
  284. if (process === '来料检验') {
  285. columns.push(
  286. { label: '一次不合格批次', align: 'center', prop: 'jlOneFailedBatch' },
  287. { label: '报检总批次', align: 'center', prop: 'jlTotalBatchForInspection' },
  288. { label: '废品/退换货数量', align: 'center', prop: 'jlQuantityOfRejectsReturns' },
  289. { label: '本月合格率批次', align: 'center', prop: 'jlQualifiedRateOfTheMonth' }
  290. );
  291. }
  292. // 白胚检验相关的列
  293. if (process === '白胚检验') {
  294. columns.push(
  295. { label: '一次不合格数', align: 'center', prop: 'bpNumberOfFailures' },
  296. { label: '报废数量', align: 'center', prop: 'bpScrapQuantity' },
  297. { label: '本月总数', align: 'center', prop: 'bpTotalForTheMonth' },
  298. { label: '本月合格率', align: 'center', prop: 'bpPassRateThisMonth' }
  299. );
  300. }
  301. // 出厂检验相关的列
  302. if (process === '出厂检验') {
  303. columns.push(
  304. { label: '一次不合格数', align: 'center', prop: 'ccNumberOfFailures' },
  305. { label: '报废数量', align: 'center', prop: 'ccScrapQuantity' },
  306. { label: '本月总数', align: 'center', prop: 'ccTotalForTheMonth' },
  307. { label: '本月合格率', align: 'center', prop: 'ccPassRateThisMonth' }
  308. );
  309. }
  310. return columns;
  311. }
  312. },
  313. methods: {
  314. //下拉菜单点击事件
  315. handleCommand(command, row) {
  316. switch (command) {
  317. case "handleUpdate":
  318. this.handleUpdate(row)
  319. break;
  320. case "handleDelete":
  321. this.handleDelete(row)
  322. break;
  323. default:
  324. break;
  325. }
  326. },
  327. /** 查询质检信息列表 */
  328. getList() {
  329. this.loading = true;
  330. listQualityinspectioninformation(this.queryParams).then(response => {
  331. this.qualityinspectioninformationList = response.rows;
  332. this.total = response.total;
  333. this.loading = false;
  334. });
  335. },
  336. // 取消按钮
  337. cancel() {
  338. this.open = false;
  339. this.reset();
  340. },
  341. // 表单重置
  342. reset() {
  343. this.form = {
  344. id: null,
  345. manufacturingProcess: null,
  346. reportName: null,
  347. reportDate: null,
  348. inspector: null,
  349. examine: null
  350. };
  351. this.resetForm("form");
  352. },
  353. /** 搜索按钮操作 */
  354. handleQuery() {
  355. this.queryParams.pageNum = 1;
  356. this.getList();
  357. },
  358. /** 重置按钮操作 */
  359. resetQuery() {
  360. this.resetForm("queryForm");
  361. this.handleQuery();
  362. },
  363. // 多选框选中数据
  364. handleSelectionChange(selection) {
  365. this.ids = selection.map(item => item.id)
  366. this.single = selection.length!==1
  367. this.multiple = !selection.length
  368. },
  369. /** 新增按钮操作 */
  370. handleAdd() {
  371. this.reset();
  372. this.open = true;
  373. this.title = "添加质检信息";
  374. },
  375. /** 修改按钮操作 */
  376. handleUpdate(row) {
  377. this.reset();
  378. const id = row.id || this.ids
  379. getQualityinspectioninformation(id).then(response => {
  380. this.form = response.data;
  381. this.open = true;
  382. this.title = "修改质检信息";
  383. });
  384. },
  385. /** 提交按钮 */
  386. submitForm() {
  387. this.$refs["form"].validate(valid => {
  388. if (valid) {
  389. if (this.form.id != null) {
  390. updateQualityinspectioninformation(this.form).then(response => {
  391. this.$modal.msgSuccess("修改成功");
  392. this.open = false;
  393. this.getList();
  394. });
  395. } else {
  396. addQualityinspectioninformation(this.form).then(response => {
  397. this.$modal.msgSuccess("新增成功");
  398. this.open = false;
  399. this.getList();
  400. });
  401. }
  402. }
  403. });
  404. },
  405. /** 删除按钮操作 */
  406. handleDelete(row) {
  407. const ids = row.id || this.ids;
  408. this.$modal.confirm('是否确认删除质检信息编号为"' + ids + '"的数据项?').then(function() {
  409. return delQualityinspectioninformation(ids);
  410. }).then(() => {
  411. this.getList();
  412. this.$modal.msgSuccess("删除成功");
  413. }).catch(() => {});
  414. },
  415. /** 导出按钮操作 */
  416. handleExport() {
  417. this.download('qualityinspectioninformation/qualityinspectioninformation/export', {
  418. ...this.queryParams
  419. }, `qualityinspectioninformation_${new Date().getTime()}.xlsx`)
  420. },
  421. // 提交上传文件
  422. submitFileForm() {
  423. this.$refs.upload.submit();
  424. },
  425. /** 导入按钮从按钮操作 */
  426. handleImport() {
  427. this.upload.title = "质检信息导入";
  428. this.upload.open = true;
  429. },
  430. // 文件上传中处理
  431. handleFileUploadProgress(event, file, fileList) {
  432. this.upload.isUploading = true;
  433. },
  434. // 文件上传成功处理
  435. handleFileSuccess(response, file, fileList) {
  436. this.upload.open = false;
  437. this.upload.isUploading = false;
  438. this.$refs.upload.clearFiles();
  439. this.$alert(
  440. "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
  441. response.msg +
  442. "</div>",
  443. "导入结果",
  444. { dangerouslyUseHTMLString: true }
  445. );
  446. this.getList();
  447. },
  448. }
  449. };
  450. </script>