|
|
|
|
@ -32,6 +32,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
<Button type="primary" style="margin-left: 8px;" @click="getList">查询</Button>
|
|
|
|
|
<Button type="primary" style="margin-left: 8px;" @click="resetSearch">重置</Button>
|
|
|
|
|
<Button type="primary" style="margin-left: 8px;" @click="createMaintenance">新增</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</slot>
|
|
|
|
|
</lx-header>
|
|
|
|
|
@ -69,7 +70,7 @@
|
|
|
|
|
align="center"
|
|
|
|
|
/>
|
|
|
|
|
<el-table-column
|
|
|
|
|
prop="stocks_item.zichanmingcheng"
|
|
|
|
|
prop="material_info.zichanmingcheng"
|
|
|
|
|
label="维护物资"
|
|
|
|
|
min-width="120"
|
|
|
|
|
align="center"
|
|
|
|
|
@ -101,7 +102,11 @@
|
|
|
|
|
label="负责人"
|
|
|
|
|
min-width="100"
|
|
|
|
|
align="center"
|
|
|
|
|
/>
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
{{ (scope.row.responsible_admin && scope.row.responsible_admin.name) || '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column
|
|
|
|
|
label="状态"
|
|
|
|
|
min-width="100"
|
|
|
|
|
@ -142,138 +147,213 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 完成维护 Modal -->
|
|
|
|
|
<div class="modal" :class="{ show: showModal }">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h3 class="modal-title">完成维护</h3>
|
|
|
|
|
<button class="close-button" @click="closeModal">×</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<Form ref="maintenanceForm" :model="form" :rules="formRules" :label-width="120">
|
|
|
|
|
<FormItem label="实际维护日期" prop="actual_date">
|
|
|
|
|
<DatePicker v-model="form.actual_date" type="date" placeholder="请选择实际维护日期" style="width: 100%" />
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="维护备注" prop="notes">
|
|
|
|
|
<Input v-model="form.notes" type="textarea" :rows="4" placeholder="请输入维护备注" />
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="上传图片" prop="photos">
|
|
|
|
|
<Upload
|
|
|
|
|
ref="upload"
|
|
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
|
|
:on-success="handleUploadSuccess"
|
|
|
|
|
:on-error="handleUploadError"
|
|
|
|
|
:on-remove="handleRemove"
|
|
|
|
|
:max-size="2048"
|
|
|
|
|
multiple
|
|
|
|
|
type="drag"
|
|
|
|
|
:action="baseUrl + 'api/admin/upload-file'"
|
|
|
|
|
>
|
|
|
|
|
<div style="padding: 20px 0">
|
|
|
|
|
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff" />
|
|
|
|
|
<p>点击或拖拽文件到此处上传</p>
|
|
|
|
|
</div>
|
|
|
|
|
</Upload>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="签名" prop="signature">
|
|
|
|
|
<div class="signature-pad-wrapper">
|
|
|
|
|
<canvas ref="signaturePad" class="signature-canvas" />
|
|
|
|
|
<Button size="small" style="margin-top: 8px;" @click="clearSignature">清除签名</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</FormItem>
|
|
|
|
|
</Form>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<Button @click="closeModal">取消</Button>
|
|
|
|
|
<Button type="primary" @click="submitMaintenance">确认完成</Button>
|
|
|
|
|
<Modal
|
|
|
|
|
v-model="showModal"
|
|
|
|
|
title="完成维护"
|
|
|
|
|
width="600"
|
|
|
|
|
:mask-closable="false"
|
|
|
|
|
>
|
|
|
|
|
<Form ref="maintenanceForm" :model="form" :rules="formRules" :label-width="120">
|
|
|
|
|
<FormItem label="实际维护日期" prop="actual_date">
|
|
|
|
|
<DatePicker v-model="form.actual_date" type="date" placeholder="请选择实际维护日期" style="width: 100%" />
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="维护备注" prop="notes">
|
|
|
|
|
<Input v-model="form.notes" type="textarea" :rows="4" placeholder="请输入维护备注" />
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="上传图片" prop="photos">
|
|
|
|
|
<Upload
|
|
|
|
|
ref="upload"
|
|
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
|
|
:on-success="handleUploadSuccess"
|
|
|
|
|
:on-error="handleUploadError"
|
|
|
|
|
:on-remove="handleRemove"
|
|
|
|
|
:max-size="2048"
|
|
|
|
|
multiple
|
|
|
|
|
type="drag"
|
|
|
|
|
:action="baseUrl + 'api/admin/upload-file'"
|
|
|
|
|
>
|
|
|
|
|
<div style="padding: 20px 0">
|
|
|
|
|
<Icon type="ios-cloud-upload" size="52" style="color: #3399ff" />
|
|
|
|
|
<p>点击或拖拽文件到此处上传</p>
|
|
|
|
|
</div>
|
|
|
|
|
</Upload>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="签名" prop="signature">
|
|
|
|
|
<div class="signature-pad-wrapper">
|
|
|
|
|
<canvas ref="signaturePad" class="signature-canvas" />
|
|
|
|
|
<Button size="small" style="margin-top: 8px;" @click="clearSignature">清除签名</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</FormItem>
|
|
|
|
|
</Form>
|
|
|
|
|
<template slot="footer">
|
|
|
|
|
<Button @click="closeModal">取消</Button>
|
|
|
|
|
<Button type="primary" @click="submitMaintenance">确认完成</Button>
|
|
|
|
|
</template>
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
<!-- 查看详情 Modal -->
|
|
|
|
|
<div class="modal" :class="{ show: showViewModal }">
|
|
|
|
|
<div class="modal-dialog">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h3 class="modal-title">维护记录详情</h3>
|
|
|
|
|
<button class="close-button" @click="closeViewModal">×</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>记录编号:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.no }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>维护物资:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.stocks_item_name }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>计划维护日期:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.planned_maintenance_date }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>实际维护日期:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.maintenance_date || '-' }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>负责人:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.responsible_admin_name }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>状态:</label>
|
|
|
|
|
<div class="form-value">{{ getStatusText(currentRecord.status) }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>维护备注:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.maintenance_notes || '-' }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>维护照片:</label>
|
|
|
|
|
<div v-if="currentRecord.files && currentRecord.files.length" class="photo-gallery">
|
|
|
|
|
<img
|
|
|
|
|
v-for="(file, idx) in currentRecord.files"
|
|
|
|
|
:key="'file-' + idx"
|
|
|
|
|
:src="file.url"
|
|
|
|
|
class="photo-preview"
|
|
|
|
|
style="cursor:pointer;"
|
|
|
|
|
alt="维护图片"
|
|
|
|
|
@click="previewImage(file.url)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else class="form-value">-</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>签名照片:</label>
|
|
|
|
|
<div v-if="currentRecord.sign && currentRecord.sign.url" class="photo-gallery">
|
|
|
|
|
<img
|
|
|
|
|
:src="currentRecord.sign.url"
|
|
|
|
|
class="sign-preview"
|
|
|
|
|
style="cursor:pointer;"
|
|
|
|
|
alt="签名图片"
|
|
|
|
|
@click="previewImage(currentRecord.sign.url)"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else class="form-value">-</div>
|
|
|
|
|
</div>
|
|
|
|
|
<Modal
|
|
|
|
|
v-model="showViewModal"
|
|
|
|
|
title="维护记录详情"
|
|
|
|
|
width="900"
|
|
|
|
|
:mask-closable="true"
|
|
|
|
|
>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>记录编号:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.no }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>维护物资:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.stocks_item_name }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>计划维护日期:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.planned_maintenance_date }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>实际维护日期:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.maintenance_date || '-' }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>负责人:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.responsible_admin_name }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>状态:</label>
|
|
|
|
|
<div class="form-value">{{ getStatusText(currentRecord.status) }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>维护备注:</label>
|
|
|
|
|
<div class="form-value">{{ currentRecord.maintenance_notes || '-' }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>维护照片:</label>
|
|
|
|
|
<div v-if="currentRecord.files && currentRecord.files.length" class="photo-gallery">
|
|
|
|
|
<img
|
|
|
|
|
v-for="(file, idx) in currentRecord.files"
|
|
|
|
|
:key="'file-' + idx"
|
|
|
|
|
:src="file.url"
|
|
|
|
|
class="photo-preview"
|
|
|
|
|
style="cursor:pointer;"
|
|
|
|
|
alt="维护图片"
|
|
|
|
|
@click="previewImage(file.url)"
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer" style="justify-content: center;">
|
|
|
|
|
<Button @click="closeViewModal">关闭</Button>
|
|
|
|
|
<div v-else class="form-value">-</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>签名照片:</label>
|
|
|
|
|
<div v-if="currentRecord.sign && currentRecord.sign.url" class="photo-gallery">
|
|
|
|
|
<img
|
|
|
|
|
:src="currentRecord.sign.url"
|
|
|
|
|
class="sign-preview"
|
|
|
|
|
style="cursor:pointer;"
|
|
|
|
|
alt="签名图片"
|
|
|
|
|
@click="previewImage(currentRecord.sign.url)"
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else class="form-value">-</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<template slot="footer">
|
|
|
|
|
<Button @click="closeViewModal">关闭</Button>
|
|
|
|
|
</template>
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
<!-- 预览弹窗 -->
|
|
|
|
|
<div v-if="previewUrl" class="image-preview-modal" @click="closePreview">
|
|
|
|
|
<img :src="previewUrl" class="image-preview-large" />
|
|
|
|
|
<img :src="previewUrl" class="image-preview-large">
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- 新增维护记录 Modal -->
|
|
|
|
|
<Modal
|
|
|
|
|
v-model="showCreateModal"
|
|
|
|
|
title="新增维护记录"
|
|
|
|
|
width="500"
|
|
|
|
|
:mask-closable="false"
|
|
|
|
|
>
|
|
|
|
|
<Form ref="createForm" :model="createForm" :rules="createFormRules" :label-width="120">
|
|
|
|
|
<FormItem label="维护物资" prop="material_id">
|
|
|
|
|
<div class="material-select">
|
|
|
|
|
<Input v-model="createForm.material_name" readonly placeholder="请选择维护物资" style="width: calc(100% - 100px);" />
|
|
|
|
|
<input v-model="createForm.material_id" type="hidden">
|
|
|
|
|
<Button type="primary" style="margin-left: 8px;" @click="openMaterialModal">选择物资</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="计划维护日期" prop="planned_maintenance_date">
|
|
|
|
|
<DatePicker v-model="createForm.planned_maintenance_date" type="date" placeholder="请选择计划维护日期" style="width: 100%" />
|
|
|
|
|
</FormItem>
|
|
|
|
|
</Form>
|
|
|
|
|
<template slot="footer">
|
|
|
|
|
<Button @click="closeCreateModal">取消</Button>
|
|
|
|
|
<Button type="primary" @click="submitCreateMaintenance">确认创建</Button>
|
|
|
|
|
</template>
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
<!-- 关联物资 Modal -->
|
|
|
|
|
<Modal
|
|
|
|
|
v-model="showMaterialModal"
|
|
|
|
|
title="选择物资"
|
|
|
|
|
width="800"
|
|
|
|
|
:mask-closable="false"
|
|
|
|
|
append-to-body
|
|
|
|
|
class="material-modal-top"
|
|
|
|
|
>
|
|
|
|
|
<div class="associate-content">
|
|
|
|
|
<div class="associate-toolbar">
|
|
|
|
|
<Input v-model="materialSearch" placeholder="搜索物资名称..." style="width: 250px; margin-right: 10px;" clearable />
|
|
|
|
|
<Select v-model="select.storehouses_id" style="width: 120px; margin-right: 10px;" clearable placeholder="仓库类型" @on-change="getWarehouseNames">
|
|
|
|
|
<Option v-for="item in warehouseTypes" :key="item.id" :value="item.id">{{ item.name }}</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
<Select v-model="select.area" style="width: 120px; margin-right: 10px;" clearable placeholder="所在区域" @on-change="getWarehouseNames">
|
|
|
|
|
<Option v-for="item in warehouseAreas" :key="item.id" :value="item.value">{{ item.value }}</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
<Select v-model="materialWarehouseName" style="width: 120px; margin-right: 10px;" clearable placeholder="仓库名称">
|
|
|
|
|
<Option v-for="warehouse in warehouseNames" :key="warehouse.value" :value="warehouse.label">{{ warehouse.label }}</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
<Button type="primary" @click="searchMaterials">搜索</Button>
|
|
|
|
|
<Button style="margin-left: 8px;" @click="resetMaterialSearch">重置</Button>
|
|
|
|
|
</div>
|
|
|
|
|
<Table :columns="materialColumns" :data="materialList" :height="400" style="margin-top: 15px;">
|
|
|
|
|
<template slot="action" slot-scope="{ row }">
|
|
|
|
|
<div style="display: flex; gap: 8px; justify-content: center;">
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
size="small"
|
|
|
|
|
ghost
|
|
|
|
|
style="border-radius: 6px;"
|
|
|
|
|
@click="selectMaterial(row)"
|
|
|
|
|
>
|
|
|
|
|
选择
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</Table>
|
|
|
|
|
<div class="pagination-container">
|
|
|
|
|
<el-pagination
|
|
|
|
|
:current-page="materialPageIndex"
|
|
|
|
|
:page-sizes="[10, 20, 50, 100]"
|
|
|
|
|
:page-size="materialPageSize"
|
|
|
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
:total="materialTotal"
|
|
|
|
|
@size-change="handleMaterialPageSizeChange"
|
|
|
|
|
@current-change="handleMaterialPageChange"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Modal>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { Button, Select, Option, DatePicker, Input, Form, FormItem, Upload, Icon } from 'view-design'
|
|
|
|
|
import { Button, Select, Option, DatePicker, Input, Form, FormItem, Upload, Icon, Modal, Table } from 'view-design'
|
|
|
|
|
import { getOperationList, saveOperation, getOperationDetail } from '@/api/maintenance/maintenance'
|
|
|
|
|
import { getStorehouseTypeList } from '@/api/system/storehouseType'
|
|
|
|
|
import { getparameteritem } from '@/api/system/dictionary.js'
|
|
|
|
|
import { index } from '@/api/system/baseForm.js'
|
|
|
|
|
import request from '@/utils/request'
|
|
|
|
|
import qs from 'qs'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
@ -285,7 +365,9 @@ export default {
|
|
|
|
|
Form,
|
|
|
|
|
FormItem,
|
|
|
|
|
Upload,
|
|
|
|
|
Icon
|
|
|
|
|
Icon,
|
|
|
|
|
Modal,
|
|
|
|
|
Table
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
@ -307,12 +389,50 @@ export default {
|
|
|
|
|
list: [],
|
|
|
|
|
showModal: false,
|
|
|
|
|
showViewModal: false,
|
|
|
|
|
showCreateModal: false,
|
|
|
|
|
currentRecord: {},
|
|
|
|
|
form: {
|
|
|
|
|
actual_date: '',
|
|
|
|
|
notes: '',
|
|
|
|
|
photos: []
|
|
|
|
|
},
|
|
|
|
|
createForm: {
|
|
|
|
|
material_id: '',
|
|
|
|
|
material_name: '',
|
|
|
|
|
planned_maintenance_date: ''
|
|
|
|
|
},
|
|
|
|
|
createFormRules: {
|
|
|
|
|
material_id: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择维护物资',
|
|
|
|
|
trigger: 'change',
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
if (!value) {
|
|
|
|
|
callback(new Error('请选择维护物资'))
|
|
|
|
|
} else {
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
planned_maintenance_date: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择计划维护日期',
|
|
|
|
|
trigger: 'change',
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
if (!value) {
|
|
|
|
|
callback(new Error('请选择计划维护日期'))
|
|
|
|
|
} else {
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
materialOptions: [],
|
|
|
|
|
adminOptions: [],
|
|
|
|
|
formRules: {
|
|
|
|
|
actual_date: [
|
|
|
|
|
{
|
|
|
|
|
@ -363,7 +483,51 @@ export default {
|
|
|
|
|
currentUser: '张三',
|
|
|
|
|
total: 0,
|
|
|
|
|
tableHeight: 550,
|
|
|
|
|
previewUrl: ''
|
|
|
|
|
previewUrl: '',
|
|
|
|
|
showMaterialModal: false,
|
|
|
|
|
materialSearch: '',
|
|
|
|
|
materialWarehouseName: '',
|
|
|
|
|
materialPageSize: 10,
|
|
|
|
|
materialPageIndex: 1,
|
|
|
|
|
materialTotal: 0,
|
|
|
|
|
materialColumns: [
|
|
|
|
|
{
|
|
|
|
|
title: '物资名称',
|
|
|
|
|
key: 'zichanmingcheng',
|
|
|
|
|
minWidth: 120
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '物资代码',
|
|
|
|
|
key: 'wuzibianma',
|
|
|
|
|
minWidth: 120
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '物资型号',
|
|
|
|
|
key: 'guigexinghao',
|
|
|
|
|
minWidth: 120
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '仓库名称',
|
|
|
|
|
key: 'material_info',
|
|
|
|
|
minWidth: 120,
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
return h('span', params.row.material_info?.suozaicangku || '')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
slot: 'action',
|
|
|
|
|
width: 100,
|
|
|
|
|
fixed: 'right',
|
|
|
|
|
align: 'center',
|
|
|
|
|
headerAlign: 'center',
|
|
|
|
|
className: 'table-col-action'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
materialList: [],
|
|
|
|
|
warehouseTypes: [],
|
|
|
|
|
warehouseAreas: [],
|
|
|
|
|
warehouseNames: []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
@ -377,6 +541,9 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getList()
|
|
|
|
|
this.getWarehouseTypes()
|
|
|
|
|
this.getWarehouseAreas()
|
|
|
|
|
this.getWarehouseNames()
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.calcTableHeight()
|
|
|
|
|
@ -424,6 +591,17 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
this.getList()
|
|
|
|
|
},
|
|
|
|
|
createMaintenance() {
|
|
|
|
|
this.showCreateModal = true
|
|
|
|
|
},
|
|
|
|
|
closeCreateModal() {
|
|
|
|
|
this.showCreateModal = false
|
|
|
|
|
this.createForm = {
|
|
|
|
|
material_id: '',
|
|
|
|
|
material_name: '',
|
|
|
|
|
planned_maintenance_date: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
pageChange(e) {
|
|
|
|
|
this.select.page = e
|
|
|
|
|
this.getList()
|
|
|
|
|
@ -461,7 +639,7 @@ export default {
|
|
|
|
|
// 2. 预处理二级字段为一级
|
|
|
|
|
this.currentRecord = {
|
|
|
|
|
...detail,
|
|
|
|
|
stocks_item_name: detail.stocks_item?.zichanmingcheng || '-',
|
|
|
|
|
stocks_item_name: detail.material_info?.zichanmingcheng || '-',
|
|
|
|
|
responsible_admin_name: detail.responsible_admin?.name || '-'
|
|
|
|
|
}
|
|
|
|
|
// 3. 打开查看窗口
|
|
|
|
|
@ -500,8 +678,9 @@ export default {
|
|
|
|
|
// 假设 response.id 是图片id,response.url 是图片地址
|
|
|
|
|
this.form.photos.push({ id: response.id, url: response.url })
|
|
|
|
|
},
|
|
|
|
|
handleUploadError(error, file) {
|
|
|
|
|
handleUploadError(err, file) {
|
|
|
|
|
// 处理上传错误后的逻辑
|
|
|
|
|
console.error('上传图片失败:', err)
|
|
|
|
|
this.$message.error('上传图片失败')
|
|
|
|
|
},
|
|
|
|
|
handleRemove(file) {
|
|
|
|
|
@ -658,12 +837,160 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
closePreview() {
|
|
|
|
|
this.previewUrl = ''
|
|
|
|
|
},
|
|
|
|
|
async submitCreateMaintenance() {
|
|
|
|
|
try {
|
|
|
|
|
const valid = await this.$refs.createForm.validate()
|
|
|
|
|
if (!valid) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const data = {
|
|
|
|
|
material_info_id: this.createForm.material_id,
|
|
|
|
|
planned_maintenance_date: this.formatDate(this.createForm.planned_maintenance_date)
|
|
|
|
|
}
|
|
|
|
|
const res = await saveOperation(data)
|
|
|
|
|
if (res) {
|
|
|
|
|
this.$Message.success('创建成功')
|
|
|
|
|
this.closeCreateModal()
|
|
|
|
|
this.getList()
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.$Message.error('创建失败:' + (error.message || '未知错误'))
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
openMaterialModal() {
|
|
|
|
|
this.showMaterialModal = true
|
|
|
|
|
this.searchMaterials()
|
|
|
|
|
},
|
|
|
|
|
async searchMaterials() {
|
|
|
|
|
try {
|
|
|
|
|
const data = {
|
|
|
|
|
page_size: this.materialPageSize,
|
|
|
|
|
page: this.materialPageIndex,
|
|
|
|
|
'show_relation[0]': 'equipmentMaintainConfig',
|
|
|
|
|
'show_relation[1]': 'materialInfo.materialstorage',
|
|
|
|
|
|
|
|
|
|
'materialstorages_cangkumingcheng': this.materialWarehouseName ? this.materialWarehouseName : '',
|
|
|
|
|
'materialstorages_suozaiquyu': this.select.area ? this.select.area : '',
|
|
|
|
|
'storehouses_id': this.select.storehouses_id ? this.select.storehouses_id : '',
|
|
|
|
|
|
|
|
|
|
'filter[0][key]': 'zichanmingcheng',
|
|
|
|
|
'filter[0][op]': 'like',
|
|
|
|
|
'filter[0][value]': this.materialSearch ? this.materialSearch : '',
|
|
|
|
|
|
|
|
|
|
'filter[1][key]': 'wuzileixing',
|
|
|
|
|
'filter[1][op]': 'eq',
|
|
|
|
|
'filter[1][value]': '一物一码'
|
|
|
|
|
}
|
|
|
|
|
const res = await request({
|
|
|
|
|
url: '/api/admin/material-infos/index',
|
|
|
|
|
method: 'post',
|
|
|
|
|
data: qs.stringify(data),
|
|
|
|
|
headers: {
|
|
|
|
|
'Content-Type': 'application/x-www-form-urlencoded'
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (res && res.data) {
|
|
|
|
|
this.materialList = res.data.map(material => ({
|
|
|
|
|
...material,
|
|
|
|
|
selected: false
|
|
|
|
|
}))
|
|
|
|
|
this.materialTotal = res.total
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取物资列表失败:', e)
|
|
|
|
|
this.$Message.error('获取物资列表失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
selectMaterial(row) {
|
|
|
|
|
this.createForm.material_id = row.id
|
|
|
|
|
this.createForm.material_name = row.zichanmingcheng
|
|
|
|
|
this.showMaterialModal = false
|
|
|
|
|
},
|
|
|
|
|
handleMaterialSubmit() {
|
|
|
|
|
this.showMaterialModal = false
|
|
|
|
|
},
|
|
|
|
|
handleMaterialCancel() {
|
|
|
|
|
this.showMaterialModal = false
|
|
|
|
|
},
|
|
|
|
|
handleMaterialPageChange(page) {
|
|
|
|
|
this.materialPageIndex = page
|
|
|
|
|
this.searchMaterials()
|
|
|
|
|
},
|
|
|
|
|
handleMaterialPageSizeChange(size) {
|
|
|
|
|
this.materialPageSize = size
|
|
|
|
|
this.materialPageIndex = 1
|
|
|
|
|
this.searchMaterials()
|
|
|
|
|
},
|
|
|
|
|
resetMaterialSearch() {
|
|
|
|
|
this.materialSearch = ''
|
|
|
|
|
this.select.storehouses_id = ''
|
|
|
|
|
this.select.area = ''
|
|
|
|
|
this.materialWarehouseName = ''
|
|
|
|
|
this.materialPageIndex = 1
|
|
|
|
|
this.searchMaterials()
|
|
|
|
|
},
|
|
|
|
|
async getWarehouseTypes() {
|
|
|
|
|
try {
|
|
|
|
|
const res = await getStorehouseTypeList({
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 999
|
|
|
|
|
})
|
|
|
|
|
if (res && res.data) {
|
|
|
|
|
this.warehouseTypes = res.data
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取仓库类型列表失败:', e)
|
|
|
|
|
this.$Message.error('获取仓库类型列表失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async getWarehouseAreas() {
|
|
|
|
|
try {
|
|
|
|
|
const res = await getparameteritem('area')
|
|
|
|
|
if (res && res.detail) {
|
|
|
|
|
this.warehouseAreas = res.detail
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取仓库区域列表失败:', e)
|
|
|
|
|
this.$Message.error('获取仓库区域列表失败')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async getWarehouseNames() {
|
|
|
|
|
try {
|
|
|
|
|
const res = await index({
|
|
|
|
|
page_size: this.select.page_size,
|
|
|
|
|
page: this.select.page,
|
|
|
|
|
table_name: 'materialstorages',
|
|
|
|
|
filter: [{
|
|
|
|
|
key: 'cangkumingcheng',
|
|
|
|
|
op: 'like',
|
|
|
|
|
value: this.select.keyword ? this.select.keyword : ''
|
|
|
|
|
}, {
|
|
|
|
|
key: 'quyu_id',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: this.select.area ? this.select.area : ''
|
|
|
|
|
}, {
|
|
|
|
|
key: 'storehouses_id',
|
|
|
|
|
op: 'eq',
|
|
|
|
|
value: this.select.storehouses_id ? this.select.storehouses_id : ''
|
|
|
|
|
}]
|
|
|
|
|
})
|
|
|
|
|
if (res && res.data) {
|
|
|
|
|
this.warehouseNames = res.data.map(warehouse => ({
|
|
|
|
|
value: warehouse.id,
|
|
|
|
|
label: warehouse.cangkumingcheng
|
|
|
|
|
}))
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('获取仓库名称列表失败:', e)
|
|
|
|
|
this.$Message.error('获取仓库名称列表失败')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.table-page-container {
|
|
|
|
|
padding: 20px;
|
|
|
|
|
background-color: #f0f2f5;
|
|
|
|
|
@ -873,12 +1200,10 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-body {
|
|
|
|
|
background: #fcfcfd;
|
|
|
|
|
padding: 20px 15px 15px 15px;
|
|
|
|
|
border-radius: 0 0 12px 12px;
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
|
gap: 16px 32px;
|
|
|
|
|
padding: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form-group {
|
|
|
|
|
@ -900,95 +1225,45 @@ export default {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form-group input[type="date"],
|
|
|
|
|
.form-group textarea,
|
|
|
|
|
.form-group input[type="file"] {
|
|
|
|
|
display: block;
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding: 5px 7.5px;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
.form-value {
|
|
|
|
|
color: #333;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
color: #495057;
|
|
|
|
|
background-color: #fff !important;
|
|
|
|
|
background-clip: padding-box;
|
|
|
|
|
border: 1px solid #ced4da;
|
|
|
|
|
border-radius: 0.25rem;
|
|
|
|
|
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form-group textarea {
|
|
|
|
|
resize: vertical;
|
|
|
|
|
word-break: break-word;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form-group input[type="file"] {
|
|
|
|
|
padding: 3px 7.5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form-text {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
color: #6c757d;
|
|
|
|
|
.photo-gallery {
|
|
|
|
|
display: grid;
|
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
|
|
|
gap: 8px;
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.signature-area {
|
|
|
|
|
width: 100%;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
}
|
|
|
|
|
.signature-pad-wrapper {
|
|
|
|
|
width: 100%;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
}
|
|
|
|
|
.signature-canvas {
|
|
|
|
|
border: 1px dashed #ced4da;
|
|
|
|
|
background: #fff;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
.photo-preview {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 120px;
|
|
|
|
|
cursor: crosshair;
|
|
|
|
|
display: block;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
margin: 0;
|
|
|
|
|
padding: 0;
|
|
|
|
|
min-width: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.form-value {
|
|
|
|
|
color: #222;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
background: transparent;
|
|
|
|
|
border: none;
|
|
|
|
|
min-height: 32px;
|
|
|
|
|
padding: 0;
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
border: 1px solid #eaeaea;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: transform 0.2s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.photo-gallery {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
background: #f8f9fa;
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
padding: 8px;
|
|
|
|
|
margin-top: 4px;
|
|
|
|
|
.photo-preview:hover {
|
|
|
|
|
transform: scale(1.05);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.photo-preview {
|
|
|
|
|
width: 64px;
|
|
|
|
|
height: 64px;
|
|
|
|
|
object-fit: cover;
|
|
|
|
|
.sign-preview {
|
|
|
|
|
max-width: 200px;
|
|
|
|
|
margin-top: 8px;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
border: 1.5px solid #eaeaea;
|
|
|
|
|
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: transform 0.15s;
|
|
|
|
|
border: 1px solid #eaeaea;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.photo-preview:hover {
|
|
|
|
|
transform: scale(1.08);
|
|
|
|
|
box-shadow: 0 4px 16px rgba(0,0,0,0.13);
|
|
|
|
|
@media (max-width: 900px) {
|
|
|
|
|
.modal-body {
|
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pagination-container {
|
|
|
|
|
@ -1040,28 +1315,6 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media (max-width: 900px) {
|
|
|
|
|
.modal-dialog {
|
|
|
|
|
max-width: 98vw;
|
|
|
|
|
}
|
|
|
|
|
.modal-body {
|
|
|
|
|
padding: 10px 5px;
|
|
|
|
|
grid-template-columns: 1fr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.modal-footer {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
padding: 7.5px;
|
|
|
|
|
border-top: 1px solid #dee2e6;
|
|
|
|
|
border-bottom-right-radius: 12px;
|
|
|
|
|
border-bottom-left-radius: 12px;
|
|
|
|
|
gap: 0.5rem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.image-preview-modal {
|
|
|
|
|
position: fixed;
|
|
|
|
|
z-index: 2000;
|
|
|
|
|
@ -1079,19 +1332,6 @@ export default {
|
|
|
|
|
background: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.sign-preview {
|
|
|
|
|
width: 100%;
|
|
|
|
|
max-width: 100%;
|
|
|
|
|
height: auto;
|
|
|
|
|
object-fit: contain;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
border: 1.5px solid #eaeaea;
|
|
|
|
|
box-shadow: 0 1px 4px rgba(0,0,0,0.06);
|
|
|
|
|
margin-top: 4px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
background: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 分割线 */
|
|
|
|
|
hr {
|
|
|
|
|
border: none;
|
|
|
|
|
@ -1127,4 +1367,49 @@ hr {
|
|
|
|
|
border-top: 1.5px solid #e0e3e8;
|
|
|
|
|
margin: 16px 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.material-select {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
.associate-content {
|
|
|
|
|
padding: 16px;
|
|
|
|
|
}
|
|
|
|
|
.associate-toolbar {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
flex-wrap: wrap;
|
|
|
|
|
gap: 8px;
|
|
|
|
|
margin-bottom: 16px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.material-modal-top .ivu-modal) {
|
|
|
|
|
z-index: 9999 !important;
|
|
|
|
|
}
|
|
|
|
|
:deep(.material-modal-top .ivu-modal-mask) {
|
|
|
|
|
z-index: 9998 !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.ivu-modal-body) {
|
|
|
|
|
padding: 20px;
|
|
|
|
|
max-height: 70vh;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.ivu-modal-header) {
|
|
|
|
|
padding: 16px;
|
|
|
|
|
border-bottom: 1px solid #eaeaea;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.ivu-modal-header-inner) {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: #222;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
:deep(.ivu-modal-footer) {
|
|
|
|
|
padding: 16px;
|
|
|
|
|
border-top: 1px solid #eaeaea;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|