优化逻辑bug

This commit is contained in:
Teo
2025-08-20 19:25:52 +08:00
parent 6cab291522
commit c98e3f72e1
28 changed files with 962 additions and 787 deletions

View File

@ -5,7 +5,7 @@ VITE_APP_TITLE = 煤科建管平台
VITE_APP_ENV = 'development'
# 开发环境
VITE_APP_BASE_API = 'http://192.168.110.180:8899'
VITE_APP_BASE_API = 'http://192.168.110.209:8899'
# 无人机接口地址

View File

@ -19,22 +19,3 @@ onMounted(() => {
});
});
</script>
<style>
* {
-webkit-touch-callout: none; /*系统默认菜单被禁用*/
-webkit-user-select: none; /*webkit浏览器*/
-khtml-user-select: none; /*早期浏览器*/
-moz-user-select: none; /*火狐*/
-ms-user-select: none; /*IE10*/
user-select: none;
}
input {
-webkit-user-select: auto; /*webkit浏览器*/
user-select: auto;
}
textarea {
user-select: auto;
-webkit-user-select: auto; /*webkit浏览器*/
}
</style>

View File

@ -96,7 +96,8 @@ const props = defineProps({
// 大小限制(MB)
fileSize: propTypes.number.def(5),
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf', 'png', 'jpg', 'jpeg', 'zip']),
// fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf', 'png', 'jpg', 'jpeg', 'zip']),
fileType: propTypes.array.def(['pdf']),
// 是否显示提示
isShowTip: propTypes.bool.def(true),
//是否为施工人员上传
@ -310,11 +311,6 @@ const uploadedSuccessfully = (res: any) => {
emit('update:modelValue', listToString(fileList.value));
proxy?.$modal.closeLoading();
}
if (props.autoUpload && props.limit === fileList.value.length) {
fileUploadRef.value?.clearFiles();
fileList.value = [];
emit('update:modelValue', ''); // 同步到外部 v-model
}
// if (props.autoUpload && props.limit === fileList.value.length) {
// fileUploadRef.value?.clearFiles();
// fileList.value = [];

View File

@ -31,6 +31,7 @@
label="运行时长"
width="140"
:show-overflow-tooltip="true"
:sort-method="sortTime"
sortable
align="center"
></el-table-column>
@ -114,6 +115,25 @@ const handleDownload = (ossId: string) => {
proxy?.$download.oss(ossId);
};
// 解析时间字符串,返回秒数
function parseTimeStr(str: string): number {
let total = 0;
const minMatch = str.match(/(\d+)分钟/);
const secMatch = str.match(/(\d+)秒/);
if (minMatch) total += parseInt(minMatch[1]) * 60;
if (secMatch) total += parseInt(secMatch[1]);
return total;
}
// 排序函数,根据时间字符串解析后的秒数排序
function sortTime(a: any, b: any) {
console.log(a, b);
return a.runDurationNum - b.runDurationNum;
// return parseTimeStr(a.runDuration) - parseTimeStr(b.runDuration);
}
/**
* 对外暴露子组件方法
*/

View File

@ -4,8 +4,8 @@
<el-form-item label="消息提醒">
<el-checkbox-group v-model="form.messageType">
<el-checkbox value="1" name="type" disabled>站内信</el-checkbox>
<el-checkbox value="2" name="type">邮件</el-checkbox>
<el-checkbox value="3" name="type">短信</el-checkbox>
<el-checkbox value="2" name="type" disabled>邮件</el-checkbox>
<el-checkbox value="3" name="type" disabled>短信</el-checkbox>
</el-checkbox-group>
</el-form-item>
<el-form-item label="附件">

View File

@ -10,7 +10,7 @@
@click="isDisabled = false"
class="px-8 py-2.5 transition-all duration-300 font-medium"
v-if="isDisabled"
v-hasPermi="['cailiaoshebei:purchaseUser:addOrUpdate']"
v-hasPermi="['ailiaoshebei:purchaseUser:byProject']"
>
点击编辑
</el-button>
@ -38,11 +38,16 @@
@click="submitForm"
icon="Check"
class="px-8 py-2.5 transition-all duration-300 transform hover:scale-105 bg-blue-500 hover:bg-blue-600 text-white font-medium"
v-hasPermi="['cailiaoshebei:purchaseUser:addOrUpdate']"
v-hasPermi="['ailiaoshebei:purchaseUser:byProject']"
>
确认提交
</el-button>
<el-button @click="resetForm" icon="Refresh" class="px-8 py-2.5 transition-all duration-300 border-gray-300 hover:bg-gray-100 font-medium">
<el-button
@click="resetForm"
v-hasPermi="['ailiaoshebei:purchaseUser:byProject']"
icon="Refresh"
class="px-8 py-2.5 transition-all duration-300 border-gray-300 hover:bg-gray-100 font-medium"
>
重置
</el-button>
</div>

View File

@ -21,7 +21,7 @@
><el-button
type="danger"
size="default"
v-hasPermi="['cailiaoshebei:batchPlan:remove']"
v-hasPermi="['cailiaoshebei:materialbatchdemandplan:remove']"
@click="handleDeleteBatch"
icon="FolderDelete"
plain
@ -65,10 +65,14 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" v-if="form.mrpBaseBo.status == 'draft'">
<el-button type="primary" plain icon="Edit" @click="handleUpdata" v-hasPermi="['cailiaoshebei:cailiaoshebei:add']">修改</el-button>
<el-button type="primary" plain icon="Edit" @click="handleUpdata" v-hasPermi="['cailiaoshebei:materialbatchdemandplan:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button plain type="warning" icon="Finished" @click="handleAudit()" v-hasPermi="['out:monthPlan:remove']">审核</el-button>
<el-button plain type="warning" icon="Finished" @click="handleAudit()" v-hasPermi="['cailiaoshebei:materialbatchdemandplan:query']"
>审核</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
@ -82,7 +86,7 @@
<el-table-column label="质量标准" align="center" prop="qs" />
<el-table-column label="规格型号" align="center" prop="specification" />
<el-table-column label="计量单位" align="center" prop="unit" width="80" />
<el-table-column label="需求数量" align="center" prop="quantity" />
<el-table-column label="需求数量" align="center" prop="demandQuantity" />
<el-table-column label="需求到货时间" align="center" prop="arrivalTime" width="250" />
<el-table-column label="备注" align="center" prop="remark" />
</el-table>
@ -139,9 +143,9 @@
<el-input v-model="scope.row.unit" placeholder="请输入单位" disabled />
</template>
</el-table-column>
<el-table-column prop="quantity" align="center" label="数量" width="130">
<el-table-column prop="demandQuantity" align="center" label="数量" width="130">
<template #default="scope">
<el-input v-model="scope.row.quantity" placeholder="请输入数量" type="number" min="0" disabled />
<el-input v-model="scope.row.demandQuantity" placeholder="请输入数量" type="number" min="0" disabled />
</template>
</el-table-column>
<el-table-column prop="qs" align="center" label="质量标准" width="150">
@ -232,7 +236,8 @@ const initFormData: any = {
name: undefined,
specification: undefined,
unit: undefined,
quantity: undefined,
suppliespriceId: undefined,
demandQuantity: undefined,
qs: undefined,
arrivalTime: undefined,
remark: undefined
@ -289,7 +294,7 @@ const selectName = (val: any, row: any) => {
row.specification = selected.specification;
row.unit = selected.unit;
row.qs = selected.qs;
row.quantity = selected.quantity;
row.demandQuantity = selected.quantity;
row.remark = selected.remark;
row.arrivalTime = selected.arrivalTime;
}
@ -328,7 +333,7 @@ const addRow = () => {
name: undefined,
specification: undefined,
unit: undefined,
quantity: undefined,
demandQuantity: undefined,
qs: undefined,
arrivalTime: undefined,
remark: undefined
@ -352,7 +357,9 @@ const reset = () => {
name: undefined,
specification: undefined,
unit: undefined,
quantity: undefined,
suppliespriceId: undefined,
demandQuantity: undefined,
qs: undefined,
arrivalTime: undefined,
remark: undefined
@ -398,7 +405,7 @@ const handleUpdata = () => {
}, {});
});
console.log(form.value);
console.log(form.value.planList);
});
dialog.visible = true;
dialog.title = '修改物资-需求';

View File

@ -58,10 +58,20 @@
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" :offset="0"
><el-button type="primary" size="default" @click="addBatch" icon="FolderAdd" plain>新增</el-button></el-col
><el-button type="primary" size="default" v-hasPermi="['cailiaoshebei:cailiaoshebei:add']" @click="addBatch" icon="FolderAdd" plain
>新增</el-button
></el-col
>
<el-col :span="1.5" :offset="0"
><el-button type="danger" size="default" @click="handleDeleteBatch" icon="FolderDelete" plain>删除</el-button></el-col
><el-button
type="danger"
size="default"
v-hasPermi="['cailiaoshebei:cailiaoshebei:remove']"
@click="handleDeleteBatch"
icon="FolderDelete"
plain
>删除</el-button
></el-col
>
</el-row>
</template>
@ -125,7 +135,9 @@
>
</el-col>
<el-col :span="1.5">
<el-button plain type="warning" icon="Finished" @click="handleAudit()">审核</el-button>
<el-button plain type="warning" v-hasPermi="['cailiaoshebei:cailiaoshebei:query']" icon="Finished" @click="handleAudit()"
>审核</el-button
>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>

View File

@ -26,8 +26,8 @@
<el-input v-model="queryParams.storageUnit" placeholder="请输入保管单位" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" v-hasPermi="['materials:materialIssue:list']" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" v-hasPermi="['materials:materialIssue:list']" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>

View File

@ -23,8 +23,9 @@
<el-input v-model="queryParams.supplierUnit" placeholder="请输入供货单位" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" v-hasPermi="['materials:materialReceive:list']" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" v-hasPermi="['materials:materialReceive:list']" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>

View File

@ -81,10 +81,10 @@
<td colspan="8">
<span>是否附带以下随机资料</span>
<div class="file_detail">
<span>(1) 合格证 {{ formData.certCountFile ? formData.certCountFile.length : 0 }} </span>
<span>(2) 出厂报告 {{ formData.reportCountFileId ? formData.reportCountFileId.length : 0 }} </span>
<span>(3) 技术资料文件 {{ formData.techDocCountFileId ? formData.techDocCountFileId.length : 0 }} </span>
<span>(4) 厂家资质文件 {{ formData.licenseCountFileId ? formData.licenseCountFileId.length : 0 }} </span>
<span>(1) 合格证 {{ formData.certCount ? formData.certCount : 0 }} </span>
<span>(2) 出厂报告 {{ formData.reportCount ? formData.reportCount : 0 }} </span>
<span>(3) 技术资料文件 {{ formData.techDocCount ? formData.techDocCount : 0 }} </span>
<span>(4) 厂家资质文件 {{ formData.licenseCount ? formData.licenseCount : 0 }} </span>
</div>
</td>
</tr>

View File

@ -8,8 +8,9 @@
<el-input v-model="queryParams.materialsName" placeholder="请输入材料名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" v-hasPermi="['materials:materialsInventory:list']" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" v-hasPermi="['materials:materialsInventory:list']" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>

View File

@ -47,13 +47,15 @@
plain
icon="Check"
@click="submitForm"
v-hasPermi="['cailiaoshebei:cailiaoshebei:delete']"
v-hasPermi="['cailiaoshebei:materialsorder:modifyTheOrderForm']"
>保存</el-button
>
<el-button plain type="warning" icon="Finished" @click="handleAudit()" v-hasPermi="['out:monthPlan:remove']">审核</el-button>
<el-button plain type="warning" icon="Finished" @click="handleAudit()" v-hasPermi="['cailiaoshebei:materialsorder:list']"
>审核</el-button
>
</el-col>
<el-col :span="1.5" v-if="form.approvalOrder == 'draft'">
<el-button type="success" plain icon="Share" @click="onShare" v-hasPermi="['cailiaoshebei:cailiaoshebei:delete']">分享</el-button>
<el-button type="success" plain icon="Share" @click="onShare" v-hasPermi="['cailiaoshebei:materialsorder:list']">分享</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>

View File

@ -65,7 +65,12 @@
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" width="150" fixed="right">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['cailiaoshebei:cailiaoshebei:edit']"
<el-button
link
type="primary"
icon="Edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['cailiaoshebei:materialsorder:changeTheStatusOfTheMaterials']"
>修改</el-button
>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['cailiaoshebei:cailiaoshebei:remove']"

View File

@ -6,10 +6,10 @@
<el-row :gutter="10" class="mb8">
<el-form :inline="true">
<el-form-item v-if="state.masterData.status == 'draft'">
<el-button type="primary" icon="edit" @click="clickApprovalSheet1()">审批</el-button>
<el-button type="primary" v-hasPermi="['design:totalsupplyplan:queryList']" icon="edit" @click="clickApprovalSheet1()">审批</el-button>
</el-form-item>
<el-form-item v-if="state.masterData.status == 'waiting' || state.masterData.status == 'finish'">
<el-button icon="view" @click="lookApprovalFlow()" type="warning">查看流程</el-button>
<el-button icon="view" v-hasPermi="['design:totalsupplyplan:queryList']" @click="lookApprovalFlow()" type="warning">查看流程</el-button>
</el-form-item>
</el-form>
<right-toolbar @queryTable="getMasterDataList"></right-toolbar>
@ -46,6 +46,7 @@
<el-button
:disabled="state.masterData.status == 'waiting' || state.masterData.status == 'finish'"
type="primary"
v-hasPermi="['design:totalsupplyplan:edit']"
@click="editApprovalSheet(row)"
>修改</el-button
>

View File

@ -14,8 +14,9 @@
<el-date-picker clearable v-model="queryParams.arrivalDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择到货日期" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" v-hasPermi="['cailiaoshebei:purchaseDoc:list']" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" v-hasPermi="['cailiaoshebei:purchaseDoc:list']" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
@ -49,7 +50,7 @@
<el-table-column label="联系人" align="center" prop="contacts" />
<el-table-column label="物流单号" align="center" prop="remark" width="150">
<template #default="scope">
<el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['out:monthPlan:remove']">查看物流单</el-button>
<el-button link type="primary" icon="View" @click="handleView(scope.row)" v-hasPermi="['cailiaoshebei:ltn:list']">查看物流单</el-button>
</template>
</el-table-column>
<el-table-column label="采购经办人" align="center" prop="purchasingAgent" width="90" />
@ -76,7 +77,7 @@
v-if="scope.row.status == 'draft' || scope.row.status == 'back'"
icon="Finished"
@click="handleAudit(scope.row)"
v-hasPermi="['cailiaoshebei:purchaseDoc:edit']"
v-hasPermi="['cailiaoshebei:purchaseDoc:query']"
>
审核</el-button
>
@ -86,7 +87,7 @@
v-if="scope.row.status != 'draft'"
icon="view"
@click="handleViewDetail(scope.row)"
v-hasPermi="['cailiaoshebei:purchaseDoc:edit']"
v-hasPermi="['cailiaoshebei:purchaseDoc:query']"
>
查看</el-button
>
@ -114,7 +115,7 @@
v-if="scope.row.status == 'finish' && scope.row.feedbackUrl"
icon="Share"
@click="handleShare(scope.row)"
v-hasPermi="['cailiaoshebei:purchaseDoc:remove']"
v-hasPermi="['cailiaoshebei:purchaseDoc:list']"
>物流单分享</el-button
>
</template>

View File

@ -8,8 +8,9 @@
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" v-hasPermi="['system:repertoryDetails:list']" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" v-hasPermi="['system:repertoryDetails:list']" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>

View File

@ -8,56 +8,34 @@
<el-input v-model="queryParams.name" placeholder="请输入设备材料名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
<el-button type="primary" v-hasPermi="['cailiaoshebei:repertory:list']" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" v-hasPermi="['cailiaoshebei:repertory:list']" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</transition>
<el-card shadow="never">
<!-- <template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:repertory:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['system:repertory:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['system:repertory:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['system:repertory:export']">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template> -->
<el-table v-loading="loading" :data="repertoryList">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="设备材料名称" align="center" prop="name" />
<el-table-column label="规格型号" align="center" prop="specification" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="View" @click="handleUpdate(scope.row)" v-hasPermi="['system:repertory:edit']">详情</el-button>
<el-button link type="primary" icon="View" @click="handleUpdate(scope.row)" v-hasPermi="['cailiaoshebei:repertoryDetails:list']"
>详情</el-button
>
</template>
</el-table-column>
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
</div>
</template>
<script setup name="Repertory" lang="ts">
import { listRepertory, getRepertory, delRepertory, addRepertory, updateRepertory } from '@/api/materials/repertory';
import { listRepertory } from '@/api/materials/repertory';
import { RepertoryVO, RepertoryQuery, RepertoryForm } from '@/api/materials/repertory/types';
import { useUserStoreHook } from '@/store/modules/user';

View File

@ -4,17 +4,6 @@
<!-- 流程分类树 -->
<el-col style="" :span="5">
<el-card shadow="hover">
<!-- <template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5" :offset="0"
><el-button type="primary" size="default" @click="addBatch" icon="FolderAdd" plain>新增</el-button></el-col
>
<el-col :span="1.5" :offset="0"
><el-button type="danger" size="default" @click="handleDeleteBatch" icon="FolderDelete" plain>删除</el-button></el-col
>
</el-row>
</template> -->
<el-input v-model="batchNumber" placeholder="请输入批次号" @input="searchBatchList" prefix-icon="Search" clearable />
<el-tree
ref="batchTreeRef"

View File

@ -2,17 +2,27 @@
<div class="p-5">
<!-- 主要内容区 -->
<el-card class="mb-5">
<el-button icon="Refresh" @click="refreshData" class="transition-all duration-200 hover:shadow-md">
<el-button
icon="Refresh"
v-hasPermi="['cailiaoshebei:physicalsupply:list']"
@click="refreshData"
class="transition-all duration-200 hover:shadow-md"
>
刷新
</el-button>
</el-card>
<!-- 数据表格 -->
<div class="bg-white rounded-lg shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md">
<el-table v-loading="loading" :data="tableData" border stripe
<el-table
v-loading="loading"
:data="tableData"
border
stripe
:header-cell-style="{ 'background-color': '#f5f7fa', 'font-weight': 'bold' }"
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 305px)"
:row-class-name="tableRowClassName">
:row-class-name="tableRowClassName"
>
<el-table-column prop="id" label="ID" width="180" align="center"></el-table-column>
<el-table-column prop="name" label="材料名称" min-width="150"></el-table-column>
<el-table-column prop="specification" label="规格" min-width="120"></el-table-column>
@ -39,12 +49,27 @@
<template #default="scope">
<!-- <el-button size="small" icon="Plus" @click="handleAddSon(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button> -->
<el-button size="small" icon="Edit" @click="handleEdit(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="View" @click="jumpRouter(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="Delete" @click="handleDelete(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"></el-button>
<el-button
size="small"
v-hasPermi="['cailiaoshebei:physicalsupply:edit']"
icon="Edit"
@click="handleEdit(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"
></el-button>
<el-button
size="small"
v-hasPermi="['cailiaoshebei:physicalsupplySon:list']"
icon="View"
@click="jumpRouter(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"
></el-button>
<el-button
size="small"
v-hasPermi="['cailiaoshebei:physicalsupply:remove']"
icon="Delete"
@click="handleDelete(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"
></el-button>
</template>
</el-table-column>
</el-table>
@ -52,18 +77,27 @@
<!-- 分页 -->
<div class="flex items-center justify-between p-4 border-t">
<div class="text-gray-500 text-sm">
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{ Math.min(currentPage *
pageSize, total)
}}
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{ Math.min(currentPage * pageSize, total) }}
</div>
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 20, 50, 100]"
:total="total" layout="prev, pager, next, jumper, sizes" @size-change="handleSizeChange"
@current-change="handleCurrentChange"></el-pagination>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="total"
layout="prev, pager, next, jumper, sizes"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
></el-pagination>
</div>
</div>
<!-- 新增/编辑对话框 -->
<el-dialog v-model="dialogVisible" :title="dialogType === 'add' ? '新增记录' : '编辑记录'" :width="dialogWidth"
:fullscreen="isFullscreen" :before-close="handleDialogClose">
<el-dialog
v-model="dialogVisible"
:title="dialogType === 'add' ? '新增记录' : '编辑记录'"
:width="dialogWidth"
:fullscreen="isFullscreen"
:before-close="handleDialogClose"
>
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px" class="space-y-4">
<el-row :gutter="20">
<el-col :span="12">
@ -107,8 +141,12 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="合同签订时间" prop="contractSigning">
<el-date-picker v-model="formData.contractSigning" type="datetime" placeholder="选择合同签订时间"
value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
<el-date-picker
v-model="formData.contractSigning"
type="datetime"
placeholder="选择合同签订时间"
value-format="YYYY-MM-DD HH:mm:ss"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
@ -137,9 +175,7 @@
<template #footer>
<div class="flex justify-end gap-2">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleSave" :loading="saveLoading">
保存
</el-button>
<el-button type="primary" @click="handleSave" :loading="saveLoading"> 保存 </el-button>
</div>
</template>
</el-dialog>
@ -154,7 +190,7 @@ import { useRouter } from 'vue-router';
const userStore = useUserStoreHook();
const router = useRouter();
const currentProject = computed(() => userStore.selectedProject);
import { useMaterialsQueryList, newMaterialsAdd, materialsEdit, materialsDel, queryMaterialsInfo } from "@/api/materials/usageMaterials/index";
import { useMaterialsQueryList, newMaterialsAdd, materialsEdit, materialsDel, queryMaterialsInfo } from '@/api/materials/usageMaterials/index';
// 表格数据相关
const tableData = ref([]);
const total = ref(0);
@ -208,25 +244,23 @@ const formRules = reactive({
{ required: true, message: '请输入供应商', trigger: 'blur' },
{ max: 100, message: '供应商名称不能超过100个字符', trigger: 'blur' }
],
findType: [
{ required: true, message: '请选择类型', trigger: 'change' }
]
findType: [{ required: true, message: '请选择类型', trigger: 'change' }]
});
// 格式化日期
const formatDate = (dateString) => {
if (!dateString) return '-';
const date = new Date(dateString);
return date.toLocaleString('zh-CN', {
return date
.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
}).replace(',', ' ');
})
.replace(',', ' ');
};
// 表格行样式
@ -293,7 +327,7 @@ const handleEdit = (row) => {
resetForm();
// 填充表单数据
Object.keys(formData).forEach(key => {
Object.keys(formData).forEach((key) => {
if (row.hasOwnProperty(key)) {
formData[key] = row[key];
}
@ -302,55 +336,49 @@ const handleEdit = (row) => {
dialogVisible.value = true;
};
const handleAddSon = (row) => {
ElMessageBox.confirm(
'确认提交',
'Warning',
{
ElMessageBox.confirm('确认提交', 'Warning', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
materialsEdit(formData).then(res => {
let { code } = res
type: 'warning'
})
.then(() => {
materialsEdit(formData).then((res) => {
let { code } = res;
if (code === 200) {
ElMessage({
type: 'success',
message: '提交成功',
})
message: '提交成功'
});
}
});
})
}).catch(() => {
.catch(() => {
ElMessage({
type: 'info',
message: '已取消提交',
})
})
message: '已取消提交'
});
});
};
// 删除
const handleDelete = (row) => {
currentRow.value = row;
ElMessageBox.confirm(
'确定要删除这条记录吗?此操作不可撤销,请谨慎操作',
'提示',
{
ElMessageBox.confirm('确定要删除这条记录吗?此操作不可撤销,请谨慎操作', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
type: 'warning'
})
.then(() => {
confirmDelete();
}).catch(() => {
})
.catch(() => {
ElMessage({
type: 'info',
message: '已取消删除',
})
})
message: '已取消删除'
});
});
};
// 确认删除
const confirmDelete = async () => {
if (!currentRow.value) return;
@ -358,7 +386,7 @@ const confirmDelete = async () => {
deleteLoading.value = true;
try {
// 模拟API请求
const res = await materialsDel(currentRow.value.id)
const res = await materialsDel(currentRow.value.id);
const { code } = res;
if (code === 200) {
ElMessage.success('删除成功');
@ -376,8 +404,6 @@ const confirmDelete = async () => {
};
//
// 保存
const handleSave = async () => {
// 表单验证
@ -390,16 +416,16 @@ const handleSave = async () => {
if (dialogType.value === 'add') {
// 新增
formData.projectId = currentProject.value?.id;
const res = await newMaterialsAdd(formData)
let { code } = res
const res = await newMaterialsAdd(formData);
let { code } = res;
if (code === 200) {
ElMessage.success('新增成功');
fetchData();
}
} else {
// 编辑
const res = await materialsEdit(formData)
let { code } = res
const res = await materialsEdit(formData);
let { code } = res;
if (code === 200) {
ElMessage.success('保存成功');
fetchData();
@ -422,7 +448,7 @@ const resetForm = () => {
}
// 重置表单数据
Object.keys(formData).forEach(key => {
Object.keys(formData).forEach((key) => {
formData[key] = '';
});
@ -451,8 +477,6 @@ const jumpRouter = (row) => {
onMounted(() => {
fetchData();
});
</script>
<style scoped>
</style>
<style scoped></style>

View File

@ -1,8 +1,24 @@
<template>
<div class="p-5">
<el-card class="mb-5">
<el-button type="primary" icon="Plus" @click="handleAdd" class="transition-all duration-200 hover:shadow-md"> 新增 </el-button>
<el-button icon="Refresh" @click="refreshData" class="transition-all duration-200 hover:shadow-md"> 刷新 </el-button>
<el-button
type="primary"
icon="Plus"
v-hasPermi="['cailiaoshebei:physicalsupplySon:add']"
@click="handleAdd"
class="transition-all duration-200 hover:shadow-md"
>
新增
</el-button>
<el-button
icon="Refresh"
v-hasPermi="['cailiaoshebei:physicalsupplySon:list']"
@click="refreshData"
class="transition-all duration-200 hover:shadow-md"
>
刷新
</el-button>
</el-card>
<div class="bg-white rounded-lg shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md">
<!-- 数据表格 -->
@ -138,10 +154,12 @@
icon="Edit"
@click="handleEdit2(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"
v-hasPermi="['cailiaoshebei:physicalsupplySon:edit']"
></el-button>
<el-button
size="small"
icon="Delete"
v-hasPermi="['cailiaoshebei:physicalsupplySon:remove']"
@click="handleDelete2(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"
></el-button>

View File

@ -1,19 +1,36 @@
<template>
<div style="padding: 20px;">
<div style="padding: 20px">
<el-card class="mb-5">
<el-button type="primary" icon="Plus" @click="handleAdd" class="transition-all duration-200 hover:shadow-md">
<el-button
type="primary"
v-hasPermi="['cailiaoshebei:physicalsupply:add']"
icon="Plus"
@click="handleAdd"
class="transition-all duration-200 hover:shadow-md"
>
新增
</el-button>
<el-button icon="Refresh" @click="refreshData" class="transition-all duration-200 hover:shadow-md"> 刷新
<el-button
v-hasPermi="['cailiaoshebei:physicalsupply:list']"
icon="Refresh"
@click="refreshData"
class="transition-all duration-200 hover:shadow-md"
>
刷新
</el-button>
</el-card>
<!-- 数据表格 -->
<div class="bg-white rounded-lg shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md">
<el-table v-loading="loading" :data="tableData" border stripe
<el-table
v-loading="loading"
:data="tableData"
border
stripe
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 305px)"
:header-cell-style="{ 'background-color': '#f5f7fa', 'font-weight': 'bold' }"
:row-class-name="tableRowClassName">
:row-class-name="tableRowClassName"
>
<el-table-column prop="id" label="ID" width="180" align="center"></el-table-column>
<el-table-column prop="name" label="材料名称" align="center"></el-table-column>
<el-table-column prop="specification" label="规格" align="center"></el-table-column>
@ -38,14 +55,34 @@
</el-table-column>
<el-table-column label="操作" width="240" align="center" fixed="right">
<template #default="scope">
<el-button size="small" icon="Plus" @click="handleAddSon(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="Edit" @click="handleEdit(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="View" @click="jumpRouter(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="Delete" @click="handleDelete(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"></el-button>
<el-button
v-hasPermi="['cailiaoshebei:physicalsupplySon:add']"
size="small"
icon="Plus"
@click="handleAddSon(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"
></el-button>
<el-button
v-hasPermi="['cailiaoshebei:physicalsupply:edit']"
size="small"
icon="Edit"
@click="handleEdit(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"
></el-button>
<el-button
v-hasPermi="['cailiaoshebei:physicalsupplySon:list']"
size="small"
icon="View"
@click="jumpRouter(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"
></el-button>
<el-button
v-hasPermi="['cailiaoshebei:physicalsupply:remove']"
size="small"
icon="Delete"
@click="handleDelete(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"
></el-button>
</template>
</el-table-column>
</el-table>
@ -53,17 +90,27 @@
<!-- 分页 -->
<div class="flex items-center justify-between p-4 border-t">
<div class="text-gray-500 text-sm">
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{ Math.min(currentPage * pageSize, total)
}}
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{ Math.min(currentPage * pageSize, total) }}
</div>
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 20, 50, 100]"
:total="total" layout="prev, pager, next, jumper, sizes" @size-change="handleSizeChange"
@current-change="handleCurrentChange"></el-pagination>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="total"
layout="prev, pager, next, jumper, sizes"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
></el-pagination>
</div>
</div>
<!-- 新增/编辑对话框 -->
<el-dialog v-model="dialogVisible" :title="dialogType === 'add' ? '新增记录' : '编辑记录'" :width="dialogWidth"
:fullscreen="isFullscreen" :before-close="handleDialogClose">
<el-dialog
v-model="dialogVisible"
:title="dialogType === 'add' ? '新增记录' : '编辑记录'"
:width="dialogWidth"
:fullscreen="isFullscreen"
:before-close="handleDialogClose"
>
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px" class="space-y-4">
<el-row :gutter="20">
<el-col :span="12">
@ -107,8 +154,12 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="合同签订时间" prop="contractSigning">
<el-date-picker v-model="formData.contractSigning" type="datetime" placeholder="选择合同签订时间"
value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
<el-date-picker
v-model="formData.contractSigning"
type="datetime"
placeholder="选择合同签订时间"
value-format="YYYY-MM-DD HH:mm:ss"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
@ -121,8 +172,7 @@
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="供货要求" prop="supplyRequirements">
<el-input v-model="formData.supplyRequirements" placeholder="请输入供货要求" type="textarea"
:rows="3"></el-input>
<el-input v-model="formData.supplyRequirements" placeholder="请输入供货要求" type="textarea" :rows="3"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -143,7 +193,6 @@
</template>
</el-dialog>
</div>
</template>
<script setup>
@ -154,7 +203,7 @@ import { useRouter } from 'vue-router';
const userStore = useUserStoreHook();
const router = useRouter();
const currentProject = computed(() => userStore.selectedProject);
import { useMaterialsQueryList, newMaterialsAdd, materialsEdit, materialsDel, queryMaterialsInfo } from '@/api/materials/usageMaterials/index';
import { useMaterialsQueryList, newMaterialsAdd, materialsEdit, materialsDel } from '@/api/materials/usageMaterials/index';
// 表格数据相关
const tableData = ref([]);
const total = ref(0);
@ -251,7 +300,7 @@ const fetchData = async () => {
ElMessage.error('获取数据失败:' + error.message);
console.error(error);
} finally {
loading.value = false;//
loading.value = false; //
}
};
@ -332,22 +381,20 @@ const handleAddSon = (row) => {
// 删除
const handleDelete = (row) => {
currentRow.value = row;
ElMessageBox.confirm(
'确定要删除这条记录吗?此操作不可撤销,请谨慎操作',
'提示',
{
ElMessageBox.confirm('确定要删除这条记录吗?此操作不可撤销,请谨慎操作', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
type: 'warning'
})
.then(() => {
confirmDelete();
}).catch(() => {
})
.catch(() => {
ElMessage({
type: 'info',
message: '已取消删除',
})
})
message: '已取消删除'
});
});
};
// 确认删除

View File

@ -1,20 +1,34 @@
<template>
<div class="p-5">
<el-card class="mb-5">
<el-button type="primary" icon="Plus" @click="handleAdd"
class="transition-all duration-200 hover:shadow-md">
<el-button
v-hasPermi="['cailiaoshebei:physicalsupplySon:add']"
type="primary"
icon="Plus"
@click="handleAdd"
class="transition-all duration-200 hover:shadow-md"
>
新增
</el-button>
<el-button icon="Refresh" @click="refreshData" class="transition-all duration-200 hover:shadow-md">
<el-button
v-hasPermi="['cailiaoshebei:physicalsupplySon:list']"
icon="Refresh"
@click="refreshData"
class="transition-all duration-200 hover:shadow-md"
>
刷新
</el-button>
</el-card>
<!-- 数据表格 -->
<div class="bg-white rounded-lg shadow-sm overflow-hidden transition-all duration-300 hover:shadow-md">
<el-table v-loading="loading2" :data="tableData" stripe
<el-table
v-loading="loading2"
:data="tableData"
stripe
:header-cell-style="{ 'background-color': '#f5f7fa', 'font-weight': 'bold' }"
style="width: 100%; margin-bottom: 20px; height: calc(100vh - 305px)"
:row-class-name="tableRowClassName">
:row-class-name="tableRowClassName"
>
<!-- 基础信息列 -->
<el-table-column prop="id" label="ID" width="180" align="center"></el-table-column>
<el-table-column prop="batch" label="批次" align="center"></el-table-column>
@ -52,14 +66,12 @@
<el-table-column prop="actualAcceptance" label="实际验收数量" min-width="120" align="right"></el-table-column>
<el-table-column prop="differenceQuantity" label="差异量" min-width="100" align="right">
<template #default="scope">
<span
:class="scope.row.differenceQuantity && parseFloat(scope.row.differenceQuantity) !== 0 ? 'text-red-500' : ''">
<span :class="scope.row.differenceQuantity && parseFloat(scope.row.differenceQuantity) !== 0 ? 'text-red-500' : ''">
{{ scope.row.differenceQuantity || '-' }}
</span>
</template>
</el-table-column>
<el-table-column prop="dhDifferenceQuantity" label="到货差异量" min-width="120"
align="right"></el-table-column>
<el-table-column prop="dhDifferenceQuantity" label="到货差异量" min-width="120" align="right"></el-table-column>
<!-- 金额相关列 -->
<el-table-column prop="cargoAmount" label="货物金额" min-width="120" align="right">
@ -124,14 +136,10 @@
<el-button size="small" type="text">查看详情</el-button>
</template>
<div class="space-y-2 text-sm">
<p><span class="font-medium">采购备注</span>{{ scope.row.cgRemark || '-' }}
</p>
<p><span class="font-medium">到货备注</span>{{ scope.row.dhRemark || '-' }}
</p>
<p><span class="font-medium">供应商备注</span>{{ scope.row.gysRemark || '-'
}}</p>
<p><span class="font-medium">结算备注</span>{{ scope.row.jsRemark || '-' }}
</p>
<p><span class="font-medium">采购备注</span>{{ scope.row.cgRemark || '-' }}</p>
<p><span class="font-medium">到货备注</span>{{ scope.row.dhRemark || '-' }}</p>
<p><span class="font-medium">供应商备注</span>{{ scope.row.gysRemark || '-' }}</p>
<p><span class="font-medium">结算备注</span>{{ scope.row.jsRemark || '-' }}</p>
</div>
</el-popover>
</template>
@ -140,23 +148,38 @@
<!-- 操作列 -->
<el-table-column label="操作" min-width="120" align="center" fixed="right">
<template #default="scope">
<el-button size="small" icon="Edit" @click="handleEdit2(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"></el-button>
<el-button size="small" icon="Delete" @click="handleDelete2(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"></el-button>
<el-button
size="small"
v-hasPermi="['cailiaoshebei:physicalsupplySon:edit']"
icon="Edit"
@click="handleEdit2(scope.row)"
class="text-blue-600 hover:text-blue-800 transition-colors"
></el-button>
<el-button
size="small"
v-hasPermi="['cailiaoshebei:physicalsupplySon:remove']"
icon="Delete"
@click="handleDelete2(scope.row)"
class="text-red-600 hover:text-red-800 transition-colors"
></el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="flex flex-wrap items-center justify-between p-4 border-t gap-4">
<div class="text-gray-500 text-sm">
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{
Math.min(currentPage * pageSize, total)
}}
{{ total }} 条记录当前显示第 {{ (currentPage - 1) * pageSize + 1 }} {{ Math.min(currentPage * pageSize, total) }}
</div>
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize"
:page-sizes="[10, 20, 50, 100]" :total="total" layout="prev, pager, next, jumper, sizes"
@size-change="handleSizeChange" @current-change="handleCurrentChange" small></el-pagination>
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:page-sizes="[10, 20, 50, 100]"
:total="total"
layout="prev, pager, next, jumper, sizes"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
small
></el-pagination>
</div>
</div>
<!-- 删除确认对话框 -->
@ -171,14 +194,19 @@
<template #footer>
<div class="flex justify-center gap-2">
<el-button @click="deleteDialogVisible2 = false">取消</el-button>
<el-button type="danger" @click="confirmDelete2" :loading="deleteLoading">
确认删除
</el-button>
<el-button type="danger" @click="confirmDelete2" :loading="deleteLoading"> 确认删除 </el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="dialogVisible2" :title="dialogType2 === 'addSon' ? '新增采购信息' : '编辑采购信息'" :width="dialogWidth"
:fullscreen="isFullscreen" :close-on-click-modal="false" :before-close="handleClose" destroy-on-close>
<el-dialog
v-model="dialogVisible2"
:title="dialogType2 === 'addSon' ? '新增采购信息' : '编辑采购信息'"
:width="dialogWidth"
:fullscreen="isFullscreen"
:close-on-click-modal="false"
:before-close="handleClose"
destroy-on-close
>
<!-- 表单内容 -->
<el-form ref="formRef" :model="form" :rules="formRules" label-width="140px" class="space-y-4">
<!-- 第一行 -->
@ -190,8 +218,12 @@
</el-col>
<el-col :span="12">
<el-form-item label="联系单下达时间" prop="issuanceTime">
<el-date-picker v-model="form.issuanceTime" type="datetime" placeholder="选择联系单下达时间"
value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
<el-date-picker
v-model="form.issuanceTime"
type="datetime"
placeholder="选择联系单下达时间"
value-format="YYYY-MM-DD HH:mm:ss"
></el-date-picker>
</el-form-item>
</el-col>
</el-row>
@ -205,8 +237,12 @@
</el-col>
<el-col :span="12">
<el-form-item label="要求到货时间" prop="requireDelivery">
<el-date-picker v-model="form.requireDelivery" type="datetime" placeholder="选择要求到货时间"
value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
<el-date-picker
v-model="form.requireDelivery"
type="datetime"
placeholder="选择要求到货时间"
value-format="YYYY-MM-DD HH:mm:ss"
></el-date-picker>
</el-form-item>
</el-col>
</el-row>
@ -220,8 +256,12 @@
</el-col>
<el-col :span="12">
<el-form-item label="计划到货时间" prop="scheduledDelivery">
<el-date-picker v-model="form.scheduledDelivery" type="datetime" placeholder="选择计划到货时间"
value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
<el-date-picker
v-model="form.scheduledDelivery"
type="datetime"
placeholder="选择计划到货时间"
value-format="YYYY-MM-DD HH:mm:ss"
></el-date-picker>
</el-form-item>
</el-col>
</el-row>
@ -235,8 +275,12 @@
</el-col>
<el-col :span="12">
<el-form-item label="实际到货时间" prop="actualDelivery">
<el-date-picker v-model="form.actualDelivery" type="datetime" placeholder="选择实际到货时间"
value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
<el-date-picker
v-model="form.actualDelivery"
type="datetime"
placeholder="选择实际到货时间"
value-format="YYYY-MM-DD HH:mm:ss"
></el-date-picker>
</el-form-item>
</el-col>
</el-row>
@ -259,8 +303,12 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="验收移交时间" prop="acceptanceCheck">
<el-date-picker v-model="form.acceptanceCheck" type="datetime" placeholder="选择验收移交时间"
value-format="YYYY-MM-DD HH:mm:ss"></el-date-picker>
<el-date-picker
v-model="form.acceptanceCheck"
type="datetime"
placeholder="选择验收移交时间"
value-format="YYYY-MM-DD HH:mm:ss"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
@ -338,8 +386,7 @@
<el-row :gutter="20">
<el-col :span="24">
<el-form-item label="到货要求" prop="deliveryRequirements">
<el-input v-model="form.deliveryRequirements" placeholder="请输入到货要求" type="textarea"
rows="3"></el-input>
<el-input v-model="form.deliveryRequirements" placeholder="请输入到货要求" type="textarea" rows="3"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -358,8 +405,7 @@
</el-col>
<el-col :span="8">
<el-form-item label="供应商备注" prop="gysRemark">
<el-input v-model="form.gysRemark" placeholder="请输入供应商备注" type="textarea"
rows="4"></el-input>
<el-input v-model="form.gysRemark" placeholder="请输入供应商备注" type="textarea" rows="4"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -376,23 +422,18 @@
<!-- 底部按钮 -->
<template #footer>
<div class="flex justify-end gap-3">
<el-button @click="handleCancel" class="transition-all duration-200">
取消
</el-button>
<el-button type="primary" @click="handleSubmit" :loading="submitLoading"
class="transition-all duration-200">
<el-button @click="handleCancel" class="transition-all duration-200"> 取消 </el-button>
<el-button type="primary" @click="handleSubmit" :loading="submitLoading" class="transition-all duration-200">
{{ dialogType2 === 'addSon' ? '新增' : '保存' }}
</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { ref, reactive, onMounted, toRaw, getCurrentInstance } from 'vue';
import { materialsUsageDetails, materialsSonAdd, materialsSonDel, materialsSonEdit } from "@/api/materials/usageMaterials/index";
import { routerRename } from '@/api/air';
import { materialsUsageDetails, materialsSonAdd, materialsSonDel, materialsSonEdit } from '@/api/materials/usageMaterials/index';
const { proxy } = getCurrentInstance();
const dialogVisible2 = ref(false);
const dialogType2 = ref('addSon'); // add 或 edit
@ -401,7 +442,7 @@ const currentRow2 = ref(null);
const tableData = ref([]);
const loading2 = ref(false);
const submitLoading = ref(false);
const routeParams = ref({})
const routeParams = ref({});
const currentPage = ref(1);
const total = ref(0);
const pageSize = ref(10);
@ -447,14 +488,14 @@ const handleAdd = () => {
dialogVisible2.value = true;
dialogType2.value = 'addSon';
resetForm();
}
};
const resetForm = () => {
if (formRef.value) {
formRef.value.resetFields();
}
// 重置表单数据
Object.keys(form).forEach(key => {
Object.keys(form).forEach((key) => {
form[key] = '';
});
@ -469,7 +510,7 @@ const handleEdit2 = (row) => {
resetForm();
// 填充表单数据
Object.keys(form).forEach(key => {
Object.keys(form).forEach((key) => {
if (row.hasOwnProperty(key)) {
form[key] = row[key];
}
@ -479,22 +520,20 @@ const handleEdit2 = (row) => {
};
const handleDelete2 = (row) => {
currentRow2.value = row;
ElMessageBox.confirm(
'确定要删除这条记录吗?此操作不可撤销,请谨慎操作',
'提示',
{
ElMessageBox.confirm('确定要删除这条记录吗?此操作不可撤销,请谨慎操作', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
}
).then(() => {
type: 'warning'
})
.then(() => {
confirmDelete2();
}).catch(() => {
})
.catch(() => {
ElMessage({
type: 'info',
message: '已取消删除',
})
})
message: '已取消删除'
});
});
};
const confirmDelete2 = async () => {
if (!currentRow2.value) return;
@ -502,7 +541,7 @@ const confirmDelete2 = async () => {
deleteLoading.value = true;
try {
// 模拟API请求
const res = await materialsSonDel(currentRow2.value.id)
const res = await materialsSonDel(currentRow2.value.id);
const { code } = res;
if (code === 200) {
ElMessage.success('删除成功');
@ -532,15 +571,15 @@ const handleSubmit = async () => {
// 如果是新增清除id
if (dialogType2.value === 'addSon') {
submitData.physicalsupplyId = routeParams.value.id
const res = await materialsSonAdd(submitData)
submitData.physicalsupplyId = routeParams.value.id;
const res = await materialsSonAdd(submitData);
const { code } = res;
if (code === 200) {
ElMessage.success('新增成功');
materialsUsageDetails1();
}
} else {
const res = await materialsSonEdit(submitData)
const res = await materialsSonEdit(submitData);
const { code } = res;
if (code === 200) {
ElMessage.success('保存成功');
@ -557,22 +596,24 @@ const handleSubmit = async () => {
}
};
const materialsUsageDetails1 = () => {
materialsUsageDetails({ physicalsupplyId: routeParams.value.id }).then(res => {
tableData.value = res.rows
})
}
materialsUsageDetails({ physicalsupplyId: routeParams.value.id }).then((res) => {
tableData.value = res.rows;
});
};
// 格式化日期
const formatDate = (dateString) => {
if (!dateString) return '-';
const date = new Date(dateString);
return date.toLocaleString('zh-CN', {
return date
.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit'
}).replace(',', ' ');
})
.replace(',', ' ');
};
function handleCancel() {
dialogVisible2.value = false;
@ -582,10 +623,10 @@ const refreshData = () => {
materialsUsageDetails1();
ElMessage.success('数据已刷新');
};
function handleSizeChange() { }
function handleSizeChange() {}
onMounted(() => {
routeParams.value = proxy.$route.query;
console.log('routeParams.value', routeParams.value);
materialsUsageDetails1();
})
});
</script>

View File

@ -208,7 +208,20 @@ const data = reactive<PageData<ConstructionValueForm, ConstructionValueQuery>>({
artificialNum: [{ required: true, message: '人工填报数量不能为空', trigger: 'blur' }],
reportDateId: [{ required: true, message: '上报日期不能为空', trigger: 'blur' }],
uavNum: [{ required: true, message: '无人机识别数量不能为空', trigger: 'blur' }],
confirmNum: [{ required: true, message: '确认数量不能为空', trigger: 'blur' }],
confirmNum: [
{ required: true, message: '确认数量不能为空', trigger: 'blur' },
{
validator: (rule: any, value: any, callback: any) => {
// 判断是否整数
if (!/^\d+$/.test(value)) {
callback(new Error('请输入整数'));
} else {
callback();
}
},
trigger: 'blur'
}
],
outValue: [{ required: true, message: '产值不能为空', trigger: 'blur' }]
}
});

View File

@ -73,7 +73,7 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<div v-if="scope.row.parentId">
<div>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['progress:progressCategory:edit']">
修改
</el-button>
@ -88,6 +88,21 @@
<!-- 添加或修改分项工程单价对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="progressCategoryFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="父类别" prop="parentId">
<el-tree-select
v-model="form.parentId"
:data="progressCategoryOptions"
:props="{ value: 'id', label: 'name', children: 'children' }"
value-key="id"
placeholder="请选择父类别"
check-strictly
/>
</el-form-item>
<el-form-item label="计量方式" prop="unitType">
<el-select v-model="form.unitType" placeholder="请选择关联数据">
<el-option v-for="dict in progress_unit_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="类别名称" prop="name">
<el-input v-model="form.name" placeholder="请输入类别名称" :disabled="form.id != null" />
</el-form-item>
@ -100,7 +115,14 @@
<el-form-item label="综合单价" prop="unitPrice">
<el-input v-model="form.unitPrice" placeholder="请输入综合单价" />
</el-form-item>
<el-form-item label="关联数据" prop="workType">
<el-select v-model="form.workType" placeholder="请选择关联数据">
<el-option v-for="dict in progress_work_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
<!-- <el-form-item label="总数量/百分比" prop="total">
<el-input v-model="form.total" placeholder="请输入总数量/百分比" />
</el-form-item> -->
@ -128,7 +150,7 @@ import { ProgressCategoryVO, ProgressCategoryQuery, ProgressCategoryForm } from
import { useUserStoreHook } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { progress_unit_type, progress_status } = toRefs<any>(proxy?.useDict('progress_unit_type', 'progress_status'));
const { progress_unit_type, progress_work_type } = toRefs<any>(proxy?.useDict('progress_unit_type', 'progress_work_type'));
// 获取用户 store
const userStore = useUserStoreHook();
@ -161,7 +183,7 @@ const dialog = reactive<DialogOption>({
const initFormData: ProgressCategoryForm = {
id: undefined,
parentId: undefined,
projectId: currentProject.value?.id,
projectId: '',
matrixId: undefined,
matrixName: undefined,
name: undefined,
@ -183,6 +205,7 @@ const data = reactive<PageData<ProgressCategoryForm, ProgressCategoryQuery>>({
queryParams: {
parentId: undefined,
projectId: currentProject.value?.id,
matrixId: undefined,
matrixName: undefined,
name: undefined,
@ -229,7 +252,10 @@ const getList = async () => {
});
if (!matrixValue.value) matrixValue.value = matrixList[0].id;
matrixOptions.value = matrixList;
console.log('🚀 ~ getList ~ matrixList:', matrixList);
queryParams.value.matrixId = matrixList[0].children[0].matrixId;
form.value.projectId = matrixList[0].projectId;
form.value.matrixId = matrixList[0].children[0].matrixId;
}
}
loading.value = true;
@ -262,12 +288,19 @@ const cancel = () => {
// 表单重置
const reset = () => {
form.value = { ...initFormData };
const projectId = form.value.projectId;
const matrixId = form.value.matrixId;
form.value = { ...initFormData, projectId, matrixId };
isDisabled.value = false;
progressCategoryFormRef.value?.resetFields();
};
/** 级联选择器改变事件 */
const handleChange = (value: number) => {
form.value.matrixId = value[1];
form.value.projectId = value[0];
queryParams.value.matrixId = value[1];
getList();

View File

@ -9,7 +9,7 @@
</el-form-item>
<el-form-item label="施工类型" prop="constructionType">
<el-select v-model="queryParams.constructionType" placeholder="请选择施工类型" clearable @change="getList">
<el-option v-for="dict in project_category_type" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-option v-for="dict in project_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item>
@ -89,7 +89,7 @@
</el-form-item>
<el-form-item label="施工类型" prop="constructionType">
<el-select v-model="form.constructionType" placeholder="请选择施工类型" disabled>
<el-option v-for="dict in project_category_type" :key="dict.value" :label="dict.label" :value="dict.value" />
<el-option v-for="dict in project_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="计量方式" prop="unitType">
@ -141,8 +141,8 @@ type ProgressCategoryTemplateOption = {
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { progress_work_type, progress_unit_type, project_category_type } = toRefs<any>(
proxy?.useDict('progress_work_type', 'progress_unit_type', 'project_category_type')
const { progress_work_type, progress_unit_type, project_type } = toRefs<any>(
proxy?.useDict('progress_work_type', 'progress_unit_type', 'project_type')
);
const progressCategoryTemplateList = ref<ProgressCategoryTemplateVO[]>([]);
const progressCategoryTemplateOptions = ref<ProgressCategoryTemplateOption[]>([]);

View File

@ -77,13 +77,13 @@
<!-- 添加或修改进度类别模版对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="progressCategoryTemplateFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="父类别id" prop="parentId">
<el-form-item label="父类别" prop="parentId">
<el-tree-select
v-model="form.parentId"
:data="progressCategoryTemplateOptions"
:props="{ value: 'id', label: 'name', children: 'children' }"
value-key="id"
placeholder="请选择父类别id"
placeholder="请选择父类别"
check-strictly
/>
</el-form-item>
@ -138,9 +138,7 @@ type ProgressCategoryTemplateOption = {
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { progress_work_type, progress_unit_type, project_category_type } = toRefs<any>(
proxy?.useDict('progress_work_type', 'progress_unit_type', 'project_category_type')
);
const { progress_work_type, progress_unit_type } = toRefs<any>(proxy?.useDict('progress_work_type', 'progress_unit_type'));
// 获取用户 store
const userStore = useUserStoreHook();
// 从 store 中获取项目列表和当前选中的项目

View File

@ -324,6 +324,7 @@ const getList = async () => {
if (data) {
menuList.value = data;
}
loading.value = false;
};
/** 查询菜单下拉树结构 */