解决冲突

This commit is contained in:
‘937886381’ 2024-03-05 09:49:01 +08:00
commit a80ce13de1
18 changed files with 766 additions and 163 deletions

View File

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

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-18 13:53:09 * @LastEditTime: 2024-03-01 19:52:55
* @Description: * @Description:
--> -->
<template> <template>
@ -33,14 +33,13 @@
<el-select <el-select
v-model="dataForm.roomNameDict" v-model="dataForm.roomNameDict"
filterable filterable
:disabled="isdetail || isedit"
style="width: 100%" style="width: 100%"
placeholder="请选择车间名称"> placeholder="请选择车间名称">
<el-option <el-option
v-for="(dict, index) in getDictDatas('workshop')" v-for="(dict, index) in getDictDatas('workshop')"
:key="index" :key="index"
:label="dict.label" :label="dict.label"
:value="dict.value" /> :value="Number(dict.value)" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -125,6 +124,26 @@ export default {
this.getDict() this.getDict()
}, },
methods: { 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() { async getDict() {
// //
const factoryRes = await getFactoryList(); const factoryRes = await getFactoryList();

View File

@ -38,7 +38,7 @@
import SmallTitle from './SmallTitle'; import SmallTitle from './SmallTitle';
import { getworkerAll } from '@/api/base/materialUseLog'; import { getworkerAll } from '@/api/base/materialUseLog';
import Editor from '@/components/Editor'; import Editor from '@/components/Editor';
import DialogForm from '@/components/DialogForm'; import DialogForm from './DialogForm';
export default { export default {
name: 'AlarmHandle', 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 label: '是否采集', // 0 , 1
prop: 'collection', prop: 'collection',
bind: { bind: {
'active-value': 1, 'active-value': 1,
'inactive-value': 0, 'inactive-value': 0,
value: 1, value: 1,
}, },
}, },
], ],
@ -294,7 +294,7 @@ export default {
name: undefined, name: undefined,
enName: undefined, enName: undefined,
description: undefined, description: undefined,
collection: undefined, collection: 1,
}; };
this.resetForm('form'); this.resetForm('form');
}, },

View File

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

View File

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

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-29 14:58:37 * @LastEditTime: 2024-03-01 19:44:59
* @Description: * @Description:
--> -->
<template> <template>
@ -11,24 +11,18 @@
:rules="dataRule" :rules="dataRule"
ref="dataForm" ref="dataForm"
@keyup.enter.native="dataFormSubmit()" @keyup.enter.native="dataFormSubmit()"
label-width="120px"> label-width="150px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="巡检单名称" prop="name"> <el-form-item label="巡检单名称" prop="name">
<el-input <el-input v-model="dataForm.name" placeholder="请输入巡检单名称" />
v-model="dataForm.name"
placeholder="请输入巡检单名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="巡检单编码" prop="code"> <el-form-item label="巡检单编码" prop="code">
<el-input <el-input v-model="dataForm.code" placeholder="请输入巡检单编码" />
v-model="dataForm.code"
placeholder="请输入巡检单编码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
label="部门" label="部门"
@ -57,8 +51,13 @@
style="width: 100%" /> style="width: 100%" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> <el-col :span="12">
<el-row :gutter="20"> <el-form-item label="巡检频率(天/次)" prop="checkPeriod">
<el-input
v-model="dataForm.checkPeriod"
placeholder="请输入巡检频率(天/次)" />
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="确认时限 (时)" prop="confirmTimeLimit"> <el-form-item label="确认时限 (时)" prop="confirmTimeLimit">
<el-input <el-input
@ -83,8 +82,6 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" /> <el-input v-model="dataForm.remark" placeholder="请输入备注" />
@ -96,9 +93,14 @@
<script> <script>
import basicAdd from '../../../../core/mixins/basic-add'; import basicAdd from '../../../../core/mixins/basic-add';
import { getCheckOrder, getOrderCode, createCheckOrder, updateCheckOrder } from "@/api/equipment/base/inspection/settings"; import {
import { getCoreDepartmentList } from "@/api/base/coreDepartment"; getCheckOrder,
import { groupClassesListAll } from '@/api/monitoring/teamProduction' 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 { getDictDataLabel } from '@/utils/dict';
// import { getEquipmentAll } from '@/api/base/equipment' // import { getEquipmentAll } from '@/api/base/equipment'
@ -107,118 +109,141 @@ export default {
data() { data() {
return { return {
urlOptions: { urlOptions: {
isGetCode: true, isGetCode: true,
codeURL: getOrderCode, codeURL: getOrderCode,
createURL: createCheckOrder, createURL: createCheckOrder,
updateURL: updateCheckOrder, updateURL: updateCheckOrder,
infoURL: getCheckOrder, infoURL: getCheckOrder,
}, },
dataForm: { dataForm: {
id: null, id: null,
code: null, code: null,
name: null, name: null,
departmentId: null, departmentId: null,
planCheckTime: null, planCheckTime: null,
confirmTimeLimit: null, confirmTimeLimit: null,
groupClass: null, groupClass: null,
remark: null remark: null,
checkPeriod: null
}, },
groupOptions: [], groupOptions: [],
departmentOptions: [], departmentOptions: [],
dataRule: { dataRule: {
confirmTimeLimit: [ confirmTimeLimit: [
{ required: true, message: '确认时限不能为空', trigger: 'blur' } { required: true, message: '确认时限不能为空', trigger: 'blur' },
], ],
code: [ code: [
{ required: true, message: '巡检单编码不能为空', trigger: 'blur' } { required: true, message: '巡检单编码不能为空', trigger: 'blur' },
], ],
name: [ name: [
{ required: true, message: '巡检单名称不能为空', trigger: 'blur' } { required: true, message: '巡检单名称不能为空', trigger: 'blur' },
], ],
planCheckTime: [ planCheckTime: [
{ required: true, message: '计划巡检时间不能为空', trigger: 'blur' } { required: true, message: '计划巡检时间不能为空', trigger: 'blur' }
],
checkPeriod: [
{ required: true, message: '巡检频率不能为空', trigger: 'blur' },
{
type: 'number',
message: '请输入正确的数字类型',
trigger: 'blur',
transform: (val) => Number(val),
}
] ]
} }
}; };
}, },
created() { created() {
const currenttime = new Date() const currenttime = new Date();
this.dataForm.planCheckTime = new Date(currenttime.getFullYear(), currenttime.getMonth(), currenttime.getDate(), 8, 0, 0).getTime() this.dataForm.planCheckTime = new Date(
console.log('11', this.dataForm.planCheckTime, currenttime) currenttime.getFullYear(),
currenttime.getMonth(),
currenttime.getDate(),
8,
0,
0
).getTime();
}, },
mounted() { mounted() {
this.getDict() this.getDict();
}, },
methods: { methods: {
init(id) { init(id) {
this.dataForm.id = id || ""; this.dataForm.id = id || '';
this.visible = true; this.visible = true;
if (this.urlOptions.getOption) { if (this.urlOptions.getOption) {
this.getArr() this.getArr();
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["dataForm"].resetFields(); this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => { this.urlOptions.infoURL(id).then((response) => {
this.dataForm = response.data this.dataForm = response.data;
if (response.data.groupClass === '') { if (response.data?.groupClass === '') {
this.dataForm.groupClass = [] this.dataForm.groupClass = [];
} else { } else {
this.dataForm.groupClass = response.data?.groupClass.split(',') || undefined this.dataForm.groupClass =
response.data?.groupClass?.split(',') || undefined;
} }
}); });
} else { } else {
if (this.urlOptions.isGetCode) { if (this.urlOptions.isGetCode) {
this.getCode() this.getCode();
} }
} }
}); });
}, },
async getDict() { async getDict() {
// //
const res = await getCoreDepartmentList(); const res = await getCoreDepartmentList();
this.departmentOptions = res.data || []; this.departmentOptions = res.data || [];
const res1 = await groupClassesListAll(); const res1 = await groupClassesListAll();
this.groupOptions = res1.data.map((item) => { this.groupOptions =
item.label = item.name + ' - ' + getDictDataLabel('workshop', item.roomNameDict) res1.data.map((item) => {
return item item.label =
}) || []; item.name + ' - ' + getDictDataLabel('workshop', item.roomNameDict);
return item;
}) || [];
// const res = await getEquipmentAll() // const res = await getEquipmentAll()
// this.eqList = res.data // this.eqList = res.data
}, },
// //
dataFormSubmit() { dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (!valid) { if (!valid) {
return false; return false;
} }
// //
if (this.dataForm.id) { 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('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
this.urlOptions
.createURL({
...this.dataForm, ...this.dataForm,
special: false, special: false,
status: 0, status: 0,
groupClass: this.dataForm.groupClass.join(',') groupClass: this.dataForm.groupClass?.join(','),
}).then(response => { })
this.$modal.msgSuccess("修改成功"); .then((response) => {
this.visible = false; this.$modal.msgSuccess('新增成功');
this.$emit("refreshDataList"); 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");
});
});
},
}, },
}; };
</script> </script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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