Kaynağa Gözat

页面功能处理

oyq28 3 yıl önce
ebeveyn
işleme
517293aee8

+ 3 - 1
imcs-ui/src/views/zuihou/resourceProductMgr/areaMgr/Index.vue

@@ -64,7 +64,7 @@
 	  <el-table-column prop="layoutMap" :label='$t("resource.table.area.layoutMap")' align="center" :show-overflow-tooltip="true" width="180px">
 		    <template slot-scope="{ row }">
 	        	<div class="img-wrapper">
-	          		<img :src="row.imgUrl"  />
+	          		<el-image :src="row.imgUrl" fit="cover" />
 	        	</div>
 	       </template>
 	  </el-table-column> 
@@ -318,6 +318,7 @@
 	    add () {
 	      this.$refs.edit.type = "add"
 	      this.$refs.edit.setTenant(false, this.dicts)
+		  this.$refs.edit.setFileData({id:"", bizId:""})		  
 	      this.dialog.title = this.$t("common.add")
 	      this.dialog.isVisible = true
 	    },
@@ -443,6 +444,7 @@
 	      }
 	      this.$refs.edit.setTenant(row, this.dicts)
 	      this.$refs.edit.type = "edit"
+		  this.$refs.edit.setFileData({id:row.layoutMap, bizId:row.id})		 
 	      this.dialog.title = this.$t("common.edit")
 	      this.dialog.isVisible = true
 	    },

+ 51 - 32
imcs-ui/src/views/zuihou/resourceProductMgr/areaMgr/components/Edit.vue

@@ -19,10 +19,13 @@
 				</template>
       </el-form-item>
       <el-form-item :label='$t("resource.table.area.layoutMap")+":"' prop="layoutMap">          
-          <fileUpload :acceptSize="5*1024*1024" :auto-upload="false" :limit="1" @fileLengthVaild="fileLengthVaild" @setId="setIdAndSubmit" ref="fileRef">
-              <el-button size="small" slot="trigger" type="primary">选取文件</el-button>              
+          <fileUpload :acceptSize="5*1024*1024" :auto-upload="false" :limit="1" :fileOtherData="this.fileData" @fileLengthVaild="fileLengthVaild" @setId="setIdAndSubmit" ref="fileRef">              
+              <el-button size="small" slot="trigger" type="primary" >选取文件</el-button>              
               <div class="el-upload__tip" slot="tip">文件不超过5MB</div>
           </fileUpload>
+          <div class="img-wrapper" v-if="tenant.imgUrl" style="margin:5px;">
+	          		<el-image :src="tenant.imgUrl" fit="cover" />
+	        </div> 
       </el-form-item>
       <el-form-item :label='$t("resource.table.area.remark")+":"' prop="remark">
       	<el-input v-model="tenant.remark" type="textarea" :rows="3" style="width: 100%;"/>
@@ -30,7 +33,7 @@
     </el-form>
     <div slot="footer" class="dialog-footer">
       <el-button plain type="warning" @click="isVisible = false">{{ $t('common.cancel') }}</el-button>
-      <el-button plain type="primary" :disabled="confirmDisabled" @click="submitForm">{{ $t('common.confirm') }}</el-button>
+      <el-button plain type="primary" :disabled="confirmDisabled" @click="submitForm" v-loading.fullscreen.lock="loading">{{ $t('common.confirm') }}</el-button>
     </div>
   </el-dialog>
 </template>
@@ -57,12 +60,15 @@ export default {
   data () {
     return {
       type: 'add',
+      loading: false,
       tenant: this.initTenant(),      
       screenWidth: 0,
       width: this.initWidth(),
       accept: "image/jpeg, image/gif, image/png",
       fileLength: 0,
       fileId: "",
+      fileData: {},
+      formData: {},
       confirmDisabled: false,
       dicts:{
         NATION: {}
@@ -105,14 +111,16 @@ export default {
       return (() => {
         this.width = this.initWidth()
       })()
-    }
+    } 
   },
   methods: {
     initTenant () {
       return {
         id: '',
         name: '',
-        status: '1'
+        layoutMap: '',
+        status: '1',
+        remark:'',
       }
     },
     initWidth () {
@@ -131,11 +139,18 @@ export default {
       vm.fileLength = data || 0;
     },
     setTenant (val, dicts) {
-    	if(val){
-    		this.tenant = { ...val }
+    	if(val){        
+    		this.tenant = { ...val }        
     	}
       // 字典表
-      this.dicts = dicts
+      this.dicts = dicts     
+    },
+    setFileData (val) {
+    	if(val){        
+    		this.fileData = { ...val }        
+    	}
+      this.fileData.bizType = "TRAY"
+      this.fileData.isSingle = true
     },
     close () {
       this.$emit('close')
@@ -152,43 +167,47 @@ export default {
       })
     },
     setIdAndSubmit (isUploadCompleted, res) {
-      const vm = this
-      console.log(res)
       if (isUploadCompleted) {
-        vm.disabled = false
-        vm.isVisible = false
-        vm.$message({
-          message: vm.$t('tips.createSuccess'),
+        this.loading = false
+        this.confirmDisabled = false
+        this.isVisible = false
+        this.$message({
+          message: this.$t('tips.createSuccess'),
           type: 'success'
         })        
-        vm.$emit('success')
+        this.$emit('success') 
         this.tenant.layoutMap = res.data.id
-        // 后续提交处理
-        if (this.type === 'add') {
-            this.save()
-        } else {
-            this.update()
-        } 
+        this.formData = JSON.parse(localStorage.getItem("formData"))        
+        this.formData.layoutMap = res.data.id
+        if (this.type === 'add') {            
+            this.save(this.formData)
+          } else {
+            this.update(this.formData)
+        }
+        localStorage.removeItem("formData");
       }      
     },
-    editSubmit () {
-      const vm = this
-      vm.disabled = true
+    editSubmit () {      
+      this.disabled = true
+      this.loading = true
       let id =  this.tenant.layoutMap!=null? this.tenant.layoutMap: ""
-      vm.$refs.fileRef.submitFile(id, this.tenant.id, 'TRAY')
+      this.$refs.fileRef.submitFile(id, this.tenant.id, 'TRAY')
     },
     submitForm () {
       this.$refs.form.validate((valid) => {
-        if (valid) {
+        if (valid) {          
+          this.formData = this.tenant 
+          localStorage.setItem("formData", JSON.stringify(this.formData));         
           this.confirmDisabled = true
           this.editSubmit()
+          // 后续提交处理          
         } else {
           return false
         }
       })
     },
-    save () {
-      areaMgrApi.save(this.tenant)
+    save (formData) {
+      areaMgrApi.save(formData)
         .then((response) => {
           const res = response.data
           if (res.isSuccess) {
@@ -207,8 +226,8 @@ export default {
           return true
         })
     },
-    update () {
-      areaMgrApi.update(this.tenant)
+    update (formData) {
+      areaMgrApi.update(formData)
         .then((response) => {
           const res = response.data
           if (res.isSuccess) {
@@ -218,9 +237,9 @@ export default {
               type: 'success'
             })
             // 通知列表
-	          this.$emit("success");
+	          this.$emit("success")
 	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
+	          this.$emit("close")
           }
         }).finally(() => {
           this.confirmDisabled = false

+ 24 - 39
imcs-ui/src/views/zuihou/runManageCenter/lineRunModel/Index.vue

@@ -1,9 +1,10 @@
 <template>
   <div class="formContaner" style="height:200px;">  		
-	    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="150px">
-	      <el-form-item :label='$t("runCenter.form.setModel")+":"' prop="runMode">
-	      	<el-select style="width:300px;" :placeholder='$t("common.pleaseSelect")' v-model="tenant.runMode"  @change="changeMode" value>
-	          <el-option :key="index" :label="item" :value="key" v-for="(item, key, index) in dicts.RUN_MODE" />
+	    <el-form ref="form" :model="rowData" :rules="rules" label-position="right" label-width="150px">
+		  <el-form-item :label='$t("runCenter.form.areaName")+":"' v-model="rowData.name" >{{rowData.name}}</el-form-item>	
+	      <el-form-item :label='$t("runCenter.form.setModel")+":"' >
+	      	<el-select style="width:300px;" :placeholder='$t("common.pleaseSelect")' v-model="rowData.runMode"  @change="changeMode" >
+	          <el-option :key="value" :label="key" :value="value" v-for="(key, value) in this.dicts.RUN_MODE" />
 	        </el-select>
 	      </el-form-item>
 	    </el-form>
@@ -15,9 +16,7 @@
 </template>
 
 <script>
-	// 【产线管理】-API
-	import productionLineMgrApi from "@/api/runManageCenter/productionLineMgr"
-	
+		
 	// 【区域管理】-API
 	import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
 	import orderMgrApi from "@/api/runManageCenter/orderMgr"
@@ -33,7 +32,7 @@
 	  },
 	  data () {
 	    return {
-	    	dicts: {
+	    dicts: {
           RUN_MODE: {}  //运行模式
         },
 	      confirmDisabled: false,
@@ -48,12 +47,11 @@
 	    }
 	  },
 	  // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
-	  created() {
-	  	// 查询所有当前产线信息
-	  	//this.getCurrentLine()
+	  created() {	  	
 	  	// 加载【字典】
-	  	initDicts(['RUN_MODE'], this.dicts)
-		this.tenant.runMode = this.rowData.runMode
+	  	initDicts(['RUN_MODE'], this.dicts)		
+		//console.log(this.tenant)
+		this.tenant = this.rowData		
         this.checkCount()		
 		},
 	  computed: {
@@ -61,15 +59,15 @@
 	      return this.$store.state.account.user
 	    },
 	    runModelList() {
-        return convertEnum(this.dicts.RUN_MODE)
-      }
+          return convertEnum(this.dicts.RUN_MODE)
+      	}
 	  },
 	  mounted () {	     
 	  },
 	  methods: {
 	  	initTenant () {
 	      return {
-		    id: '',
+		    id: '',			
 	      	runMode: '',
 	      }
 	    },
@@ -79,14 +77,10 @@
 	      this.$refs.form.resetFields()
 	      this.tenant = this.initTenant()
 	    },		
-		changeMode(val) {
+		changeMode(val) {			
 		    this.bool = true 
 			let runMode = this.rowData.runMode
-			if( runMode === val){
-			   this.bool = false
-			   return false
-			}
-			
+
 			if ( runMode === "1" || runMode === "3"){
 			    //弹框确认
 				this.$confirm('确认要切换产线模式吗?', this.$t("common.tips"), {
@@ -126,20 +120,19 @@
 					})
 				})			    			
 			}
-			
-			
-			
+
 			if(this.bool){			
 				this.tenant.runMode = val
 			}
 	
 		},
-	    submitForm () {
+	    submitForm () {		 	
 	      this.$refs.form.validate((valid) => {
 	        if (valid && this.bool) {
 			  // 获取父组件传值ID
 			  this.tenant.id = this.rowData.id
 	          this.confirmDisabled = true
+			  console.log(this.tenant)
 	          //productionLineMgrApi.update(this.tenant).then(res => {
 			  areaMgrApi.update(this.tenant).then(res => {
 	          	res = res.data 
@@ -157,19 +150,11 @@
 	        }
 	      })
 		  this.$emit("close")
-		  location.reload()
-	    },	    
-	    // 查询所有当前产线信息
-	    getCurrentLine(){
-	    	productionLineMgrApi.getCurrent({}).then(res => {
-	    		res = res.data 
-	    		if(res.isSuccess){
-	    			// 给当前赋值
-					console.log(res.data)
-	    			this.tenant = res.data
-	    		}
-	    	})
-	    }
+		  //location.reload()
+	    },
+		checkCount(){
+
+		}
 	  }
 	}
 </script>

+ 74 - 60
imcs-ui/src/views/zuihou/runManageCenter/setCurrentLine/Index.vue

@@ -1,39 +1,63 @@
 <template>
   <div class="formContaner">
   		<div class="formTitle">{{$t("runCenter.searchForm.setCurrent")}}</div>
-			<!-- 表单模块 -->
-	    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="180px">
-	      <el-form-item :label='$t("runCenter.form.setCurrent")+":"' prop="id">
-	          <el-select v-model="tenant.id" :placeholder='$t("common.pleaseSelect")' style="width: 300px;">
-		        	<el-option
-					      v-for="item in lineList"
-					      :key="item.id"
-					      :label="item.name"
-					      :value="item.id">
-					    </el-option>
-		      	</el-select>
-	      </el-form-item>
-	    </el-form>
-	    
-	    <div slot="footer" class="dialog-footer">
-	      <el-button type="primary" icon="el-icon-refresh" :disabled="confirmDisabled" @click="submitForm">{{ $t('runCenter.buttons.change') }}</el-button>
-	    </div>
+			<!-- 表单模块 -->        	    
+			<el-descriptions class="description" :column="2" v-for="item in lineList" :key="item.id" :colon="false">
+			  	<template slot="extra">
+      				<el-button type="primary" icon="el-icon-refresh" size="small" @click="config(item)"  >配置</el-button>
+    		 	</template>
+			 	<el-descriptions-item>
+					   <h1>{{item.name}}</h1>
+				       <span>运行模式:{{ dicts.RUN_MODE[item.runMode] }}</span>
+				</el-descriptions-item>             	
+             	<el-descriptions-item>
+                      <div class="block">    					
+    						<el-image :src="item.imgUrl" fit="cover" lazy>
+      							<div slot="placeholder" class="image-slot">
+        								加载中<span class="dot">...</span>
+      							</div>
+    						</el-image>
+  						</div>
+				 </el-descriptions-item>
+           </el-descriptions>
+
+        <el-dialog
+		  title="产线模式"
+		  :visible.sync="modeVisible"
+		  width="50%"
+		  custom-class="dialogNoTop"
+		>
+			<!--【产线模式】 -->
+		    <lineRunMode :rowData="rowData" @close="modeClose" @success="editModeSuccess" />			
+		</el-dialog>
+
     </div>
 </template>
 
 <script>
 	// 【产线管理】-API
 	import productionLineMgrApi from "@/api/runManageCenter/productionLineMgr"
-	import { initQueryParams } from '@/utils/commons'
+	import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
+	import elDragDialog from '@/directive/el-drag-dialog'
+	import lineRunMode from "../../runManageCenter/lineRunModel/Index"
+	import { initQueryParams, initDicts } from '@/utils/commons'
 	export default {
 	  name: "SetCurrentLine",
-	  components: {},
+	  directives: { elDragDialog },
+	  components: {lineRunMode},
 	  props: {
 	  },
 	  data () {
 	    return {
-	    	lineList: [],
-	    	confirmDisabled: false,
+		  dicts: {
+			RUN_MODE: {}  //运行模式
+		  },
+		  modeVisible: false,
+		  rowData: {}, // row数据
+		  queryParams: initQueryParams({}),
+		  imgUrls:[require("@/assets/yunMap/layout.png"),require("@/assets/yunMap/layout2.png"),require("@/assets/yunMap/layout3.png")],	
+	      lineList: [{name:"智能生产保障系统", runMode:"2",imgUrl:require("@/assets/yunMap/layout.png")},{name:"舱体类加工单元", runMode:"2",imgUrl:require("@/assets/yunMap/layout2.png")},{name:"框体类加工单元", runMode:"1",imgUrl:require("@/assets/yunMap/layout3.png")}],
+	      confirmDisabled: false,
 	      tenant: this.initTenant(),
 	      rules: {
 	        id: [
@@ -44,10 +68,9 @@
 	  },
 	  // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
 	  created() {
+		initDicts(['RUN_MODE'], this.dicts)  
 	  	// 获取【产线】数据下拉
-	    this.getLineList()
-	    // 查询所有当前产线信息
-	  	this.getCurrentLine()
+	    this.fetch()	    
 		},
 	  computed: {
 	    currentUser () {
@@ -67,47 +90,27 @@
 	      this.$refs.form.clearValidate()
 	      this.$refs.form.resetFields()
 	      this.tenant = this.initTenant()
-	    },
-	    // 【切换】按钮-事件
-	    submitForm () {
-	      this.$refs.form.validate((valid) => {
-	        if (valid) {
-	          this.confirmDisabled = true
-	          productionLineMgrApi.setCurrent(this.tenant).then(res => {
-	          	res = res.data 
-	          	if (res.isSuccess) {
-		            this.$message({
-		              message: this.$t('tips.optionSuccess'),
-		              type: 'success'
-		            })
-		            // 恢复按钮
-		            this.confirmDisabled = false
-		          }
-	          })
-	        } else {
-	          return false
-	        }
-	      })
-	    },
+	    },	    
 	    // 获取【产线】数据下拉
-	    getLineList(){
-	    	productionLineMgrApi.getList({}).then(res => {
+	    fetch(){
+	    	//productionLineMgrApi.getList({}).then(res => {
+			 areaMgrApi.page(this.queryParams).then(res => {	
 	    		res = res.data 
 	    		if(res.isSuccess){
-	    			this.lineList = res.data
+	    			this.lineList = res.data.records
 	    		}
 	    	})
-	    },
-	    // 查询所有当前产线信息
-	    getCurrentLine(){
-	    	productionLineMgrApi.getCurrent({}).then(res => {
-	    		res = res.data 
-	    		if(res.isSuccess){
-	    			// 给当前赋值
-	    			this.tenant = res.data
-	    		}
-	    	})
-	    }
+	    },	    
+		modeClose(){
+	  		this.modeVisible = false
+	  	},
+	  	editModeSuccess(){
+	  		this.fetch()
+	  	},
+		config(item){
+		  this.rowData = item		  
+	  	  this.modeVisible = true
+		}  
 	  }
 	}
 </script>
@@ -121,6 +124,17 @@
 		padding-bottom: 20px;
 		border-bottom: 1px solid #CCCCCC;
 	}
+	.description {
+		width:90%;
+		margin: 10px auto;
+		padding:0 3%;		
+	}
+    .el-descriptions >>> .el-descriptions__table{
+		height:180px;
+	}
+	.el-descriptions >>> .el-descriptions-item__label{
+		margin-left:15px;
+	}
 	.formContaner form{
 		max-width: 600px;
 	}