王智慧 před 3 roky
rodič
revize
7fbe9a0360

+ 30 - 0
src/apis/fetch.js

@@ -88,4 +88,34 @@ export default {
   getCertListType(data) {
     return $http("/cert/certList/type", data);
   },
+
+  // 新增安全检查模板
+  addSecurityTemplate(data) {
+    return $http("/security/template/add", data);
+  },
+
+  // 删除安全检查模板
+  deleteSecurityTemplate(data) {
+    return $http("/security/template/delete", data);
+  },
+
+  // 获取安全检查模板详情
+  getSecurityTemplateDetail(data) {
+    return $http("/security/template/detail", data);
+  },
+
+  // 获取安全检查项目下拉
+  getSecurityTemplateSelect() {
+    return $http("/security/template/item/select");
+  },
+
+  // 获取安全检查模板列表
+  getSecurityTemplateList(data) {
+    return $http("/security/template/list", data);
+  },
+
+  // 修改安全检查模板
+  updateSecurityTemplate(data) {
+    return $http("/security/template/update", data);
+  },
 };

+ 1 - 1
src/views/marineManage/marineNotice.vue

@@ -1,7 +1,7 @@
 <template>
   <el-empty :image-size="300" description=" " />
   <div style="text-align: center; font-size: 40px; color: #666">
-    船舶安检正在建设中
+    海事公告正在建设中
   </div>
 </template>
 <script setup>

+ 254 - 8
src/views/shipSecurityManage/shipCheckTemplateList.vue

@@ -1,7 +1,126 @@
 <template>
-  <el-empty :image-size="300" description=" " />
-  <div style="text-align: center; font-size: 40px; color: #666">
-    船舶安检正在建设中
+  <div class="full-container-p24">
+    <div style="display: flex; justify-content: space-between">
+      <div style="display: flex">
+        <el-input
+          placeholder="请输入船东/手机号"
+          prefix-icon="el-icon-search"
+          v-model="term"
+          clearable
+          size="large"
+          class="mr30"
+          style="width: 300px"
+        ></el-input>
+        <el-button
+          size="large"
+          type="primary"
+          @click="getSecurityTemplateList(1)"
+        >
+          查询
+        </el-button>
+      </div>
+      <el-button
+        size="large"
+        type="primary"
+        @click="router.push('/shipOwnerManage/shipOwnerDetail')"
+      >
+        添加船东
+      </el-button>
+      <el-dialog title="添加船东" v-model="dialogFormVisible">
+        <template v-slot:default>
+          <el-form
+            :model="ruleForm"
+            :rules="rules"
+            ref="form"
+            label-width="110px"
+            label-position="left"
+          >
+            <el-form-item prop="userName" label="船东姓名">
+              <el-input
+                style="width: 280px"
+                v-model="ruleForm.userName"
+              ></el-input>
+            </el-form-item>
+            <el-form-item prop="phone" label="手机号">
+              <el-input
+                style="width: 280px"
+                v-model="ruleForm.phone"
+              ></el-input>
+            </el-form-item>
+            <el-form-item prop="shipname" label="船名">
+              <el-input
+                style="width: 280px"
+                v-model="ruleForm.shipname"
+              ></el-input>
+            </el-form-item>
+            <el-form-item prop="mmsi" label="MMSI">
+              <el-input style="width: 280px" v-model="ruleForm.mmsi"></el-input>
+            </el-form-item>
+          </el-form>
+        </template>
+        <template v-slot:footer>
+          <div class="dialog-footer">
+            <el-button @click="resetForm">取 消</el-button>
+            <el-button type="primary" @click="addShipOwner(ruleForm)">
+              确 定
+            </el-button>
+          </div>
+        </template>
+      </el-dialog>
+    </div>
+    <div style="margin-top: 24px">
+      <el-table border :data="tableData" stripe style="width: 100%">
+        <el-table-column
+          type="index"
+          label="序号"
+          width="80"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="userName"
+          label="船东名称"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="phone"
+          label="手机号"
+          min-width="120"
+          align="center"
+        ></el-table-column>
+        <el-table-column
+          prop="createTime"
+          label="创建时间"
+          min-width="120"
+          align="center"
+        >
+          <template v-slot="scope">
+            {{ subTimeStr(scope.row.createTime) }}
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" min-width="80" align="center">
+          <template v-slot="scope">
+            <el-button
+              @click="shipOwnerDetail(scope.row.id)"
+              type="primary"
+              text
+              size="small"
+            >
+              查看详情
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="df aic jcfe mt40 mr20">
+        <el-pagination
+          background
+          layout="prev, pager, next"
+          :current-page="currentPage"
+          :total="total"
+          @current-change="pageChange"
+        ></el-pagination>
+      </div>
+    </div>
   </div>
 </template>
 <script setup>
@@ -11,12 +130,139 @@ import store from "../../store";
 import router from "../../router";
 import md5 from "md5";
 import api from "../../apis/fetch";
-import { useRoute } from "vue-router";
-import _ from "lodash";
 import { subTimeStr } from "../../utils/utils";
 
-const route = useRoute();
-onMounted(() => {});
+let dialogFormVisible = ref(false);
+let form = ref(null);
+let ruleForm = ref({
+  userName: "",
+  phone: "",
+  shipname: "",
+  mmsi: "",
+});
+async function resetForm() {
+  dialogFormVisible.value = false;
+  form.value.resetFields();
+}
+const rules = ref({
+  userName: [{ required: true, message: "请填写船东名称", trigger: "blur" }],
+  shipname: [{ required: true, message: "请填写船名", trigger: "blur" }],
+  mmsi: [{ required: true, message: "请填写MMSI", trigger: "blur" }],
+  phone: [
+    { required: true, message: "请填写手机号", trigger: "blur" },
+    { min: 11, max: 11, message: "请正确填写手机号", trigger: "blur" },
+  ],
+});
+async function addShipOwner() {
+  form.value.validate(async (valid) => {
+    if (valid) {
+      let { userName, shipname, mmsi, phone } = ruleForm.value;
+      let res = await api.addShipOwner({
+        userName,
+        shipname,
+        mmsi,
+        phone,
+      });
+      console.log(res);
+      if (res.data.status == 0) {
+        ElNotification.success({
+          title: "添加成功",
+          duration: 0,
+          message: `${userName}:${res.data.msg}`,
+          type: "success",
+        });
+        resetForm();
+        getSecurityTemplateList();
+      } else {
+        ElNotification.error({
+          title: "失败",
+          duration: 3000,
+          message: res.data.msg,
+        });
+      }
+    } else {
+      return false;
+    }
+  });
+}
+let currentPage = ref(1);
+let term = ref("");
+let tableData = ref([]);
+let total = ref(0);
+async function getSecurityTemplateList(page) {
+  currentPage.value = page || currentPage.value;
+  let res = await api.getSecurityTemplateList({
+    currentPage: currentPage.value,
+    size: 10,
+    term: term.value,
+  });
+  if (res.data.status == 0) {
+    tableData.value = res.data.result;
+    total.value = res.data.total;
+  } else {
+    tableData.value = [];
+    total.value = 0;
+  }
+}
+
+async function shipOwnerDetail(shipOwnerId) {
+  store.commit("addAlive", "shipOwnerList");
+  router.push({
+    path: "/shipOwnerManage/shipOwnerDetail",
+    query: {
+      shipOwnerId,
+    },
+  });
+}
+function pageChange(e) {
+  currentPage.value = e;
+  getSecurityTemplateList();
+}
+onMounted(() => {
+  getSecurityTemplateList();
+});
 </script>
+<style scoped>
+.seach-btn {
+  display: inline-block;
+  width: 60px;
+  height: 38px;
+  background: #0094fe;
+  border-radius: 2px;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #ffffff;
+  text-align: center;
+  line-height: 38px;
+  margin-left: 10px;
+  cursor: pointer;
+}
+
+.cargo-owner-add {
+  width: 80px;
+  height: 32px;
+  border-radius: 2px;
+  border: 1px solid #0094fe;
+  font-size: 14px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+  line-height: 32px;
+  text-align: center;
+  cursor: pointer;
+}
+
+:deep().el-dialog {
+  width: 560px;
+  padding: 20px 50px;
+  border-radius: 6px;
+}
 
-<style scoped></style>
+:deep() .el-dialog__title {
+  font-size: 18px;
+  font-family: PingFangSC-Regular, PingFang SC;
+  font-weight: 400;
+  color: #0094fe;
+}
+</style>