Skip to content

Instantly share code, notes, and snippets.

@leftjs
Last active June 18, 2017 10:08
Show Gist options
  • Save leftjs/67e02dfae44c280880ac78b4fa5ddd85 to your computer and use it in GitHub Desktop.
Save leftjs/67e02dfae44c280880ac78b4fa5ddd85 to your computer and use it in GitHub Desktop.
list页面的查询
<div class="form-group">
<!--<select name="WarehouseCD" ng-model="p.WarehouseCD" ng-disabled="!!(ngDialogData.WarehouseCD)" class="form-control input-sm ">-->
<!--<option selected="selected" value="">请选择</option>-->
<!--<option ng-repeat="item in DicWarehouses" value="{{item.SYS_USER_CD}}">{{item.SYS_CD_NM}}</option>-->
<!--</select>-->
<label>仓库</label>
<ui-select style="display: inline-block" ng-model="DicWarehouse.selected" theme="bootstrap" reset-search-input="true" ng-change="DicWarehouseChange()" required>
<ui-select-match placeholder="输入查询..." allow-clear="true">{{$select.selected.SYS_CD_NM}}</ui-select-match>
<ui-select-choices repeat="item in DicWarehouses | filter: $select.search track by $index" refresh="loadDicWarehouses($select.search)" refresh-delay="0">
<div ng-bind-html="item.SYS_CD_NM | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
</div>
<div class="form-group">
<!--<select name="WarehouseCD" ng-model="p.WarehouseCD" ng-disabled="!!(ngDialogData.WarehouseCD)" class="form-control input-sm ">-->
<!--<option selected="selected" value="">请选择</option>-->
<!--<option ng-repeat="item in DicWarehouses" value="{{item.SYS_USER_CD}}">{{item.SYS_CD_NM}}</option>-->
<!--</select>-->
<label>加工单位</label>
<ui-select style="display: inline-block" ng-model="Supplier.selected" theme="bootstrap" reset-search-input="true" ng-change="SupplierChange()" required>
<ui-select-match placeholder="输入查询..." allow-clear="true">{{$select.selected.SYS_CD_NM}}</ui-select-match>
<ui-select-choices repeat="item in Suppliers | filter: $select.search track by $index" refresh="loadSuppliers($select.search)" refresh-delay="0">
<div ng-bind-html="item.SYS_CD_NM | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
</div>
// 仓库
$scope.DicWarehouses = []; //主表字典-仓库
$scope.DicWarehouse = {}; //被选中项
$scope.loadDicWarehouses = function (key) {
if (!$scope.DicWarehouses.length)
DicWarehouse.Get({ SYS_CD_NM: key }, function (r) {
$scope.DicWarehouses = r.Result.Data;
});
}
$scope.DicWarehouseChange = function () {
$scope.p.WarehouseCD = $scope.DicWarehouse.selected && $scope.DicWarehouse.selected.SYS_USER_CD || '';
}
// 加工单位
$scope.Suppliers = []; //主表字典-供应商(加工单位)
$scope.Supplier = [];
$scope.loadSuppliers = function () {
if (!$scope.Suppliers.length)
Supplier.Get({}, function (r) {
$scope.Suppliers = r.Result.Data;
});
}
$scope.SupplierChange = function () {
$scope.p.ProcUnitCD = $scope.Supplier.selected && $scope.Supplier.selected.SYS_USER_CD || '';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment