wangting
2023-07-05 c55f83b7af3edda89984979d9a24c4cd3a6f5205
主数据列表展示
已修改2个文件
117 ■■■■ 文件已修改
Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/work/BusinessWork.vue 97 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Crud/VciMasterCrud.vue
@@ -59,7 +59,7 @@
            :label="item.label"
            :prop="item.prop"
            :sortable="item.sortable"
            :formatter="formatBoolean"
            :formatter="item.formatter"
            :width="item.label.length >=4 ?'150':item.label.length==3 ?'120':'90'"
            :show-overflow-tooltip="true"
            align="center"
@@ -154,6 +154,7 @@
import SetPersonnel from "@/components/template/SetPersonnel";
import ResembleQueryDialog from "@/components/FormTemplate/ResembleQueryDialog.vue";
import BatchImport from '@/components/BatchImport'
import { validatenull } from "@/util/validate";
export default {
  components: {
    integrationTransfer,
@@ -278,6 +279,17 @@
    },
    tableHeadFindData: {
      handler(newval, oldval) {
        newval.forEach((record,_index) =>{
          if(record.field == 'id' && validatenull(record.templet)){
            //企业编码的默认添加超链接,暂未实现
            record.formatter = '';
          }else {
            if (record.templet && typeof (record.templet) == 'string' && !validatenull(record.templet) && record.templet.indexOf("function(row,column)")>-1) {
              record.formatter = eval("(" + record.templet + ")");
              //function(row,column){return row[column.property]=='true'?'是':'否'}
            }
          }
        })
        this.tableHeadFindDatas = newval;
      },
    },
@@ -296,11 +308,7 @@
  methods: {
    // 转换数据true和false
    formatBoolean(row, column) {
      if (column.property === "xiaoshouwl"
        ||column.property === "shifoupihaoguanli"
        ||column.property === "caigouwl"
        ||column.property === "kucunwl"
        ||column.property === "passing") {
      if (column.fieldType === "truefalse") {
        return row[column.property] =='true'? "是" : "否";
      }
      return row[column.property];
Source/UBCS-WEB/src/components/work/BusinessWork.vue
@@ -1,17 +1,38 @@
<template>
<div>
  <el-button @click="HandlerRend"></el-button>
  <el-table :data="data">
    <el-table-column
      fixed
      type="selection"
      width="55">
  <el-button  @click="HandlerRend" size="small" type="primary">保存</el-button>
  <el-table
    v-loading="isLoading"
    :data="tableData"
    max-height="700"
    style=""
    @cell-click="handleCellClick"
  >
    <el-table-column fixed type="selection" width="55"> </el-table-column>
    <el-table-column fixed label="序号" type="index" width="55">
    </el-table-column>
    <el-table-column
      fixed
      label="序号"
      type="index"
      width="55">
      v-for="item in this.tableHeadData"
      :key="item.id"
      :label="item.label"
      :prop="item.prop"
      :sortable="item.sortable"
      :formatter="item.formatter"
      :width="item.label.length >=4 ?'150':item.label.length==3 ?'120':'90'"
      :show-overflow-tooltip="true"
      align="center"
    >
      <!-- 编辑和展示逻辑 -->
      <!--              <template slot-scope="{ row }">-->
      <!--                <el-input v-if="editingRow === row && editShow== item.prop" v-model="row[item.prop]" @blur="saveRow"></el-input>-->
      <!--                <span v-else>{{row[item.prop]}}</span>-->
      <!--                <el-switch-->
      <!--                  v-if="editShow === 'true'"-->
      <!--                  v-model="row[item.prop]"-->
      <!--                  active-color="#13ce66"-->
      <!--                  inactive-color="#ff4949">-->
      <!--                </el-switch>-->
      <!--              </template>-->
    </el-table-column>
  </el-table>
</div>
@@ -19,17 +40,20 @@
<script>
import {businese} from '@/api/work/businese'
import {MasterTable} from "@/api/GetItem";
import {validatenull} from "@/util/validate";
export default {
  name: "BusinessWork",
  props:['ids','templateId'],
  data() {
    return {
      BuinessOids:[],
      data:[
        {
          label:'app'
        }
      ]
      isLoading:false,
      tableHeadData:[],
      tableData:[],
      editingRow: null,
      editShow: "",
      editAttr: ""
    }
  },
  watch:{
@@ -49,15 +73,54 @@
  },
  methods:{
    HandlerRend(){
      this.editingRow = null;
    },
    //表格头渲染
    CrudHeaderRend() {
      if (this.codeClassifyOid != "") {
        MasterTable({
          codeClassifyOid: this.codeClassifyOid,
          functionId: 5,
        }).then((res) => {
          this.options = res.data.tableDefineVO.seniorQueryColumns;
          this.List = res.data.tableDefineVO.cols[0];
          this.tableHeadData=[];
          this.List.forEach((item) => {
            let columnItem = {
              label: item.title,
              prop: item.field,
              type: this.columnType[item.type],
              sortable: item.sort,
              width: item.minWidth
            };
            if(item.field == 'id' && validatenull(item.templet)){
              //企业编码的默认添加超链接,暂未实现
              columnItem.formatter = '';
            }else {
              if (item.templet && typeof (item.templet) == 'string' && !validatenull(item.templet) && item.templet.indexOf("function(row,column)")>-1) {
                columnItem.formatter = eval("(" + item.templet + ")");
                //function(row,column){return row[column.property]=='true'?'是':'否'}
              }
            }
            this.tableHeadData.push(columnItem)
          });
        });
      }
    },
    //表格数据
    BuinseseRend(){
      businese({
        btmType:'wupin',
        'conditionMap[oid]':this.BuinessOids.toString()
      }).then(res=>{
        console.log(res)
        this.tableData = res.data.data;
      })
    }
    },
    // 监听单元格点击事件并存储正在编辑的行
    handleCellClick(row, column) {
      this.editingRow = row;
      this.editShow = column.property;
    },
  }
}
</script>