llj
2025-12-15 a0010bcabbfbc3771aa05d54094f5d02bcdd5609
src/views/component/SettleStyleDialog/index.vue
@@ -11,21 +11,21 @@
      <el-card class="search-card">
        <div slot="header" class="clearfix">
          <span>查询条件</span>
          <el-button
            style="float: right; padding: 3px 0"
          <el-button
            style="float: right; padding: 3px 0"
            type="text"
            @click="toggleCollapse"
          >
            {{ collapse ? '展开' : '收起' }}
          </el-button>
        </div>
        <el-form :model="queryParams" ref="queryForm" :inline="true">
          <el-row :gutter="20">
            <el-col :span="6">
              <el-form-item label="代码">
                <el-input
                  v-model="queryParams.HNumber"
                <el-input
                  v-model="queryParams.HNumber"
                  placeholder="请输入代码"
                  clearable
                  @keyup.enter.native="handleQuery"
@@ -34,8 +34,8 @@
            </el-col>
            <el-col :span="6">
              <el-form-item label="名称">
                <el-input
                  v-model="queryParams.HName"
                <el-input
                  v-model="queryParams.HName"
                  placeholder="请输入名称"
                  clearable
                  @keyup.enter.native="handleQuery"
@@ -44,8 +44,8 @@
            </el-col>
            <el-col :span="6">
              <el-form-item label="结算方式代码">
                <el-input
                  v-model="queryParams.HNumber2"
                <el-input
                  v-model="queryParams.HNumber2"
                  placeholder="请输入结算方式代码"
                  clearable
                  style="width: 190px"
@@ -97,8 +97,8 @@
                </el-col>
                <el-col :span="8">
                  <el-form-item label="内容">
                    <el-input
                      v-model="queryParams.ColContent"
                    <el-input
                      v-model="queryParams.ColContent"
                      placeholder="请输入内容"
                      clearable
                      @keyup.enter.native="handleQuery"
@@ -138,7 +138,7 @@
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55" align="center" />
          <el-table-column
          <el-table-column
            v-for="column in tableColumns"
            :key="column.field"
            :prop="column.field"
@@ -189,7 +189,7 @@
      dialogVisible: false,
      collapse: false,
      loading: false,
      // 查询参数
      queryParams: {
        HNumber: '',
@@ -199,28 +199,28 @@
        Comparator: '0',
        ColContent: ''
      },
      // 表格数据
      tableData: [],
      tableColumns: [],
      selectedRow: null,
      multipleSelection: [],
      // 分页
      pagination: {
        page: 1,
        size: 50,
        total: 0
      },
      // 过滤方案
      currentFilterScheme: '',
      HInterID_Choose: 0,
      // 隐藏字段
      hiddenFields: ["HItemID", "HUSEORGID", "HCREATEORGID", "父级ID"],
      baseURL: process.env.VUE_APP_BASE_URL || 'http://47.96.97.237/API/',
      baseURL: process.env.VUE_APP_BASE_API || 'http://47.96.97.237/API/',
      user: 'admin',
      HModName: 'Gy_SettleStyle',
      HModuleName: '结算方式维护',
@@ -257,13 +257,13 @@
      this.loadTableData()
      this.getDefaultFilterScheme()
    },
    // 加载表格数据
    async loadTableData() {
      this.loading = true
      try {
        const sWhere = this.buildQueryCondition()
        const response = await axios.get(`${this.baseURL}/Gy_SettleStyle/SettleStyleList`, {
          params: {
            sWhere: sWhere,
@@ -271,7 +271,7 @@
            Organization: this.Organization
          }
        })
        if (response.data.count === 1) {
          this.tableData = response.data.data
          console.log('结算方式数据:', this.tableData)
@@ -287,11 +287,11 @@
        this.loading = false
      }
    },
    // 构建查询条件
    buildQueryCondition() {
      let sWhere = ""
      // 基本查询条件
      if (this.queryParams.HNumber) {
        sWhere += ` and 结算方式代码 like '%${this.queryParams.HNumber}%'`
@@ -299,9 +299,9 @@
      if (this.queryParams.HName) {
        sWhere += ` and 结算方式名称 like '%${this.queryParams.HName}%'`
      }
      // 高级过滤条件
      if (this.queryParams.ColName && this.queryParams.ColName !== "0" &&
      if (this.queryParams.ColName && this.queryParams.ColName !== "0" &&
          this.queryParams.Comparator && this.queryParams.Comparator !== "0") {
        let com = ""
        switch (this.queryParams.Comparator) {
@@ -323,26 +323,26 @@
        }
        sWhere += ` and ${this.queryParams.ColName} ${com}`
      }
      // 添加打开类型的过滤条件
      sWhere += this.addSWhereByOpenType()
      return sWhere
    },
    // 根据打开类型添加条件
    addSWhereByOpenType() {
      // 这里可以根据需要添加特定的过滤条件
      return " and 禁用标记 = ''"
    },
    // 生成表格列
    generateTableColumns(columnList) {
      this.tableColumns = []
      // 添加选择列
      this.tableColumns.push({ type: 'selection', fixed: 'left' })
      // 动态生成列
      if (columnList && columnList.length > 0) {
        columnList.forEach(item => {
@@ -354,12 +354,12 @@
              sortable: true,
              width: 200
            }
            // 根据字段类型设置不同的模板
            if (item.ColmType === 'DateTime') {
              column.formatter = this.formatDate
            }
            this.tableColumns.push(column)
          }
        })
@@ -378,13 +378,13 @@
        this.tableColumns = [...this.tableColumns, ...defaultColumns]
      }
    },
    // 查询
    handleQuery() {
      this.pagination.page = 1
      this.loadTableData()
    },
    // 重置查询
    handleReset() {
      this.queryParams = {
@@ -398,14 +398,14 @@
      this.pagination.page = 1
      this.loadTableData()
    },
    // 重新同步
    async handleResCnz() {
      if (!this.queryParams.HNumber2) {
        this.$message.warning('请输入结算方式代码')
        return
      }
      try {
        const response = await axios.get(`${this.baseURL}/Gy_SettleStyle/Gy_SettleStyleViewApi`, {
          params: {
@@ -413,7 +413,7 @@
            Type: 'JSFS'
          }
        })
        if (response.data.count === 1) {
          this.$message.success(response.data.Message)
          this.loadTableData() // 重新加载数据
@@ -425,29 +425,29 @@
        this.$message.error('重新同步失败')
      }
    },
    // 刷新
    handleRefresh() {
      this.loadTableData()
    },
    // 切换折叠状态
    toggleCollapse() {
      this.collapse = !this.collapse
    },
    // 行双击事件
    handleRowDblClick(row) {
      this.selectedRow = row
      this.confirmSelection()
    },
    // 行点击事件
    handleRowClick(row) {
      this.$refs.table.toggleRowSelection(row)
      this.selectedRow = row
    },
    // 选择变化
    handleSelectionChange(selection) {
      this.multipleSelection = selection
@@ -455,7 +455,7 @@
        this.selectedRow = selection[0]
      }
    },
    // 确认选择
    confirmSelection() {
      if (this.selectedRow) {
@@ -468,12 +468,12 @@
        this.$message.warning('请选择一条数据')
      }
    },
    // 退出
    handleExit() {
      this.dialogVisible = false
    },
    // 关闭对话框
    handleClose(done) {
      this.$confirm('确认关闭?')
@@ -482,20 +482,20 @@
        })
        .catch(_ => {})
    },
    // 分页大小改变
    handleSizeChange(size) {
      this.pagination.size = size
      this.pagination.page = 1
      this.loadTableData()
    },
    // 当前页改变
    handleCurrentChange(page) {
      this.pagination.page = page
      this.loadTableData()
    },
    // 格式化日期
    formatDate(dateString) {
      if (!dateString) return ''
@@ -506,7 +506,7 @@
        return dateString
      }
    },
    // 获取默认过滤方案
    async getDefaultFilterScheme() {
      try {
@@ -518,12 +518,12 @@
            Type: "Default"
          }
        })
        if (response.data.count === 1) {
          const data = response.data.data[0]
          this.HInterID_Choose = data.hmainid
          this.currentFilterScheme = `当前过滤方案:${data.方案名称} (${data.备注})`
          // 应用过滤条件
          this.applyFilterConditions(response.data.data)
        }
@@ -531,7 +531,7 @@
        console.error('获取过滤方案失败:', error)
      }
    },
    // 应用过滤条件
    applyFilterConditions(filterData) {
      filterData.forEach(item => {
@@ -540,17 +540,17 @@
        }
      })
    },
    // 保存过滤方案
    handleSaveScheme() {
      this.$message.info('保存方案功能')
    },
    // 读取过滤方案
    handleReadScheme() {
      this.$message.info('读取方案功能')
    },
    // 列设置
    handleColumnSetting() {
      this.$message.info('列设置功能')
@@ -606,4 +606,4 @@
  color: #fc9393;
  margin: 10px 0;
}
</style>
</style>