Files
scrq-hd/.svn/pristine/c2/c216afdecb22523c81f45f1aff27c3175a1c87e4.svn-base
2025-07-03 10:34:04 +08:00

842 lines
22 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container" ref="container">
<div class="main">
<query-params
ref="query"
:form="queryFormConfig"
@handleQuery="handleQuery"
@resetQuery="resetQuery"
>
</query-params>
<el-divider></el-divider>
<div>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" size="mini" @click="openThis"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="primary"
size="mini"
:disabled="AcceptShow"
@click="Accept"
>受理
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
size="mini"
:disabled="rejectShow"
@click="Reject"
>驳回
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
size="mini"
:disabled="ConfirmShow"
@click="Confirm"
>确认
</el-button>
</el-col>
<el-popover
style="float: right"
placement="bottom-end"
title="自定义显示列"
width="250"
@show="initPopover"
trigger="hover"
>
<headConfig
ref="test"
@fathers="fathers"
:propThis="propThis"
></headConfig>
<el-button
size="mini"
type="primary"
class="el-icon-caret-bottom"
slot="reference"
>自定义列</el-button
>
</el-popover>
</el-row>
<el-row
:gutter="10"
style="margin: 10px 0px"
class="mb8"
v-show="isSortShow"
>
<el-col>
<el-select
class="sortSeq"
ref="select"
@click.native="notSelect"
style="width: 800px"
v-model="seqence"
:multiple="true"
placeholder=""
>
<el-option
v-for="(item, index) in seqenceOptions"
:key="index"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-col>
</el-row>
</div>
</div>
<el-table
@sort-change="sortChange"
@header-dragend="headerDragend"
v-if="indexShow"
v-loading="loading"
:data="tableData"
border
ref="singleTable"
:height="tableHeight"
:cell-style="cellStyle"
highlight-current-row
@current-change="currentChange"
>
<el-table-column align="center" type="index" label="序号" width="50">
</el-table-column>
<el-table-column align="center" type="selection" width="55">
</el-table-column>
<el-table-column align="center" label="维修进度" width="100">
<template slot-scope="scope">
<div
style="
width: 100%;
height: 12px;
background: #e4d7d5;
border-radius: 10px;
"
>
<div
:class="
scope.row.dictStatusWidth == 1
? 'color1'
: scope.row.dictStatusWidth == 2
? 'color2'
: scope.row.dictStatusWidth == 3
? 'color3'
: scope.row.dictStatusWidth == 4
? 'color4'
: 'color5'
"
style="border-radius: 10px"
></div>
</div>
</template>
</el-table-column>
<el-table-column
v-for="(item, index) in realList"
:sortable="item.notSort == true ? false : `custom`"
:prop="item.tableProp"
:key="index"
:align="item.align"
header-align="center"
:min-width="item.width"
:label="item.tableTitle"
:show-overflow-tooltip="item.show_overflow_tooltip"
></el-table-column>
</el-table>
<el-pagination
style="margin-top: 10px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange2"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100, 200, 500, 1000]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</el-pagination>
</div>
</template>
<script >
import Edit from "./edit";
import AcceptPenson from "./AcceptPenson";
import { getUserProfile } from "@/api/system/user";
export default {
components: {
Edit,
AcceptPenson,
},
computed: {
queryFormConfig() {
return {
controlList: [
{
key: "deviceCode",
label: "设备编号",
type: "input",
placeholder: "请输入",
prop: "deviceCode",
class: "width_0180",
},
{
key: "deviceName",
label: "设备名称",
type: "input",
placeholder: "请输入",
prop: "deviceName",
class: "width_0180",
},
{
key: "specification",
label: "规格型号",
type: "input",
placeholder: "请输入",
prop: "specification",
class: "width_0180",
},
{
key: "dictStatus",
label: "状态",
type: "select",
placeholder: "请选择",
prop: "dictStatus",
options: this.$dictType.getDict("apm_repair_status"),
optionLabel: "text",
optionValue: "key",
},
{
key: "servicePeople",
label: "报修人",
type: "input",
placeholder: "请输入",
prop: "servicePeople",
class: "width_0180",
},
{
key: "datetime",
label: "报修日期",
type: "datetimerange",
startPlaceholder: "报修开始日期",
endPlaceholder: "报修结束日期",
prop: "datetime",
},
],
config: {
//零散的配置参数
hasAdvQuery: false, //有无高级查询
storageMode:true,//记忆模式开启后每次查询会存储到localstorage中存储名为下面的storageKey
storageKey:"equipmentEepair",
propThis: this, //this
preFixWidthClass: "width_0100", //前置框的宽度calss不写则为默认100
marginWidthClass: "width_0180", //空白选择框的宽度calss不写则为默认180
},
defaultList: [
//默认展示的属性,跟controList里面的key相对应
"deviceCode",
"deviceName",
"specification", //'planStartDtArray',
],
};
},
},
data() {
return {
nickName: null,
realList: [],
isSortShow: false,
indexShow: false,
seqenceOptions: [],
seqence: [],
datetime: [],
// 非单个禁用
single: true,
AcceptShow: true,
rejectShow: true,
ConfirmShow: true,
propThis: this,
isAdd: null,
queryParams: {
specification: null,
deviceName: null,
deviceCode: null,
},
tableHeight: null,
tableData: [],
total: null,
loading: false,
pageSize: 50,
currentPage: 1,
deletedButton: true,
updateButton: true,
selectRow: {},
selectAllRow: [],
};
},
created() {
this.getList();
},
mounted() {
this.$nextTick(() => {
this.tableHeight =
window.innerHeight - this.$refs.query.offsetHeight - 230;
// 监听窗口大小变化
let self = this;
window.onresize = function () {
self.tableHeight =
window.innerHeight - self.$refs.query.offsetHeight - 230;
};
});
this.getUser();
this.initSeqenceOptions();
this.initData();
this.getWorkCenterTree();
this.$refs.query.init();
},
watch: {
seqence: function () {
this.getList();
var oldIsSortShow = this.isSortShow;
//判断是否显示排序条件
if (this.seqence.length > 0) {
this.isSortShow = true;
} else {
this.isSortShow = false;
}
//判断table高度
if (oldIsSortShow != this.isSortShow) {
if (this.isSortShow) {
this.tableHeight = this.tableHeight - 47;
} else {
this.tableHeight = this.tableHeight + 47;
}
}
},
},
methods: {
getUser() {
getUserProfile().then((resp) => {
if (resp.code == 200) {
this.nickName = resp.data.nickName;
}
});
},
currentChange(val) {
if (val != null) {
this.AcceptShow = false;
this.selectRow = val;
switch (val.dictStatus) {
case 1:
this.single = false;
break;
case 4:
this.single = false;
break;
case 5:
this.ConfirmShow = false;
break;
default:
this.single = true;
this.ConfirmShow = true;
}
val.repairedBy == this.nickName
? (this.rejectShow = false)
: (this.rejectShow = true);
} else {
this.AcceptShow = false;
this.single = true;
this.rejectShow = true;
this.ConfirmShow = true;
}
},
notSelect() {
this.$refs.select.blur();
},
cellStyle({ row, column, rowIndex, columnIndex }) {
if (row.dictStatus == 2 && column.property == "dictStatusShow") {
//已受理
return "color:lightgreen;font-weight:bold;";
} else if (row.dictStatus == 3 && column.property == "dictStatusShow") {
//维修中
return "color:orange;font-weight:bold;";
} else if (row.dictStatus == 4 && column.property == "dictStatusShow") {
//已驳回
return "color:red ;font-weight:bold;";
} else if (row.dictStatus == 5 && column.property == "dictStatusShow") {
//已维修
return "color:green;font-weight:bold;";
}
},
headerDragend(newWidth, oldWidth, column, event) {
// realList
this.realList.forEach((value) => {
if (column.property == value.tableProp) {
value.width = newWidth;
}
});
this.$refs.test.init();
setTimeout(() => {
this.$refs.test.show();
}, 1000);
},
sortChange({ column, prop, order }) {
console.log(prop);
let sTemp = {
value: null,
label: null,
};
let value = prop.replace("Show", "") + " " + order;
let judgeValue = value.split(" ");
// this.seqence.push(value)
if (this.seqence.length === 0) {
this.seqence.push(value);
console.log(this.seqence);
} else {
for (let i = 0; i < this.seqence.length; i++) {
let judgeSeqence = this.seqence[i].split(" ");
if (judgeValue[0] === judgeSeqence[0]) {
if (judgeValue[1] === "null") {
return;
}
this.seqence.splice(i, 1, value);
console.log(this.seqence);
return;
}
if (i + 1 === this.seqence.length) {
this.seqence.push(value);
console.log(this.seqence);
}
}
}
},
getWorkCenterTree() {
this.$plan.getWorkCenterTree().then((resp) => {
console.log(resp, "work-index getWorkCenterTree resp");
this.treeOptions = [];
this.treeOptions.push(resp.data.data);
this.removeBlackChildren(this.treeOptions);
});
},
removeBlackChildren(list) {
list.forEach((value) => {
if (value.children.length == 0) {
value.children = undefined;
} else {
this.removeBlackChildren(value.children);
}
});
},
initSeqenceOptions() {
let tempList = this.$headerConfig.getList("equipmentEepair");
tempList.forEach((data, index) => {
if (data.notSort) return;
let temp = {
value: null,
label: null,
};
temp.value = data.tableProp.replace("Show", "") + " ascending";
temp.label = data.tableTitle + " 升序";
this.seqenceOptions.push(temp);
let tempD = {
value: null,
label: null,
};
tempD.value = data.tableProp.replace("Show", "") + " descending";
tempD.label = data.tableTitle + " 降序";
this.seqenceOptions.push(tempD);
});
},
//初始化表格
initData() {
this.getList();
this.workStatus = [];
this.workStatus.push({});
this.workType = [];
this.workType.push({});
this.$dictType
.getOrderWorkStatusArray()
.forEach((value) => this.workStatus.push(value));
const params = {
tableName: "equipmentEepair",
};
this.$headerConfig.getRealList(params).then((data) => {
if (data.data && data.data.data && data.data.data !== null) {
let temp = JSON.parse(data.data.data);
this.realList = temp.headerList;
this.List = temp.List;
} else {
this.List = this.$headerConfig.getList("equipmentEepair");
this.realList = this.List;
let temp = {
headerList: this.realList,
List: this.List,
};
const params = {
tableName: "equipmentEepair",
configure: JSON.stringify(temp),
};
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
}
this.tableData = JSON.parse(JSON.stringify(this.tableData));
this.indexShow = true;
});
},
initPopover() {
const params = {
tableName: "equipmentEepair",
};
this.$headerConfig.getRealList(params).then((_data) => {
console.log(_data, "_data");
let data = _data.config ? _data.data : _data;
console.log("开始输出真正表格1548", data);
let temp = JSON.parse(data.data);
console.log(temp, "temp");
this.realList = temp.headerList;
console.log(this.realList);
this.$refs.test.init();
});
},
fathers(data) {
this.List = data.configure.List;
data.configure.List.forEach((value) => {
this.realList.forEach((real) => {
if (value.tableProp == real.tableProp) {
value.width = real.width;
}
});
});
data.configure.headerList.forEach((value) => {
this.realList.forEach((real) => {
if (value.tableProp == real.tableProp) {
value.width = real.width;
}
});
});
if (data.configure.headerList.length <= 0) {
return;
}
const params = {
tableName: "equipmentEepair",
configure: JSON.stringify(data.configure),
};
this.realList = data.configure.headerList;
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
},
openThis() {
this.$layer.iframe({
shadeClose: false,
content: {
content: Edit, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false,
data: this.selectRow,
},
title: "新增信息",
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.$layer.iframe({
shadeClose: false,
content: {
content: Edit, //传递的组件对象
parent: this, //当前的vue对象
data: {
dictType: 1,
row: this.selectRow,
},
},
title: "编辑设备维修信息",
});
},
Accept() {
this.$layer.iframe({
shadeClose: false,
content: {
content: AcceptPenson, //传递的组件对象
parent: this, //当前的vue对象
data: {
row: this.selectRow,
},
},
title: "指定受理人(双击选中)",
});
},
Reject() {
console.log("驳回");
this.$confirm("是否驳回【" + this.nickName + "】的请求?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
let parmas = JSON.parse(JSON.stringify(this.selectRow));
parmas.repairedBy = "";
parmas.dictStatus = 4;
console.log(parmas);
this.$EquipmentRepair.updateService(parmas).then((resp) => {
if (resp.data.code == 200) {
this.$message.success("驳回成功!");
this.getList();
} else {
this.$message.error(resp.data.message);
}
});
});
},
Confirm() {
this.$layer.iframe({
shadeClose: false,
content: {
content: Edit, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false,
data: {
dictType:1,
isShowstatus: true,
row: this.selectRow,
},
},
title: "确认维修信息",
});
},
handleCurrentChange2(val) {
console.log(val);
this.currentPage = val;
},
handleSizeChange(val) {
this.pageSize = val;
},
handleQuery() {
this.getQueryParams();
this.getList();
this.queryParams.pageNo = 1;
},
getQueryParams() {
let pageSize = this.queryParams.pageSize;
let pageNo = this.queryParams.pageNo;
this.queryParams = this.$refs.query.getQueryParams(); //返回子组件的queryParams
this.queryParams.pageSize = pageSize;
this.queryParams.pageNo = pageNo;
//取得子组件的queryParams并且与原来的pagesize pageNo合并
},
getList() {
this.single = true;
this.loading = true;
const orders = [];
this.seqence.map((val) => {
orders.push(
val.replace("ascending", "asc").replace("descending", "desc")
);
});
let params = {
pageSize: this.pageSize,
pageNo: this.currentPage,
dictStatus: this.queryParams.dictStatus,
specification: this.queryParams.specification,
deviceName: this.queryParams.deviceName,
deviceCode: this.queryParams.deviceCode,
servicePeople: this.queryParams.servicePeople,
serviceStartTime: this.queryParams.serviceStartTime,
serviceEndTime: this.queryParams.serviceEndTime,
orders: orders,
};
if (
this.queryParams.datetime != undefined &&
this.queryParams.datetime != null
) {
(params.serviceStartTime = this.g_method.dateFtt(
"yyyy-MM-dd hh:mm:ss",
this.queryParams.datetime[0]
)),
(params.serviceEndTime = this.g_method.dateFtt(
"yyyy-MM-dd hh:mm:ss",
this.queryParams.datetime[1]
));
}
this.$EquipmentRepair.getEquipmentrepairList(params).then((resp) => {
if (resp.data.code === 200) {
// console.log("拿到整体得数据", resp.data.data.data);
this.tableData = resp.data.data.data;
this.tableData.forEach((e) => {
e.dictStatusWidth = e.dictStatus;
e.dictStatusShow = this.$dictType.getApmRepairStatus(e.dictStatus);
e.dictSeverityShow = this.$dictType.getFaultSeverity(
e.dictSeverity
);
});
this.total = resp.data.data.recordsTotal;
this.loading = false;
}
});
},
Query() {
this.currentPage = 1;
this.getList();
},
resetQuery() {
this.queryParams = {};
this.getList();
},
// handleSelectionChangeMainTable(val) {
// if(val.dictStatus==1 || val.dictStatus==4){
// this.single=false
// }
// else{
// this.single=true
// }
// if (val.length) {
// let ids = [];
// val.forEach((e) => {
// ids.push(e.id);
// });
// this.selectAllRow = ids;
// this.deletedButton = false;
// } else {
// this.deletedButton = true;
// }
// },
},
};
</script>
<style lang="scss" scoped>
>>> .el-form-item {
padding: 0px;
margin: 0px;
}
>>> .vue-treeselect__control {
height: 20px;
line-height: 28px;
}
>>> .el-divider {
margin: 1px;
}
>>> .el-table__body tr.current-row > td {
background-color: #8ac1ff !important;
cursor: pointer;
}
.el-table >>> tbody tr:hover > td {
background-color: #8ac1ff !important;
}
.mb8 >>> .el-select .el-input__inner {
border: 0px;
}
.mb8 >>> .el-select .el-input__inner {
border: 0px;
padding-right: 35px;
}
.sortSeq >>> .el-input__suffix-inner {
display: none;
}
>>> .el-form-item {
margin-bottom: 10px;
}
.el-divider {
margin-top: 0px;
margin-bottom: 5px;
}
>>> .el-table .el-table__header-wrapper th {
padding: 5px 0;
}
>>> .vue-treeselect__control {
height: 30px !important;
line-height: 30px !important;
}
>>> .vue-treeselect--single .vue-treeselect__input-container {
height: 30px !important;
line-height: 30px !important;
}
>>> .el-input-group__append .el-select,
.el-input-group__append .el-button,
.el-input-group__prepend .el-select,
.el-input-group__prepend .el-button {
margin-left: -28px !important;
margin-right: -33px !important;
}
.colorRoute {
width: 90%;
height: 20px;
border-radius: 5px;
background: yellow;
}
.colorRouteG {
width: 90%;
height: 20px;
border-radius: 5px;
background: green;
}
.color1 {
width: 20%;
height: 12px;
background: blue;
}
.color2 {
width: 40%;
height: 12px;
background: peru;
}
.color3 {
width: 60%;
height: 12px;
background: lightcoral;
}
.color4 {
width: 80%;
height: 12px;
background: red;
}
.color5 {
width: 100%;
height: 12px;
background: greenyellow;
}
</style>