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() { handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal this.$modal
.confirm('是否确认导出所有巡检设置?') .confirm('是否确认导出所有巡检设置?')
.then(() => { .then(() => {
this.exportLoading = true; 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) => { .then((response) => {
this.$download.excel(response, '巡检设置.xls'); this.$download.excel(response, '巡检设置.xls');
this.exportLoading = false; this.exportLoading = false;
}) })
.catch(() => {}); .catch(() => {});

View File

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

View File

@ -233,6 +233,32 @@ export default {
this.title = ''; 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() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
@ -258,15 +284,35 @@ export default {
}, },
/** 编辑 */ /** 编辑 */
handleEdit(row) { handleEdit(row, detail) {
this.editOpen = true; this.editOpen = true;
this.$nextTick(() => { 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) { handleDelete(row) {
@ -284,27 +330,27 @@ export default {
}, },
handleDetail(row) { handleDetail(row) {
this.addOrUpdateVisible = true; this.handleEdit(row, true);
this.addOrEditTitle = '详情';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row?.id, true);
});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal this.$modal
.confirm('是否确认导出所有巡检设置?') .confirm('是否确认导出所有巡检设置?')
.then(() => { .then(() => {
this.exportLoading = true; 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) => { .then((response) => {
this.$download.excel(response, '巡检设置.xls'); this.$download.excel(response, '巡检单待确认.xls');
this.exportLoading = false; this.exportLoading = false;
}) })
.catch(() => {}); .catch(() => {});

View File

@ -11,7 +11,6 @@
<SearchBar <SearchBar
:formConfigs="searchBarFormConfig" :formConfigs="searchBarFormConfig"
ref="search-bar" ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" /> @headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 --> <!-- 列表 -->
@ -25,7 +24,7 @@
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:width="120" :width="70"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
</base-table> </base-table>
@ -37,45 +36,16 @@
:page.sync="queryParams.pageNo" :page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" /> @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> </div>
</template> </template>
<script> <script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; 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'; import { parseTime } from '../../core/mixins/code-filter';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
export default { export default {
name: 'SpecialEquipmentCheckRecord', name: 'SpecialEquipmentCheckRecord',
components: { addRecord }, components: {},
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
@ -88,50 +58,50 @@ export default {
btnName: '详情', btnName: '详情',
} }
: undefined, : undefined,
this.$auth.hasPermi('equipment:check-record:update') // this.$auth.hasPermi('equipment:check-record:update')
? { // ? {
type: 'edit', // type: 'edit',
btnName: '修改', // btnName: '',
} // }
: undefined, // : undefined,
this.$auth.hasPermi('equipment:check-record:delete') // this.$auth.hasPermi('equipment:check-record:delete')
? { // ? {
type: 'delete', // type: 'delete',
btnName: '删除', // btnName: '',
} // }
: undefined, // : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'name', label: '巡检单名称' }, { prop: 'name', label: '巡检单名称' },
{ prop: 'department', label: '部门' }, { prop: 'department', label: '部门' },
{ prop: 'actualCheckTime', label: '巡检时间', filter: parseTime }, { prop: 'actualCheckTime', label: '巡检时间', filter: parseTime },
{ prop: 'groupClass', label: '班次' }, { prop: 'groupClass', label: '班次' },
{ // {
prop: '_detail', // prop: '_detail',
label: '巡检内容', // label: '',
subcomponent: { // subcomponent: {
name: 'ViewDetail', // name: 'ViewDetail',
props: ['injectData'], // props: ['injectData'],
data() { // data() {
return {}; // return {};
}, // },
methods: { // methods: {
handleClick() { // handleClick() {
this.$emit('emitData', { // this.$emit('emitData', {
action: this.injectData.label, // action: this.injectData.label,
value: this.injectData, // value: this.injectData,
}); // });
}, // },
}, // },
render: function (h) { // render: function (h) {
return ( // return (
<el-button type="text" onClick={this.handleClick}> // <el-button type="text" onClick={this.handleClick}>
//
</el-button> // </el-button>
); // );
}, // },
}, // },
}, // },
{ prop: 'remark', label: '备注' }, { prop: 'remark', label: '备注' },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
@ -193,85 +163,16 @@ export default {
plain: true, plain: true,
color: 'primary', color: 'primary',
}, },
{ // {
type: this.$auth.hasPermi('equipment:check-record:create') // type: this.$auth.hasPermi('equipment:check-record:create')
? 'button' // ? 'button'
: '', // : '',
btnName: '新增', // btnName: '',
name: 'add', // name: 'add',
plain: true, // 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),
},
],
], ],
// //
open: false, open: false,
// //
@ -285,42 +186,12 @@ export default {
form: {}, form: {},
basePath: '/base/equipment-check-order', basePath: '/base/equipment-check-order',
mode: null, mode: null,
allSpecialEquipments: [],
}; };
}, },
created() { created() {
// this.initSearchBar();
this.getList(); this.getList();
}, },
methods: { 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() { getList() {
this.loading = true; this.loading = true;
@ -335,125 +206,44 @@ export default {
cancel() { cancel() {
this.open = false; this.open = false;
this.mode = null; 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() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.getList(); 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 }) { handleDetail({ id }) {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true); this.$refs.addOrUpdate.init(id, true);
}); });
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal this.$modal
.confirm('是否确认导出所有设备巡检记录?') .confirm('是否确认导出所有设备巡检记录?')
.then(() => { .then(() => {
this.exportLoading = true; 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) => { .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.$download.excel(response, '设备巡检记录.xls');
this.exportLoading = false; this.exportLoading = false;
}) })