<script setup lang="ts">
import {reactive} from 'vue';
import layout from '/@/views/h5/layout/index.vue';
import {useRoute} from "vue-router";
import {getPropertyRightsByProcessInstanceIdAPI} from "/@/api/workbench/miOwLibr/ownershipCreate";
const route = useRoute();
interface showText {
	title?: string;
	label?: string;
	content?: string;
	key?: string;
	isFile?: boolean;
	isOneCol?:boolean;
	unit?: string;
	isTableTitle?: boolean;
	children?: showText[]
}

const showTextArray = reactive<showText[]>([
	{title:'填报说明', isFile: false, isOneCol:true},
	{label: '指标名称', content: '', key: 'indicatorName', isFile: false},
	{label: '指标代码', content: '', key: 'indicatorCode', isFile: false},
	{label: '指标描述', content: '', key: 'indicatorDescription', isFile: false, isOneCol:true},
	{title:'基本信息', isFile: false, isOneCol:true},
	{label: '企业名称', content: '', key: 'enterpriseName', isFile: false},
	{label: '统一社会信用代码/工商注册号', content: '', key: 'creditCode', isFile: false, isOneCol:true},
	{label: '设立注册日期', content: '', key: 'registrationDate', isFile: false},
	{label: '国家出资企业', content: '', key: 'stateOwnedEnterprise', isFile: false},
	{label: '是否国资主管单位', content: '', key: 'changeSupervisor', isFile: false},
	{label: '主要出资人名称', content: '', key: 'mainInvestorName', isFile: false},
	{label: '主要出资人统一社会信用代码', content: '', key: 'mainInvestorCode', isFile: false, isOneCol:true},
	{label: '主管单位', content: '', key: 'supervisorUnit', isFile: false},
	{label: '主管单位统一社会信用代码', content: '', key: 'supervisorUnitCode', isFile: false},
	{label: '所属部门', content: '', key: 'belongingDepartment', isFile: false},
	{label: '企业类别', content: '', key: 'enterpriseCategory', isFile: false},
	{label: '注册资本(万元人民币)', content: '', key: 'registeredCapital', isFile: false, unit:'万元'},
	{label: '企业分类', content: '', key: 'enterpriseClassification', isFile: false},
	{label: '监管机构', content: '', key: 'regulatoryAgency', isFile: false},
	{label: '与国家出资企业关系', content: '', key: 'relationStateEnterprise', isFile: false},
	{label: '组织形式', content: '', key: 'organizationForm', isFile: false},
	{label: '企业产权级次', content: '', key: 'propertyLevel', isFile: false},
	{label: '经营状况', content: '', key: 'operationStatus', isFile: false},
	{label: '产权登记情况', content: '', key: 'propertyRegistrationCase', isFile: false},
	{label: '进场交易', content: '', key: 'marketTransaction', isFile: false},
	{label: '是否上市公司', content: '', key: 'isListedCompany', isFile: false},
	{label: '是否并表', content: '', key: 'isConsolidated', isFile: false},
	{label: '是否以持股为主要经营目的', content: '', key: 'isHoldingMainBusiness', isFile: false},
	{label: '是否境外转境内企业', content: '', key: 'isOverseasToDomestic', isFile: false},
	{label: '主业', content: '', key: 'mainBusiness', isFile: false},
	{label: '辅业', content: '', key: 'auxiliaryBusiness', isFile: false},
	{label: '主要行业', content: '', key: 'mainIndustry', isFile: false},
	{label: '经营规模', content: '', key: 'operationScale', isFile: false},
	{label: '混改情况', content: '', key: 'mixedReformSituation', isFile: false, isOneCol:true},
	{label: '注册地', content: '', key: 'registrationAddress', isFile: false, isOneCol:true},
	{label: '变动原因', content: '', key: 'changeReason', isFile: false, isOneCol:true},
	{title:'合规性资料目录', isFile: false, isOneCol:true},
	{label: '经济行为决策或批复文件', content: '', key: 'decisionDocument', isFile: true,isOneCol:true},
	{label: '企业法人营业执照', content: '', key: 'businessLicense', isFile: true,isOneCol:true},
	{label: '企业章程', content: '', key: 'enterpriseCharter', isFile: true,isOneCol:true},
	{label: '最近一期审计公告', content: '', key: 'latestAuditReport', isFile: true,isOneCol:true},
	{label: '非货币出资资产评估备案表准文件', content: '', key: 'assetAssessmentFiling', isFile: true,isOneCol:true},
	{label: '业务办理申请文件', content: '', key: 'businessApplicationFile', isFile: true,isOneCol:true},
	{label: '其他', content: '', key: 'otherMaterials', isFile: true,isOneCol:true},
	{title:'股东出资信息', isFile: false, isOneCol:true},
])
const showTextArrayTable = reactive<showText[]>(	[
	{label:'股东信息',children:[
			{label: '股东名称', content: '', key: 'shareholderName', isFile: false},
			{label: '统一社会信用代码', content: '', key: 'creditCode', isFile: false},
			{label: '出资人类别', content: '', key: 'investorCategory', isFile: false},
			{label: '股东性质', content: '', key: 'shareholderNature', isFile: false},
			{label: '监管区域', content: '', key: 'regulatoryRegion', isFile: false},
			{label: '国别', content: '', key: 'country', isFile: false},
			{label: '实缴资本(万元)', content: '', key: 'paidCapital', isFile: false, unit: '万元'},
			{label: '认缴资本(万元)', content: '', key: 'subscribedCapital', isFile: false, unit: '万元'},
			{label: '股权比例(%)', content: '', key: 'equityRatio', isFile: false, unit: '%'},
			{label: '合计', content: '', key: 'totalAmount', isFile: false},
		]},
	{label:'认缴明细信息',children:[
			{label: '币种', content: '', key: 'subscribeCurrency', isFile: false},
			{label: '认缴出资金额(万元)', content: '', key: 'subscribeAmount', isFile: false, unit: '万元'},
			{label: '认缴出资日期', content: '', key: 'subscribeDate', isFile: false},
		]},
		{label:'实缴明细信息',children:[
				{label: '币种', content: '', key: 'paidCurrency', isFile: false},
				{label: '实缴出资金额(万元)', content: '', key: 'paidAmount', isFile: false, unit: '万元'},
				{label: '实缴出资日期', content: '', key: 'paidDate', isFile: false},
		]},
		{label:'填表说明',children:[
				{label: '指标名称', content: '', key: 'indicatorName', isFile: false},
				{label: '指标代码', content: '', key: 'indicatorCode', isFile: false},
				{label: '指标描述', content: '', key: 'indicatorDescription', isFile: false, isOneCol: true},
		]},
		{label:'实收资本',children:[
				{label: '国家出资', content: '', key: 'stateCapital', isFile: false, unit: '万元'},
				{label: '国有法人出资', content: '', key: 'stateLegalCapital', isFile: false, unit: '万元'},
				{label: '国有绝对控股法人出资', content: '', key: 'stateAbsoluteControlCapital', isFile: false, unit: '万元'},
				{label: '国有实际控股法人出资', content: '', key: 'stateActualControlCapital', isFile: false, unit: '万元'},
				{label: '国有参股出资人', content: '', key: 'stateEquityCapital', isFile: false, unit: '万元'},
				{label: '其他', content: '', key: 'otherCapital', isFile: false, unit: '万元'},
				{label: '合计', content: '', key: 'capitalTotal', isFile: false, unit: '万元'}
		]}
])
const showTextArrayTable2 = reactive<showText[]>([
	{ label: '非货币资产类别', content: '', key: 'nonMonetaryAssetCategory', isFile: false },
	{ label: '出资方', content: '', key: 'investor', isFile: false },
	{ label: '出资作价（万元）', content: '', key: 'investmentValuation', isFile: false, unit: '万元' },
	{ label: '评估值（万元）', content: '', key: 'assessmentValue', isFile: false, unit: '万元' },
	{ label: '备注', content: '', key: 'remark', isFile: false, isOneCol: true },
	{ label: '合计', content: '', key: 'totalAmount', isFile: false }
])
const showTextArrayTable3 = reactive<showText[]>([
	{ label: '名称', content: '', key: 'employeeName', isFile: false },
	{ label: '所持金额（万元）', content: '', key: 'holdingAmount', isFile: false, unit: '万元' },
	{ label: '持股比例', content: '', key: 'shareRatio', isFile: false , unit: '%'},
	{ label: '备注', content: '', key: 'remark', isFile: false, isOneCol: true }
])
const showTextArrayTable4 = reactive<showText[]>([
	{ label: '投资标的名称', content: '', key: 'investmentTargetName', isFile: false },
	{ label: '统一社会信用代码', content: '', key: 'creditCode', isFile: false },
	{ label: '经营状态', content: '', key: 'operationStatus', isFile: false },
	{ label: '标的类型', content: '', key: 'targetType', isFile: false },
	{ label: '是否实际控制', content: '', key: 'isActualControl', isFile: false },
	{ label: '所属行业', content: '', key: 'industry', isFile: false },
	{ label: '对外所投区域', content: '', key: 'investmentRegion', isFile: false },
	{ label: '投资额（万元）', content: '', key: 'investmentAmount', isFile: false, unit: '万元' },
	{ label: '投资比例（百分比）', content: '', key: 'investmentRatio', isFile: false, unit: '%' }
])
const testData = {
  indicatorName: '产权登记指标',
  indicatorCode: 'PR-2024-001',
  indicatorDescription: '国有企业产权登记相关信息',
  enterpriseName: 'XX市智慧城市科技有限公司',
  creditCode: '91310000123456789A',
  registrationDate: '2020-05-15',
  stateOwnedEnterprise: 'XX市国资委',
  changeSupervisor: '否',
  mainInvestorName: 'XX市城市建设投资集团',
  mainInvestorCode: '91310000123456789B',
  supervisorUnit: 'XX市国资委',
  supervisorUnitCode: '123456789012345678',
  belongingDepartment: '投资发展部',
  enterpriseCategory: '国有控股企业',
  registeredCapital: '5000',
  enterpriseClassification: '一级企业',
  regulatoryAgency: 'XX市国资委',
  relationStateEnterprise: '全资子公司',
  organizationForm: '有限责任公司',
  propertyLevel: '二级',
  operationStatus: '正常经营',
  propertyRegistrationCase: '新设登记',
  marketTransaction: '是',
  isListedCompany: '否',
  isConsolidated: '是',
  isHoldingMainBusiness: '否',
  isOverseasToDomestic: '否',
  mainBusiness: '智慧城市解决方案',
  auxiliaryBusiness: '软件开发',
  mainIndustry: '信息技术服务业',
  operationScale: '大型',
  mixedReformSituation: '已完成混合所有制改革，引入民营资本30%',
  registrationAddress: 'XX市高新区科技大道88号',
  changeReason: '新设企业',
  decisionDocument: '/attachments/decision-document.pdf',
  businessLicense: '/attachments/business-license.pdf',
  enterpriseCharter: '/attachments/enterprise-charter.pdf',
  latestAuditReport: '/attachments/audit-report.pdf',
  assetAssessmentFiling: '/attachments/assessment-filing.pdf',
  businessApplicationFile: '/attachments/application-file.pdf',
  otherMaterials: '/attachments/other-materials.pdf',

  // 股东出资信息列表
  shareholderInvestmentEntities: [
    {
      shareholderName: 'XX市城市建设投资集团有限公司',
      creditCode: '91310000123456789B',
      investorCategory: '国有法人',
      shareholderNature: '国有控股股东',
      regulatoryRegion: 'XX市',
      country: '中国',
      paidCapital: '3500',
      subscribedCapital: '3500',
      equityRatio: '70',
      totalAmount: '3500',
      subscribeCurrency: '人民币',
      subscribeAmount: '3500',
      subscribeDate: '2020-05-10',
      paidCurrency: '人民币',
      paidAmount: '3500',
      paidDate: '2020-05-15',
      stateCapital: '3500',
      stateLegalCapital: '0',
      stateAbsoluteControlCapital: '0',
      stateActualControlCapital: '0',
      stateEquityCapital: '0',
      otherCapital: '1500',
      capitalTotal: '5000',
      indicatorName: '股东出资指标',
      indicatorCode: 'SH-2024-001',
      indicatorDescription: '股东出资详细信息'
    }
  ],

  // 非货币资产信息列表
  shareholderNonMonetaryEntities: [
    {
      nonMonetaryAssetCategory: '知识产权',
      investor: 'XX科技集团有限公司',
      investmentValuation: '500',
      assessmentValue: '500',
      remark: '软件著作权作为出资',
      totalAmount: '500'
    }
  ],

  // 员工持股信息列表
  employeeNomineeHoldingEntities: [
    {
      employeeName: '核心技术团队',
      holdingAmount: '200',
      shareRatio: '4',
      remark: '限制性股票激励计划'
    }
  ],

  // 对外投资信息列表
  outboundInvestmentEntities: [
    {
      investmentTargetName: 'XX云计算服务有限公司',
      creditCode: '91310000987654321C',
      operationStatus: '正常经营',
      targetType: '股权投资',
      isActualControl: '否',
      industry: '云计算服务',
      investmentRegion: '华东地区',
      investmentAmount: '1000',
      investmentRatio: '20'
    }
  ]
};
const processInstanceId = ref(route.query.processInstanceId as string)
getPropertyRightsByProcessInstanceIdAPI(processInstanceId.value).then(res => {
	Object.assign(testData,res.data)
})
</script>

<template>
	<layout title="产权管理审核" task-id="" :process-instance-id="processInstanceId">
		<div class="investment-list" >
			<div class="investment-item" v-for="item in showTextArray" :key="item.key" :class="item.isOneCol ? 'one-col' : ''">
				<div class="title" v-if="item.title">{{item.title}}</div>
				<div class="label">{{item.label}}</div>
				<div class="content">
					<upload-file v-if="item.isFile" v-model="testData[item.key]" disabled/>
					<div v-else><span>{{testData[item.key]}}</span><span v-if="item.unit">{{item.unit}}</span></div>
				</div>
			</div>
		</div>
		<el-table :data="testData.shareholderInvestmentEntities" border style="width: 100%" height="300" :header-cell-style="{textAlign: 'center'}">
			<el-table-column type="index" label="序号" width="60"></el-table-column>
			<el-table-column v-for="item in showTextArrayTable" :key="item?.key" :label="item?.label" min-width="150"

			>
				<template #default="scope">
					<div v-if="item.isFile">
						<upload-file v-model="scope.row[item.key]" disabled/>
					</div>
					<div v-else>
						<span>{{scope.row[item?.key]}}</span>
						<span v-if="item.unit">{{item.unit}}</span>
					</div>
					<template v-if="item.children">
						<el-table-column v-for="child in item.children" :key="child?.key" :label="child?.label" min-width="150">
							<template #default="scope1">
								<div v-if="item.isFile">
									<upload-file v-model="scope1.row[child.key]" disabled/>
								</div>
								<div v-else>
									<span>{{scope1.row[child?.key]}}</span>
									<span v-if="child.unit">{{child.unit}}</span>
								</div>
							</template>
						</el-table-column>
					</template>
				</template>

			</el-table-column>
		</el-table>
		<div class="investment-list" >
			<div class="investment-item one-col">
				<div class="title" >股东出资信息（非货币）</div>
			</div>
		</div>
		<el-table :data="testData.shareholderNonMonetaryEntities" border style="width: 100%" height="300"  :header-cell-style="{textAlign: 'center'}">
			<el-table-column type="index" label="序号" width="60"></el-table-column>
			<el-table-column v-for="item in showTextArrayTable2" :key="item?.key" :label="item?.label" min-width="150">
				<template #default="scope">
					<div v-if="item.isFile">
						<upload-file v-model="scope.row[item.key]" disabled/>
					</div>
					<div v-else>
						<span>{{scope.row[item?.key]}}</span>
						<span v-if="item.unit">{{item.unit}}</span>
					</div>
				</template>
			</el-table-column>
		</el-table>
		<div class="investment-list" >
			<div class="investment-item one-col">
				<div class="title" >员工代持</div>
			</div>
		</div>
			<el-table :data="testData.employeeNomineeHoldingEntities" border style="width: 100%" height="300"  :header-cell-style="{textAlign: 'center'}">
			<el-table-column type="index" label="序号" width="60"></el-table-column>
			<el-table-column v-for="item in showTextArrayTable3" :key="item?.key" :label="item?.label" min-width="150">
				<template #default="scope">
					<div v-if="item.isFile">
						<upload-file v-model="scope.row[item.key]" disabled/>
					</div>
					<div v-else>
						<span>{{scope.row[item?.key]}}</span>
						<span v-if="item.unit">{{item.unit}}</span>
					</div>
				</template>
			</el-table-column>
		</el-table>
		<div class="investment-list" >
			<div class="investment-item one-col">
				<div class="title" >对外投资情况</div>
			</div>
		</div>
			<el-table :data="testData.outboundInvestmentEntities" border style="width: 100%" height="300" :header-cell-style="{textAlign: 'center'}">
			<el-table-column type="index" label="序号" width="60"></el-table-column>
			<el-table-column v-for="item in showTextArrayTable4" :key="item?.key" :label="item?.label" min-width="150">
				<template #default="scope">
					<div v-if="item.isFile">
						<upload-file v-model="scope.row[item.key]" disabled/>
					</div>
					<div v-else>
						<span>{{scope.row[item?.key]}}</span>
						<span v-if="item.unit">{{item.unit}}</span>
					</div>
				</template>
			</el-table-column>
		</el-table>
	</layout>
</template>

<style scoped lang="scss">
.investment-list {
	display: flex;
	flex-wrap: wrap;
	font-size: 14px;
	box-sizing: border-box;

}
.investment-list .investment-item {
	width: 50%;
	margin: 8px 0;
	box-sizing: border-box;
}
.investment-list .investment-item .title {
	width: 100%;
	font-size: 16px;
	font-weight: 700;
}
.investment-list .investment-item .label {
	color: #858585;
	padding: 0;
	margin-bottom: 5px;
	text-align: left;
	box-sizing: border-box;
}
.investment-list .investment-item .content {
	color: #333333;
	line-height: 1;
}
.investment-list .one-col {
	width: 100%;
}
</style>