| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686 |
- <template>
- <basic-container>
- <avue-crud
- :option="option"
- :search.sync="search"
- v-model="form"
- :table-loading="loading"
- :data="dataList"
- ref="crud"
- :key="key"
- :before-open="beforeOpen"
- @on-load="onLoad"
- @row-save="rowSave"
- @row-update="(row,index,done,loading)=>{rowSave(row,done,loading,index)}"
- @search-change="searchChange"
- :upload-delete="uploadDelete"
- :before-close="beforeClose"
- @row-del="rowDel"
- @refresh-change="refreshChange"
- @resetColumn="resetColumnTwo('crud','option','optionList',234)"
- @saveColumn="saveColumnTwo('crud','option','optionList',234)"
- :page.sync="page">
- <template slot-scope="scope" slot="menuLeft">
- <el-button type="success" size="small" icon="el-icon-bottom" @click="excelBox = true">导入
- </el-button>
- <el-button type="warning"
- icon="el-icon-download"
- size="small"
- @click="outExport">导出
- </el-button>
- </template>
- <template slot-scope="{type,size,row,index,disabled}" slot="code">
- <span class="el-button--text" style="cursor: pointer" @click="track(row)">{{row.code}}</span>
- </template>
- <template slot="leasingCompanyIdForm">
- <crop-select v-model="form.leasingCompanyId" disabled @getCorpData="getGSData" corpType="KH"/>
- </template>
- <template slot="addressIdForm">
- <port-info v-model="form.addressId" type="id" @balabalaTow="balabala"/>
- </template>
- <template slot="addressIdSearch">
- <port-info v-model="search.addressId" type="id"/>
- </template>
- <template slot="addressId" slot-scope="{row}">
- {{ row.address }}
- </template>
- <template slot="leasingCompanyIdSearch">
- <crop-select v-model="search.leasingCompanyId" corpType="KH"/>
- </template>
- <template slot="leasingCompanyId" slot-scope="{row}">
- {{ row.leasingCompany }}
- </template>
- </avue-crud>
- <el-dialog title="导入箱档案" append-to-body :visible.sync="excelBox" width="555px" :close-on-click-modal="false"
- v-dialog-drag>
- <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading"
- :upload-before="uploadBefore" :upload-after="uploadAfter">
- <template slot="excelTemplate">
- <el-button type="primary" @click="derivation">
- 点击下载<i class="el-icon-download el-icon--right"></i>
- </el-button>
- </template>
- </avue-form>
- <p style="text-align: center;color: #DC0505">
- 温馨提示 第一次导入时请先下载模板
- </p>
- </el-dialog>
- <el-dialog
- title="箱轨迹"
- :visible.sync="boxTrack"
- :append-to-body="true"
- :destroy-on-close="true"
- :close-on-click-modal="false"
- v-if="boxTrack"
- top="1vh"
- width="80%">
- <span>
- <avue-crud
- ref="crudTrack"
- :option="optionTrack"
- :data="dataTrackList"
- :search.sync="searchTwo"
- :page.sync="pageTwo"
- :table-loading="loadingTwo"
- @on-load="onLoadTrack"
- @search-change="searchChangeTwo"
- @row-update="rowUpdateTrack"
- @resetColumn="resetColumnTwo('crudTrack','optionTrack','optionTrackBack',234.1)"
- @saveColumn="saveColumnTwo('crudTrack','optionTrack','optionTrackBack',234.1)"
- v-model="formTrack">
- <template slot-scope="{type,size,row,index,disabled}" slot="menu">
- <el-button icon="el-icon-edit" :size="size" :disabled="disabled" :type="type"
- @click="$refs.crudTrack.rowEdit(row,index)">编辑
- </el-button>
- <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
- @click="rowDel(row,index,'GJ')">删除
- </el-button>
- </template>
- </avue-crud>
- </span>
- </el-dialog>
- </basic-container>
- </template>
- <script>
- import {addUpdate, boxRemove, getList, remove} from "@/api/box/archives";
- import {getToken} from "@/util/auth";
- import {getAllBoxs} from "@/api/basicData/portinformation";
- import {archivestrajectory, update} from "@/api/boxManagement/exportShipment";
- export default {
- name: "archives",
- data() {
- return {
- boxTrack: false,
- dataTrackList:[],
- searchTwo:{},
- formTrack: {},
- optionTrack: {},
- optionTrackBack: {
- align: 'center',
- index: true,
- menu:false,
- addBtnText: "录入明细",
- refreshBtn: false,
- addBtn: false,
- span: 8,
- searchMenuPosition: "right",
- searchSpan: 8,
- searchIcon: true,
- searchIndex: 2,
- addRowBtn: false,
- cellBtn: false,
- editBtn: false,
- delBtn: false,
- menuWidth: 200,
- dialogTop: 25,
- dialogWidth: "80%",
- column: [{
- label: '箱号',
- prop: 'code',
- overHidden: true,
- remote: true,
- filterable: true,
- type: "select",
- dicUrl: "/api/blade-box-tube/archives/selectArchivesList?size=10¤t=1&code={{key}}",
- props: {
- label: "code",
- value: "code"
- },
- disabled: true
- }, {
- label: '地点',
- prop: 'address',
- overHidden: true,
- formProp: 'address',
- search: true
- }, {
- label: '日期',
- prop: 'newDate',
- search: true,
- searchProp: 'newDateList',
- overHidden: true,
- type: "date",
- searchRange: true,
- searchDefaultTime: ["00:00:00", "23:59:59"],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- }, {
- label: '应收',
- prop: 'collect',
- overHidden: true
- }, {
- label: '应付',
- prop: 'pay',
- overHidden: true
- }, {
- label: '业务类型',
- prop: 'billType',
- overHidden: true
- }, {
- label: '状态',
- prop: 'status',
- overHidden: true
- }]
- },
- excelBox: false,
- loading: false,
- search: {},
- form: {},
- excelForm: {},
- dataList: [],
- page: {
- pageSize: 20,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
- },
- pageTwo:{
- pageSize: 20,
- currentPage: 1,
- total: 0,
- pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
- },
- loadingTwo:false,
- excelOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- {
- label: "模板下载",
- prop: "excelTemplate",
- formslot: true,
- span: 24
- },
- {
- label: "模板上传",
- prop: "excelFile",
- type: "upload",
- drag: true,
- loadText: "模板上传中,请稍等",
- span: 24,
- propsHttp: {
- res: "data"
- },
- tip: "请上传 .xls,.xlsx 标准格式文件",
- action: "/api/blade-box-tube/archives/import-descParts-info"
- }
- ]
- },
- key: 0,
- option: {},
- optionList: {
- index: true,
- dialogDrag: true,
- span: 8,
- border: true,
- height:"auto",
- searchMenuPosition: "right",
- align: "center",
- searchSpan: 8,
- searchIcon: true,
- searchIndex: 2,
- highlightCurrentRow: true,
- dialogWidth: "70%",
- column: [{
- label: '合同号',
- prop: 'contractNo',
- width: 100,
- disabled:true,
- overHidden: true,
- search: true,
- },{
- label: '箱号',
- prop: 'code',
- width: 100,
- overHidden: true,
- filterable: true,
- remote: true,
- type: "select",
- search: true,
- allowCreate: true,
- dicUrl: "/api/blade-box-tube/archives/list?size=10¤t=1&code={{key}}",
- props: {
- label: "code",
- value: "code",
- res:"data.records"
- }
- }, {
- label: '箱类型',
- prop: 'typeId',
- width: 100,
- overHidden: true,
- search: true,
- filterable: true,
- type: 'select',
- dataType: 'string',
- props: {
- label: 'name',
- value: 'id'
- },
- dicUrl: '/api/blade-client/container/listMessage'
- }, {
- label: '最新地点',
- prop: 'addressId',
- width: 100,
- overHidden: true,
- search: true,
- }, {
- label: '最新日期',
- prop: 'newDate',
- width: 100,
- searchProp: 'newDateList',
- overHidden: true,
- search: true,
- type: "date",
- searchRange: true,
- searchDefaultTime: ["00:00:00", "23:59:59"],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- }, {
- label: '租赁公司',
- prop: 'leasingCompanyId',
- width: 100,
- overHidden: true,
- search: true,
- }, {
- label: '箱来源',
- prop: 'boxSource',
- width: 100,
- overHidden: true,
- search: true,
- filterable: true,
- type: 'select',
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_source",
- props: {
- label: "dictValue",
- value: "dictKey"
- }
- }, {
- label: '箱状态',
- prop: 'boxStatus',
- width: 100,
- overHidden: true,
- search: true,
- filterable: true,
- type: 'select',
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_status",
- props: {
- label: "dictValue",
- value: "dictKey"
- }
- }, {
- label: '租赁方式',
- prop: 'leaseMethod',
- width: 100,
- overHidden: true,
- filterable: true,
- type: 'select',
- disabled:true,
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=lease_method",
- props: {
- label: "dictValue",
- value: "dictKey"
- }
- }, {
- label: '空重(kg)',
- prop: 'emptyWeight',
- width: 100,
- overHidden: true,
- type: 'number',
- controls: false,
- }, {
- label: '毛重(kg)',
- prop: 'gorssWeight',
- width: 100,
- overHidden: true,
- type: 'number',
- controls: false,
- }, {
- label: '皮重(kg)',
- prop: 'tare',
- width: 100,
- overHidden: true,
- type: 'number',
- controls: false,
- }, {
- label: '装载重量(kg)',
- prop: 'loadingWeight',
- width: 100,
- overHidden: true,
- type: 'number',
- controls: false,
- }, {
- label: '容积(m³)',
- prop: 'volume',
- type: 'number',
- controls: false,
- overHidden: true,
- width: 100
- }, {
- label: '状态',
- width: 100,
- overHidden: true,
- search: true,
- filterable: true,
- prop: 'status',
- type: 'select',
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=box_archives_status",
- props: {
- label: "dictValue",
- value: "dictKey"
- }
- }, {
- label: '造箱公司',
- prop: 'boxMakingCompany',
- width: 100,
- overHidden: true,
- search: true,
- }, {
- label: '造箱日期',
- prop: 'boxMakingDate',
- searchProp: 'boxMakingDateList',
- width: 100,
- overHidden: true,
- search: true,
- type: "date",
- searchRange: true,
- searchDefaultTime: ["00:00:00", "23:59:59"],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- }, {
- label: '起租日期',
- prop: 'leaseCommencementDate',
- searchProp: 'leaseCommencementDateList',
- width: 100,
- overHidden: true,
- search: true,
- type: "date",
- disabled:true,
- searchRange: true,
- searchDefaultTime: ["00:00:00", "23:59:59"],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- }, {
- label: '购入日期',
- prop: 'purchaseDate',
- width: 100,
- overHidden: true,
- type: "date",
- disabled:true,
- searchRange: true,
- searchDefaultTime: ["00:00:00", "23:59:59"],
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss"
- }, {
- label: '箱龄(月)',
- prop: 'boxAge',
- overHidden: true,
- width: 100,
- }, {
- label: '出入场状态',
- prop: 'boxAccessStatus',
- overHidden: true,
- display:false,
- width: 100,
- }, {
- label: '照片',
- prop: 'filesList',
- width: 200,
- overHidden: true,
- type: 'upload',
- span: 24,
- listType: 'picture-card',
- tip: '只能上传jpg/png文件,且不超过500kb',
- propsHttp: {
- url: 'link',
- name: 'originalName',
- res: 'data'
- },
- action: '/api/blade-resource/oss/endpoint/put-file'
- }]
- }
- }
- },
- async created() {
- this.option = await this.getColumnData(this.getColumnName(234), this.optionList);
- this.optionTrack = await this.getColumnData(this.getColumnName(234.1), this.optionTrackBack);
- this.key++
- this.findObject(this.option.column, "typeId").change = ({value, column}) => {
- getAllBoxs().then(res => {
- for (let item of res.data.data) {
- if (value == item.id) {
- this.form.name = item.name
- }
- }
- })
- }
- let i = 0;
- this.option.column.forEach(item => {
- if (item.search) i++
- })
- if (i % 3 !== 0) {
- const num = 3 - Number(i % 3)
- this.option.searchMenuSpan = num * 8;
- this.option.searchMenuPosition = "right";
- }
- },
- methods: {
- track(row) {
- // this.dataTrackList = row
- this.formSearch = row
- this.boxTrack = true
- },
- rowUpdateTrack(form, index, done, loading) {
- update(form).then(res => {
- done()
- this.$message.success("操作成功")
- this.onLoadTrack(this.pageTwo, this.searchTwo)
- })
- },
- searchChangeTwo(params, done) {
- done();
- this.onLoadTrack(this.pageTwo, params)
- },
- onLoadTrack(page, params = {}) {
- params = {
- ...params,
- current: page.currentPage,
- size: page.pageSize,
- code: this.formSearch.code
- }
- this.loadingTwo = true
- archivestrajectory(params).then(res => {
- this.dataTrackList = res.data.data.records
- this.pageTwo.total = res.data.data.total
- this.loadingTwo = false
- }).finally(() => {
- this.loadingTwo = false
- })
- },
- //打开表单前
- beforeOpen(done,type){
- if (type === "add"){
- this.findObject(this.option.column, "typeId").value = this.$refs.crud.DIC.typeId.length>0?this.$refs.crud.DIC.typeId[0].id:''
- this.form.name = this.$refs.crud.DIC.typeId.length>0?this.$refs.crud.DIC.typeId[0].name:''
- this.findObject(this.option.column, "boxSource").value = this.$refs.crud.DIC.boxSource.length>0?this.$refs.crud.DIC.boxSource[0].dictKey:''
- this.findObject(this.option.column, "boxStatus").value = this.$refs.crud.DIC.boxStatus.length>0?this.$refs.crud.DIC.boxStatus[0].dictKey:''
- }
- done();
- },
- //导出
- outExport() {
- this.$confirm('是否导出当前所有箱档案?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let queryParams = this.search
- const routeData = this.$router.resolve({
- path: '/api/blade-box-tube/archives/export-archives-out', //跳转目标窗口的地址
- query: {
- 'Blade-Auth': getToken(),
- ...queryParams //括号内是要传递给新窗口的参数
- }
- })
- window.open(routeData.href.slice(1, routeData.href.length));
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消' //
- });
- })
- },
- derivation() {
- window.open(`/api/blade-box-tube/archives/export-archives-info?${this.website.tokenHeader}=${getToken()}`);
- },
- uploadBefore(file, done, loading) {
- loading = true;
- done();
- },
- uploadAfter(res, done, loading, column) {
- this.excelBox = false;
- this.$message.success("导入成功!");
- this.onLoad(this.page, this.search);
- loading = false;
- done();
- },
- balabala(val) {
- if (val === null) {
- this.form.address = ''
- } else {
- this.form.address = val.name
- }
- },
- getGSData(row) {
- this.form.leasingCompany = row.cname
- },
- //关闭弹窗前
- beforeClose(done, type) {
- this.onLoad(this.page, this.search)
- done()
- },
- //刷新
- refreshChange() {
- this.onLoad(this.page, this.search)
- },
- rowDel(form, index) {
- this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- remove(form.id).then(res => {
- this.$message({
- type: 'success',
- message: '删除成功!'
- });
- this.onLoad(this.page, this.search)
- })
- }).catch(() => {
- });
- },
- uploadDelete(file, column) {
- return new Promise((resolve, reject)=>{
- this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- if (this.form.filesList[file.uid].id){
- boxRemove(this.form.filesList[file.uid].id).then(res => {
- this.$message({
- type: 'success',
- message: '删除成功!'
- });
- resolve();
- })
- }else {
- resolve();
- }
- }).catch(()=>{
- reject();
- this.$message({
- type: "info",
- message: "已取消删除"
- });
- })
- })
- },
- rowSave(form, done, loading, index) {
- done()
- addUpdate(form).then(res => {
- this.onLoad(this.page, this.search)
- })
- },
- searchChange(params, done) {
- done();
- this.onLoad(this.page, params)
- },
- onLoad(page, params = {}) {
- params = {
- ...params,
- current: page.currentPage,
- size: page.pageSize,
- ...Object.assign(params, this.search)
- }
- this.loading = true
- getList(params).then(res => {
- this.dataList = res.data.data.records
- this.page.total = res.data.data.total
- this.loading = false
- }).finally(() => {
- this.loading = false
- })
- },
- //自定义列保存
- async saveColumnTwo(ref, option, optionBack, code) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- //自定义列重置
- async resetColumnTwo(ref, option, optionBack, code) {
- this[option] = this[optionBack];
- const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
- if (inSave) {
- this.$message.success("重置成功");
- this.$refs[ref].$refs.dialogColumn.columnBox = false;
- }
- },
- }
- }
- </script>
- <style scoped>
- </style>
|