922 lines
25 KiB
Plaintext
922 lines
25 KiB
Plaintext
<template>
|
||
<div class="app-container" ref="container">
|
||
<div class="main">
|
||
<query-params
|
||
ref="query"
|
||
:form="queryFormConfig"
|
||
@handleQuery="handleQuery"
|
||
@getTableData="getTableData"
|
||
@resetQuery="resetQuery"
|
||
>
|
||
</query-params>
|
||
<el-divider></el-divider>
|
||
<div>
|
||
<el-row :gutter="10" class="mb8">
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
@click="openDetailAdd"
|
||
>添加保养计划
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="success"
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
:disabled="updateButton"
|
||
@click="addPlan"
|
||
>新增保养任务
|
||
</el-button>
|
||
</el-col>
|
||
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="warning"
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
:disabled="updateButton"
|
||
@click="updatedThis"
|
||
>修改
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="danger"
|
||
icon="el-icon-delete"
|
||
size="mini"
|
||
:disabled="deletedButton"
|
||
@click="deleteAll"
|
||
>删除
|
||
</el-button>
|
||
</el-col>
|
||
<el-col :span="1.5">
|
||
<el-button
|
||
type="primary"
|
||
icon="el-icon-s-grid"
|
||
size="mini"
|
||
:disabled="updateButton"
|
||
@click="MaintenancePlan"
|
||
>保养计划
|
||
</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
|
||
@expand-change="rowExpand"
|
||
@sort-change="sortChange"
|
||
@header-dragend="headerDragend"
|
||
v-if="indexShow"
|
||
v-loading="loading"
|
||
:data="tableData"
|
||
border
|
||
ref="list"
|
||
:height="tableHeight"
|
||
:cell-style="cellStyle"
|
||
highlight-current-row
|
||
@current-change="handleCurrentChange"
|
||
@selection-change="handleSelectionChangeMainTable"
|
||
>
|
||
<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 type="expand">
|
||
<template slot-scope="scope">
|
||
<el-table border :data="scope.row.dataList">
|
||
<el-table-column
|
||
v-for="(item, index) in scope.row.childrenList"
|
||
:key="index"
|
||
:label="item"
|
||
width="150"
|
||
>
|
||
<template>
|
||
<div
|
||
:class="
|
||
scope.row.childrenList[index] ==
|
||
scope.row.maintenanceStartTime.slice(0, 10) ||
|
||
scope.row.childrenList[index] ==
|
||
scope.row.maintenanceEndTime.slice(0, 10)
|
||
? 'colorRouteG'
|
||
: 'colorRoute'
|
||
"
|
||
></div>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="模板名称" width="180">
|
||
<template slot-scope="scope">
|
||
<i
|
||
style="color: blue; text-decoration: underline"
|
||
@click="formGenerateShow(scope.row)"
|
||
>{{ scope.row.templateText }}</i
|
||
>
|
||
</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 EditPlan from "./editPlan";
|
||
import formGenerate from "./formGenerate";
|
||
import fullcalendarPlan from "./fullcalendarPlan";
|
||
export default {
|
||
components: {
|
||
Edit,
|
||
EditPlan,
|
||
fullcalendarPlan,
|
||
},
|
||
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: "maintenancePeriod",
|
||
label: "保养周期",
|
||
type: "input",
|
||
placeholder: "请输入",
|
||
prop: "maintenancePeriod",
|
||
class: "width_0180",
|
||
},
|
||
{
|
||
key: "value1",
|
||
label: "创建日期",
|
||
type: "datetimerange",
|
||
startPlaceholder: "开始日期",
|
||
endPlaceholder: "结束日期",
|
||
prop: "value1",
|
||
},
|
||
],
|
||
config: {
|
||
//零散的配置参数
|
||
hasAdvQuery: false, //有无高级查询
|
||
storageMode:true,//记忆模式,开启后每次查询会存储到localstorage中,存储名为下面的storageKey
|
||
storageKey:"equipmentMaintenance",
|
||
propThis: this, //this
|
||
preFixWidthClass: "width_0100", //前置框的宽度calss,不写则为默认100
|
||
marginWidthClass: "width_0180", //空白选择框的宽度calss,不写则为默认180
|
||
},
|
||
defaultList: [
|
||
//默认展示的属性,跟controList里面的key相对应
|
||
"deviceCode",
|
||
"deviceName",
|
||
"specification", //'planStartDtArray',
|
||
],
|
||
};
|
||
},
|
||
},
|
||
data() {
|
||
return {
|
||
realList: [],
|
||
isSortShow: false,
|
||
indexShow: false,
|
||
seqenceOptions: [],
|
||
seqence: [],
|
||
expands: [], //只展开一行放入当前行id
|
||
value1: [],
|
||
getRowKeys: (row) => {
|
||
//获取当前行id
|
||
// console.log(row)
|
||
return row.id; //这里看这一行中需要根据哪个属性值是id
|
||
},
|
||
propThis: this,
|
||
isAdd: null,
|
||
queryParams: {
|
||
specification: null,
|
||
deviceName: null,
|
||
deviceCode: null,
|
||
maintenancePeriod: null,
|
||
checkStartTime: null,
|
||
checkEndTime: null,
|
||
},
|
||
showMore: false,
|
||
tableHeight: null,
|
||
tableData: [],
|
||
total: null,
|
||
loading: false,
|
||
pageSize: 50,
|
||
currentPage: 1,
|
||
statusArr: [],
|
||
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.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: {
|
||
handleCurrentChange(val) {
|
||
if (val === null) {
|
||
this.updateButton = true;
|
||
} else {
|
||
this.updateButton = false;
|
||
}
|
||
this.selectRow = val;
|
||
},
|
||
MaintenancePlan() {
|
||
this.$layer.iframe({
|
||
area: ["80rem", "40rem"],
|
||
shadeClose: true,
|
||
content: {
|
||
content: fullcalendarPlan, //传递的组件对象
|
||
parent: this, //当前的vue对象
|
||
shadeClose: false,
|
||
data: this.selectRow,
|
||
},
|
||
title: "设备保养时间",
|
||
});
|
||
},
|
||
formGenerateShow(datarow) {
|
||
this.$layer.iframe({
|
||
area: ["80vw", "80Vh"],
|
||
shadeClose: true,
|
||
content: {
|
||
content: formGenerate, //传递的组件对象
|
||
|
||
parent: this, //当前的vue对象
|
||
shadeClose: false,
|
||
data: datarow,
|
||
},
|
||
title: "设备保养模板",
|
||
});
|
||
},
|
||
notSelect() {
|
||
this.$refs.select.blur();
|
||
},
|
||
cellStyle({ row, column, rowIndex, columnIndex }) {
|
||
if (row.dictStatus == 10 && column.property == "dictStatusShow") {
|
||
//已创建
|
||
return "color: red;font-weight:bold;";
|
||
} else if (row.dictStatus == 20 && column.property == "dictStatusShow") {
|
||
//生产中
|
||
return "color:lightgreen;font-weight:bold;";
|
||
} else if (row.dictStatus == 30 && column.property == "dictStatusShow") {
|
||
//暂停
|
||
return "color:orange;font-weight:bold;";
|
||
} else if (row.dictStatus == 40 && column.property == "dictStatusShow") {
|
||
//已完成
|
||
return "color:green;font-weight:bold;";
|
||
} else if (row.dictStatus == 50 && column.property == "dictStatusShow") {
|
||
//已关闭
|
||
return "color:gray;font-weight:bold;";
|
||
}
|
||
},
|
||
handleRowClick(selection, column, event) {
|
||
if (this.rows.length == 0 || this.rowClickFlag) {
|
||
this.rowClickFlag = true;
|
||
this.rows = [];
|
||
this.rows.push(selection);
|
||
this.single = this.rows.length != 1;
|
||
this.multiple = !this.rows.length;
|
||
if (this.rows.length > 0) {
|
||
let flag = false;
|
||
this.rows.forEach((element) => {
|
||
if (element.pickNumber) {
|
||
flag = true;
|
||
}
|
||
});
|
||
if (flag) {
|
||
this.ispickshow = true;
|
||
} else {
|
||
this.ispickshow = false;
|
||
}
|
||
} else {
|
||
this.ispickshow = true;
|
||
}
|
||
if (this.rows.length === 1 && this.ispickshow) {
|
||
this.isReturnShow = false;
|
||
} else {
|
||
this.isReturnShow = true;
|
||
}
|
||
|
||
this.isReShow = !this.rows.length;
|
||
} else {
|
||
this.single = this.rows.length != 1;
|
||
this.multiple = !this.rows.length;
|
||
this.isReShow = !this.rows.length;
|
||
}
|
||
},
|
||
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("equipmentMaintenance");
|
||
|
||
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: "equipmentMaintenance",
|
||
};
|
||
this.$headerConfig.getRealList(params).then((data) => {
|
||
console.log("开始输出真正表格", 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("equipmentMaintenance");
|
||
this.realList = this.List;
|
||
let temp = {
|
||
headerList: this.realList,
|
||
List: this.List,
|
||
};
|
||
const params = {
|
||
tableName: "equipmentMaintenance",
|
||
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: "equipmentMaintenance",
|
||
};
|
||
|
||
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: "equipmentMaintenance",
|
||
configure: JSON.stringify(data.configure),
|
||
};
|
||
|
||
this.realList = data.configure.headerList;
|
||
|
||
this.$headerConfig.updateRealList(params).then((value) => {
|
||
console.log(value);
|
||
});
|
||
},
|
||
showMoreChange() {
|
||
if (!this.showMore) {
|
||
this.tableHeight = this.tableHeight - 70;
|
||
} else {
|
||
this.tableHeight = this.tableHeight + 70;
|
||
}
|
||
this.$nextTick(() => {
|
||
this.showMore = !this.showMore;
|
||
});
|
||
},
|
||
handleCurrentChange2(val) {
|
||
console.log(val);
|
||
this.currentPage = val;
|
||
},
|
||
handleSizeChange(val) {
|
||
this.pageSize = val;
|
||
},
|
||
stateFormat(row, column) {
|
||
if (row.status === 0) {
|
||
return "在库";
|
||
} else if (row.status === 1) {
|
||
return "在用";
|
||
}
|
||
},
|
||
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合并
|
||
},
|
||
getTableData(val) {
|
||
//高级查询
|
||
this.queryData = val;
|
||
this.tableData = this.queryData.data;
|
||
this.tableData.forEach((value) => {
|
||
value.materialNumber = value.materialCode;
|
||
value.dictStatusShow = this.$dictType.getOrderWorkStatus(
|
||
value.dictStatus
|
||
);
|
||
value.dictFlowtypeShow = this.$dictType.getMaterialFlowType(
|
||
value.dictFlowtype
|
||
);
|
||
value.dictPtypeShow = this.$dictType.getOrderPtypeType(value.dictPtype);
|
||
|
||
value.dictPstatusShow = this.$dictType.getWorkPStatus(
|
||
value.dictPstatus
|
||
); //领料状态
|
||
});
|
||
this.total = this.queryData.recordsTotal;
|
||
// this.getBomlList()
|
||
},
|
||
getList() {
|
||
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,
|
||
maintenancePeriod: this.queryParams.maintenancePeriod,
|
||
specification: this.queryParams.specification,
|
||
deviceName: this.queryParams.deviceName,
|
||
deviceCode: this.queryParams.deviceCode,
|
||
maintenanceStartTime: this.queryParams.maintenanceStartTime,
|
||
maintenanceEndTime: this.queryParams.maintenanceEndTime,
|
||
orders: orders,
|
||
};
|
||
if (
|
||
this.queryParams.value1 != undefined &&
|
||
this.queryParams.value1 != null
|
||
) {
|
||
(params.maintenanceStartTime = this.g_method.dateFtt(
|
||
"yyyy-MM-dd hh:mm:ss",
|
||
this.queryParams.value1[0]
|
||
)),
|
||
(params.maintenanceEndTime = this.g_method.dateFtt(
|
||
"yyyy-MM-dd hh:mm:ss",
|
||
this.queryParams.value1[1]
|
||
));
|
||
}
|
||
this.$EquipmentMaintenance.getEquipmentPlanList(params).then((resp) => {
|
||
if (resp.data.code === 200) {
|
||
// console.log("拿到整体得数据", resp.data.data);
|
||
this.tableData = resp.data.data.data;
|
||
this.total = resp.data.data.recordsTotal;
|
||
this.loading = false;
|
||
}
|
||
});
|
||
},
|
||
Query() {
|
||
this.currentPage = 1;
|
||
this.getList();
|
||
},
|
||
|
||
resetQuery() {
|
||
this.queryParams = {};
|
||
this.getList();
|
||
},
|
||
handleSelectionChangeMainTable(val) {
|
||
console.log(val, "shibu是");
|
||
|
||
if (val.length == 1) {
|
||
this.updateButton = false;
|
||
this.selectRow = val[0];
|
||
console.log("选中的当前行", this.selectRow);
|
||
} else {
|
||
this.updateButton = true;
|
||
this.selectRow = {};
|
||
}
|
||
if (val.length) {
|
||
let ids = [];
|
||
val.forEach((e) => {
|
||
ids.push(e.id);
|
||
});
|
||
this.selectAllRow = ids;
|
||
this.deletedButton = false;
|
||
} else {
|
||
this.deletedButton = true;
|
||
}
|
||
},
|
||
openDetailAdd() {
|
||
this.isAdd = true;
|
||
this.$layer.iframe({
|
||
shadeClose: false,
|
||
content: {
|
||
content: Edit, //传递的组件对象
|
||
parent: this, //当前的vue对象
|
||
shadeClose: false,
|
||
data: this.currentRow,
|
||
},
|
||
title: "添加保养计划",
|
||
});
|
||
},
|
||
updatedThis() {
|
||
this.isAdd = false;
|
||
this.$layer.iframe({
|
||
shadeClose: false,
|
||
content: {
|
||
content: Edit, //传递的组件对象
|
||
parent: this, //当前的vue对象
|
||
shadeClose: false,
|
||
data: this.selectRow,
|
||
},
|
||
title: "修改",
|
||
});
|
||
},
|
||
deleteAll() {
|
||
this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
|
||
confirmButtonText: "确定",
|
||
cancelButtonText: "取消",
|
||
type: "warning",
|
||
})
|
||
.then(() => {
|
||
let params = { ids: this.selectAllRow };
|
||
this.$EquipmentMaintenance
|
||
.DeleteEquipmentPlan(params)
|
||
.then((resp) => {
|
||
if (resp.data.code == 200) {
|
||
this.$message.success("删除成功");
|
||
this.getList();
|
||
} else {
|
||
this.$message.error(resp.data.message);
|
||
}
|
||
});
|
||
})
|
||
.catch(() => {
|
||
this.$message({
|
||
type: "info",
|
||
message: "已取消删除",
|
||
});
|
||
});
|
||
},
|
||
rowExpand(row, rowList) {
|
||
console.log(row, rowList);
|
||
|
||
row.dataList = [];
|
||
row.dataList.push({});
|
||
row.childrenList = this.getDiffDate(
|
||
row.maintenanceStartTime.slice(0, 10),
|
||
row.maintenanceEndTime.slice(0, 10)
|
||
);
|
||
},
|
||
getDiffDate(start, end) {
|
||
var startTime = this.getDate(start);
|
||
|
||
var endTime = this.getDate(end);
|
||
|
||
var dateArr = [];
|
||
|
||
while (endTime.getTime() - startTime.getTime() >= 0) {
|
||
var year = startTime.getFullYear();
|
||
|
||
var month =
|
||
startTime.getMonth().toString().length === 1
|
||
? "0" + (parseInt(startTime.getMonth().toString(), 10) + 1)
|
||
: startTime.getMonth() + 1;
|
||
|
||
var day =
|
||
startTime.getDate().toString().length === 1
|
||
? "0" + startTime.getDate()
|
||
: startTime.getDate();
|
||
|
||
dateArr.push(year + "-" + month + "-" + day);
|
||
|
||
startTime.setDate(startTime.getDate() + 1);
|
||
}
|
||
return dateArr;
|
||
},
|
||
getDate(datestr) {
|
||
var temp = datestr.split("-");
|
||
if (temp[1] === "01") {
|
||
temp[0] = parseInt(temp[0], 10) - 1;
|
||
temp[1] = "12";
|
||
} else {
|
||
temp[1] = parseInt(temp[1], 10) - 1;
|
||
}
|
||
var date = new Date(temp[0], temp[1], temp[2]);
|
||
return date;
|
||
},
|
||
addPlan() {
|
||
this.$layer.iframe({
|
||
shadeClose: false,
|
||
content: {
|
||
content: EditPlan, //传递的组件对象
|
||
parent: this, //当前的vue对象
|
||
shadeClose: false,
|
||
data: this.selectRow,
|
||
},
|
||
title: "新增保养任务",
|
||
});
|
||
},
|
||
},
|
||
};
|
||
</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{
|
||
// padding: 5px;
|
||
// }
|
||
>>> .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;
|
||
}
|
||
</style>
|