From 9ec03d5c74d5ab3070561c8c576924ec42e1b464 Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期四, 25 八月 2022 18:39:07 +0800
Subject: [PATCH] bug
---
src/views/doublePrevent/riskLevel/riskCheckUnit/components/selectMeasureControlDialog.vue | 219 ++++++++++++++++++
src/views/doublePrevent/riskCheckManage/riskCheckUnit/components/checkUnitDialog.vue | 2
src/views/doublePrevent/riskLevel/riskCheckUnit/components/checkUnitDialog.vue | 260 +++++++++++++++++++++
src/views/doublePrevent/riskLevel/riskCheckUnit/index.vue | 194 ++++++++++++++++
4 files changed, 674 insertions(+), 1 deletions(-)
diff --git a/src/views/doublePrevent/riskCheckManage/riskCheckUnit/components/checkUnitDialog.vue b/src/views/doublePrevent/riskCheckManage/riskCheckUnit/components/checkUnitDialog.vue
index 0a8d4f0..81ab0c6 100644
--- a/src/views/doublePrevent/riskCheckManage/riskCheckUnit/components/checkUnitDialog.vue
+++ b/src/views/doublePrevent/riskCheckManage/riskCheckUnit/components/checkUnitDialog.vue
@@ -78,7 +78,7 @@
</template>
<script lang="ts">
-import SelectMeasureControlDialog from '/@/views/doublePrevent/riskLevel/riskCheckUnit/components/selectMeasureControlDialog.vue';
+import SelectMeasureControlDialog from './selectMeasureControlDialog.vue';
import { reactive, toRefs, ref } from 'vue';
import { checkUnitApi } from '/@/api/doublePreventSystem/checkUnit';
import { ElMessage } from 'element-plus';
diff --git a/src/views/doublePrevent/riskLevel/riskCheckUnit/components/checkUnitDialog.vue b/src/views/doublePrevent/riskLevel/riskCheckUnit/components/checkUnitDialog.vue
new file mode 100644
index 0000000..0a8d4f0
--- /dev/null
+++ b/src/views/doublePrevent/riskLevel/riskCheckUnit/components/checkUnitDialog.vue
@@ -0,0 +1,260 @@
+<template>
+ <div class="system-add-menu-container">
+ <el-dialog :title="title" v-model="isShowCheckUnitDialog" append-to-body :close-on-click-modal="false" width="50%">
+ <el-divider></el-divider>
+ <div class="checkUnit-form">
+ <el-form :model="checkUnitForm" :rules="checkUnitFormRules" ref="checkUnitFormRef" size="default" label-width="120px">
+ <el-row :gutter="35">
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12" class="mb20">
+ <el-form-item label="任务单元名称" prop="taskUnitName">
+ <el-input class="input-add" :disabled="!disabled" v-model.trim="checkUnitForm.taskUnitName" placeholder="请输入任务单元名称" clearable></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12" class="mb20">
+ <el-form-item label="任务单元说明" prop="note">
+ <el-input class="input-add" :disabled="!disabled" v-model.trim="checkUnitForm.note" placeholder="请输入任务单元说明" clearable></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12" class="mb20" v-show="personTime">
+ <el-form-item label="创建人" prop="location">
+ <el-input class="input-add" :disabled="!disabled" v-model.trim="checkUnitForm.createByUserName" placeholder="请输入区域位置"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12" class="mb20" v-show="personTime">
+ <el-form-item label="创建时间" prop="location">
+ <el-input class="input-add" :disabled="!disabled" v-model.trim="checkUnitForm.gmtCreate" placeholder="请输入区域位置"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12" class="mb20" v-show="personTime">
+ <el-form-item label="最后修改人" prop="location">
+ <el-input class="input-add" :disabled="!disabled" v-model.trim="checkUnitForm.lastEditUserName" placeholder="请输入区域位置"></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12" class="mb20" v-show="personTime">
+ <el-form-item label="最后修改时间" prop="location">
+ <el-input class="input-add" :disabled="!disabled" v-model.trim="checkUnitForm.gmtModitify" placeholder="请输入区域位置"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ </div>
+
+ <div class="checkUnit-point">
+ <el-tabs class="active" v-model="activeName">
+ <el-tab-pane label="检查项信息" name="checkUnit">
+ <div class="filter-container">
+ <el-button size="default" :disabled="!disabled" type="success" @click="onOpenDialogRef('新增', '')">
+ <el-icon>
+ <ele-FolderAdd />
+ </el-icon>
+ 选择风险管控措施
+ </el-button>
+ </div>
+
+ <el-table :data="measureData" border fit highlight-current-row style="width: 100%">
+ <el-table-column type="index" label="序号" width="60" />
+ <el-table-column prop="checkContent" label="管控内容" show-overflow-tooltip align="center"></el-table-column>
+ <el-table-column label="操作" width="150" align="center">
+ <template #default="scope">
+ <el-button size="small" text :disabled="!disabled" type="danger" @click="onDelCheckUnit(scope.$index, scope.row)">删除</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-tab-pane>
+ </el-tabs>
+ </div>
+
+ <template #footer>
+ <span class="dialog-footer" v-show="disabled">
+ <el-button @click="isShowCheckUnitDialog = !isShowCheckUnitDialog" size="default">取 消</el-button>
+ <el-button type="primary" @click="submitCheckUnit" v-throttle size="default">确 定</el-button>
+ </span>
+ </template>
+ </el-dialog>
+ <el-dialog title="选择风险管控措施" v-model="isShowSelectMeasureControlDialog" append-to-body :close-on-click-modal="false" width="70%">
+ <select-measure-control-dialog ref="SelectMeasureControlDialogRef" @receiveRiskControlId="receiveRiskControlId"></select-measure-control-dialog>
+ </el-dialog>
+ </div>
+</template>
+
+<script lang="ts">
+import SelectMeasureControlDialog from '/@/views/doublePrevent/riskLevel/riskCheckUnit/components/selectMeasureControlDialog.vue';
+import { reactive, toRefs, ref } from 'vue';
+import { checkUnitApi } from '/@/api/doublePreventSystem/checkUnit';
+import { ElMessage } from 'element-plus';
+interface stateType {
+ isShowCheckUnitDialog: Boolean;
+ disabled: Boolean;
+ personTime: Boolean;
+ isShowSelectMeasureControlDialog: Boolean;
+ checkUnitForm: {
+ taskUnitName: string | null;
+ note: string | null;
+ measureList: [];
+ };
+ title: string;
+ activeName: string;
+ measureData: [];
+ checkUnitData: [];
+ checkUnitFormRules: {};
+}
+
+export default {
+ name: 'checkUnitDialog',
+ components: { SelectMeasureControlDialog },
+ setup(props: any, context: any) {
+ const checkUnitFormRef = ref();
+ const riskControlMeasureDialogRef = ref();
+ const state = reactive<stateType>({
+ title: '',
+ disabled: false,
+ personTime: false,
+ activeName: 'checkUnit',
+ measureData: [],
+ checkUnitData: [],
+ isShowCheckUnitDialog: false,
+ isShowSelectMeasureControlDialog: false,
+ checkUnitForm: {
+ taskUnitName: null,
+ note: null,
+ measureList: []
+ },
+ checkUnitFormRules: {
+ taskUnitName: [{ required: true, message: '请填写任务单元名称', trigger: 'blur' }],
+ note: [{ required: true, message: '请填写任务单元说明', trigger: 'change' }]
+ }
+ });
+
+ //打开模态框
+ const openCheckUnitDialog = (type: string, value: object) => {
+ state.isShowCheckUnitDialog = true;
+ setTimeout(() => {
+ checkUnitFormRef.value.clearValidate();
+ });
+ if (type === '新增') {
+ state.disabled = true;
+ state.personTime = false;
+ state.title = '新增隐患排查单元';
+ state.measureData = [];
+ state.checkUnitForm = {
+ taskUnitName: null,
+ note: null,
+ measureList: []
+ };
+ } else if (type === '查看') {
+ state.disabled = false;
+ state.personTime = true;
+ state.title = '查看隐患排查单元';
+ state.checkUnitForm = JSON.parse(JSON.stringify(value));
+ state.measureData = state.checkUnitForm.measureList;
+ } else {
+ state.disabled = true;
+ state.personTime = false;
+ state.title = '修改隐患排查单元';
+ state.checkUnitForm = JSON.parse(JSON.stringify(value));
+ state.measureData = state.checkUnitForm.measureList;
+ }
+ };
+
+ const onOpenDialogRef = () => {
+ state.isShowSelectMeasureControlDialog = true;
+ };
+
+ const onDelCheckUnit = (value: number, scope: object) => {
+ state.measureData.splice(value, 1);
+ };
+
+ const receiveRiskControlId = (value: []) => {
+ state.isShowSelectMeasureControlDialog = false;
+ state.measureData = value;
+ state.checkUnitForm.measureList = JSON.parse(
+ JSON.stringify(
+ value.map((item: { id: number }) => {
+ return item.id;
+ })
+ )
+ );
+ };
+
+ //新增修改提交
+ const submitCheckUnit = async () => {
+ checkUnitFormRef.value.validate(async (valid: Boolean) => {
+ if (valid) {
+ if (state.title === '新增隐患排查单元') {
+ let res = await checkUnitApi().addCheckUnit(state.checkUnitForm);
+ if (res.data.code === '200') {
+ ElMessage({
+ type: 'success',
+ message: '隐患排查单元新增成功',
+ duration: 2000
+ });
+ state.isShowCheckUnitDialog = false;
+ context.emit('refreshCheckUnit');
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ } else {
+ let res = await checkUnitApi().modCheckUnit(state.checkUnitForm);
+ if (res.data.code === '200') {
+ ElMessage({
+ type: 'success',
+ message: '隐患排查单元修改成功',
+ duration: 2000
+ });
+ state.isShowCheckUnitDialog = false;
+ context.emit('refreshCheckUnit');
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ }
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: '请完善基本信息'
+ });
+ }
+ });
+ };
+
+ return {
+ ...toRefs(state),
+ checkUnitFormRef,
+ submitCheckUnit,
+ onDelCheckUnit,
+ onOpenDialogRef,
+ openCheckUnitDialog,
+ receiveRiskControlId,
+ riskControlMeasureDialogRef
+ };
+ }
+};
+</script>
+
+<style scoped>
+::v-deep.el-divider--horizontal {
+ margin-top: 0px !important;
+}
+
+::v-deep.el-dialog__body {
+ padding-top: 10px !important;
+}
+.filter-container {
+ padding: 10px 0px;
+}
+:deep(.el-textarea.is-disabled .el-textarea__inner) {
+ background-color: var(--el-card-bg-color);
+ color: var(--el-input-text-color, var(--el-text-color-regular));
+}
+:deep(.el-input.is-disabled .el-input__inner) {
+ color: var(--el-input-text-color, var(--el-text-color-regular));
+}
+:deep(.el-input.is-disabled .el-input__wrapper) {
+ background-color: var(--el-card-bg-color);
+}
+</style>
diff --git a/src/views/doublePrevent/riskLevel/riskCheckUnit/components/selectMeasureControlDialog.vue b/src/views/doublePrevent/riskLevel/riskCheckUnit/components/selectMeasureControlDialog.vue
new file mode 100644
index 0000000..df01f4a
--- /dev/null
+++ b/src/views/doublePrevent/riskLevel/riskCheckUnit/components/selectMeasureControlDialog.vue
@@ -0,0 +1,219 @@
+<template>
+ <div class="system-role-container">
+ <el-card shadow="hover">
+ <div class="system-user-search mb15">
+ <div class="basic-line">
+ <span>管控方式:</span>
+ <el-select class="input-box" v-model="riskControlMeasureData.params.controlType" placeholder="管控方式" clearable>
+ <el-option v-for="item in controlTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+ </el-select>
+ </div>
+ <div class="basic-line">
+ <span>安全风险事件:</span>
+ <el-select class="input-box" v-model="riskControlMeasureData.params.riskEventId" placeholder="安全风险事件" clearable>
+ <el-option v-for="item in allSafetyRiskEventData" :key="item.id" :label="item.riskEventName" :value="item.id"></el-option>
+ </el-select>
+ </div>
+ <el-button size="default" type="primary" class="ml10" v-throttle @click="handleSearch">
+ <el-icon>
+ <ele-Search />
+ </el-icon>
+ 查询
+ </el-button>
+ </div>
+ <el-table
+ @selection-change="handleSelectionChange"
+ ref="table"
+ :row-key="getRowKey"
+ :data="riskControlMeasureData.data"
+ style="width: 100%"
+ >
+ <el-table-column type="selection" :reserve-selection="true" width="55"></el-table-column>
+ <el-table-column prop="riskEventName" label="安全风险事件名称" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="controlMeasureCode" label="风控措施编码" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="controlType" label="管控方式" show-overflow-tooltip>
+ <template #default="scope">
+ {{ parseNumber(scope.row.controlType, '管控方式') }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="checkContent" label="管控内容" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="classify1" label="管控措施分类1" show-overflow-tooltip>
+ <template #default="scope">
+ {{ parseNumber(scope.row.classify1, '管控措施分类1') }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="classify2" label="管控措施分类2" show-overflow-tooltip>
+ <template #default="scope">
+ {{ parseNumber(scope.row.classify2, '管控措施分类2') }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="classify3" label="管控措施分类3" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="measureDesc" label="措施说明" show-overflow-tooltip></el-table-column>>
+ <el-table-column label="操作" width="150">
+ <template #default="scope">
+ <el-button type="text" @click="giveValue(scope.row)">选择 </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-card>
+ </div>
+</template>
+
+<script lang="ts">
+import { toRefs, reactive, onMounted, ref } from 'vue';
+import { ElMessageBox, ElMessage } from 'element-plus';
+import { riskControlMeasureApi } from '/@/api/doublePreventSystem/riskControlMeasure/index.ts';
+import { safetyRiskEventApi } from '/@/api/doublePreventSystem/safetyRiskEvent';
+
+// 定义接口来定义对象的类型
+interface TableData {
+ roleName: string;
+ roleSign: string;
+ describe: string;
+ sort: number;
+ status: boolean;
+ createTime: string;
+}
+interface TableDataState {
+ isShowSelectMeasureControlDialog: boolean;
+ riskControlMeasureIdList: Array<riskControlMeasure>;
+ riskControlMeasureData: {
+ data: Array<TableData>;
+ total: number;
+ loading: boolean;
+ params: {
+ pageIndex: number;
+ pageSize: number;
+ controlType: number | null;
+ riskEventId: number | null;
+ };
+ };
+ controlTypeList: Array<controlTypeType>;
+ classifyOneList: Array<classifyOneType>;
+ classifyTwoList: Array<classifyOneType>;
+}
+interface controlTypeType {
+ id: number;
+ name: string;
+}
+interface classifyOneType {
+ id: number;
+ riskMeasureName: string;
+}
+
+interface riskControlMeasure {}
+export default {
+ name: 'selectMeasureControlDialog',
+ components: {},
+ setup(props: any, context: any) {
+ const riskControlMeasureDialogRef = ref();
+ const state = reactive<TableDataState>({
+ isShowSelectMeasureControlDialog: false,
+ riskControlMeasureIdList: [],
+ riskControlMeasureData: {
+ data: [],
+ total: 0,
+ loading: false,
+ params: {
+ pageIndex: 1,
+ pageSize: 10,
+ controlType: null,
+ riskEventId: null
+ }
+ },
+ controlTypeList: [
+ { id: 1, name: '自动化监控' },
+ { id: 2, name: '隐患排查' }
+ ],
+ classifyOneList: [],
+ classifyTwoList: []
+ });
+
+ // 初始化表格数据
+ const initRiskControlMeasureData = async () => {
+ let res = await riskControlMeasureApi().getAllRiskControlMeasureList();
+ if (res.data.code === '200') {
+ state.riskControlMeasureData.data = res.data.data;
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ };
+
+ //获取管控措施分类
+ const getClassify = async () => {
+ let res = await riskControlMeasureApi().getClassifyData();
+ if (res.data.code === '200') {
+ state.classifyOneList = res.data.data.filter((item: any) => item.parentId === null);
+ state.classifyTwoList = res.data.data.filter((item: any) => item.parentId !== null);
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ };
+
+ const parseNumber = (value: string | number, type: string) => {
+ if (type === '管控方式') {
+ return state.controlTypeList.find((item) => item.id === value)?.name;
+ } else if (type === '管控措施分类1') {
+ return state.classifyOneList.find((item) => item.id === value)?.riskMeasureName;
+ } else {
+ return state.classifyTwoList.find((item) => item.id === value)?.riskMeasureName;
+ }
+ };
+
+ const handleSearch = () => {
+ initRiskControlMeasureData();
+ };
+
+ // 分页改变
+ const onHandleSizeChange = (val: number) => {
+ state.riskControlMeasureData.params.pageSize = val;
+ initRiskControlMeasureData();
+ };
+
+ // 分页改变
+ const onHandleCurrentChange = (val: number) => {
+ state.riskControlMeasureData.params.pageIndex = val;
+ initRiskControlMeasureData();
+ };
+
+ const handleSelectionChange = (val: []) => {
+ state.riskControlMeasureIdList = val;
+ };
+
+ const getRowKey = (value: { id: number }) => {
+ return value.id;
+ };
+
+ const giveValue = () => {
+ context.emit('receiveRiskControlId', state.riskControlMeasureIdList);
+ };
+
+ // 页面加载时
+ onMounted(() => {
+ initRiskControlMeasureData();
+ getClassify();
+ });
+
+ return {
+ handleSearch,
+ parseNumber,
+ getRowKey,
+ giveValue,
+ handleSelectionChange,
+ onHandleSizeChange,
+ onHandleCurrentChange,
+ riskControlMeasureDialogRef,
+ initRiskControlMeasureData,
+ ...toRefs(state)
+ };
+ }
+};
+</script>
+
+<style scoped></style>
diff --git a/src/views/doublePrevent/riskLevel/riskCheckUnit/index.vue b/src/views/doublePrevent/riskLevel/riskCheckUnit/index.vue
new file mode 100644
index 0000000..ad9a72f
--- /dev/null
+++ b/src/views/doublePrevent/riskLevel/riskCheckUnit/index.vue
@@ -0,0 +1,194 @@
+<template>
+ <div class="system-role-container">
+ <el-card shadow="hover">
+ <div class="system-user-search mb15">
+ <!-- <div class="basic-line">-->
+ <!-- <span>风险等级:</span>-->
+ <!-- <el-select v-model="checkUnitData.params.riskLevel" clearable filterable class="input-box" placeholder="请选择风险等级">-->
+ <!-- <el-option v-for="item in levelList" :key="item.id" :label="item.name" :value="item.id"></el-option>-->
+ <!-- </el-select>-->
+ <!-- </div>-->
+ <!-- <div class="basic-line">-->
+ <!-- <span>部门:</span>-->
+ <!-- <el-cascader :options="departmentList" :props="{ emitPath: false, checkStrictly: true, value: 'depId', label: 'depName' }" placeholder="请选择部门" clearable filterable class="input-box" v-model="checkUnitData.params.depId"> </el-cascader>-->
+ <!-- </div>-->
+ <div class="basic-line">
+ <span>任务单元名称:</span>
+ <el-input class="input-box" v-model="checkUnitData.params.taskUnitName" placeholder="任务单元名称" clearable> </el-input>
+ </div>
+ <el-button size="default" type="primary" class="ml10" v-throttle @click="handleSearch">
+ <el-icon>
+ <ele-Search />
+ </el-icon>
+ 查询
+ </el-button>
+ <el-button size="default" type="success" class="ml10" @click="onOpenDialogRef('新增', '')">
+ <el-icon>
+ <ele-FolderAdd />
+ </el-icon>
+ 新增排查单元
+ </el-button>
+ </div>
+ <el-table :data="checkUnitData.data" style="width: 100%">
+ <el-table-column type="index" label="序号" width="60" />
+ <el-table-column prop="taskUnitName" label="任务单元名称" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="note" label="任务单元说明" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="createByUserName" label="创建人" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="lastEditUserName" label="最后修改人" show-overflow-tooltip></el-table-column>
+ <el-table-column prop="gmtModitify" label="最后修改时间" show-overflow-tooltip></el-table-column>
+ <el-table-column label="操作" width="200" align="center">
+ <template #default="scope">
+ <el-button size="small" text type="primary" :icon="View" @click="onOpenDialogRef('查看', scope.row)">查看</el-button>
+ <el-button size="small" text type="primary" :icon="Edit" @click="onOpenDialogRef('修改', scope.row)">修改</el-button>
+ <el-button size="small" text type="danger" :icon="Delete" @click="onDelcheckUnit(scope.row)">删除</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <br />
+ <el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="checkUnitData.params.pageIndex" background v-model:page-size="checkUnitData.params.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="checkUnitData.total" class="page-position"> </el-pagination>
+ <br />
+ <br />
+ </el-card>
+ <checkUnitDialog ref="checkUnitDialogRef" @refreshCheckUnit="initCheckUnitTableData" />
+ </div>
+</template>
+
+<script lang="ts">
+import { toRefs, reactive, onMounted, ref, defineComponent } from 'vue';
+import { ElMessageBox, ElMessage } from 'element-plus';
+import checkUnitDialog from './components/checkUnitDialog.vue';
+import { checkUnitApi } from '/@/api/doublePreventSystem/checkUnit/index.ts';
+import { Edit, Delete, View } from '@element-plus/icons-vue';
+
+// 定义接口来定义对象的类型
+interface TableData {
+ roleName: string;
+ roleSign: string;
+ describe: string;
+ sort: number;
+ status: boolean;
+ createTime: string;
+}
+interface TableDataState {
+ checkUnitData: {
+ data: Array<TableData>;
+ total: number;
+ loading: boolean;
+ params: {
+ pageIndex: number;
+ pageSize: number;
+ taskUnitName: number | null;
+ };
+ };
+}
+
+export default defineComponent({
+ name: 'index',
+ components: { checkUnitDialog, Edit, Delete, View },
+ setup() {
+ const checkUnitDialogRef = ref();
+ const state = reactive<TableDataState>({
+ checkUnitData: {
+ data: [],
+ total: 0,
+ loading: false,
+ params: {
+ pageIndex: 1,
+ pageSize: 10,
+ taskUnitId: null
+ }
+ }
+ });
+ // 初始化表格数据
+ const initCheckUnitTableData = async () => {
+ let res = await checkUnitApi().getCheckUnitList(state.checkUnitData.params);
+ if (res.data.code === '200') {
+ state.checkUnitData.data = res.data.data;
+ state.checkUnitData.total = res.data.count;
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ };
+
+ // 打开生产装置弹窗
+ const onOpenDialogRef = (type: string, value: any) => {
+ checkUnitDialogRef.value.openCheckUnitDialog(type, value);
+ };
+ // 删除角色
+ const onDelCheckUnit = (row: any) => {
+ ElMessageBox.confirm(`此操作将永久删除该条生产装置:“${row.produceDeviceName}”,是否继续?`, '提示', {
+ confirmButtonText: '确认',
+ cancelButtonText: '取消',
+ type: 'warning'
+ })
+ .then(async () => {
+ let res = await checkUnitApi().deleteCheckUnit({ id: row.id });
+ if (res.data.code === '200') {
+ ElMessage({
+ type: 'success',
+ duration: 2000,
+ message: '删除成功'
+ });
+ await initCheckUnitTableData();
+ } else {
+ ElMessage({
+ type: 'warning',
+ message: res.data.msg
+ });
+ }
+ })
+ .catch(() => {});
+ };
+
+ const handleSearch = () => {
+ initCheckUnitTableData();
+ };
+ // 分页改变
+ const onHandleSizeChange = (val: number) => {
+ state.checkUnitData.params.pageSize = val;
+ initCheckUnitTableData();
+ };
+ // 分页改变
+ const onHandleCurrentChange = (val: number) => {
+ state.checkUnitData.params.pageIndex = val;
+ initCheckUnitTableData();
+ };
+ // 页面加载时
+ onMounted(() => {
+ initCheckUnitTableData();
+ });
+
+ return {
+ Edit,
+ Delete,
+ View,
+ handleSearch,
+ onOpenDialogRef,
+ onHandleSizeChange,
+ onDelCheckUnit,
+ onHandleCurrentChange,
+ checkUnitDialog,
+ checkUnitDialogRef,
+ initCheckUnitTableData,
+ ...toRefs(state)
+ };
+ }
+});
+</script>
+
+<style scoped>
+:deep(.el-textarea.is-disabled .el-textarea__inner) {
+ background-color: var(--el-card-bg-color);
+ color: var(--el-input-text-color, var(--el-text-color-regular));
+}
+:deep(.el-input.is-disabled .el-input__inner) {
+ color: var(--el-input-text-color, var(--el-text-color-regular));
+}
+:deep(.el-input.is-disabled .el-input__wrapper) {
+ background-color: var(--el-card-bg-color);
+}
+</style>
--
Gitblit v1.9.2