Commit 9dbb9738 authored by ZhangRunSong's avatar ZhangRunSong

feat:借出草稿

parent c06c6cb1
......@@ -34,6 +34,14 @@ export function updateApply(data) {
data: data
})
}
// 审核借用申请
export function approve(data) {
return request({
url: '/material/apply/check',
method: 'put',
data: data
})
}
// 删除物品借用申请
export function delApply(id) {
......
......@@ -35,6 +35,15 @@ export function updateReturn(data) {
})
}
// 修改物品归还申请
export function approve(data) {
return request({
url: '/material/return/check',
method: 'put',
data: data
})
}
// 删除物品归还申请
export function delReturn(id) {
return request({
......
......@@ -135,6 +135,7 @@ const getUserList = () => {
const handleSubmit = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
form.value.draft = "0"
addMaterial(form.value).then(response => {
if (response.code === 200){
proxy.$modal.msgSuccess("新增成功");
......@@ -157,7 +158,7 @@ const saveDraft = () => {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
form.value.draft="1"
form.value.draft= "1"
addMaterial(form.value).then(response => {
if (response.code === 200){
proxy.$modal.msgSuccess("草稿保存成功");
......@@ -185,7 +186,7 @@ function resetForm() {
proxy.resetForm("materialRef");
}
// 返回项目管理页面
// 返回
const reset = () => {
// 返回项目
proxy.$router.push({ path: '/material/materialDetail' })
......
......@@ -187,29 +187,6 @@ const handleSubmit = () => {
});
};
// 新增草稿
const saveDraft = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
proxy.$confirm('确认提交吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
addDraft(form).then(response => {
if (response.code === 200){
proxy.$modal.msgSuccess("草稿保存成功");
proxy.$router.push({ path: '/material/materialDetail' })
}else {
proxy.$modal.msgError(response.msg)
}
});
}).catch(()=> {})
}
});
}
// 表单重置
function resetForm() {
form.value = {
......@@ -230,7 +207,7 @@ function resetForm() {
proxy.resetForm("materialRef");
}
// 返回项目管理页面
// 返回
const reset = () => {
// 返回项目
proxy.$router.push({ path: '/material/materialDetail' })
......
......@@ -78,7 +78,7 @@
plain
@click="handleExport"
v-hasPermi="['psa:material:export']"
><img src="../../assets/icons/common/print.png" height="38" width="38"/>
><img src="../../assets/icons/common/export2.png" height="38" width="38"/>
</el-button>
</el-tooltip>
</span>
......
......@@ -288,11 +288,14 @@ const handleSubmit = () => {
const saveDraft = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
addDraft(form).then(response => {
form.value.draft = "1";
addApply(form.value).then(response => {
if (response.code === 200){
proxy.$modal.msgSuccess("草稿保存成功");
proxy.$router.push({ path: '/material/materialDetail' })
resetForm();
proxy.$router.push({ path: '/material/materialApply' })
}else {
resetForm();
proxy.$modal.msgError(response.msg)
}
});
......@@ -314,12 +317,13 @@ function resetForm() {
unit: null,
maxStock: null
}],
remark: null
remark: null,
draft : null
};
proxy.resetForm("materialRef");
}
// 返回项目管理页面
// 返回
const reset = () => {
// 返回项目
proxy.$router.push({ path: '/material/materialApply' })
......
This diff is collapsed.
<template>
<div class="app-container">
<div class="content" style="position: relative">
<div style="padding-left: 15px ;padding-top: 15px">
<span class="bold-text" style="border-bottom: 3px solid blue;">借用草稿</span>
</div>
<div style="padding-top: 28px ;padding-left: 10px; ">
<el-form :model="form" label-width="auto">
<el-row>
<el-col :span="2">
<label class="label-title">项目名称:</label>
</el-col>
<el-col :span="2">
<span class="label">
{{ project_list.find(item => item.id === form.projectId)?.projectName || '未知类型' }}
</span>
</el-col>
</el-row>
<el-row>
<el-col :span="2">
<label class="label-title">申请人:</label>
</el-col>
<el-col :span="2">
<span class="label">
{{form.userName}}
</span>
</el-col>
</el-row>
<el-row>
<el-col :span="2">
<label class="label-title">申请时间:</label>
</el-col>
<el-col :span="5">
<span class="label">
未开始
</span>
</el-col>
</el-row>
<el-row>
<el-col :span="2">
<label class="label-title">审批状态:</label>
</el-col>
<el-col :span="2">
<template v-for="(item, index) in material_status" :key="index">
<span class="label" v-if="item.value === form.checkStatus">
</span>
</template>
</el-col>
</el-row>
<el-row>
<el-col :span="2">
<label class="label-title">申请备注:</label>
</el-col>
<el-col :span="15">
<span class="label">
{{ form.remark }}
</span>
</el-col>
</el-row>
<el-row>
<el-col :span="2">
<label class="label-title">申请物品:</label>
</el-col>
<el-col :span="20">
<div v-for="(item, index) in form.items" :key="index" class="item-row" style="display: flex; gap: 30px">
<span style="flex: 1; min-width: 120px" class="label">物品类型:{{ material_type.find(m => m.id === item.type)?.typeName || '—' }}</span>
<span style="flex: 1; min-width: 120px" class="label" >物品名称:{{ all_material_type_detail.find(d => d.id === item.material_detail)?.materialName || '—' }}</span>
<span style="flex: 1; min-width: 120px" class="label" >申请数量:{{ item.quantity || 0 }}</span>
</div>
</el-col>
</el-row>
</el-form>
<div style="position: absolute;right: 52px;bottom: 42px">
<el-button type="primary" size="large" class="btn-A" @click="reset">返回</el-button>
</div>
</div>
</div>
</div>
</template>
<script setup>
import {getApply} from "../../api/material/apply";
import { listProject} from "../../api/project/project.js";
import {listMaterialType,listMaterialTypeDetail} from "../../api/material/material.js";
const { proxy } = getCurrentInstance();
const {material_status } = proxy.useDict('material_status');
const project_list = ref([]);
const all_material_type_detail = ref([]);
const material_type = ref([]);
const form = ref({
id: null,
projectId: null,
userId: null,
userName: null,
checkStatus: null,
remark: null,
createBy: null,
createTime: null,
items: [{
type: null,
material_detail: null,
quantity: null
}],
})
// 格式化日期
/*function formatDate(date) {
if (!date) return '-';
const d = new Date(date);
return `${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;
}*/
// 返回
const reset = () => {
if (returnType === "1"){
// 返回项目
proxy.$router.push({ path: '/material/materialBorrowApproval' })
}else if (returnType === "0") {
// 返回项目
proxy.$router.push({ path: '/material/materialApply' })
}
else if (returnType === "2" ) {
proxy.$router.push({ path: '/materials/apply/applydraft' })
}
}
// 条页面来源
let returnType=null;
/** 根据ID查到的详细信息 */
const getInfo = () =>{
returnType = proxy.$route.query.type;
getApply(proxy.$route.query.id).then(response=>{
form.value = response.data;
})
}
/** 获取项目列表 */
function getProjectList(){
listProject().then(response =>{
project_list.value = response.rows;
console.log("project_list:",project_list.value)
})
}
/** 获取物品类型 */
function getTypeList() {
listMaterialType().then(response => {
material_type.value = response.data;
});
}
/** 获取类型的物品列表 */
function getTypeDetailList(){
listMaterialTypeDetail().then(response => {
all_material_type_detail.value = response.data;
});
}
onMounted(() => {
//根据id查询信息
getInfo();
//获取项目列表
getProjectList();
//获取物品类型
getTypeList();
//获取物品信息
getTypeDetailList();
})
</script>
<style scoped lang="scss">
.bold-text {
width: 72px;
height: 15px;
font-family: PingFangSC-Medium;
font-weight: 900;
font-size: 18px;
color: #0D162A;
letter-spacing: 0;
line-height: 15px;
}
.label-title {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 19px;
color: #666666;
letter-spacing: 0;
//text-align: right;
line-height: 40px;
}
.bordered {
margin-left: 110px;
padding: 20px;
background: #FAFAFA;
border: 1px solid #C8CEDE;
border-radius: 2px;
//min-height: 200px;
}
.label {
font-family: PingFangSC-Regular;
font-weight: 400;
font-size: 19px;
color: #4A4E54;
letter-spacing: 0;
line-height: 40px;
}
.file-item {
display: block;
margin: 9px 0;
}
.file-item .el-link {
font-size: 18px;
}
.table-container {
display: flex;
justify-content: center;
}
</style>
This diff is collapsed.
......@@ -78,22 +78,23 @@
@click="handleAdd"
v-hasPermi="['material:apply:add']"
>借用申请</el-button>
<el-tooltip content="导出" placement="top">
<el-tooltip content="草稿箱" placement="top">
<el-button
type="text"
plain
@click="handleExport"
v-hasPermi="['material:apply:export']"
><img src="../../assets/icons/common/daochu.png" height="38" width="38"/>
@click="draft"
v-hasPermi="['material:apply:draft']"
><img src="../../assets/icons/common/rightone.png" height="38" width="38"/>
</el-button>
</el-tooltip>
<el-tooltip content="草稿箱" placement="top">
<el-tooltip content="导出" placement="top">
<el-button
type="text"
plain
@click="draft"
v-hasPermi="['material:apply:draft']"
><img src="../../assets/icons/common/rightone.png" height="38" width="38"/>
@click="handleExport"
v-hasPermi="['material:apply:export']"
><img src="../../assets/icons/common/export2.png" height="38" width="38"/>
</el-button>
</el-tooltip>
</span>
......@@ -331,7 +332,9 @@ function handleAdd() {
title.value = "添加物品借用申请";*/
proxy.$router.push({ path: '/materials/apply/applyadd' });
}
function draft() {
proxy.$router.push({ path: '/materials/apply/applydraft' });
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
......
......@@ -213,7 +213,7 @@
</template>
<script setup>
import {listApply} from "@/api/material/apply";
import {listApply,approve} from "../../api/material/apply.js";
import {listMaterialType, listMaterialTypeDetail} from "../../api/material/material.js";
import {listProject} from "../../api/project/project.js";
......@@ -346,7 +346,8 @@ function handleApprove(row) {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
approve(row.id).then(response => {
row.checkStatus = "1"
approve(row).then(response => {
proxy.$message({
message: '通过成功',
type: 'success'
......@@ -363,7 +364,8 @@ function handleReject(row) {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
reject(row.id).then(response => {
row.checkStatus = "2"
approve(row).then(response => {
proxy.$message({
message: '驳回成功',
type: 'success'
......
......@@ -114,7 +114,7 @@ const form = ref({
return `${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;
}*/
// 返回项目管理页面
// 返回
const reset = () => {
if (returnType === "1"){
// 返回项目
......
......@@ -194,7 +194,7 @@ function resetForm() {
proxy.resetForm("materialRef");
}
// 返回项目管理页面
// 返回
const reset = () => {
// 返回项目
proxy.$router.push({ path: '/material/materialEntry' })
......
......@@ -202,7 +202,7 @@ function resetForm() {
proxy.resetForm("materialRef");
}
// 返回项目管理页面
// 返回
const reset = () => {
// 返回项目
proxy.$router.push({ path: '/materials/entry/entrydraft' });
......
......@@ -73,7 +73,7 @@
plain
@click="handleExport"
v-hasPermi="['psa:entry:export']"
><img src="../../assets/icons/common/print.png" height="38" width="38"/>
><img src="../../assets/icons/common/export2.png" height="38" width="38"/>
</el-button>
</el-tooltip>
</span>
......
......@@ -290,7 +290,7 @@ function resetForm() {
proxy.resetForm("materialRef");
}
// 返回项目管理页面
// 返回
const reset = () => {
// 返回项目
proxy.$router.push({ path: '/material/materialReturn' })
......
......@@ -58,22 +58,24 @@
@click="handleAdd"
v-hasPermi="['material:return:add']"
>归还申请</el-button>
<el-tooltip content="导出" placement="top">
<el-tooltip content="草稿箱" placement="top">
<el-button
type="text"
plain
@click="handleExport"
v-hasPermi="['material:apply:export']"
><img src="../../assets/icons/common/daochu.png" height="38" width="38"/>
@click="draft"
v-hasPermi="['material:apply:draft']"
><img src="../../assets/icons/common/rightone.png" height="38" width="38"/>
</el-button>
</el-tooltip>
<el-tooltip content="草稿箱" placement="top">
<el-tooltip content="导出" placement="top">
<el-button
type="text"
plain
@click="draft"
v-hasPermi="['material:apply:draft']"
><img src="../../assets/icons/common/rightone.png" height="38" width="38"/>
@click="handleExport"
v-hasPermi="['material:apply:export']"
><img src="../../assets/icons/common/export2.png" height="38" width="38"/>
</el-button>
</el-tooltip>
</span>
......
This diff is collapsed.
......@@ -114,7 +114,7 @@ const form = ref({
return `${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;
}*/
// 返回项目管理页面
// 返回
const reset = () => {
// 返回项目
proxy.$router.push({ path: '/material/materialReturn' })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment