|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="full-container-p24">
|
|
<div class="full-container-p24">
|
|
|
- <div style="display: flex; justify-content: space-between">
|
|
|
|
|
|
|
+ <div class="df jcsb">
|
|
|
<div style="display: flex">
|
|
<div style="display: flex">
|
|
|
<el-input
|
|
<el-input
|
|
|
placeholder="请输入模板名称"
|
|
placeholder="请输入模板名称"
|
|
@@ -22,101 +22,6 @@
|
|
|
<el-button size="large" type="primary" @click="showDialog">
|
|
<el-button size="large" type="primary" @click="showDialog">
|
|
|
创建安检模板
|
|
创建安检模板
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-dialog
|
|
|
|
|
- title="安检模板"
|
|
|
|
|
- v-model="dialogFormVisible"
|
|
|
|
|
- @close="resetForm"
|
|
|
|
|
- >
|
|
|
|
|
- <template v-slot:default>
|
|
|
|
|
- <el-form
|
|
|
|
|
- :model="ruleForm"
|
|
|
|
|
- :rules="rules"
|
|
|
|
|
- ref="form"
|
|
|
|
|
- label-width="140px"
|
|
|
|
|
- label-position="left"
|
|
|
|
|
- >
|
|
|
|
|
- <el-form-item prop="securityCheckName" label="安检名称">
|
|
|
|
|
- <el-input
|
|
|
|
|
- style="width: 280px"
|
|
|
|
|
- v-model="ruleForm.securityCheckName"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item prop="minShipLen" label="选择适用船型">
|
|
|
|
|
- <div class="df aic jcsb" style="width: 100%">
|
|
|
|
|
- <el-input
|
|
|
|
|
- style="width: 130px"
|
|
|
|
|
- v-model="ruleForm.minShipLen"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
- -
|
|
|
|
|
- <el-input
|
|
|
|
|
- style="width: 130px"
|
|
|
|
|
- v-model="ruleForm.maxShipLen"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item prop="maxShipLen" label="最大适用船型"></el-form-item>
|
|
|
|
|
- <div class="df aic jcsb mb20">
|
|
|
|
|
- <el-button-group v-if="ruleForm.items.length > 1">
|
|
|
|
|
- <el-button
|
|
|
|
|
- v-for="(item, index) in ruleForm.items"
|
|
|
|
|
- @click="itemIndex = index"
|
|
|
|
|
- :type="itemIndex == index ? 'primary' : ''"
|
|
|
|
|
- >
|
|
|
|
|
- {{ item.itemName || "新检查项目" }}
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </el-button-group>
|
|
|
|
|
- <el-button type="primary" @click="addNewItem">
|
|
|
|
|
- 添加新检查项目
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div>
|
|
|
|
|
- <el-form-item label="项目名称">
|
|
|
|
|
- <el-input
|
|
|
|
|
- style="width: 280px"
|
|
|
|
|
- v-model="ruleForm.items[itemIndex].itemName"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="项目类型">
|
|
|
|
|
- <el-select
|
|
|
|
|
- style="width: 280px"
|
|
|
|
|
- v-model="ruleForm.items[itemIndex].itemType"
|
|
|
|
|
- placeholder="请选择安全检查项目类型"
|
|
|
|
|
- >
|
|
|
|
|
- <el-option
|
|
|
|
|
- v-for="item in templateTypeSelect"
|
|
|
|
|
- :label="item.value"
|
|
|
|
|
- :value="item.key"
|
|
|
|
|
- />
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="项目备注">
|
|
|
|
|
- <el-input
|
|
|
|
|
- style="width: 280px"
|
|
|
|
|
- v-model="ruleForm.items[itemIndex].itemRemark"
|
|
|
|
|
- ></el-input>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <div class="df jcfe">
|
|
|
|
|
- <el-button
|
|
|
|
|
- v-if="ruleForm.items.length > 1"
|
|
|
|
|
- size="small"
|
|
|
|
|
- type="primary"
|
|
|
|
|
- @click="removeItem"
|
|
|
|
|
- >
|
|
|
|
|
- 移除当前项目
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template v-slot:footer>
|
|
|
|
|
- <div class="dialog-footer">
|
|
|
|
|
- <el-button @click="resetForm">取 消</el-button>
|
|
|
|
|
- <el-button type="primary" @click="addSecurityTemplate(ruleForm)">
|
|
|
|
|
- 确 定
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
<div style="margin-top: 24px">
|
|
<div style="margin-top: 24px">
|
|
|
<el-table border :data="tableData" stripe style="width: 100%">
|
|
<el-table border :data="tableData" stripe style="width: 100%">
|
|
@@ -159,7 +64,12 @@
|
|
|
编辑
|
|
编辑
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<el-button
|
|
<el-button
|
|
|
- @click="deleteSecurityTemplate(scope.row.id)"
|
|
|
|
|
|
|
+ @click="
|
|
|
|
|
+ deleteSecurityTemplate(
|
|
|
|
|
+ scope.row.id,
|
|
|
|
|
+ scope.row.securityCheckName
|
|
|
|
|
+ )
|
|
|
|
|
+ "
|
|
|
type="danger"
|
|
type="danger"
|
|
|
text
|
|
text
|
|
|
size="small"
|
|
size="small"
|
|
@@ -190,75 +100,8 @@ import md5 from "md5";
|
|
|
import api from "../../apis/fetch";
|
|
import api from "../../apis/fetch";
|
|
|
import { subTimeStr } from "../../utils/utils";
|
|
import { subTimeStr } from "../../utils/utils";
|
|
|
|
|
|
|
|
-let dialogFormVisible = ref(false);
|
|
|
|
|
-let form = ref(null);
|
|
|
|
|
-let ruleForm = ref({
|
|
|
|
|
- securityCheckName: "",
|
|
|
|
|
- items: [{}],
|
|
|
|
|
- minShipLen: "",
|
|
|
|
|
- maxShipLen: "",
|
|
|
|
|
-});
|
|
|
|
|
function showDialog() {
|
|
function showDialog() {
|
|
|
- dialogFormVisible.value = true;
|
|
|
|
|
-}
|
|
|
|
|
-async function resetForm() {
|
|
|
|
|
- itemIndex.value = 0;
|
|
|
|
|
- ruleForm.value = {
|
|
|
|
|
- items: [{}],
|
|
|
|
|
- };
|
|
|
|
|
- dialogFormVisible.value = false;
|
|
|
|
|
-}
|
|
|
|
|
-const rules = ref({
|
|
|
|
|
- securityCheckName: [
|
|
|
|
|
- { required: true, message: "请填写船东名称", trigger: "blur" },
|
|
|
|
|
- ],
|
|
|
|
|
- minShipLen: [{ required: true, message: "请填写船名", trigger: "blur" }],
|
|
|
|
|
- maxShipLen: [{ required: true, message: "请填写MMSI", trigger: "blur" }],
|
|
|
|
|
- items: [{ required: true, message: "请填写手机号", trigger: "blur" }],
|
|
|
|
|
-});
|
|
|
|
|
-let itemIndex = ref(0);
|
|
|
|
|
-let templateTypeSelect = ref([]);
|
|
|
|
|
-function addNewItem() {
|
|
|
|
|
- ruleForm.value.items.push({});
|
|
|
|
|
- itemIndex.value = ruleForm.value.items.length - 1;
|
|
|
|
|
-}
|
|
|
|
|
-async function getSecurityTemplateSelect() {
|
|
|
|
|
- let { data } = await api.getSecurityTemplateSelect();
|
|
|
|
|
- templateTypeSelect.value = data.status == 0 ? data.result : [];
|
|
|
|
|
-}
|
|
|
|
|
-async function addSecurityTemplate() {
|
|
|
|
|
- form.value.validate(async (valid) => {
|
|
|
|
|
- if (valid) {
|
|
|
|
|
- let { securityCheckName, minShipLen, maxShipLen, items, id } =
|
|
|
|
|
- ruleForm.value;
|
|
|
|
|
- let res = await api[
|
|
|
|
|
- id ? "updateSecurityTemplate" : "addSecurityTemplate"
|
|
|
|
|
- ]({
|
|
|
|
|
- securityCheckName,
|
|
|
|
|
- minShipLen,
|
|
|
|
|
- maxShipLen,
|
|
|
|
|
- items,
|
|
|
|
|
- });
|
|
|
|
|
- if (res.data.status == 0) {
|
|
|
|
|
- ElNotification.success({
|
|
|
|
|
- title: id ? "更新成功" : "添加成功",
|
|
|
|
|
- duration: 0,
|
|
|
|
|
- message: `${securityCheckName}:${res.data.msg}`,
|
|
|
|
|
- type: "success",
|
|
|
|
|
- });
|
|
|
|
|
- resetForm();
|
|
|
|
|
- getSecurityTemplateList();
|
|
|
|
|
- } else {
|
|
|
|
|
- ElNotification.error({
|
|
|
|
|
- title: "失败",
|
|
|
|
|
- duration: 3000,
|
|
|
|
|
- message: res.data.msg,
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ router.push("/shipSecurityManage/shipCheckTemplateDetail");
|
|
|
}
|
|
}
|
|
|
let currentPage = ref(1);
|
|
let currentPage = ref(1);
|
|
|
let term = ref("");
|
|
let term = ref("");
|
|
@@ -280,25 +123,17 @@ async function getSecurityTemplateList(page) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function removeItem() {
|
|
|
|
|
- ruleForm.value.items.splice(itemIndex.value, 1);
|
|
|
|
|
- ruleForm.value.items.length > 1
|
|
|
|
|
- ? (itemIndex.value -= 1)
|
|
|
|
|
- : (itemIndex.value = 0);
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
async function getSecurityTemplateDetail(id) {
|
|
async function getSecurityTemplateDetail(id) {
|
|
|
- let { data } = await api.getSecurityTemplateDetail({
|
|
|
|
|
- id,
|
|
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: "/shipSecurityManage/shipCheckTemplateDetail",
|
|
|
|
|
+ query: {
|
|
|
|
|
+ id,
|
|
|
|
|
+ },
|
|
|
});
|
|
});
|
|
|
- if (data.status == 0) {
|
|
|
|
|
- dialogFormVisible.value = true;
|
|
|
|
|
- ruleForm.value = data.result;
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function deleteSecurityTemplate(id) {
|
|
|
|
|
- ElMessageBox.confirm("确认删除安检模板?", "提示", {
|
|
|
|
|
|
|
+function deleteSecurityTemplate(id, securityCheckName) {
|
|
|
|
|
+ ElMessageBox.confirm(`确认删除安检模板: ${securityCheckName} ?`, "提示", {
|
|
|
confirmButtonText: "确认",
|
|
confirmButtonText: "确认",
|
|
|
cancelButtonText: "取消",
|
|
cancelButtonText: "取消",
|
|
|
type: "warning",
|
|
type: "warning",
|
|
@@ -311,6 +146,7 @@ function deleteSecurityTemplate(id) {
|
|
|
ElMessage({
|
|
ElMessage({
|
|
|
type: "success",
|
|
type: "success",
|
|
|
message: data.msg,
|
|
message: data.msg,
|
|
|
|
|
+ duration: 1500,
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
getSecurityTemplateList();
|
|
getSecurityTemplateList();
|
|
@@ -324,7 +160,6 @@ function pageChange(e) {
|
|
|
}
|
|
}
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
getSecurityTemplateList();
|
|
getSecurityTemplateList();
|
|
|
- getSecurityTemplateSelect();
|
|
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
<style scoped>
|
|
<style scoped>
|