indexCopyV4.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
  4. <el-form-item label="工位名称" prop="stationName">
  5. <el-input
  6. v-model="queryParams.stationName"
  7. placeholder="请输入工序名称"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="工序" prop="processId">
  13. <el-select v-model="queryParams.processId">
  14. <el-option
  15. v-for="(item,index) in processList"
  16. :key="index"
  17. :label="item.label"
  18. :value="item.value"
  19. ></el-option>
  20. </el-select>
  21. </el-form-item>
  22. <!-- <el-form-item label="班组名称" prop="teamName">-->
  23. <!-- <el-input-->
  24. <!-- v-model="queryParams.teamName"-->
  25. <!-- placeholder="请输入班组名称"-->
  26. <!-- clearable-->
  27. <!-- @keyup.enter.native="handleQuery"-->
  28. <!-- />-->
  29. <!-- </el-form-item>-->
  30. <el-form-item label="人员姓名" prop="personnelName">
  31. <el-input
  32. v-model="queryParams.personnelName"
  33. placeholder="请输入人员姓名"
  34. clearable
  35. @keyup.enter.native="handleQuery"
  36. />
  37. </el-form-item>
  38. <el-form-item label="设备名称" prop="deviceName">
  39. <el-input
  40. v-model="queryParams.deviceName"
  41. placeholder="请输入设备名称"
  42. clearable
  43. @keyup.enter.native="handleQuery"
  44. />
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  48. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  49. </el-form-item>
  50. </el-form>
  51. <el-row :gutter="10" class="mb8">
  52. <el-col :span="1.5">
  53. <el-button
  54. type="primary"
  55. plain
  56. icon="el-icon-plus"
  57. size="mini"
  58. @click="handleAdd"
  59. v-hasPermi="['amichi:stationInformation:add']"
  60. >新增</el-button>
  61. </el-col>
  62. <el-col :span="1.5">
  63. <el-button
  64. type="success"
  65. plain
  66. icon="el-icon-edit"
  67. size="mini"
  68. :disabled="single"
  69. @click="handleUpdate"
  70. v-hasPermi="['amichi:stationInformation:edit']"
  71. >修改</el-button>
  72. </el-col>
  73. <el-col :span="1.5">
  74. <el-button
  75. type="danger"
  76. plain
  77. icon="el-icon-delete"
  78. size="mini"
  79. :disabled="multiple"
  80. @click="handleDelete"
  81. v-hasPermi="['amichi:stationInformation:remove']"
  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="handleExport"
  91. v-hasPermi="['amichi:stationInformation:export']"
  92. >导出</el-button>
  93. </el-col>
  94. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  95. </el-row>
  96. <el-table v-loading="loading" :data="stationInformationList" @selection-change="handleSelectionChange" style="margin-top: 20px">
  97. <el-table-column type="selection" width="55" align="center" />
  98. <el-table-column label="工序" align="center" prop="processId">
  99. <template v-slot="scope">
  100. <span v-for="option in processList" :key="option.value" v-if="option.value == scope.row.processId" class="custom-label">
  101. {{ option.label }}
  102. </span>
  103. </template>
  104. </el-table-column>
  105. <!-- <el-table-column label="工序" align="center" prop="processName"/>-->
  106. <el-table-column label="工位名称" align="center" prop="stationName" />
  107. <el-table-column label="人员姓名" align="center" prop="personnelName"/>
  108. <el-table-column label="设备mac" align="center" prop="deviceNumber" />
  109. <el-table-column label="备注" align="center" prop="remark" />
  110. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  111. <template slot-scope="scope">
  112. <el-dropdown @command="(command)=>{handleCommand(command, scope.row)}">
  113. <el-button type="warning">操作<i class="el-icon-arrow-down el-icon--right"></i>
  114. </el-button>
  115. <el-dropdown-menu slot="dropdown">
  116. <el-dropdown-item icon="el-icon-edit" command="viewPersonCode">查看人员码</el-dropdown-item>
  117. <el-dropdown-item icon="el-icon-edit" command="handleUpdate">修改</el-dropdown-item>
  118. <el-dropdown-item icon="el-icon-delete" command="handleDelete">删除</el-dropdown-item>
  119. </el-dropdown-menu>
  120. </el-dropdown>
  121. </template>
  122. </el-table-column>
  123. </el-table>
  124. <pagination
  125. v-show="total>0"
  126. :total="total"
  127. :page.sync="queryParams.pageNum"
  128. :limit.sync="queryParams.pageSize"
  129. @pagination="getList"
  130. />
  131. <!-- 添加或修改工位信息对话框 -->
  132. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  133. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  134. <el-form-item label="工位名称" prop="stationName">
  135. <el-input v-model="form.stationName" placeholder="请输入工位名称" />
  136. </el-form-item>
  137. <el-form-item label="工位类型" prop="processId">
  138. <el-select
  139. v-model="form.processId"
  140. size="small"
  141. style="width: 680px"
  142. filterable
  143. @change="processNametSelected()"
  144. >
  145. <el-option
  146. v-for="(item,index) in processList"
  147. :key="index"
  148. :label="item.label"
  149. :value="item.value"
  150. ></el-option>
  151. </el-select>
  152. </el-form-item>
  153. <el-form-item label="人员姓名" prop="personnelId">
  154. <el-select
  155. v-model="form.personnelId"
  156. size="small"
  157. style="width: 680px"
  158. filterable
  159. @change="personnelNametSelected()"
  160. >
  161. <el-option
  162. v-for="(item,index) in userInfo"
  163. :key="index"
  164. :label="item.nickName"
  165. :value="item.userId"
  166. ></el-option>
  167. </el-select>
  168. </el-form-item>
  169. <!-- <el-form-item label="设备名称" prop="deviceName">-->
  170. <!-- <el-input v-model="form.deviceName" placeholder="请输入设备名称" />-->
  171. <!-- </el-form-item>-->
  172. <el-form-item label="备注" prop="remark">
  173. <el-input v-model="form.remark" placeholder="请输入备注" />
  174. </el-form-item>
  175. </el-form>
  176. <div slot="footer" class="dialog-footer">
  177. <el-button type="primary" @click="submitForm">确 定</el-button>
  178. <el-button @click="cancel">取 消</el-button>
  179. </div>
  180. </el-dialog>
  181. <!-- 添加或修改工位信息对话框 -->
  182. <el-dialog :title="title" :visible.sync="viewPersonCodeFlag" width="800px" append-to-body>
  183. <div class="mBox" id="printView">
  184. <div class="top">
  185. <div class="topnr">
  186. <img :src="imgBase" alt="" style="text-align: center;width:320px;height: 320px">
  187. </div>
  188. </div>
  189. <div class="bottom" style="border-bottom: 2px solid black;border-top: 2px solid black">
  190. <div class="bottom-left" style="border-right: 2px solid black;height: 50px">姓名</div>
  191. <div class="bottom-right">{{currentUserName}}</div>
  192. </div>
  193. <div class="bottom">
  194. <div class="bottom-left" style="border-right: 2px solid black;height: 50px">工段</div>
  195. <div class="bottom-right">{{currentProcessName}}</div>
  196. </div>
  197. </div>
  198. <div slot="footer" class="dialog-footer">
  199. <el-button type="primary" v-print="printViewInfo">打印</el-button>
  200. <el-button @click="cancel">取 消</el-button>
  201. </div>
  202. </el-dialog>
  203. <!-- print -->
  204. <div id="printDom" style="width: 160px; height: 160px"></div>
  205. </div>
  206. </template>
  207. <script>
  208. import { listStationInformation, getStationInformation, delStationInformation, addStationInformation, updateStationInformation } from "@/api/amichi/stationInformation/stationInformation";
  209. import qrCodeList from "@/views/amichi/print/qrCodeList";
  210. import {listUserInformation} from "@/api/amichi/user/user"
  211. import {listList} from "@/api/amichi/procedureList/list";
  212. import {generateEmployeeCode} from "@/api/system/user";
  213. export default {
  214. name: "StationInformation",
  215. dicts:["gxlxinfo"],
  216. data() {
  217. return {
  218. msg: "打印",
  219. printViewInfo: {
  220. id: "printView", //打印区域的唯一的id属性
  221. // popTitle: '配置页眉标题', // 页眉文字 (不设置时显示undifined)(页眉页脚可以在打印页面的更多设置的选项中取消勾选)
  222. // extraHead: '打印,印刷', // 最左上方的头部文字,附加在head标签上的额外标签,使用逗号分割
  223. preview: false, // 是否启动预览模式,默认是false (开启预览模式ture会占满整个屏幕,不建议开启,除非业务需要)
  224. // previewTitle: '预览的标题', // 打印预览的标题(预览模式preview为true时才显示)
  225. // previewPrintBtnLabel: '预览结束,开始打印', // 打印预览的标题下方的按钮文本,点击可进入打印(预览模式preview为true时才显示)
  226. zIndex: 20002, // 预览窗口的z-index,默认是20002,最好比默认值更高
  227. previewBeforeOpenCallback (that) { console.log('正在加载预览窗口!'); console.log(that.msg, this) }, // 预览窗口打开之前的callback (预览模式preview为true时才执行) (that可以取到data里的变量值)
  228. previewOpenCallback () { console.log('已经加载完预览窗口,预览打开了!') }, // 预览窗口打开时的callback (预览模式preview为true时才执行)
  229. beforeOpenCallback () { console.log('开始打印之前!') }, // 开始打印之前的callback
  230. openCallback () { console.log('执行打印了!') }, // 调用打印时的callback
  231. closeCallback () { console.log('关闭了打印工具!') }, // 关闭打印的callback(无法区分确认or取消)
  232. clickMounted () { console.log('点击v-print绑定的按钮了!') },
  233. // url: 'http://localhost:8080/', // 打印指定的URL,确保同源策略相同
  234. // asyncUrl (reslove) {
  235. // setTimeout(() => {
  236. // reslove('http://localhost:8080/')
  237. // }, 2000)
  238. // },
  239. standard: '',
  240. extarCss: ''
  241. },
  242. //是否显示弹窗
  243. viewPersonCodeFlag:false,
  244. //工序列表
  245. processList:[],
  246. //当前选择弹窗展开的工段信息
  247. currentProcessName:"",
  248. //当前姓名
  249. currentUserName:"",
  250. //二维码信息
  251. imgBase:"",
  252. // 遮罩层
  253. loading: true,
  254. // 选中数组
  255. ids: [],
  256. // 非单个禁用
  257. single: true,
  258. // 非多个禁用
  259. multiple: true,
  260. // 显示搜索条件
  261. showSearch: true,
  262. // 总条数
  263. total: 0,
  264. // 工位信息表格数据
  265. stationInformationList: [],
  266. // 弹出层标题
  267. title: "",
  268. // 是否显示弹出层
  269. open: false,
  270. // 查询参数
  271. queryParams: {
  272. pageNum: 1,
  273. pageSize: 10,
  274. stationCode: null,
  275. stationName: null,
  276. personnelId: null,
  277. personnelName: null,
  278. deviceId: null,
  279. deviceName: null,
  280. createById: null,
  281. updateById: null,
  282. dataApprovalStatus: null,
  283. processKey: null,
  284. taskProcessKey: null,
  285. taskNodeKey: null,
  286. teamName:null
  287. },
  288. userInfo:[],
  289. // 表单参数
  290. form: {},
  291. // 表单校验
  292. rules: {
  293. }
  294. };
  295. },
  296. created() {
  297. this.processListApi();
  298. this.getListUserInformation();
  299. this.getList();
  300. },
  301. methods: {
  302. processNametSelected(){
  303. let obj = this.processList.find(item=>item.value==this.form.processId);
  304. console.log(obj,"dddd");
  305. this.form.processName=obj.label;
  306. console.log(this.form);
  307. },
  308. personnelNametSelected(){
  309. let obj = this.userInfo.find(item=>item.userId==this.form.personnelId);
  310. this.form.personnelName=obj.nickName;
  311. },
  312. getListUserInformation(){
  313. let obj= {"isEnablePaging":false}
  314. listUserInformation(obj).then(resp=>{
  315. this.userInfo=resp.rows.filter(item=>item.userName!="fjqyAdmin");
  316. console.log(this.userInfo);
  317. })
  318. },
  319. dym(){
  320. this.viewPersonCodeFlag=false;
  321. },
  322. //下拉菜单点击事件
  323. handleCommand(command, row) {
  324. switch (command) {
  325. case "handleUpdate":
  326. this.handleUpdate(row)
  327. break;
  328. case "handleDelete":
  329. this.handleDelete(row)
  330. break;
  331. case "printStationCode":
  332. this.printStationCode(row)
  333. break;
  334. case "viewPersonCode":
  335. this.viewPersonCode(row)
  336. break;
  337. default:
  338. break;
  339. }
  340. },
  341. viewPersonCode(row){
  342. console.log("hmc")
  343. this.title="人员码"
  344. this.currentProcessName=row.processName;
  345. this.currentUserName=row.personnelName;
  346. this.employeeNumber=row.personnelId;
  347. this.employeeName=row.personnelName;
  348. this.generateEmployeeCodeApi({"userNumber":row.personnelId,"userName":row.personnelName});
  349. },
  350. async generateEmployeeCodeApi(obj){
  351. await generateEmployeeCode(obj).then((res) => {
  352. console.log(res);
  353. if (res.code == 200) {
  354. this.imgBase=res.data;
  355. this.viewPersonCodeFlag=true;
  356. }
  357. });
  358. },
  359. //打印逻辑方法
  360. printStationCode(row){
  361. console.log("打印工位码信息")
  362. console.log(row)
  363. let codeString = "scan@&"+row.stationCode;
  364. let allPringtData = [];
  365. //添加内容
  366. allPringtData.push({
  367. codeData: codeString,
  368. showMsg: [
  369. { label: "工位码", value: row.stationCode },
  370. ],
  371. });
  372. qrCodeList(allPringtData, "printDom");
  373. },
  374. /** 查询工位信息列表 */
  375. getList() {
  376. this.loading = true;
  377. listStationInformation(this.queryParams).then(response => {
  378. this.stationInformationList = response.rows;
  379. this.total = response.total;
  380. this.loading = false;
  381. });
  382. },
  383. // 取消按钮
  384. cancel() {
  385. this.open = false;
  386. this.viewPersonCodeFlag=false;
  387. this.reset();
  388. },
  389. // 表单重置
  390. reset() {
  391. this.form = {
  392. id: null,
  393. stationCode: null,
  394. stationName: null,
  395. personnelId: null,
  396. personnelName: null,
  397. deviceId: null,
  398. deviceName: null,
  399. remark: null,
  400. createById: null,
  401. createBy: null,
  402. createTime: null,
  403. updateById: null,
  404. updateBy: null,
  405. updateTime: null,
  406. delFlag: null,
  407. dataApprovalStatus: null,
  408. processKey: null,
  409. taskProcessKey: null,
  410. taskNodeKey: null
  411. };
  412. this.resetForm("form");
  413. },
  414. /**
  415. * 查询工序列表
  416. */
  417. processListApi(){
  418. this.processList=[];
  419. listList({"isEnablePaging":false}).then(response => {
  420. let newData=response.rows.map(item=>{
  421. return {"value":item.id,"label":item.procedurName}
  422. })
  423. this.processList=newData;
  424. console.log(this.processList)
  425. });
  426. },
  427. /** 搜索按钮操作 */
  428. handleQuery() {
  429. this.queryParams.pageNum = 1;
  430. this.getList();
  431. },
  432. /** 重置按钮操作 */
  433. resetQuery() {
  434. this.resetForm("queryForm");
  435. this.handleQuery();
  436. },
  437. // 多选框选中数据
  438. handleSelectionChange(selection) {
  439. this.ids = selection.map(item => item.id)
  440. this.single = selection.length!==1
  441. this.multiple = !selection.length
  442. },
  443. /** 新增按钮操作 */
  444. handleAdd() {
  445. this.reset();
  446. this.getListUserInformation();
  447. this.processListApi();
  448. this.open = true;
  449. this.title = "添加工位信息";
  450. },
  451. /** 修改按钮操作 */
  452. handleUpdate(row) {
  453. this.reset();
  454. this.getListUserInformation();
  455. this.processListApi();
  456. const id = row.id || this.ids
  457. getStationInformation(id).then(response => {
  458. this.form = response.data;
  459. this.form.personnelId=parseInt(response.data.personnelId);
  460. this.form.processId=parseInt(response.data.processId);
  461. // this.form.stationType=parseInt(response.data.stationType);
  462. this.open = true;
  463. this.title = "修改工位信息";
  464. });
  465. },
  466. /** 提交按钮 */
  467. submitForm() {
  468. this.$refs["form"].validate(valid => {
  469. if (valid) {
  470. if (this.form.id != null) {
  471. updateStationInformation(this.form).then(response => {
  472. this.$modal.msgSuccess("修改成功");
  473. this.open = false;
  474. this.getList();
  475. });
  476. } else {
  477. addStationInformation(this.form).then(response => {
  478. this.$modal.msgSuccess("新增成功");
  479. this.open = false;
  480. this.getList();
  481. });
  482. }
  483. }
  484. });
  485. },
  486. /** 删除按钮操作 */
  487. handleDelete(row) {
  488. const ids = row.id || this.ids;
  489. this.$modal.confirm('是否确认删除工位信息编号为"' + ids + '"的数据项?').then(function() {
  490. return delStationInformation(ids);
  491. }).then(() => {
  492. this.getList();
  493. this.$modal.msgSuccess("删除成功");
  494. }).catch(() => {});
  495. },
  496. /** 导出按钮操作 */
  497. handleExport() {
  498. this.download('amichi/stationInformation/export', {
  499. ...this.queryParams
  500. }, `stationInformation_${new Date().getTime()}.xlsx`)
  501. }
  502. }
  503. };
  504. </script>
  505. <style scoped>
  506. .mBox{
  507. width: 404px;
  508. height: 506px;
  509. border: 2px solid black;
  510. margin: 0 auto;
  511. color: black;
  512. .top{
  513. width: 400px;
  514. height: 400px;
  515. margin: 0 auto;
  516. box-sizing: border-box;
  517. .topnr{
  518. width: 320px;
  519. height: 320px;
  520. align-content: center;
  521. align-items: center;
  522. //border: 1px solid black;
  523. margin: 0 auto;
  524. img{
  525. margin-top: 40px;
  526. }
  527. }
  528. }
  529. .bottom{
  530. display: flex;
  531. justify-content: space-evenly;
  532. align-content: center;
  533. .bottom-left{
  534. width: 150px;
  535. height: 50px;
  536. line-height: 50px;
  537. //border: 1px solid black;
  538. box-sizing: border-box;
  539. text-align: center;
  540. font-size: 18px;
  541. }
  542. .bottom-right{
  543. width: 250px;
  544. height: 50px;
  545. line-height: 50px;
  546. //border: 1px solid black;
  547. box-sizing: border-box;
  548. text-align: center;
  549. font-size: 18px;
  550. }
  551. }
  552. }
  553. </style>