Commit 82da31e5 authored by lei's avatar lei

Merge branch 'master' of http://h.gemho.cn:7099/lichunliang/yindong-tongbai-automation

# Conflicts:
#	src/views/equipment/equipmentMag/index.vue
parents e6ae69c6 b5069032
{
"mcpServers": {}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@
:before-upload="handleBeforeUpload"
:data="data"
:limit="limit"
:file-list="fileList"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-success="handleUploadSuccess"
......@@ -18,7 +19,7 @@
<!-- 上传按钮 -->
<el-button size="mini" type="primary">选取文件</el-button>
<div slot="file" slot-scope="{ file }">
<img class="el-upload-list__item-thumbnail" :src="baseUrl + file.url" alt />
<img class="el-upload-list__item-thumbnail" :src="file.url" alt />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)">
<i class="el-icon-zoom-in"></i>
......@@ -45,37 +46,6 @@
的文件
</div>
</el-upload>
<!-- 文件列表 -->
<!-- <transition-group
ref="uploadFileList"
class="upload-file-list el-upload-list el-upload-list--text"
name="el-fade-in-linear"
tag="ul"
>
<li
:key="file.url"
class="el-upload-list__item ele-upload-list__item-content"
v-for="(file, index) in fileList"
>
<el-link
:href="`${baseUrl}${file.url}`"
:underline="false"
target="_blank"
>
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
<el-link
:underline="false"
@click="handleDelete(index)"
type="danger"
v-if="!disabled"
>删除</el-link
>
</div>
</li>
</transition-group>-->
<el-dialog :visible.sync="dialogVisible" :append-to-body="true">
<img :src="dialogImageUrl" alt />
</el-dialog>
......@@ -143,12 +113,34 @@ export default {
},
dialogImageUrl: '',
fileList: [],
// 添加标志位
isInternalChange: false,
}
},
watch: {
// 回显
value: {
handler(newVal, oldVal) {
// 只有当变化不是由组件内部引起时,才处理
if (!this.isInternalChange) {
if (newVal) {
this.fileList = newVal.split(',').map((url) => ({ url: this.baseUrl + url }))
} else {
this.fileList = []
}
}
// 重置标志位
this.isInternalChange = false
},
deep: true,
immediate: true,
},
},
mounted() {
if (this.drag && !this.disabled) {
this.$nextTick(() => {
const element = this.$refs.uploadFileList?.$el || this.$refs.uploadFileList
element &&
Sortable.create(element, {
ghostClass: 'file-upload-darg',
onEnd: (evt) => {
......@@ -160,30 +152,6 @@ export default {
})
}
},
watch: {
value: {
handler(val) {
if (val) {
let temp = 1
// 首先将值转为数组
const list = Array.isArray(val) ? val : this.value.split(',')
// 然后将数组转为对象数组
this.fileList = list.map((item) => {
if (typeof item === 'string') {
item = { name: item, url: item }
}
item.uid = item.uid || new Date().getTime() + temp++
return item
})
} else {
this.fileList = []
return []
}
},
deep: true,
immediate: true,
},
},
computed: {
// 是否显示提示
showTip() {
......@@ -233,12 +201,6 @@ export default {
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push({ name: res.fileName, url: res.fileName })
const updatedFile = this.$refs.fileUpload.uploadFiles.find((f) => f.uid === file.uid)
if (updatedFile) {
updatedFile.url = res.fileName
updatedFile.name = res.fileName
}
this.uploadedSuccessfully()
} else {
this.number--
......@@ -249,10 +211,16 @@ export default {
}
},
handleRemove(file) {
this.fileList.forEach((item, index) => {
const updatedFile = this.$refs.fileUpload.uploadFiles
updatedFile.forEach((item, index) => {
if (item.url === file.url) {
this.fileList.splice(index, 1)
this.$emit('handleRemove', this.listToString(this.fileList))
// 从组件上传列表中移除文件
updatedFile.splice(index, 1)
// 从自己的上传列表中移除文件
this.uploadList.splice(index, 1)
// 在触发 input 事件前设置标志位
this.isInternalChange = true
this.$emit('handleRemove', this.listToString(this.uploadList))
}
})
},
......@@ -263,29 +231,12 @@ export default {
handleDownload(file) {
console.log(file)
},
// 删除文件
handleDelete(index) {
this.fileList.splice(index, 1)
this.$emit('input', this.listToString(this.fileList))
},
// 上传结束处理
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList)
this.uploadList = []
this.number = 0
this.$emit('input', this.listToString(this.fileList))
// 在触发 input 事件前设置标志位
this.isInternalChange = true
this.$emit('input', this.listToString(this.uploadList))
this.$modal.closeLoading()
}
},
// 获取文件名称
getFileName(name) {
// 如果是url那么取最后的名字 如果不是直接返回
if (name.lastIndexOf('/') > -1) {
return name.slice(name.lastIndexOf('/') + 1)
} else {
return name
}
},
// 对象转成指定字符串分隔
listToString(list, separator) {
......
......@@ -8,7 +8,10 @@
label-width="68px"
>
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="queryParams.deviceType" placeholder="">
<el-select
v-model="queryParams.deviceType"
placeholder="请选择设备类型"
>
<el-option
v-for="item in deviceTypeList"
:key="item.id"
......@@ -122,7 +125,7 @@
<el-input v-model="form.location" placeholder="请输入设备位置描述" />
</el-form-item>
<el-form-item label="设备类型" prop="deviceType">
<el-select v-model="form.deviceType" placeholder="">
<el-select v-model="form.deviceType" placeholder="请选择设备类型">
<el-option
v-for="item in deviceTypeList"
:key="item.id"
......@@ -329,7 +332,7 @@ export default {
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除设备类型编号为"' + ids + '"的数据项?')
.confirm('是否确认删除设备类型编号为"' + row.deviceNo + '"的数据项?')
.then(function () {
return delDevice(ids);
})
......
......@@ -94,7 +94,10 @@ export default {
// 表单参数
form: {},
// 表单校验
rules: {},
rules: {
typeName: [{ required: true, message: '类型名称不能为空', trigger: 'blur' }],
typeDeptIds: [{ required: true, message: '设备管理部门不能为空', trigger: 'blur' }],
},
}
},
created() {
......
......@@ -39,7 +39,6 @@
:data="placeList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="地点名称" align="center" prop="placeName" />
<el-table-column label="地点位置" align="center" prop="location" />
<el-table-column label="信息" align="center" prop="information" />
......
......@@ -28,7 +28,6 @@
</el-row>
<el-table v-loading="loading" :data="inspectionList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" width="55" align="center" prop="id" />
<el-table-column label="巡检日期" align="center" prop="pollingData" width="180">
<template slot-scope="scope">
......
......@@ -21,7 +21,6 @@
</el-row>
<el-table v-loading="loading" :data="inspectionList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="报修单编号" align="center" prop="repairsId" />
<el-table-column label="巡检日期" align="center" prop="pollingData" width="180">
<template slot-scope="scope">
......@@ -31,6 +30,11 @@
<el-table-column label="巡检人" align="center" prop="inspectionUserName" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备状态" align="center" prop="deviceState">
<template slot-scope="scope">
<el-tag v-if="scope.row.deviceState == 1" type="success">正常</el-tag>
<el-tag v-else type="danger">异常</el-tag>
......
......@@ -6,7 +6,7 @@
<el-option v-for="item in deviceTypeList" :key="item.id" :label="item.typeName" :value="item.id"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="" prop="deviceName">
<el-form-item label="设备名称" prop="deviceName">
<el-input v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item>
......@@ -21,11 +21,14 @@
</el-row>
<el-table v-loading="loading" :data="workOrderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="维修单编号" align="center" prop="id" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备编码" align="center" prop="deviceNo" />
<el-table-column label="巡检人" align="center" prop="inspectionUserName" />
<el-table-column label="巡检人" align="center" prop="inspectionUserName">
<template slot-scope="scope">
<span>{{ scope.row.inspectionUserName || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="设备故障描述" align="center" prop="deviceErrorDetail" />
<el-table-column label="故障日期" align="center" prop="erroDate" width="180">
<template slot-scope="scope">
......@@ -37,12 +40,27 @@
<span>{{ selectDictLabels(orderStatesList, scope.row.orderStates) }}</span>
</template>
</el-table-column>
<el-table-column label="维修人" align="center" prop="maintainUserName">
<template slot-scope="scope">
<span>{{ scope.row.maintainUserName || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="维修情况描述" align="center" prop="maintainDetail">
<template slot-scope="scope">
<span>{{ scope.row.maintainDetail || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="维修日期" align="center" prop="maintainDate" width="180">
<template slot-scope="scope">
<span>{{ scope.row.maintainDate ? parseTime(scope.row.maintainDate, '{y}-{m}-{d}') : '-' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="handleUpdate(scope.row)" v-hasPermi="['workOrder:workOrder:edit']" v-if="scope.row.orderStates == 0"
>派单</el-button
>
<el-button size="mini" type="text" @click="handleView(scope.row)" v-hasPermi="['workOrder:workOrder:view']" v-if="false">查看</el-button>
</template>
</el-table-column>
</el-table>
......@@ -58,7 +76,7 @@
</el-select>
</el-form-item>
<el-form-item label="设备名称" prop="deviceName">
<el-select v-model="form.deviceName" placeholder="请选择设备名称" @change="getDeviceNo">
<el-select v-model="form._deviceName" placeholder="请选择设备名称" value-key="id" @change="getDeviceNo">
<el-option v-for="item in deviceNameList" :key="item.id" :label="item.deviceName" :value="item"> </el-option>
</el-select>
</el-form-item>
......@@ -69,8 +87,8 @@
<el-form-item label="设备故障描述" prop="deviceErrorDetail">
<el-input v-model="form.deviceErrorDetail" placeholder="请输入设备故障描述" />
</el-form-item>
<el-form-item label="设备故障图片" prop="deviceErroPhotos">
<FileUploadInspec v-model="form.deviceErroPhotos" @input="fileSuccess" @handleRemove="handleRemove" :fileType="['jpg', 'jpeg', 'png']" />
<el-form-item label="设备故障图片" prop="deviceErrorPhotos">
<FileUploadInspec :value="form.deviceErrorPhotos" @input="fileSuccess" @handleRemove="handleRemove" :fileType="['jpg', 'jpeg', 'png']" />
</el-form-item>
<el-form-item label="故障日期" prop="erroDate">
<el-date-picker clearable v-model="form.erroDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择故障日期"> </el-date-picker>
......@@ -162,7 +180,7 @@ export default {
deviceName: null,
inspectionUserId: null,
deviceErrorDetail: null,
deviceErroPhotos: null,
deviceErrorPhotos: null,
erroDate: null,
orderStates: null,
maintainUserId: null,
......@@ -189,7 +207,7 @@ export default {
// 表单校验
rules: {
repairsId: [{ required: true, message: '维修单编号不能为空', trigger: 'blur' }],
deviceErroPhotos: [{ required: true, message: '设备故障图片不能为空', trigger: 'blur' }],
deviceErrorPhotos: [{ required: true, message: '设备故障图片不能为空', trigger: 'blur' }],
deviceErrorDetail: [{ required: true, message: '设备故障描述不能为空', trigger: 'blur' }],
erroDate: [{ required: true, message: '故障日期不能为空', trigger: 'blur' }],
maintainEndDate: [{ required: true, message: '维修截止日期不能为空', trigger: 'blur' }],
......@@ -223,11 +241,38 @@ export default {
},
// 设备名称
getDeviceName(val) {
// 清空部门
this.deptOptions = []
const typeDeptIds = this.deviceTypeList.find((item) => item.id === val).typeDeptIds
// 如果有关联的部门ID,则进行查询
if (typeDeptIds && typeDeptIds.length > 0) {
// 创建所有 listDept 请求的 Promise 数组
const deptPromises = typeDeptIds.map((deptId) =>
listDept({ deptId: deptId })
.then((response) => {
// 处理并返回数据
return this.handleTree(response.data, 'deptId')
})
.catch((error) => {
return [] // 返回空数组,避免 Promise.all 失败
})
)
//等待所有请求完成
Promise.all(deptPromises)
.then((deptData) => {
this.deptOptions = deptData.flat()
})
.catch((error) => {
console.error('获取部门数据失败:', error)
})
}
listDeviceName({ deviceType: val }).then((response) => {
this.deviceNameList = response.rows
})
this.form.deviceName = null
this.form.deviceNo = null
this.form.maintainDeptId = null
},
// 取消按钮
cancel() {
......@@ -244,7 +289,7 @@ export default {
deviceName: null,
inspectionUserId: null,
deviceErrorDetail: null,
deviceErroPhotos: null,
deviceErrorPhotos: null,
erroDate: null,
orderStates: null,
maintainUserId: null,
......@@ -280,13 +325,12 @@ export default {
this.reset()
this.open = true
this.title = '添加工单派遣'
listDept().then((response) => {
this.deptOptions = this.handleTree(response.data, 'deptId')
})
// listDept().then((response) => {
// this.deptOptions = this.handleTree(response.data, 'deptId')
// })
},
/** 派单 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
listDept().then((response) => {
this.deptOptions = this.handleTree(response.data, 'deptId')
......@@ -297,6 +341,19 @@ export default {
this.title = '派遣'
})
},
// 查看
handleView(row) {
const id = row.id || this.ids
// listDept().then((response) => {
// this.deptOptions = this.handleTree(response.data, 'deptId')
// })
getWorkOrder(id).then((response) => {
this.form = response.data
this.open = true
this.title = '查看'
console.log(this.form)
})
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
......@@ -310,6 +367,7 @@ export default {
},
deptSelect(val) {
this.queryParamsUser.deptId = val.deptId
this.form.maintainUserId = null
this.getUserList()
},
/** 查询用户列表 */
......@@ -319,6 +377,7 @@ export default {
})
},
getDeviceNo(val) {
this.form._deviceName = val
this.form.deviceName = val.deviceName
this.form.deviceNo = val.deviceNo
this.form.deviceId = val.deviceId
......@@ -327,6 +386,9 @@ export default {
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.form._deviceName) {
delete this.form._deviceName
}
addWorkOrder(this.form).then((response) => {
this.$modal.msgSuccess('新增成功')
this.open = false
......@@ -337,20 +399,24 @@ export default {
},
// 派单提交
submitFormOrder() {
this.$refs['formpd'].validate((valid) => {
if (valid) {
updateWorkOrder({ ...this.form, ...this.formpd }).then((response) => {
this.$modal.msgSuccess('派单成功')
this.openpd = false
this.getList()
})
}
})
},
// 文件上传回调
fileSuccess(val) {
this.form.deviceErroPhotos = val
this.form.deviceErrorPhotos = val
},
// 文件删除
handleRemove(url) {
this.form.deviceErroPhotos = url
this.form.deviceErrorPhotos = url
},
},
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment