bonus-ui/src/views/material/back/component/home.vue

606 lines
22 KiB
Vue
Raw Normal View History

<template>
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
2025-11-08 16:18:58 +08:00
<el-form-item prop="startTime">
2024-11-14 10:31:33 +08:00
<el-date-picker
2025-11-08 16:18:58 +08:00
v-model="queryParams.startTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="开始日期"
2025-11-24 11:23:13 +08:00
@change="() => queryParams.endTime = ''"
2025-11-08 16:18:58 +08:00
style="width: 130px"
/>
</el-form-item>
<el-form-item>-</el-form-item>
<el-form-item prop="endTime">
<el-date-picker
v-model="queryParams.endTime"
value-format="yyyy-MM-dd"
type="date"
placeholder="结束日期"
2025-11-24 11:23:13 +08:00
:picker-options="{ disabledDate: (t) => t.getTime() < new Date(queryParams.startTime).getTime() - 86400000}"
2025-11-08 16:18:58 +08:00
style="width: 130px"
/>
2024-11-14 10:31:33 +08:00
</el-form-item>
<el-form-item prop="keyWord">
<el-input
maxlength="50"
v-model="queryParams.keyWord"
placeholder="请输入关键字"
clearable
style="width: 240px"
/>
</el-form-item>
<el-form-item prop="status">
<el-select
2024-11-22 09:04:26 +08:00
v-model="queryParams.status"
clearable
filterable
style="width: 240px"
placeholder="请选择退料状态"
2024-12-03 09:18:08 +08:00
>
<el-option
2024-11-14 10:31:33 +08:00
v-for="dict in dict.type.back_task_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
<!-- <el-option
v-for="item in taskStatusList"
:key="item.id"
:label="item.name"
:value="item.id"
2024-11-14 10:31:33 +08:00
></el-option> -->
</el-select>
2025-06-09 17:36:15 +08:00
</el-form-item>
<el-form-item prop="unitId">
2024-12-30 10:33:42 +08:00
<treeselect
2024-11-14 10:31:33 +08:00
v-model="queryParams.unitId"
2024-12-30 10:33:42 +08:00
:options="unitList" :normalizer="normalizer"
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择退料单位" @select="unitChange"
2025-06-09 17:36:15 +08:00
/>
</el-form-item>
<el-form-item prop="proId">
2024-12-30 10:33:42 +08:00
<treeselect
2024-11-14 10:31:33 +08:00
v-model="queryParams.proId"
2024-12-30 10:33:42 +08:00
:options="proList" :normalizer="normalizer"
:show-count="true" style="width: 240px" :disable-branch-nodes="true"
noChildrenText="没有数据了" noOptionsText="没有数据" noResultsText="没有搜索结果"
placeholder="请选择退料工程" @select="proChange"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>查询</el-button
>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
2024-11-16 15:25:23 +08:00
<el-button type="primary" icon="el-icon-plus" plain size="mini" @click="handleAdd">退料接收</el-button>
2025-06-09 17:36:15 +08:00
</el-col>
<el-col :span="1.5">
<el-button icon="el-icon-download" size="mini" @click="handleExport" >导出</el-button>
2025-06-09 17:36:15 +08:00
</el-col>
2025-11-10 17:37:03 +08:00
<el-col :span="1.5">
<el-button icon="el-icon-download" size="mini" @click="handleExportDetails" >导出退料明细</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" ></right-toolbar>
</el-row>
2025-08-21 11:24:07 +08:00
<el-table v-loading="loading" :data="typeList" border @selection-change="handleSelectionChange" :max-height="650">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<!-- <el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope">
2025-09-11 14:19:04 +08:00
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column> -->
2025-07-24 14:23:57 +08:00
<el-table-column align="center" label="序号" type="index" >
<template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
2025-11-13 17:05:42 +08:00
<el-table-column label="分公司" align="center" prop="impUnitName" width="140" />
2025-07-24 14:23:57 +08:00
<el-table-column label="退料单位" align="center" prop="unitName" width="180"/>
<el-table-column label="退料工程" align="center" prop="proName" width="180"/>
<el-table-column label="退料单号" align="center" prop="code" :show-overflow-tooltip="true" width="150"/>
<el-table-column label="物资类型" align="center" prop="typeName" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="退料人" align="center" prop="backPerson" :show-overflow-tooltip="true" width="100"/>
<el-table-column label="退料人电话" align="center" prop="phone" :show-overflow-tooltip="true" width="120"/>
2025-07-24 14:23:57 +08:00
<el-table-column label="创建时间" align="center" prop="createTime" width="100"/>
<el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true" width="100"/>
<!-- <el-table-column label="协议号" align="center" prop="agreementCode" :show-overflow-tooltip="true"/> -->
<el-table-column label="状态" align="center" :show-overflow-tooltip="true" prop="taskStatus" width="100">
<template slot-scope="scope">
2024-11-14 10:31:33 +08:00
<dict-tag :options="dict.type.back_task_status" :value="scope.row.taskStatus"/>
<!-- <el-button type="text" v-if="scope.row.taskStatus == '0'">未完成</el-button>
<el-button type="text" style="color: #67c23a" v-if="scope.row.taskStatus == '2'">已完成</el-button>
<el-button type="text" style="color: #67c23a" v-if="scope.row.taskStatus == '1'">已驳回</el-button> -->
</template>
</el-table-column>
<el-table-column label="打印状态" align="center" prop="printStatus" :show-overflow-tooltip="true" width="100">
<template slot-scope="scope">
2024-11-14 10:31:33 +08:00
<div v-if="scope.row.printStatus==1">已打印</div>
<div v-if="scope.row.printStatus==0">未打印</div>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="240" fixed="right">
<template slot-scope="scope">
2025-06-09 17:36:15 +08:00
<el-button size="mini" plain icon="el-icon-zoom-in"
@click="handleSee(scope.row)"
>查看</el-button>
2025-06-09 17:36:15 +08:00
<el-button size="mini" type="primary" plain icon="el-icon-edit"
v-if="scope.row.taskStatus!=2&&scope.row.taskStatus!=1" @click="handleUpdate(scope.row)"
>编辑</el-button>
<el-button size="mini" type="success" plain icon="el-icon-refresh"
2025-01-09 15:07:22 +08:00
v-if="scope.row.taskStatus!=2&&scope.row.taskStatus!=1" @click="handleSubmit(scope.row)"
2025-06-09 17:36:15 +08:00
>提交</el-button>
<el-button size="mini" type="danger" icon="el-icon-delete"
2024-11-14 18:06:10 +08:00
v-if="scope.row.taskStatus!=2&&scope.row.taskStatus!=1"
@click="handleDelete(scope.row)"
>删除</el-button>
<el-button size="mini" type="info" icon="el-icon-zoom-in"
@click="handlePrint(scope.row)"
>退料单</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
2024-12-03 09:18:08 +08:00
<!-- 退料单 -->
<dialogFormByCq :dialogTitle="title" :isShowFlag.sync="isShowOneFlag" :priKey="priKey" :rowObj="rowObj"></dialogFormByCq>
<!-- 提交 -->
<el-dialog v-loading.fullscreen.lock="fullscreenLoading" :title="title" :visible.sync="openOne" append-to-body width="400px">
<div class="submit_box">
<div>
<i class="el-icon-circle-check" style="color: #ff9900; font-size: 30px"></i>
</div>
<div class="submit_box_title">
<div>{{ openTextOne }}</div>
<div>{{ openTextTwo }}</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
2024-11-14 10:31:33 +08:00
<el-button @click="openOne=false">返回</el-button>
<el-button type="primary" @click="submitOpenOneForm()"
>确定</el-button>
</div>
</el-dialog>
<el-dialog v-loading.fullscreen.lock="fullscreenLoading" :title="title" :visible.sync="openTwo" append-to-body width="400px">
<div class="submit_box_two">
<div>
<i
class="el-icon-circle-check"
style="color: #00c196; font-size: 30px"
></i>
</div>
<div class="submit_box_title">{{ openTextThree }}</div>
</div>
<div slot="footer" class="dialog-footer"></div>
</el-dialog>
</div>
</template>
<script>
2024-12-03 09:18:08 +08:00
2024-11-14 10:31:33 +08:00
import {
getBackApplyList,
2024-11-14 18:06:10 +08:00
backApplyRemove,
submitBackApply
2024-11-14 10:31:33 +08:00
} from '@/api/back/index.js'
2026-01-29 10:39:29 +08:00
import {
getProData,
getUnitData,
} from '@/api/lease/outbound.js'
// import { getInfo, h } from '@/api/login'
// import {
// getUnitData,
// getProData,
// getAgreementInfoById,
// // getUseNumByTypeId
// } from '@/api/claimAndRefund/receive.js'
2024-11-15 19:28:43 +08:00
import dialogFormByCq from '@/views/material/back/component/dialogFormByCq.vue'
2024-12-30 10:33:42 +08:00
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
2025-11-10 17:37:03 +08:00
import { formatTime } from '@/utils/bonus'
export default {
name: '',
2024-11-14 10:31:33 +08:00
dicts: ['back_task_status'],
2024-12-30 10:33:42 +08:00
components: { dialogFormByCq,Treeselect },
data() {
return {
fullscreenLoading: false,
type: '',
isShowOneFlag: false,
priKey: '',
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 字典表格数据
typeList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: '', //关键字
2024-12-30 10:33:42 +08:00
unitId: null, //单位id
lotId: '', //工程id
2024-11-22 09:04:26 +08:00
status: '', //状态
typeId: '', //工机具类型
time: '',
agreementCode: '', //协议
startTime: '',
endTime: '',
2024-12-30 10:33:42 +08:00
proId: null,
2025-11-08 16:18:58 +08:00
startTime: '',
endTime: '',
},
selectTreeProps: {
children: 'children',
label: 'name',
// multiple: false,
value: 'id',
// multiple: true,
},
2024-12-03 09:18:08 +08:00
unitId: null,
projectId: null,
dialogQueryParams: {
pageNum: 1,
pageSize: 10,
},
// 表单参数
form: {},
// 表单校验
rules: {
dictName: [
{
required: true,
message: '字典名称不能为空',
trigger: 'blur',
},
],
dictType: [
{
required: true,
message: '字典类型不能为空',
trigger: 'blur',
},
],
},
openOne: false,
openTwo: false,
openTextOne: '',
openTextTwo: '',
openTextThree: '',
2025-06-09 17:36:15 +08:00
companyId: '',
unitList: [],
proList: [],
taskStatusList: [
{
2024-11-14 10:31:33 +08:00
name: '待退料',
id: '37',
},
{
2024-11-14 10:31:33 +08:00
name: '退料已提交',
id: '38',
2024-11-14 10:31:33 +08:00
}
],
rowObj: {},
loadingType: '',
loadingTotal: 0,
loadingList: [],
}
},
created() {
2025-07-09 17:06:52 +08:00
const end = new Date()
let start = new Date()
2025-07-18 12:00:38 +08:00
start.setMonth(start.getMonth() - 1)
2025-11-08 16:18:58 +08:00
this.queryParams.startTime = this.format(start)
this.queryParams.endTime = this.format(end)
2025-07-28 11:14:30 +08:00
// 不在这里直接调用getList等字典数据加载完成后再调用
2025-06-09 17:36:15 +08:00
this.initSelectData()
},
methods: {
2025-07-28 11:14:30 +08:00
// 字典数据加载完成后的回调
onDictReady(dict) {
// 获取back_task_status的所有选项
const validOptions = dict.type.back_task_status || []
2025-08-04 13:54:47 +08:00
2025-07-28 11:14:30 +08:00
// 如果有有效选项,设置第一个为默认值
if (validOptions.length > 0) {
this.queryParams.status = validOptions[0].value
}
2025-08-04 13:54:47 +08:00
2025-07-28 11:14:30 +08:00
// 执行查询
this.getList()
},
2025-07-09 17:06:52 +08:00
format(date) {
const y = date.getFullYear()
const m = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${y}-${m}-${day}`
},
2024-12-30 10:33:42 +08:00
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
2025-06-09 17:36:15 +08:00
},
2024-11-14 10:31:33 +08:00
initSelectData() {
this.GetUnitData()
this.GetProData()
},
// 获取 来往单位 列表数据
async GetUnitData() {
const params = {
2024-12-30 10:33:42 +08:00
// projectId: this.queryParams.proId /* */,
}
2026-01-29 10:39:29 +08:00
const res = await getUnitData(params)
2025-06-09 17:36:15 +08:00
this.unitList = res.data
},
2025-06-09 17:36:15 +08:00
unitChange(val){
2024-12-30 10:33:42 +08:00
setTimeout(()=>{
this.GetProData()
2025-06-09 17:36:15 +08:00
},500)
},
2024-11-14 10:31:33 +08:00
// 获取 工程名称 列表数据
async GetProData() {
const params = {
unitId: this.queryParams.unitId,
}
2026-01-29 10:39:29 +08:00
const res = await getProData(params)
2024-12-30 10:33:42 +08:00
this.proList = res.data;
this.queryParams.proId=null
},
2025-06-09 17:36:15 +08:00
proChange(val){
2024-12-30 10:33:42 +08:00
setTimeout(()=>{
this.GetUnitData()
2025-06-09 17:36:15 +08:00
},500)
},
2024-11-14 10:31:33 +08:00
/** 查询列表 startTime,结束日期endTime */
async getList() {
this.loading = true
2025-11-08 16:18:58 +08:00
// if (this.queryParams.time && this.queryParams.time.length > 0) {
// this.queryParams.startTime = this.queryParams.time[0]
// this.queryParams.endTime = this.queryParams.time[1]
// }else{
// this.queryParams.startTime=undefined
// this.queryParams.endTime=undefined
// }
try {
let params = {
companyId: this.companyId,
...this.queryParams,
}
2024-11-14 10:31:33 +08:00
const res = await getBackApplyList(params)
2025-01-24 14:49:15 +08:00
this.typeList = res.data.rows
this.total = res.data.total
this.loading = false
} catch (error) {}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
2025-07-09 17:06:52 +08:00
const end = new Date()
let start = new Date()
2025-07-18 12:00:38 +08:00
start.setMonth(start.getMonth() - 1)
2025-11-08 16:18:58 +08:00
this.queryParams.startTime = this.format(start)
this.queryParams.endTime = this.format(end)
// this.resetForm("queryForm");
this.unitId=null;
this.projectId=null;
this.queryParams.unitId = ""
this.queryParams.proId = ""
this.$refs.queryForm.resetFields()
this.initSelectData()
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.dictId)
this.single = selection.length != 1
this.multiple = !selection.length
},
2024-11-14 10:31:33 +08:00
/** 新增按钮操作 */
handleAdd() {
this.$emit('returnApply')
},
/** 修改按钮操作 */
handleUpdate(row) {
2024-11-14 10:31:33 +08:00
this.$emit("returnEdit",row.id);
},
2024-11-14 10:31:33 +08:00
/** 查看按钮操作 */
handleSee(row) {
this.$emit("queryReturn",row.id);
2024-12-03 09:18:08 +08:00
},
// 退料单
handleUpdateOrder() {
this.title = '查看'
this.isShowOneFlag = true
},
2024-11-14 18:06:10 +08:00
// // 提交
// handleSubmit() {
// this.title = '确认操作'
// this.openTextOne = '确认提交退料么?'
// this.openTextTwo = '确认提交退料么?'
// this.openOne = true
// },
// submitOpenOneForm() {
// this.openTextThree = '提交成功!'
// this.openTwo = true
// },
2024-12-03 09:18:08 +08:00
2024-11-14 18:06:10 +08:00
handleSubmit(row){
2025-08-04 13:54:47 +08:00
console.log(row)
2024-11-14 18:06:10 +08:00
this.$modal.confirm('是否确认提交所选择的退料任务?') .then(() => {
let param = {
id:row.id,
2025-08-04 13:54:47 +08:00
taskId:row.taskId,
proId:row.proId,
unitId:row.unitId,
2024-11-14 18:06:10 +08:00
}
submitBackApply(param).then((res) => {
2024-12-03 09:18:08 +08:00
this.getList()
2024-11-14 18:06:10 +08:00
this.$message.success('操作成功!')
2024-12-03 09:18:08 +08:00
})
}).catch(() => {
2024-11-14 18:06:10 +08:00
})
},
/** 删除按钮操作 */
handleDelete(row) {
2024-11-14 10:31:33 +08:00
// let param = {
// id:row.id+ '',
// }
this.$modal
2024-11-14 18:06:10 +08:00
.confirm('是否确认删除所选择的退料任务?')
.then(() => {
2024-11-22 09:04:26 +08:00
return backApplyRemove({id:row.id})
})
.then(() => {
2024-12-03 09:18:08 +08:00
this.getList()
this.$message.success('操作成功!')
})
2024-12-03 09:18:08 +08:00
.catch(() => {
})
},
handlePrint(row) {
this.isShowOneFlag = true
this.rowObj = row
},
2024-11-14 10:31:33 +08:00
/** 导出按钮操作 */
2025-11-10 17:37:03 +08:00
handleExport() {
// const formatTime = (date) => {
// const year = date.getFullYear();
// const month = String(date.getMonth() + 1).padStart(2, '0');
// const day = String(date.getDate()).padStart(2, '0');
// const hours = String(date.getHours()).padStart(2, '0');
// const minutes = String(date.getMinutes()).padStart(2, '0');
// const seconds = String(date.getSeconds()).padStart(2, '0');
// return `${year}${month}${day}_${hours}${minutes}${seconds}`;
// };
2025-06-09 17:36:15 +08:00
2025-11-10 17:37:03 +08:00
const currentTime = formatTime(new Date())
2025-06-09 17:36:15 +08:00
2025-11-10 17:37:03 +08:00
this.download(
'material/back_apply_info/export',
{
...this.queryParams,
2025-11-10 17:49:17 +08:00
// startTime: this.queryParams.time[0],
// endTime: this.queryParams.time[1]
2025-11-10 17:37:03 +08:00
},
`退料申请单_${currentTime}.xlsx`,
)
},
handleExportDetails() {
const currentTime = formatTime(new Date())
this.download(
2025-11-10 17:45:35 +08:00
'material/back_apply_info/exportBackDetailsList',
2025-11-10 17:37:03 +08:00
{
...this.queryParams,
2025-11-10 17:49:17 +08:00
// startTime: this.queryParams.time[0],
// endTime: this.queryParams.time[1]
2025-11-10 17:37:03 +08:00
},
`退料明细_${currentTime}.xlsx`,
)
},
},
}
</script>
<style lang="scss" scoped>
.submit_box {
display: flex;
justify-content: flex-start;
align-items: center;
.submit_box_title {
display: flex;
flex-direction: column;
margin-left: 15px;
:first-child {
font-size: 14px;
font-weight: 600;
}
:last-child {
margin-top: 6px;
font-size: 12px;
}
}
}
.submit_box_two {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
margin-left: 30%;
.submit_box_title {
display: flex;
flex-direction: column;
margin-left: 10px;
font-size: 18px;
font-weight: 600;
}
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
.dialog-footer {
display: flex;
justify-content: flex-end;
align-items: center;
}
</style>