@{
|
Layout = "~/Views/Shared/_LayoutVue.cshtml";
|
ViewBag.Title = "算法策略";
|
}
|
|
@section head{
|
|
<style>
|
.el-input__inner {
|
text-align: center;
|
}
|
</style>
|
}
|
<div id="strategyList" v-cloak>
|
<el-card class="box-card">
|
<el-form label-width="90px" v-bind:model="formData" class="demo-ruleForm" v-bind:inline="true">
|
<el-form-item label="库区名称:">
|
<el-input v-model="formData.areaName" size="mini"></el-input>
|
</el-form-item>
|
<el-button style="margin-top:2px;" size="mini" type="primary" v-on:click="search">查 询</el-button>
|
|
@*<el-button size="mini" type="warning" v-on:click="setpriority" style="float:right">设置优先级</el-button>*@
|
</el-form>
|
</el-card>
|
<el-row>
|
<el-col v-bind:span="9">
|
<hh-table v-bind:coloptions="areaCols" style="margin-right:10px"
|
v-bind:paging="true"
|
v-bind:single="true"
|
v-bind:check="true"
|
v-bind:where="where"
|
v-on:clickrow="clickRow"
|
url="/Basic/Common/GetStockAndAreaList"
|
ref="areaList"
|
dh="100">
|
</hh-table>
|
</el-col>
|
<el-col v-bind:span="15" style="float:right">
|
<el-button size="mini" type="success" v-on:click="add" style="margin:10px 0px 5px 0px">新增关联</el-button>
|
<el-button size="mini" type="danger" v-on:click="del" style="margin:10px 0px 5px 5px">删除关联</el-button>
|
@*<hh-table v-bind:coloptions="strategyCols"
|
v-bind:single="true"
|
v-bind:url="itemUrl"
|
ref="strategyList"
|
dh="100">
|
</hh-table>*@
|
<el-table v-bind:data="tableData" ref="singleTable" class="tb-edit" style="width: 100%;height:365px"
|
border highlight-current-row v-on:row-click="clickStrategyRow" size="mini">
|
<el-table-column type="selection" width="35"></el-table-column>
|
<el-table-column label="策略编码" prop="CN_S_CODE" width="150" align="center"></el-table-column>
|
<el-table-column label="策略名称" prop="CN_S_NAME" width="120" align="center"></el-table-column>
|
<el-table-column label="策略类型" prop="CN_S_TYPE" width="70" align="center"></el-table-column>
|
<el-table-column label="是否使用" prop="CN_C_IS_USE" width="70" align="center"></el-table-column>
|
<el-table-column label="条件" prop="CN_S_WHERE" width="90" align="center"></el-table-column>
|
<el-table-column label="优先级" prop="CN_N_PRIORITY" width="80" align="center">
|
<template scope="scope">
|
<el-input size="mini" type="text" maxlength="3" v-model.number="scope.row.CN_N_PRIORITY" v-on:keyup.native="checkNum(scope.row,scope.$index)" v-on:change.native="updatePriority(scope.row,scope.$index)" placeholder=""></el-input>
|
<span>{{scope.row.CN_N_PRIORITY}}</span>
|
</template>
|
</el-table-column>
|
|
<el-table-column label="备注" prop="CN_S_NOTE" width="110" align="center">
|
</el-table>
|
</el-col>
|
</el-row>
|
</div>
|
@section scripts{
|
<script>
|
new Vue({
|
mixins: [useAutoHeight],
|
computed: {},
|
data: {
|
areaCode: "",
|
stockCode: "",
|
itemUrl: "",
|
formData: {
|
areaName: ""
|
},
|
where: {},
|
areaCols: [
|
{ f: "CN_S_STOCK_CODE", n: "仓库编码", w: "70" },
|
{ f: "CN_S_STOCK_NAME", n: "仓库名称", w: "90" },
|
{ f: "CN_S_AREA_CODE", n: "库区编码", w: "103" },
|
{ f: "CN_S_AREA_NAME", n: "库区名称", w: "125" }
|
],
|
tableData: [],
|
},
|
methods: {
|
checkNum: function (row, index) {
|
var oldvalue = row.CN_N_PRIORITY.toString();
|
row.CN_N_PRIORITY = oldvalue.replace(/[^\d]/g, '').replace('.', '');
|
if (row.CN_N_PRIORITY == "" || row.CN_N_PRIORITY == "0") {
|
row.CN_N_PRIORITY = "1";
|
}
|
var $this = this;
|
$this.$set($this.tableData, index, row);
|
},
|
updatePriority: function (row, index) {
|
var priority = row.CN_N_PRIORITY.toString();
|
var $this = this;
|
|
ajaxManage({
|
url: "/Sys/Strategy/UpdatePriority?areaCode=" + $this.areaCode + "&stockCode=" + $this.stockCode + "&strategyGuid=" + row.CN_GUID + "&priority=" + priority,
|
success: function (data) {
|
if (data.Success) {
|
wms.success("更新优先级成功!");
|
}
|
else {
|
wms.warning("优先级更新失败!" + data.Msg);
|
}
|
return;
|
}
|
});
|
|
},
|
search: function () {
|
var $this = this;
|
$this.areaCode = "";
|
$this.stockCode = "";
|
this.$refs.areaList.loadData(this.formData);
|
$this.tableData = [];
|
},
|
add: function () {
|
var $this = this;
|
var areaCode = $this.areaCode;
|
var stockCode = $this.stockCode;
|
if (areaCode == "" && stockCode == "") {
|
wms.warning("请先选择左侧仓库或者库区!");
|
return;
|
}
|
wms.showDialogFrame({
|
title: '新增策略',
|
dh: 220,
|
width: "720px",
|
btn: false,
|
callBack: function (frame) {
|
ajaxManage({
|
url: "/Sys/Strategy/GetStrategyList?areaCode=" + areaCode + "&stockCode=" + stockCode,
|
success: function (data) {
|
console.log(data.Data);
|
$this.tableData = data.Data;
|
}
|
});
|
},
|
url: "@Url.Action("Add")?areaCode=" + areaCode + "&stockCode=" + stockCode
|
});
|
|
|
},
|
del: function () {
|
var $this = this;
|
var areaCode = $this.areaCode;
|
var stockCode = $this.stockCode;
|
|
var selectRow = this.$refs.singleTable.selection;
|
if (selectRow.length <= 0) {
|
wms.warning("请先选择右侧策略行!");
|
return;
|
}
|
wms.confirm("确认删除?", function () {
|
ajaxManage({
|
url: "/Sys/Strategy/DeleteAreaStrategy?areaCode=" + areaCode + "&stockCode=" + stockCode + "&strategyGuid=" + selectRow[0].CN_GUID,
|
success: function (data) {
|
wms.showMsg(data, function () {
|
wms.success("策略删除成功!");
|
ajaxManage({
|
url: "/Sys/Strategy/GetStrategyList?areaCode=" + areaCode + "&stockCode=" + stockCode,
|
success: function (data) {
|
$this.tableData = data.Data;
|
}
|
});
|
});
|
}
|
});
|
});
|
|
},
|
clickRow: function (row, event, column) {
|
var $this = this;
|
var areaCode = row.CN_S_AREA_CODE;
|
var stockCode = row.CN_S_STOCK_CODE;
|
|
$this.areaCode = areaCode;
|
$this.stockCode = stockCode;
|
|
ajaxManage({
|
url: "/Sys/Strategy/GetStrategyList?areaCode=" + areaCode + "&stockCode=" + stockCode,
|
success: function (data) {
|
console.log(data.Data);
|
$this.tableData = data.Data;
|
}
|
});
|
},
|
clickStrategyRow: function (row, event, column) {
|
var selectrow = row;
|
this.$refs.singleTable.clearSelection();
|
this.$refs.singleTable.toggleRowSelection(selectrow);
|
}
|
},
|
el: '#strategyList'
|
});
|
</script>
|
}
|