bonus-ui/src/views/material/repair/repairManage/component/home.vue

306 lines
10 KiB
Vue
Raw Normal View History

<template>
<div>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="创建时间" prop="time">
<el-date-picker
v-model="queryParams.time"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
type="daterange"
value-format="yyyy-MM-dd"
style="width: 240px"
></el-date-picker>
</el-form-item>
<el-form-item label="关键字" prop="keyWord">
<el-input
maxlength="50"
v-model="queryParams.keyWord"
placeholder="请输入关键字"
clearable
style="width: 240px"
/>
</el-form-item>
<el-form-item label="状态" prop="taskStatus">
<el-select
v-model="queryParams.taskStatus"
clearable
filterable
style="width: 240px"
placeholder="请选择"
>
<el-option
v-for="dict in dict.type.back_task_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</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">
<el-button type="primary" plain size="mini" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain size="mini">提交</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<!-- <el-table-column label="序号" align="center" width="80" type="index>
<template scope="scope">
<span>{{(queryParams.pageNum - 1) * 10 + scope.$index + 1}}</span>
</template>
</el-table-column> -->
<el-table-column align="center" label="序号" type="index"/>
<el-table-column label="退料单位" align="center" prop="unitName" :show-overflow-tooltip="true"/>
<el-table-column label="退料工程" align="center" prop="proName" :show-overflow-tooltip="true"/>
<el-table-column label="维修单号" align="center" prop="code" :show-overflow-tooltip="true"/>
<el-table-column label="物资类型" align="center" prop="typeName" :show-overflow-tooltip="true"/>
<el-table-column label="退料单号" align="center" prop="code" :show-overflow-tooltip="true"/>
<el-table-column label="维修班组" align="center" prop="backPerson" :show-overflow-tooltip="true"/>
<!-- <el-table-column label="退料人电话" align="center" prop="phone" :show-overflow-tooltip="true"/> -->
<el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true"/>
<el-table-column label="创建时间" align="center" prop="createTime" :show-overflow-tooltip="true"/>
<el-table-column label="状态" align="center" :show-overflow-tooltip="true" prop="taskStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.back_task_status" :value="scope.row.taskStatus"/>
</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="250">
<template slot-scope="scope">
<el-button size="mini" plain icon="el-icon-zoom-in" @click="handleSee(scope.row)" >查看</el-button>
<el-button size="mini" type="warning" plain icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
<el-button size="mini" type="danger" icon="el-icon-delete" @click="handleDelete(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"
/>
</div>
</template>
<script>
import {
getBackApplyList,
getProjectList,
getUnitList,
backApplyRemove
} from '@/api/back/index.js'
import { getInfo, h } from '@/api/login'
export default {
name: '',
dicts: ['back_task_status'],
data() {
return {
type: '',
isShowOneFlag: false,
priKey: '',
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 字典表格数据
tableList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: '', //关键字
unitId: '', //单位id
proId: '', //工程id
taskStatus: '', //状态
typeId: '', //工机具类型
time: [],// 日期范围
agreementCode: '', //协议
startTime: '',
endTime: '',
},
companyId: '',
unitList: [],
proList: [],
}
},
created() {
this.getList();
// this.initSelectData()
// this.InitIGetInfo()
},
methods: {
//人员信息
InitIGetInfo() {
getInfo().then((res) => {
this.companyId = res.user.companyId
this.getList()
})
},
/** 查询列表 startTime,结束日期endTime */
async getList() {
this.loading = true
if (this.queryParams.time && this.queryParams.time.length > 0) {
this.queryParams.startTime = this.queryParams.time[0]
this.queryParams.endTime = this.queryParams.time[1]
}
try {
let params = {
companyId: this.companyId,
...this.queryParams,
}
const res = await getBackApplyList(params)
this.tableList = res.rows
this.total = res.total
this.loading = false
} catch (error) {}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.time = []
// this.resetForm("queryForm");
this.$refs.queryForm.resetFields()
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.dictId)
this.single = selection.length != 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$emit('handelAdd')
},
/** 修改按钮操作 */
handleUpdate(row) {
this.$emit("handelEdit",row.id);
},
/** 查看按钮操作 */
handleSee(row) {
this.$emit("handelView",row.id);
},
/** 删除按钮操作 */
handleDelete(row) {
// let param = {
// id:row.id+ '',
// }
this.$modal
.confirm('是否确认删除所选择的数据项?')
.then(() => {
return backApplyRemove(row.id)
})
.then(() => {
this.getList()
this.$message.success('操作成功!')
})
.catch(() => {
})
},
/** 导出按钮操作 */
handleExport() {
this.download(
'material/backApply/export',
{
...this.queryParams
},
`退料申请单_${new Date().getTime()}.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>