| New file |
| | |
| | | <template> |
| | | <div class="mod-transport"> |
| | | <avue-crud |
| | | ref="crud" |
| | | :page.sync="page" |
| | | :data="dataList" |
| | | :option="tableOption" |
| | | @search-change="searchChange" |
| | | @selection-change="selectionChange" |
| | | :cell-class-name="addClasscolor" |
| | | @refresh-change="refreshChange" |
| | | @on-load="getDataList" |
| | | > |
| | | <template slot="menuLeft"> |
| | | <!-- 搜索 --> |
| | | <el-form |
| | | :inline="true" |
| | | :model="dataForm" |
| | | @keyup.enter.native="getDataList(this.page)" |
| | | > |
| | | <el-form-item label="订单号:" label-width="72px"> |
| | | <el-input |
| | | v-model="search.OrderID" |
| | | placeholder="订单号" |
| | | clearable |
| | | ></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="用户名:" label-width="72px"> |
| | | <el-input |
| | | v-model="search.userName" |
| | | placeholder="用户名" |
| | | clearable |
| | | ></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="币对:" label-width="72px"> |
| | | <avue-select |
| | | v-model="search.symbol" |
| | | placeholder="请选择" |
| | | :dic="options" |
| | | ></avue-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="成交状态:" label-width="72px"> |
| | | <el-select v-model="search.OrderStatus" placeholder="请选择"> |
| | | <el-option label="全部" value=""></el-option> |
| | | <el-option label="已提交" value="submitted"></el-option> |
| | | <el-option label="委托完成" value="created"></el-option> |
| | | <el-option label="已撤销" value="canceled"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button |
| | | type="primary" |
| | | icon="el-icon-search" |
| | | size="small" |
| | | @click="getDataList()" |
| | | >查询</el-button |
| | | > |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | | |
| | | <template slot-scope="scope" slot="TransactionEngineStatus"> |
| | | <span |
| | | v-if="isAuth('commodity-spots:operate')" |
| | | class="speacButton" @click="TransactionEngineStatus(scope.row)" |
| | | >查看</span |
| | | > |
| | | </template> |
| | | |
| | | <template slot-scope="scope" slot="menu"> |
| | | <el-button |
| | | type="danger" |
| | | icon="el-icon-edit" |
| | | size="small" |
| | | v-if="isAuth('commodity-spots:operate')&&scope.row.state=='submitted'" |
| | | @click.stop="addOrUpdateHandle(scope.row)" |
| | | >撤销</el-button |
| | | > |
| | | </template> |
| | | </avue-crud> |
| | | <!-- 弹窗, 新增 / 修改 --> |
| | | <add-or-update |
| | | v-if="addOrUpdateVisible" |
| | | ref="addOrUpdate" |
| | | @refreshDataList="getDataList" |
| | | ></add-or-update> |
| | | <!-- 交易参数管理 --> |
| | | <parameters v-if="parametersFlag" ref="parameters"> </parameters> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { tableOption } from "@/crud/etf-spots/sell-order"; |
| | | import AddOrUpdate from "./sell-order-add-or-update"; |
| | | import parameters from "./sell-parameters"; |
| | | export default { |
| | | data() { |
| | | return { |
| | | parametersFlag: false, |
| | | dataForm: {}, |
| | | dataList2: [], |
| | | dataList: [], |
| | | options: [], |
| | | options1: [ |
| | | { |
| | | value: "1", |
| | | label: "修改", |
| | | }, |
| | | { |
| | | value: "2", |
| | | label: "运行引擎", |
| | | }, |
| | | { |
| | | value: "3", |
| | | label: "重置引擎", |
| | | }, |
| | | ], |
| | | options2: [ |
| | | { |
| | | value: "1", |
| | | label: "修改", |
| | | }, |
| | | { |
| | | value: "2", |
| | | label: "停止引擎", |
| | | }, |
| | | { |
| | | value: "3", |
| | | label: "重置引擎", |
| | | }, |
| | | ], |
| | | dataListLoading: false, |
| | | dataListSelections: [], |
| | | addOrUpdateVisible: false, |
| | | tableOption: tableOption, |
| | | page: { |
| | | total: 0, // 总页数 |
| | | currentPage: 1, // 当前页数 |
| | | pageSize: 10, // 每页显示多少条 |
| | | }, |
| | | search: { |
| | | OrderID: "", |
| | | userName: "", |
| | | rolename: "0", |
| | | symbol: "", |
| | | OrderStatus: "", |
| | | }, |
| | | }; |
| | | }, |
| | | components: { |
| | | AddOrUpdate, |
| | | parameters, |
| | | }, |
| | | created() { |
| | | this.getSymbol(); |
| | | }, |
| | | methods: { |
| | | // 获取数据列表 |
| | | getDataList(page, params, done) { |
| | | this.dataListLoading = true; |
| | | this.$http({ |
| | | url: this.$http.adornUrl("/exchangeApplyOrder/list"), |
| | | method: "post", |
| | | data: this.$http.adornData( |
| | | Object.assign( |
| | | { |
| | | current: page == null ? this.page.currentPage : page.currentPage, |
| | | size: page == null ? this.page.pageSize : page.pageSize, |
| | | type: "commodities", |
| | | offset: "close", |
| | | userName:this.search.userName, |
| | | orderNo:this.search.OrderID, |
| | | symbol:this.search.symbol, |
| | | state:this.search.OrderStatus, |
| | | }, |
| | | params |
| | | ) |
| | | ), |
| | | }).then(({ data }) => { |
| | | data = data.data; |
| | | this.dataList = data.records; |
| | | this.page.total = data.total; |
| | | this.dataListLoading = false; |
| | | |
| | | // this.getList(); |
| | | // if (done) { |
| | | // done(); |
| | | // } |
| | | }); |
| | | }, |
| | | // 条件查询 |
| | | searchChange(params, done) { |
| | | this.getDataList(this.page, params, done); |
| | | }, |
| | | // 多选变化 |
| | | selectionChange(val) { |
| | | this.dataListSelections = val; |
| | | }, |
| | | // 新增 / 修改 |
| | | addOrUpdateHandle(row) { |
| | | // |
| | | this.$confirm(`确定进行撤销操作?`, "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | this.$http({ |
| | | url: this.$http.adornUrl("/exchangeApplyOrder/close"), |
| | | method: "post", |
| | | data: this.$http.adornData( |
| | | Object.assign({ |
| | | orderNo: row.orderNo, |
| | | }), |
| | | false |
| | | ), |
| | | }).then(({ data }) => { |
| | | if (data.code == 0) { |
| | | this.$message({ |
| | | message: "操作成功", |
| | | type: "success", |
| | | duration: 1500, |
| | | onClose: () => { |
| | | this.getDataList(); |
| | | }, |
| | | }); |
| | | } else { |
| | | this.$message({ |
| | | message: data.msg, |
| | | type: "error", |
| | | duration: 1500, |
| | | onClose: () => {}, |
| | | }); |
| | | } |
| | | }); |
| | | }) |
| | | .catch(() => {}); |
| | | |
| | | // |
| | | }, |
| | | // 删除 |
| | | deleteHandle(id) { |
| | | var ids = id |
| | | ? [id] |
| | | : this.dataListSelections.map((item) => { |
| | | return item.roleId; |
| | | }); |
| | | this.$confirm(`确定进行[${id ? "删除" : "批量删除"}]操作?`, "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | this.$http({ |
| | | url: this.$http.adornUrl("/sys/role"), |
| | | method: "delete", |
| | | data: this.$http.adornData(ids, false), |
| | | }).then(({ data }) => { |
| | | this.$message({ |
| | | message: "操作成功", |
| | | type: "success", |
| | | duration: 1500, |
| | | onClose: () => { |
| | | this.getDataList(); |
| | | }, |
| | | }); |
| | | }); |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | changeSelet(row) { |
| | | console.log("row => " + JSON.stringify(row)); |
| | | switch (row.select) { |
| | | case "1": //修改 |
| | | { |
| | | this.addOrUpdateVisible = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.addOrUpdate.init(row); |
| | | }); |
| | | } |
| | | break; |
| | | case "2": // |
| | | { |
| | | if (row.RobotStatus == 0) { |
| | | //启动引擎 |
| | | // |
| | | this.$confirm(`确定启动引擎?`, "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | // |
| | | row.RobotStatus = 1; |
| | | row.TransactionEngineStatus = 1; |
| | | this.$message({ |
| | | message: "操作成功", |
| | | type: "success", |
| | | duration: 1500, |
| | | onClose: () => {}, |
| | | }); |
| | | // |
| | | }) |
| | | .catch(() => {}); |
| | | // |
| | | } else if (row.RobotStatus == 1) { |
| | | //停止引擎 |
| | | // |
| | | this.$confirm(`确定停止引擎?`, "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | // |
| | | row.RobotStatus = 0; |
| | | row.TransactionEngineStatus = 0; |
| | | this.$message({ |
| | | message: "操作成功", |
| | | type: "success", |
| | | duration: 1500, |
| | | onClose: () => {}, |
| | | }); |
| | | // |
| | | }) |
| | | .catch(() => {}); |
| | | // |
| | | } |
| | | } |
| | | break; |
| | | case "3": //重置 |
| | | { |
| | | // |
| | | this.$confirm(`确定重置引擎?`, "提示", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | // |
| | | this.$message({ |
| | | message: "操作成功", |
| | | type: "success", |
| | | duration: 1500, |
| | | onClose: () => {}, |
| | | }); |
| | | // |
| | | }) |
| | | .catch(() => {}); |
| | | // |
| | | } |
| | | break; |
| | | } |
| | | |
| | | row.select = ""; |
| | | }, |
| | | addClasscolor({ column, row }) { |
| | | //表单样式 |
| | | if (column.property === "OrderInterval") { |
| | | return "green"; |
| | | } else if ( |
| | | column.property === "orderPriceType" || |
| | | column.property === "TransactionEngineStatus" |
| | | ) { |
| | | return "blue"; |
| | | } |
| | | return ""; |
| | | }, |
| | | //查看更多参数 |
| | | TransactionEngineStatus(row) { |
| | | this.parametersFlag = true; |
| | | this.$nextTick(() => { |
| | | this.$refs.parameters.init(row); |
| | | }); |
| | | }, |
| | | getList() { |
| | | let call = (item) => { |
| | | let flag0 = |
| | | !this.search.OrderID || |
| | | item.orderNo.indexOf(this.search.OrderID) >= 0; |
| | | |
| | | let flag1 = |
| | | !this.search.userName || |
| | | item.userName.indexOf(this.search.userName) >= 0; |
| | | |
| | | let flag2 = |
| | | !this.search.OrderStatus || |
| | | item.state.indexOf(this.search.OrderStatus) >= 0; |
| | | |
| | | let flag3 = |
| | | !this.options.value || item.symbol.indexOf(this.options.value) >= 0; |
| | | |
| | | return flag0 && flag1 && flag2 && flag3; |
| | | }; |
| | | |
| | | this.dataList2 = this.dataList.filter((item) => { |
| | | return call(item); |
| | | }); |
| | | |
| | | //this.dataList2 = this.dataList; |
| | | }, |
| | | // 获取项目种类列表 |
| | | getSymbol(page, params, done) { |
| | | this.dataListLoading = true; |
| | | this.$http({ |
| | | url: this.$http.adornUrl("/api/item!list.action?type=commodities"), |
| | | method: "get", |
| | | params: this.$http.adornParams(Object.assign({}, params), false), |
| | | }).then(({ data }) => { |
| | | if (data.code == 0) { |
| | | let arr = data.data; |
| | | this.options = arr.map((item, index) => { |
| | | return Object.assign({ |
| | | label: item.name, |
| | | value: item.symbol, |
| | | }); |
| | | }); |
| | | } |
| | | if (done) { |
| | | done(); |
| | | } |
| | | }); |
| | | }, |
| | | // 刷新回调用 |
| | | refreshChange () { |
| | | this.page = this.$refs.crud.$refs.tablePage.defaultPage |
| | | this.getDataList(this.page) |
| | | this.dataListSelections = [] |
| | | this.$refs.crud.selectClear() |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .mod-mange { |
| | | } |
| | | .speacButton { |
| | | color: rgb(69, 147, 235); |
| | | cursor: pointer; |
| | | } |
| | | .speacButton:hover { |
| | | color: rgb(8, 63, 134); |
| | | } |
| | | </style> |