浏览代码

添加港口

QuKatie 3 年之前
父节点
当前提交
92538b7d35

+ 95 - 0
src/components/port-info/configuration/mainList.json

@@ -0,0 +1,95 @@
+{
+  "align": "center",
+  "border": true,
+  "index": true,
+  "tree": true,
+  "addBtn": false,
+  "menu":false,
+  "selection":true,
+  "tip":false,
+  "header":false,
+  "column": [{
+      "label": "港口编号",
+      "prop": "code",
+      "width": 150
+    },
+    {
+      "label": "港口名称",
+      "prop": "name",
+      "width": 150
+    },
+    {
+      "label": "英文全称",
+      "prop": "enName",
+      "width": 150
+    },
+    {
+      "label": "港口类型",
+      "prop": "typeId",
+      "width": 120
+    },
+    {
+      "label": "航线",
+      "prop": "line",
+      "width": 120
+    },
+    {
+      "label": "UNCODE",
+      "prop": "unCode",
+      "width": 120
+    },
+    {
+      "label": "国家",
+      "prop": "country",
+      "width": 80
+    },
+    {
+      "label": "省",
+      "prop": "province",
+      "width": 80
+    },
+    {
+      "label": "市",
+      "prop": "city",
+      "width": 80
+    },
+    {
+      "label": "状态",
+      "prop": "status",
+      "type": "select",
+      "dicData": [{
+        "label": "正常",
+        "value": 0
+      }, {
+        "label": "关闭",
+        "value": 1
+      }],
+      "width": 120
+    },
+    {
+      "label": "备注",
+      "prop": "remarks",
+      "width": 150
+    },
+    {
+      "label": "录入人",
+      "prop": "createUserName",
+      "width": 120
+    },
+    {
+      "label": "录入时间",
+      "prop": "createTime",
+      "width": 150
+    },
+    {
+      "label": "最新修改人",
+      "prop": "updateUserName",
+      "width": 120
+    },
+    {
+      "label": "最新修改时间",
+      "prop": "updateTime",
+      "width": 150
+    }
+  ]
+}

+ 285 - 0
src/components/port-info/index.vue

@@ -0,0 +1,285 @@
+<template>
+  <div>
+    <div @click="portinfoVisible = true&&!disabled">
+      <el-input
+        v-model="value"
+        @input="$emit('balabala', value)"
+        placeholder="请选择"
+        :disabled="disabled"
+      />
+    </div>
+    <el-dialog
+      title="港口信息"
+      :visible.sync="portinfoVisible"
+      width="60%"
+      append-to-body
+      @closed="closed"
+    >
+      <span>
+        <el-row>
+          <el-col :span="5">
+            <el-scrollbar>
+              <basic-container>
+                <avue-tree
+                  :option="treeOption"
+                  :data="treeData"
+                  @node-click="nodeClick"
+                />
+              </basic-container>
+            </el-scrollbar>
+          </el-col>
+          <el-col :span="19">
+            <avue-crud
+              ref="crud"
+              :data="data"
+              :option="tableOption"
+              :page.sync="page"
+              :table-loading="loading"
+              v-model="form"
+              :search.sync="search"
+              :before-open="beforeOpen"
+              @size-change="sizeChange"
+              @current-change="currentChange"
+              @search-change="searchChange"
+              @refresh-change="refreshChange"
+              @row-save="rowSave"
+              @row-del="rowDel"
+              @row-update="rowUpdate"
+              @on-load="getList"
+              @saveColumn="saveColumn"
+              @tree-load="treeLoad"
+              @selection-change="selectionChange"
+            >
+            </avue-crud>
+          </el-col>
+        </el-row>
+      </span>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="portinfoVisible = false">取 消</el-button>
+        <el-button
+          type="primary"
+          @click="importPort"
+          :disabled="selectionList.length != 1"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import option from "./configuration/mainList.json";
+import reportDialog from "@/components/report-dialog/main";
+import {
+  getList,
+  add,
+  update,
+  remove,
+  getPortTypeTree,
+  getTypeTree
+} from "@/api/basicData/portinformation";
+
+export default {
+  data() {
+    return {
+      switchDialog: false, //报表
+      loading: true,
+      data: [],
+      tableOption: option,
+      form: {},
+      search: {},
+      treeDeptId: "",
+      treeDeptName: "",
+      height: window.innerHeight - 500,
+      page: {
+        currentPage: 1,
+        total: 0,
+        pageSize: 10
+      },
+      treeOption: {
+        nodeKey: "id",
+        lazy: true,
+        treeLoad: function(node, resolve) {
+          const parentId = node.level === 0 ? 0 : node.data.id;
+          getPortTypeTree(parentId).then(res => {
+            resolve(
+              res.data.map(item => {
+                return {
+                  ...item,
+                  leaf: !item.hasChildren
+                };
+              })
+            );
+          });
+        },
+        addBtn: false,
+        menu: false,
+        size: "small",
+        props: {
+          labelText: "标题",
+          label: "name",
+          value: "id",
+          children: "children"
+        }
+      },
+      portinfoVisible: false,
+      selectionList: []
+    };
+  },
+  props: {
+    value: String,
+    disabled: Boolean
+  },
+  model: {
+    prop: "value",
+    event: "balabala"
+  },
+  created() {},
+  components: {
+    reportDialog
+  },
+  mounted() {
+    option.height = window.innerHeight - 500;
+    //查询服务类别字典项
+    getTypeTree().then(res => {
+      this.findObject(this.tableOption.column, "typeId").dicData =
+        res.data.data;
+    });
+  },
+  methods: {
+    closed() {
+      this.selectionList = [];
+    },
+    importPort() {
+      this.$emit("balabala", this.selectionList[0].name);
+      this.portinfoVisible = false;
+    },
+    //打印
+    openReport() {
+      this.switchDialog = !this.switchDialog;
+    },
+    //关闭打印
+    onClose(val) {
+      this.switchDialog = val;
+    },
+    getList(page, params = {}) {
+      this.loading = true;
+      getList(page.currentPage, page.pageSize, params, this.treeDeptId).then(
+        res => {
+          this.data = res.data.data.records;
+          this.page.total = res.data.data.total;
+          this.loading = false;
+        }
+      );
+    },
+    //点击新增打开的窗口 取消时触发
+    // beforeClose(){
+
+    // },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    //点击新增或修改时
+    beforeOpen(done, type) {
+      if (["add"].includes(type)) {
+        this.tableOption.column.forEach(e => {
+          if (e.prop == "typeId") {
+            this.$set(this.tableOption.column, 3, {
+              ...e,
+              value: this.treeDeptId
+            });
+          }
+        });
+      }
+      done();
+    },
+    searchChange(params, done) {
+      this.getList(this.page, params);
+      done();
+    },
+    sizeChange(val) {
+      this.page.pageSize = val;
+      this.getList();
+    },
+    currentChange(val) {
+      this.page.currentPage = val;
+      this.getList();
+    },
+    refreshChange() {
+      this.getList(this.page, this.search);
+    },
+    rowSave(row, done, loading) {
+      add(row).then(
+        () => {
+          this.page.currentPage = 1;
+          this.getList(this.page);
+          this.$message.success("保存成功");
+          done();
+        },
+        error => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    rowUpdate(row, index, done, loading) {
+      row.createTime = "";
+      update(row).then(
+        () => {
+          this.getList(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          // 数据回调进行刷新
+          done(row);
+        },
+        error => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    rowDel(row, index, done) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          this.getList(this.page);
+          done(row);
+        });
+    },
+    cellDblclick(row, column, cell, event) {
+      this.$refs.crud.rowEdit(row);
+    },
+    saveColumn(row, column) {
+      console.log(row, column);
+    },
+    //展开主页左边类型
+    nodeClick(data) {
+      this.treeDeptName = data.cname;
+      this.treeDeptId = data.id;
+      this.page.currentPage = 1;
+      this.getList(this.page);
+    },
+    //列表内展开树节点
+    treeLoad(tree, treeNode, resolve) {
+      const parentId = tree.id;
+      getList({ parentId: parentId }).then(res => {
+        resolve(res.data.data.records);
+      });
+    }
+  }
+};
+</script>
+
+<style scoped lang="scss"></style>

+ 2 - 2
src/main.js

@@ -28,8 +28,8 @@ import {getWorkDicts} from '@/api/system/dictbiz'
 //客户选择组件
 import selectComponent from '@/components/selectComponent/customerSelect';
 Vue.component('selectComponent', selectComponent);
-
-
+import portInfo from "@/components/port-info/index";
+Vue.component('portInfo', portInfo);
 // 注册全局crud驱动
 window.$crudCommon = crudCommon;
 // 加载Vue拓展

+ 1 - 8
src/views/exportTrade/customerInquiry/config/mainList.json

@@ -55,14 +55,7 @@
       "search": true,
       "index": 7,
       "minWidth": 80,
-      "overHidden": true,
-      "type": "select",
-      "filterable":true,
-      "dicData": [],
-      "props": {
-        "label": "name",
-        "value": "name"
-      }
+      "overHidden": true
     }, {
       "label": "目的港",
       "prop": "portOfDestination",

+ 9 - 0
src/views/exportTrade/customerInquiry/detailsPage.vue

@@ -26,6 +26,15 @@
       <containerTitle title="基础信息"></containerTitle>
       <basic-container style="margin-bottom: 10px">
         <avue-form ref="form" v-model="form" :option="option">
+          <template slot="portOfLoad">
+            <port-info
+              v-model="form.portOfLoad"
+              :disabled="$route.query.status == 1"
+            />
+          </template>
+          <template slot="portOfDestination">
+            <port-info v-model="form.portOfDestination" :disabled="$route.query.status == 1" />
+          </template>
           <template slot="corpId">
             <select-component
               v-model="form.corpId"

+ 15 - 6
src/views/exportTrade/customerInquiry/index.vue

@@ -13,6 +13,12 @@
       @refresh-change="refreshChange"
       @on-load="onLoad"
     >
+      <template slot="portOfLoadSearch">
+        <port-info v-model="search.portOfLoad" />
+      </template>
+      <template slot="portOfDestinationSearch">
+        <port-info v-model="search.portOfDestination" />
+      </template>
       <template slot="menuLeft">
         <el-button
           type="primary"
@@ -62,7 +68,7 @@
 
 <script>
 import option from "./config/mainList.json";
-import { getList, remove,getPorts } from "@/api/basicData/customerInquiry";
+import { getList, remove, getPorts } from "@/api/basicData/customerInquiry";
 
 export default {
   name: "customerInformation",
@@ -107,13 +113,16 @@ export default {
         };
       }
     });
-    getPorts().then(res => {
-      this.findObject(this.option.column, "portOfLoad").dicData = res.data;
-      this.findObject(this.option.column, "portOfDestination").dicData =
-        res.data;
-    });
+    // getPorts().then(res => {
+    //   this.findObject(this.option.column, "portOfLoad").click =()=>{
+    //     console.log('11111111')
+    //   };
+    //   // this.findObject(this.option.column, "portOfDestination").dicData =
+    //   //   res.data;
+    // });
   },
   methods: {
+    // getOpen
     //删除列表后面的删除按钮触发触发(row, index, done)
     rowDel(row, index, done) {
       this.$confirm("确定删除数据?", {

+ 7 - 1
src/views/exportTrade/purchaseInquiry/detailsPage.vue

@@ -23,6 +23,12 @@
       <containerTitle title="基础信息"></containerTitle>
       <basic-container style="margin-bottom: 10px">
         <avue-form ref="form" v-model="form" :option="option">
+          <template slot="portOfLoad">
+            <port-info v-model="form.portOfLoad" :disabled="$route.query.status == 1" />
+          </template>
+          <template slot="portOfDestination">
+            <port-info v-model="form.portOfDestination" :disabled="$route.query.status == 1" />
+          </template>
           <template slot="corpId">
             <select-component
               v-model="form.corpId"
@@ -494,7 +500,7 @@ export default {
           price: 0,
           amount: 0,
           taxRate: 0,
-          unit:e.unit,
+          unit: e.unit,
           remarks: null,
           $cellEdit: true
         });

+ 6 - 0
src/views/exportTrade/purchaseInquiry/index.vue

@@ -22,6 +22,12 @@
           :configuration="configuration"
         ></select-component>
       </template>
+      <template slot="portOfLoadSearch">
+        <port-info v-model="search.portOfLoad" />
+      </template>
+      <template slot="portOfDestinationSearch">
+        <port-info v-model="search.portOfDestination" />
+      </template>
       <template slot-scope="scope" slot="corpId">
         {{ scope.row.corpName }}
       </template>

+ 13 - 1
src/views/exportTrade/salesContract/detailsPage.vue

@@ -25,6 +25,18 @@
       <containerTitle title="基础信息"></containerTitle>
       <basic-container>
         <avue-form ref="form" v-model="form" :option="option">
+          <template slot="portOfLoad">
+            <port-info
+              v-model="form.portOfLoad"
+              :disabled="$route.query.status == 1"
+            />
+          </template>
+          <template slot="portOfDestination">
+            <port-info
+              v-model="form.portOfDestination"
+              :disabled="$route.query.status == 1"
+            />
+          </template>
           <template slot="corpId">
             <select-component
               v-model="form.corpId"
@@ -616,7 +628,7 @@ export default {
           price: 0,
           amount: 0,
           taxRate: 0,
-          unit:e.unit,
+          unit: e.unit,
           remarks: null,
           $cellEdit: true
         });

+ 7 - 0
src/views/exportTrade/salesContract/index.vue

@@ -30,6 +30,13 @@
           :configuration="configuration"
         ></select-component>
       </template>
+      <template slot="portOfLoadSearch">
+        <port-info v-model="search.portOfLoad" />
+      </template>
+      <template slot="portOfDestinationSearch">
+        <port-info v-model="search.portOfDestination" />
+      </template>
+
       <template slot-scope="scope" slot="corpId">
         {{ scope.row.corpsName }}
       </template>

+ 6 - 0
src/views/exportTrade/shippingInquiry/index.vue

@@ -22,6 +22,12 @@
           :configuration="configuration"
         ></select-component>
       </template>
+      <template slot="portOfLoadSearch">
+        <port-info v-model="search.portOfLoad" />
+      </template>
+      <template slot="portOfDestinationSearch">
+        <port-info v-model="search.portOfDestination" />
+      </template>
       <template slot-scope="scope" slot="corpId">
         {{ scope.row.corpName }}
       </template>