index.vue 19.7 KB
Newer Older
wanglianghe's avatar
wanglianghe committed
1 2 3 4 5
<template>
  <div class="app-container">

    <!-- 搜索工作栏 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
6 7
      <el-form-item :label="$t('城市名称')" prop="cityName">
        <el-input v-model="queryParams.cityName" :placeholder="$t('请输入城市名称')" clearable @keyup.enter.native="handleQuery"/>
wanglianghe's avatar
wanglianghe committed
8
      </el-form-item>
9 10
      <el-form-item :label="$t('关键词')" prop="keywords">
        <el-input v-model="queryParams.keywords" :placeholder="$t('请输入关键词')" clearable @keyup.enter.native="handleQuery"/>
wanglianghe's avatar
wanglianghe committed
11
      </el-form-item>
wanglianghe's avatar
wanglianghe committed
12
      
wanglianghe's avatar
wanglianghe committed
13
      <el-form-item>
14 15
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{$t('搜索')}}</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">{{$t('重置')}}</el-button>
wanglianghe's avatar
wanglianghe committed
16 17 18 19 20 21 22
      </el-form-item>
    </el-form>

    <!-- 操作工具栏 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
23
                   v-hasPermi="['ecw:node:create']">{{$t('新增')}}</el-button>
wanglianghe's avatar
wanglianghe committed
24
      </el-col>
25
      <!-- <el-col :span="1.5">
wanglianghe's avatar
wanglianghe committed
26
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
27
                   v-hasPermi="['ecw:node:export']">{{$t('导出')}}</el-button>
28
      </el-col> -->
wanglianghe's avatar
wanglianghe committed
29 30 31 32 33
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 列表 -->
    <el-table v-loading="loading" :data="list">
34 35 36 37
      <el-table-column :label="$t('排序')" align="center" prop="aorder" />
      <el-table-column :label="$t('网点编号')" align="center" prop="number" />
      <el-table-column :label="$t('网点名称')" align="center" :prop="$l('title')" />
      <el-table-column :label="$t('网点地址')" align="center" :prop="$l('address')" />
wanglianghe's avatar
wanglianghe committed
38

39
      <el-table-column prop="adminId" :label="$t('负责人')" align="center">
wanglianghe's avatar
wanglianghe committed
40 41
        <template slot-scope="scope">
          <div>
42
            <span>{{ scope.row.adminId ? scope.row.adminName : $t('未设置') }}</span>
wanglianghe's avatar
wanglianghe committed
43
            <br>
44
            <el-button v-if="!scope.row.adminId" type="text" size="mini" @click="setAdminClick(scope.row)">{{$t('设置主管')}}</el-button>
wanglianghe's avatar
wanglianghe committed
45 46 47 48
          </div>
        </template>
      </el-table-column>

49

50
      <el-table-column prop="status" :label="$t('状态')" width="100">
51 52 53 54
        <template slot-scope="scope">
          <el-switch v-model="scope.row.status" :active-value="CommonStatusEnum.ENABLE" :inactive-value="CommonStatusEnum.DISABLE" @change="handleStatusChange(scope.row)" />
        </template>
      </el-table-column>
wanglianghe's avatar
wanglianghe committed
55 56

     
57
      <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
wanglianghe's avatar
wanglianghe committed
58
        <template slot-scope="scope">
wanglianghe's avatar
wanglianghe committed
59
          <el-button size="mini" type="text" @click="warehouse(scope.row)"
60
                     v-hasPermi="['ecw:node:delete']">{{$t('仓库')}}</el-button>
wanglianghe's avatar
wanglianghe committed
61
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
62
                     v-hasPermi="['ecw:node:update']">{{$t('修改')}}</el-button>
wanglianghe's avatar
wanglianghe committed
63 64 65 66 67 68 69
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
                @pagination="getList"/>

wanglianghe's avatar
wanglianghe committed
70
    <!-- 设置主管对话框  -->
71
      <el-dialog :title="$t('设置主管')" :visible.sync="setAdminOpen" width="900px" append-to-body>
wanglianghe's avatar
wanglianghe committed
72
        <el-table  :data="userList">
73 74 75 76
        <el-table-column :label="$t('序号')" type="index" width="50" />
        <el-table-column :label="$t('用户名')" align="center" prop="username" />
        <el-table-column :label="$t('姓名')" align="center" prop="nickname" />
        <el-table-column :label="$t('手机号')" align="center" prop="mobile" />
wanglianghe's avatar
wanglianghe committed
77

78
        <el-table-column prop="loginDate" :label="$t('最近操作')" align="center">
wanglianghe's avatar
wanglianghe committed
79 80 81 82 83 84 85
          <template slot-scope="scope">
            <span>{{ new Date(scope.row.loginDate).format('yyyy-MM-dd hh:mm:ss')}}</span>
            <br>
            <span>{{scope.row.loginIp}}</span>
          </template>
        </el-table-column>
        
86
        <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
wanglianghe's avatar
wanglianghe committed
87 88
          <template slot-scope="scope">
            <el-button size="mini" type="text" icon="el-icon-edit" @click="setAdmin(scope.row)"
89
                      >{{$t('设为主管')}}</el-button>
wanglianghe's avatar
wanglianghe committed
90 91 92 93 94 95 96 97 98
          </template>
        </el-table-column>
      </el-table>

        <!-- 分页组件 -->
      <pagination v-show="userTotal > 0" :total="userTotal" :page.sync="userQueryParams.pageNo" :limit.sync="userQueryParams.pageSize"
                @pagination="getUserList"/>
    </el-dialog>

wanglianghe's avatar
wanglianghe committed
99
    <!-- 对话框(添加 / 修改) -->
wanglianghe's avatar
wanglianghe committed
100 101 102
    <el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">

103 104
        <el-form-item :label="$t('所在地区')" prop="area">
          <el-select v-model="form.zhou" :placeholder="$t('请选择大洲')" @change="changeContinents">
wanglianghe's avatar
wanglianghe committed
105 106 107
            <el-option
              v-for="item in continentsList"
              :key="item.id"
108
              :label="$l(item, 'title')"
wanglianghe's avatar
wanglianghe committed
109 110 111
              :value="item.id">
            </el-option>
          </el-select>
112
          <el-select v-model="form.guojia" :placeholder="$t('请选择国家')" @change="changeCountry" v-if="form.zhou">
wanglianghe's avatar
wanglianghe committed
113 114 115
            <el-option
              v-for="item in countryList"
              :key="item.id"
116
              :label="$l(item, 'title')"
wanglianghe's avatar
wanglianghe committed
117 118 119
              :value="item.id">
            </el-option>
          </el-select>
120
          <el-select v-model="form.sheng" :placeholder="$t('请选择省')" @change="changeProvince" v-if="form.guojia">
wanglianghe's avatar
wanglianghe committed
121 122 123
            <el-option
              v-for="item in provinceList"
              :key="item.id"
124
              :label="$l(item, 'title')"
wanglianghe's avatar
wanglianghe committed
125 126 127
              :value="item.id">
            </el-option>
          </el-select>
128
          <el-select v-model="form.shi" :placeholder="$t('请选择城市')" @change="changeCity" v-if="form.sheng">
wanglianghe's avatar
wanglianghe committed
129 130 131
            <el-option
              v-for="item in cityList"
              :key="item.id"
132
              :label="$l(item, 'title')"
wanglianghe's avatar
wanglianghe committed
133 134 135
              :value="item.id">
            </el-option>
          </el-select>
wanglianghe's avatar
wanglianghe committed
136
        </el-form-item>
wanglianghe's avatar
wanglianghe committed
137

138 139
        <el-form-item :label="$t('排序')" prop="aorder">
          <el-input v-model="form.aorder" :placeholder="$t('请输入排序')" />
wanglianghe's avatar
wanglianghe committed
140
        </el-form-item>
wanglianghe's avatar
wanglianghe committed
141

142 143
        <el-form-item :label="$t('网点编号')" prop="number">
          <el-input v-model="form.number" :placeholder="$t('请输入网点编号')" />
wanglianghe's avatar
wanglianghe committed
144
        </el-form-item>
wanglianghe's avatar
wanglianghe committed
145
        
146 147
        <el-form-item :label="$t('网点名称')" prop="titleZh">
          <el-input v-model="form.titleZh" :placeholder="$t('请输入网点名称')" />
wanglianghe's avatar
wanglianghe committed
148
        </el-form-item>
149 150
        <el-form-item :label="$t('英文名称')" prop="titleEn">
          <el-input v-model="form.titleEn" :placeholder="$t('请输入英文名称')" />
wanglianghe's avatar
wanglianghe committed
151
        </el-form-item>
152 153
        <el-form-item :label="$t('副名称')" prop="titlesZh">
          <el-input v-model="form.titlesZh" :placeholder="$t('请输入副名称')" />
wanglianghe's avatar
wanglianghe committed
154
        </el-form-item>
155 156
         <el-form-item :label="$t('英文副名称')" prop="titlesEn">
          <el-input v-model="form.titlesEn" :placeholder="$t('请输入英文副名称')" />
wanglianghe's avatar
wanglianghe committed
157
        </el-form-item>
158 159
        <el-form-item :label="$t('网点地址')" prop="addressZh">
          <el-input v-model="form.addressZh" :placeholder="$t('请输入网点地址')" />
wanglianghe's avatar
wanglianghe committed
160
        </el-form-item>
161 162
        <el-form-item :label="$t('英文地址')" prop="addressEn">
          <el-input v-model="form.addressEn" :placeholder="$t('请输入英文地址')" />
wanglianghe's avatar
wanglianghe committed
163
        </el-form-item>
wanglianghe's avatar
wanglianghe committed
164

165 166
        <el-form-item :label="$t('网点属性')" prop="tradeType">
          <el-select v-model="form.tradeType" :placeholder="$t('请选择')">
wanglianghe's avatar
wanglianghe committed
167 168 169 170
            <el-option v-for="dict in regionTypeDatas" :key="dict.value" :label="dict.label" :value="dict.value"/>
          </el-select>
          </el-form-item>

171
       <el-form-item :label="$t('服务内容')" prop="checkList">
wanglianghe's avatar
wanglianghe committed
172
          <el-checkbox-group v-model="form.checkList">
173
            <el-checkbox v-for="dict in transportDatas" :label="dict.value" :key="dict.value" :value="dict.value" name="freight"> {{$l(dict, 'label')}}</el-checkbox>
wanglianghe's avatar
wanglianghe committed
174
          </el-checkbox-group>
175
        </el-form-item>  
wanglianghe's avatar
wanglianghe committed
176
        
177
        <el-form-item :label="$t('网点详情')" prop="contentZh">
178
          <editor v-model="form.contentZh" :min-height="150"/>
wanglianghe's avatar
wanglianghe committed
179
        </el-form-item>
180
        <el-form-item :label="$t('英文详情')" prop="contentEn">
181
          <editor v-model="form.contentEn" :min-height="150"/>
wanglianghe's avatar
wanglianghe committed
182
        </el-form-item>
wanglianghe's avatar
wanglianghe committed
183 184
        
        
185 186
        <el-form-item :label="$t('上班时间')" prop="worktime">
          <el-input v-model="form.worktime" :placeholder="$t('请输入上班时间')" />
wanglianghe's avatar
wanglianghe committed
187
        </el-form-item>
wanglianghe's avatar
wanglianghe committed
188 189
       
        
wanglianghe's avatar
wanglianghe committed
190 191
      </el-form>
      <div slot="footer" class="dialog-footer">
192 193
        <el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button>
        <el-button @click="cancel">{{$t('取消')}}</el-button>
wanglianghe's avatar
wanglianghe committed
194 195 196 197 198 199 200
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { createNode, updateNode, deleteNode, getNode, getNodePage, exportNodeExcel } from "@/api/ecw/node";
wanglianghe's avatar
wanglianghe committed
201 202 203
import { getListTree } from "@/api/ecw/region";
import { getDictDatas, DICT_TYPE } from '@/utils/dict';
import {CommonStatusEnum} from '@/utils/constants'
wanglianghe's avatar
wanglianghe committed
204
import {listUser} from "@/api/system/user";
205
import Editor from '@/components/Editor';
dragondean@qq.com's avatar
dragondean@qq.com committed
206
  
wanglianghe's avatar
wanglianghe committed
207 208 209
export default {
  name: "Node",
  components: {
210
    Editor,
wanglianghe's avatar
wanglianghe committed
211 212
  },
  data() {
dragondean@qq.com's avatar
dragondean@qq.com committed
213
    const areaCheck = (rule, value, callback) => {
wanglianghe's avatar
wanglianghe committed
214
        if(!this.form.zhou) {
215
          callback(new Error(this.$t('请选择大洲')));
wanglianghe's avatar
wanglianghe committed
216
        } else if(!this.form.guojia){
217
          callback(new Error(this.$t('请选择国家/地区')));
wanglianghe's avatar
wanglianghe committed
218
        } else if(!this.form.sheng){
219
          callback(new Error(this.$t('请选择省市')));
wanglianghe's avatar
wanglianghe committed
220 221 222 223
        } else {
          callback();
        }
    };
wanglianghe's avatar
wanglianghe committed
224 225 226 227 228 229 230 231 232
    return {
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
wanglianghe's avatar
wanglianghe committed
233 234 235 236 237 238 239 240 241
      //洲际列表
      continentsList:[],
      //国家列表
      countryList:[],
      //省信息列表
      provinceList: [],
      //市信息列表
      cityList: [],

wanglianghe's avatar
wanglianghe committed
242 243 244 245 246 247
      // 服务网点列表
      list: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
wanglianghe's avatar
wanglianghe committed
248 249 250 251 252 253 254 255 256 257 258

      //社否显示设置主管
      updateRow:null,
      userList:[],
      userTotal: 0,
      setAdminOpen: false,
      userQueryParams: {
        pageNo: 1,
        pageSize: 10
      },

wanglianghe's avatar
wanglianghe committed
259 260 261 262
      dateRangeCreateTime: [],
      // 查询参数
      queryParams: {
        pageNo: 1,
wanglianghe's avatar
wanglianghe committed
263
        pageSize: 10
wanglianghe's avatar
wanglianghe committed
264 265
      },
      // 表单参数
266
      form: {
wanglianghe's avatar
wanglianghe committed
267
        checkList:[],
268
      },
wanglianghe's avatar
wanglianghe committed
269 270
      // 表单校验
      rules: {
wanglianghe's avatar
wanglianghe committed
271
        area: [{ validator:areaCheck, required: true, trigger: "blur" }],
272 273 274 275 276 277 278 279 280 281 282 283
        aorder: [{ required: true, message: this.$t("排序不能为空"), trigger: "blur" }],
        number: [{ required: true, message: this.$t("网点编号不能为空"), trigger: "blur" }],
        titleZh: [{ required: true, message: this.$t("网点名称不能为空"), trigger: "blur" }],
        titleEn: [{ required: true, message: this.$t("英文名称不能为空"), trigger: "blur" }],
        titlesZh: [{ required: true, message: this.$t("副名称不能为空"), trigger: "blur" }],
        titlesEn: [{ required: true, message: this.$t("英文副名称不能为空"), trigger: "blur" }],
        addressZh: [{ required: true, message: this.$t("网点地址不能为空"), trigger: "blur" }],
        addressEn: [{ required: true, message: this.$t("英文地址不能为空"), trigger: "blur" }],
        contentZh: [{ required: true, message: this.$t("网点详情不能为空"), trigger: "blur" }],
        contentEn: [{ required: true, message: this.$t("英文详情不能为空"), trigger: "blur" }],
        worktime: [{ required: true, message: this.$t("上班时间不能为空"), trigger: "blur" }],
        tradeType: [{ required: true, message: this.$t('请选择网点属性'), trigger: 'change' }],
wanglianghe's avatar
wanglianghe committed
284
        checkList: [
285
            { type: 'array', required: true, message: this.$t('请至少选择一个服务内容'), trigger: 'change' }
wanglianghe's avatar
wanglianghe committed
286 287 288 289 290 291 292 293 294 295
          ],
      },

      // 枚举
      CommonStatusEnum: CommonStatusEnum,
      // 数据字典
      statusDictDatas: getDictDatas(DICT_TYPE.COMMON_STATUS),
      regionTypeDatas: getDictDatas(DICT_TYPE.ECW_REGION_TYPE),
      transportDatas: getDictDatas(DICT_TYPE.ECW_TRANSPORT_TYPE)

wanglianghe's avatar
wanglianghe committed
296 297 298 299
    };
  },
  created() {
    this.getList();
wanglianghe's avatar
wanglianghe committed
300
    this.getContinentsList();
wanglianghe's avatar
wanglianghe committed
301
  },
wanglianghe's avatar
wanglianghe committed
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325

  watch: {
      'form.zhou'(newV, oldV) {
        if(oldV && oldV != newV) {
            this.form.guojia = null;
            this.form.sheng = null;
            this.form.shi = null;
        }
      },

      'form.guojia'(newV, oldV) {
          if(oldV && oldV != newV) {
            this.form.sheng = null;
            this.form.shi = null;
          }
      },

      'form.sheng'(newV, oldV) {
          if(oldV && oldV != newV) {
            this.form.shi = null;
          }
      }
    },

wanglianghe's avatar
wanglianghe committed
326 327 328 329 330 331 332 333 334 335 336 337 338 339
  methods: {
    /** 查询列表 */
    getList() {
      this.loading = true;
      // 处理查询参数
      let params = {...this.queryParams};
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
      // 执行查询
      getNodePage(params).then(response => {
        this.list = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
wanglianghe's avatar
wanglianghe committed
340

wanglianghe's avatar
wanglianghe committed
341 342 343 344
    //跳转仓库
    warehouse(row) {
        let nodeId = row.id;
        this.$router.push({
wanglianghe's avatar
wanglianghe committed
345
          path:'/node/warehouse-list',
wanglianghe's avatar
wanglianghe committed
346 347 348 349 350 351
          query: {
            nodeId:nodeId
          }
        })
    },

wanglianghe's avatar
wanglianghe committed
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
    //获取用户列表
    getUserList() {
        listUser(this.userQueryParams).then(response => {
            this.userList = response.data.list;
            this.userTotal = response.data.total;
        });
    },

    //设置主管
    setAdminClick(row) {
      this.updateRow = row;
      this.setAdminOpen = true;
      this.getUserList();
    },

    setAdmin(user) {
        this.updateRow.adminId = user.id;
        updateNode(this.updateRow).then(() => {
         this.$set(this.updateRow, 'adminName', user.nickname);
371
         this.$modal.msgSuccess(this.$t("设置成功"));
wanglianghe's avatar
wanglianghe committed
372 373
         this.setAdminOpen = false;
      }).catch(function() {
374
         this.$modal.msgSuccess(this.$t("设置失败"));
wanglianghe's avatar
wanglianghe committed
375 376 377
      });
    },

wanglianghe's avatar
wanglianghe committed
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
    getContinentsList() {
        this.queryParams.treeType = 0;
        getListTree(this.queryParams).then(response => {
          this.continentsList = response.data;
      });
    },

    changeContinents(zhou) {
      for(let index in this.continentsList) {
        let continent = this.continentsList[index];
        if(continent.id == zhou) {
          this.countryList = continent.children;
          return;
        }
      }
    },
    changeCountry(countryId) {
      for(let index in this.countryList) {
        let country = this.countryList[index];
        if(country.id == countryId) {
          this.provinceList = country.children;
          return;
        }
      }
    },
    changeProvince(provinceId) {
      for(let index in this.provinceList) {
        let province = this.provinceList[index];
        if(province.id == provinceId) {
          this.cityList = province.children;
          return;
        }
      }
    },

    changeCity(cityId) {
      for(let index in this.cityList) {
        let city = this.cityList[index];
        if(city.id == cityId) {
          
          return;
        }
      }
    },

423
    handleStatusChange(row) {
424
      let text = row.status === CommonStatusEnum.ENABLE ? this.$t("启用") : this.$t("停用");
wanglianghe's avatar
wanglianghe committed
425
      this.$modal.confirm(this.$t('确认要{action}编号为{id}的数据吗?', {action: text, id: row.id})).then(function() {
426 427 428
        return updateNode(row);

      }).then(() => {
429
        this.$modal.msgSuccess(text + ' ' + this.$t("成功"));
430 431 432 433 434 435
      }).catch(function() {
        row.status = row.status === CommonStatusEnum.ENABLE ? CommonStatusEnum.DISABLE
          : CommonStatusEnum.ENABLE;
      });
    },

wanglianghe's avatar
wanglianghe committed
436

wanglianghe's avatar
wanglianghe committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
    /** 取消按钮 */
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 表单重置 */
    reset() {
      this.form = {
        id: undefined,
        number: undefined,
        zhou: undefined,
        guojia: undefined,
        sheng: undefined,
        shi: undefined,
        titleZh: undefined,
        titleEn: undefined,
        titlesZh: undefined,
        titlesEn: undefined,
        contentZh: undefined,
        contentEn: undefined,
        addressZh: undefined,
        addressEn: undefined,
wanglianghe's avatar
wanglianghe committed
459
        tradeType: undefined,
wanglianghe's avatar
wanglianghe committed
460 461 462 463
        freight: undefined,
        worktime: undefined,
        adminId: undefined,
        aorder: undefined,
wanglianghe's avatar
wanglianghe committed
464
        checkList: []
wanglianghe's avatar
wanglianghe committed
465
        
wanglianghe's avatar
wanglianghe committed
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNo = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRangeCreateTime = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
484
      this.title = this.$t("添加服务网点");
wanglianghe's avatar
wanglianghe committed
485 486 487 488 489 490 491
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id;
      getNode(id).then(response => {
        this.form = response.data;
492 493 494 495 496

        this.changeContinents(response.data.zhou);
        this.changeCountry(response.data.guojia);
        this.changeProvince(response.data.sheng);

wanglianghe's avatar
wanglianghe committed
497 498
        let ckList = response.data.freight.split(',');
        this.$set(this.form, 'checkList', ckList);
499

wanglianghe's avatar
wanglianghe committed
500
        this.open = true;
501
        this.title = this.$t("修改服务网点");
wanglianghe's avatar
wanglianghe committed
502 503 504 505 506 507 508 509
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (!valid) {
          return;
        }
wanglianghe's avatar
wanglianghe committed
510

wanglianghe's avatar
wanglianghe committed
511 512 513
        console.log(this.form);
        // return;

wanglianghe's avatar
wanglianghe committed
514 515
      //逗号拼接运输方式
      var freight = ''
wanglianghe's avatar
wanglianghe committed
516 517
      for(let i = 0; i < this.form.checkList.length; i++) {
            freight += this.form.checkList[i] + ','
wanglianghe's avatar
wanglianghe committed
518 519 520 521
          }
      freight = freight.substring(0, freight.length - 1);
      this.form.freight = freight;

wanglianghe's avatar
wanglianghe committed
522 523 524
        // 修改的提交
        if (this.form.id != null) {
          updateNode(this.form).then(response => {
525
            this.$modal.msgSuccess(this.$t("修改成功"));
wanglianghe's avatar
wanglianghe committed
526 527 528 529 530 531 532
            this.open = false;
            this.getList();
          });
          return;
        }
        // 添加的提交
        createNode(this.form).then(response => {
533
          this.$modal.msgSuccess(this.$t("新增成功"));
wanglianghe's avatar
wanglianghe committed
534 535 536 537 538 539 540 541
          this.open = false;
          this.getList();
        });
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const id = row.id;
542
      this.$modal.confirm(this.$t('是否确认删除服务网点编号为{id}的数据项?', {id})).then(function() {
wanglianghe's avatar
wanglianghe committed
543 544 545
          return deleteNode(id);
        }).then(() => {
          this.getList();
546
          this.$modal.msgSuccess(this.$t("删除成功"));
wanglianghe's avatar
wanglianghe committed
547 548 549 550 551 552 553 554 555 556
        }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      // 处理查询参数
      let params = {...this.queryParams};
      params.pageNo = undefined;
      params.pageSize = undefined;
      this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
      // 执行导出
557
      this.$modal.confirm(this.$t('是否确认导出所有服务网点数据项?')).then(() => {
wanglianghe's avatar
wanglianghe committed
558 559 560 561 562 563 564 565 566 567
          this.exportLoading = true;
          return exportNodeExcel(params);
        }).then(response => {
          this.$download.excel(response, '${table.classComment}.xls');
          this.exportLoading = false;
        }).catch(() => {});
    }
  }
};
</script>