进销存升级
1.用印管理查看时,申请编号显示不一致
2.知识库页面页码展示有误
3.新增的销售报价记录点击编辑后,产品规格型号信息不回显
已修改3个文件
282 ■■■■ 文件已修改
src/views/collaborativeApproval/knowledgeBase/index.vue 105 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/sealManagement/index.vue 120 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesQuotation/index.vue 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/collaborativeApproval/knowledgeBase/index.vue
@@ -46,11 +46,13 @@
    </div>
    <!-- 新增/编辑知识弹窗 -->
    <el-dialog
    <FormDialog
      v-model="dialogVisible"
      :title="dialogTitle"
      width="800px"
      :close-on-click-modal="false"
      :width="'800px'"
      @close="closeKnowledgeDialog"
      @confirm="submitForm"
      @cancel="closeKnowledgeDialog"
    >
      <el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
        <el-row :gutter="20">
@@ -115,7 +117,14 @@
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="创建人" prop="creator">
              <el-input v-model="form.creator" placeholder="请输入创建人" />
              <el-select v-model="form.creator" placeholder="请选择创建人" style="width: 100%" filterable>
                <el-option
                  v-for="user in userList"
                  :key="user.userId"
                  :label="user.nickName"
                  :value="user.nickName"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -125,20 +134,16 @@
          </el-col>
        </el-row>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitForm">确定</el-button>
        </span>
      </template>
    </el-dialog>
    </FormDialog>
    <!-- 查看知识详情弹窗 -->
    <el-dialog
    <FormDialog
      v-model="viewDialogVisible"
      title="知识详情"
      width="900px"
      :close-on-click-modal="false"
      :width="'900px'"
      @close="closeViewDialog"
      @confirm="handleViewDialogConfirm"
      @cancel="closeViewDialog"
    >
      <div class="knowledge-detail">
        <el-descriptions :column="2" border>
@@ -183,7 +188,7 @@
          <h4>关键要点</h4>
          <div class="key-points">
            <el-tag
              v-for="(point, index) in currentKnowledge.keyPoints.split(',')"
              v-for="(point, index) in currentKnowledge.keyPoints?.split(',') || []"
              :key="index"
              type="success"
              style="margin-right: 8px; margin-bottom: 8px;"
@@ -219,24 +224,19 @@
          </div>
        </div>
      </div>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="viewDialogVisible = false">关闭</el-button>
          <el-button type="primary" @click="copyKnowledge">复制知识</el-button>
          <!-- <el-button type="success" @click="markAsFavorite">收藏@</el-button> -->
        </span>
      </template>
    </el-dialog>
    </FormDialog>
  </div>
</template>
<script setup>
import { Search } from "@element-plus/icons-vue";
import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed } from "vue";
import { onMounted, ref, reactive, toRefs, getCurrentInstance, computed, watch } from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import PIMTable from "@/components/PIMTable/PIMTable.vue";
import FormDialog from '@/components/Dialog/FormDialog.vue';
import { listKnowledgeBase, delKnowledgeBase,addKnowledgeBase,updateKnowledgeBase } from "@/api/collaborativeApproval/knowledgeBase.js";
import useUserStore from '@/store/modules/user';
import { userListNoPageByTenantId } from '@/api/system/user.js';
// 表单验证规则
const rules = {
@@ -302,6 +302,9 @@
// 表单引用
const formRef = ref();
// 用户相关
const userStore = useUserStore();
const userList = ref([]);
// 表格列配置
const tableColumn = ref([
@@ -389,6 +392,15 @@
  }
]);
// 监听对话框打开,获取用户列表
watch(dialogVisible, (newVal) => {
  if (newVal) {
    userListNoPageByTenantId().then((res) => {
      userList.value = res.data || [];
    });
  }
});
// 生命周期
onMounted(() => {
  getList();
@@ -414,7 +426,7 @@
  .then(res => {
    tableLoading.value = false;
    tableData.value = res.data.records
    page.total = res.data.total;
    page.value.total = res.data.total;
  }).catch(err => {
    tableLoading.value = false;
  })
@@ -437,7 +449,7 @@
  dialogType.value = type;
  if (type === "add") {
    dialogTitle.value = "新增知识";
    // 重置表单
    // 重置表单,默认创建人为当前用户
    Object.assign(form.value, {
      title: "",
      type: "",
@@ -446,7 +458,7 @@
      problem: "",
      solution: "",
      keyPoints: "",
      creator: "",
      creator: userStore.nickName || "",
      usageCount: 0
    });
  } else if (type === "edit" && row) {
@@ -550,6 +562,39 @@
  });
};
// 关闭知识表单对话框
const closeKnowledgeDialog = () => {
  // 清空表单数据,默认创建人为当前用户
  Object.assign(form.value, {
    id: undefined,
    title: "",
    type: "",
    scenario: "",
    efficiency: "",
    problem: "",
    solution: "",
    keyPoints: "",
    creator: userStore.nickName || "",
    usageCount: 0
  });
  // 清除表单验证状态
  if (formRef.value) {
    formRef.value.clearValidate();
  }
  dialogVisible.value = false;
};
// 关闭查看详情对话框
const closeViewDialog = () => {
  viewDialogVisible.value = false;
};
// 处理查看详情对话框确认(执行复制操作)
const handleViewDialogConfirm = () => {
  copyKnowledge();
  closeViewDialog();
};
// 提交知识表单
const submitForm = async () => {
  try {
@@ -559,7 +604,7 @@
      addKnowledgeBase({...form.value}).then(res => {
        if(res.code == 200){
          ElMessage.success("添加成功");
          dialogVisible.value = false;
          closeKnowledgeDialog();
          getList();
        }
      }).catch(err => {
@@ -569,7 +614,7 @@
      updateKnowledgeBase({...form.value}).then(res => {
        if(res.code == 200){
          ElMessage.success("更新成功");
          dialogVisible.value = false;
          closeKnowledgeDialog();
          getList();
        }
      }).catch(err => {
src/views/collaborativeApproval/sealManagement/index.vue
@@ -82,7 +82,14 @@
    </el-card>
    <!-- 用印申请对话框 -->
    <el-dialog v-model="showSealApplyDialog" title="申请用印" width="600px">
    <FormDialog
      v-model="showSealApplyDialog"
      title="申请用印"
      :width="'600px'"
      @close="closeSealApplyDialog"
      @confirm="submitSealApplication"
      @cancel="closeSealApplyDialog"
    >
      <el-form :model="sealForm" :rules="sealRules" ref="sealFormRef" label-width="100px">
        <el-form-item label="申请编号" prop="applicationNum">
          <el-input v-model="sealForm.applicationNum" placeholder="请输入申请编号" />
@@ -119,13 +126,7 @@
          </el-radio-group>
        </el-form-item>
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="showSealApplyDialog = false">取消</el-button>
          <el-button type="primary" @click="submitSealApplication">提交申请</el-button>
        </span>
      </template>
    </el-dialog>
    </FormDialog>
    <!-- 规章制度发布对话框 -->
    <!-- <el-dialog v-model="showRegulationDialog" :title="operationType === 'add' ? '发布制度' : '编辑制度'" width="800px">
@@ -177,10 +178,17 @@
    </el-dialog> -->
    <!-- 用印详情对话框 -->
    <el-dialog v-model="showSealDetailDialog" title="用印申请详情" width="700px">
    <FormDialog
      v-model="showSealDetailDialog"
      title="用印申请详情"
      :width="'700px'"
      @close="closeSealDetailDialog"
      @confirm="closeSealDetailDialog"
      @cancel="closeSealDetailDialog"
    >
      <div v-if="currentSealDetail" class="mb10">
        <el-descriptions :column="2" border>
          <el-descriptions-item label="申请编号">{{ currentSealDetail.id }}</el-descriptions-item>
          <el-descriptions-item label="申请编号">{{ currentSealDetail.applicationNum }}</el-descriptions-item>
          <el-descriptions-item label="申请标题">{{ currentSealDetail.title }}</el-descriptions-item>
          <el-descriptions-item label="申请人">{{ currentSealDetail.createUserName }}</el-descriptions-item>
          <el-descriptions-item label="所属部门">{{ currentSealDetail.department }}</el-descriptions-item>
@@ -194,10 +202,17 @@
          <el-descriptions-item label="申请原因" :span="2">{{ currentSealDetail.reason }}</el-descriptions-item>
        </el-descriptions>
      </div>
    </el-dialog>
    </FormDialog>
    <!-- 规章制度详情对话框 -->
    <el-dialog v-model="showRegulationDetailDialog" title="规章制度详情" width="800px">
    <FormDialog
      v-model="showRegulationDetailDialog"
      title="规章制度详情"
      :width="'800px'"
      @close="closeRegulationDetailDialog"
      @confirm="handleRegulationDetailConfirm"
      @cancel="closeRegulationDetailDialog"
    >
      <div v-if="currentRegulationDetail">
        <el-descriptions :column="2" border>
          <el-descriptions-item label="制度编号">{{ currentRegulationDetail.id }}</el-descriptions-item>
@@ -216,10 +231,17 @@
          <el-button type="success" @click="resetForm(currentRegulationDetail)">确认查看</el-button>
        </div>
      </div>
    </el-dialog>
    </FormDialog>
    <!-- 版本历史对话框 -->
    <el-dialog v-model="showVersionHistoryDialog" title="版本历史" width="800px">
    <FormDialog
      v-model="showVersionHistoryDialog"
      title="版本历史"
      :width="'800px'"
      @close="closeVersionHistoryDialog"
      @confirm="closeVersionHistoryDialog"
      @cancel="closeVersionHistoryDialog"
    >
      <el-table :data="versionHistory" style="width: 100%;margin-bottom: 10px">
        <el-table-column prop="version" label="版本号" width="100" />
        <el-table-column prop="updateTime" label="更新时间" width="180" />
@@ -232,10 +254,17 @@
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    </FormDialog>
    <!-- 阅读状态对话框 -->
    <el-dialog v-model="showReadStatusDialog" title="阅读状态" width="800px">
    <FormDialog
      v-model="showReadStatusDialog"
      title="阅读状态"
      :width="'800px'"
      @close="closeReadStatusDialog"
      @confirm="closeReadStatusDialog"
      @cancel="closeReadStatusDialog"
    >
      <el-table :data="readStatusList" style="width: 100%;margin-bottom: 10px">
        <el-table-column prop="employee" label="员工姓名" width="120" />
        <el-table-column prop="department" label="所属部门" width="150" />
@@ -249,7 +278,7 @@
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    </FormDialog>
  </div>
</template>
@@ -263,7 +292,8 @@
import { getUserProfile, userListNoPageByTenantId } from '@/api/system/user.js'
import useUserStore from '@/store/modules/user'
import { userLoginFacotryList } from "@/api/system/user.js"
import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js"
import FormDialog from '@/components/Dialog/FormDialog.vue'
// 响应式数据
const currentUser = ref(null)
@@ -434,7 +464,7 @@
    addSealApplication(sealForm).then(res => {
      if(res.code == 200){
        ElMessage.success('申请提交成功')
        showSealApplyDialog.value = false
        closeSealApplyDialog()
        getSealApplicationList()
        Object.assign(sealForm, {
        applicationNum: '',
@@ -447,12 +477,53 @@
      })
      }
    }).catch(err => {
      ElMessage.error(err.msg)
      console.log(err.msg)
    })
  
  } catch (error) {
    ElMessage.error('请完善申请信息')
  }
}
// 关闭用印申请对话框
const closeSealApplyDialog = () => {
  // 清空表单数据
  Object.assign(sealForm, {
    applicationNum: '',
    title: '',
    sealType: '',
    reason: '',
    approveUserId: '',
    urgency: 'normal',
    status: 'pending'
  })
  // 清除表单验证状态
  if (sealFormRef.value) {
    sealFormRef.value.clearValidate()
  }
  showSealApplyDialog.value = false
}
// 关闭用印详情对话框
const closeSealDetailDialog = () => {
  showSealDetailDialog.value = false
}
// 关闭规章制度详情对话框
const closeRegulationDetailDialog = () => {
  showRegulationDetailDialog.value = false
}
// 处理规章制度详情确认
const handleRegulationDetailConfirm = () => {
  // 如果tableData>0,执行确认查看操作
  if (currentRegulationDetail.value && tableData.value && tableData.value.length > 0) {
    resetForm(currentRegulationDetail.value)
  }
  closeRegulationDetailDialog()
}
// 关闭版本历史对话框
const closeVersionHistoryDialog = () => {
  showVersionHistoryDialog.value = false
}
// 关闭阅读状态对话框
const closeReadStatusDialog = () => {
  showReadStatusDialog.value = false
}
// 新增
const handleAdd = () => {
@@ -735,6 +806,13 @@
  })
}
// 分页变化处理
const paginationChange = (obj) => {
  page.current = obj.page;
  page.size = obj.limit;
  getSealApplicationList();
};
// 监听对话框打开,获取用户列表
watch(showSealApplyDialog, (newVal) => {
  if (newVal) {
src/views/salesManagement/salesQuotation/index.vue
@@ -51,7 +51,7 @@
        height="calc(100vh - 22em)"
      >
                <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column prop="quotationNo" label="报价单号" width="150" />
        <el-table-column prop="quotationNo" label="报价单号" />
        <el-table-column prop="customer" label="客户名称" />
        <el-table-column prop="salesperson" label="业务员" width="100" />
        <el-table-column prop="quotationDate" label="报价日期" width="120" />
@@ -252,7 +252,7 @@
                                    @change="getProductModel($event, scope.row)"
                                >
                                    <el-option
                                        v-for="item in modelOptions"
                                        v-for="item in scope.row.modelOptions || []"
                                        :key="item.id"
                                        :label="item.model"
                                        :value="item.id"
@@ -322,7 +322,7 @@
        </el-descriptions-item>
      </el-descriptions>
      
      <div style="margin-top: 20px;">
      <div style="margin: 20px 0;">
        <h4>产品明细</h4>
        <el-table :data="currentQuotation.products" border style="width: 100%">
          <el-table-column prop="product" label="产品名称" />
@@ -521,7 +521,7 @@
    if (!value) {
        row.productId = '';
        row.product = '';
        modelOptions.value = [];
        row.modelOptions = [];
        row.specificationId = '';
        row.specification = '';
        row.unit = '';
@@ -534,9 +534,9 @@
    if (label) {
        row.product = label;
    }
    // 获取规格型号列表
    // 获取规格型号列表,设置到当前行的 modelOptions
    modelList({ id: value }).then((res) => {
        modelOptions.value = res || [];
        row.modelOptions = res || [];
    });
};
const getProductModel = (value, row) => {
@@ -550,10 +550,11 @@
    }
    // 更新 specificationId(v-model 已经自动更新,这里确保一致性)
    row.specificationId = value;
    const index = modelOptions.value.findIndex((item) => item.id === value);
    const modelOptions = row.modelOptions || [];
    const index = modelOptions.findIndex((item) => item.id === value);
    if (index !== -1) {
        row.specification = modelOptions.value[index].model;
        row.unit = modelOptions.value[index].unit;
        row.specification = modelOptions[index].model;
        row.unit = modelOptions[index].unit;
    } else {
        row.specification = '';
        row.unit = '';
@@ -616,23 +617,46 @@
  form.paymentMethod = row.paymentMethod || ''
  form.status = row.status || '草稿'
  form.remark = row.remark || ''
  form.products = row.products ? row.products.map(product => {
  form.products = row.products ? await Promise.all(row.products.map(async (product) => {
    const productName = product.product || product.productName || ''
    // 优先用 productId;如果只有名称,尝试反查 id 以便树选择器反显
    const resolvedId = product.productId
    const resolvedProductId = product.productId
      ? Number(product.productId)
      : findNodeIdByLabel(productOptions.value, productName) || ''
    // 如果有产品ID,加载对应的规格型号列表
    let modelOptions = [];
    let resolvedSpecificationId = product.specificationId || '';
    if (resolvedProductId) {
      try {
        const res = await modelList({ id: resolvedProductId });
        modelOptions = res || [];
        // 如果返回的数据没有 specificationId,但有 specification 名称,根据名称查找 ID
        if (!resolvedSpecificationId && product.specification) {
          const foundModel = modelOptions.find(item => item.model === product.specification);
          if (foundModel) {
            resolvedSpecificationId = foundModel.id;
          }
        }
      } catch (error) {
        console.error('加载规格型号失败:', error);
      }
    }
    return {
      productId: resolvedId,
      productId: resolvedProductId,
      product: productName,
      specificationId: product.specificationId || '',
      specificationId: resolvedSpecificationId,
      specification: product.specification || '',
      quantity: product.quantity || 0,
      unit: product.unit || '',
      unitPrice: product.unitPrice || 0,
      amount: product.amount || 0
      amount: product.amount || 0,
      modelOptions: modelOptions // 为每行添加独立的规格型号列表
    }
  }) : []
  })) : []
  form.subtotal = row.subtotal || 0
  form.freight = row.freight || 0
  form.otherFee = row.otherFee || 0
@@ -714,7 +738,8 @@
    quantity: 1,
    unit: '',
    unitPrice: 0,
    amount: 0
    amount: 0,
    modelOptions: [] // 为每行添加独立的规格型号列表
  })
}