소스 검색

🎨 feat<报表管理>:数据录入禁用修改

xinyan 9 달 전
부모
커밋
d9ecb07d26
2개의 변경된 파일16개의 추가작업 그리고 10개의 파일을 삭제
  1. 13 7
      src/views/reportManage/dataCenter/normalDisplay/components/TableDataEntry.vue
  2. 3 3
      src/views/reportManage/dataCenter/utils/columns.ts

+ 13 - 7
src/views/reportManage/dataCenter/normalDisplay/components/TableDataEntry.vue

@@ -121,9 +121,9 @@ function setDefaultDate() {
       handleWeekChange();
       break;
     case 'month':
-      monthlyEntryTime.value = new Date();
-      startDate.value = dayjs(monthlyEntryTime.value).subtract(1, 'month').startOf('month').format('YYYY-MM-DD');
-      endDate.value = dayjs(monthlyEntryTime.value).subtract(1, 'month').endOf('month').format('YYYY-MM-DD');
+      monthlyEntryTime.value = dayjs().subtract(1, 'month').format('YYYY-MM-DD');
+      startDate.value = dayjs(monthlyEntryTime.value).startOf('month').format('YYYY-MM-DD');
+      endDate.value = dayjs(monthlyEntryTime.value).endOf('month').format('YYYY-MM-DD');
   }
 }
 
@@ -227,6 +227,7 @@ interface RowVO {
 const xGrid = ref<VxeGridInstance<RowVO>>();
 const originalDataMap = new Map();
 const currentScrollLeft = ref(0);
+const activeEditRow = ref(null);
 
 const gridOptions = reactive({
   border: 'inner',
@@ -273,7 +274,6 @@ const gridOptions = reactive({
 const gridEvents = {
   pageChange({ currentPage, pageSize }) {
     if (gridOptions.pagerConfig) {
-
       gridOptions.pagerConfig.currentPage = currentPage;
       gridOptions.pagerConfig.pageSize = pageSize;
     }
@@ -290,6 +290,7 @@ const hasActiveEditRow = (row: RowVO) => {
 };
 
 const clearRowEvent = (row: RowVO) => {
+  activeEditRow.value = false;
   const $grid = xGrid.value;
   if ($grid) {
     const originalData = originalDataMap.get(row.id);
@@ -302,6 +303,7 @@ const clearRowEvent = (row: RowVO) => {
 };
 
 const handelEditRow = (row: RowVO) => {
+  activeEditRow.value = true;
   const $grid = xGrid.value;
   if ($grid) {
     // 记录当前滚动条位置
@@ -428,7 +430,8 @@ function createDayDataRules() {
   if (dateType === 'day') {
     rules.ad_sales_original[0].required = false;
     rules.ad_cost_original[0].required = false;
-  } if (dateType === 'month') {
+  }
+  if (dateType === 'month') {
     rules.ad_sales_original[0].required = false;
     rules.ad_cost_original[0].required = false;
     rules.impression[0].required = false;
@@ -668,6 +671,7 @@ async function updateMonthData(row: RowVO) {
 }
 
 const editRowEvent = async (row: any) => {
+  activeEditRow.value = false;
   const $grid = xGrid.value;
   if ($grid) {
     if (dateType === 'day') {
@@ -820,9 +824,11 @@ onMounted(() => {
             <el-button link size="small" type="warning" @click="editRowEvent(row)">保存</el-button>
           </template>
           <template v-else>
-            <el-button :disabled="!row.id" link size="small" type="success" @click="handelEditRow(row)">修改</el-button>
+            <el-button :disabled="!row.id||activeEditRow" link size="small" type="success" @click="handelEditRow(row)">
+              修改
+            </el-button>
           </template>
-          <el-button v-if="!hasActiveEditRow(row)" :disabled="row.id" link size="small" type="primary"
+          <el-button v-if="!hasActiveEditRow(row)" :disabled="row.id||activeEditRow" link size="small" type="primary"
                      @click="editEvent(row)">创建
           </el-button>
         </template>

+ 3 - 3
src/views/reportManage/dataCenter/utils/columns.ts

@@ -200,7 +200,7 @@ export const monthColumns = ref([
         title: '销售额(本币)',
         editRender: {},
         slots: { edit: 'sales_original_edit' },
-        width: 123,
+        minWidth: 123,
       },
     ]
   },
@@ -212,7 +212,7 @@ export const monthColumns = ref([
         title: '广告销售额(本币)',
         editRender: {},
         slots: { edit: 'ad_sales_original_edit' },
-        width: 151,
+        minWidth: 151,
       },
     ]
   },
@@ -224,7 +224,7 @@ export const monthColumns = ref([
         title: '广告花费(本币)',
         editRender: {},
         slots: { edit: 'ad_cost_original_edit' },
-        width: 138,
+        minWidth: 138,
       },
     ]
   },