TblDepotOutList.vue 19.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 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 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="品名">
              <j-input placeholder="请输入品名" v-model="queryParam.productName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="工作令">
              <j-input placeholder="请输入工作令" v-model="queryParam.workOrder"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="4" :lg="5" :md="6" :sm="24">
            <a-form-item label="采购性质">
              <j-dict-select-tag placeholder="请选择采购性质" v-model="queryParam.buyingClassify" dictCode="buying_classify" />
            </a-form-item>
          </a-col>
          <template v-if="toggleSearchStatus">
            <a-col :xl="8" :lg="9" :md="10" :sm="24">
              <a-form-item label="出库时间">
                <j-date placeholder="请选择开始日期" class="query-group-cust" v-model="queryParam.operTime_begin"></j-date>
                <span class="query-group-split-cust"></span>
                <j-date placeholder="请选择结束日期" class="query-group-cust" v-model="queryParam.operTime_end"></j-date>
              </a-form-item>
            </a-col>
          </template>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'" />
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button @click="callRobot" type="primary" icon="reddit">机器人召唤送物</a-button>
      <a-button @click="callRobotReturnToCabin" type="primary" icon="api">机器人返回舱位点</a-button>
      <a-button @click="callRobotGoCharge" type="primary" icon="api">机器人返回充电桩</a-button>
      <!-- <a-button @click="callRobotMoveShow" type="primary" icon="api">机器人取消任务</a-button>  -->
    </div>

    <!-- table区域-begin -->
    <div>
      <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div> -->
      <!-- :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" -->
      <a-table ref="table" size="middle" :scroll="{ x: true }" bordered rowKey="id" :columns="columns"
        :dataSource="dataSource" :pagination="ipagination" :loading="loading" class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
            style="max-width:80px;font-size: 12px;font-style: italic;" />
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button v-else :ghost="true" type="primary" icon="download" size="small" @click="downloadFile(text)">
            下载
          </a-button>
        </template>

        <span v-if="deleteFlg" slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <span>&nbsp;&nbsp;&nbsp;</span>
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>

      </a-table>
    </div>

    <tbl-depot-out-modal ref="modalForm" @ok="modalFormOk"></tbl-depot-out-modal>
    <a-modal v-model="showRobot" title="机器人任务" on-ok="handleOk" width="800px">
      <template slot="footer">
        <a-button key="back" @click="handleCancel">
          取消
        </a-button>
        <a-button key="submit" type="primary" :loading="loading" @click="handleOk">
          确定
        </a-button>
      </template>
      <!-- 召唤机器人送物 -->
      <a-form-model ref="form" :model="model" :rules="validatorRules" >
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="选择机器人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operTime">
              <a-select  size="small"  v-model="model.robotName"  placeholder="请选择机器人" allowClear>
                <a-select-option v-for="(item,index) in robotOptions" :key="index" :value="item.id">
                  <img :src="item.img" style="float: left; height: 16px; margin-top: 2px;margin-right: 10px;">
                  <span style="float: left">{{ item.value }}</span>
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="24" v-if="model.robotName === 'SCSK08C0450100861'"> 
            <a-form-model-item label="选择召唤点" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operTime">
              <a-select  size="small"  v-model="model.via"  placeholder="请选择召唤点" allowClear>
                <a-select-option v-for="(item,index) in pointOptions" :key="index" :value="item.pointId">
                  {{ item.pointName }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="24"> 
            <a-form-model-item label="选择目标点" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operTime">
              <a-select  size="small"  v-model="model.pointId"  placeholder="请选择目标点" allowClear>
                <a-select-option v-for="(item,index) in pointOptions" :key="index" :value="item.pointId">{{ item.pointName }}</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="24" v-if="model.robotName === 'SCWM00JS48YF01635'">
            <a-form-model-item label="输入超时时间(秒)" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="overtime">
              <a-input-number :min="0" placeholder="请输入超时时间(秒)" style="width: 250px;" v-model="model.overtime"></a-input-number>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-modal>
    <!-- 机器人返回舱位 -->
    <a-modal v-model="showRobot1" title="机器人返回舱位" on-ok="handleOk1" width="800px">
      <template slot="footer">
        <a-button key="back" @click="handleCancel1">
          取消
        </a-button>
        <a-button key="submit" type="primary" :loading="loading" @click="handleOk1">
          确定
        </a-button>
      </template>
      <a-form-model ref="form" :model="model" :rules="validatorRules" >
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="选择机器人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operTime">
              <a-select  size="small"  v-model="model.robotName"  placeholder="请选择机器人" allowClear>
                <a-select-option v-for="(item,index) in robotOptions" :key="index" :value="item.id">
                  <img :src="item.img" style="float: left; height: 16px; margin-top: 2px;margin-right: 10px;" >
                  <span style="float: left">{{ item.value }}</span>
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="选择机器人舱位点" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operTime">
              <a-select  size="small"  v-model="model.cabinId"  placeholder="请选择机器人舱位点" allowClear>
                <a-select-option v-for="(item,index) in cabinOptions" :key="index" :value="item.cabinId">{{ item.cabinName }}</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-modal>
    <a-modal v-model="callRobotMoveShowDialog" title="选择机器人动作" on-ok="handleOk2" width="800px">
      <template slot="footer">
        <a-button key="back" @click="handleCancel2">
          取消
        </a-button>
        <a-button key="submit" type="primary" :loading="loading" @click="handleOk2">
          确定
        </a-button>
      </template>
      <a-form-model ref="form" :model="model" :rules="validatorRules" >
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="选择机器人动作" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="operTime">
              <a-select  size="small"  v-model="model.option"  placeholder="请选择机器人" allowClear>
                <a-select-option v-for="(item,index) in cancleMoveOptions" :key="index" :value="item.id">{{ item.value }}</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-modal>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import TblDepotOutModal from './modules/TblDepotOutModal'
import { mapGetters } from 'vuex'
import {getRobotPoints,getRobotGoCharge} from '@/api/RobotPoints'
import {getRobotCabins} from '@/api/RobotCabin'
import { httpAction} from '@/api/manage'
export default {
  name: 'TblDepotOutList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    TblDepotOutModal
  },
  data() {
    return {
      deleteFlg:false,
      description: 'tbl_depot管理页面',
      toggleSearchStatus: true,
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '零件编号',
          align: "center",
          dataIndex: 'partNumber'
        },
        {
          title: '出库人',
          align: "center",
          dataIndex: 'createBy'
        },
        {
          title: '领料人',
          align: "center",
          dataIndex: 'ling'
        },
        {
          title: '领料环节',
          align: "center",
          dataIndex: 'lingSysOrgCode'
        },
        {
          title: '品名',
          align: "center",
          dataIndex: 'productName'
        },
        {
          title: '规格',
          align: "center",
          dataIndex: 'spec'
        },
        {
          title: '型号',
          align: "center",
          dataIndex: 'type'
        },
        {
          title: '采购性质',
          align: "center",
          dataIndex: 'buyingClassify'
        },
        {
          title: '数量',
          align: "center",
          dataIndex: 'operNumber'
        },
        {
          title: '工作令',
          align: "center",
          dataIndex: 'workOrder'
        },
        {
          title: '出库时间',
          align: "center",
          sorter: true,
          dataIndex: 'operTime',
          customRender: function (text) {
            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
          }
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          fixed: "right",
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      url: {
        list: "/depot/tblDepot/outList",
        delete: "/depot/tblDepot/delete",
        deleteBatch: "/depot/tblDepot/deleteBatch",
        exportXlsUrl: "/depot/tblDepot/exportXls",
        importExcelUrl: "depot/tblDepot/importExcel",
        callRobotMove: '/robotPoints/tblRobotPoints/movetoTarget',
        cancleRobotMove: '/robotPoints/tblRobotPoints/cancleMove',
      },
      dictOptions: {},
      superFieldList: [],
      model:{},
      confirmLoading: false,
      showRobot:false,
      showRobot1:false,
      loading: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      robotOptions:[
        {id:"SCWM00JS48YF01635",value:"开放收物上舱",img:require("../../assets/kaifangcang.png")},
        {id:"SCSK08C0450100861",value:"送物上舱",img:require("../../assets/kaifangcang.png")}
      ],
      cancleMoveOptions:[
      {id:"BACK_DEFAULT_ORIGIN",value:"取消后回充"},
      {id:"DONT_BACK_DEFAULT_ORIGIN",value:"取消后停留在原地"}
      ],
      callRobotMoveShowDialog: false,
      cabinOptions:[],
      pointOptions:[],
      // templateIdOptions:[
      // {id:"dock_cabin_to_move_and_lift_down",value:"调度底盘去某个上仓举起并移动到另外点位放下"},
      // {id:"docking_cabin_and_docking_down",value:"调度底盘移动上舱举起并移动到另外一个舱位放下"},
      // {id:"docking_cabin_and_move_target",value:"调度底盘移动上舱举起并移动到目标点"},
      // {id:"move_target_and_lift_down",value:"托举上舱移动到目的地并且放下上舱"},
      // {id:"dock_cabin_and_move_target_with_wait_action",value:"让某舱到某目的地"}
      // ],
      templateIdOptions:[
        {id:"docking_cabin_and_move_target",value:"上舱移动到目的地"},
      {id:"dock_cabin_to_move_and_lift_down",value:"上舱移动到目的地并放下上舱"},
      {id:"dock_cabin_and_move_target_with_wait_action",value:"上舱移动到目的地,超时返回"},
      {id:"docking_cabin_and_docking_down",value:"上舱移动到另外一个舱位并放下"},
      {id:"move_target_and_lift_down",value:"上舱移动到目的地并放下上舱"},
      ],
      validatorRules: {
        robotName: [{ required: true, message: '请选择机器人!' }],
        pointId: [{ required: true, message: '请选择目标点位!' }],
        templateId: [{ required: true, message: '请选择机器人任务!' }],
      },
    }
  },
  created() {
    this.getSuperFieldList();
    this.delete();
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  methods: {
    ...mapGetters(["nickname", "avatar", "userInfo"]),
    delete() {
      if (this.nickname() === '管理员') {
        this.deleteFlg = true;
      }
    },
    initDictConfig() {
    },
    getSuperFieldList() {
      let fieldList = [];
      fieldList.push({ type: 'string', value: 'partNumber', text: '零件编号', dictCode: '' })
      fieldList.push({ type: 'string', value: 'productName', text: '品名', dictCode: '' })
      fieldList.push({ type: 'string', value: 'spec', text: '规格', dictCode: '' })
      fieldList.push({ type: 'string', value: 'type', text: '型号', dictCode: '' })
      fieldList.push({ type: 'string', value: 'buyingClassify', text: '采购性质', dictCode: 'buying_classify' })
      fieldList.push({ type: 'int', value: 'operNumber', text: '数量', dictCode: '' })
      fieldList.push({ type: 'date', value: 'operTime', text: '出入库时间' })
      fieldList.push({ type: 'string', value: 'ling', text: '领料人' })
      this.superFieldList = fieldList
    },
    handleOk2(e) {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.confirmLoading = true
          let httpurl = ''
          let method = ''
            httpurl += this.url.cancleRobotMove
            method = 'post'
          // console.log(this.model)
          // console.log(httpurl)
          // return
          httpAction(httpurl, this.model, method)
            .then((res) => {
              if (res.success) {
                this.$message.success(res.message)
                this.$emit('ok')
              } else {
                this.$message.warning(res.message)
              }
            })
            .finally(() => {
              this.confirmLoading = false
              this.handleCancel2()
            })
        }
      })
    },
    handleCancel2(e) {
      this.callRobotMoveShowDialog = false;
      this.model ={}
    },
    callRobot(){
      this.showRobot = true;
      this.getRobotPoints()
      this.model = {}
    },
    callRobotReturnToCabin(){
      this.showRobot1 = true
      this.getRobotCabins()
    },
    getRobotPoints(){
        getRobotPoints().then((res)=>{
          // console.log('res===',res)
          if(res.success){
            this.pointOptions = res.result
          }
        });
    },
    getRobotCabins(){
        getRobotCabins().then((res)=>{
          console.log(res)
          if(res.success){
            this.cabinOptions = res.result
          }
        });
    },
    callRobotGoCharge(){
      getRobotGoCharge().then((res)=>{
          // console.log('res===',res)
          if (res.success) {
                this.$message.success(res.message)
                this.$emit('ok')
              } else {
                this.$message.warning(res.message)
              }
        });
    },
    handleChange(value) {
      console.log(this.model.cabinId);
      
    },
    handleOk(e) {
      // this.loading = true;
      // setTimeout(() => {
      //   this.showRobot = false;
      //   this.loading = false;
      // }, 3000);
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.model.templateId = 'dock_cabin_and_move_target_with_wait_action'
          this.confirmLoading = true
          let httpurl = ''
          let method = ''
            httpurl += this.url.callRobotMove
            method = 'post'
          console.log(this.model)
          // return
          httpAction(httpurl, this.model, method)
            .then((res) => {
              if (res.success) {
                this.$message.success(res.message)
                this.$emit('ok')
              } else {
                this.$message.warning(res.message)
              }
            })
            .finally(() => {
              // this.showRobot = false
              this.confirmLoading = false
              this.handleCancel()
            })
        }
      })
    },
    handleCancel(e) {
      this.showRobot = false;
      this.model = {}
    },
    handleOk1(e) {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.confirmLoading = true
          let httpurl = ''
          let method = ''
            httpurl += this.url.callRobotReturnToCabin
            method = 'post'
          // console.log(this.model)
          // return
          httpAction(httpurl, this.model, method)
            .then((res) => {
              if (res.success) {
                this.$message.success(res.message)
                this.$emit('ok')
              } else {
                this.$message.warning(res.message)
              }
            })
            .finally(() => {
              // this.showRobot1 = false
              this.confirmLoading = false
              this.handleCancel1()
            })
        }
      })
    },
    handleCancel1(e) {
      this.showRobot1 = false;
      this.model ={}
    },
    callRobotMoveShow(){
    this.callRobotMoveShowDialog = true
    },
  
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>