| | |
| | | <template> |
| | | <BasicModal width="1200px" :height=600 v-bind="$attrs" ok-text="保存" @register="register" :title="t('导入工单料站表')" |
| | | <BasicModal width="1200px" :height=400 v-bind="$attrs" ok-text="保存" @register="register" :title="t('导入工单料站表')" |
| | | @ok="handleSubmit"> |
| | | <ImpExcel style="width: 100px;" @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> |
| | | <a-button style="position:relative;left: 100px;" @click="aoaToExcel" class="m-3"> 模板 </a-button> |
| | | <ImpExcel style="width: 100px; position: relative; top:-56px" @success="loadDataSuccess" dateFormat="YYYY-MM-DD"> |
| | | <a-button class="m-3"> 导入Excel </a-button> |
| | | |
| | | </ImpExcel> |
| | | |
| | | <p style="color: red;" v-text="err"></p> |
| | | <a-card :title="t('列表')" :bordered="false" class="!mt-5"> |
| | | <div> |
| | | <a-card style="position: relative;top:-55px" :title="t('列表')" :bordered="false"> |
| | | <!-- :columns="dtlColumns" |
| | | :dataSource="data" --> |
| | | <PageWrapper dense contentFullHeight contentClass="flex"> |
| | | <BasicTable v-for="(table, index) in tableListRef" :key="index" :title="table.title" :columns="table.columns" |
| | | <PageWrapper :minHeight="300" dense contentFullHeight contentClass="flex"> |
| | | <BasicTable :maxHeight="200" v-for="(table, index) in tableListRef" :key="index" :title="table.title" :columns="table.columns" |
| | | :dataSource="table.dataSource" /> |
| | | </PageWrapper> |
| | | </div> |
| | | </a-card> |
| | | </a-card> |
| | | </BasicModal> |
| | | </template> |
| | | <script lang="ts"> |
| | | import { defineComponent, ref, nextTick, unref } from 'vue'; |
| | | import { defineComponent, ref, nextTick, unref,h } from 'vue'; |
| | | import { Tag ,Tooltip} from 'ant-design-vue'; |
| | | import { BasicModal, useModalInner } from '/@/components/Modal'; |
| | | import { BasicForm, FormSchema, useForm } from '/@/components/Form/index'; |
| | | import { SaveSmttable, ExportTable,SaveExportTable } from '/@/api/tigerapi/mes/smt/smttable'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { aoaToSheetXlsx } from '/@/components/Excel'; |
| | | import { useMessage } from '/@/hooks/web/useMessage'; |
| | | import { useLocale } from '/@/locales/useLocale'; |
| | | import { PageWrapper } from '/@/components/Page'; |
| | |
| | | meta: { sheetName }, |
| | | } = excelData; |
| | | const columns: BasicColumn[] = []; |
| | | columns.push({title:"处理方式",dataIndex:"处理方式"}); |
| | | columns.push({title:"处理方式",dataIndex:"处理方式",customRender: ({ record }) => { |
| | | const status = record.处理方式; |
| | | var text = ''; |
| | | var color = ''; |
| | | if(status=='数据异常'){ |
| | | color='red' |
| | | text=status |
| | | } |
| | | else{ |
| | | text=status |
| | | } |
| | | return h(Tooltip, { title: 'xxxxxx' }, () => h(Tag, { color: color }, () => text)); |
| | | },}); |
| | | columns.push({title:'原因',dataIndex:'原因'}) |
| | | for (const title of header) { |
| | | columns.push({ title, dataIndex: title }); |
| | | } |
| | | tableListRef.value.push({ title: sheetName, dataSource: results, columns }); |
| | | |
| | | } |
| | | console.log('console.log(tableListRef.value);',tableListRef.value); |
| | | var res=await ExportTable(tableListRef.value) |
| | |
| | | // function handleVisibleChange(v) { |
| | | // v && props.userData && nextTick(() => onDataReceive(props.userData)); |
| | | // } |
| | | |
| | | //导出 |
| | | function aoaToExcel() { |
| | | const arrHeader = ["关联工单号","产品编码","物料编码","替代料","单位","单位用量","产线编码", |
| | | "贴片机编码","贴片机编码","钢网编码","站位号","贴片位置","飞达编码","飞达类型","加工面","上料顺序", |
| | | "创建人","创建时间"]; |
| | | aoaToSheetXlsx({ |
| | | data: '', |
| | | header: arrHeader, |
| | | filename: '工单料站表信息.xlsx', |
| | | }); |
| | | } |
| | | async function handleSubmit() { |
| | | try { |
| | | const values = tableListRef.value; |
| | |
| | | } |
| | | } |
| | | |
| | | return { register, model: modelRef, handleSubmit, loadDataSuccess, tableListRef,err,t }; |
| | | return { register, model: modelRef, handleSubmit, loadDataSuccess, tableListRef,err,t,aoaToExcel }; |
| | | }, |
| | | }); |
| | | </script> |