2 커밋 b0219776bd ... da340f82c0

작성자 SHA1 메시지 날짜
  Zimo da340f82c0 表格封装调整 操作 查询 排序 只影响表头排布而不影响表格内容 1 일 전
  Zimo 1d812c31bd 页面调整添加表格 action 1 일 전

+ 8 - 7
src/components/ZmTable/ZmTableColumn.vue

@@ -51,6 +51,7 @@ const tableContext = inject(TableContextKey, {
 const innerSortOrder = ref<SortOrder | null>(props.defaultSortOrder ?? null)
 const filterVisible = ref(false)
 const settingVisible = ref(false)
+const hasHeaderAction = computed(() => props.action || props.zmSortable || props.zmFilterable)
 
 const defaultOptions = ref<Partial<Props>>({
   align: 'center',
@@ -74,10 +75,7 @@ const bindProps = computed(() => {
     ...columnProps
   } = props
   const columnAlign = props.align || (attrs.align as ColumnAlign | undefined)
-  const resolvedAlign =
-    action || zmSortable || zmFilterable
-      ? 'left'
-      : columnAlign || tableContext.columnAlign.value || defaultOptions.value.align
+  const resolvedAlign = columnAlign || tableContext.columnAlign.value || defaultOptions.value.align
 
   return {
     ...defaultOptions.value,
@@ -95,7 +93,10 @@ const alignMap: Record<string, string> = {
   left: 'justify-between',
   right: 'justify-end'
 }
-const headerFlexClass = computed(() => alignMap[String(bindProps.value.align)] || 'justify-center')
+const headerFlexClass = computed(() => {
+  if (hasHeaderAction.value) return 'justify-between'
+  return alignMap[String(bindProps.value.align)] || 'justify-center'
+})
 
 const isSortControlled = computed(() => props.sortOrder !== undefined)
 const currentOrder = computed<SortOrder | null>(() => {
@@ -212,7 +213,7 @@ const calculativeWidth = () => {
     .map((item) => props.realValue?.(item) ?? item[props.prop as keyof typeof item])
     .filter(hasFilterValue)
   let labelWidth = getTextWidth(bindProps.value.label || '') + 32
-  if (props.zmFilterable || props.zmSortable) labelWidth += 8
+  if (hasHeaderAction.value) labelWidth += 8
   if (props.zmFilterable) labelWidth += 22
   if (props.zmSortable) labelWidth += 22
   const maxWidth = Math.min(
@@ -242,7 +243,7 @@ watch(
       <slot name="header" v-bind="scope">
         <div class="header-wrapper" :class="headerFlexClass">
           <span class="truncate" :title="scope.column.label">{{ scope.column.label }}</span>
-          <div v-if="props.action || props.zmSortable || props.zmFilterable" class="action-area">
+          <div v-if="hasHeaderAction" class="action-area">
             <el-tooltip
               v-if="props.zmSortable"
               :content="

+ 1 - 1
src/locales/zh-CN.ts

@@ -545,7 +545,7 @@ export default {
     name: '查询条件',
     nameHolder: '请输入查询条件',
     status: '工单状态',
-    createTime: '创建时间:',
+    createTime: '创建时间',
     start: '开始日期',
     end: '结束日期',
     search: '搜索',

+ 7 - 2
src/views/pms/iotlockstock/index.vue

@@ -375,7 +375,12 @@ onMounted(() => {
                 </template>
               </ZmTableColumn>
               <ZmTableColumn prop="unit" :label="t('workOrderMaterial.unit')" min-width="90" />
-              <ZmTableColumn prop="storageTime" :label="t('stock.storageTime')" min-width="180">
+              <ZmTableColumn
+                prop="storageTime"
+                :label="t('stock.storageTime')"
+                min-width="180"
+                action
+              >
                 <template #default="{ row }">
                   {{ dateFormatter(row, null, row.storageTime) }}
                 </template>
@@ -447,8 +452,8 @@ onMounted(() => {
   margin-bottom: 2px;
   font-size: 11px;
   font-weight: 500;
-  color: var(--el-text-color-regular);
   letter-spacing: 0;
+  color: var(--el-text-color-regular);
 }
 
 .stat-value {

+ 1 - 0
src/views/pms/iotrddailyreport/components/DailyStatistics.vue

@@ -526,6 +526,7 @@ const { ZmTable, ZmTableColumn } = useTableComponents()
                         label="设备利用率"
                         prop="utilizationRate"
                         cover-formatter
+                        action
                         :real-value="
                           (row: List) => (Number(row.utilizationRate ?? 0) * 100).toFixed(2) + '%'
                         "

+ 1 - 0
src/views/pms/iotrddailyreport/components/NonProductionEfficiency.vue

@@ -284,6 +284,7 @@ const { ZmTable, ZmTableColumn } = useTableComponents<ListItem>()
               label="自然时间"
               min-width="92"
               cover-formatter
+              action
               :real-value="(row: ListItem) => formatNumber(row.calendarTime)"
             />
           </zm-table>

+ 1 - 1
src/views/pms/iotrddailyreport/fillDailyReport.vue

@@ -274,7 +274,7 @@ function realValue(type: any, value: string) {
               :height="height"
               show-border
             >
-              <zm-table-column label="操作" width="140" fixed="left">
+              <zm-table-column label="操作" width="140" fixed="left" action>
                 <template #default="scope">
                   <el-button
                     link

+ 1 - 1
src/views/pms/iotrddailyreport/index.vue

@@ -504,7 +504,7 @@ onMounted(() => {
                   </el-tag>
                 </template>
               </zm-table-column>
-              <zm-table-column label="操作" width="120" fixed="right">
+              <zm-table-column label="操作" width="120" fixed="right" action>
                 <template #default="scope">
                   <el-button
                     link

+ 1 - 1
src/views/pms/iotrddailyreport/statistics.vue

@@ -291,7 +291,7 @@ function handleWellNameClick(taskId: number) {
                 cover-formatter
                 :real-value="(row) => (Number(row.nonProductionRate ?? 0) * 100).toFixed(2) + '%'"
               />
-              <zm-table-column prop="manufactureName" label="甲方" />
+              <zm-table-column prop="manufactureName" label="甲方" action />
             </zm-table>
           </template>
         </el-auto-resizer>

+ 2 - 1
src/views/pms/iotrhdailyreport/rh-table.vue

@@ -264,10 +264,11 @@ function handleCurrentChange(val: number) {
               prop="capacity"
               label="产能(万方)"
               cover-formatter
+              :action="!showAction"
               :real-value="unitformatter"
             />
 
-            <zm-table-column label="操作" :width="120" fixed="right" v-if="showAction">
+            <zm-table-column label="操作" :width="120" fixed="right" action v-if="showAction">
               <template #default="scope">
                 <slot name="action" :row="scope.row"></slot>
               </template>

+ 3 - 1
src/views/pms/iotrhdailyreport/summary.vue

@@ -222,7 +222,8 @@ const columns = (type: string) => {
       : []),
     {
       label: '设备利用率(%)',
-      prop: 'utilizationRate'
+      prop: 'utilizationRate',
+      action: true
     }
   ]
 }
@@ -912,6 +913,7 @@ const { ZmTable, ZmTableColumn } = useTableComponents()
                           :label="item.label"
                           :prop="item.prop"
                           :formatter="formatter"
+                          :action="item.action"
                         />
                         <zm-table-column
                           v-else-if="item.prop === 'name'"

+ 6 - 2
src/views/pms/iotrydailyreport/ry-table.vue

@@ -404,9 +404,13 @@ function handleCurrentChange(val: number) {
               <zm-table-column prop="partyaResource" label="甲方资源" />
               <zm-table-column prop="otherNptTime" label="其它非生产时间" />
             </zm-table-column>
-            <zm-table-column prop="otherNptReason" label="其他非生产时间原因" />
+            <zm-table-column
+              prop="otherNptReason"
+              label="其他非生产时间原因"
+              :action="!showAction"
+            />
 
-            <zm-table-column label="操作" :width="120" fixed="right" v-if="showAction">
+            <zm-table-column label="操作" :width="120" fixed="right" action v-if="showAction">
               <template #default="scope">
                 <slot name="action" :row="scope.row"></slot>
               </template>

+ 2 - 2
src/views/pms/iotrydailyreport/ry-xj-table.vue

@@ -453,9 +453,9 @@ function handleCurrentChange(val: number) {
                   (Number(row.totalStaffNum) || 0) - (Number(row.offDutyStaffNum) || 0)
               "
             />
-            <zm-table-column prop="leaveStaffNum" label="休假人员数量" />
+            <zm-table-column prop="leaveStaffNum" label="休假人员数量" :action="!showAction" />
 
-            <zm-table-column label="操作" :width="120" fixed="right" v-if="showAction">
+            <zm-table-column label="操作" :width="120" fixed="right" action v-if="showAction">
               <template #default="scope">
                 <slot name="action" :row="scope.row"></slot>
               </template>

+ 3 - 1
src/views/pms/iotrydailyreport/summary.vue

@@ -176,7 +176,8 @@ const columns = (type: string) => {
     },
     {
       label: '设备利用率(%)',
-      prop: 'utilizationRate'
+      prop: 'utilizationRate',
+      action: true
     }
   ]
 }
@@ -707,6 +708,7 @@ const tolist = (id: number, non: boolean = false) => {
                           :label="item.label"
                           :prop="item.prop"
                           :formatter="formatter"
+                          :action="item.action"
                         />
                         <zm-table-column
                           v-else-if="item.prop === 'name'"

+ 3 - 1
src/views/pms/iotrydailyreport/xsummary.vue

@@ -182,7 +182,8 @@ const columns = (type: string) => {
     },
     {
       label: '设备利用率(%)',
-      prop: 'utilizationRate'
+      prop: 'utilizationRate',
+      action: true
     }
   ]
 }
@@ -706,6 +707,7 @@ const tolist = (id: number, non: boolean = false) => {
                           :label="item.label"
                           :prop="item.prop"
                           :formatter="formatter"
+                          :action="item.action"
                         />
                         <zm-table-column
                           v-else-if="item.prop === 'name'"

+ 2 - 1
src/views/pms/iotsapstock/IotSapStockConfig.vue

@@ -159,7 +159,7 @@ const handleExport = async () => {
   }
 }
 
-const formatNumber = (value: unknown) => erpPriceTableColumnFormatter(null, null, value)
+const formatNumber = (value: unknown) => erpPriceTableColumnFormatter(null, null, value, null)
 
 onMounted(() => {
   loadSapOrgOptions()
@@ -329,6 +329,7 @@ onMounted(() => {
                 prop="createTime"
                 :label="t('chooseMaintain.createTime')"
                 min-width="180"
+                action
               >
                 <template #default="{ row }">
                   {{ dateFormatter(row, null, row.createTime) }}

+ 2 - 1
src/views/pms/iotsapstock/index.vue

@@ -373,6 +373,7 @@ onMounted(() => {
                 prop="createTime"
                 :label="t('chooseMaintain.createTime')"
                 min-width="180"
+                action
               >
                 <template #default="{ row }">
                   {{ dateFormatter(row, null, row.createTime) }}
@@ -432,8 +433,8 @@ onMounted(() => {
   margin-bottom: 2px;
   font-size: 11px;
   font-weight: 500;
-  color: var(--el-text-color-regular);
   letter-spacing: 0;
+  color: var(--el-text-color-regular);
 }
 
 .stat-value {

+ 1 - 1
src/views/report-statistics/costs.vue

@@ -377,7 +377,7 @@ const handleChange = () => {
               <ZmTableColumn label="类别" prop="type" min-width="120" />
               <ZmTableColumn label="设备编号" prop="deviceCode" min-width="150" />
               <ZmTableColumn label="设备名称" prop="deviceName" min-width="180" />
-              <ZmTableColumn label="成本" prop="cost" min-width="120">
+              <ZmTableColumn label="成本" prop="cost" min-width="120" action>
                 <template #default="{ row }"> {{ row.cost ?? 0 }}元 </template>
               </ZmTableColumn>
             </ZmTable>

+ 1 - 1
src/views/report-statistics/work-order-completion.vue

@@ -445,7 +445,7 @@ async function handleExport() {
               <ZmTableColumn label="项目部" prop="project" min-width="160" />
               <ZmTableColumn label="队伍" prop="deptName" min-width="140" />
               <ZmTableColumn label="状态" prop="status" min-width="100" />
-              <ZmTableColumn label="设备" prop="device" min-width="180" />
+              <ZmTableColumn label="设备" prop="device" min-width="180" action />
             </ZmTable>
           </template>
         </el-auto-resizer>