|
|
@@ -0,0 +1,200 @@
|
|
|
+<template>
|
|
|
+ <div class="table-card">
|
|
|
+ <div class="mobile-table-content">
|
|
|
+ <div class="mobile-table" v-for="(item, rowIdx) in list.length === 0 ? firstData : list" :key="rowIdx">
|
|
|
+ <a-row>
|
|
|
+ <a-col v-for="(col, colIdx) in columns" :key="colIdx" :span="8">
|
|
|
+ <div class="mobile-table-item">
|
|
|
+ <div class="mobile-table-item-content" v-if="col.dataIndex === 'sequence_index_number'">
|
|
|
+ <div>
|
|
|
+ <span>
|
|
|
+ {{ col.title }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <a-tag>{{ rowIdx + 1 }}</a-tag>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="mobile-table-item-content" v-if="col.dataIndex === 'dynamic-opr-button'">
|
|
|
+ <div class="mob-label">
|
|
|
+ <span>
|
|
|
+ {{ col.title }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <a-button v-if="!disabled" type="dashed" @click="removeDomain(item)" danger>
|
|
|
+ <template #icon>
|
|
|
+ <DeleteOutlined />
|
|
|
+ </template>
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+ <div class="mobile-table-item-content" v-if="['sequence_index_number', 'dynamic-opr-button'].indexOf(col.dataIndex) === -1">
|
|
|
+ <div class="mob-label">
|
|
|
+ <span
|
|
|
+ v-if="
|
|
|
+ record.list.find((item) => item.model == col.dataIndex) &&
|
|
|
+ record.list.find((item) => item.model == col.dataIndex).rules[0].required
|
|
|
+ "
|
|
|
+ style="color: #ff4d4f; margin-right: 4px"
|
|
|
+ >*</span
|
|
|
+ >
|
|
|
+ <span>
|
|
|
+ {{ col.title }}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="mobile-tanle-form-item">
|
|
|
+ <StFormModelItem
|
|
|
+ v-if="record.disableCell && record.disableCell.find((item) => item.y == col.dataIndex && item.x == rowIdx + 1)"
|
|
|
+ :record="record.list.find((item) => item.model == col.dataIndex)"
|
|
|
+ :config="config"
|
|
|
+ :parentDisabled="true"
|
|
|
+ :index="record.list.findIndex((item) => item.model == col.dataIndex)"
|
|
|
+ :domains="dynamicValidateForm.domains"
|
|
|
+ :dynamicData="dynamicData"
|
|
|
+ :formData="formData"
|
|
|
+ :formConfig="formConfig"
|
|
|
+ :childTableFieldRecord="record.list"
|
|
|
+ :rowIndex="rowIdx"
|
|
|
+ v-model:value="item[record.list.find((item) => item.model == col.dataIndex).model]"
|
|
|
+ @input="handleInput"
|
|
|
+ :columns="columns"
|
|
|
+ :pagination="pagination"
|
|
|
+ :currentTableData="currentTableData"
|
|
|
+ :colIndex="colIdx"
|
|
|
+ />
|
|
|
+ <StFormModelItem
|
|
|
+ v-else
|
|
|
+ :record="record.list.find((item) => item.model == col.dataIndex)"
|
|
|
+ :config="config"
|
|
|
+ :parentDisabled="disabled"
|
|
|
+ :index="record.list.findIndex((item) => item.model == col.dataIndex)"
|
|
|
+ :domains="dynamicValidateForm.domains"
|
|
|
+ :dynamicData="dynamicData"
|
|
|
+ :formData="formData"
|
|
|
+ :formConfig="formConfig"
|
|
|
+ :childTableFieldRecord="record.list"
|
|
|
+ :rowIndex="rowIdx"
|
|
|
+ v-model:value="item[record.list.find((item) => item.model == col.dataIndex).model]"
|
|
|
+ @input="handleInput"
|
|
|
+ :columns="columns"
|
|
|
+ :pagination="pagination"
|
|
|
+ :currentTableData="currentTableData"
|
|
|
+ :colIndex="colIdx"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <a-button type="dashed" style="width: 100%" v-show="isShowMoreBtn" @click="handleLoadMore"
|
|
|
+ >查看更多 (共有{{ dynamicValidateForm.domains.length }}条数据)
|
|
|
+ </a-button>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+ import StFormModelItem from '/@/views/flow/stFormDesign/packages/StBatch/module/StFormModelItem.vue';
|
|
|
+ import { DeleteOutlined } from '@ant-design/icons-vue';
|
|
|
+ import { isEmpty } from 'lodash';
|
|
|
+ import { computed, nextTick, ref, watch } from 'vue';
|
|
|
+
|
|
|
+ const props = defineProps([
|
|
|
+ 'formData',
|
|
|
+ 'dynamicData',
|
|
|
+ 'formConfig',
|
|
|
+ 'dynamicValidateForm',
|
|
|
+ 'firstData',
|
|
|
+ 'columns',
|
|
|
+ 'record',
|
|
|
+ 'disabled',
|
|
|
+ 'config',
|
|
|
+ 'pagination',
|
|
|
+ 'currentTableData',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ const list = ref([]);
|
|
|
+
|
|
|
+ const pageNum = ref(1);
|
|
|
+ const pageSize = ref(5);
|
|
|
+
|
|
|
+ const emits = defineEmits(['removeDomain', 'handleInput']);
|
|
|
+
|
|
|
+ const removeDomain = (item) => {
|
|
|
+ emits('removeDomain', item);
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleInput = (event) => {
|
|
|
+ emits('handleInput', event);
|
|
|
+ };
|
|
|
+ const handleLoadMore = () => {
|
|
|
+ refreshTableCard();
|
|
|
+ pageNum.value++;
|
|
|
+ };
|
|
|
+
|
|
|
+ const refreshTableCard = () => {
|
|
|
+ const startIndex = (pageNum.value - 1) * pageSize.value;
|
|
|
+ const endIndex = startIndex + pageSize.value;
|
|
|
+ list.value = props.dynamicValidateForm.domains.slice(0, endIndex);
|
|
|
+ };
|
|
|
+
|
|
|
+ const isShowMoreBtn = computed(() => {
|
|
|
+ return (
|
|
|
+ props.dynamicValidateForm.domains &&
|
|
|
+ props.dynamicValidateForm.domains.length > 1 &&
|
|
|
+ props.dynamicValidateForm.domains.length !== list.value.length
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+ defineExpose({
|
|
|
+ refreshTableCard
|
|
|
+ })
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+ .table-card {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: 10px;
|
|
|
+ background: #fff;
|
|
|
+ .mobile-table-content {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .mobile-table {
|
|
|
+ border: 1px solid rgba(#000, 0.1);
|
|
|
+ border-radius: 10px;
|
|
|
+ padding: 20px;
|
|
|
+
|
|
|
+ :deep(.ant-card-body) {
|
|
|
+ padding: 15px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .mobile-table-item {
|
|
|
+ width: 100%;
|
|
|
+
|
|
|
+ .mobile-table-item-content {
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ padding: 10px 0;
|
|
|
+ border-bottom: 1px solid #f0f0f0;
|
|
|
+
|
|
|
+ .mob-label {
|
|
|
+ width: 100px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .mobile-tanle-form-item {
|
|
|
+ width: calc(100% - 100px);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|