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

545 lines
14 KiB
Plaintext

<template>
<div class="app-container">
<div class="main">
<div class="query" ref="query">
<el-form
:model="queryParams"
ref="queryParams"
:inline="true"
label-width="100px"
>
<el-form-item>
<el-input
v-model="queryParams.repairCode"
placeholder="维修代码"
clearable
size="small"
style="width: 230px"
/>
</el-form-item>
<el-form-item>
<el-input
v-model="queryParams.repairText"
placeholder="维修描述"
clearable
size="small"
style="width: 230px"
/>
</el-form-item>
<!-- <el-form-item>-->
<!-- <el-select size="small" collapse-tags :multiple="true" style="width: 230px" v-model="queryParams.dictStatuses" placeholder="源单状态">-->
<!-- <el-option-->
<!-- v-for="item in this.$dictType.getInputBillStatusArray()"-->
<!-- :key="item.key"-->
<!-- :label="item.text"-->
<!-- :value="item.key">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- <el-form-item>-->
<!-- <el-date-picker-->
<!-- v-model="queryParams.completeTime"-->
<!-- type="datetime"-->
<!-- size="small"-->
<!-- style="width: 230px"-->
<!-- value-format="yyyy-MM-dd hh:mm:ss"-->
<!-- placeholder="选择完成时间">-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="Query"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
<el-button
type="primary"
:icon="
showMore == true ? 'el-icon-arrow-up' : 'el-icon-arrow-down'
"
size="mini"
></el-button>
</el-form-item>
<div v-show="showMore"></div>
</el-form>
</div>
<el-divider></el-divider>
<div>
<div>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="openDetailAdd"
v-hasPermi="['repair_add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-plus"
size="mini"
@click="handleDelete"
:disabled="buttonEnable"
v-hasPermi="['repair_remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-plus"
size="mini"
@click="openDetail"
:disabled="buttonEnable"
v-hasPermi="['repair_query']"
>查看
</el-button>
</el-col>
<el-col :span="1.5">
<el-select
ref="select"
@click.native="notSelect"
style="width: 800px"
v-model="seqence"
:multiple="true"
placeholder=""
>
<el-option
v-for="item in seqenceOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</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-table
@sort-change="sortChange"
@header-dragend="headerDragend"
ref="singleTable"
:expand-row-keys="expands"
:row-key="getRowKeys"
v-loading="loading"
highlight-current-row
@current-change="handleCurrentChange"
:data="tableData"
border
v-if="indexShow"
:height="tableHeight"
class="tableStyle"
style="width: 100%"
>
<el-table-column
type="index"
align="center"
label="序号"
width="50"
>
</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>
</div>
</div>
</div>
</template>
<script>
import edit from "./edit";
export default {
name: "repair",
data() {
return {
getRowKeys: (row) => {
//获取当前行id
// console.log(row)
return row.id; //这里看这一行中需要根据哪个属性值是id
},
buttonEnableP: true,
buttonEnableD: true,
expands: [],
printInfo: false,
multipleSelectionTable: [],
multipleSelection: [],
childrenList: [],
childrenStates: [],
subLoading: false,
indexShow: false,
tableHeight: 0,
showMore: false,
editNow: false,
currentRow: null,
buttonEnable: true,
List: [],
realList: [],
isAdd: null,
total: null,
propThis: this,
pageSize: 50,
currentPage: 1,
tableData: [],
queryParams: {},
loading: false,
seqenceOptions: [],
seqence: [],
};
},
mounted() {
let tempList = this.$headerConfig.getList("repair");
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);
});
this.$nextTick(() => {
this.tableHeight =
window.innerHeight - this.$refs.query.offsetHeight - 250;
});
this.getRepairList();
const params = {
tableName: "repair",
};
this.$headerConfig.getRealList(params).then((data) => {
console.log("开始输出真正表格");
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("repair");
this.realList = this.List;
let temp = {
headerList: this.realList,
List: this.List,
};
const params = {
tableName: "repair",
configure: JSON.stringify(temp),
};
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
}
this.indexShow = true;
});
},
methods: {
notSelect() {
this.$refs.select.blur();
},
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);
}
}
}
},
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);
},
handleDelete() {
this.$confirm("是否删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.$repair.deleteRepair({ id: this.currentRow.id }).then((data) => {
if (data.data.code === 200) {
this.$message.success("删除成功");
this.getRepairList();
}
});
})
.catch(() => {});
},
openDetail() {
this.isAdd = false;
this.$layer.iframe({
shadeClose: false,
content: {
content: edit, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false,
data: this.currentRow,
},
title: "编辑",
});
},
openDetailAdd() {
this.isAdd = true;
this.$layer.iframe({
shadeClose: false,
content: {
content: edit, //传递的组件对象
parent: this, //当前的vue对象
shadeClose: false,
data: this.currentRow,
},
title: "新增",
});
},
handleCurrentChange2(val) {
// this.currentRow = val;
console.log(val);
this.currentPage = val;
this.getRepairList();
},
handleSizeChange(val) {
this.pageSize = val;
this.getRepairList();
},
initPopover() {
const params = {
tableName: "repair",
};
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: "repair",
configure: JSON.stringify(data.configure),
};
this.realList = data.configure.headerList;
this.$headerConfig.updateRealList(params).then((value) => {
console.log(value);
});
},
getRepairList() {
this.expands = [];
setTimeout(() => {
this.$refs.singleTable.setCurrentRow(null);
}, 10);
this.buttonEnable = true;
this.loading = true;
const orders = [];
this.seqence.map((val) => {
orders.push(
val.replace("ascending", "asc").replace("descending", "desc")
);
});
const params = {
pageSize: this.pageSize,
pageNo: this.currentPage,
repairCode: this.queryParams.repairCode,
repairText: this.queryParams.repairText,
orders,
};
this.$repair.getRepairList(params).then((data) => {
this.tableData = data.data.data.data;
// this.tableData.forEach(value => {
// })
this.total = data.data.data.recordsTotal;
this.loading = false;
});
},
Query() {
console.log(this.queryParams);
this.currentPage = 1;
this.getRepairList();
},
resetQuery() {
this.queryParams = {};
this.seqence = [];
},
handleCurrentChange(val) {
console.log(val);
this.currentRow = val;
this.buttonEnable = false;
this.buttonEnableD = false;
},
},
watch: {
seqence: function () {
this.getRepairList();
},
},
};
</script>
<style scoped lang="scss">
>>> .el-table__expanded-cell:hover {
/*padding:20px 0px;*/
background-color: white !important;
}
>>> .el-table--striped .el-table__body tr.el-table__row--striped.current-row td,
>>> .el-table__body tr.current-row > td {
background-color: #8ac1ff !important;
cursor: pointer;
}
>>> .el-table__body tr:hover > td {
background-color: #e9edf3;
cursor: pointer;
}
>>> .el-link.el-link--default {
color: white;
}
>>> .el-form-item {
margin-bottom: 10px;
}
.mb8 >>> .el-select .el-input__inner {
border: 0px;
}
.mb8 >>> .el-select .el-input__inner {
border: 0px;
padding-right: 35px;
}
>>> .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;
}
</style>