石广澎
2023-11-29 20913c80c3f5fc8e533cb92b90e6f20bcd68e032
admin-web/src/views/stock/scrap/itemScrapping/detail.vue
@@ -6,7 +6,7 @@
        <span>{{ detail.businessFormCode }}</span>
      </el-col>
      <el-col :span="8">
        <span>报废仓库:</span>
        <span>仓库:</span>
        <span>{{ detail.warehouseName }}</span>
      </el-col>
      <el-col :span="8">
@@ -16,73 +16,38 @@
    </el-row>
    <el-row :gutter="20" style="margin-top: 20px">
      <el-col :span="8">
        <span>状态:</span>
        <span>{{ detail.states == 1 ? '待报废' : '已报废' }}</span>
      </el-col>
      <el-col :span="8">
        <span>创建人:</span>
        <span>{{ detail.buyerName }}</span>
        <span>{{ detail.operatorName }}</span>
      </el-col>
      <el-col :span="8">
        <span>报废时间:</span>
        <span>{{ detail.incomeTime | formatTime }}</span>
      </el-col>
    </el-row>
    <el-row :gutter="20" style="margin-top: 20px">
      <el-col class="img-row" :span="12">
        <span>报废类型:</span>
        <span>{{ detail.buyType == 1 ? '集采' : '自采' }}</span>
        <span>{{ detail.dealTime | formatTime }}</span>
      </el-col>
    </el-row>
    <el-row :gutter="20" style="margin-top: 20px">
      <el-col class="img-row" :span="24">
        <span>报废手续照片:</span>
        <span>报废手续:</span>
        <div class="img-box" v-for="(item, index) in fileList" :key="index" @click="handlePreview(item)">
          <img class="img" :src="getUrl(item.path)" alt="" />
        </div>
      </el-col>
    </el-row>
    <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.procureGoods" :key="goodsIndex">
    <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.scrappedGoods" :key="goodsIndex">
      <el-row :gutter="20">
        <el-col :span="8">
          <span>物品分类:</span>
          <span>{{ goodsItem.baseCategoryName }}</span>
          <span>{{ goodsItem.categoryName }}</span>
        </el-col>
        <el-col :span="8">
          <span>物品名称:</span>
          <span>{{ goodsItem.goodsTemplateName }}</span>
        </el-col>
        <el-col :span="8">
          <span>供货商:</span>
          <span>{{ goodsItem.supplier }}</span>
          <span>{{ goodsItem.goodsName }}</span>
        </el-col>
      </el-row>
      <el-table :data="goodsItem.models" :stripe="true" style="margin-top: 20px">
        <el-table-column prop="baseGoodsModelsName" label="规格型号" align="center">
          <template slot-scope="scope">
            {{ scope.row.baseGoodsModelsName }}
          </template>
        </el-table-column>
        <el-table-column label="单位" align="center">
          <template slot-scope="scope">
            {{ scope.row.unit }}
          </template>
        </el-table-column>
        <el-table-column prop="price" label="单价" align="center">
          <template slot-scope="scope">
            {{ scope.row.price }}
          </template>
        </el-table-column>
        <el-table-column prop="counts" label="报废数量" align="center">
          <template slot-scope="scope">
            {{ scope.row.counts }}
          </template>
        </el-table-column>
        <el-table-column prop="counts" label="金额" align="center">
          <template slot-scope="scope">
            {{ (scope.row.price * scope.row.counts).toFixed(2) }}
          </template>
        </el-table-column>
        <el-table-column prop="baseGoodsModelsName" label="规格型号" align="center"></el-table-column>
        <el-table-column label="单位" prop="unit" align="center"></el-table-column>
        <el-table-column prop="counts" label="报废数量" align="center"></el-table-column>
        <el-table-column prop="scrappedName" label="报废原因" align="center"></el-table-column>
      </el-table>
    </div>
    <div id="uploadPreviewImages" style="display: none">
@@ -99,12 +64,13 @@
  </win-md>
</template>
<script>
import { procureDetail } from '@/api/stock/procure/purchaseOrder';
import {scrappedDetail} from '@/api/stock/scrap';
import winMd from '@/components/win/win-md';
import * as DateFormatter from '@/utils/DateFormatter';
import { getDownUrl } from '@/utils/base';
import {getDownUrl} from '@/utils/base';
import Viewer from 'viewerjs';
import 'viewerjs/dist/viewer.css';
import {getDicts} from '@/api/system/dict/data';
let viewer = null;
@@ -119,19 +85,19 @@
  },
  data() {
    return {
      scrapReasonOptions: [],
      fileList: [],
      detail: {
        baseCategoryName: '',
        businessFormCode: '',
        goodsTemplateName: '',
        procureDoc: '',
        uploadFiles: '',
        agencyId: '',
        agencyName: '',
        states: '',
        createName: '',
        time: '',
        procureGoods: [{}, {}],
        fileKey: Math.random(),
        scrappedGoods: [],
      },
    };
  },
@@ -142,15 +108,22 @@
    },
  },
  created() {
    procureDetail({ id: this.setting.id }).then((res) => {
    scrappedDetail({ id: this.setting.id }).then((res) => {
      this.detail = res;
      this.fileList = this.detail.procureDoc ? JSON.parse(this.detail.procureDoc) : [];
      this.fileList = this.detail.uploadFiles ? JSON.parse(this.detail.uploadFiles) : [];
      this.$nextTick(() => {
        this.initPreviewImg();
      });
    });
    getDicts('SCRAP_REASON').then((res) => {
      this.scrapReasonOptions = res;
    });
  },
  methods: {
    getDictName(code) {
      let item = this.scrapReasonOptions.find(v=>v.dict_value==code)
      return item ? item.dict_label : ''
    },
    initPreviewImg() {
      if (viewer != null) {
        viewer.destroy();
@@ -172,12 +145,6 @@
          index++;
        }
      }
      // this.fileList.forEach((f, i) => {
      //   if (file.uid == f.uid) {
      //     index = i
      //   }
      // })
      // document.querySelector('#uploadPreviewImages').children[0].click()
      viewer.view(index);
    },
    checkImg(name) {
@@ -203,10 +170,4 @@
</script>
<style lang="scss" scoped>
@import url(../../index.scss);
.el-dialog {
  z-index: 1100 !important;
}
>>> .el-dialog {
  z-index: 1100 !important;
}
</style>