This commit is contained in:
		
							parent
							
								
									ca70bb4959
								
							
						
					
					
						commit
						1b4bf1270b
					
				| 
						 | 
				
			
			@ -324,8 +324,9 @@ export default {
 | 
			
		|||
      uploadUrl: process.env.VUE_APP_BASE_API + '/file/upload', // 上传的图片服务器地址
 | 
			
		||||
      upload: {
 | 
			
		||||
        // 设置上传的请求头部
 | 
			
		||||
        headers: { Authorization: 'Bearer ' + getToken() },
 | 
			
		||||
      }
 | 
			
		||||
        headers: { Authorization: 'Bearer ' + getToken() }
 | 
			
		||||
      },
 | 
			
		||||
      equipmentListTemp: []
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  computed: {
 | 
			
		||||
| 
						 | 
				
			
			@ -438,10 +439,13 @@ export default {
 | 
			
		|||
        } else {
 | 
			
		||||
          const newItem = {
 | 
			
		||||
            ...typeData,
 | 
			
		||||
            scrapNum: 0
 | 
			
		||||
            scrapNum: 0,
 | 
			
		||||
            isNew: true
 | 
			
		||||
          }
 | 
			
		||||
 | 
			
		||||
          // 将新项添加到数组开头,实现倒序
 | 
			
		||||
          this.equipmentList.unshift(newItem)
 | 
			
		||||
 | 
			
		||||
          this.deviceType.push(lastSelected)
 | 
			
		||||
          this.$message({
 | 
			
		||||
            message: `已添加 ${typeData.typeName}`,
 | 
			
		||||
| 
						 | 
				
			
			@ -451,6 +455,8 @@ export default {
 | 
			
		|||
          this.getDeviceCodeOptions(newItem).then(options => {
 | 
			
		||||
            this.$set(newItem, 'deviceCodeOptions', options)
 | 
			
		||||
          })
 | 
			
		||||
 | 
			
		||||
          console.log('this.equipmentList', this.equipmentList)
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -489,6 +495,7 @@ export default {
 | 
			
		|||
            deviceCodeOptions: [] // 初始化设备编码选项
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        // 为每个设备项获取设备编码选项
 | 
			
		||||
        for (let i = 0; i < this.equipmentList.length; i++) {
 | 
			
		||||
          if (this.equipmentList[i].manageType == '0') {
 | 
			
		||||
| 
						 | 
				
			
			@ -511,6 +518,10 @@ export default {
 | 
			
		|||
      // }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    getEquipmentListTemp() {
 | 
			
		||||
      return this.equipmentList
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    /** 保存按钮操作 */
 | 
			
		||||
    handleSave() {
 | 
			
		||||
      // console.log(this.equipmentList)
 | 
			
		||||
| 
						 | 
				
			
			@ -765,17 +776,17 @@ export default {
 | 
			
		|||
    },
 | 
			
		||||
    /** 导出按钮操作 */
 | 
			
		||||
    handleExport() {
 | 
			
		||||
      const formatTime = (date) => {
 | 
			
		||||
        const year = date.getFullYear();
 | 
			
		||||
        const month = String(date.getMonth() + 1).padStart(2, '0');
 | 
			
		||||
        const day = String(date.getDate()).padStart(2, '0');
 | 
			
		||||
        const hours = String(date.getHours()).padStart(2, '0');
 | 
			
		||||
        const minutes = String(date.getMinutes()).padStart(2, '0');
 | 
			
		||||
        const seconds = String(date.getSeconds()).padStart(2, '0');
 | 
			
		||||
        return `${year}${month}${day}_${hours}${minutes}${seconds}`;
 | 
			
		||||
      };
 | 
			
		||||
      const formatTime = date => {
 | 
			
		||||
        const year = date.getFullYear()
 | 
			
		||||
        const month = String(date.getMonth() + 1).padStart(2, '0')
 | 
			
		||||
        const day = String(date.getDate()).padStart(2, '0')
 | 
			
		||||
        const hours = String(date.getHours()).padStart(2, '0')
 | 
			
		||||
        const minutes = String(date.getMinutes()).padStart(2, '0')
 | 
			
		||||
        const seconds = String(date.getSeconds()).padStart(2, '0')
 | 
			
		||||
        return `${year}${month}${day}_${hours}${minutes}${seconds}`
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const currentTime = formatTime(new Date());
 | 
			
		||||
      const currentTime = formatTime(new Date())
 | 
			
		||||
      this.download(
 | 
			
		||||
        '/material/purchase_check_info/exportDetails',
 | 
			
		||||
        { taskId: this.taskId },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,11 +1,7 @@
 | 
			
		|||
<template>
 | 
			
		||||
  <!-- 盘点报废管理 -->
 | 
			
		||||
  <div class="app-container">
 | 
			
		||||
    <PageHeaderApply
 | 
			
		||||
      v-if="isShowComponent != 'Home'"
 | 
			
		||||
      :pageContent="pageContent"
 | 
			
		||||
      @goBack="goBack"
 | 
			
		||||
    />
 | 
			
		||||
    <PageHeaderApply v-if="isShowComponent != 'Home'" :pageContent="pageContent" @goBack="goBack" />
 | 
			
		||||
    <component
 | 
			
		||||
      :is="isShowComponent"
 | 
			
		||||
      :isEdit="isEdit"
 | 
			
		||||
| 
						 | 
				
			
			@ -19,70 +15,80 @@
 | 
			
		|||
      @editTools="editTools"
 | 
			
		||||
      @addToolsSuccess="addToolsSuccess"
 | 
			
		||||
      @queryTools="queryTools"
 | 
			
		||||
      :ref="`${isShowComponent}Ref`"
 | 
			
		||||
    />
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import PageHeaderApply from "@/components/pageHeaderApply";
 | 
			
		||||
import Home from "./component/homeApply.vue"; // 主列表
 | 
			
		||||
import AddTools from "./component/addToolsApply.vue"; // 新增机具 和 修改机具
 | 
			
		||||
import QueryTools from "./component/queryToolsApply.vue"; // 查询机具 和 验收机具
 | 
			
		||||
import PageHeaderApply from '@/components/pageHeaderApply'
 | 
			
		||||
import Home from './component/homeApply.vue' // 主列表
 | 
			
		||||
import AddTools from './component/addToolsApply.vue' // 新增机具 和 修改机具
 | 
			
		||||
import QueryTools from './component/queryToolsApply.vue' // 查询机具 和 验收机具
 | 
			
		||||
export default {
 | 
			
		||||
  name: "InventoryScrap",
 | 
			
		||||
  name: 'InventoryScrap',
 | 
			
		||||
  components: {
 | 
			
		||||
    Home,
 | 
			
		||||
    PageHeaderApply,
 | 
			
		||||
    AddTools,
 | 
			
		||||
    QueryTools,
 | 
			
		||||
    QueryTools
 | 
			
		||||
  },
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      isShowComponent: "Home",
 | 
			
		||||
      pageContent: "盘点报废申请",
 | 
			
		||||
      isShowComponent: 'Home',
 | 
			
		||||
      pageContent: '盘点报废申请',
 | 
			
		||||
      isEdit: false,
 | 
			
		||||
      editTaskId: "",
 | 
			
		||||
      editId: "",
 | 
			
		||||
      queryId: "",
 | 
			
		||||
      queryTaskId: "",
 | 
			
		||||
      editTaskId: '',
 | 
			
		||||
      editId: '',
 | 
			
		||||
      queryId: '',
 | 
			
		||||
      queryTaskId: '',
 | 
			
		||||
      isView: false,
 | 
			
		||||
      codingTaskId: "",
 | 
			
		||||
    };
 | 
			
		||||
      codingTaskId: ''
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  methods: {
 | 
			
		||||
    /* 新增工机具 */
 | 
			
		||||
    addTools() {
 | 
			
		||||
      this.isEdit = false;
 | 
			
		||||
      this.editTaskId = "";
 | 
			
		||||
      this.queryTaskId = "";
 | 
			
		||||
      this.pageContent = "报废新增";
 | 
			
		||||
      this.isShowComponent = "AddTools";
 | 
			
		||||
      this.isEdit = false
 | 
			
		||||
      this.editTaskId = ''
 | 
			
		||||
      this.queryTaskId = ''
 | 
			
		||||
      this.pageContent = '报废新增'
 | 
			
		||||
      this.isShowComponent = 'AddTools'
 | 
			
		||||
    },
 | 
			
		||||
    /* 新增成功 */
 | 
			
		||||
    addToolsSuccess() {
 | 
			
		||||
      this.isShowComponent = "Home";
 | 
			
		||||
      this.isShowComponent = 'Home'
 | 
			
		||||
    },
 | 
			
		||||
    /* 编辑工机具 */
 | 
			
		||||
    editTools(taskId, id) {
 | 
			
		||||
      this.isEdit = true;
 | 
			
		||||
      this.pageContent = "报废编辑";
 | 
			
		||||
      this.editTaskId = taskId;
 | 
			
		||||
      this.editId = id;
 | 
			
		||||
      this.isShowComponent = "AddTools";
 | 
			
		||||
      this.isEdit = true
 | 
			
		||||
      this.pageContent = '报废编辑'
 | 
			
		||||
      this.editTaskId = taskId
 | 
			
		||||
      this.editId = id
 | 
			
		||||
      this.isShowComponent = 'AddTools'
 | 
			
		||||
    },
 | 
			
		||||
    /* 查询工机具 */
 | 
			
		||||
    queryTools(taskId, id) {
 | 
			
		||||
      this.isView = true;
 | 
			
		||||
      this.pageContent = "详情信息";
 | 
			
		||||
      this.queryTaskId = taskId;
 | 
			
		||||
      this.queryId = id;
 | 
			
		||||
      this.isShowComponent = "QueryTools";
 | 
			
		||||
      this.isView = true
 | 
			
		||||
      this.pageContent = '详情信息'
 | 
			
		||||
      this.queryTaskId = taskId
 | 
			
		||||
      this.queryId = id
 | 
			
		||||
      this.isShowComponent = 'QueryTools'
 | 
			
		||||
    },
 | 
			
		||||
    /* 返回按钮 */
 | 
			
		||||
    goBack() {
 | 
			
		||||
      this.isShowComponent = "Home";
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
      if (this.isShowComponent === 'AddTools') {
 | 
			
		||||
        const equipmentListTemp = this.$refs[`${this.isShowComponent}Ref`].getEquipmentListTemp()
 | 
			
		||||
        const isNew = equipmentListTemp.some(item => item.isNew)
 | 
			
		||||
        if (equipmentListTemp.length === 0 || isNew) {
 | 
			
		||||
          this.$message.error('当前页面有未保存的报废信息,请先保存!')
 | 
			
		||||
          return
 | 
			
		||||
        }
 | 
			
		||||
      } else {
 | 
			
		||||
        this.isShowComponent = 'Home'
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue