<div v-lazy-load="htmls/InnovationApplication/InnovationApplication.js" title="交易明细">
<div v-controller="InnovationApplicationCtrl">

<div class="message-list">
   <div ng-repeat="item in dragArr" ng-drop="true" ng-drop-success="onDropComplete($index, $data, $event)">
    <span class="message-detail" ng-drag-data="{{item}}" >
      <div class="user-mesg" ng-drag="true" ng-drag-data="{{item}}">{{item.text}}</div>
      <input type="text" placeholder="请输入" ng-model="dragArr[$index].value"/>
    </span>
  </div>
</div>

</div>

</div>

InnovationApplicationCtrl.$inject = ['$scope'];

function InnovationApplicationCtrl($scope) {
$scope.dragArr = [{
text: '客户姓名',
value: ''
}, {
text: '证件类型',
value: ''
}, {
text: '证件号码',
value: ''
}, {
text: '性别',
value: ''
}, {
text: '教育程度',
value: ''
}, {
text: '学位',
value: ''
}, {
text: '婚姻状况',
value: ''
}, {
text: '国籍',
value: ''
}, {
text: '居住地址',
value: ''
}, {
text: '公司地址',
value: ''
}, {
text: '公司名称',
value: ''
}, {
text: '公司电话',
value: ''
}, {
text: '月收入',
value: ''
}, {
text: '申请金额',
value: ''
}, {
text: '申请期限',
value: ''
}];
$scope.onDropComplete = function(index, obj, $event) {
var otherObj = $scope.dragArr[index];
var otherIndex = $scope.dragArr.findIndex(vv => Object.is(vv.text, obj.text));
if (otherObj.key !== obj.key) return;
$scope.dragArr[index] = $scope.dragArr[otherIndex];//obj;
$scope.dragArr[otherIndex] = otherObj;
}
}

posted on 2020-03-15 16:31  因过竹林逢僧话  阅读(332)  评论(0编辑  收藏  举报