浏览代码

完成个人上下料站人员配置功能

oyq28 3 年之前
父节点
当前提交
6b9cbb255f

+ 118 - 117
imcs-ui/package.json

@@ -1,117 +1,118 @@
-{
-  "name": "zuihou-ui",
-  "version": "1.0.0",
-  "description": "zuihou-admin-cloud 前端项目",
-  "author": "zuihou",
-  "license": "Apache 2.0",
-  "scripts": {
-    "dev": "vue-cli-service serve",
-    "build:prod": "vue-cli-service build",
-    "build:boot": "vue-cli-service build --mode boot",
-    "build:docker": "vue-cli-service build --mode docker",
-    "build:stage": "vue-cli-service build --mode staging",
-    "preview": "node build/index.js --preview",
-    "lint": "eslint --ext .js,.vue src",
-    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
-    "new": "plop"
-  },
-  "keywords": [
-    "vue",
-    "admin",
-    "dashboard",
-    "element-ui",
-    "management-system"
-  ],
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/zuihou/zuihou-ui"
-  },
-  "bugs": {
-    "url": "https://github.com/zuihou/zuihou-ui/issues"
-  },
-  "dependencies": {
-    "@riophae/vue-treeselect": "0.0.38",
-    "axios": "^0.21.4",
-    "chromedriver": "^79.0.0",
-    "clipboard": "2.0.4",
-    "codemirror": "^5.64.0",
-    "driver.js": "0.9.5",
-    "dropzone": "5.5.1",
-    "echarts": "^5.2.2",
-    "element-ui": "2.12.0",
-    "file-saver": "2.0.1",
-    "fuse.js": "3.4.4",
-    "jsbarcode": "^3.11.3",
-    "jsonlint": "1.6.3",
-    "jszip": "^3.7.1",
-    "moment": "^2.29.1",
-    "normalize.css": "7.0.0",
-    "nprogress": "0.2.0",
-    "path-to-regexp": "2.4.0",
-    "screenfull": "4.2.0",
-    "showdown": "^1.9.1",
-    "sortablejs": "1.8.4",
-    "spark-md5": "^3.0.1",
-    "tui-editor": "1.3.3",
-    "vue": "2.6.10",
-    "vue-count-to": "^1.0.13",
-    "vue-echarts": "^6.0.0-rc.5",
-    "vue-i18n": "7.3.2",
-    "vue-lazyload": "^1.3.3",
-    "vue-print-nb": "^1.6.0",
-    "vue-progressbar": "^0.7.5",
-    "vue-router": "3.0.2",
-    "vue-seamless-scroll": "^1.1.23",
-    "vue-simple-uploader": "^0.7.4",
-    "vue-splitpane": "1.0.4",
-    "vuedraggable": "2.20.0",
-    "vuescroll": "^4.17.3",
-    "vuex": "3.1.0",
-    "xlsx": "^0.17.4"
-  },
-  "devDependencies": {
-    "@babel/core": "7.0.0",
-    "@babel/register": "7.0.0",
-    "@vue/cli-plugin-babel": "3.5.3",
-    "@vue/cli-plugin-eslint": "3.5.1",
-    "@vue/cli-plugin-unit-jest": "^3.9.0",
-    "@vue/cli-service": "3.5.3",
-    "@vue/test-utils": "1.0.0-beta.29",
-    "autoprefixer": "^9.5.1",
-    "babel-core": "7.0.0-bridge.0",
-    "babel-eslint": "10.0.1",
-    "babel-jest": "23.6.0",
-    "chalk": "2.4.2",
-    "chokidar": "2.1.5",
-    "compression-webpack-plugin": "^1.1.12",
-    "connect": "3.6.6",
-    "eslint": "5.15.3",
-    "eslint-plugin-vue": "5.2.2",
-    "html-webpack-plugin": "3.2.0",
-    "husky": "1.3.1",
-    "less": "^3.13.1",
-    "less-loader": "^5.0.0",
-    "lint-staged": "8.1.5",
-    "mockjs": "1.0.1-beta3",
-    "node-sass": "^4.14.1",
-    "plop": "2.3.0",
-    "pug": "^3.0.2",
-    "pug-plain-loader": "^1.1.0",
-    "runjs": "^4.3.2",
-    "sass-loader": "^7.1.0",
-    "script-ext-html-webpack-plugin": "2.1.3",
-    "script-loader": "0.7.2",
-    "serve-static": "^1.13.2",
-    "svg-sprite-loader": "4.1.3",
-    "svgo": "1.2.0",
-    "vue-template-compiler": "2.6.10"
-  },
-  "engines": {
-    "node": ">=8.9",
-    "npm": ">= 3.0.0"
-  },
-  "browserslist": [
-    "> 1%",
-    "last 2 versions"
-  ]
-}
+{
+  "name": "zuihou-ui",
+  "version": "1.0.0",
+  "description": "zuihou-admin-cloud 前端项目",
+  "author": "zuihou",
+  "license": "Apache 2.0",
+  "scripts": {
+    "dev": "vue-cli-service serve",
+    "build:prod": "vue-cli-service build",
+    "build:boot": "vue-cli-service build --mode boot",
+    "build:docker": "vue-cli-service build --mode docker",
+    "build:stage": "vue-cli-service build --mode staging",
+    "preview": "node build/index.js --preview",
+    "lint": "eslint --ext .js,.vue src",
+    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
+    "new": "plop"
+  },
+  "keywords": [
+    "vue",
+    "admin",
+    "dashboard",
+    "element-ui",
+    "management-system"
+  ],
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/zuihou/zuihou-ui"
+  },
+  "bugs": {
+    "url": "https://github.com/zuihou/zuihou-ui/issues"
+  },
+  "dependencies": {
+    "@riophae/vue-treeselect": "0.0.38",
+    "axios": "^0.21.4",
+    "chromedriver": "^79.0.0",
+    "clipboard": "2.0.4",
+    "codemirror": "^5.64.0",
+    "driver.js": "0.9.5",
+    "dropzone": "5.5.1",
+    "echarts": "^5.2.2",
+    "element-ui": "2.15.6",
+    "file-saver": "2.0.1",
+    "fuse.js": "3.4.4",
+    "jsbarcode": "^3.11.3",
+    "jsonlint": "1.6.3",
+    "jszip": "^3.7.1",
+    "moment": "^2.29.1",
+    "normalize.css": "7.0.0",
+    "nprogress": "0.2.0",
+    "path-to-regexp": "2.4.0",
+    "screenfull": "4.2.0",
+    "showdown": "^1.9.1",
+    "sortablejs": "1.8.4",
+    "spark-md5": "^3.0.1",
+    "tui-editor": "1.3.3",
+    "vue": "2.6.10",
+    "vue-count-to": "^1.0.13",
+    "vue-echarts": "^6.0.0-rc.5",
+    "vue-i18n": "7.3.2",
+    "vue-lazyload": "^1.3.3",
+    "vue-print-nb": "^1.6.0",
+    "vue-progressbar": "^0.7.5",
+    "vue-router": "3.0.2",
+    "vue-seamless-scroll": "^1.1.23",
+    "vue-simple-uploader": "^0.7.4",
+    "vue-splitpane": "1.0.4",
+    "vuedraggable": "2.20.0",
+    "vuescroll": "^4.17.3",
+    "vuex": "3.1.0",
+    "xlsx": "^0.17.4"
+  },
+  "devDependencies": {
+    "@babel/core": "7.0.0",
+    "@babel/register": "7.0.0",
+    "@vue/cli-plugin-babel": "3.5.3",
+    "@vue/cli-plugin-eslint": "3.5.1",
+    "@vue/cli-plugin-unit-jest": "^3.9.0",
+    "@vue/cli-service": "3.5.3",
+    "@vue/test-utils": "1.0.0-beta.29",
+    "autoprefixer": "^9.5.1",
+    "babel-core": "7.0.0-bridge.0",
+    "babel-eslint": "10.0.1",
+    "babel-jest": "23.6.0",
+    "chalk": "2.4.2",
+    "chokidar": "2.1.5",
+    "compression-webpack-plugin": "^1.1.12",
+    "connect": "3.6.6",
+    "eslint": "5.15.3",
+    "eslint-plugin-vue": "5.2.2",
+    "html-webpack-plugin": "3.2.0",
+    "husky": "1.3.1",
+    "less": "^3.13.1",
+    "less-loader": "^5.0.0",
+    "lint-staged": "8.1.5",
+    "mockjs": "1.0.1-beta3",
+    "node-sass": "^4.14.1",
+    "plop": "2.3.0",
+    "pug": "^3.0.2",
+    "pug-plain-loader": "^1.1.0",
+    "qs": "^6.10.2",
+    "runjs": "^4.3.2",
+    "sass-loader": "^7.1.0",
+    "script-ext-html-webpack-plugin": "2.1.3",
+    "script-loader": "0.7.2",
+    "serve-static": "^1.13.2",
+    "svg-sprite-loader": "4.1.3",
+    "svgo": "1.2.0",
+    "vue-template-compiler": "2.6.10"
+  },
+  "engines": {
+    "node": ">=8.9",
+    "npm": ">= 3.0.0"
+  },
+  "browserslist": [
+    "> 1%",
+    "last 2 versions"
+  ]
+}

+ 105 - 0
imcs-ui/src/api/machiningClient/stationMgr.js

@@ -0,0 +1,105 @@
+/*********************** 【机加工人端-待完成任务/已完成任务】API ********************/
+import axiosApi from '../AxiosApi.js'
+
+const apiList = {
+	getList: {
+	    method: 'POST',
+	    url: `/authority/stationUser/query`
+	},  	
+  	update: {
+	    method: 'PUT',
+	    url: `/authority/stationUser`
+  	},
+	saveAll: {
+	    method: 'POST',
+	    url: `/authority/stationUser/saveAll`
+	},
+	updateAll: {
+	    method: 'POST',
+	    url: `/authority/stationUser/updateAll`
+	},
+	allStation: {
+	    method: 'GET',
+	    url: `/authority/stationUser/allStation`
+	}, 
+	allUser: {
+	    method: 'GET',
+	    url: `/authority/stationUser/allUser`
+	}, 
+	stationUser: {
+	    method: 'GET',
+	    url: `/authority/stationUser/stationUser`
+	},	
+	getStation:{
+		method: 'GET',
+	    url: `/authority/stationUser/getStation`
+	},
+  	remove: {
+    	method: 'DELETE',
+    	url: `/authority/stationUser`
+  	},
+}
+
+export default {
+	getList (data) {
+	    return axiosApi({
+	    	...apiList.getList,
+	    	data
+	    })
+  	},
+  	// 获取【所有人员】信息
+  	allUser (data) {
+	    return axiosApi({
+	    	...apiList.allUser,
+	    	data
+	    })
+  	},
+  	page (data) {
+	    return axiosApi({
+	      	...apiList.page,
+	      	data
+	    })
+  	},
+  	saveAll (data) {
+	    return axiosApi({
+	      	...apiList.saveAll,
+	      	data
+	    })
+  	},
+	updateAll (data) {
+	    return axiosApi({
+	      	...apiList.updateAll,
+	      	data
+	    })
+  	},
+  	allStation (data) {
+	    return axiosApi({
+	      	...apiList.allStation,
+	      	data
+	    })
+  	},  
+	stationUser (data) {
+	    return axiosApi({
+	      	...apiList.stationUser,
+	      	data
+	    })
+  	}, 
+	getStation (data) {
+	    return axiosApi({
+	      	...apiList.getStation,
+	      	data
+	    })
+  	},     
+  	update (data) {
+	    return axiosApi({
+	      	...apiList.update,
+	      	data
+	    })
+  	},
+  	remove (data) {
+	    return axiosApi({
+	      	...apiList.remove,
+	      	data
+	    })
+  	}  	
+}

+ 239 - 0
imcs-ui/src/views/zuihou/machiningClient/personConf/Index.vue

@@ -0,0 +1,239 @@
+<template>
+  <div class="formContaner" style="height: 200px; margin-top: 15px">
+    <el-form
+      ref="form"
+      :model="tenant"
+      :rules="rules"
+      label-position="right"
+      label-width="150px"
+    >
+      <el-form-item
+        :label="station.stationName + ':'"
+        v-for="(station, index) in stationList"
+        :key="station.stationId"
+      >
+        <el-select
+          :id="'select' + index"
+          v-model="tenant.userIds[station.stationId]"
+          style="width: 300px"
+          :placeholder="$t('common.pleaseSelect')"
+          multiple
+          @change="
+            (val) => {
+              selChange(val, station.stationId);
+            }
+          "
+        >
+          <el-option
+            :label="user.userName"
+            :value="user.userId"
+            v-for="user in userList"
+            :key="user.userId"
+          />
+        </el-select>
+      </el-form-item>
+    </el-form>
+
+    <div slot="footer" class="dialog-footer">
+      <el-button
+        type="primary"
+        icon="el-icon-check"
+        :disabled="confirmDisabled"
+        @click="submitForm"
+        >{{ $t("runCenter.buttons.ok") }}</el-button
+      >
+    </div>
+  </div>
+</template>
+
+<script>
+// 【产线管理】-API
+import stationMgrApi from "@/api/machiningClient/stationMgr";
+
+// 共通的【查询方法】
+import { initDicts, initQueryParams } from "@/utils/commons";
+// 共通【工具方法】(字典分解)
+import { convertEnum } from "@/utils/utils";
+import qs from "qs";
+export default {
+  name: "PersonConf",
+  components: {},
+  props: {},
+  data() {
+    return {
+      dataList: [],
+      stationList: [],
+      userList: [],
+      confirmDisabled: false,
+      bool: true,
+      tenant: this.initTenant(),
+      rules: {},
+    };
+  },
+  // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
+  created() {
+    // 查询所有当前产线信息
+    this.getAllStation();
+    this.getAllUser();
+    this.getStateUser();
+  },
+  computed: {
+    currentUser() {
+      return this.$store.state.account.user;
+    },
+  },
+  mounted() {},
+  methods: {
+    initTenant() {
+      return {
+        ids: {},
+        stationIds: [],
+        userIds: {},
+      };
+    },
+    reset() {
+      // 先清除校验,再清除表单,不然有奇怪的bug
+      this.$refs.form.clearValidate();
+      this.$refs.form.resetFields();
+      this.tenant = this.initTenant();
+    },
+    submitForm() {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          // 获取父组件传值ID
+          this.tenant.stationIds = this.stationList.map((item) => {
+            return item.stationId;
+          });
+          this.confirmDisabled = true;
+
+          //this.bool = this.tenant.ids.length>0? true : false
+          //console.log(this.dataList)
+          if (this.dataList.length == 0) {
+            let arr = [];
+            for (let prop in this.tenant.userIds) {
+              let obj = this.tenant.userIds[prop];
+              arr.push(obj.join(","));
+            }
+            this.tenant.userIds = arr;
+            //console.log(this.tenant)
+            stationMgrApi
+              .saveAll(qs.stringify(this.tenant, { arrayFormat: "brackets" }))
+              .then((res) => {
+                res = res.data;
+                if (res.isSuccess) {
+                  this.$message({
+                    message: this.$t("tips.optionSuccess"),
+                    type: "success",
+                  });
+                  // 恢复按钮
+                  this.confirmDisabled = false;
+                }
+              });
+          } else {
+            let ids = [];
+            let userIds = [];
+            let stationIds = [];
+            for (let prop in this.tenant.ids) {
+              for (let i = 0; i < this.tenant.userIds[prop].length; i++) {
+                stationIds.push(prop);
+                ids.push(
+                  this.tenant.ids[prop][i] ? this.tenant.ids[prop][i] : "0"
+                );
+                userIds.push(this.tenant.userIds[prop][i]);
+              }
+            }
+
+            let params = {
+              userIds: userIds,
+              ids: ids,
+              stationIds: stationIds,
+            };
+            console.log(params);
+            stationMgrApi
+              .updateAll(qs.stringify(params, { arrayFormat: "brackets" }))
+              .then((res) => {
+                res = res.data;
+                if (res.isSuccess) {
+                  this.$message({
+                    message: this.$t("tips.optionSuccess"),
+                    type: "success",
+                  });
+                  // 恢复按钮
+                  this.confirmDisabled = false;
+                }
+              });
+          }
+        } else {
+          return false;
+        }
+      });
+      this.$emit("close");
+      //location.reload()
+    },
+    // 查询所有当前产线信息
+    getAllStation() {
+      stationMgrApi.allStation({}).then((res) => {
+        res = res.data;
+        if (res.isSuccess) {
+          // 给当前赋值
+          //console.log(res.data);
+          this.stationList = res.data;
+        }
+      });
+    },
+    getAllUser() {
+      stationMgrApi.allUser({}).then((res) => {
+        res = res.data;
+        if (res.isSuccess) {
+          // 给当前赋值
+          //console.log(res.data);
+          this.userList = res.data;
+        }
+      });
+    },
+    getStateUser() {
+      return new Promise((resolve, reject) => {
+        stationMgrApi.stationUser({}).then((res) => {
+          res = res.data;
+          if (res.isSuccess) {
+            // 给当前赋值
+            //console.log(res.data)
+            if (res.data.length > 0) {
+              res.data.map((data) => {
+                this.tenant.ids[data.stationId] = data.ids.split(",");
+                this.tenant.userIds[data.stationId] = data.userIds.split(",");
+              });
+              this.dataList = res.data;
+            }
+          }
+        });
+        resolve(true);
+      }).catch(() => {
+        reject(false);
+      });
+    },
+    selChange(data, stationId) {
+      this.tenant.userIds[stationId] = data;
+      console.log(this.tenant.userIds[stationId]);
+      this.$forceUpdate();
+    },
+  },
+};
+</script>
+
+<!-- 本组件的css -->
+<style lang="scss" scoped>
+.formTitle {
+  font-size: 16px;
+  font-weight: 700;
+  margin: 30px 30px 20px 30px;
+  padding-bottom: 20px;
+  border-bottom: 1px solid #cccccc;
+}
+.formContaner form {
+  max-width: 600px;
+}
+.dialog-footer {
+  margin-left: 180px;
+}
+</style>

+ 15 - 1
imcs-ui/src/views/zuihou/machiningClient/touchScreen/Index.vue

@@ -142,6 +142,7 @@
     // 【查看】组件
 	import TaskView from "../waitingTasks/components/View"
 	import { fullScreen, exitFullScreen } from '@/utils/commons'
+	import stationMgrApi from "@/api/machiningClient/stationMgr";
 export default {
   name: 'TouchScreen',
   components: { TaskView },
@@ -161,8 +162,12 @@ export default {
   },
   	// 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
   	created() {
+	   this.fetch()	  
 	},
   	computed: {
+	   currentUser () {
+	      return this.$store.state.account.user
+	   }  
   	},
   	mounted () {
   	},
@@ -193,6 +198,16 @@ export default {
 		selectChange(value){
           console.log(value)
 		},
+		fetch(){		   	
+		   stationMgrApi.getStation({userId:this.$store.state.account.user.id}).then((res) => {
+              	res = res.data;
+				if(res.isSuccess){
+					if(res.data.length>0){
+                      this.options = res.data
+					}					
+				}  
+		     });		
+		},
 		readView(){			
 			//this.tenantViewVisible = true
 			this.$refs.view.read(null)			
@@ -224,7 +239,6 @@ export default {
 			this.taskCount = this.taskCount - 1
 			this.finishData.push(item)
 			this.taskData.shift()
-
 		},
 		navigator(){
 			this.$router.push("/classScheduleMgr/classScheduleMgr")