适用班组数
This commit is contained in:
		
							parent
							
								
									56d62bdf32
								
							
						
					
					
						commit
						050ba909bc
					
				| 
						 | 
				
			
			@ -83,6 +83,16 @@
 | 
			
		|||
              @keyup.enter.native="handleQuery"
 | 
			
		||||
            />
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="适用班组数" prop="fitNum">
 | 
			
		||||
            <el-input
 | 
			
		||||
              v-model="maForm.fitNum"
 | 
			
		||||
              placeholder="请输入适用班组数"
 | 
			
		||||
              maxlength="10"
 | 
			
		||||
              type="number"
 | 
			
		||||
              style="width: 240px"
 | 
			
		||||
              @blur="fitNumChange"
 | 
			
		||||
            />
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
          <el-form-item label="业务单号" prop="code" v-if="isEdit || isDetail">
 | 
			
		||||
            <el-input
 | 
			
		||||
              v-model="maForm.code"
 | 
			
		||||
| 
						 | 
				
			
			@ -139,7 +149,7 @@
 | 
			
		|||
                @mouseenter.native="showCustomTooltip(item, $event)"
 | 
			
		||||
                @mouseleave.native="hideCustomTooltip"
 | 
			
		||||
              >
 | 
			
		||||
              <span v-html="highlightText(item.fullPath, searchKeyword)"></span>
 | 
			
		||||
                <span v-html="highlightText(item.fullPath, searchKeyword)"></span>
 | 
			
		||||
              </el-option>
 | 
			
		||||
            </el-select>
 | 
			
		||||
            <div
 | 
			
		||||
| 
						 | 
				
			
			@ -150,7 +160,12 @@
 | 
			
		|||
                top: tooltipPosition.y + 'px'
 | 
			
		||||
              }"
 | 
			
		||||
            >
 | 
			
		||||
              <img :src="currentTooltipItem.imageUrl || defaultImage" style="max-width: 200px; max-height: 150px;"  @load="imageLoaded" @error="imageLoadError"/>
 | 
			
		||||
              <img
 | 
			
		||||
                :src="currentTooltipItem.imageUrl || defaultImage"
 | 
			
		||||
                style="max-width: 200px; max-height: 150px"
 | 
			
		||||
                @load="imageLoaded"
 | 
			
		||||
                @error="imageLoadError"
 | 
			
		||||
              />
 | 
			
		||||
              <p>库存: {{ currentTooltipItem.storageNum }}</p>
 | 
			
		||||
            </div>
 | 
			
		||||
          </el-col>
 | 
			
		||||
| 
						 | 
				
			
			@ -249,7 +264,7 @@
 | 
			
		|||
            filterable
 | 
			
		||||
            clearable
 | 
			
		||||
            :disabled="isDetail"
 | 
			
		||||
            @change="(selectedIds) => getTypeList(scope.row, selectedIds, scope.$index)"
 | 
			
		||||
            @change="selectedIds => getTypeList(scope.row, selectedIds, scope.$index)"
 | 
			
		||||
          ></el-cascader>
 | 
			
		||||
 | 
			
		||||
          <span v-else>{{ scope.row.maTypeName }}</span>
 | 
			
		||||
| 
						 | 
				
			
			@ -264,9 +279,14 @@
 | 
			
		|||
            filterable
 | 
			
		||||
            placeholder="请选择规格型号"
 | 
			
		||||
            :disabled="isDetail"
 | 
			
		||||
            @change="(val) => changeTypeName(scope.row, val, getSelectedItemName(val,scope.row))"
 | 
			
		||||
            @change="val => changeTypeName(scope.row, val, getSelectedItemName(val, scope.row))"
 | 
			
		||||
          >
 | 
			
		||||
            <el-option v-for="item in scope.row.typeList" :key="item.typeId" :label="item.name" :value="item.typeId"></el-option>
 | 
			
		||||
            <el-option
 | 
			
		||||
              v-for="item in scope.row.typeList"
 | 
			
		||||
              :key="item.typeId"
 | 
			
		||||
              :label="item.name"
 | 
			
		||||
              :value="item.typeId"
 | 
			
		||||
            ></el-option>
 | 
			
		||||
          </el-select>
 | 
			
		||||
          <span v-else>{{ scope.row.typeName }}</span>
 | 
			
		||||
        </template>
 | 
			
		||||
| 
						 | 
				
			
			@ -358,7 +378,6 @@
 | 
			
		|||
      </span>
 | 
			
		||||
    </el-dialog>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
| 
						 | 
				
			
			@ -427,8 +446,10 @@ export default {
 | 
			
		|||
        code: '', // 采购申请编号
 | 
			
		||||
        supplierTime: '', // 供货时间
 | 
			
		||||
        supplierPlace: '', // 供货地点
 | 
			
		||||
        bmFileInfos: [] // 附件
 | 
			
		||||
        bmFileInfos: [], // 附件
 | 
			
		||||
        fitNum: 1
 | 
			
		||||
      },
 | 
			
		||||
      lastFitNum: 1,
 | 
			
		||||
      pickerOptions: {
 | 
			
		||||
        disabledDate(time) {
 | 
			
		||||
          // 禁用今天之前的日期
 | 
			
		||||
| 
						 | 
				
			
			@ -493,9 +514,7 @@ export default {
 | 
			
		|||
            trigger: 'change'
 | 
			
		||||
          }
 | 
			
		||||
        ],
 | 
			
		||||
        deviceType: [
 | 
			
		||||
          { required: true, message: '请选择类型规格', trigger: 'blur' }
 | 
			
		||||
        ]
 | 
			
		||||
        deviceType: [{ required: true, message: '请选择类型规格', trigger: 'blur' }]
 | 
			
		||||
      },
 | 
			
		||||
      maTypeList: [], // 类型名称
 | 
			
		||||
      // 规格型号
 | 
			
		||||
| 
						 | 
				
			
			@ -610,27 +629,39 @@ export default {
 | 
			
		|||
    console.log(this.$route.query, 'this.$route.query')
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
  showCustomTooltip(item, event) {
 | 
			
		||||
    clearTimeout(this.tooltipTimeout);
 | 
			
		||||
    this.tooltipTimeout = setTimeout(() => {
 | 
			
		||||
      this.currentTooltipItem = item;
 | 
			
		||||
      this.tooltipPosition = {
 | 
			
		||||
        x: event.clientX + 15,
 | 
			
		||||
        y: event.clientY + 15
 | 
			
		||||
      };
 | 
			
		||||
    }, 300); // 300ms延迟显示,避免鼠标快速移动时频繁触发
 | 
			
		||||
  },
 | 
			
		||||
  imageLoaded() {
 | 
			
		||||
      this.shouldShowTooltip = true; // 图片加载完成,显示悬浮框
 | 
			
		||||
  },
 | 
			
		||||
  imageLoadError() {
 | 
			
		||||
    this.shouldShowTooltip = true; // 图片加载失败,也显示悬浮框
 | 
			
		||||
  },
 | 
			
		||||
    fitNumChange() {
 | 
			
		||||
      const newVal = Math.min(5, Math.max(1, parseInt(this.maForm.fitNum) || 1))
 | 
			
		||||
      const ratio = newVal / this.lastFitNum
 | 
			
		||||
      this.equipmentList.forEach(item => {
 | 
			
		||||
        if (typeof item.preNum === 'number') {
 | 
			
		||||
          item.preNum = Math.max(1, Math.floor(item.preNum * ratio)) // 向下取整,且至少为1
 | 
			
		||||
        }
 | 
			
		||||
      })
 | 
			
		||||
 | 
			
		||||
  hideCustomTooltip() {
 | 
			
		||||
    clearTimeout(this.tooltipTimeout);
 | 
			
		||||
    this.currentTooltipItem = null;
 | 
			
		||||
  },
 | 
			
		||||
      this.lastFitNum = newVal
 | 
			
		||||
      this.maForm.fitNum = newVal
 | 
			
		||||
    },
 | 
			
		||||
    showCustomTooltip(item, event) {
 | 
			
		||||
      clearTimeout(this.tooltipTimeout)
 | 
			
		||||
      this.tooltipTimeout = setTimeout(() => {
 | 
			
		||||
        this.currentTooltipItem = item
 | 
			
		||||
        this.tooltipPosition = {
 | 
			
		||||
          x: event.clientX + 15,
 | 
			
		||||
          y: event.clientY + 15
 | 
			
		||||
        }
 | 
			
		||||
      }, 300) // 300ms延迟显示,避免鼠标快速移动时频繁触发
 | 
			
		||||
    },
 | 
			
		||||
    imageLoaded() {
 | 
			
		||||
      this.shouldShowTooltip = true // 图片加载完成,显示悬浮框
 | 
			
		||||
    },
 | 
			
		||||
    imageLoadError() {
 | 
			
		||||
      this.shouldShowTooltip = true // 图片加载失败,也显示悬浮框
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    hideCustomTooltip() {
 | 
			
		||||
      clearTimeout(this.tooltipTimeout)
 | 
			
		||||
      this.currentTooltipItem = null
 | 
			
		||||
    },
 | 
			
		||||
    // 获取类型名称-tree
 | 
			
		||||
    async getMaTypeNameOpt() {
 | 
			
		||||
      try {
 | 
			
		||||
| 
						 | 
				
			
			@ -680,7 +711,7 @@ export default {
 | 
			
		|||
    //     console.log('🚀  ~ error:', error)
 | 
			
		||||
    //   }
 | 
			
		||||
    // },
 | 
			
		||||
  async getTypeList(row, typeIds, index) {
 | 
			
		||||
    async getTypeList(row, typeIds, index) {
 | 
			
		||||
      console.log('🚀 ~ getTypeList ~ row:', row)
 | 
			
		||||
      // 递归循环 获取类型名称
 | 
			
		||||
      const filterData = data => {
 | 
			
		||||
| 
						 | 
				
			
			@ -710,30 +741,29 @@ export default {
 | 
			
		|||
      } catch (error) {
 | 
			
		||||
        console.log('🚀  ~ error:', error)
 | 
			
		||||
      }
 | 
			
		||||
  },
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    getSelectedItemName(typeId,row) {
 | 
			
		||||
      const selectedItem = row.typeList.find(item => item.typeId === typeId);
 | 
			
		||||
      return selectedItem ? selectedItem.name : '';
 | 
			
		||||
    getSelectedItemName(typeId, row) {
 | 
			
		||||
      const selectedItem = row.typeList.find(item => item.typeId === typeId)
 | 
			
		||||
      return selectedItem ? selectedItem.name : ''
 | 
			
		||||
    },
 | 
			
		||||
    //
 | 
			
		||||
    changeTypeName(row, val,name) {
 | 
			
		||||
    changeTypeName(row, val, name) {
 | 
			
		||||
      console.log('🚀 ~ changeTypeName ~ row:', row)
 | 
			
		||||
      console.log('🚀 ~ changeTypeName ~ val:', val)
 | 
			
		||||
      this.equipmentList.some(item => {
 | 
			
		||||
        // 跳过当前行
 | 
			
		||||
        if (item === row) return false;
 | 
			
		||||
        if (item === row) return false
 | 
			
		||||
        if (item.typeId === val) {
 | 
			
		||||
          this.$message({
 | 
			
		||||
            message: `${name} 已添加到列表中`,
 | 
			
		||||
            type: 'warning'
 | 
			
		||||
          });
 | 
			
		||||
          row.typeId = '';
 | 
			
		||||
          return true;
 | 
			
		||||
          })
 | 
			
		||||
          row.typeId = ''
 | 
			
		||||
          return true
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
      });
 | 
			
		||||
        return false
 | 
			
		||||
      })
 | 
			
		||||
      // console.log('xxxxxxxxxxxxxxxxx', this.equipmentList.some(item => item.typeId === val))
 | 
			
		||||
      // if (this.equipmentList.some(item => item.typeId === val)) {
 | 
			
		||||
      //       // console.log("yyyyyyyyyyy",item.typeId)
 | 
			
		||||
| 
						 | 
				
			
			@ -830,17 +860,17 @@ export default {
 | 
			
		|||
    /** 租赁单位和工程-下拉选 */
 | 
			
		||||
    projectInfoList() {
 | 
			
		||||
      if (!this.isEdit) {
 | 
			
		||||
        getListUnite({ projectId: null,enableFilter:true }).then(response => {
 | 
			
		||||
        getListUnite({ projectId: null, enableFilter: true }).then(response => {
 | 
			
		||||
          this.uniteList = response.data
 | 
			
		||||
        })
 | 
			
		||||
        getListProject({ unitId: null,enableFilter:true }).then(response => {
 | 
			
		||||
        getListProject({ unitId: null, enableFilter: true }).then(response => {
 | 
			
		||||
          this.projectList = response.data
 | 
			
		||||
        })
 | 
			
		||||
      } else {
 | 
			
		||||
        getListUnite({ projectId: null,enableFilter:true }).then(response => {
 | 
			
		||||
        getListUnite({ projectId: null, enableFilter: true }).then(response => {
 | 
			
		||||
          this.uniteList = response.data
 | 
			
		||||
        })
 | 
			
		||||
        getListProject({ unitId: this.maForm.unitId,enableFilter:true }).then(response => {
 | 
			
		||||
        getListProject({ unitId: this.maForm.unitId, enableFilter: true }).then(response => {
 | 
			
		||||
          this.projectList = response.data
 | 
			
		||||
        })
 | 
			
		||||
      }
 | 
			
		||||
| 
						 | 
				
			
			@ -1003,7 +1033,7 @@ export default {
 | 
			
		|||
        this.$refs['maForm'].validate(async valid => {
 | 
			
		||||
          if (valid) {
 | 
			
		||||
            for (let i = 0; i < this.equipmentList.length; i++) {
 | 
			
		||||
              if(!this.equipmentList[i].typeId){
 | 
			
		||||
              if (!this.equipmentList[i].typeId) {
 | 
			
		||||
                this.$message.error(`第 ${i + 1} 行的 ${'规格型号'} 不能为空`)
 | 
			
		||||
                return
 | 
			
		||||
              }
 | 
			
		||||
| 
						 | 
				
			
			@ -1201,7 +1231,11 @@ export default {
 | 
			
		|||
    handleDownload(file) {
 | 
			
		||||
      console.log(file)
 | 
			
		||||
      if (file.status === 'ready') {
 | 
			
		||||
        downloadFile({ fileName: file.name, fileData: file.raw, fileType: 'application/vnd.ms-excel;charset=utf-8' })
 | 
			
		||||
        downloadFile({
 | 
			
		||||
          fileName: file.name,
 | 
			
		||||
          fileData: file.raw,
 | 
			
		||||
          fileType: 'application/vnd.ms-excel;charset=utf-8'
 | 
			
		||||
        })
 | 
			
		||||
      } else if (file.status === 'success') {
 | 
			
		||||
        downloadFileData({ fileName: file.name, fileUrl: file.url })
 | 
			
		||||
        // downloadFileData({ fileName: file.name,fileUrl:file.url })
 | 
			
		||||
| 
						 | 
				
			
			@ -1287,17 +1321,17 @@ export default {
 | 
			
		|||
    // 导出数据
 | 
			
		||||
    handleExport() {
 | 
			
		||||
      try {
 | 
			
		||||
        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())
 | 
			
		||||
 | 
			
		||||
        let fileName = `工器具清单_${currentTime}.xLsx`
 | 
			
		||||
        let url = '/material/leaseTask/export'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -132,7 +132,7 @@
 | 
			
		|||
          rows="2"
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="适用班组数" prop="fitNum">
 | 
			
		||||
      <!-- <el-form-item label="适用班组数" prop="fitNum">
 | 
			
		||||
        <el-input
 | 
			
		||||
          v-model="maForm.fitNum"
 | 
			
		||||
          placeholder="请输入适用班组数"
 | 
			
		||||
| 
						 | 
				
			
			@ -141,7 +141,7 @@
 | 
			
		|||
          style="width: 240px"
 | 
			
		||||
          @blur="fitNumChange"
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      </el-form-item> -->
 | 
			
		||||
    </el-form>
 | 
			
		||||
    <el-row :gutter="10" class="mb8">
 | 
			
		||||
      <el-col :span="1.5">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue