|
|
@@ -8,29 +8,34 @@
|
|
|
v-show="showSearch"
|
|
|
label-width="100px"
|
|
|
>
|
|
|
- <el-form-item label="计划名称" prop="materialsCode">
|
|
|
+ <el-form-item label="计划名称" prop="planName">
|
|
|
<el-input
|
|
|
- v-model="queryParams.materialsCode"
|
|
|
+ v-model="queryParams.planName"
|
|
|
placeholder="请输入计划名称"
|
|
|
clearable
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="岗位" prop="workstationId">
|
|
|
- <treeselect
|
|
|
- style="width: 218px"
|
|
|
- v-model="queryParams.workstationId"
|
|
|
- :options="marsOptions"
|
|
|
- :normalizer="normalizer"
|
|
|
- placeholder="选择岗位"
|
|
|
- />
|
|
|
+ <el-form-item label="物资柜" prop="cabinetId">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.cabinetId"
|
|
|
+ placeholder="请选择需要检查的物资柜"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="dict in cabinets"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <!-- <el-form-item label="计划日期">
|
|
|
+ <el-form-item label="计划日期">
|
|
|
<el-date-picker
|
|
|
style="width: 300px"
|
|
|
:default-time="['00:00:00', '23:59:59']"
|
|
|
- v-model="restitutionTime"
|
|
|
+ v-model="createTime"
|
|
|
type="datetimerange"
|
|
|
:picker-options="pickerOptions"
|
|
|
range-separator="-"
|
|
|
@@ -39,10 +44,10 @@
|
|
|
align="right"
|
|
|
>
|
|
|
</el-date-picker>
|
|
|
- </el-form-item> -->
|
|
|
- <el-form-item label="检察员" prop="materialsName">
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="检察员" prop="checkUserName">
|
|
|
<el-input
|
|
|
- v-model="queryParams.materialsName"
|
|
|
+ v-model="queryParams.checkUserName"
|
|
|
placeholder="请输入检察员"
|
|
|
clearable
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
@@ -66,14 +71,14 @@
|
|
|
icon="el-icon-search"
|
|
|
size="mini"
|
|
|
@click="handleQuery"
|
|
|
- >搜索
|
|
|
+ >搜索
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
v-no-more-click
|
|
|
icon="el-icon-refresh"
|
|
|
size="mini"
|
|
|
@click="resetQuery"
|
|
|
- >重置
|
|
|
+ >重置
|
|
|
</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
@@ -88,10 +93,10 @@
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
v-hasPermi="['iscs:plan:add']"
|
|
|
- >新增
|
|
|
+ >新增
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
- <!-- <el-col :span="1.5">
|
|
|
+ <el-col :span="1.5">
|
|
|
<el-button
|
|
|
v-no-more-click
|
|
|
type="danger"
|
|
|
@@ -103,7 +108,7 @@
|
|
|
v-hasPermi="['iscs:plan:remove']"
|
|
|
>批量删除
|
|
|
</el-button>
|
|
|
- </el-col> -->
|
|
|
+ </el-col>
|
|
|
<right-toolbar
|
|
|
:showSearch.sync="showSearch"
|
|
|
@queryTable="getList"
|
|
|
@@ -112,30 +117,29 @@
|
|
|
|
|
|
<el-table
|
|
|
v-loading="loading"
|
|
|
- :data="materialsList"
|
|
|
+ :data="PlanList"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
>
|
|
|
<!-- <el-table-column type="selection" width="55" align="center" /> -->
|
|
|
- <el-table-column label="计划编号" align="center" prop="checkId">
|
|
|
+ <el-table-column label="计划编号" align="center" prop="planId">
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="计划名称" align="center" prop="checkName">
|
|
|
+ <el-table-column label="计划名称" align="center" prop="planName">
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="检查物资柜" align="center" prop="workstationId">
|
|
|
+ <el-table-column label="巡检物资柜" align="center" prop="cabinetName">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tooltip :content="scope.row.cabinetName" placement="top">
|
|
|
+ <span>{{ getDisplayText(scope.row.cabinetName) }}</span>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
- <!-- <el-table-column label="巡检物资柜" align="center" prop="cabinetIdStr">-->
|
|
|
- <!-- <template slot-scope="scope">-->
|
|
|
- <!-- <el-tag type="danger">{{ getCabinetName(scope.row.cabinetIdStr) }}</el-tag>-->
|
|
|
- <!-- </template>-->
|
|
|
- <!-- </el-table-column>-->
|
|
|
- <el-table-column label="计划日期" align="center" prop="cron">
|
|
|
+ <el-table-column label="计划日期" align="center" prop="planDate">
|
|
|
<template slot-scope="scope">
|
|
|
- {{ cronDescription(scope.row.cron) }}
|
|
|
+ {{ scope.row.planDate }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="检察员" align="center" prop="userIdStr">
|
|
|
+ <el-table-column label="检察员" align="center" prop="checkUserName">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-tag>{{ getUserName(scope.row.userIdStr) }}</el-tag>
|
|
|
+ {{ scope.row.checkUserName }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="状态" align="center" prop="status">
|
|
|
@@ -164,17 +168,9 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['iscs:plan:query']"
|
|
|
- >编辑
|
|
|
+ >编辑
|
|
|
</el-button>
|
|
|
- <!-- <el-button
|
|
|
- v-no-more-click
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleResult(scope.row)"
|
|
|
- v-hasPermi="['iscs:task:result']"
|
|
|
- >结果记录
|
|
|
- </el-button> -->
|
|
|
+
|
|
|
<el-button
|
|
|
v-no-more-click
|
|
|
size="mini"
|
|
|
@@ -182,7 +178,7 @@
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
v-hasPermi="['iscs:plan:remove']"
|
|
|
- >删除
|
|
|
+ >删除
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -190,7 +186,7 @@
|
|
|
<pagination
|
|
|
v-show="total > 0"
|
|
|
:total="total"
|
|
|
- :page.sync="queryParams.pages"
|
|
|
+ :page.sync="queryParams.current"
|
|
|
:limit.sync="queryParams.size"
|
|
|
@pagination="getList"
|
|
|
/>
|
|
|
@@ -201,13 +197,28 @@
|
|
|
<span class="title">{{ title }}</span>
|
|
|
</div>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
|
|
|
- <el-form-item label="任务名称" prop="checkName">
|
|
|
- <el-input v-model="form.checkName" placeholder="请输入任务名称" />
|
|
|
+ <el-form-item label="计划名称" prop="planName">
|
|
|
+ <el-input v-model="form.planName" placeholder="请输入计划名称"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="计划日期">
|
|
|
+ <el-date-picker
|
|
|
+ style="width: 350px"
|
|
|
+ v-model="form.planDate"
|
|
|
+ placeholder="请选择日期"
|
|
|
+ :picker-options="pickerOptions"
|
|
|
+ align="right"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属岗位" prop="workstationId">
|
|
|
+ <treeselect style="width: 348px" v-model="form.workstationId" :options="workstationOption"
|
|
|
+ :normalizer="normalizer" placeholder="选择岗位"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="检查物资柜" prop="cabinetIdStr">
|
|
|
+ <el-form-item label="检查物资柜" prop="cabinetIds">
|
|
|
<el-select
|
|
|
style="width: 348px"
|
|
|
- v-model="form.cabinetIdStr"
|
|
|
+ v-model="form.cabinetIds"
|
|
|
placeholder="请选择需要检查的物资柜"
|
|
|
multiple
|
|
|
clearable
|
|
|
@@ -220,12 +231,11 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="检查人员" prop="userIdStr">
|
|
|
+ <el-form-item label="检察员" prop="checkUserId">
|
|
|
<el-select
|
|
|
style="width: 348px"
|
|
|
- v-model="form.userIdStr"
|
|
|
- placeholder="请选择检查人员"
|
|
|
- multiple
|
|
|
+ v-model="form.checkUserId"
|
|
|
+ placeholder="请选择检察员"
|
|
|
clearable
|
|
|
>
|
|
|
<el-option
|
|
|
@@ -236,95 +246,41 @@
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="检查时间频率" prop="cron">
|
|
|
- <el-input v-model="form.cron" placeholder="请点击生成表达式">
|
|
|
- {{ form.co }}
|
|
|
- <template slot="append">
|
|
|
- <el-button v-no-more-click type="primary" @click="handleShowCron">
|
|
|
- 生成表达式
|
|
|
- <i class="el-icon-time el-icon--right"></i>
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
+
|
|
|
</el-form>
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button v-no-more-click type="primary" @click="submitForm"
|
|
|
- >确 定
|
|
|
+ >确 定
|
|
|
</el-button>
|
|
|
<el-button v-no-more-click @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
- <!-- 检查日期表达式工具-->
|
|
|
- <el-dialog
|
|
|
- title="Cron表达式生成器"
|
|
|
- :visible.sync="openCron"
|
|
|
- append-to-body
|
|
|
- destroy-on-close
|
|
|
- class="scrollbar"
|
|
|
- >
|
|
|
- <crontab
|
|
|
- @hide="openCron = false"
|
|
|
- @fill="crontabFill"
|
|
|
- :expression="expression"
|
|
|
- ></crontab>
|
|
|
- </el-dialog>
|
|
|
- <!-- 检查结果-->
|
|
|
- <el-dialog title="检查结果记录" :visible.sync="ResultVisible" width="50%">
|
|
|
- <div class="info-bar">
|
|
|
- <p>检查计划名称:{{ planName }}</p>
|
|
|
- <p>物资柜编号:{{ cabinetId }}</p>
|
|
|
- <p>检查时间:{{ inspectionDate }}</p>
|
|
|
- <p>巡检人:{{ inspector }}</p>
|
|
|
- </div>
|
|
|
- <el-table :data="items" border>
|
|
|
- <el-table-column prop="name" label="物资名称" width="200" />
|
|
|
- <el-table-column prop="id" label="物资编号" width="150" />
|
|
|
- <el-table-column label="物资状态" width="200">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-select v-model="scope.row.status" placeholder="请选择">
|
|
|
- <el-option label="正常" value="正常" />
|
|
|
- <el-option label="破损" value="破损" />
|
|
|
- <el-option label="丢失" value="丢失" />
|
|
|
- <el-option label="过期" value="过期" />
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="备注">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input v-model="scope.row.comment" placeholder="备注信息" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogVisible = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="saveResults">保存</el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getPlanPerson, getIsCheckTaskCabinets } from "@/api/mes/material/plan";
|
|
|
+
|
|
|
import {
|
|
|
- getPlanList,
|
|
|
+ listPlan,
|
|
|
addPlan,
|
|
|
deletePlan,
|
|
|
updatePlan,
|
|
|
- getPlanDetail,
|
|
|
-} from "@/api/mes/material/checkPlan";
|
|
|
-import { genCode } from "@/api/system/autocode/rule";
|
|
|
-import Crontab from "@/components/Crontab/index.vue";
|
|
|
-import cronstrue from "cronstrue/i18n";
|
|
|
-import Treeselect from "@riophae/vue-treeselect";
|
|
|
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
-import { listMarsDept } from "@/api/system/marsdept";
|
|
|
+ selectPlanById
|
|
|
+} from '@/api/mes/material/plan'
|
|
|
+import Crontab from '@/components/Crontab/index.vue'
|
|
|
+import Treeselect from '@riophae/vue-treeselect'
|
|
|
+import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
|
|
+import { listMarsDept } from '@/api/system/marsdept'
|
|
|
+import { getIsMaterialsCabinets } from '@/api/mes/material/information'
|
|
|
+import { listUser } from '@/api/system/user'
|
|
|
|
|
|
export default {
|
|
|
- name: "Team",
|
|
|
+ name: 'Team',
|
|
|
components: { Treeselect, Crontab },
|
|
|
- dicts: ["material_status", "checking_status"],
|
|
|
+ dicts: ['material_status', 'checking_status'],
|
|
|
data() {
|
|
|
return {
|
|
|
//自动生成编码
|
|
|
@@ -344,325 +300,280 @@ export default {
|
|
|
// 总条数
|
|
|
total: 0,
|
|
|
// 班组表格数据
|
|
|
- materialsList: [],
|
|
|
- // mars树选项
|
|
|
- marsOptions: [],
|
|
|
+ PlanList: [],
|
|
|
// 弹出层标题
|
|
|
- title: "",
|
|
|
+ title: '',
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
- // 是否显示Cron表达式弹出层
|
|
|
- openCron: false,
|
|
|
- // 传入的表达式
|
|
|
- expression: "",
|
|
|
// 查询参数
|
|
|
- createTime: "",
|
|
|
+ createTime: '',
|
|
|
queryParams: {
|
|
|
current: 1,
|
|
|
size: 10,
|
|
|
- // materialsCode: null,
|
|
|
- // materialsName: null,
|
|
|
- // loanState: null,
|
|
|
- // materialsCabinetId: null,
|
|
|
- // materialsTypeId: null,
|
|
|
- // startTime: "",
|
|
|
- // endTime: "",
|
|
|
+ checkUserName:'',
|
|
|
+ planName:'',
|
|
|
+ cabinetId:'',
|
|
|
+ startTime:null,
|
|
|
+ endTime:null,
|
|
|
},
|
|
|
-
|
|
|
- // 查询参数
|
|
|
- queryParamsCabinets: {
|
|
|
- current: 1,
|
|
|
- size: -1,
|
|
|
- },
|
|
|
-
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
-
|
|
|
cabinets: [], //物资所属柜
|
|
|
planPersonOption: [], // 检查人员
|
|
|
+ workstationOption: [],//所属岗位
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
userIdStr: [
|
|
|
- { required: true, message: "人员不能为空", trigger: "blur" },
|
|
|
+ { required: true, message: '人员不能为空', trigger: 'blur' }
|
|
|
],
|
|
|
checkName: [
|
|
|
- { required: true, message: "任务名称不能为空", trigger: "blur" },
|
|
|
- ],
|
|
|
- cron: [
|
|
|
- { required: true, message: "检查时间频率不能为空", trigger: "blur" },
|
|
|
- ],
|
|
|
+ { required: true, message: '任务名称不能为空', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+
|
|
|
},
|
|
|
- ResultVisible: false, //检查结果弹窗标志
|
|
|
- planName: "每月物资检查计划",
|
|
|
- cabinetId: "柜子001",
|
|
|
- inspectionDate: "2024-12-15",
|
|
|
- inspector: "张三",
|
|
|
- items: [
|
|
|
- { name: "安全帽", id: "A001", status: "正常", comment: "" },
|
|
|
- { name: "消防器材", id: "B002", status: "正常", comment: "" },
|
|
|
- ],
|
|
|
pickerOptions: {
|
|
|
shortcuts: [
|
|
|
{
|
|
|
- text: "最近一周",
|
|
|
+ text: '最近一周',
|
|
|
onClick(picker) {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|
|
- picker.$emit("pick", [start, end]);
|
|
|
- },
|
|
|
+ const end = new Date()
|
|
|
+ const start = new Date()
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
|
|
+ picker.$emit('pick', [start, end])
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
- text: "最近一个月",
|
|
|
+ text: '最近一个月',
|
|
|
onClick(picker) {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
|
|
- picker.$emit("pick", [start, end]);
|
|
|
- },
|
|
|
+ const end = new Date()
|
|
|
+ const start = new Date()
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
|
|
+ picker.$emit('pick', [start, end])
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
- text: "最近三个月",
|
|
|
+ text: '最近三个月',
|
|
|
onClick(picker) {
|
|
|
- const end = new Date();
|
|
|
- const start = new Date();
|
|
|
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
|
|
- picker.$emit("pick", [start, end]);
|
|
|
- },
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- };
|
|
|
+ const end = new Date()
|
|
|
+ const start = new Date()
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
|
|
+ picker.$emit('pick', [start, end])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ 'form.workstationId':function(newVal, oldVal) {
|
|
|
+ if (newVal) {
|
|
|
+ console.log(newVal,'gangwei ')
|
|
|
+ const data = {
|
|
|
+ current: 1,
|
|
|
+ size: -1,
|
|
|
+ workstationId: newVal,
|
|
|
+ }
|
|
|
+ getIsMaterialsCabinets(data).then((response) => {
|
|
|
+ console.log(response,'wgahah')
|
|
|
+ if (response?.data?.records) {
|
|
|
+ this.cabinets = response.data.records.map((item) => ({
|
|
|
+ value: item.cabinetId,
|
|
|
+ label: item.cabinetName
|
|
|
+ }))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
- this.getList();
|
|
|
- this.materialsCabinets();
|
|
|
+ this.getList()
|
|
|
+ this.getOtherList()
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
- cronDescription(cron) {
|
|
|
- return cronstrue.toString(cron, { locale: "zh_CN" });
|
|
|
+// 格式化日期查询数据
|
|
|
+ formatDate(date) {
|
|
|
+ const year = date.getFullYear().toString().padStart(2, "0");
|
|
|
+ const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
|
+ const day = date.getDate().toString().padStart(2, "0");
|
|
|
+ const hours = date.getHours().toString().padStart(2, "0");
|
|
|
+ const minutes = date.getMinutes().toString().padStart(2, "0");
|
|
|
+ const seconds = date.getSeconds().toString().padStart(2, "0");
|
|
|
+
|
|
|
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
|
},
|
|
|
/** 查询物资信息列表 */
|
|
|
getList() {
|
|
|
- this.loading = true;
|
|
|
+ this.loading = true
|
|
|
// 格式化日期并更新 queryParams
|
|
|
if (Array.isArray(this.createTime) && this.createTime.length === 2) {
|
|
|
- this.queryParams.startTime = this.formatDate(this.createTime[0]);
|
|
|
- this.queryParams.endTime = this.formatDate(this.createTime[1]);
|
|
|
+ this.queryParams.startTime = this.formatDate(this.createTime[0])
|
|
|
+ this.queryParams.endTime = this.formatDate(this.createTime[1])
|
|
|
}
|
|
|
- getPlanList(this.queryParams).then((response) => {
|
|
|
- console.log(response, "获取物资信息allList ");
|
|
|
- this.materialsList = response.data.records;
|
|
|
- this.total = response.data.total;
|
|
|
+ listPlan(this.queryParams).then((response) => {
|
|
|
+ console.log(response, '获取物资信息allList ')
|
|
|
+ this.PlanList = response.data.records
|
|
|
+ this.total = response.data.total
|
|
|
this.machinerytypeList = this.handleTree(
|
|
|
response.data.records,
|
|
|
- "materialsTypeId",
|
|
|
- "parentId",
|
|
|
- "children"
|
|
|
- );
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ 'materialsTypeId',
|
|
|
+ 'parentId',
|
|
|
+ 'children'
|
|
|
+ )
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
},
|
|
|
- // 物资所属柜
|
|
|
- materialsCabinets() {
|
|
|
- getIsCheckTaskCabinets(this.queryParamsCabinets).then((response) => {
|
|
|
+
|
|
|
+ getOtherList() {
|
|
|
+ const data = {
|
|
|
+ current: 1,
|
|
|
+ size: -1,
|
|
|
+ }
|
|
|
+ getIsMaterialsCabinets(data).then((response) => {
|
|
|
if (response?.data?.records) {
|
|
|
- // 提取 cabinetId 和 cabinetName
|
|
|
this.cabinets = response.data.records.map((item) => ({
|
|
|
value: item.cabinetId,
|
|
|
- label: item.cabinetName,
|
|
|
- }));
|
|
|
+ label: item.cabinetName
|
|
|
+ }))
|
|
|
}
|
|
|
- // 岗位查询
|
|
|
- const data1 = {
|
|
|
- pasge: 1,
|
|
|
- size: -1,
|
|
|
- };
|
|
|
- listMarsDept(data1).then((response) => {
|
|
|
- this.marsOptions = this.handleTree(
|
|
|
- response.data.records,
|
|
|
- "workstationId",
|
|
|
- "parentId"
|
|
|
- );
|
|
|
- });
|
|
|
- });
|
|
|
- // 巡检人员
|
|
|
- const data = {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 99999,
|
|
|
- };
|
|
|
- getPlanPerson(data).then((res) => {
|
|
|
- console.log(res, "巡检人员信息");
|
|
|
+ })
|
|
|
+ const data1 = {
|
|
|
+ pageSize: 999999999,
|
|
|
+ pageNum: 1
|
|
|
+ }
|
|
|
+ listUser(data1).then((res) => {
|
|
|
this.planPersonOption = res.rows.map((item) => {
|
|
|
return {
|
|
|
label: item.nickName,
|
|
|
- value: item.userId,
|
|
|
- };
|
|
|
- });
|
|
|
- });
|
|
|
+ value: item.userId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ listMarsDept(data).then(res => {
|
|
|
+ this.workstationOption = this.handleTree(res.data.records, 'workstationId', 'parentId')
|
|
|
+ })
|
|
|
},
|
|
|
normalizer(node) {
|
|
|
if (node.children && !node.children.length) {
|
|
|
- delete node.children;
|
|
|
+ delete node.children
|
|
|
}
|
|
|
return {
|
|
|
id: node.workstationId,
|
|
|
label: node.workstationName,
|
|
|
- children: node.children,
|
|
|
- };
|
|
|
+ children: node.children
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /* 物资柜信息转换展示 */
|
|
|
+ getDisplayText(cabinetName) {
|
|
|
+ const names = cabinetName.split(',');
|
|
|
+ if(names.length ==1) {
|
|
|
+ return `${names.length}个 (${names[0]})`;
|
|
|
+ }
|
|
|
+ if (names.length > 1) {
|
|
|
+ return `${names.length}个 (${names[0]}...)`;
|
|
|
+ }
|
|
|
+ return names[0];
|
|
|
+ },
|
|
|
+ goto(){
|
|
|
+
|
|
|
},
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
+ this.open = false
|
|
|
+ this.reset()
|
|
|
},
|
|
|
// 表单重置
|
|
|
reset() {
|
|
|
this.form = {
|
|
|
- cron: undefined,
|
|
|
- };
|
|
|
- this.resetForm("form");
|
|
|
- this.autoGenFlag = false;
|
|
|
+ planName:'',
|
|
|
+ cabinetIds:'',
|
|
|
+ workstationId:'',
|
|
|
+ checkUserName:'',
|
|
|
+ }
|
|
|
+ this.resetForm('form')
|
|
|
+ this.autoGenFlag = false
|
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
- this.queryParams.pages = 1;
|
|
|
- this.getList();
|
|
|
+ this.queryParams.current = 1
|
|
|
+ this.getList()
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
- this.resetForm("queryForm");
|
|
|
- this.handleQuery();
|
|
|
+ this.resetForm('queryForm')
|
|
|
+ this.queryParams.startTime = ''
|
|
|
+ this.queryParams.endTime = ''
|
|
|
+ this.createTime=''
|
|
|
+ this.handleQuery()
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map((item) => item.checkId);
|
|
|
- this.single = selection.length !== 1;
|
|
|
- this.multiple = !selection.length;
|
|
|
+ this.ids = selection.map((item) => item.planId)
|
|
|
+ this.single = selection.length !== 1
|
|
|
+ this.multiple = !selection.length
|
|
|
},
|
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
- this.reset();
|
|
|
- this.open = true;
|
|
|
- this.title = "新增检查计划";
|
|
|
- this.optType = "add";
|
|
|
+ this.reset()
|
|
|
+ this.open = true
|
|
|
+ this.form.workstationId=null
|
|
|
+ this.title = '新增检查计划'
|
|
|
+ this.optType = 'add'
|
|
|
},
|
|
|
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- getPlanDetail(row.checkId).then((response) => {
|
|
|
- this.form = response.data;
|
|
|
- this.form.userIdStr = response.data.userIdStr.split(",");
|
|
|
- this.form.cabinetIdStr = response.data.cabinetIdStr.split(",");
|
|
|
- this.open = true;
|
|
|
- this.title = "编辑检查计划";
|
|
|
- this.optType = "edit";
|
|
|
- });
|
|
|
+ this.reset()
|
|
|
+ selectPlanById(row.planId).then((response) => {
|
|
|
+ this.form = response.data
|
|
|
+ this.open = true
|
|
|
+ this.title = '编辑检查计划'
|
|
|
+ this.optType = 'edit'
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
- /** cron表达式按钮操作 */
|
|
|
- handleShowCron() {
|
|
|
- this.expression = this.form.cron;
|
|
|
- this.openCron = true;
|
|
|
- },
|
|
|
- /** 确定后回传值 */
|
|
|
- crontabFill(value) {
|
|
|
- this.form.cron = value;
|
|
|
- },
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate((valid) => {
|
|
|
+ this.$refs['form'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- if (this.form.checkId != null) {
|
|
|
- const data = {
|
|
|
- checkId: this.form.checkId,
|
|
|
- checkName: this.form.checkName,
|
|
|
- cabinetIdStr: this.form.cabinetIdStr.join(","),
|
|
|
- userIdStr: this.form.userIdStr.join(","),
|
|
|
- cron: this.form.cron,
|
|
|
- };
|
|
|
- updatePlan(data).then((response) => {
|
|
|
- console.log(response, "修改返回");
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
+ if (this.form.planId != null) {
|
|
|
+ updatePlan(this.form).then((response) => {
|
|
|
+ console.log(response, '修改返回')
|
|
|
+ this.$modal.msgSuccess('修改成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
} else {
|
|
|
- const data = {
|
|
|
- checkName: this.form.checkName,
|
|
|
- cabinetIdStr: this.form.cabinetIdStr.join(","),
|
|
|
- userIdStr: this.form.userIdStr.join(","),
|
|
|
- cron: this.form.cron,
|
|
|
- };
|
|
|
- // console.log(data,'新增的参数');
|
|
|
- addPlan(data).then((response) => {
|
|
|
- console.log(response, "新增返回");
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
+ addPlan(this.form).then((response) => {
|
|
|
+ console.log(response, '新增返回')
|
|
|
+ this.$modal.msgSuccess('新增成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
- const checkIds = row.checkId || this.ids;
|
|
|
+ const checkIds = row.planId || this.ids
|
|
|
|
|
|
this.$modal
|
|
|
.confirm('是否确认删除编号为"' + checkIds + '"的数据项?')
|
|
|
- .then(function () {
|
|
|
- return deletePlan(checkIds);
|
|
|
+ .then(function() {
|
|
|
+ return deletePlan(checkIds)
|
|
|
})
|
|
|
.then(() => {
|
|
|
- this.getList();
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
+ this.getList()
|
|
|
+ this.$modal.msgSuccess('删除成功')
|
|
|
})
|
|
|
- .catch(() => {});
|
|
|
- },
|
|
|
-
|
|
|
- // 检查结果 弹窗打开函数
|
|
|
- handleResult() {
|
|
|
- this.ResultVisible = true;
|
|
|
- },
|
|
|
-
|
|
|
- // 检查结果确认按钮
|
|
|
- saveResults() {
|
|
|
- // 提交检查结果逻辑
|
|
|
- console.log(this.items);
|
|
|
- this.dialogVisible = false;
|
|
|
- },
|
|
|
- // 表格转换用户名
|
|
|
- getUserName(userIdStr) {
|
|
|
- if (!userIdStr) return "";
|
|
|
- const userIds = userIdStr.split(",").map(Number);
|
|
|
- return userIds
|
|
|
- .map((userId) => {
|
|
|
- const user = this.planPersonOption.find(
|
|
|
- (option) => option.value == userId
|
|
|
- );
|
|
|
- return user ? user.label : "";
|
|
|
- })
|
|
|
- .join(", ");
|
|
|
- },
|
|
|
- // 表格转换物资柜子
|
|
|
- getCabinetName(cabinetIdStr) {
|
|
|
- if (!cabinetIdStr) return "";
|
|
|
- const cabinetIds = cabinetIdStr.split(",").map(Number);
|
|
|
- return cabinetIds
|
|
|
- .map((cabinetId) => {
|
|
|
- const cabinet = this.cabinets.find(
|
|
|
- (option) => option.value == cabinetId
|
|
|
- );
|
|
|
- return cabinet ? cabinet.label : "";
|
|
|
+ .catch(() => {
|
|
|
})
|
|
|
- .join(", ");
|
|
|
- },
|
|
|
- },
|
|
|
-};
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
<style lang="scss" src="@/assets/styles/dialog-title.scss" scoped>
|
|
|
.el-input-width {
|