Explorar el Código

2022-02-25 22:18

王克恕 hace 3 años
padre
commit
f0f9432d94

+ 10 - 0
imcs-ui/src/api/prepareProductMgr/material.js

@@ -30,6 +30,10 @@ const apiList = {
     method: 'POST',
     url: `/authority/meterial/delete`
   },
+  get: {
+    method: 'POST',
+    url: `/authority/meterial/get`
+  },
   list: {
     method: 'POST',
     url: `/authority/meterial/query`
@@ -96,6 +100,12 @@ export default {
       data
     })
   },
+  get (data) {
+    return axiosApi({
+      ...apiList.get,
+      data
+    })
+  },
   list (data) {
     return axiosApi({
       ...apiList.list,

+ 75 - 1
imcs-ui/src/views/zuihou/runManageCenter/orderMgr/components/draftOrder/components/Edit.vue

@@ -155,6 +155,22 @@
           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;)"
@@ -265,6 +281,16 @@
       @close="editClose"
       @success="editSuccess"
     />
+    
+    <!-- 选择数据的组件 -->
+    <meterial-select
+      ref="meterial"
+      :dialog-visible="dialogMeterial.isVisible"
+      :title="dialogMeterial.title"
+      @close="editMeterialClose"
+      @success="editMeterialSuccess"
+    />
+    
   </el-dialog>
 </template>
 <script>
@@ -272,6 +298,8 @@
 	import moment from 'moment'
 	// 选择【新增】组件
 	import SelectTable from "./Select"
+	// 选择【原料炉批号】组件
+	import MeterialSelect from "./MeterialSelect"
 	// 【客户管理】-API
 	import customerMgrApi from "@/api/basicConfiguration/customerMgr"
 	// 【订单管理】-API
@@ -281,7 +309,7 @@
 	import { arrReduce } from '@/utils/commons'
 export default {
   name: 'TenantEdit',
-  components: { SelectTable },
+  components: { SelectTable, MeterialSelect },
   props: {
     dialogVisible: {
       type: Boolean,
@@ -303,7 +331,12 @@ export default {
         isVisible: false,
         title: ""
       },
+      dialogMeterial: {
+        isVisible: false,
+        title: ""
+      }, 
       customList: [],
+      currRow: {}, // 当前选择的Row
       tableData: [],
       dicts:{
         NATION: {}
@@ -363,6 +396,35 @@ export default {
     }
   },
   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;
+    		}
+    		arr.push(item);
+    	})
+    	// 赋值
+    	this.tableData = arr;
+    },
+  	
   	// 【删除】按钮-事件
   	domDelete(row){
   		this.$confirm(this.$t("tips.comTips"), this.$t("common.tips"), {
@@ -378,10 +440,12 @@ export default {
       }).catch(() => {})
 
   	},
+  	
   	// 【新增-修改】弹出框,关闭
   	editClose () {
       this.dialog.isVisible = false
     },
+    
     // 【新增-修改】弹出框,确定事件
     editSuccess (arr) {
     	// 合并当前数组,和新增的数组
@@ -390,17 +454,20 @@ export default {
     	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'
       }
     },
+    
     initWidth () {
       this.screenWidth = document.body.clientWidth
       if (this.screenWidth < 991) {
@@ -411,6 +478,7 @@ export default {
         return '800px'
       }
     },
+    
     setTenant (val, dicts) {
     	if(val){
     		this.tenant = { ...val }
@@ -420,9 +488,11 @@ export default {
       // 字典表
       this.dicts = dicts
     },
+    
     close () {
       this.$emit('close')
     },
+    
     reset () {
       // 先清除校验,再清除表单,不然有奇怪的bug
       this.$refs.form.clearValidate()
@@ -431,6 +501,7 @@ export default {
       // 关闭时候,清空数据
       this.tableData = []
     },
+    
     submitForm () {
       this.$refs.form.validate((valid) => {
         if (valid) {
@@ -486,6 +557,7 @@ export default {
         }
       })
     },
+    
     save () {
       orderMgrApi.save(this.tenant)
         .then((response) => {
@@ -506,6 +578,7 @@ export default {
           return true
         })
     },
+    
     update () {
       orderMgrApi.update(this.tenant)
         .then((response) => {
@@ -526,6 +599,7 @@ export default {
           return true
         })
     },
+    
     // 客户下拉数据
     customerList(){
     	customerMgrApi.getList({}).then(res => {

+ 399 - 0
imcs-ui/src/views/zuihou/runManageCenter/orderMgr/components/draftOrder/components/MeterialSelect.vue

@@ -0,0 +1,399 @@
+<!-- 【原料炉批号】选择-列表 -->
+<template>
+  <el-dialog
+  	:close-on-click-modal="false"
+  	:close-on-press-escape="false"
+  	:title="title"
+  	:append-to-body="true"
+  	:visible.sync="isVisible"
+  	width="1060px"
+  	top="50px"
+  >
+    <el-form ref="form" :model="tenant" :rules="rules" label-position="right" label-width="130px">
+
+    	<div class="filter-container">
+    	<span>
+    		<span>物料牌号:{{ material.tradeMark ? material.tradeMark : '-' }}</span>
+    	</span>
+      <span style="margin-left: 15px;">
+    		<span>器材名称:{{ material.equipmentName ? material.equipmentName : '' }}</span>
+    	</span>
+    	<span style="margin-left: 15px;">
+    		<span>规格型号:{{ material.specification ? material.specification : '' }}</span>
+    	</span>
+    	<span style="margin-left: 15px;">
+    		<span>处理状态:{{ material.handleStatus ? material.handleStatus : '' }}</span>
+    	</span>
+    </div>
+
+	    <!-- 列表数据
+	    	:expand-row-keys="expands"
+	      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
+	    -->
+	    <el-table
+	      :key="tableKey"
+	      ref="table"
+	      v-loading="loading"
+	      :data="tableData.records"
+	      border
+	      fit
+	      row-key="id"
+	      highlight-current-row
+	      style="width: 100%;"
+	      @selection-change="onSelectChange"
+	      @cell-click="cellClick"
+	    >
+	      <!-- 序号 -->
+	    	<el-table-column :label='$t("common.serialNo")' width="55px" align="center">
+		      <template slot-scope="scope">
+		        <div>
+		          {{scope.$index+(queryParams.current - 1) * queryParams.size + 1}}
+		        </div>
+		      </template>
+	      </el-table-column>
+	      <!-- CheckBox -->
+	      <el-table-column align="center" type="selection" width="50" :reserve-selection="true" />
+	      <el-table-column prop="furnaceBatchNo" label='原炉(批)号' :show-overflow-tooltip="true" width="150px"></el-table-column>
+	      <el-table-column prop="meterialCode" label='物料编码' :show-overflow-tooltip="true" width="200px"></el-table-column>
+	      <el-table-column prop="tradeMark" label='材料牌号' :show-overflow-tooltip="true" width="150px"></el-table-column>
+		  	<el-table-column prop="factory" label='供应方名称' :show-overflow-tooltip="true" width="150px"></el-table-column>
+	      <el-table-column prop="meterialBatchNo" label='毛坯批号' :show-overflow-tooltip="true" width="150px"></el-table-column>
+	      <el-table-column prop="factoryDate" label='入厂日期' :show-overflow-tooltip="true" width="150px"></el-table-column>
+	      <el-table-column prop="batchStand" label='接收数量' :show-overflow-tooltip="true" width="150px"></el-table-column>
+	      <el-table-column prop="createUser" label='操作人员' :show-overflow-tooltip="true" width="150px"></el-table-column>
+	      <el-table-column prop="createTime" label='操作时间' :show-overflow-tooltip="true" width="150px"></el-table-column>
+	      <el-table-column prop="" label='订单消耗数量' :show-overflow-tooltip="true" width="150px"></el-table-column>
+	      <!--<el-table-column v-for="item in tableData.titleList" :key="item.id" :prop="item.field" :label='item.text' :show-overflow-tooltip="true" width="180px"></el-table-column>-->
+	    </el-table>
+
+	    <!-- 【分页组件】-->
+	    <pagination
+	      v-show="tableData.total > 0"
+	      :limit.sync="queryParams.size"
+	      :page.sync="queryParams.current"
+	      :total="Number(tableData.total)"
+	      @pagination="fetch"
+	    />
+
+    </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 trayMgrApi from "@/api/prepareProductMgr/trayMgr"
+// 【分页】组件
+import Pagination from "@/components/Pagination"
+// 【BOM管理】-API
+import bomMgrApi from "@/api/prepareProductMgr/bomMgr"
+// 【原材料接收管理】-API
+import ReceiveApi from "@/api/prepareProductMgr/receive"
+// 【原材料管理】-API
+import MaterialApi from "@/api/prepareProductMgr/material"
+// 【共通】函数
+import { initQueryParams } from '@/utils/commons'
+export default {
+  name: 'TenantEdit',
+  components: { Pagination },
+  props: {
+    dialogVisible: {
+      type: Boolean,
+      default: false
+    },
+    title: {
+      type: String,
+      default: ''
+    }
+  },
+  data () {
+    return {
+    	expands: [], // 展开行的key
+    	qiyongStatus: [], //状态
+    	statusList: [], // 启用状态
+    	queryParams: initQueryParams({}),
+    	selection: [],
+    	loading: false,
+    	tableKey: 0,
+      type: 'add',
+      tableData: {
+        total: 0
+      },
+      material: {}, // 原材料详情信息
+      tenant: this.initTenant(),
+      screenWidth: 0,
+      width: this.initWidth(),
+      confirmDisabled: false,
+      roles: [],
+      rules: {
+        name: [
+        	{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
+        ]
+      }
+    }
+  },
+  // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
+  created() {
+  	// 加载列表数据
+  	this.fetch()
+  	// 调用常量-初始化值
+  	this.qiyongStatus = this.$constWKS.AUDIOLIST;
+  	this.statusList = this.$constWKS.STATUSORTHERLIST;
+	},
+  computed: {
+    isVisible: {
+      get () {
+        return this.dialogVisible
+      },
+      set () {
+        this.close()
+        this.reset()
+      }
+    }
+  },
+  mounted () {
+    window.onresize = () => {
+      return (() => {
+        this.width = this.initWidth()
+      })()
+    }
+  },
+  methods: {
+  	// 【新增】按钮-事件
+    addRes(){
+      this.tableData.push({
+      	key: "WKS_"+ Math.random(),
+      	id: '',
+      	positionSort: this.tableData.length + 1,
+      	size: '',
+      	remark: '',
+      	isEdit: true
+      })
+    },
+    // 【搜索】按钮-事件
+    search () {
+      this.fetch({
+        ...this.queryParams
+      })
+    },
+    // Table的选择事件
+    onSelectChange (selection) {
+      this.selection = selection
+    },
+    cellClick (row, column) {
+      if (column['columnKey'] === "operation") {
+        return
+      }
+      let flag = false
+      this.selection.forEach((item) => {
+        if (item.id === row.id) {
+          flag = true
+          this.$refs.table.toggleRowSelection(row)
+        }
+      })
+
+      if (!flag) {
+        this.$refs.table.toggleRowSelection(row, true)
+      }
+    },
+    // 【删除】按钮事件
+    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(() => {})
+    },
+    // 【修改】按钮事件
+    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
+    },
+    initTenant () {
+      return {
+      	model: '',
+        name: '',
+        category: {
+          key: ''
+        },
+        brand: {
+          key: ''
+        },
+        status: '1'
+      }
+    },
+    initWidth () {
+      this.screenWidth = document.body.clientWidth
+      if (this.screenWidth < 991) {
+        return '90%'
+      } else if (this.screenWidth < 1400) {
+        return '45%'
+      } else {
+        return '800px'
+      }
+    },
+    setTenant (val) {
+    	if(val){
+    		console.log("dsfsfsfas === ", val)
+    		this.tenant = { ...val };
+    		// 获取原材料详情
+    		this.getMaterial(val.meterialId);
+    		// 获取。列表
+    		this.search();
+    	}
+    },
+    
+    // 获取原材料详情
+    getMaterial(id) {
+    	MaterialApi.get({ id }).then(res=> {
+    		res = res.data;
+    		console.log("获取【原材料】详情 === ", res)
+    		if(res.code == 0) {
+    			// 如果存在,才赋值
+    			if(res.data) {
+    				this.material = res.data;
+    			}
+    		}
+    	})
+    },
+    		
+    close () {
+      this.$emit('close')
+    },
+    // 【重置】按钮-事件
+    reset () {
+    	// 初始化表单
+      this.queryParams = initQueryParams({})
+      // 清空列表选中的数据
+      this.$refs.table.clearSelection()
+    },
+    submitForm () {
+    	if(this.selection && this.selection.length == 1) {
+    		// 把选择的数据提交到父组件
+    		this.$emit("success", this.selection[0]);
+    		// 关闭弹出框
+    		this.isVisible = false
+    	} else {
+    		this.$message({
+          message: "只能选择一条数据~~",
+          type: 'warning'
+        })
+    	}
+    },
+    save () {
+      trayMgrApi.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 () {
+      trayMgrApi.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
+        })
+    },
+    fetch (params = {}) {
+      this.loading = true
+
+			// 分页信息
+      this.queryParams.current = params.current ? params.current : this.queryParams.current
+      this.queryParams.size = params.size ? params.size : this.queryParams.size
+			// 必须传的参数
+			// this.queryParams.model.auditStatus = '2'
+			// 原材料Id
+			this.queryParams.model.meterialId = this.tenant.meterialId;
+			
+			// 测试数据,真实数据,请使用page
+      ReceiveApi.page(this.queryParams).then(response => {
+      	const res = response.data
+        console.log("列表的数据111122233:", res)
+        if (res.isSuccess) {
+        	// 总数
+        	this.tableData = res.data;
+        }
+        // eslint-disable-next-line no-return-assign
+      }).finally(() => this.loading = false)
+
+    },
+  }
+}
+</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>