projects/mesxc-lb #205

Merged
gtz217 merged 38 commits from projects/mesxc-lb into projects/mesxc-test 2024-02-26 02:14:07 +08:00
4 changed files with 157 additions and 303 deletions
Showing only changes of commit 15738642b0 - Show all commits

View File

@ -354,18 +354,21 @@ export default {
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有巡检设置?')
.then(() => {
this.exportLoading = true;
return exportEquipmentTypeExcel(params);
return this.$axios({
url: '/base/equipment-check-order/export-excel',
params: {
name: this.queryParams.name,
status: 0,
special: true,
},
});
})
.then((response) => {
this.$download.excel(response, '巡检设置.xls');
this.$download.excel(response, '巡检设置.xls');
this.exportLoading = false;
})
.catch(() => {});

View File

@ -32,6 +32,7 @@
<el-form-item label="巡检单名称" prop="name">
<el-input
v-model="form.name"
:disabled="disableEdit"
placeholder="请输入巡检单名称" />
</el-form-item>
</el-col>
@ -42,6 +43,7 @@
v-model="form.departmentId"
filterable
clearable
:disabled="disableEdit"
:placeholder="`请选择部门`">
<el-option
v-for="opt in departmentOptions"
@ -59,6 +61,7 @@
filterable
clearable
multiple
:disabled="disableEdit"
style="width: 100%"
placeholder="请选择班次">
<el-option
@ -84,6 +87,7 @@
:placeholder="`请选择巡检人`"
multiple
clearable
:disabled="disableEdit"
filterable>
<el-option
v-for="opt in inspectorOptions"
@ -99,6 +103,7 @@
<el-date-picker
v-model="form.planCheckTime"
type="datetime"
:disabled="disableEdit"
placeholder="请选择计划开始时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
@ -123,7 +128,9 @@
</div>
<div style="margin-top: 12px; position: relative">
<div style="position: absolute; top: -40px; right: 0">
<div
v-if="!disableEdit"
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加内容
@ -139,6 +146,7 @@
<method-btn
slot="handleBtn"
label="操作"
v-if="!disableEdit"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
@ -154,8 +162,14 @@
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button type="primary" :loading="btnLoading" @click="handleConfirm">
<el-button style="" @click="handleCancel">
{{ disableEdit ? '返回' : '取消' }}
</el-button>
<el-button
v-if="!disableEdit"
type="primary"
:loading="btnLoading"
@click="handleConfirm">
保存
</el-button>
</div>
@ -314,6 +328,7 @@ export default {
],
row: null,
groupOptions: [],
disableEdit: false,
};
},
computed: {
@ -375,8 +390,8 @@ export default {
console.log('handleEmitFun', val);
},
init(row) {
console.log('row', row);
init(row, detail) {
if (detail) this.disableEdit = true;
this.visible = true;
this.row = row;
this.getInfo(row);
@ -390,7 +405,7 @@ export default {
if (res.code == 0) {
this.form = res.data;
this.form.groupClass = res.data.groupClass.split(',');
this.form.checkPerson = res.data.checkPerson.split(',');
this.form.checkPerson = res.data.checkPerson?.split(',');
this.formLoading = false;
}
this.formLoading = false;

View File

@ -233,6 +233,32 @@ export default {
this.title = '';
},
/** search bar click */
async searchBarClicked(btn) {
switch (btn.btnName) {
/** 批量确认 */
case 'batch-confirm':
if (this.$refs['check-order-list-table'].selectedOrder.length == 0) {
this.$message.warning('请选择待确认的巡检单');
return;
}
const res = await this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId,
method: 'put',
data: this.$refs['check-order-list-table'].selectedOrder.map(
(item) => item.id
),
});
if (res.code == 0) {
this.$message.success('确认成功');
this.getList();
}
break;
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
@ -258,15 +284,35 @@ export default {
},
/** 编辑 */
handleEdit(row) {
handleEdit(row, detail) {
this.editOpen = true;
this.$nextTick(() => {
this.$refs['content-edit'].init(row);
this.$refs['content-edit'].init(row, detail ?? false);
});
},
/** 确认巡检单 */
handleConfirm(row) {},
handleConfirm(row) {
const id = row.id;
this.$modal
.confirm('是否确认巡检单"' + row.name + '"?')
.then(() => {
return this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put',
data: [id],
});
})
.then((res) => {
this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
},
/** 删除巡检单 */
handleDelete(row) {
@ -284,27 +330,27 @@ export default {
},
handleDetail(row) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row?.id, true);
});
this.handleEdit(row, true);
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有巡检设置?')
.then(() => {
this.exportLoading = true;
return exportEquipmentTypeExcel(params);
return this.$axios({
url: '/base/equipment-check-order/export-excel',
// params: {
// name: this.queryParams.name,
// status: 1,
// special: true,
// },
responseType: 'blob',
});
})
.then((response) => {
this.$download.excel(response, '巡检设置.xls');
this.$download.excel(response, '巡检单待确认.xls');
this.exportLoading = false;
})
.catch(() => {});

View File

@ -11,7 +11,6 @@
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
@ -25,7 +24,7 @@
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:width="70"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
@ -37,45 +36,16 @@
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm
v-if="open"
ref="form"
v-model="form"
:disabled="mode == 'detail'"
:has-files="true"
:rows="rows" />
</base-dialog>
<addRecord
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList"
@destroy="addOrUpdateVisible = false" />
</div>
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import addRecord from './Record-add.vue';
import {
exportCheckLogExcel,
deleteEqCheckLog,
} from '@/api/equipment/base/inspection/record';
import { parseTime } from '../../core/mixins/code-filter';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
export default {
name: 'SpecialEquipmentCheckRecord',
components: { addRecord },
components: {},
mixins: [basicPageMixin],
data() {
return {
@ -88,50 +58,50 @@ export default {
btnName: '详情',
}
: undefined,
this.$auth.hasPermi('equipment:check-record:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:check-record:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
// this.$auth.hasPermi('equipment:check-record:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:check-record:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
].filter((v) => v),
tableProps: [
{ prop: 'name', label: '巡检单名称' },
{ prop: 'department', label: '部门' },
{ prop: 'actualCheckTime', label: '巡检时间', filter: parseTime },
{ prop: 'groupClass', label: '班次' },
{
prop: '_detail',
label: '巡检内容',
subcomponent: {
name: 'ViewDetail',
props: ['injectData'],
data() {
return {};
},
methods: {
handleClick() {
this.$emit('emitData', {
action: this.injectData.label,
value: this.injectData,
});
},
},
render: function (h) {
return (
<el-button type="text" onClick={this.handleClick}>
</el-button>
);
},
},
},
// {
// prop: '_detail',
// label: '',
// subcomponent: {
// name: 'ViewDetail',
// props: ['injectData'],
// data() {
// return {};
// },
// methods: {
// handleClick() {
// this.$emit('emitData', {
// action: this.injectData.label,
// value: this.injectData,
// });
// },
// },
// render: function (h) {
// return (
// <el-button type="text" onClick={this.handleClick}>
//
// </el-button>
// );
// },
// },
// },
{ prop: 'remark', label: '备注' },
],
searchBarFormConfig: [
@ -193,85 +163,16 @@ export default {
plain: true,
color: 'primary',
},
{
type: this.$auth.hasPermi('equipment:check-record:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
},
],
rows: [
[
{
input: true,
label: '维修单号',
prop: 'repairOrderNumber',
},
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/listAll',
bind: {
filterable: true,
clearable: true,
},
rules: [
{ required: true, message: '设备名称不能为空', trigger: 'blur' },
],
},
],
[
{
// TODO:
select: true,
label: '维修工',
prop: 'repairman',
// url: '/base/core-equipment/listAll',
bind: {
filterable: true,
clearable: true,
multiple: true,
},
rules: [
{ required: true, message: '维修工不能为空', trigger: 'blur' },
],
},
{
input: true,
label: '联系方式',
prop: 'repairmanPhone',
},
],
[
{
datetime: true,
label: '故障发生时间',
prop: 'faultTime',
rules: [
{
required: true,
message: '故障发生时间不能为空',
trigger: 'blur',
},
],
bind: {
format: 'yyyy-MM-dd HH:mm:ss',
'value-format': 'timestamp',
// 'value-format': 'yyyy-MM-dd HH:mm:ss',
clearable: true,
},
},
{
select: true,
label: '故障级别',
prop: 'faultLevel', //
options: this.getDictDatas(this.DICT_TYPE.FAULT_LEVEL),
},
],
// {
// type: this.$auth.hasPermi('equipment:check-record:create')
// ? 'button'
// : '',
// btnName: '',
// name: 'add',
// plain: true,
// },
],
//
open: false,
//
@ -285,42 +186,12 @@ export default {
form: {},
basePath: '/base/equipment-check-order',
mode: null,
allSpecialEquipments: [],
};
},
created() {
// this.initSearchBar();
this.getList();
},
methods: {
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.allSpecialEquipments = data.filter((item) => item.special);
this.setSearchBarEquipmentList(data.filter((item) => item.special));
});
},
//
handleSearchBarChange({ param, value }) {
if ('specialType' === param) {
if (!value) {
this.setSearchBarEquipmentList(this.allSpecialEquipments);
return;
}
this.setSearchBarEquipmentList(
this.allSpecialEquipments.filter((item) => item.specialType == value)
);
}
},
setSearchBarEquipmentList(eqList) {
this.$set(
this.searchBarFormConfig[1],
'selectOptions',
eqList.map((item) => ({
name: item.name,
id: item.id,
}))
);
},
/** 查询列表 */
getList() {
this.loading = true;
@ -335,125 +206,44 @@ export default {
cancel() {
this.open = false;
this.mode = null;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: null,
repairOrderNumber: null,
equipmentId: null,
repairman: null,
repairmanPhone: null,
faultTime: null,
faultLevel: null,
maintenanceStartTime: null,
maintenanceFinishTime: null,
faultType: null,
repairMode: null,
maintenanceStatus: null,
faultDetail: null,
maintenanceDetail: null,
remark: null,
files: [
// {
// fileName: '',
// fileType: '',
// fileUrl: '',
// },
],
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();
});
},
/** 修改按钮操作 */
handleUpdate(row) {
// this.reset();
// const id = row.id;
// this.info({ id }).then((response) => {
// this.form = response.data;
// this.open = true;
// this.title = '';
// });
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row.id);
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.post(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm(
'是否删除设备巡检记录配置名称为"' + row.configName + '"的数据项?'
)
.then(function () {
return deleteEqCheckLog(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
handleDetail({ id }) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true);
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有设备巡检记录?')
.then(() => {
this.exportLoading = true;
return exportCheckLogExcel(params);
return this.$axios({
url: '/base/equipment-check-order/export-excel',
params: {
name: this.queryParams.name,
status: 2,
special: true,
},
responseType: 'blob',
});
})
.then((response) => {
// const link = document.createElement('a');
// link.href = window.URL.createObjectURL(new Blob([response]));
// link.download = '.xls';
// document.body.appendChild(link);
// link.click();
// document.body.removeChild(link);
// window.URL.revokeObjectURL(link.href);
this.$download.excel(response, '设备巡检记录.xls');
this.exportLoading = false;
})