indexCopyV4.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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="stationType">
  13. <el-select v-model="queryParams.stationType">
  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="stationName" />
  106. <el-table-column label="人员姓名" align="center" prop="personnelName"/>
  107. <el-table-column label="设备mac" align="center" prop="deviceNumber" />
  108. <el-table-column label="备注" align="center" prop="remark" />
  109. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  110. <template slot-scope="scope">
  111. <el-dropdown @command="(command)=>{handleCommand(command, scope.row)}">
  112. <el-button type="warning">
  113. 操作<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="handleUpdate">修改</el-dropdown-item>
  117. <el-dropdown-item icon="el-icon-delete" command="handleDelete">删除</el-dropdown-item>
  118. </el-dropdown-menu>
  119. </el-dropdown>
  120. </template>
  121. </el-table-column>
  122. </el-table>
  123. <pagination
  124. v-show="total>0"
  125. :total="total"
  126. :page.sync="queryParams.pageNum"
  127. :limit.sync="queryParams.pageSize"
  128. @pagination="getList"
  129. />
  130. <!-- 添加或修改工位信息对话框 -->
  131. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  132. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  133. <el-form-item label="工位名称" prop="stationName">
  134. <el-input v-model="form.stationName" placeholder="请输入工位名称" />
  135. </el-form-item>
  136. <el-form-item label="工位类型" prop="processId">
  137. <el-select
  138. v-model="form.processId"
  139. size="small"
  140. style="width: 680px"
  141. @change="processNametSelected()"
  142. >
  143. <el-option
  144. v-for="(item,index) in processList"
  145. :key="index"
  146. :label="item.label"
  147. :value="item.value"
  148. ></el-option>
  149. </el-select>
  150. </el-form-item>
  151. <el-form-item label="人员姓名" prop="personnelId">
  152. <el-select
  153. v-model="form.personnelId"
  154. size="small"
  155. style="width: 680px"
  156. @change="personnelNametSelected()"
  157. >
  158. <el-option
  159. v-for="(item,index) in userInfo"
  160. :key="index"
  161. :label="item.nickName"
  162. :value="item.userId"
  163. ></el-option>
  164. </el-select>
  165. </el-form-item>
  166. <!-- <el-form-item label="设备名称" prop="deviceName">-->
  167. <!-- <el-input v-model="form.deviceName" placeholder="请输入设备名称" />-->
  168. <!-- </el-form-item>-->
  169. <el-form-item label="备注" prop="remark">
  170. <el-input v-model="form.remark" placeholder="请输入备注" />
  171. </el-form-item>
  172. </el-form>
  173. <div slot="footer" class="dialog-footer">
  174. <el-button type="primary" @click="submitForm">确 定</el-button>
  175. <el-button @click="cancel">取 消</el-button>
  176. </div>
  177. </el-dialog>
  178. <!-- print -->
  179. <div id="printDom" style="width: 160px; height: 160px"></div>
  180. </div>
  181. </template>
  182. <script>
  183. import { listStationInformation, getStationInformation, delStationInformation, addStationInformation, updateStationInformation } from "@/api/amichi/stationInformation/stationInformation";
  184. import qrCodeList from "@/views/amichi/print/qrCodeList";
  185. import {listUserInformation} from "@/api/amichi/user/user"
  186. import {listList} from "@/api/amichi/procedureList/list";
  187. export default {
  188. name: "StationInformation",
  189. dicts:["gxlxinfo"],
  190. data() {
  191. return {
  192. //工序列表
  193. processList:[],
  194. // 遮罩层
  195. loading: true,
  196. // 选中数组
  197. ids: [],
  198. // 非单个禁用
  199. single: true,
  200. // 非多个禁用
  201. multiple: true,
  202. // 显示搜索条件
  203. showSearch: true,
  204. // 总条数
  205. total: 0,
  206. // 工位信息表格数据
  207. stationInformationList: [],
  208. // 弹出层标题
  209. title: "",
  210. // 是否显示弹出层
  211. open: false,
  212. // 查询参数
  213. queryParams: {
  214. pageNum: 1,
  215. pageSize: 10,
  216. stationCode: null,
  217. stationName: null,
  218. personnelId: null,
  219. personnelName: null,
  220. deviceId: null,
  221. deviceName: null,
  222. createById: null,
  223. updateById: null,
  224. dataApprovalStatus: null,
  225. processKey: null,
  226. taskProcessKey: null,
  227. taskNodeKey: null,
  228. teamName:null
  229. },
  230. userInfo:[],
  231. // 表单参数
  232. form: {},
  233. // 表单校验
  234. rules: {
  235. }
  236. };
  237. },
  238. created() {
  239. this.processListApi();
  240. this.getListUserInformation();
  241. this.getList();
  242. },
  243. methods: {
  244. processNametSelected(){
  245. let obj = this.processList.find(item=>item.value==this.form.processId);
  246. console.log(obj,"dddd");
  247. this.form.processName=obj.label;
  248. console.log(this.form);
  249. },
  250. personnelNametSelected(){
  251. let obj = this.userInfo.find(item=>item.userId==this.form.personnelId);
  252. this.form.personnelName=obj.nickName;
  253. },
  254. getListUserInformation(){
  255. listUserInformation().then(resp=>{
  256. this.userInfo=resp.rows.filter(item=>item.userName!="fjqyAdmin");
  257. console.log(this.userInfo);
  258. })
  259. },
  260. //下拉菜单点击事件
  261. handleCommand(command, row) {
  262. switch (command) {
  263. case "handleUpdate":
  264. this.handleUpdate(row)
  265. break;
  266. case "handleDelete":
  267. this.handleDelete(row)
  268. break;
  269. case "printStationCode":
  270. this.printStationCode(row)
  271. break;
  272. default:
  273. break;
  274. }
  275. },
  276. //打印逻辑方法
  277. printStationCode(row){
  278. console.log("打印工位码信息")
  279. console.log(row)
  280. let codeString = "scan@&"+row.stationCode;
  281. let allPringtData = [];
  282. //添加内容
  283. allPringtData.push({
  284. codeData: codeString,
  285. showMsg: [
  286. { label: "工位码", value: row.stationCode },
  287. ],
  288. });
  289. qrCodeList(allPringtData, "printDom");
  290. },
  291. /** 查询工位信息列表 */
  292. getList() {
  293. this.loading = true;
  294. listStationInformation(this.queryParams).then(response => {
  295. this.stationInformationList = response.rows;
  296. this.total = response.total;
  297. this.loading = false;
  298. });
  299. },
  300. // 取消按钮
  301. cancel() {
  302. this.open = false;
  303. this.reset();
  304. },
  305. // 表单重置
  306. reset() {
  307. this.form = {
  308. id: null,
  309. stationCode: null,
  310. stationName: null,
  311. personnelId: null,
  312. personnelName: null,
  313. deviceId: null,
  314. deviceName: null,
  315. remark: null,
  316. createById: null,
  317. createBy: null,
  318. createTime: null,
  319. updateById: null,
  320. updateBy: null,
  321. updateTime: null,
  322. delFlag: null,
  323. dataApprovalStatus: null,
  324. processKey: null,
  325. taskProcessKey: null,
  326. taskNodeKey: null
  327. };
  328. this.resetForm("form");
  329. },
  330. /**
  331. * 查询工序列表
  332. */
  333. processListApi(){
  334. this.processList=[];
  335. listList({"isEnablePaging":false}).then(response => {
  336. let newData=response.rows.map(item=>{
  337. return {"value":item.id,"label":item.procedurName}
  338. })
  339. this.processList=newData;
  340. console.log(this.processList)
  341. });
  342. },
  343. /** 搜索按钮操作 */
  344. handleQuery() {
  345. this.queryParams.pageNum = 1;
  346. this.getList();
  347. },
  348. /** 重置按钮操作 */
  349. resetQuery() {
  350. this.resetForm("queryForm");
  351. this.handleQuery();
  352. },
  353. // 多选框选中数据
  354. handleSelectionChange(selection) {
  355. this.ids = selection.map(item => item.id)
  356. this.single = selection.length!==1
  357. this.multiple = !selection.length
  358. },
  359. /** 新增按钮操作 */
  360. handleAdd() {
  361. this.reset();
  362. this.getListUserInformation();
  363. this.processListApi();
  364. this.open = true;
  365. this.title = "添加工位信息";
  366. },
  367. /** 修改按钮操作 */
  368. handleUpdate(row) {
  369. this.reset();
  370. this.getListUserInformation();
  371. this.processListApi();
  372. const id = row.id || this.ids
  373. getStationInformation(id).then(response => {
  374. this.form = response.data;
  375. this.form.personnelId=parseInt(response.data.personnelId);
  376. this.form.processId=parseInt(response.data.processId);
  377. // this.form.stationType=parseInt(response.data.stationType);
  378. this.open = true;
  379. this.title = "修改工位信息";
  380. });
  381. },
  382. /** 提交按钮 */
  383. submitForm() {
  384. this.$refs["form"].validate(valid => {
  385. if (valid) {
  386. if (this.form.id != null) {
  387. updateStationInformation(this.form).then(response => {
  388. this.$modal.msgSuccess("修改成功");
  389. this.open = false;
  390. this.getList();
  391. });
  392. } else {
  393. addStationInformation(this.form).then(response => {
  394. this.$modal.msgSuccess("新增成功");
  395. this.open = false;
  396. this.getList();
  397. });
  398. }
  399. }
  400. });
  401. },
  402. /** 删除按钮操作 */
  403. handleDelete(row) {
  404. const ids = row.id || this.ids;
  405. this.$modal.confirm('是否确认删除工位信息编号为"' + ids + '"的数据项?').then(function() {
  406. return delStationInformation(ids);
  407. }).then(() => {
  408. this.getList();
  409. this.$modal.msgSuccess("删除成功");
  410. }).catch(() => {});
  411. },
  412. /** 导出按钮操作 */
  413. handleExport() {
  414. this.download('amichi/stationInformation/export', {
  415. ...this.queryParams
  416. }, `stationInformation_${new Date().getTime()}.xlsx`)
  417. }
  418. }
  419. };
  420. </script>