|  | @@ -0,0 +1,242 @@
 | 
	
		
			
				|  |  | +<template>
 | 
	
		
			
				|  |  | +  <!-- <el-dialog
 | 
	
		
			
				|  |  | +    title="查看"
 | 
	
		
			
				|  |  | +    width="70%"
 | 
	
		
			
				|  |  | +    :close-on-click-modal="false"
 | 
	
		
			
				|  |  | +    :visible.sync="visible"> -->
 | 
	
		
			
				|  |  | +  <div>
 | 
	
		
			
				|  |  | +    <div class="my-title" v-if="!prodVisible">查看</div>
 | 
	
		
			
				|  |  | +    <div v-if="!prodVisible" style="margin-left: 20px;margin-right: 20px">
 | 
	
		
			
				|  |  | +      <!-- 工作流 -->
 | 
	
		
			
				|  |  | +      <div v-show="dataForm.workFlowBusinessExt">
 | 
	
		
			
				|  |  | +        <el-steps :active="dataForm.workFlowBusinessExt&&dataForm.workFlowBusinessExt.workFlowProcessStepList?dataForm.workFlowBusinessExt.workFlowProcessStepList.length + 2:0" align-center style="margin-bottom: 20px">
 | 
	
		
			
				|  |  | +          <template v-for="(item, i) in stepList">
 | 
	
		
			
				|  |  | +            <el-step :icon="item.icon" :title="item.title" :description="item.description"></el-step>
 | 
	
		
			
				|  |  | +          </template>
 | 
	
		
			
				|  |  | +        </el-steps>
 | 
	
		
			
				|  |  | +        <el-collapse style="margin-bottom: 20px">
 | 
	
		
			
				|  |  | +          <el-collapse-item>
 | 
	
		
			
				|  |  | +            <template slot="title">
 | 
	
		
			
				|  |  | +              <span style="color: red">审批日志(展开查看更多):</span>
 | 
	
		
			
				|  |  | +            </template>
 | 
	
		
			
				|  |  | +            <template v-for="(item, i) in logList">
 | 
	
		
			
				|  |  | +              <div>{{++i}}:{{item.approverName}}  {{item.createTime}}  {{item.approvalValue}}</div>
 | 
	
		
			
				|  |  | +            </template>
 | 
	
		
			
				|  |  | +          </el-collapse-item>
 | 
	
		
			
				|  |  | +        </el-collapse>
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +      <div v-show="isFlow">
 | 
	
		
			
				|  |  | +        <approve-component ref="approve" @approveFinished="approveFinished"/>
 | 
	
		
			
				|  |  | +      </div>
 | 
	
		
			
				|  |  | +      <e-desc title="基本信息" column="3">
 | 
	
		
			
				|  |  | +        <e-desc-item label="公司订单编码">{{dataForm.orderCode}}</e-desc-item>
 | 
	
		
			
				|  |  | +        <e-desc-item label="客户订单编码">{{dataForm.cusOrderCode}}</e-desc-item>
 | 
	
		
			
				|  |  | +        <e-desc-item label="客户名称">{{dataForm.customerName}}</e-desc-item>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <e-desc-item label="业务员">{{dataForm.salesmanName}}</e-desc-item>
 | 
	
		
			
				|  |  | +        <e-desc-item label="合同编号">{{dataForm.contractCode}}</e-desc-item>
 | 
	
		
			
				|  |  | +        <e-desc-item label="交货日期">{{dataForm.deliveryDate ? dataForm.deliveryDate.substring(0,10) : ''}}</e-desc-item>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <e-desc-item label="备注说明" span="3">{{dataForm.notes}}</e-desc-item>
 | 
	
		
			
				|  |  | +      </e-desc>
 | 
	
		
			
				|  |  | +      
 | 
	
		
			
				|  |  | +      <e-desc title="订单产品明细">
 | 
	
		
			
				|  |  | +        <el-table
 | 
	
		
			
				|  |  | +          :data="productDetails"
 | 
	
		
			
				|  |  | +          border
 | 
	
		
			
				|  |  | +          style="width: 100%;">
 | 
	
		
			
				|  |  | +          <el-table-column
 | 
	
		
			
				|  |  | +            label="序号"
 | 
	
		
			
				|  |  | +            type="index"
 | 
	
		
			
				|  |  | +            width="50"
 | 
	
		
			
				|  |  | +            align="center">
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column
 | 
	
		
			
				|  |  | +            prop="productName"
 | 
	
		
			
				|  |  | +            header-align="center"
 | 
	
		
			
				|  |  | +            align="center"
 | 
	
		
			
				|  |  | +            min-width="140"
 | 
	
		
			
				|  |  | +            :show-tooltip-when-overflow="true"
 | 
	
		
			
				|  |  | +            label="产品名称">
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column
 | 
	
		
			
				|  |  | +            prop="prodCode"
 | 
	
		
			
				|  |  | +            header-align="center"
 | 
	
		
			
				|  |  | +            align="center"
 | 
	
		
			
				|  |  | +            min-width="120"
 | 
	
		
			
				|  |  | +            :show-tooltip-when-overflow="true"
 | 
	
		
			
				|  |  | +            label="产品编号">
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column
 | 
	
		
			
				|  |  | +            prop="state"
 | 
	
		
			
				|  |  | +            header-align="center"
 | 
	
		
			
				|  |  | +            align="center"
 | 
	
		
			
				|  |  | +            :formatter="formatState"
 | 
	
		
			
				|  |  | +            :show-tooltip-when-overflow="true"
 | 
	
		
			
				|  |  | +            label="状态">
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column
 | 
	
		
			
				|  |  | +            prop="startTime"
 | 
	
		
			
				|  |  | +            header-align="center"
 | 
	
		
			
				|  |  | +            align="center"
 | 
	
		
			
				|  |  | +            :show-tooltip-when-overflow="true"
 | 
	
		
			
				|  |  | +            label="开始时间">
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column
 | 
	
		
			
				|  |  | +            prop="endTime"
 | 
	
		
			
				|  |  | +            header-align="center"
 | 
	
		
			
				|  |  | +            align="center"
 | 
	
		
			
				|  |  | +            :show-tooltip-when-overflow="true"
 | 
	
		
			
				|  |  | +            label="完成时间">
 | 
	
		
			
				|  |  | +          </el-table-column>
 | 
	
		
			
				|  |  | +          <el-table-column
 | 
	
		
			
				|  |  | +            fixed="right"
 | 
	
		
			
				|  |  | +            header-align="center"
 | 
	
		
			
				|  |  | +            align="center"
 | 
	
		
			
				|  |  | +            width="120"
 | 
	
		
			
				|  |  | +            label="操作">
 | 
	
		
			
				|  |  | +            <template slot-scope="scope">
 | 
	
		
			
				|  |  | +              <el-button type="text" v-if="isAuth('trace:search:prod:detail')" size="small" @click="prodDetailHandle(scope.row.id, scope.row.prodCode)">查看记录</el-button>
 | 
	
		
			
				|  |  | +  <!--            <el-button v-if="isAuth('order:ctl:deliver') && Number(scope.row.orderState) === 3" type="text" size="small" @click="deliverHandle(scope.row.orderId)">发货</el-button>-->
 | 
	
		
			
				|  |  | +  <!--            <el-button v-if="isAuth('order:ctl:arrived') && Number(scope.row.orderState) === 4 " type="text" size="small" @click="arrivedHandle(scope.row)">送达</el-button>-->
 | 
	
		
			
				|  |  | +            </template>
 | 
	
		
			
				|  |  | +        </el-table-column>
 | 
	
		
			
				|  |  | +        </el-table>
 | 
	
		
			
				|  |  | +      </e-desc>
 | 
	
		
			
				|  |  | +    </div>
 | 
	
		
			
				|  |  | +    <span class="dialog-footer">
 | 
	
		
			
				|  |  | +      <el-button @click="onChose">返回</el-button>
 | 
	
		
			
				|  |  | +    </span>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 弹窗, 新增 / 修改 -->
 | 
	
		
			
				|  |  | +    <product-detail v-if="prodVisible" ref="detail" @onChose="onChildClose"/>
 | 
	
		
			
				|  |  | +  </div>
 | 
	
		
			
				|  |  | +  <!-- </el-dialog> -->
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script>
 | 
	
		
			
				|  |  | +  import EDesc from '../common/e-desc'
 | 
	
		
			
				|  |  | +  import EDescItem from '../common/e-desc-item'
 | 
	
		
			
				|  |  | +  import { dealStepData, dealStepLogs } from '@/api/util'
 | 
	
		
			
				|  |  | +  import { getOrderDetailById } from '@/api/trace'
 | 
	
		
			
				|  |  | +  import uploadComponent from '../common/upload-component'
 | 
	
		
			
				|  |  | +  import ApproveComponent from '../common/approve-component'
 | 
	
		
			
				|  |  | +  import ProductDetail from './product-detail'
 | 
	
		
			
				|  |  | +  export default {
 | 
	
		
			
				|  |  | +    name: 'order-detail',
 | 
	
		
			
				|  |  | +    components: {
 | 
	
		
			
				|  |  | +      EDesc, EDescItem, uploadComponent, ApproveComponent, ProductDetail
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    data () {
 | 
	
		
			
				|  |  | +      return {
 | 
	
		
			
				|  |  | +        visible: false,
 | 
	
		
			
				|  |  | +        isFlow: false,
 | 
	
		
			
				|  |  | +        prodVisible: false,
 | 
	
		
			
				|  |  | +        id: 0,
 | 
	
		
			
				|  |  | +        dataForm: {},
 | 
	
		
			
				|  |  | +        productDetails: [],
 | 
	
		
			
				|  |  | +        stepList: [],
 | 
	
		
			
				|  |  | +        logList: [],
 | 
	
		
			
				|  |  | +        fileList: [],
 | 
	
		
			
				|  |  | +        // 状态:1:待排产,2:生产中,3:生产完成
 | 
	
		
			
				|  |  | +        optionsState: [
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            code: '1',
 | 
	
		
			
				|  |  | +            value: '待排产'
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            code: '2',
 | 
	
		
			
				|  |  | +            value: '生产中'
 | 
	
		
			
				|  |  | +          },
 | 
	
		
			
				|  |  | +          {
 | 
	
		
			
				|  |  | +            code: '3',
 | 
	
		
			
				|  |  | +            value: '生产完成'
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        ]
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    methods: {
 | 
	
		
			
				|  |  | +      onChose () {
 | 
	
		
			
				|  |  | +        this.$emit('onChose')
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      onChildClose () {
 | 
	
		
			
				|  |  | +        this.prodVisible = false
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      async init (id, businessType) {
 | 
	
		
			
				|  |  | +        this.visible = true
 | 
	
		
			
				|  |  | +        this.isFlow = !!(businessType && businessType !== '')
 | 
	
		
			
				|  |  | +        this.id = id || 0
 | 
	
		
			
				|  |  | +        this.dataForm = {
 | 
	
		
			
				|  |  | +          workFlowBusinessExt: null
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        this.productDetails = []
 | 
	
		
			
				|  |  | +        this.stepList = []
 | 
	
		
			
				|  |  | +        this.logList = []
 | 
	
		
			
				|  |  | +        this.fileList = []
 | 
	
		
			
				|  |  | +        this.getDetails(businessType)
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      getDetails (businessType) {
 | 
	
		
			
				|  |  | +        getOrderDetailById(this.id).then(({data}) => {
 | 
	
		
			
				|  |  | +          if (data && data.code === '200') {
 | 
	
		
			
				|  |  | +            this.dataForm = data.data
 | 
	
		
			
				|  |  | +            // 流程图展示
 | 
	
		
			
				|  |  | +            dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
 | 
	
		
			
				|  |  | +            dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
 | 
	
		
			
				|  |  | +            // 附件
 | 
	
		
			
				|  |  | +            if (data.data.attachList) {
 | 
	
		
			
				|  |  | +              data.data.attachList.forEach((item) => {
 | 
	
		
			
				|  |  | +                this.fileList.push({
 | 
	
		
			
				|  |  | +                  name: item.fileName,
 | 
	
		
			
				|  |  | +                  url: item.url,
 | 
	
		
			
				|  |  | +                  id: item.url
 | 
	
		
			
				|  |  | +                })
 | 
	
		
			
				|  |  | +              })
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // 订单产品明细
 | 
	
		
			
				|  |  | +            if (data.data.prodProductionList) {
 | 
	
		
			
				|  |  | +              this.productDetails = data.data.prodProductionList
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            // 初始化审批Form
 | 
	
		
			
				|  |  | +            this.showApproveForm(businessType, this.id)
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 初始化审批Form
 | 
	
		
			
				|  |  | +      showApproveForm (businessType, businessId) {
 | 
	
		
			
				|  |  | +        if (this.isFlow) {
 | 
	
		
			
				|  |  | +          this.$nextTick(() => {
 | 
	
		
			
				|  |  | +            this.$refs.approve.init(businessType, businessId)
 | 
	
		
			
				|  |  | +          })
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 审批完成
 | 
	
		
			
				|  |  | +      approveFinished () {
 | 
	
		
			
				|  |  | +        this.onChose()
 | 
	
		
			
				|  |  | +        this.$emit('approveFinished')
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 格式化产品状态
 | 
	
		
			
				|  |  | +      formatState (row) {
 | 
	
		
			
				|  |  | +        if (!row.state) return ''
 | 
	
		
			
				|  |  | +        const item1 = this.optionsState.find((item) => item.code === row.state.toString())
 | 
	
		
			
				|  |  | +        return item1 ? item1.value : ''
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +      // 查看产品记录
 | 
	
		
			
				|  |  | +      prodDetailHandle (productdId, prodCode) {
 | 
	
		
			
				|  |  | +        this.prodVisible = true
 | 
	
		
			
				|  |  | +        this.$nextTick(() => {
 | 
	
		
			
				|  |  | +          this.$refs.detail.init(productdId, prodCode)
 | 
	
		
			
				|  |  | +        })
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +</script>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<style scoped>
 | 
	
		
			
				|  |  | +.my-line{
 | 
	
		
			
				|  |  | +  border-bottom: 1px solid #c0c4cc;
 | 
	
		
			
				|  |  | +  margin-bottom: 10px;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +.title{
 | 
	
		
			
				|  |  | +  padding: 10px 0 ;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +</style>
 |