projects/mesxc-dy #229

Merged
juzi merged 3 commits from projects/mesxc-dy into projects/mesxc-test 2024-03-04 12:24:26 +08:00
5 changed files with 155 additions and 115 deletions
Showing only changes of commit 063532567b - Show all commits

View File

@ -15,16 +15,12 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="巡检单名称" prop="name">
<el-input
v-model="dataForm.name"
placeholder="请输入巡检单名称" />
<el-input v-model="dataForm.name" placeholder="请输入巡检单名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="巡检单编码" prop="code">
<el-input
v-model="dataForm.code"
placeholder="请输入巡检单编码" />
<el-input v-model="dataForm.code" placeholder="请输入巡检单编码" />
</el-form-item>
</el-col>
<el-col :span="12">
@ -97,9 +93,14 @@
<script>
import basicAdd from '../../../../core/mixins/basic-add';
import { getCheckOrder, getOrderCode, createCheckOrder, updateCheckOrder } from "@/api/equipment/base/inspection/settings";
import { getCoreDepartmentList } from "@/api/base/coreDepartment";
import { groupClassesListAll } from '@/api/monitoring/teamProduction'
import {
getCheckOrder,
getOrderCode,
createCheckOrder,
updateCheckOrder,
} from '@/api/equipment/base/inspection/settings';
import { getCoreDepartmentList } from '@/api/base/coreDepartment';
import { groupClassesListAll } from '@/api/monitoring/teamProduction';
import { getDictDataLabel } from '@/utils/dict';
// import { getEquipmentAll } from '@/api/base/equipment'
@ -129,13 +130,13 @@ export default {
departmentOptions: [],
dataRule: {
confirmTimeLimit: [
{ required: true, message: '确认时限不能为空', trigger: 'blur' }
{ required: true, message: '确认时限不能为空', trigger: 'blur' },
],
code: [
{ required: true, message: '巡检单编码不能为空', trigger: 'blur' }
{ required: true, message: '巡检单编码不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '巡检单名称不能为空', trigger: 'blur' }
{ required: true, message: '巡检单名称不能为空', trigger: 'blur' },
],
planCheckTime: [
{ required: true, message: '计划巡检时间不能为空', trigger: 'blur' }
@ -153,34 +154,41 @@ export default {
};
},
created() {
const currenttime = new Date()
this.dataForm.planCheckTime = new Date(currenttime.getFullYear(), currenttime.getMonth(), currenttime.getDate(), 8, 0, 0).getTime()
console.log('11', this.dataForm.planCheckTime, currenttime)
const currenttime = new Date();
this.dataForm.planCheckTime = new Date(
currenttime.getFullYear(),
currenttime.getMonth(),
currenttime.getDate(),
8,
0,
0
).getTime();
},
mounted() {
this.getDict()
this.getDict();
},
methods: {
init(id) {
this.dataForm.id = id || "";
this.dataForm.id = id || '';
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
this.getArr();
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data
if (response.data.groupClass === '') {
this.dataForm.groupClass = []
this.urlOptions.infoURL(id).then((response) => {
this.dataForm = response.data;
if (response.data?.groupClass === '') {
this.dataForm.groupClass = [];
} else {
this.dataForm.groupClass = response.data?.groupClass.split(',') || undefined
this.dataForm.groupClass =
response.data?.groupClass?.split(',') || undefined;
}
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
this.getCode();
}
}
});
@ -190,43 +198,49 @@ export default {
const res = await getCoreDepartmentList();
this.departmentOptions = res.data || [];
const res1 = await groupClassesListAll();
this.groupOptions = res1.data.map((item) => {
item.label = item.name + ' - ' + getDictDataLabel('workshop', item.roomNameDict)
return item
this.groupOptions =
res1.data.map((item) => {
item.label =
item.name + ' - ' + getDictDataLabel('workshop', item.roomNameDict);
return item;
}) || [];
// const res = await getEquipmentAll()
// this.eqList = res.data
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL({
this.urlOptions
.updateURL({
...this.dataForm,
special: false,
status: 0,
groupClass: this.dataForm.groupClass.join(',')
}).then(response => {
this.$modal.msgSuccess("修改成功");
groupClass: this.dataForm.groupClass?.join(','),
})
.then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit("refreshDataList");
this.$emit('refreshDataList');
});
return;
}
//
this.urlOptions.createURL({
this.urlOptions
.createURL({
...this.dataForm,
special: false,
status: 0,
groupClass: this.dataForm.groupClass.join(',')
}).then(response => {
this.$modal.msgSuccess("新增成功");
groupClass: this.dataForm.groupClass?.join(','),
})
.then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit("refreshDataList");
this.$emit('refreshDataList');
});
});
},

View File

@ -37,9 +37,7 @@
@close="cancel"
@cancel="cancel"
@confirm="handleConfirm">
<add
ref="add"
@refreshDataList="successSubmit" />
<add ref="add" @refreshDataList="successSubmit" />
</base-dialog>
<!-- 添加巡检查看详情 -->
<addOrUpdata
@ -52,7 +50,7 @@
<script>
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import addOrUpdata from './add-or-updata.vue';
import add from './add.vue'
import add from './add.vue';
import { parseTime } from '../../../../core/mixins/code-filter';
// import { publicFormatter } from '@/utils/dict';
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
@ -71,7 +69,7 @@ export default {
? {
type: 'add',
btnName: '添加',
showTip: '添加巡检'
showTip: '添加巡检',
}
: undefined,
this.$auth.hasPermi('equipment:check-setting:update')
@ -94,16 +92,40 @@ export default {
: undefined,
].filter((v) => v),
tableProps: [
{ prop: 'name', label: '巡检单名称', width: 110, showOverflowtooltip: true },
{ prop: 'code', label: '巡检单编码', minWidth: 150, showOverflowtooltip: true },
{
prop: 'name',
label: '巡检单名称',
width: 110,
showOverflowtooltip: true,
},
{
prop: 'code',
label: '巡检单编码',
minWidth: 150,
showOverflowtooltip: true,
},
{ prop: 'department', label: '部门', showOverflowtooltip: true },
{ prop: 'planCheckTime', label: '计划巡检时间', width: 150, filter: parseTime },
{ prop: 'confirmTimeLimit', label: '确认时限', showOverflowtooltip: true },
{
prop: 'planCheckTime',
label: '计划巡检时间',
width: 150,
filter: parseTime,
},
{
prop: 'confirmTimeLimit',
label: '确认时限',
showOverflowtooltip: true,
},
{ prop: 'groupClass', label: '班次', showOverflowtooltip: true },
{ prop: 'creator', label: '创建人', showOverflowtooltip: true },
{ prop: 'createTime', label: '创建时间', width: 150, filter: parseTime },
{
prop: 'createTime',
label: '创建时间',
width: 150,
filter: parseTime,
},
// { prop: 'responsible', label: '' },
{ prop: 'remark', label: '备注' } // TODO:
{ prop: 'remark', label: '备注' }, // TODO:
],
searchBarFormConfig: [
{
@ -136,7 +158,7 @@ export default {
name: 'add',
plain: true,
color: 'success',
}
},
// {
// type: this.$auth.hasPermi('equipment:check-setting:export')
// ? 'button'
@ -177,7 +199,11 @@ export default {
clearable: true,
},
rules: [
{ required: true, message: '设备名称不能为空', trigger: 'change' },
{
required: true,
message: '设备名称不能为空',
trigger: 'change',
},
],
},
{
@ -196,13 +222,13 @@ export default {
equipmentId: null,
name: null,
special: false,
status: 0
status: 0,
},
//
form: {},
basePath: '/base/equipment-check-order',
mode: null,
groupList: []
groupList: [],
};
},
created() {
@ -212,11 +238,11 @@ export default {
},
methods: {
handleConfirm() {
this.$refs.add.dataFormSubmit()
this.$refs.add.dataFormSubmit();
},
successSubmit() {
this.cancel()
this.getList()
this.cancel();
this.getList();
},
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
@ -231,9 +257,9 @@ export default {
});
},
getGroup() {
groupClassesListAll().then(res => {
this.groupList = res.data || []
})
groupClassesListAll().then((res) => {
this.groupList = res.data || [];
});
},
/** 查询列表 */
getList() {
@ -247,9 +273,9 @@ export default {
},
/** 取消按钮 */
cancel() {
this.$refs.add.formClear()
this.$refs.add.formClear();
this.open = false;
this.title = ''
this.title = '';
// this.reset();
},
/** 表单重置 */

View File

@ -257,16 +257,14 @@ export default {
this.$message.warning('请选择待确认的巡检单');
return;
}
let checkPersonParam = '';
if (!row.checkPerson || row.checkPerson.trim() == '') {
/** 如有必要,更新巡检人 */
checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
}
//let checkPersonParam = '';
//if (!row.checkPerson || row.checkPerson.trim() == '') {
// checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
//}
const res = this.$axios({
url:
`/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}` +
checkPersonParam,
url: `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}`,
// +checkPersonParam,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put',
data: this.$refs['check-order-list-table'].selectedOrder.map(
@ -337,8 +335,8 @@ export default {
return this.$axios({
url:
`/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}` +
checkPersonParam,
`/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}`,
// + checkPersonParam,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put',
data: [id],

View File

@ -123,7 +123,7 @@
type: 'number',
message: '请输入正确的数字',
trigger: 'blur',
transform: (val) => Number(val),
transform: (val) => Number(val) && parseInt(val) === Number(val),
},
{ required: true, message: '保养频率不能为空', trigger: 'blur' },
]">

View File

@ -409,7 +409,8 @@ const uploadedFile = {
return {};
},
methods: {
handleDelete() {
handleDelete(e) {
e.stopPropagation();
this.$emit('delete', this.file);
},
async handleDownload() {
@ -610,7 +611,8 @@ export default {
const response = await this.$axios('/base/core-equipment/listAll');
this.equipmentList = response.data || [];
const equipmentOptions = (response.data || [])
.filter((item) => (type == 'special-equipment' ? item.special : true))
// .filter((item) => (type == 'special-equipment' ? item.special : true))
.filter((item) => item.special == true)
.map((item) => ({
label: item.name,
value: item.id,