123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <template>
- <!-- 位置作业页面 -->
- <div class="homeworkPath">
- <div class="top">
- <el-date-picker v-model="value" type="date" placeholder="选择日期">
- </el-date-picker>
- <el-button type="primary" class="btn" @click="onclick">
- <i class="el-icon-search"></i>查询
- </el-button>
- </div>
- <el-table :data="selectionList" border highlight-current-row>
- <el-table-column type="index" width="50" label="序号" align="center">
- </el-table-column>
- <el-table-column
- v-for="(item, i) in tableTop"
- :key="i"
- :prop="item.prop"
- :label="item.label"
- align="center"
- :width="item.width"
- show-overflow-tooltip
- >
- <template slot="scope" v-if="item.label !== '船舶位置'">
- <span>{{ item.label }}</span>
- </template>
- <template slot="scope" v-if="item.label !== '位置状态'">
- <span>{{ item.label }}</span>
- </template>
- <template slot="scope" v-if="item.label !== '日期'">
- <span>{{ item.label }}</span>
- </template>
- <!-- 插入输入框 -->
- <template slot-scope="scope">
- <template v-if="item.slot">
- <!-- 船舶位置 -->
- <template v-if="item.prop == 'shipLocation'">
- <el-input
- v-model.number="scope.row.shipLocation"
- style="width: 100px;"
- @blur="onblur(scope)"
- ></el-input>
- </template>
- <!-- 位置状态 -->
- <template v-if="item.prop == 'locationStatus'">
- <el-select
- v-model.number="scope.row.locationStatus"
- placeholder="请选择"
- >
- <el-option
- v-for="(item, i) in options"
- :key="i"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </template>
- <!-- 日期 -->
- <template v-if="item.prop == 'locationRouteTime'">
- <el-date-picker
- type="date"
- v-model.number="scope.row.locationRouteTime"
- style="width: 150px;"
- :clearable="false"
- ></el-date-picker>
- </template>
- </template>
- <template v-else>
- <span>{{ scope.row[item.prop] }}</span>
- </template>
- </template>
- </el-table-column>
- <el-table-column fixed="right" label="操作" width="60">
- <template slot-scope="scope">
- <el-button @click="click(scope.row)" type="text" size="small"
- >保存</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <script>
- import { sjTime } from "@/utils/sharedJsFile";
- export default {
- name: "homeworkPath",
- data() {
- return {
- options: [
- {
- label: "未到闸船舶",
- value: "未到闸船舶"
- },
- {
- label: "等闸船舶",
- value: "等闸船舶"
- },
- {
- label: "已过闸船舶",
- value: "已过闸船舶"
- },
- {
- label: "到港待卸船舶",
- value: "到港待卸船舶"
- }
- ],
- value: null,
- // 车辆表格表头
- tableTop: [
- {
- prop: "foreignShipName",
- label: "外轮船名",
- width: "140"
- },
- {
- prop: "materialName",
- label: "物资名称",
- width: "140"
- },
- {
- prop: "capacityName",
- label: "江船船名",
- width: "140"
- },
- {
- prop: "locationRouteTime",
- label: "离港日期",
- width: "200",
- slot: true
- },
- {
- prop: "startPortName",
- label: "起运港",
- width: "140"
- },
- {
- prop: "shipLocation",
- label: "船舶位置",
- width: "130",
- slot: true
- },
- {
- prop: "locationStatus",
- label: "位置状态",
- width: "180",
- slot: true
- },
- {
- prop: "arrivePortName",
- label: "到达港",
- width: "140"
- },
- {
- prop: "planWeight",
- label: "计划吨",
- width: "100"
- },
- {
- prop: "realWeight",
- label: "实际吨",
- width: "100"
- },
- {
- prop: "locationMemo",
- label: "备注",
- width: "140"
- }
- ],
- selectionList: []
- };
- },
- created() {
- this.initialization();
- },
- methods: {
- onblur(scope) {
- // console.log("我是交了");
- // console.log(scope);
- this.axios
- .post(
- "/api/v1/tms/getShipLocationStatus?shipLocation=" +
- scope.row.shipLocation
- )
- .then(res => {
- // console.log(res.data.data);
- scope.row.locationStatus = res.data.data.locationStatus;
- });
- },
- initialization() {
- this.axios.post("/api/v1/tms/getShipLocationList").then(res => {
- if (res.data.code == "200") {
- this.selectionList = res.data.data;
- }
- });
- },
- onclick() {
- this.value = sjTime(this.value);
- this.axios
- .post("/api/v1/tms/getShipLocationList", { dayTime: this.value })
- .then(res => {
- if (res.data.code == "200") {
- this.selectionList = res.data.data;
- }
- });
- },
- click(row) {
- this.axios.post("/api/v1/tms/updateShipLocation", row).then(res => {
- if (res.data.code == "200") {
- this.$message({
- type: "success",
- message: "保存成功!"
- });
- this.initialization();
- }
- });
- }
- }
- };
- </script>
- <style lang="scss">
- .homeworkPath {
- .top {
- padding: 1.25rem 1.875rem;
- }
- }
- </style>
|