gongchunyi
7 天以前 d336a25aae76f8baf8a8a5dfce18521b9a7d0f03
src/views/basicData/product/ProductSelectDialog.vue
@@ -22,7 +22,7 @@
      <el-table-column type="index" label="序号" width="60" />
      <el-table-column prop="productName" label="产品大类" min-width="160" />
      <el-table-column prop="model" label="型号名称" min-width="200" />
      <el-table-column prop="unit" label="单位" min-width="160" />
      <el-table-column prop="thickness" label="厚度" min-width="160" :formatter="formatThicknessTo15" />
    </el-table>
    <div class="mt-3 flex justify-end">
@@ -32,10 +32,10 @@
    </div>
    <template #footer>
      <el-button @click="close()">取消</el-button>
      <el-button type="primary" :disabled="multipleSelection.length === 0" @click="onConfirm">
        确定
      </el-button>
         <el-button @click="close()">取消</el-button>
    </template>
  </el-dialog>
</template>
@@ -43,13 +43,13 @@
<script setup lang="ts">
import { computed, onMounted, reactive, ref, watch, nextTick } from "vue";
import { ElMessage } from "element-plus";
import { productModelList } from '@/api/basicData/productModel'
import { productModelList } from '@/api/basicData/productModel.js'
export type ProductRow = {
  id: number;
  productName: string;
  model: string;
  unit?: string;
  thickness?: string;
};
const props = defineProps<{
@@ -80,6 +80,16 @@
const multipleSelection = ref<ProductRow[]>([]);
const tableRef = ref();
// 表格展示时统一保留 15 位小数
const formatThicknessTo15 = (_row: any, _column: any, cellValue: any) => {
  if (cellValue === null || cellValue === undefined) return "";
  const s = String(cellValue).trim();
  if (s === "") return "";
  const n = Number(s);
  if (Number.isNaN(n)) return s;
  return n.toFixed(15);
};
function close() {
  visible.value = false;
}