You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-cpt-vue/src/views/udi/trace/historyTask/index.vue

580 lines
19 KiB
Vue

<template>
<div>
<el-card>
<el-form label-width="110px" v-show="showSearch" size="mini">
<el-row type="flex">
<el-col type="flex" :span="8">
<el-form-item label="任务类型:" prop="taskType" class="query-form-item">
<el-select v-model="filterQuery.taskType"
placeholder="请选择任务类型"
style="width: 90%"
@change="onSubmit"
clearable
>
<el-option label="关联关系" value="1"></el-option>
<el-option label="入库" value="2"></el-option>
<el-option label="出库" value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col type="flex" :span="8">
<el-form-item label="任务状态:" prop="status" class="query-form-item">
<el-select v-model="filterQuery.status" placeholder="请选择任务状态" style="width: 90%" @change="onSubmit" clearable>
<el-option label="未处理" value="1"></el-option>
<el-option label="正在处理" value="2"></el-option>
<el-option label="已处理" value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col type="flex" :span="8">
<el-form-item label="产品通用名称:" prop="cpmctymc" class="query-form-item">
<el-input v-model="filterQuery.cpmctymc"
style="width: 90%"
placeholder="请输入产品通用名称"
@keyup.native="onSubmit"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<el-col type="flex" :span="8">
<el-form-item label="规格型号:" prop="ggxh" class="query-form-item">
<el-input v-model="filterQuery.ggxh"
style="width: 90%"
placeholder="请输入规格型号"
@keyup.native="onSubmit"
></el-input>
</el-form-item>
</el-col>
<el-col type="flex" :span="8">
<el-form-item label="医疗器械注册人:" prop="ylqxzcrbarmc" class="query-form-item">
<el-input v-model="filterQuery.ylqxzcrbarmc"
style="width: 90%"
placeholder="请输入医疗器械注册人"
@keyup.native="onSubmit"
></el-input>
</el-form-item>
</el-col>
<el-col type="flex" :span="8">
<el-form-item label="批次号:" prop="batchNo" class="query-form-item">
<el-input v-model="filterQuery.batchNo"
style="width: 90%"
placeholder="请输入批次号"
@keyup.native="onSubmit"
></el-input>
</el-form-item>
</el-col>
</el-row>
<!--时间筛选-->
<el-row>
<el-col :span="8" v-show='false'>
<el-form-item class="query-form-item" label="创建时间:">
<el-date-picker
:picker-options="pickerOptions"
v-model="actDateRange"
type="daterange"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 90%"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8" v-show='false'>
<el-form-item class="query-form-item" label="更新时间:">
<el-date-picker
:picker-options="pickerOptions"
v-model="auditDateRange"
type="daterange"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
style="width: 90%"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="top-right-btn" style="display:flex;">
<el-button-group>
<el-button icon="el-icon-view" type="primary" @click="hideSearch">显示/隐藏搜索栏
</el-button>
<el-button type="primary" icon="el-icon-refresh" @click="onReset">重置</el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit" size="mini"
>查询
</el-button
>
</el-button-group>
</div>
<el-divider style="margin: 15px"></el-divider>
<!-- @row-click="handleSelectionChange"-->
<el-table v-loading="loading" :data="taskList"
style="width: 100%"
highlight-current-row border>
<el-table-column label="序号" type="index"></el-table-column>
<!-- <el-table-column label="任务类型" prop="taskType" width="120"></el-table-column>-->
<el-table-column label="任务类型" prop="taskType" width="120">
<template slot-scope="scope">
{{ formatTaskType(scope.row) }}
</template>
</el-table-column>
<!-- <el-table-column label="任务状态" prop="status" width="120">-->
<!-- <template slot-scope="scope">-->
<!-- {{ formatTaskType1(scope.row) }}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="任务状态" prop="status" width="120">
<template slot-scope="scope">
<el-tag :type="scope.row.status | statusFilterType">
{{
scope.row.status | statusFilterName
}}
</el-tag>
</template>
</el-table-column>
<el-table-column label="医疗器械注册人" prop="ylqxzcrbarmc" width="200"show-overflow-tooltip></el-table-column>
<el-table-column label="社会统一信用号" prop="creditNum" width="220"show-overflow-tooltip></el-table-column>
<el-table-column label="产品通用名称" prop="cpmctymc" width="180" show-overflow-tooltip></el-table-column>
<el-table-column label="规格型号" prop="ggxh" width="180"show-overflow-tooltip></el-table-column>
<el-table-column label="批次号" prop="batchNo" width="180"show-overflow-tooltip></el-table-column>
<el-table-column label="序列号" prop="serialNo" width="180"show-overflow-tooltip></el-table-column>
<el-table-column label="生产日期" prop="produceDate" width="180"show-overflow-tooltip></el-table-column>
<el-table-column label="失效日期" prop="expireDate" width="180"show-overflow-tooltip></el-table-column>
<!-- <el-table-column label="创建时间" prop="createTime" width="180"></el-table-column>-->
<!-- <el-table-column label="更新时间" prop="updateTime" width="180"></el-table-column>-->
<el-table-column label="操作" width="100" fixed="right">
<template slot-scope="scope">
<el-button
type="text"
@click.native="handleView(scope.row,scope.index)"
>详情
</el-button>
<el-button type="text" @click.native="deleteView(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:limit.sync="filterQuery.limit"
:page.sync="filterQuery.page"
@pagination="getTaskList"
></pagination>
</el-card>
<el-dialog
title="任务列表-详情"
:visible.sync="open"
class="dialog-two"
width="60%"
top="5vh"
>
<el-form :model="formView" :rules="formRules" ref="dataForm" label-width="100px">
<el-row type="flex">
<el-col :span="11" type="flex">
<el-form-item label="任务类型" prop="taskType">
<el-input v-model="taskTypeText" size="small" style="width: 90%" :disabled="true"></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="任务状态" prop="status">
<el-input v-model="statusText" size="small" style="width: 90%" :disabled="true"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<el-col :span="11" type="flex">
<el-form-item label="产品通用名称" prop="cpmctymc"show-overflow-tooltip>
<el-input v-model="formView.cpmctymc" size="small" style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="规格型号" prop="ggxh"show-overflow-tooltip>
<el-input v-model="formView.ggxh" size="small"
style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<el-col :span="11" type="flex">
<el-form-item label="批次号" prop="batchNo"show-overflow-tooltip>
<el-input v-model="formView.batchNo" size="small" style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="序列号" prop="serialNo"show-overflow-tooltip>
<el-input v-model="formView.serialNo" size="small"
style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<el-col :span="11" class="el-col">
<el-form-item label="生产日期" prop="produceDate"show-overflow-tooltip>
<el-input v-model="formView.produceDate" size="small"
style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" type="flex">
<el-form-item label="失效日期" prop="expireDate"show-overflow-tooltip>
<el-input v-model="formView.expireDate" size="small" style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<el-col :span="11" type="flex">
<el-form-item label="创建时间" prop="createTime"show-overflow-tooltip>
<el-input v-model="formView.createTime" size="small" style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="更新时间" prop="updateTime"show-overflow-tooltip>
<el-input v-model="formView.updateTime" size="small"
style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<el-col :span="11" type="flex">
<el-form-item label="医疗器械注册人" prop="ylqxzcrbarmc"show-overflow-tooltip>
<el-input v-model="formView.ylqxzcrbarmc" size="small" style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="社会统一信用号" prop="creditNum"show-overflow-tooltip>
<el-input v-model="formView.creditNum" size="small"
style="width: 90%" :disabled="true"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click.native="open = false" size="small"></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {isBlank} from "@/utils/strUtil";
import {deleteTaskList, getTraceHistoryTaskList} from "@/api/udi/udiTrace";
const formJson = {
id: "",
passWord: "",
userName: "",
checkPassword: "",
employeeName: "",
taskFlag: 1,
comments: '',
dept: null,
roles: [],
depts: [],
};
export default {
data() {
return {
filterQuery: {
//搜索列表个字段对应的值
taskType: null,
status: null,
cpmctymc: null,
ggxh: null,
ylqxzcrbarmc: null,
page: 1,
limit: 10,
startTime: null,
endTime: null,
startAduditTime: null,
endAduditTime: null,
},
formData: formJson,
total: 0,
codeRelTotal: 0,
loading: true,
manuCodeRelLoading: false,
taskList: [],
listCodeRel: [],
open: false,
openManuCodeRel: false,
formView: {
taskType:null,
status: null,
},
taskTypes: [
{ value: 1, label: '关联关系' },
{ value: 2, label: '入库' },
{ value: 3, label: '出库' },
],
taskStatus: [
{ value: 1, label: '未处理' },
{ value: 2, label: '正在处理' },
{ value: 3, label: '已处理' },
],
formViewCodeRel: {},
showSearch: true,
actDateRange: [],
auditDateRange: [],
pickerOptions: {
shortcuts: [
{
text: "最近一周",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近一个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit("pick", [start, end]);
},
},
{
text: "最近三个月",
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit("pick", [start, end]);
},
},
],
},
}
},
computed: {
taskTypeText() {
const taskType = this.taskTypes.find(item => item.value === this.formView.taskType);
return taskType ? taskType.label : '';
},
statusText() {
const status = this.taskStatus.find(item => item.value === this.formView.status);
return status ? status.label : '';
},
},
methods: {
//隐藏搜索
hideSearch() {
this.showSearch = !this.showSearch;
},
formatTaskType(row) {
switch (row.taskType) {
case 1:
return '关联关系';
case 2:
return '入库';
case 3:
return '出库';
default:
return '任务类型有误!!';
}
},
formatTaskType1(row) {
switch (row.status) {
case 1:
return '未处理';
case 2:
return '正在处理';
case 3:
return '已处理';
default:
return '任务状态有误!!';
}
},
//删除
deleteView(rowId) {
this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.deleteTask(rowId);
})
.catch(() => {
});
},
deleteTask(data) {
this.loading = true;
let tquery = {
id: data.id + "",
};
deleteTaskList(tquery)
.then((response) => {
this.loading = false;
if (response.code == 20000) {
this.getTaskList();
this.$message({
type: "success",
message: "删除成功!",
});
} else {
this.$message.error(response.message);
}
})
.catch(() => {
});
},
//详情
handleView(row){
this.taskList.forEach(obj => {
if (row.id == obj.id) {
this.formView = obj
}
})
console.log(this.formView)
this.open = true
},
handleViewCoderel(row){
this.listCodeRel.forEach(obj => {
if (this.listCodeRel[0]) {
this.formViewCodeRel = obj
}
})
console.log(this.formViewCodeRel)
this.openManuCodeRel = true
},
//重置
onReset(){
this.$router.push({
path: "",
});
this.filterQuery = {
taskType: null,
status: null,
cpmctymc: null,
ggxh: null,
ylqxzcrbarmc: null,
page: 1,
limit: 10,
startTime: null,
endTime: null,
startAduditTime: null,
endAduditTime: null,
};
this.listCodeRel = null,
this.auditDateRange = [];
this.actDateRange = [];
this.getTaskList();
},
//查询事件
onSubmit(){
this.loading = true;
if (this.actDateRange !== null) {
this.filterQuery.startTime = this.actDateRange[0];
this.filterQuery.endTime = this.actDateRange[1];
} else {
this.filterQuery.startTime = null;
this.filterQuery.endTime = null;
}
if (this.auditDateRange !== null) {
this.filterQuery.startAduditTime = this.auditDateRange[0];
this.filterQuery.endAduditTime = this.auditDateRange[1];
} else {
this.filterQuery.startAduditTime = null;
this.filterQuery.endAduditTime = null;
}
this.filterQuery.page = 1;
this.getTaskList()
},
getTaskList() {
this.loading = true;
getTraceHistoryTaskList(this.filterQuery).then((res) => {
this.loading = false;
if (res.code === 20000) {
this.taskList = res.data.list || [];
this.total = res.data.total || 0;
console.log(this.list)
} else {
this.$message.error(res.message);
this.taskList = [];
this.total = 0;
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
this.taskList = [];
this.total = 0;
})
},
},
filters: {
statusFilterType(status) {
const statusMap = {
1: "gray",
2: "danger",
3: "success"
};
return statusMap[status];
},
statusFilterName(status) {
const statusMap = {
1: "未处理",
2: "正在处理",
3: "已处理"
};
return statusMap[status];
},
},
created() {
this.getTaskList()
}
}
</script>
<style scoped>
.el-col {
border-radius: 4px;
flex-wrap: wrap;
}
.query-form-item {
display: block !important;
margin-right: 10px;
margin-bottom: 5px;
}
</style>