liyong
8 天以前 4eda70d80cfacbe107929effb0ff65b9c794deb1
Merge remote-tracking branch 'origin/dev_NEW_pro' into dev_NEW_pro
已修改4个文件
186 ■■■■■ 文件已修改
src/views/procurementManagement/procurementLedger/index.vue 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productionProcess/index.vue 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionPlan/productionPlan/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/index.vue
@@ -54,7 +54,9 @@
      <div style="display: flex;justify-content: flex-end;margin-bottom: 20px;">
        <el-button type="primary"
                   @click="openForm('add')">新增台账</el-button>
        <el-button type="primary" plain @click="handleImport">导入</el-button>
        <el-button type="primary"
                   plain
                   @click="handleImport">导入</el-button>
        <el-button @click="handleOut">导出</el-button>
        <el-button type="danger"
                   plain
@@ -96,7 +98,6 @@
                               prop="availableQuality"/>
              <el-table-column label="退货数量"
                               prop="returnQuality"/>
              <el-table-column label="税率(%)"
                               prop="taxRate"/>
              <el-table-column label="含税单价(元)"
@@ -136,8 +137,7 @@
                         width="100"
                         show-overflow-tooltip>
          <template #default="scope">
            <el-tag
                :type="getApprovalStatusType(scope.row.approvalStatus)"
            <el-tag :type="getApprovalStatusType(scope.row.approvalStatus)"
                size="small">
              {{ approvalStatusText[scope.row.approvalStatus] || '未知状态' }}
            </el-tag>
@@ -278,7 +278,15 @@
          <el-col :span="12">
            <el-form-item label="录入人:"
                          prop="recorderId">
              <el-input v-model="form.recorderName" placeholder="自动填充" disabled/>
              <el-select v-model="form.recorderId"
                         placeholder="请选择"
                         clearable
                         filterable>
                <el-option v-for="item in userList"
                           :key="item.userId"
                           :label="item.nickName"
                           :value="item.userId" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -327,8 +335,7 @@
                         :value="item.templateName">
                <div style="display: flex; justify-content: space-between; align-items: center;">
                  <span>{{ item.templateName }}</span>
                  <el-icon
                      v-if="item.id"
                  <el-icon v-if="item.id"
                      class="delete-icon"
                      @click.stop="handleDeleteTemplate(item)"
                      style="cursor: pointer; color: #f56c6c; font-size: 14px; margin-left: 8px;">
@@ -431,16 +438,13 @@
      </el-form>
    </FormDialog>
    <!-- 导入弹窗 -->
    <FormDialog
        v-model="importUpload.open"
    <FormDialog v-model="importUpload.open"
        :title="importUpload.title"
        :width="'600px'"
        @close="importUpload.open = false"
        @confirm="submitImportFile"
        @cancel="importUpload.open = false"
    >
      <el-upload
          ref="importUploadRef"
                @cancel="importUpload.open = false">
      <el-upload ref="importUploadRef"
          :limit="1"
          accept=".xlsx,.xls"
          :action="importUpload.url"
@@ -451,8 +455,7 @@
          :on-progress="importUpload.onProgress"
          :on-change="importUpload.onChange"
          :auto-upload="false"
          drag
      >
                 drag>
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">
          将文件拖到此处,或<em>点击上传</em>
@@ -460,7 +463,9 @@
        <template #tip>
          <div class="el-upload__tip">
            仅支持 xls/xlsx,大小不超过 10MB。
            <el-button link type="primary" @click="downloadTemplate">下载导入模板</el-button>
            <el-button link
                       type="primary"
                       @click="downloadTemplate">下载导入模板</el-button>
          </div>
        </template>
      </el-upload>
@@ -526,12 +531,10 @@
                         placeholder="请选择"
                         clearable
                         @change="mathNum">
                <el-option
                  v-for="dict in tax_rate"
                <el-option v-for="dict in tax_rate"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
                           :value="dict.value" />
              </el-select>
            </el-form-item>
          </el-col>
@@ -630,13 +633,16 @@
        </el-row>
      </el-form>
    </FormDialog>
    <FileList v-if="fileListDialogVisible"  v-model:visible="fileListDialogVisible" record-type="purchase_ledger" :record-id="recordId"  />
    <FileList v-if="fileListDialogVisible"
              v-model:visible="fileListDialogVisible"
              record-type="purchase_ledger"
              :record-id="recordId" />
  </div>
</template>
<script setup>
import FormDialog from '@/components/Dialog/FormDialog.vue';
import FileListDialog from '@/components/Dialog/FileListDialog.vue';
  import FormDialog from "@/components/Dialog/FormDialog.vue";
  import FileListDialog from "@/components/Dialog/FileListDialog.vue";
  import { getToken } from "@/utils/auth";
  import pagination from "@/components/PIMTable/Pagination.vue";
  import {
@@ -649,6 +655,7 @@
  } from "vue";
  import { Search, Delete } from "@element-plus/icons-vue";
  import { ElMessageBox, ElMessage } from "element-plus";
  import { userListNoPage } from "@/api/system/user.js";
  import {
    addOrUpdateSalesLedgerProduct,
    delProduct,
@@ -670,7 +677,9 @@
    delPurchaseTemplate,
  } from "@/api/procurementManagement/procurementLedger.js";
  import useFormData from "@/hooks/useFormData.js";
  const FileList = defineAsyncComponent(() => import("@/components/Dialog/FileList.vue"));
  const FileList = defineAsyncComponent(() =>
    import("@/components/Dialog/FileList.vue")
  );
const {proxy} = getCurrentInstance();
const { tax_rate } = proxy.useDict("tax_rate");
@@ -679,11 +688,12 @@
const selectedRows = ref([]);
const productSelectedRows = ref([]);
const modelOptions = ref([]);
  const userList = ref([]);
const productOptions = ref([]);
const salesContractList = ref([]);
const supplierList = ref([]);
const tableLoading = ref(false);
const fileListDialogVisible = ref(false)
  const fileListDialogVisible = ref(false);
const page = reactive({
  current: 1,
  size: 100,
@@ -706,7 +716,7 @@
};
// 获取审批状态标签类型
const getApprovalStatusType = (status) => {
  const getApprovalStatusType = status => {
  const typeMap = {
    1: "info",      // 待审核 - 灰色
    2: "warning",   // 审批中 - 橙色
@@ -793,7 +803,8 @@
      form.value.paymentMethod = matchedTemplate.paymentMethod;
    }
    // 模板数据中的产品字段是 productList,需要转换为 productData
    productData.value = matchedTemplate.productList || matchedTemplate.productData || [];
      productData.value =
        matchedTemplate.productList || matchedTemplate.productData || [];
  } else {
    // 未匹配到已有模板,视为新模板
    currentTemplateId.value = null;
@@ -835,7 +846,6 @@
    salesLedgerId: "",
    projectName: "",
    recorderId: "",
    recorderName: "",
    entryDate: "",
    productData: [],
    supplierName: "",
@@ -925,7 +935,7 @@
  url: import.meta.env.VITE_APP_BASE_API + "/purchase/ledger/import",
  headers: {Authorization: "Bearer " + getToken()},
  isUploading: false,
  beforeUpload: (file) => {
    beforeUpload: file => {
    const isExcel = file.name.endsWith(".xlsx") || file.name.endsWith(".xls");
    const isLt10M = file.size / 1024 / 1024 < 10;
    if (!isExcel) {
@@ -974,7 +984,11 @@
// 下载导入模板(如后端路径不同,可在此处调整)
const downloadTemplate = () => {
  proxy.download("/purchase/ledger/exportTemplate", {}, "采购台账导入模板.xlsx");
    proxy.download(
      "/purchase/ledger/exportTemplate",
      {},
      "采购台账导入模板.xlsx"
    );
};
const submitImportFile = () => {
@@ -1039,8 +1053,8 @@
  // 检查是否有产品数据
  if (!productData.value || productData.value.length === 0) {
    ElMessage({
      message: '请先添加产品信息',
      type: 'warning',
        message: "请先添加产品信息",
        type: "warning",
    });
    return;
  }
@@ -1051,11 +1065,15 @@
      supplierId: form.value.supplierId,
      paymentMethod: form.value.paymentMethod,
      recorderId: form.value.recorderId,
      recorderName: form.value.recorderName,
      projectName: form.value.projectName,
      templateName: templateName.value.trim(),
    };
    console.log("template params ===>", params, "currentTemplateId:", currentTemplateId.value);
      console.log(
        "template params ===>",
        params,
        "currentTemplateId:",
        currentTemplateId.value
      );
    // 如果 currentTemplateId 有值,说明当前是“编辑已有模板” → 调用更新接口
    // 否则为“新建模板” → 调用新增接口
@@ -1196,6 +1214,9 @@
  }
  await getTemplateList();
    await userListNoPage().then(res => {
      userList.value = res.data;
    });
  operationType.value = type;
  form.value = {};
  productData.value = [];
@@ -1216,8 +1237,6 @@
        item => item.isWhite === 0
    );
    // 设置默认值
    form.value.recorderName = userStore.nickName;
    form.value.entryDate = getCurrentDate();
    if (type === "add") {
@@ -1385,14 +1404,20 @@
            return nodes[i].value;
          }
          if (nodes[i].children && nodes[i].children.length > 0) {
            const found = findProductIdByCategory(nodes[i].children, categoryName);
              const found = findProductIdByCategory(
                nodes[i].children,
                categoryName
              );
            if (found) return found;
          }
        }
        return null;
      };
      const productId = findProductIdByCategory(productOptions.value, productForm.value.productCategory);
        const productId = findProductIdByCategory(
          productOptions.value,
          productForm.value.productCategory
        );
      if (productId) {
        productForm.value.productId = productId;
        // 获取型号列表并等待完成
@@ -1403,7 +1428,10 @@
        await nextTick();
        // 根据 specificationModel 查找 productModelId
        if (productForm.value.specificationModel && modelOptions.value.length > 0) {
          if (
            productForm.value.specificationModel &&
            modelOptions.value.length > 0
          ) {
          const modelItem = modelOptions.value.find(
              item => item.model === productForm.value.specificationModel
          );
@@ -1550,11 +1578,9 @@
          delProduct(ids).then(res => {
            proxy.$modal.msgSuccess("删除成功");
            closeProductDia();
            getPurchaseById({id: currentId.value, type: 2}).then(
                res => {
            getPurchaseById({ id: currentId.value, type: 2 }).then(res => {
                  productData.value = res.productData;
                }
            );
            });
          });
        })
        .catch(() => {
@@ -1585,7 +1611,9 @@
const handleDelete = () => {
  let ids = [];
  if (selectedRows.value.length > 0) {
    ids = selectedRows.value.filter(item => item.salesLedgerId === null).map(item => item.id);
      ids = selectedRows.value
        .filter(item => item.salesLedgerId === null)
        .map(item => item.id);
  } else {
    proxy.$modal.msgWarning("请选择数据");
    return;
@@ -1756,13 +1784,13 @@
};
// 打开附件弹框
const openFileDialog = async (row) => {
  recordId.value = row.id
  fileListDialogVisible.value = true
}
  const openFileDialog = async row => {
    recordId.value = row.id;
    fileListDialogVisible.value = true;
  };
// 删除模板
const handleDeleteTemplate = async (item) => {
  const handleDeleteTemplate = async item => {
  if (!item.id) {
    proxy.$modal.msgWarning("无法删除该模板");
    return;
src/views/productionManagement/productionProcess/index.vue
@@ -162,9 +162,8 @@
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary" @click="handleProcessSubmit">确定</el-button>
          <el-button @click="processDialogVisible = false">取消</el-button>
          <el-button type="primary"
                     @click="handleProcessSubmit">确定</el-button>
        </span>
      </template>
    </el-dialog>
@@ -252,10 +251,8 @@
      </div>
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary" :disabled="!selectedParam" @click="handleParamSubmit">确定</el-button>
          <el-button @click="paramDialogVisible = false">取消</el-button>
          <el-button type="primary"
                     :disabled="!selectedParam"
                     @click="handleParamSubmit">确定</el-button>
        </span>
      </template>
    </el-dialog>
@@ -288,7 +285,7 @@
</template>
<script setup>
  import { ref, reactive, onMounted } from "vue";
  import { ref, reactive, computed, onMounted } from "vue";
  import { ElMessage, ElMessageBox } from "element-plus";
  import { Plus, Edit, Delete, Search } from "@element-plus/icons-vue";
  import PIMTable from "@/components/PIMTable/PIMTable.vue";
@@ -313,8 +310,19 @@
  const processLoading = ref(false);
  const deviceOptions = ref([]);
  // 参数列表数据
  const paramList = ref([]);
  // 工序已选参数表格分页(接口一次返回全量)
  const paramPage2 = ref({
    current: 1,
    size: 10,
    total: 0,
  });
  const paramListRaw = ref([]);
  const paramList = computed(() => {
    const all = paramListRaw.value;
    const { current, size } = paramPage2.value;
    const start = (current - 1) * size;
    return all.slice(start, start + size);
  });
  const paramLoading = ref(false);
  // 数据字典
@@ -485,21 +493,21 @@
    }
  };
  const paramPage2 = ref({
    current: 1,
    size: 10,
    total: 0,
  });
  // 获取参数列表
  const getParamList = processId => {
    paramLoading.value = true;
    console.log(paramPage2.value, "paramPage2.value");
    getProcessParamList({ technologyOperationId: processId })
      .then(res => {
        console.log(res, "res");
        paramList.value = res.data || [];
        paramPage2.value.total = 0;
        const list = res.data || [];
        paramListRaw.value = Array.isArray(list) ? list : [];
        paramPage2.value.total = paramListRaw.value.length;
        const maxPage = Math.max(
          1,
          Math.ceil(paramPage2.value.total / paramPage2.value.size) || 1
        );
        if (paramPage2.value.current > maxPage) {
          paramPage2.value.current = maxPage;
        }
      })
      .catch(() => {
        ElMessage.error("获取参数列表失败");
@@ -512,6 +520,7 @@
  // 选择工序
  const selectProcess = process => {
    selectedProcess.value = process;
    paramPage2.value.current = 1;
    getParamList(process.id);
  };
@@ -556,7 +565,8 @@
          getProcessList();
          if (selectedProcess.value?.id === process.id) {
            selectedProcess.value = null;
            paramList.value = [];
            paramListRaw.value = [];
            paramPage2.value.total = 0;
          }
        })
        .catch(() => {
@@ -744,10 +754,8 @@
  };
  const handleParamPagination = obj => {
    console.log(obj, "obj");
    paramPage2.value.current = obj.page;
    paramPage2.value.size = obj.limit;
    getParamList(selectedProcess.value.id);
  };
  // 获取数据字典
src/views/productionPlan/productionPlan/index.vue
@@ -134,9 +134,8 @@
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary" @click="handleMergeSubmit">确定下发</el-button>
          <el-button @click="isShowNewModal = false">取消</el-button>
          <el-button type="primary"
                     @click="handleMergeSubmit">确定下发</el-button>
        </span>
      </template>
    </el-dialog>
@@ -228,9 +227,8 @@
      </el-form>
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary" @click="handleSubmit">确定</el-button>
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary"
                     @click="handleSubmit">确定</el-button>
        </span>
      </template>
    </el-dialog>
vite.config.js
@@ -8,11 +8,11 @@
  const { VITE_APP_ENV } = env;
  const baseUrl =
      env.VITE_APP_ENV === "development"
          ? "http://1.15.17.182:9003"
          ? "http://1.15.17.182:9048"
          : env.VITE_BASE_API;
  const javaUrl =
      env.VITE_APP_ENV === "development"
          ? "http://1.15.17.182:9002"
          ? "http://1.15.17.182:9049"
          : env.VITE_JAVA_API;
  return {
    define:{