projects/mesxc-zhp #232

Merged
gtz217 merged 2 commits from projects/mesxc-zhp into projects/mesxc-test 2024-03-05 10:07:27 +08:00
18 changed files with 766 additions and 163 deletions
Showing only changes of commit a80ce13de1 - Show all commits

View File

@ -1,7 +1,7 @@
###
# @Author: Do not edit
# @Date: 2023-08-29 09:40:39
# @LastEditTime: 2024-03-01 16:13:32
# @LastEditTime: 2024-03-05 09:48:49
# @LastEditors: zhp
# @Description:
###

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-18 13:53:09
* @LastEditTime: 2024-03-01 19:52:55
* @Description:
-->
<template>
@ -33,14 +33,13 @@
<el-select
v-model="dataForm.roomNameDict"
filterable
:disabled="isdetail || isedit"
style="width: 100%"
placeholder="请选择车间名称">
<el-option
v-for="(dict, index) in getDictDatas('workshop')"
:key="index"
:label="dict.label"
:value="dict.value" />
:value="Number(dict.value)" />
</el-select>
</el-form-item>
</el-col>
@ -125,6 +124,26 @@ export default {
this.getDict()
},
methods: {
init(id) {
this.dataForm.id = id || "";
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data
// this.dataForm.roomNameDict = String(this.dataForm.roomNameDict)
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
async getDict() {
//
const factoryRes = await getFactoryList();

View File

@ -38,7 +38,7 @@
import SmallTitle from './SmallTitle';
import { getworkerAll } from '@/api/base/materialUseLog';
import Editor from '@/components/Editor';
import DialogForm from '@/components/DialogForm';
import DialogForm from './DialogForm';
export default {
name: 'AlarmHandle',

View File

@ -0,0 +1,520 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-08-15 10:32:36
description: 弹窗的表单组件
-->
<template>
<el-form
ref="form"
:model="form"
:label-width="`${labelWidth}px`"
:size="size"
:label-position="labelPosition"
v-loading="formLoading">
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
<el-input
v-if="col.input"
v-model="form[col.prop]"
@change="$emit('update', form)"
:placeholder="`请输入${col.label}`"
:disabled="disabled"
v-bind="col.bind" />
<el-input
v-if="col.textarea"
type="textarea"
v-model="form[col.prop]"
:disabled="disabled"
@change="$emit('update', form)"
:placeholder="`请输入${col.label}`"
v-bind="col.bind" />
<el-select
v-if="col.select"
v-model="form[col.prop]"
:placeholder="`请选择${col.label}`"
:disabled="disabled"
@change="$emit('update', form)"
v-bind="col.bind">
<el-option
v-for="opt in optionListOf[col.prop]"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
<el-date-picker
v-if="col.datetime"
v-model="form[col.prop]"
type="datetime"
:disabled="disabled"
:placeholder="`请选择${col.label}`"
value-format="timestamp"
@change="$emit('update', form)"
v-bind="col.bind"></el-date-picker>
<el-switch
v-if="col.switch"
v-model="form[col.prop]"
:disabled="disabled"
active-color="#0b58ff"
inactive-color="#e1e1e1"
@change="$emit('update', form)"
v-bind="col.bind"></el-switch>
<component
v-if="col.subcomponent"
:key="col.key"
:disabled="disabled"
:read-only="disabled"
:is="col.subcomponent"
v-model="form[col.prop]"
:inlineStyle="col.style"
@on-change="$emit('update', form)"
v-bind="col.bind"></component>
<div
class="upload-area"
:class="uploadOpen ? '' : 'height-48'"
ref="uploadArea"
:key="col.prop"
v-if="col.upload">
<span class="close-icon" :class="uploadOpen ? 'open' : ''">
<el-button
type="text"
icon="el-icon-arrow-right"
@click="handleFilesOpen" />
</span>
<!-- :file-list="uploadedFileList" -->
<el-upload
v-if="col.upload"
class="upload-in-dialog"
:key="col.prop + '__el-upload'"
:action="uploadUrl"
:headers="uploadHeaders"
:show-file-list="false"
icon="el-icon-upload2"
:disabled="disabled"
:before-upload="beforeUpload"
:on-success="
(response, file, fileList) => {
handleUploadSuccess(response, file, col.prop);
}
"
v-bind="col.bind">
<el-button
size="mini"
:disabled="disabled || col.bind?.disabled || false">
<svg-icon
icon-class="icon-upload"
style="color: inherit"></svg-icon>
上传文件
</el-button>
<div class="el-upload__tip" slot="tip" v-if="col.uploadTips">
{{ col.uploadTips || '只能上传jpg/png文件, 大小不超过2MB' }}
</div>
</el-upload>
<uploadedFile
class="file"
v-for="file in form[col.prop]"
:file="file"
:key="file.fileUrl"
:disabled="disabled"
@delete="!disabled && handleDeleteFile(file, col.prop)" />
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getAccessToken } from '@/utils/auth';
import tupleImg from '@/assets/images/tuple.png';
import cache from '@/utils/cache';
/**
* 找到最长的label
* @param {*} options
*/
function findMaxLabelWidth(rows) {
let max = 0;
rows.forEach((row) => {
row.forEach((opt) => {
// debugger;
if (!opt.label) return 0;
if (opt.label.length > max) {
max = opt.label.length;
if (opt.label.includes('(')) {
max = max - 3;
}
}
});
});
return max;
}
const uploadedFile = {
name: 'UploadedFile',
props: ['file', 'disabled'],
data() {
return {};
},
methods: {
handleDelete() {
this.$emit('delete', this.file);
},
async handleDownload() {
const data = await this.$axios({
url: this.file.fileUrl,
method: 'get',
responseType: 'blob',
});
await this.$message.success('开始下载');
// create download link
const url = window.URL.createObjectURL(data);
const link = document.createElement('a');
link.href = url;
link.download = this.file.fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
},
mounted() {},
render: function (h) {
return (
<div
title={this.file.fileName}
onClick={this.handleDownload}
style={{
background: `url(${tupleImg}) no-repeat`,
backgroundSize: '14px',
backgroundPosition: '0 55%',
paddingLeft: '20px',
paddingRight: '24px',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
cursor: 'pointer',
display: 'inline-block',
}}>
{this.file.fileName}
{!this.disabled && (
<el-button
type="text"
icon="el-icon-close"
style="float: right; position: relative; top: 2px; left: 8px; z-index: 100"
class="dialog__upload_component__close"
onClick={this.handleDelete}
/>
)}
</div>
);
},
};
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: { uploadedFile },
props: {
rows: {
type: Array,
default: () => [],
},
dataForm: {
type: Object,
default: () => ({}),
},
disabled: {
type: Boolean,
default: false,
},
hasFiles: {
type: Boolean | Array,
default: false,
},
labelPosition: {
type: String,
default: 'right',
},
size: {
type: String,
default: '',
},
},
data() {
return {
uploadOpen: false,
form: {},
formLoading: true,
optionListOf: {},
uploadedFileList: [],
dataLoaded: false,
uploadHeaders: { Authorization: 'Bearer ' + getAccessToken() },
uploadUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', // headersurl
};
},
computed: {
labelWidth() {
let max = findMaxLabelWidth(this.rows);
// 20px
return max * 20;
// return max * 20 + 'px';
},
},
watch: {
rows: {
handler() {
this.$nextTick(() => {
this.handleOptions('watch');
});
},
deep: true,
immediate: false,
},
dataForm: {
handler(val) {
this.form = JSON.parse(JSON.stringify(val));
if (this.hasFiles) {
if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
this.form.files = this.form.files ?? [];
} else if (Array.isArray(this.hasFiles)) {
this.hasFiles.forEach((prop) => {
this.form[prop] = this.form[prop] ?? [];
});
}
}
},
deep: true,
immediate: true,
},
},
mounted() {
// options
this.handleOptions();
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
// getCode
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
async handleOptions(trigger = 'monuted') {
console.log('[dialogForm:handleOptions]');
const promiseList = [];
this.rows.forEach((cols) => {
cols.forEach((opt) => {
if (opt.value && !this.form[opt.prop]) {
//
this.form[opt.prop] = opt.value;
}
if (opt.options) {
this.$set(this.optionListOf, opt.prop, opt.options);
} else if (opt.url) {
// dependswatcher
if (opt.depends) {
this.$watch(
() => this.form[opt.depends],
(id) => {
console.log('<', opt.depends, '>', 'changed', id);
if (id == null) return;
//
this.form[opt.prop] = null;
//
this.$axios({
url: `${opt.url}?id=${id}`,
}).then((res) => {
this.$set(
this.optionListOf,
opt.prop,
res.data.map((item) => ({
label: item[opt.labelKey ?? 'name'],
value: item[opt.valueKey ?? 'id'],
}))
);
});
},
{
immediate: false,
}
);
return;
}
//
if (opt.select || (opt.input && !this.form?.id)) {
promiseList.push(async () => {
const response = await this.$axios(opt.url, {
method: opt.method ?? 'get',
// data: opt.method == 'post' ? opt.queryParams : null
});
// console.log('[dialogForm:handleOptions:response]', response);
if (opt.select) {
//
const list =
'list' in response.data
? response.data.list
: response.data;
if (opt.cache) {
cache.store(opt.cache, list);
}
this.$set(
this.optionListOf,
opt.prop,
list.map((item) => ({
label: item[opt.labelKey ?? 'name'],
value: item[opt.valueKey ?? 'id'],
}))
);
} else if (opt.input) {
console.log('setting code: ', response.data);
//
this.form[opt.prop] = response.data;
// dataFormcodebug
this.$emit('update', this.form);
}
});
}
}
});
});
console.log('[dialogForm:handleOptions] done!');
// watch
if (trigger == 'watch') {
this.formLoading = false;
return;
}
try {
await Promise.all(promiseList.map((fn) => fn()));
this.formLoading = false;
this.dataLoaded = true;
// console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf)
} catch (error) {
console.log('[dialogForm:handleOptions:error]', error);
this.formLoading = false;
}
if (!promiseList.length) this.formLoading = false;
},
//
beforeUpload(file) {
const checkFileSize = () => {
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
this.$modal.msgError('上传文件大小不能超过 2MB!');
}
return isLt2M;
};
const checkFileType = () => {
const isJPG =
file.type === 'image/jpeg' ||
file.type === 'image/png' ||
file.type === 'image/jpg';
return isJPG;
};
// return checkFileSize() && checkFileType();
return checkFileSize();
},
// bind
handleUploadSuccess(response, file, prop) {
console.log('[handleUploadSuccess]', response, file, prop);
this.form[prop].push({
fileName: file.name,
fileUrl: response.data,
fileType: prop == 'files' ? 2 : 1,
});
this.$modal.msgSuccess('上传成功');
this.$emit('update', this.form);
},
getFileName(fileUrl) {
return fileUrl.split('/').pop();
},
handleFilesOpen() {
this.uploadOpen = !this.uploadOpen;
},
handleDeleteFile(file, prop) {
this.form[prop] = this.form[prop].filter(
(item) => item.fileUrl != file.fileUrl
);
this.$emit('update', this.form);
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
.upload-area {
// background: #ccc;
// display: grid;
// grid-auto-rows: 34px;
// grid-template-columns: repeat(6, minmax(32px, max-content));
// gap: 8px;
// align-items: center;
position: relative;
overflow: hidden;
transition: height 0.3s ease-out;
}
.upload-in-dialog {
// display: inline-block;
margin-right: 24px;
// background: #ccc;
position: relative;
// top: -13px;
float: left;
}
.close-icon {
// background: #ccc;
position: absolute;
top: 0;
right: 12px;
z-index: 100;
transition: transform 0.3s ease-out;
}
.close-icon.open {
transform: rotateZ(90deg);
}
</style>
<style>
.dialog__upload_component__close {
color: #ccc;
}
.dialog__upload_component__close:hover {
/* color: #777; */
color: red;
}
.height-48 {
height: 35px !important;
}
</style>

View File

@ -218,9 +218,9 @@ export default {
label: '是否采集', // 0 , 1
prop: 'collection',
bind: {
'active-value': 1,
'active-value': 1,
'inactive-value': 0,
value: 1,
value: 1,
},
},
],
@ -294,7 +294,7 @@ export default {
name: undefined,
enName: undefined,
description: undefined,
collection: undefined,
collection: 1,
};
this.resetForm('form');
},

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-29 14:59:28
* @LastEditTime: 2024-03-04 11:14:28
* @Description:
-->
<template>
@ -78,7 +78,7 @@
v-for="opt in inspectorOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
:value="opt.label" />
</el-select>
</el-form-item>
</el-col>
@ -418,7 +418,7 @@ export default {
});
},
getConfirmed() {
return this.$confirm('是否直接确认巡检记录', '提示', {
return this.$confirm('是否直接确认巡检', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
@ -431,10 +431,16 @@ export default {
}
this.$nextTick(() => {
this.getConfirmed().then(confirm => {
// let checkPersonParam = '';
// if (!this.dataForm.checkPerson || this.dataForm.checkPerson.trim() == '') {
// /** */
// checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
// } else {
// checkPersonParam = `&checkPerson=${this.dataForm.checkPerson}`
// }
this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId,
`/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}`,
method: 'put',
data: [this.dataForm.id],
}).then(res =>{

View File

@ -179,8 +179,14 @@ export default {
this.$modal
.confirm('是否确认所有选中巡检单"?')
.then(() => {
// let checkPersonParam = '';
// if (!row.checkPerson || row.checkPerson.trim() == '') {
// /** */
// checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
// }
return this.$axios({
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId,
// url: `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}` + checkPersonParam,
url: `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}`,
method: 'put',
data: this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
@ -394,11 +400,17 @@ export default {
this.$modal
.confirm('是否确认巡检单"' + row.name + '"?')
.then(() => {
// let checkPersonParam = '';
// const nickname = this.$store.getters.nickname;
// if (!row.checkPerson || row.checkPerson.trim() == '') {
// /** */
// checkPersonParam = `&checkPerson=${nickname}`;
// } else {
// checkPersonParam = `&checkPerson=${row.checkPerson}`
// }
return this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
`/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}`,
method: 'put',
data: [row.id],
});

View File

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-29 14:58:37
* @LastEditTime: 2024-03-01 19:44:59
* @Description:
-->
<template>
@ -11,24 +11,18 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="120px">
label-width="150px">
<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-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="部门"
@ -57,8 +51,13 @@
style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="巡检频率(天/次)" prop="checkPeriod">
<el-input
v-model="dataForm.checkPeriod"
placeholder="请输入巡检频率(天/次)" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="确认时限 (时)" prop="confirmTimeLimit">
<el-input
@ -83,8 +82,6 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" />
@ -96,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'
@ -107,118 +109,141 @@ export default {
data() {
return {
urlOptions: {
isGetCode: true,
codeURL: getOrderCode,
isGetCode: true,
codeURL: getOrderCode,
createURL: createCheckOrder,
updateURL: updateCheckOrder,
infoURL: getCheckOrder,
},
dataForm: {
id: null,
id: null,
code: null,
name: null,
departmentId: null,
planCheckTime: null,
confirmTimeLimit: null,
groupClass: null,
remark: null
remark: null,
checkPeriod: null
},
groupOptions: [],
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' }
],
checkPeriod: [
{ required: true, message: '巡检频率不能为空', trigger: 'blur' },
{
type: 'number',
message: '请输入正确的数字类型',
trigger: 'blur',
transform: (val) => Number(val),
}
]
}
};
},
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.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
}
this.$nextTick(() => {
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.dataForm.id = id || '';
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr();
}
this.$nextTick(() => {
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 = [];
} else {
this.dataForm.groupClass = response.data?.groupClass.split(',') || undefined
this.dataForm.groupClass =
response.data?.groupClass?.split(',') || undefined;
}
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode();
}
}
});
},
});
},
async getDict() {
//
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) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL({
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions
.updateURL({
...this.dataForm,
special: false,
status: 0,
groupClass: this.dataForm.groupClass?.join(','),
})
.then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
this.urlOptions
.createURL({
...this.dataForm,
special: false,
status: 0,
groupClass: this.dataForm.groupClass.join(',')
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
//
this.urlOptions.createURL({
...this.dataForm,
special: false,
status: 0,
groupClass: this.dataForm.groupClass.join(',')
}).then(response => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
groupClass: this.dataForm.groupClass?.join(','),
})
.then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

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,14 +69,14 @@ export default {
? {
type: 'add',
btnName: '添加',
showTip: '添加巡检'
}
showTip: '添加巡检',
}
: undefined,
this.$auth.hasPermi('equipment:check-setting:update')
? {
type: 'edit',
btnName: '修改',
}
}
: undefined,
// this.$auth.hasPermi('equipment:check-setting:update')
// ? {
@ -90,20 +88,44 @@ export default {
? {
type: 'delete',
btnName: '删除',
}
}
: 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,12 +238,12 @@ 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 }) => {
this.$set(
@ -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

@ -160,6 +160,7 @@ import Editor from "@/components/Editor";
import { getDictDatas } from "@/utils/dict";
import { parseTime } from '@/utils/ruoyi'
import { getDictDataLabel } from '@/utils/dict';
import tupleImg from '@/assets/images/tuple.png';
const uploadedFile = {
name: 'UploadedFile',

View File

@ -29,7 +29,7 @@
</el-col>
<!-- 产线名 -->
<el-col :span="8">
<!-- <el-col :span="8">
<el-form-item label="产线名" prop="lineId">
<el-select
v-model="formFilters.lineId"
@ -45,10 +45,10 @@
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-col> -->
<!-- 工段名 -->
<el-col :span="8">
<!-- <el-col :span="8">
<el-form-item label="工段名" prop="sectionId">
<el-select
v-model="formFilters.sectionId"
@ -64,7 +64,7 @@
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
</el-col> -->
<!-- 设备名称 -->
<el-col :span="8">
@ -234,7 +234,7 @@
v-for="opt in workerOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
:value="opt.label" />
</el-select>
</el-form-item>
</el-col>
@ -597,9 +597,9 @@ export default {
/** 设置默认维修工为用户自己 */
setInitWorker() {
/** 获取用户自身id */
const userId = this.$store.getters.userId;
const nickname = this.$store.getters.nickname;
this.$nextTick(() => {
this.form.repairman = [userId];
this.form.repairman = [nickname];
});
},
@ -630,8 +630,8 @@ export default {
/** 获取设备 */
async initEquipment() {
const response = await this.$axios('/base/core-equipment/listAll');
this.equipmentList = response.data || [];
this.equipmentOptions = response.data || [];
this.equipmentList = response.data.filter(item => item.special === false) || [];
this.equipmentOptions = response.data.filter(item => item.special === false) || [];
// this.allSpeicalEquipments = equipmentOptions;
},
/** 获取维修工 - 同时从用户表和员工表拉取数据 */
@ -737,6 +737,7 @@ export default {
fileType: prop == 'files' ? 2 : 1,
});
this.$modal.msgSuccess('上传成功');
console.log('为我', this.form.files)
this.$emit('update', this.form);
},

View File

@ -60,14 +60,7 @@
</el-col>
<el-col :span='6'>
<el-form-item label="包装要求" prop="packReq">
<el-select v-model="form.packReq" placeholder="请选择" style="width: 100%;" clearable>
<el-option
v-for="item in getDictDatas(DICT_TYPE.PACK_SPEC)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-input v-model="form.packReq"></el-input>
</el-form-item>
</el-col>
</el-row>
@ -127,7 +120,7 @@ export default {
this.form.customerId = res.data.customerId
this.form.planQuantity = res.data.planQuantity
this.form.deliveTime = res.data.deliveTime ? res.data.deliveTime : null
this.form.packReq = res.data.packReq ? res.data.packReq+'' : ''
this.form.packReq = res.data.packReq
this.form.remark = res.data.remark
setTimeout(() => {
this.getSpecifications(this.form.planProductId)

View File

@ -125,7 +125,7 @@ const tableProps = [
{
prop: 'packReq',
label: '包装要求',
filter: publicFormatter('pack_spec'),
// filter: publicFormatter('pack_spec'),
minWidth: 120,
showOverflowtooltip: true
},

View File

@ -45,7 +45,7 @@
@close="cancel"
@cancel="cancel"
@confirm="handleConfirm">
<add ref="add" @refreshDataList="successSubmit" />
<add ref="add" v-if="open" @refreshDataList="successSubmit" />
</base-dialog>
<!-- 添加巡检查看详情 -->
<addOrUpdata

View File

@ -86,7 +86,7 @@ export default {
? {
type: 'edit',
btnName: '修改',
}
}
: undefined,
{
type: 'detail',
@ -96,7 +96,7 @@ export default {
? {
type: 'delete',
btnName: '删除',
}
}
: undefined,
].filter((v) => v),
tableProps: [
@ -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,
const res = await this.$axios({
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

@ -235,7 +235,7 @@ export default {
...this.dataForm,
special: true,
status: 0,
groupClass: this.dataForm.groupClass.join(','),
groupClass: this.dataForm.groupClass?.join(','),
},
});
if (res.code == 0) {

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,