Ver Fonte

硬件数量配置

laoyao há 3 anos atrás
pai
commit
2cc3624e4d

+ 402 - 402
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/components/Hardware.vue

@@ -1,402 +1,402 @@
-<template>
-  <el-dialog 
-  	:close-on-click-modal="false" 
-  	:close-on-press-escape="false" 
-  	:title="title" 
-  	:append-to-body="true"
-  	:visible.sync="isVisible" 
-  	width="700px" 
-  	top="50px"
-  >
-    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
-    	<!-- 机床 -->
-    	<div v-if="tenant.category.key == 'machine'">
-	    	<div class="formTitle">{{ $t("resource.common.jichuang") }}</div>
-	    	<!-- 工作台数量 -->
-	    	<el-form-item :label='$t("resource.form.workbench_num")+":"' prop="workbenchNum">
-	      	<el-input-number v-model="tenant.workbenchNum"></el-input-number>
-	      </el-form-item>
-      </div>
-      
-      <!-- 机械手臂 -->
-	    <div v-if="tenant.category.key == 'arm'">
-	    	<div class="formTitle">{{ $t("resource.common.jxsbi") }}</div>
-	      <!-- 手臂数量 -->
-	      <el-form-item :label='$t("resource.form.hand_num")+":"' prop="handNum">
-	      	<el-input-number v-model="tenant.handNum"></el-input-number>
-	      </el-form-item>
-	      <!-- 缓存库数量 -->
-	      <el-form-item :label='$t("resource.form.cache_storge_num")+":"' prop="cacheStorgeNum">
-	      	<el-input-number v-model="tenant.cacheStorgeNum"></el-input-number>
-	      </el-form-item>
-	      <!-- 最大移动速度 -->
-	      <el-form-item :label='$t("resource.form.max_speed")+":"' prop="maxSpeed">
-	      	<el-input-number v-model="tenant.maxSpeed"></el-input-number>
-	      	<span>{{ $t("resource.common.mimm") }}</span>
-	      </el-form-item>
-	      <!-- 手抓 -->
-      	<el-form-item :label='$t("resource.form.arm")+":"'>
-	        <!-- 功能按钮 -->
-			    <el-row class="filter-container">
-			    	<el-col>
-			    		<el-button type="primary" icon="el-icon-plus" size="medium" @click="addRes">{{ $t("common.add") }}</el-button>
-			    	</el-col>
-			    </el-row>
-			    <!-- Table数据 -->
-					<el-table
-			      ref="table"
-			      v-loading="loading"
-			      :data="tableData"
-			      border
-			      fit
-			      style="width: 100%;"
-			      @selection-change="onSelectChange"
-			    >
-			      <el-table-column prop="positionSort" :label='$t("common.serialNo")' align="center" width="50px">
-			      	<template slot-scope="{ row }">
-			      		<span>{{row.positionSort}}</span>
-			      	</template>
-			      </el-table-column>
-			      <el-table-column prop="name" :label='$t("resource.form.armName")' align="center">
-			      	<template slot-scope="{ row }">
-			      		<el-input size="small" v-model="row.name" v-if="row.isEdit" :placeholder='$t("common.pleaseEnter")'></el-input>
-			      		<span v-else="">{{row.name}}</span>
-			      	</template>
-			      </el-table-column>
-			      <el-table-column prop="zoneType" :label='$t("resource.form.rouJiagong")' width="160px">
-			      	<template slot-scope="{ row }">
-			      		<el-select v-if="row.isEdit" v-model="row.zoneType" :placeholder='$t("common.pleaseSelect")' size="small">
-				        	<el-option label="产线类型" value="1"></el-option>
-				        	<el-option label="智能加个产线" value="2"></el-option>
-				      	</el-select>
-			      		<span v-else="">{{row.zoneType}}</span>
-			      	</template>
-			      </el-table-column>
-			      <el-table-column
-			        :label="$t('table.operation')"
-			        fixed="right"
-			        align="center"
-			        column-key="operation"
-			        width="80px"
-			      >
-			        <template slot-scope="{ row }">
-			        	<el-tooltip v-if="type != 'add'" class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
-				          <i
-				            class="el-icon-edit table-operation"
-				            style="color: #2db7f5;"
-				            @click="edit(row)"
-				          />
-				        </el-tooltip>
-			          <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
-				          <i
-				            class="el-icon-delete table-operation"
-				            style="color: #f50;"
-				            @click="singleDelete(row)"
-				          />
-			          </el-tooltip>
-			        </template>
-			      </el-table-column>
-			    </el-table>
-	      </el-form-item>
-	    </div>
-      <!-- AGV -->
-      <div v-if="tenant.category.key == 'agv'">
-	    	<div class="formTitle">{{ $t("resource.common.agv") }}</div>
-	      <!-- 产线控制状态 -->
-	      <!-- 可放子盘数量 -->
-	      <el-form-item :label='$t("resource.form.tray_num")+":"' prop="trayNum">
-	      	<el-input-number v-model="tenant.trayNum"></el-input-number>
-	      </el-form-item>
-	    </div>
-	    
-	    <!-- 托板(tuoban) -->
-      <div v-if="tenant.category.key == 'tuoban'">
-	    	<div class="formTitle">{{ $t("resource.common.tuoban") }}</div>
-	      <!-- 关联托板分类 -->
-	      <el-form-item :label='$t("resource.form.tuoban")+":"' prop="plateId">
-	      	<el-select v-model="tenant.plateId" :placeholder='$t("common.pleaseSelect")' size="small">
-	        	<el-option v-for="item in tuobanList" :key="item.id" :label="item.name" :value="item.id"></el-option>
-	      	</el-select>
-	      </el-form-item>
-	    </div>
-    </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>
-    </div>
-  </el-dialog>
-</template>
-<script>
-// 【区域管理】-API
-import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
-// 【生产资源配置】-API
-import equipmentConfigApi from "@/api/resourceProductMgr/equipmentConfig"
-
-export default {
-  name: 'TenantEdit',
-  props: {
-    dialogVisible: {
-      type: Boolean,
-      default: false
-    },
-    title: {
-      type: String,
-      default: ''
-    }
-  },
-  data () {
-    return {
-      type: 'add',
-      loading: false,
-      tableData: [],
-      tenant: this.initTenant(),
-      screenWidth: 0,
-      width: this.initWidth(),
-      confirmDisabled: false,
-      roles: [],
-      tuobanList: [],  // 托板类型下拉数据
-      rules: {
-        workbenchNum: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        handNum: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        cacheStorgeNum: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        maxSpeed: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        trayNum: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ]
-      }
-    }
-  },
-  computed: {
-    isVisible: {
-      get () {
-        return this.dialogVisible
-      },
-      set () {
-        this.close()
-        this.reset()
-      }
-    }
-  },
-  mounted () {
-    window.onresize = () => {
-      return (() => {
-        this.width = this.initWidth()
-      })()
-    }
-  },
-  methods: {
-    initTenant () {
-      return {
-        id: '',
-        category: {
-        	data: '',
-        	key: ''
-        }
-        /*handNum: null,
-        workbenchNum: null,
-        cacheStorgeNum: null,
-        maxSpeed: null,
-        trayNum: null*/
-      }
-    },
-    initWidth () {
-      this.screenWidth = document.body.clientWidth
-      if (this.screenWidth < 991) {
-        return '90%'
-      } else if (this.screenWidth < 1400) {
-        return '45%'
-      } else {
-        return '800px'
-      }
-    },
-    
-    // 【新增】按钮-事件
-    addRes(){
-      this.tableData.push({
-      	key: "WKS_"+ Math.random(),
-      	id: '',
-      	positionSort: this.tableData.length + 1,
-      	name: '',
-      	zoneType: '',
-      	isEdit: true
-      })
-    },
-    
-    // Table的选择事件
-    onSelectChange (selection) {
-      this.selection = selection
-    },
-    
-    // 【修改】按钮事件
-    edit(row){
-    	let list = new Array();
-    	this.tableData.forEach((item, index) => {
-    		// 当前编辑行
-    		if(!!item.id && item.id == row.id){
-    			item.isEdit = true
-    		}
-    		list.push(item)
-    	})
-    	// 赋值给当前
-    	this.tableData = list
-    },
-    
-    // 【删除】按钮事件
-    singleDelete(row){
-    	this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
-      	distinguishCancelAndClose: true,
-        confirmButtonText: this.$t("common.confirm"),
-        cancelButtonText: this.$t("common.cancel"),
-        type: "warning"
-      }).then(() => {
-      	// 过滤符合条件的数据
-      	let arr = this.tableData.filter(item => item.key != row.key || item.id != row.id)
-      	// 给数据排序
-    		arr.forEach((item, index) => {
-    			item.positionSort = index + 1
-    		})
-      	// 给新的数据赋值
-    		this.tableData = arr;
-
-      }).catch(() => {})
-    },
-    
-    setTenant (val) {
-    	if(val){
-    		console.log("2222 == ", val);
-    		this.tenant = { ...val };
-    		// 托板下拉数据
-    		this.getTuobanList();
-    	}
-    },
-    
-    // 托板下拉数据
-    getTuobanList() {
-    	equipmentConfigApi.tuobanList().then((response) => {
-	    	const res = response.data
-	    	// console.log("托板下拉数据: ",  res);
-	      if (res.code == 0) {
-	        this.tuobanList = res.data;
-	      }
-	    })
-    },
-    
-    close () {
-      this.$emit('close')
-    },
-    reset () {
-      // 先清除校验,再清除表单,不然有奇怪的bug
-      this.$refs.form.clearValidate()
-      this.$refs.form.resetFields()
-      this.tenant = this.initTenant()
-    },
-    submitForm () {
-      this.$refs.form.validate((valid) => {
-        if (valid) {
-          this.confirmDisabled = true
-          if (this.type === 'add') {
-            this.save()
-          } else {
-            this.update()
-          }
-        } else {
-          return false
-        }
-      })
-    },
-    save () {
-    	// 添加数据
-    	this.tenant.list = this.tableData;
-      equipmentConfigApi.save(this.tenant)
-        .then((response) => {
-          const res = response.data
-          if (res.isSuccess) {
-            this.isVisible = false
-            this.$message({
-              message: this.$t('tips.createSuccess'),
-              type: 'success'
-            })
-            // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
-          }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
-        })
-    },
-    update () {
-    	// 添加数据
-    	this.tenant.list = this.tableData;
-      equipmentConfigApi.updateResource(this.tenant)
-        .then((response) => {
-          const res = response.data
-          if (res.isSuccess) {
-            this.isVisible = false
-            this.$message({
-              message: this.$t('tips.updateSuccess'),
-              type: 'success'
-            })
-            // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
-          }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
-        })
-    }
-
-  }
-}
-</script>
-<style lang="scss" >
-.avatar-uploader .el-upload {
-  border: 1px dashed #d9d9d9;
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-}
-.avatar-uploader .el-upload:hover {
-  border-color: #409eff;
-}
-.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 100px;
-  height: 100px;
-  line-height: 100px;
-  text-align: center;
-}
-.avatar {
-  width: 100px;
-  height: 100px;
-  display: block;
-}
-.checkUsed{
-	display: inline-block;
-	margin-left: 10px;
-	color: #1890ff;
-}
-</style>
-
-<style type="text/css" lang="scss" scoped>
-	.formTitle {
-		margin: 0 0 10px 20px;
-		
-		font-size: 16px;
-		font-weight: bold;
-		color: #1890FF;
-	}
-</style>
+<template>
+  <el-dialog
+  	:close-on-click-modal="false"
+  	:close-on-press-escape="false"
+  	:title="title"
+  	:append-to-body="true"
+  	:visible.sync="isVisible"
+  	width="700px"
+  	top="50px"
+  >
+    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
+    	<!-- 机床 -->
+    	<div v-if="tenant.category.key == 'machine'">
+	    	<div class="formTitle">{{ $t("resource.common.jichuang") }}</div>
+	    	<!-- 工作台数量 -->
+	    	<el-form-item :label='$t("resource.form.workbench_num")+":"' prop="workbenchNum">
+	      	<el-input-number v-model="tenant.workbenchNum" :min="0"></el-input-number>
+	      </el-form-item>
+      </div>
+
+      <!-- 机械手臂 -->
+	    <div v-if="tenant.category.key == 'arm'">
+	    	<div class="formTitle">{{ $t("resource.common.jxsbi") }}</div>
+	      <!-- 手臂数量 -->
+	      <el-form-item :label='$t("resource.form.hand_num")+":"' prop="handNum">
+	      	<el-input-number v-model="tenant.handNum" :min="0"></el-input-number>
+	      </el-form-item>
+	      <!-- 缓存库数量 -->
+	      <el-form-item :label='$t("resource.form.cache_storge_num")+":"' prop="cacheStorgeNum">
+	      	<el-input-number v-model="tenant.cacheStorgeNum" :min="0"></el-input-number>
+	      </el-form-item>
+	      <!-- 最大移动速度 -->
+	      <el-form-item :label='$t("resource.form.max_speed")+":"' prop="maxSpeed">
+	      	<el-input-number v-model="tenant.maxSpeed" :min="0"></el-input-number>
+	      	<span>{{ $t("resource.common.mimm") }}</span>
+	      </el-form-item>
+	      <!-- 手抓 -->
+      	<el-form-item :label='$t("resource.form.arm")+":"'>
+	        <!-- 功能按钮 -->
+			    <el-row class="filter-container">
+			    	<el-col>
+			    		<el-button type="primary" icon="el-icon-plus" size="medium" @click="addRes">{{ $t("common.add") }}</el-button>
+			    	</el-col>
+			    </el-row>
+			    <!-- Table数据 -->
+					<el-table
+			      ref="table"
+			      v-loading="loading"
+			      :data="tableData"
+			      border
+			      fit
+			      style="width: 100%;"
+			      @selection-change="onSelectChange"
+			    >
+			      <el-table-column prop="positionSort" :label='$t("common.serialNo")' align="center" width="50px">
+			      	<template slot-scope="{ row }">
+			      		<span>{{row.positionSort}}</span>
+			      	</template>
+			      </el-table-column>
+			      <el-table-column prop="name" :label='$t("resource.form.armName")' align="center">
+			      	<template slot-scope="{ row }">
+			      		<el-input size="small" v-model="row.name" v-if="row.isEdit" :placeholder='$t("common.pleaseEnter")'></el-input>
+			      		<span v-else="">{{row.name}}</span>
+			      	</template>
+			      </el-table-column>
+			      <el-table-column prop="zoneType" :label='$t("resource.form.rouJiagong")' width="160px">
+			      	<template slot-scope="{ row }">
+			      		<el-select v-if="row.isEdit" v-model="row.zoneType" :placeholder='$t("common.pleaseSelect")' size="small">
+				        	<el-option label="产线类型" value="1"></el-option>
+				        	<el-option label="智能加个产线" value="2"></el-option>
+				      	</el-select>
+			      		<span v-else="">{{row.zoneType}}</span>
+			      	</template>
+			      </el-table-column>
+			      <el-table-column
+			        :label="$t('table.operation')"
+			        fixed="right"
+			        align="center"
+			        column-key="operation"
+			        width="80px"
+			      >
+			        <template slot-scope="{ row }">
+			        	<el-tooltip v-if="type != 'add'" class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
+				          <i
+				            class="el-icon-edit table-operation"
+				            style="color: #2db7f5;"
+				            @click="edit(row)"
+				          />
+				        </el-tooltip>
+			          <el-tooltip class="item" :content='$t("common.delete")' effect="dark" placement="top-start">
+				          <i
+				            class="el-icon-delete table-operation"
+				            style="color: #f50;"
+				            @click="singleDelete(row)"
+				          />
+			          </el-tooltip>
+			        </template>
+			      </el-table-column>
+			    </el-table>
+	      </el-form-item>
+	    </div>
+      <!-- AGV -->
+      <div v-if="tenant.category.key == 'agv'">
+	    	<div class="formTitle">{{ $t("resource.common.agv") }}</div>
+	      <!-- 产线控制状态 -->
+	      <!-- 可放子盘数量 -->
+	      <el-form-item :label='$t("resource.form.tray_num")+":"' prop="trayNum">
+	      	<el-input-number v-model="tenant.trayNum" :min="0"></el-input-number>
+	      </el-form-item>
+	    </div>
+
+	    <!-- 托板(tuoban) -->
+      <div v-if="tenant.category.key == 'tuoban'">
+	    	<div class="formTitle">{{ $t("resource.common.tuoban") }}</div>
+	      <!-- 关联托板分类 -->
+	      <el-form-item :label='$t("resource.form.tuoban")+":"' prop="plateId">
+	      	<el-select v-model="tenant.plateId" :placeholder='$t("common.pleaseSelect")' size="small">
+	        	<el-option v-for="item in tuobanList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+	      	</el-select>
+	      </el-form-item>
+	    </div>
+    </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>
+    </div>
+  </el-dialog>
+</template>
+<script>
+// 【区域管理】-API
+import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
+// 【生产资源配置】-API
+import equipmentConfigApi from "@/api/resourceProductMgr/equipmentConfig"
+
+export default {
+  name: 'TenantEdit',
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      type: 'add',
+      loading: false,
+      tableData: [],
+      tenant: this.initTenant(),
+      screenWidth: 0,
+      width: this.initWidth(),
+      confirmDisabled: false,
+      roles: [],
+      tuobanList: [],  // 托板类型下拉数据
+      rules: {
+        workbenchNum: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        handNum: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        cacheStorgeNum: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        maxSpeed: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        trayNum: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ]
+      }
+    }
+  },
+  computed: {
+    isVisible: {
+      get () {
+        return this.dialogVisible
+      },
+      set () {
+        this.close()
+        this.reset()
+      }
+    }
+  },
+  mounted () {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth()
+      })()
+    }
+  },
+  methods: {
+    initTenant () {
+      return {
+        id: '',
+        category: {
+        	data: '',
+        	key: ''
+        }
+        /*handNum: null,
+        workbenchNum: null,
+        cacheStorgeNum: null,
+        maxSpeed: null,
+        trayNum: null*/
+      }
+    },
+    initWidth () {
+      this.screenWidth = document.body.clientWidth
+      if (this.screenWidth < 991) {
+        return '90%'
+      } else if (this.screenWidth < 1400) {
+        return '45%'
+      } else {
+        return '800px'
+      }
+    },
+
+    // 【新增】按钮-事件
+    addRes(){
+      this.tableData.push({
+      	key: "WKS_"+ Math.random(),
+      	id: '',
+      	positionSort: this.tableData.length + 1,
+      	name: '',
+      	zoneType: '',
+      	isEdit: true
+      })
+    },
+
+    // Table的选择事件
+    onSelectChange (selection) {
+      this.selection = selection
+    },
+
+    // 【修改】按钮事件
+    edit(row){
+    	let list = new Array();
+    	this.tableData.forEach((item, index) => {
+    		// 当前编辑行
+    		if(!!item.id && item.id == row.id){
+    			item.isEdit = true
+    		}
+    		list.push(item)
+    	})
+    	// 赋值给当前
+    	this.tableData = list
+    },
+
+    // 【删除】按钮事件
+    singleDelete(row){
+    	this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
+      	distinguishCancelAndClose: true,
+        confirmButtonText: this.$t("common.confirm"),
+        cancelButtonText: this.$t("common.cancel"),
+        type: "warning"
+      }).then(() => {
+      	// 过滤符合条件的数据
+      	let arr = this.tableData.filter(item => item.key != row.key || item.id != row.id)
+      	// 给数据排序
+    		arr.forEach((item, index) => {
+    			item.positionSort = index + 1
+    		})
+      	// 给新的数据赋值
+    		this.tableData = arr;
+
+      }).catch(() => {})
+    },
+
+    setTenant (val) {
+    	if(val){
+    		console.log("2222 == ", val);
+    		this.tenant = { ...val };
+    		// 托板下拉数据
+    		this.getTuobanList();
+    	}
+    },
+
+    // 托板下拉数据
+    getTuobanList() {
+    	equipmentConfigApi.tuobanList().then((response) => {
+	    	const res = response.data
+	    	// console.log("托板下拉数据: ",  res);
+	      if (res.code == 0) {
+	        this.tuobanList = res.data;
+	      }
+	    })
+    },
+
+    close () {
+      this.$emit('close')
+    },
+    reset () {
+      // 先清除校验,再清除表单,不然有奇怪的bug
+      this.$refs.form.clearValidate()
+      this.$refs.form.resetFields()
+      this.tenant = this.initTenant()
+    },
+    submitForm () {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.confirmDisabled = true
+          if (this.type === 'add') {
+            this.save()
+          } else {
+            this.update()
+          }
+        } else {
+          return false
+        }
+      })
+    },
+    save () {
+    	// 添加数据
+    	this.tenant.list = this.tableData;
+      equipmentConfigApi.save(this.tenant)
+        .then((response) => {
+          const res = response.data
+          if (res.isSuccess) {
+            this.isVisible = false
+            this.$message({
+              message: this.$t('tips.createSuccess'),
+              type: 'success'
+            })
+            // 通知列表
+	          this.$emit("success");
+	          // 通知列表-并关闭弹出框
+	          this.$emit("close");
+          }
+        }).finally(() => {
+          this.confirmDisabled = false
+          return true
+        })
+    },
+    update () {
+    	// 添加数据
+    	this.tenant.list = this.tableData;
+      equipmentConfigApi.updateResource(this.tenant)
+        .then((response) => {
+          const res = response.data
+          if (res.isSuccess) {
+            this.isVisible = false
+            this.$message({
+              message: this.$t('tips.updateSuccess'),
+              type: 'success'
+            })
+            // 通知列表
+	          this.$emit("success");
+	          // 通知列表-并关闭弹出框
+	          this.$emit("close");
+          }
+        }).finally(() => {
+          this.confirmDisabled = false
+          return true
+        })
+    }
+
+  }
+}
+</script>
+<style lang="scss" >
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409eff;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 100px;
+  height: 100px;
+  line-height: 100px;
+  text-align: center;
+}
+.avatar {
+  width: 100px;
+  height: 100px;
+  display: block;
+}
+.checkUsed{
+	display: inline-block;
+	margin-left: 10px;
+	color: #1890ff;
+}
+</style>
+
+<style type="text/css" lang="scss" scoped>
+	.formTitle {
+		margin: 0 0 10px 20px;
+
+		font-size: 16px;
+		font-weight: bold;
+		color: #1890FF;
+	}
+</style>

+ 690 - 689
imcs-ui/src/views/zuihou/runManageCenter/orderMgr/components/draftOrder/components/Edit.vue

@@ -1,689 +1,690 @@
-<template>
-  <el-dialog
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    :title="title"
-    :append-to-body="true"
-    :visible.sync="isVisible"
-    width="950px"
-    top="50px"
-  >
-    <el-form
-      ref="form"
-      :disabled="formDisabled"
-      :model="tenant"
-      :rules="rules"
-      label-position="right"
-      label-width="100px"
-    >
-    	<!--订单名称-->
-      <el-form-item :label="$t(&quot;runCenter.form.orderName&quot;)+&quot;:&quot;" prop="orderName">
-        <el-input v-model="tenant.orderName" :placeholder='$t("common.pleaseEnter")' style="width: 50%;"/>
-      </el-form-item>
-      <!-- 所属产线 -->
-      <el-form-item
-        :label="$t(&quot;runCenter.form.zoneId&quot;)+&quot;:&quot;"
-        prop="zoneId"
-      >
-        <el-select
-          v-model="tenant.zoneId"
-          :placeholder="$t(&quot;common.pleaseSelect&quot;)"
-          style="width: 50%;"
-        >
-          <el-option
-            v-for="item in zoneList"
-            :key="item.id"
-            :label="item.name"
-            :value="item.id"
-          />
-        </el-select>
-      </el-form-item>
-      <!-- 交付时间 -->
-      <el-form-item
-        :label="$t(&quot;runCenter.form.deliveryTime&quot;)+&quot;:&quot;"
-        prop="deliveryTime"
-      >
-        <el-date-picker
-          v-model="tenant.deliveryTime"
-          type="date"
-          value-format="yyyy-MM-dd"
-          :placeholder="$t(&quot;common.pleaseSelect&quot;)"
-          :picker-options="pickerOptions"
-          style="width: 50%;"
-        />
-      </el-form-item>
-      <!-- 下单时间 -->
-      <el-form-item
-        :label="$t(&quot;runCenter.form.orderTime&quot;)+&quot;:&quot;"
-        prop="orderTime"
-      >
-        <el-date-picker
-          v-model="tenant.orderTime"
-          type="date"
-          value-format="yyyy-MM-dd"
-          :placeholder="$t(&quot;common.pleaseSelect&quot;)"
-          :picker-options="pickerOptions"
-          style="width: 50%;"
-        />
-      </el-form-item>
-      <!-- 启用状态 -->
-      <el-form-item
-        :label="$t(&quot;runCenter.form.status&quot;)+&quot;:&quot;"
-        prop="status"
-      >
-        <template>
-          <el-radio
-            v-model="tenant.status"
-            label="1"
-          >
-            {{ $t("common.show") }}
-          </el-radio>
-          <el-radio
-            v-model="tenant.status"
-            label="0"
-          >
-            {{ $t("common.hide") }}
-          </el-radio>
-        </template>
-      </el-form-item>
-      <!-- 零件 -->
-      <el-form-item
-        :label="$t(&quot;runCenter.form.lingjian&quot;)+&quot;:&quot;"
-        prop="product"
-      >
-        <el-button
-          type="primary"
-          :disabled="type == 'view' ? true : false"
-          icon="el-icon-plus"
-          size="small"
-          circle
-          @click="add"
-        />
-      </el-form-item>
-
-      <!-- Table数据 -->
-      <el-table
-        ref="table"
-        :data="tableData"
-        border
-        fit
-        style="width: 100%;"
-      >
-      	<!-- 零部件编号 -->
-        <el-table-column
-          prop="partsNo"
-          :label="$t(&quot;runCenter.table.orderSldPro.partsNo&quot;)"
-          align="center"
-          :show-overflow-tooltip="true"
-          width="120px"
-        >
-          <template slot-scope="{ row }">
-            <span>{{ row.partsNo }}</span>
-          </template>
-        </el-table-column>
-        <!-- 产品代号 -->
-        <el-table-column
-          prop="bomAlias"
-          :label="$t(&quot;runCenter.table.orderSldPro.bomAlias&quot;)"
-          align="center"
-          :show-overflow-tooltip="true"
-          width="100px"
-        />
-        <!-- 零件名称 -->
-        <el-table-column
-          prop="bomName"
-          :label="$t(&quot;runCenter.table.orderSldPro.name&quot;)"
-          align="center"
-          width="100px" 
-        >
-	        <template slot-scope="{ row }">
-			      {{ row.name || row.bomName }}
-					</template>
-        </el-table-column>
-	        
-        <!-- 零件代号 -->
-        <el-table-column
-          prop="partsAlias"
-          :label="$t(&quot;runCenter.table.orderSldPro.partsAlias&quot;)"
-          align="center"
-          width="100px"
-        />
-        <!-- 零件批号 -->
-        <!--<el-table-column
-          prop="brand"
-          :label="$t(&quot;runCenter.table.orderSldPro.brand&quot;)"
-          align="center"
-          width="100px"
-        />-->
-        <!-- 原料炉批号 -->
-        <el-table-column
-          prop="furnaceBatchNo"
-          label="原料炉批号"
-          align="center"
-          width="150px"
-        >
-        	<template slot-scope="{ row }">
-			      <div style="color: #42d885;cursor: pointer;" @click="changeMetral(row)">
-			      	<span v-if="row.furnaceBatchNo">{{ row.furnaceBatchNo }}</span>
-			      	<a v-else>请选择</a>
-			      </div>
-					</template>
-        </el-table-column>
-        
-        <!-- 数量 -->
-        <el-table-column
-          prop="bomNum"
-          :label="$t(&quot;runCenter.table.orderSldPro.bomNum&quot;)"
-          width="150px"
-          align="center"
-        >
-          <template slot-scope="{ row }">
-            <el-input-number
-              v-model="row.bomNum"
-              :min="1"
-              :max="999999999"
-              :label="$t(&quot;common.pleaseEnter&quot;)"
-              size="small"
-            />
-          </template>
-        </el-table-column>
-        <el-table-column
-          prop="deliveryTime"
-          :label="$t(&quot;runCenter.table.orderSldPro.deliveryTime&quot;)"
-          width="220px"
-          align="center"
-        >
-          <template slot-scope="{ row }">
-            <el-date-picker
-              v-model="row.deliveryTime"
-              type="date"
-              value-format="yyyy-MM-dd"
-              size="small"
-              :placeholder="$t(&quot;common.pleaseSelect&quot;)"
-              :picker-options="pickerOptions"
-              style="width: 100%;"
-            />
-          </template>
-        </el-table-column>
-        <el-table-column
-          prop="remark"
-          :label="$t(&quot;common.remark&quot;)"
-          :show-overflow-tooltip="true"
-          width="180px"
-          align="center"
-        >
-          <template slot-scope="{ row }">
-            <el-input
-              v-model="row.remark"
-              size="small"
-              :label="$t(&quot;common.pleaseEnter&quot;)"
-            />
-          </template>
-        </el-table-column>
-        <el-table-column
-          v-if="type != 'view'"
-          :label="$t('table.operation')"
-          fixed="right"
-          align="center"
-          column-key="operation"
-          width="60px"
-        >
-          <template slot-scope="{ row }">
-            <!--<el-tooltip class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
-			          <i
-			            class="el-icon-edit table-operation"
-			            style="color: #2db7f5;"
-			            @click="edit(row)"
-			          />
-			        </el-tooltip>-->
-            <el-tooltip
-              class="item"
-              :content="$t(&quot;common.delete&quot;)"
-              effect="dark"
-              placement="top-start"
-            >
-              <i
-                class="el-icon-delete table-operation"
-                style="color: #f50;"
-                @click="domDelete(row)"
-              />
-            </el-tooltip>
-          </template>
-        </el-table-column>
-      </el-table>
-    </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>
-    </div>
-
-    <!-- 选择数据的组件 -->
-    <select-table
-      ref="edit"
-      :dialog-visible="dialog.isVisible"
-      :title="dialog.title"
-      @close="editClose"
-      @success="editSuccess"
-    />
-    
-    <!-- 选择数据的组件 -->
-    <meterial-select
-      ref="meterial"
-      :dialog-visible="dialogMeterial.isVisible"
-      :title="dialogMeterial.title"
-      @close="editMeterialClose"
-      @success="editMeterialSuccess"
-    />
-    
-  </el-dialog>
-</template>
-<script>
-	// 日期格式化组件
-	import moment from 'moment'
-	// 选择【新增】组件
-	import SelectTable from "./Select"
-	// 选择【原料炉批号】组件
-	import MeterialSelect from "./MeterialSelect"
-	// 【客户管理】-API
-	import customerMgrApi from "@/api/basicConfiguration/customerMgr"  
-  //【所属产线】-API
-  import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
-	// 【订单管理】-API
-	import orderMgrApi from "@/api/runManageCenter/orderMgr"
-	// 【订单明细】-API
-	import orderDetailApi from "@/api/runManageCenter/orderDetail"
-	import { arrReduce } from '@/utils/commons'
-export default {
-  name: 'TenantEdit',
-  components: { SelectTable, MeterialSelect },
-  props: {
-    dialogVisible: {
-      type: Boolean,
-      default: false
-    },
-    title: {
-      type: String,
-      default: ''
-    }
-  },
-  data () {
-    return {
-      type: 'add',
-      tenant: this.initTenant(),
-      screenWidth: 0,
-      width: this.initWidth(),
-      confirmDisabled: false,
-      dialog: {
-        isVisible: false,
-        title: ""
-      },
-      dialogMeterial: {
-        isVisible: false,
-        title: ""
-      }, 
-      customList: [],
-      currRow: {}, // 当前选择的Row
-      zoneList: [],
-      tableData: [],
-      dicts:{
-        NATION: {}
-      },
-      roles: [],
-      pickerOptions: {
-        disabledDate: (time) => {
-          return time.getTime() < Date.now() - 86400000;
-        },
-      },
-      rules: {
-        custId: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
-        ],
-        deliveryTime: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        orderTime: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ],
-        status: [
-        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
-        ]
-      }
-    }
-  },
-  computed: {
-  	formDisabled(){
-  		if(this.type == "view"){
-  			this.confirmDisabled = true
-  			return true
-  		}else{
-  			this.confirmDisabled = false
-  			return false
-  		}
-  	},
-    isVisible: {
-      get () {
-      	// 清空数据
-      	this.tableData = [];
-        return this.dialogVisible
-      },
-      set () {
-        this.close()
-        this.reset()
-      }
-    }
-  },
-  // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
-  created() {
-  	// 加载客户列表数据
-  	this.customerList() 
-    this.getZoneList()   
-	},
-  mounted () {
-    window.onresize = () => {
-      return (() => {
-        this.width = this.initWidth()
-      })()
-    }
-  },
-  methods: {
-  	// 【原料炉批号】点击-事件
-  	changeMetral(row) {
-  		// 当前选择的行。row
-  		this.currRow = row;
-  		this.$refs.meterial.type = "edit";
-  		this.$refs.meterial.setTenant(row);
-      this.dialogMeterial.title = "选择原料炉批号";
-      this.dialogMeterial.isVisible = true;
-  	},
-  	
-  	// 【原料炉批号-修改】弹出框,关闭
-  	editMeterialClose () {
-      this.dialogMeterial.isVisible = false
-    },
-    
-    // 【原料炉批号-修改】弹出框,确定事件
-    editMeterialSuccess (obj) {
-    	console.log("【原料炉批号-修改】: ", obj);
-    	let arr = [];
-    	this.tableData.map(item => {
-    		if(item.id == this.currRow.id) {
-    			// 赋值,原料炉批号
-    			item.furnaceBatchNo = obj.furnaceBatchNo;
-    			// 带入参数
-    			item.meterialReceiveId = obj.id;
-    		}
-    		arr.push(item);
-    	})
-    	// 赋值
-    	this.tableData = arr;
-    },
-  	
-  	// 【删除】按钮-事件
-  	domDelete(row){
-  		this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
-      	distinguishCancelAndClose: true,
-        confirmButtonText: this.$t("common.confirm"),
-        cancelButtonText: this.$t("common.cancel"),
-        type: "warning"
-      }).then(() => {
-      	// 过滤我们需要的数据
-	  		let list = this.tableData.filter(item => item.id != row.id)
-	  		// 重新赋值
-	  		this.tableData = list
-      }).catch(() => {})
-
-  	},
-  	
-  	// 【新增-修改】弹出框,关闭
-  	editClose () {
-      this.dialog.isVisible = false
-    },
-    
-    // 【新增-修改】弹出框,确定事件
-    editSuccess (arr) {
-    	// 清除备注
-    	arr.forEach(item => {
-    		item.remark = "";
-    	});
-    	// 合并当前数组,和新增的数组
-    	let list = [...this.tableData, ...arr];
-    	// 去除数组中重复的数据
-    	this.tableData = arrReduce(list, "id");
-    },
-    
-    add () {
-      this.$refs.edit.type = "add"
-      this.dialog.title = this.$t("runCenter.common.selectPro")
-      this.dialog.isVisible = true
-    },
-    
-    initTenant () {
-      return {
-        orderTime: moment(new Date()).format('YYYY-MM-DD'),
-        status: '1',
-        zoneId: '',
-      }
-    },
-    
-    initWidth () {
-      this.screenWidth = document.body.clientWidth
-      if (this.screenWidth < 991) {
-        return '90%'
-      } else if (this.screenWidth < 1400) {
-        return '45%'
-      } else {
-        return '800px'
-      }
-    },
-    
-    setTenant (val, dicts) {
-    	if(val){
-    		this.tenant = { ...val }        
-    		// 修改的时候,订单详情数据(BOM产品)
-    		this.getBomList()
-    	}
-      // 字典表
-      this.dicts = dicts
-    },
-    
-    close () {
-      this.$emit('close')
-    },
-    
-    reset () {
-      // 先清除校验,再清除表单,不然有奇怪的bug
-      this.$refs.form.clearValidate()
-      this.$refs.form.resetFields()
-      this.tenant = this.initTenant()
-      // 关闭时候,清空数据
-      this.tableData = []
-    },
-    
-    submitForm () {
-      this.$refs.form.validate((valid) => {
-        if (valid) {
-          this.confirmDisabled = true
-          // 验证【数量】不能不填写
-          let flag = false, flagBatchNo = false;
-          this.tableData.map(item => {
-          	if(!item.bomNum){
-          		flag = true
-          	}
-            if(!item.deliveryTime){
-              flag = true
-            }
-            // 验证【原料炉批号】
-            if(!item.furnaceBatchNo){
-              flagBatchNo = true
-            }
-          })
-          if(flag){
-          	this.$message({
-	              message: this.$t('runCenter.tips.prodNums'),
-	              type: 'warning'
-	            })
-          	this.confirmDisabled = false
-          	return false
-          }
-          if(flagBatchNo){
-          	this.$message({
-	              message: this.$t('请选择【原料炉批号】~'),
-	              type: 'warning'
-	            })
-          	this.confirmDisabled = false
-          	return false
-          }
-          // 添加数据
-          this.tenant.orderProductList = []
-          this.tableData.map(item => {
-          	// 添加数据
-          	this.tenant.orderProductList.push({
-          		bomId: item.bomId,
-          		bomNum: item.bomNum,
-          		meterialReceiveId: item.meterialReceiveId,
-          		furnaceBatchNo: item.furnaceBatchNo,
-          		deliveryTime: item.deliveryTime,
-          		remark: item.remark
-          	})
-          })
-
-          // 验证订单是否是否有待生产产品
-          if(this.tenant.orderProductList.length == 0){
-            this.$message({
-              message: this.$t('runCenter.tips.prods'),
-              type: 'warning'
-            })
-            this.confirmDisabled = false
-            return false
-          }
-
-          if (this.type === 'add') {
-            this.save()
-          } else {
-            this.update()
-          }
-        } else {
-          return false
-        }
-      })
-    },
-    
-    save () {
-      orderMgrApi.save(this.tenant)
-        .then((response) => {
-          const res = response.data
-          if (res.isSuccess) {
-            this.isVisible = false
-            this.$message({
-              message: this.$t('tips.createSuccess'),
-              type: 'success'
-            })
-            // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
-          }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
-        })
-    },
-    
-    update () {
-      orderMgrApi.update(this.tenant)
-        .then((response) => {
-          const res = response.data
-          if (res.isSuccess) {
-            this.isVisible = false
-            this.$message({
-              message: this.$t('tips.updateSuccess'),
-              type: 'success'
-            })
-            // 通知列表
-	          this.$emit("success");
-	          // 通知列表-并关闭弹出框
-	          this.$emit("close");
-          }
-        }).finally(() => {
-          this.confirmDisabled = false
-          return true
-        })
-    },
-    
-    // 客户下拉数据
-    customerList(){
-    	customerMgrApi.getList({}).then(res => {
-    		res = res.data
-    		if(res.isSuccess){
-    			// console.log("88888== ",res)
-    			this.customList = res.data.data
-    		}
-    	})
-    },
-    //获取产线数据
-    getZoneList(){
-        areaMgrApi.getList({status:1}).then(res => {
-    		res = res.data
-    		if(res.isSuccess){
-    			this.zoneList = res.data
-    		}
-    	})
-    },
-    // [BOM产品]数据-修改的时候
-    getBomList(){
-    	orderDetailApi.getList({orderId: this.tenant.id}).then(res => {
-    		res = res.data
-    		if(res.isSuccess){
-    			this.tableData = res.data
-    		}
-    	})
-    }
-  }
-}
-</script>
-<style lang="scss" >
-.avatar-uploader .el-upload {
-  border: 1px dashed #d9d9d9;
-  border-radius: 6px;
-  cursor: pointer;
-  position: relative;
-  overflow: hidden;
-}
-.avatar-uploader .el-upload:hover {
-  border-color: #409eff;
-}
-.avatar-uploader-icon {
-  font-size: 28px;
-  color: #8c939d;
-  width: 100px;
-  height: 100px;
-  line-height: 100px;
-  text-align: center;
-}
-.avatar {
-  width: 100px;
-  height: 100px;
-  display: block;
-}
-.checkUsed{
-	display: inline-block;
-	margin-left: 10px;
-	color: #1890ff;
-}
-</style>
+<template>
+  <el-dialog
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    :title="title"
+    :append-to-body="true"
+    :visible.sync="isVisible"
+    width="950px"
+    top="50px"
+  >
+    <el-form
+      ref="form"
+      :disabled="formDisabled"
+      :model="tenant"
+      :rules="rules"
+      label-position="right"
+      label-width="100px"
+    >
+    	<!--订单名称-->
+      <el-form-item :label="$t(&quot;runCenter.form.orderName&quot;)+&quot;:&quot;" prop="orderName">
+        <el-input v-model="tenant.orderName" :placeholder='$t("common.pleaseEnter")' style="width: 50%;"/>
+      </el-form-item>
+      <!-- 所属产线 -->
+      <el-form-item
+        :label="$t(&quot;runCenter.form.zoneId&quot;)+&quot;:&quot;"
+        prop="zoneId"
+      >
+        <el-select
+          v-model="tenant.zoneId"
+          :placeholder="$t(&quot;common.pleaseSelect&quot;)"
+          style="width: 50%;"
+        >
+          <el-option
+            v-for="item in zoneList"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id"
+          />
+        </el-select>
+      </el-form-item>
+      <!-- 交付时间 -->
+      <el-form-item
+        :label="$t(&quot;runCenter.form.deliveryTime&quot;)+&quot;:&quot;"
+        prop="deliveryTime"
+      >
+        <el-date-picker
+          v-model="tenant.deliveryTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          :placeholder="$t(&quot;common.pleaseSelect&quot;)"
+          :picker-options="pickerOptions"
+          style="width: 50%;"
+        />
+      </el-form-item>
+      <!-- 下单时间 -->
+      <el-form-item
+        :label="$t(&quot;runCenter.form.orderTime&quot;)+&quot;:&quot;"
+        prop="orderTime"
+      >
+        <el-date-picker
+          v-model="tenant.orderTime"
+          type="date"
+          value-format="yyyy-MM-dd"
+          :placeholder="$t(&quot;common.pleaseSelect&quot;)"
+          :picker-options="pickerOptions"
+          style="width: 50%;"
+        />
+      </el-form-item>
+      <!-- 启用状态 -->
+      <el-form-item
+        :label="$t(&quot;runCenter.form.status&quot;)+&quot;:&quot;"
+        prop="status"
+      >
+        <template>
+          <el-radio
+            v-model="tenant.status"
+            label="1"
+          >
+            {{ $t("common.show") }}
+          </el-radio>
+          <el-radio
+            v-model="tenant.status"
+            label="0"
+          >
+            {{ $t("common.hide") }}
+          </el-radio>
+        </template>
+      </el-form-item>
+      <!-- 零件 -->
+      <el-form-item
+        :label="$t(&quot;runCenter.form.lingjian&quot;)+&quot;:&quot;"
+        prop="product"
+      >
+        <el-button
+          type="primary"
+          :disabled="type == 'view' ? true : false"
+          icon="el-icon-plus"
+          size="small"
+          circle
+          @click="add"
+        />
+      </el-form-item>
+
+      <!-- Table数据 -->
+      <el-table
+        ref="table"
+        :data="tableData"
+        border
+        fit
+        style="width: 100%;"
+      >
+      	<!-- 零部件编号 -->
+        <el-table-column
+          prop="partsNo"
+          :label="$t(&quot;runCenter.table.orderSldPro.partsNo&quot;)"
+          align="center"
+          :show-overflow-tooltip="true"
+          width="120px"
+        >
+          <template slot-scope="{ row }">
+            <span>{{ row.partsNo }}</span>
+          </template>
+        </el-table-column>
+        <!-- 产品代号 -->
+        <el-table-column
+          prop="bomAlias"
+          :label="$t(&quot;runCenter.table.orderSldPro.bomAlias&quot;)"
+          align="center"
+          :show-overflow-tooltip="true"
+          width="100px"
+        />
+        <!-- 零件名称 -->
+        <el-table-column
+          prop="bomName"
+          :label="$t(&quot;runCenter.table.orderSldPro.name&quot;)"
+          align="center"
+          width="100px"
+        >
+	        <template slot-scope="{ row }">
+			      {{ row.name || row.bomName }}
+					</template>
+        </el-table-column>
+
+        <!-- 零件代号 -->
+        <el-table-column
+          prop="partsAlias"
+          :label="$t(&quot;runCenter.table.orderSldPro.partsAlias&quot;)"
+          align="center"
+          width="100px"
+        />
+        <!-- 零件批号 -->
+        <!--<el-table-column
+          prop="brand"
+          :label="$t(&quot;runCenter.table.orderSldPro.brand&quot;)"
+          align="center"
+          width="100px"
+        />-->
+        <!-- 原料炉批号 -->
+        <el-table-column
+          prop="furnaceBatchNo"
+          label="原料炉批号"
+          align="center"
+          width="150px"
+        >
+        	<template slot-scope="{ row }">
+			      <div style="color: #42d885;cursor: pointer;" @click="changeMetral(row)">
+			      	<span v-if="row.furnaceBatchNo">{{ row.furnaceBatchNo }}</span>
+			      	<a v-else>请选择</a>
+			      </div>
+					</template>
+        </el-table-column>
+
+        <!-- 数量 -->
+        <el-table-column
+          prop="bomNum"
+          :label="$t(&quot;runCenter.table.orderSldPro.bomNum&quot;)"
+          width="150px"
+          align="center"
+        >
+          <template slot-scope="{ row }">
+            <el-input-number
+              v-model="row.bomNum"
+              :min="1"
+              :max="999999999"
+              :label="$t(&quot;common.pleaseEnter&quot;)"
+              size="small"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="deliveryTime"
+          :label="$t(&quot;runCenter.table.orderSldPro.deliveryTime&quot;)"
+          width="220px"
+          align="center"
+        >
+          <template slot-scope="{ row }">
+            <el-date-picker
+              v-model="row.deliveryTime"
+              type="date"
+              value-format="yyyy-MM-dd"
+              size="small"
+              :placeholder="$t(&quot;common.pleaseSelect&quot;)"
+              :picker-options="pickerOptions"
+              style="width: 100%;"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column
+          prop="remark"
+          :label="$t(&quot;common.remark&quot;)"
+          :show-overflow-tooltip="true"
+          width="180px"
+          align="center"
+        >
+          <template slot-scope="{ row }">
+            <el-input
+              v-model="row.remark"
+              size="small"
+              :label="$t(&quot;common.pleaseEnter&quot;)"
+            />
+          </template>
+        </el-table-column>
+        <el-table-column
+          v-if="type != 'view'"
+          :label="$t('table.operation')"
+          fixed="right"
+          align="center"
+          column-key="operation"
+          width="60px"
+        >
+          <template slot-scope="{ row }">
+            <!--<el-tooltip class="item" :content='$t("common.edit")' effect="dark" placement="top-start">
+			          <i
+			            class="el-icon-edit table-operation"
+			            style="color: #2db7f5;"
+			            @click="edit(row)"
+			          />
+			        </el-tooltip>-->
+            <el-tooltip
+              class="item"
+              :content="$t(&quot;common.delete&quot;)"
+              effect="dark"
+              placement="top-start"
+            >
+              <i
+                class="el-icon-delete table-operation"
+                style="color: #f50;"
+                @click="domDelete(row)"
+              />
+            </el-tooltip>
+          </template>
+        </el-table-column>
+      </el-table>
+    </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>
+    </div>
+
+    <!-- 选择数据的组件 -->
+    <select-table
+      ref="edit"
+      :dialog-visible="dialog.isVisible"
+      :title="dialog.title"
+      @close="editClose"
+      @success="editSuccess"
+    />
+
+    <!-- 选择数据的组件 -->
+    <meterial-select
+      ref="meterial"
+      :dialog-visible="dialogMeterial.isVisible"
+      :title="dialogMeterial.title"
+      @close="editMeterialClose"
+      @success="editMeterialSuccess"
+    />
+
+  </el-dialog>
+</template>
+<script>
+	// 日期格式化组件
+	import moment from 'moment'
+	// 选择【新增】组件
+	import SelectTable from "./Select"
+	// 选择【原料炉批号】组件
+	import MeterialSelect from "./MeterialSelect"
+	// 【客户管理】-API
+	import customerMgrApi from "@/api/basicConfiguration/customerMgr"
+  //【所属产线】-API
+  import areaMgrApi from "@/api/resourceProductMgr/areaMgr"
+	// 【订单管理】-API
+	import orderMgrApi from "@/api/runManageCenter/orderMgr"
+	// 【订单明细】-API
+	import orderDetailApi from "@/api/runManageCenter/orderDetail"
+	import { arrReduce } from '@/utils/commons'
+export default {
+  name: 'TenantEdit',
+  components: { SelectTable, MeterialSelect },
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+      type: 'add',
+      tenant: this.initTenant(),
+      screenWidth: 0,
+      width: this.initWidth(),
+      confirmDisabled: false,
+      dialog: {
+        isVisible: false,
+        title: ""
+      },
+      dialogMeterial: {
+        isVisible: false,
+        title: ""
+      },
+      customList: [],
+      currRow: {}, // 当前选择的Row
+      zoneList: [],
+      tableData: [],
+      dicts:{
+        NATION: {}
+      },
+      roles: [],
+      pickerOptions: {
+        disabledDate: (time) => {
+          return time.getTime() < Date.now() - 86400000;
+        },
+      },
+      rules: {
+        custId: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
+        ],
+        deliveryTime: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        orderTime: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ],
+        status: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'change' }
+        ]
+      }
+    }
+  },
+  computed: {
+  	formDisabled(){
+  		if(this.type == "view"){
+  			this.confirmDisabled = true
+  			return true
+  		}else{
+  			this.confirmDisabled = false
+  			return false
+  		}
+  	},
+    isVisible: {
+      get () {
+      	// 清空数据
+      	this.tableData = [];
+        return this.dialogVisible
+      },
+      set () {
+        this.close()
+        this.reset()
+      }
+    }
+  },
+  // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
+  created() {
+  	// 加载客户列表数据
+  	this.customerList()
+    this.getZoneList()
+	},
+  mounted () {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth()
+      })()
+    }
+  },
+  methods: {
+  	// 【原料炉批号】点击-事件
+  	changeMetral(row) {
+  		// 当前选择的行。row
+  		this.currRow = row;
+  		this.$refs.meterial.type = "edit";
+  		this.$refs.meterial.setTenant(row);
+      this.dialogMeterial.title = "选择原料炉批号";
+      this.dialogMeterial.isVisible = true;
+  	},
+
+  	// 【原料炉批号-修改】弹出框,关闭
+  	editMeterialClose () {
+      this.dialogMeterial.isVisible = false
+    },
+
+    // 【原料炉批号-修改】弹出框,确定事件
+    editMeterialSuccess (obj) {
+    	console.log("【原料炉批号-修改】: ", obj);
+    	let arr = [];
+    	this.tableData.map(item => {
+    		if(item.id == this.currRow.id) {
+    			// 赋值,原料炉批号
+    			item.furnaceBatchNo = obj.furnaceBatchNo;
+    			// 带入参数
+    			item.meterialReceiveId = obj.id;
+    		}
+    		arr.push(item);
+    	})
+    	// 赋值
+    	this.tableData = arr;
+    },
+
+  	// 【删除】按钮-事件
+  	domDelete(row){
+  		this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
+      	distinguishCancelAndClose: true,
+        confirmButtonText: this.$t("common.confirm"),
+        cancelButtonText: this.$t("common.cancel"),
+        type: "warning"
+      }).then(() => {
+      	// 过滤我们需要的数据
+	  		let list = this.tableData.filter(item => item.id != row.id)
+	  		// 重新赋值
+	  		this.tableData = list
+      }).catch(() => {})
+
+  	},
+
+  	// 【新增-修改】弹出框,关闭
+  	editClose () {
+      this.dialog.isVisible = false
+    },
+
+    // 【新增-修改】弹出框,确定事件
+    editSuccess (arr) {
+    	// 清除备注
+    	arr.forEach(item => {
+    		item.remark = "";
+    	});
+    	// 合并当前数组,和新增的数组
+    	let list = [...this.tableData, ...arr];
+    	// 去除数组中重复的数据
+    	this.tableData = arrReduce(list, "id");
+    },
+
+    add () {
+      this.$refs.edit.type = "add"
+      this.dialog.title = this.$t("runCenter.common.selectPro")
+      this.dialog.isVisible = true
+    },
+
+    initTenant () {
+      return {
+        orderTime: moment(new Date()).format('YYYY-MM-DD'),
+        status: '1',
+        zoneId: '',
+      }
+    },
+
+    initWidth () {
+      this.screenWidth = document.body.clientWidth
+      if (this.screenWidth < 991) {
+        return '90%'
+      } else if (this.screenWidth < 1400) {
+        return '45%'
+      } else {
+        return '800px'
+      }
+    },
+
+    setTenant (val, dicts) {
+    	if(val){
+    		this.tenant = { ...val }
+    		// 修改的时候,订单详情数据(BOM产品)
+    		this.getBomList()
+    	}
+      // 字典表
+      this.dicts = dicts
+    },
+
+    close () {
+      this.$emit('close')
+    },
+
+    reset () {
+      // 先清除校验,再清除表单,不然有奇怪的bug
+      this.$refs.form.clearValidate()
+      this.$refs.form.resetFields()
+      this.tenant = this.initTenant()
+      // 关闭时候,清空数据
+      this.tableData = []
+    },
+
+    submitForm () {
+      this.$refs.form.validate((valid) => {
+        if (valid) {
+          this.confirmDisabled = true
+          // 验证【数量】不能不填写
+          let flag = false, flagBatchNo = false;
+          this.tableData.map(item => {
+          	if(!item.bomNum){
+          		flag = true
+          	}
+            if(!item.deliveryTime){
+              flag = true
+            }
+            // 验证【原料炉批号】
+            if(!item.furnaceBatchNo){
+              flagBatchNo = true
+            }
+          })
+          if(flag){
+          	this.$message({
+	              message: this.$t('runCenter.tips.prodNums'),
+	              type: 'warning'
+	            })
+          	this.confirmDisabled = false
+          	return false
+          }
+          if(flagBatchNo){
+          	this.$message({
+	              message: this.$t('请选择【原料炉批号】~'),
+	              type: 'warning'
+	            })
+          	this.confirmDisabled = false
+          	return false
+          }
+          // 添加数据
+          this.tenant.orderProductList = []
+          this.tableData.map(item => {
+          	// 添加数据
+          	this.tenant.orderProductList.push({
+              id:item.id,
+          		bomId: item.bomId,
+          		bomNum: item.bomNum,
+          		meterialReceiveId: item.meterialReceiveId,
+          		furnaceBatchNo: item.furnaceBatchNo,
+          		deliveryTime: item.deliveryTime,
+          		remark: item.remark
+          	})
+          })
+
+          // 验证订单是否是否有待生产产品
+          if(this.tenant.orderProductList.length == 0){
+            this.$message({
+              message: this.$t('runCenter.tips.prods'),
+              type: 'warning'
+            })
+            this.confirmDisabled = false
+            return false
+          }
+
+          if (this.type === 'add') {
+            this.save()
+          } else {
+            this.update()
+          }
+        } else {
+          return false
+        }
+      })
+    },
+
+    save () {
+      orderMgrApi.save(this.tenant)
+        .then((response) => {
+          const res = response.data
+          if (res.isSuccess) {
+            this.isVisible = false
+            this.$message({
+              message: this.$t('tips.createSuccess'),
+              type: 'success'
+            })
+            // 通知列表
+	          this.$emit("success");
+	          // 通知列表-并关闭弹出框
+	          this.$emit("close");
+          }
+        }).finally(() => {
+          this.confirmDisabled = false
+          return true
+        })
+    },
+
+    update () {
+      orderMgrApi.update(this.tenant)
+        .then((response) => {
+          const res = response.data
+          if (res.isSuccess) {
+            this.isVisible = false
+            this.$message({
+              message: this.$t('tips.updateSuccess'),
+              type: 'success'
+            })
+            // 通知列表
+	          this.$emit("success");
+	          // 通知列表-并关闭弹出框
+	          this.$emit("close");
+          }
+        }).finally(() => {
+          this.confirmDisabled = false
+          return true
+        })
+    },
+
+    // 客户下拉数据
+    customerList(){
+    	customerMgrApi.getList({}).then(res => {
+    		res = res.data
+    		if(res.isSuccess){
+    			// console.log("88888== ",res)
+    			this.customList = res.data.data
+    		}
+    	})
+    },
+    //获取产线数据
+    getZoneList(){
+        areaMgrApi.getList({status:1}).then(res => {
+    		res = res.data
+    		if(res.isSuccess){
+    			this.zoneList = res.data
+    		}
+    	})
+    },
+    // [BOM产品]数据-修改的时候
+    getBomList(){
+    	orderDetailApi.getList({orderId: this.tenant.id}).then(res => {
+    		res = res.data
+    		if(res.isSuccess){
+    			this.tableData = res.data
+    		}
+    	})
+    }
+  }
+}
+</script>
+<style lang="scss" >
+.avatar-uploader .el-upload {
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
+}
+.avatar-uploader .el-upload:hover {
+  border-color: #409eff;
+}
+.avatar-uploader-icon {
+  font-size: 28px;
+  color: #8c939d;
+  width: 100px;
+  height: 100px;
+  line-height: 100px;
+  text-align: center;
+}
+.avatar {
+  width: 100px;
+  height: 100px;
+  display: block;
+}
+.checkUsed{
+	display: inline-block;
+	margin-left: 10px;
+	color: #1890ff;
+}
+</style>