<template>
	<div class="diaClass">
		<!--		工作流引用  显示表单-->
		<!--		{{workflow.workId}}-->

    <el-card :body-style="cardBodyStyle">
      <el-form :model="insertForm" :rules="rules" label-width="110" label-position="right" :inline="true">
        <el-row :gutter="10">
          <el-col :span="6">
            <el-form-item label="定价编号">
              <el-input readonly v-model="insertForm.pricNo"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="录入人">
              <el-input readonly v-model="insertForm.addName"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="录入时间">
              <el-date-picker
                  disabled
                  style="width: 100%"
                  v-model="insertForm.addTime"
                  type="date"
                  value-format="YYYY-MM-DD"
                  placeholder=""
                  :size="size"
              />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="insertForm.remark" readonly></el-input>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
    </el-card>

    <el-tabs type="border-card">
      <el-tab-pane label="定价行数据">
        <el-card :body-style="cardBodyStyle">

          <el-table :data="tableDataWl" border highlight-current-row>
            <el-table-column type="index" label="行号" align="center" width="60">
              <template #default="scope">
                <span>{{ scope.$index + (currentPage - 1) * pageSize + 1 }}</span>
              </template>
            </el-table-column>
            <el-table-column v-if="true" prop="itemCd" label="物料编码" header-align="center" align="center"

                             show-overflow-tooltip>
              <template #header>
                <span style="color: red">*</span>物料编码
              </template>
              <template #default="scope">


              </template>
            </el-table-column>
            <el-table-column v-if="true" prop="itemNm" label="物料名称" header-align="center" align="center"

                             show-overflow-tooltip>
              <template #header>
                <span style="color: red">*</span>物料名称
              </template>

            </el-table-column>
            <el-table-column v-if="true" prop="startDt" label="开始执行期间" header-align="center" align="center"
                               show-overflow-tooltip>
              <template #header>
                <span style="color: red">*</span>开始执行期间
              </template>
              <template #default="scope">

                <el-date-picker
                    disabled
                    style="width: 100%"
                    v-model="scope.row.startDt"
                    type="datetime"
                    placeholder=""
                    :size="size"
                />

              </template>
            </el-table-column>
            <el-table-column v-if="true" prop="priceCash" label="现汇价格" header-align="center" align="center"

                             show-overflow-tooltip>
<!--              <template #header>-->
<!--                <span style="color: red">*</span>现汇价格-->
<!--              </template>-->
            </el-table-column>
            <el-table-column v-if="true" prop="priceBill" label="承兑价格" header-align="center" align="center"

                             show-overflow-tooltip>
<!--              <template #header>-->
<!--                <span style="color: red">*</span>承兑价格-->
<!--              </template>-->
            </el-table-column>
            <el-table-column v-if="true" prop="transTasteSci" label="规格(品位)%" header-align="center" align="center"

                             show-overflow-tooltip>
              <!--                <template #header>-->
              <!--                  <span style="color: red">*</span>承兑价格-->
              <!--                </template>-->
            </el-table-column>

          </el-table>
        </el-card>
      </el-tab-pane>
    </el-tabs>
    <el-tabs type="border-card">
      <el-tab-pane label="附件信息">
        <Attachment ref="AttachmentRefManual" :fId="fId" :uploadButton="false"></Attachment>
      </el-tab-pane>
    </el-tabs>
	</div>
</template>

<script setup>
	import {
		ref,
		reactive,
		onMounted,
		getCurrentInstance,
		nextTick
	} from 'vue'
	const {
		proxy
	} = getCurrentInstance()
	import style from '@/tools/style'
	const cardBodyStyle = ref(style.card)
	/**
	 * 新增表单form
	 */
	const insertForm = ref({
		id: '',

	})
  const tableDataWl = ref([])

	import {
		useWorkflowStore
	} from "@/stores/workflow"
	const workflow = useWorkflowStore()
  const dictList = ref({})
  const dictData = () => {
    var url = 'framework/Common/querySelectorList'
    var param = {
      type: JSON.stringify([ 'MEASURING_UNIT'])
    }
    proxy.$axios.get(url, param).then(response => {
      if (response.data.code == '0') {
        dictList.value = response.data.data
      } else {
        ElMessage.error('操作失败！' + response.data.msg)
      }
    })

  }
  const currentPage = ref(1)
  const pageSize = ref(10)
  const getFrom = () =>{
    var url = 'sal/UpriceHead/queryByWorkId'
    var param = {
      id: workflow.workId
    }
    proxy.$axios.get(url, param).then(response => {
      if (response.data.code == '0') {
        insertForm.value = response.data.data
        getTableLine(response.data.data.id)
        fId.value = response.data.data.id
      } else {
        ElMessage.error('操作失败！' + response.data.msg)
      }
    })
  }
  const getTableLine = (id) =>{
    var url = 'sal/UpriceLine/queryAll'
    var param = {
      params: JSON.stringify({id: id})
    }
    proxy.$axios.post(url, param).then(response => {
      if (response.data.code == 0) {
        tableDataWl.value = response.data.data.records
      } else {
        ElMessage({
          type: 'error',
          message: '操作失败' + response.data.msg
        });
      }
    });
  }
const fId = ref('')
	//
	onMounted(() => {
    dictData()
    getFrom()


	})
</script>

<style scoped>
::v-deep .el-form-item {
  width: 100%
}

::v-deep .el-dialog__body {
  background-color: #F2F6FC;
}

.el-date-editor--date {
  width: 100%;
}

::v-deep .diaClass .el-form-item__label {
  width: 140px !important;
}

</style>
