| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <template>
- <div>
- <basic-container>
- <!-- @resetColumn="resetColumn('crud', 'option', 'optionBack', 458)"-->
- <!-- @saveColumn="saveColumn('crud', 'option', 'optionBack', 458)"-->
- <avue-crud
- :option="option"
- :data="dataList"
- ref="crud"
- v-model="form"
- :page.sync="page"
- :search.sync="search"
- :table-loading="loading"
- @search-change="searchChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad"
- @selection-change="selectionChange"
- >
- <template slot="menu" slot-scope="{ row, index }">
- <!-- <el-button v-if="row.locked==0" type="text" icon="el-icon-unlock" size="small" @click="rowUnlock(row, index)">加锁</el-button> -->
- <!-- <el-button v-if="row.locked==1" type="text" icon="el-icon-unlock" size="small" @click="rowOnlock(row, index)">解锁</el-button> -->
- <el-button v-if="row.locked == 0" type="text" icon="el-icon-unlock" size="small" @click="allClick(row)">解锁</el-button>
- <el-button :disabled="row.locked != 0" type="text" icon="el-icon-delete" size="small" @click="rowDel(row, index)">删除</el-button>
- </template>
- <template slot="menuLeft">
- <el-button type="primary" size="small" @click="allClick()" :disabled="selectionList.length == 0">一键解锁 </el-button>
- </template>
- </avue-crud>
- </basic-container>
- </div>
- </template>
- <script>
- import option from "./config/mainList.json";
- import { lockList, lockRemove, unLock } from "@/api/lock/businessUnlocking";
- import { getWorkDicts } from "@/api/system/dictbiz";
- export default {
- name: "index",
- data() {
- return {
- selectionList: [],
- option: {},
- optionBack: {
- height: "auto",
- calcHeight: 30,
- menuWidth: 120,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- addBtn: false,
- viewBtn: false,
- editBtn: false,
- delBtn: false,
- selection: true,
- searchIcon: true,
- align: "center",
- searchIndex: 4,
- column: [
- {
- label: "业务编号",
- prop: "srcBillNo",
- width: 120,
- search: true,
- overHidden: true,
- sortable: true
- },
- {
- label: "单据日期",
- prop: "billDate",
- width: 120,
- overHidden: true,
- search: true,
- searchProp: "billDateList",
- type: "date",
- unlinkPanels: true,
- searchRange: true,
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- searchDefaultTime: ["00:00:00", "23:59:59"],
- sortable: true
- },
- {
- label: "船名",
- prop: "srcVesselEnName",
- width: 120,
- overHidden: true,
- search: true,
- sortable: true
- },
- {
- label: "航次",
- prop: "srcVoyageNo",
- width: 120,
- overHidden: true,
- search: true,
- sortable: true
- },
- {
- label: "MBLNO",
- prop: "srcMblno",
- width: 120,
- overHidden: true,
- search: true,
- sortable: true
- },
- {
- label: "Reference",
- prop: "rcRefno",
- width: 120,
- overHidden: true,
- search: true,
- sortable: true
- },
- {
- label: "加解锁操作时间",
- prop: "lockedTime",
- width: 120,
- overHidden: true,
- sortable: true
- },
- {
- label: "累计已解锁次数",
- prop: "unlockedCount",
- width: 120,
- overHidden: true
- },
- {
- label: "操作人",
- prop: "operatorName",
- width: 120,
- overHidden: true
- },
- {
- label: "业务类型",
- prop: "businessTypeName",
- width: 120,
- search: true,
- overHidden: true,
- sortable: true
- }
- ]
- },
- dataList: [],
- form: {},
- page: {
- pageSize: 10,
- pagerCount: 5,
- total: 0
- },
- search: {},
- loading: false
- };
- },
- async created() {
- // this.option = await this.getColumnData(this.getColumnName(458), this.optionBack);
- this.option = this.optionBack;
- },
- filters: {
- moudleNameFormat(row, moudleOption) {
- let name;
- moudleOption.map(e => {
- if (row == e.dictKey) {
- name = e.dictValue;
- }
- });
- return name;
- }
- },
- methods: {
- selectionChange(list) {
- this.selectionList = list;
- },
- searchChange(params, done) {
- this.onLoad(this.page, params);
- done();
- },
- currentChange(val) {
- this.page.currentPage = val;
- },
- sizeChange(val) {
- this.page.currentPage = 1;
- this.page.pageSize = val;
- },
- refreshChange() {
- this.onLoad(this.page, this.search);
- },
- onLoad(page, params) {
- this.dataList.forEach(item => {
- this.$refs.crud.toggleRowExpansion(item, false);
- });
- this.loading = true;
- lockList(page.currentPage, page.pageSize, params)
- .then(res => {
- this.dataList = res.data.data.records ? res.data.data.records : [];
- this.page.total = res.data.data.total;
- if (this.page.total) {
- this.option.height = window.innerHeight - 260;
- }
- this.dataList.forEach(item => {
- this.$set(item, "insideList", []);
- this.$set(item, "loading", true);
- });
- this.$nextTick(() => {
- this.$refs.crud.refreshTable();
- });
- })
- .finally(() => {
- this.loading = false;
- });
- },
- rowDel(row) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- lockRemove({ ids: row.id }).then(res => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
- });
- },
- // 解锁
- rowUnlock(row, index) {
- this.$confirm("是否确认解锁?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.onLoad(this.page, this.search);
- });
- },
- //加锁
- rowOnlock(row, index) {
- this.$confirm("是否确认加锁?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.onLoad(this.page, this.search);
- });
- },
- allClick(row) {
- let arr = [];
- let ids = null;
- if (row) {
- arr.push(row.id);
- } else {
- this.selectionList.forEach(e => {
- if (e.locked == 0) {
- arr.push(e.id);
- }
- });
- }
- if (arr.length == 0) {
- this.$message.warning("请勾选未解锁的业务!");
- return;
- }
- console.log(arr);
- ids = arr.join(",");
- // this.$confirm("是否确认解锁?", "提示", {
- // confirmButtonText: "确定",
- // cancelButtonText: "取消",
- // type: "warning"
- // }).then(() => {
- unLock({ ids: ids }).then(() => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.page.currentPage = 1;
- this.onLoad(this.page, { parentId: 0 });
- });
- // })
- },
- //自定义列保存
- async saveColumn(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;
- this.searchReset();
- }
- },
- //自定义列重置
- async resetColumn(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;
- this.searchReset();
- }
- }
- }
- };
- </script>
- <style scoped></style>
|