| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
- $(function () {
- /*任务状态*/
- $.ajax({
- type: "POST",
- url: baseURL + "sys/dict/infoList/task_status",
- contentType: "application/json",
- async: false,
- success: function(r){
- if(r.code == 0){
- vm.dict = r.dictList;
- }else{
- layer.alert("读取字典项失败");
- }
- }
- });
- /*任务类型*/
- $.ajax({
- type: "POST",
- url: baseURL + "sys/dict/infoList/task_type",
- contentType: "application/json",
- async: false,
- success: function(r){
- if(r.code == 0){
- vm.type = r.dictList;
- }else{
- layer.alert("读取字典项失败");
- }
- }
- });
- $("#jqGrid").jqGrid({
- url: baseURL + 'qmjz/taskManage/page',
- datatype: "json",
- colModel: [
- { label: 'id', name: 'id', index: 'id', width: 50, key: true ,hidden: true},
- { label: '任务名称', name: 'taskName', index: 'taskName', width: 70 },
- { label: '任务类型', name: 'taskType', index: 'taskType', width: 60, sortable: false,formatter: function (cellvalue, options, rowdata) {
- for (const item of vm.type) {
- if(cellvalue == item.value) {
- return item.code
- }
- }
- }},
- { label: '任务积分', name: 'taskScore', index: 'taskScore', width: 60 },
- { label: '任务状态', name: 'taskStatus', index: 'taskStatus', width: 80, sortable: false,formatter: function (cellvalue, options, rowdata) {
- for (const item of vm.dict) {
- if(cellvalue == item.value) {
- return item.code
- }
- }
- }},
- ],
- viewrecords: true,
- height: 385,
- rowNum: 10,
- rowList : [10,30,50],
- rownumbers: true,
- rownumWidth: 25,
- autowidth:true,
- multiselect: true,
- pager: "#jqGridPager",
- jsonReader : {
- root: "list",
- page: "currPage",
- total: "totalPage",
- records: "totalCount"
- },
- prmNames : {
- page:"pageNum",
- rows:"pageSize"
- // order: "order"
- },
- gridComplete:function(){
- //隐藏grid底部滚动条
- $("#jqGrid").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
- }
- });
- upload(1,'images','images/*');
- });
- var vm = new Vue({
- el:'#rrapp',
- data:{
- q:{
- taskName: '',
- taskScore:'',
- taskStatus:''
- },
- dict: [],
- type: [],
- work: {},
- showList: true,
- },
- watch: {
- colleges: function() {
- this.$nextTick(function(){
- $('#college').selectpicker('refresh');
- })
- },
- qstaffguids:function () {
- this.$nextTick(function(){
- $('#qstaffguid').selectpicker('refresh');
- })
- }
- },
- methods: {
- init:function () {
- vm.q.work= {};
- },
- refresh: function () {
- vm.init();
- location.reload();
- },
- query: function () {
- vm.reload(1);
- },
- update: function (event) {
- var id = getSelectedRow();
- if(id == null){
- return ;
- }
- vm.showList = false;
- vm.getInfo(id)
- },
- getInfo: function(id){
- $.get(baseURL + "qmjz/taskManage/info/"+id, function(r){
- vm.work = r.data;
- });
- },
- reload: function (event) {
- vm.showList = true;
- var page;
- if (event == 1){
- page = 1;
- }else {
- page = $("#jqGrid").jqGrid('getGridParam','page');
- }
- $("#jqGrid").jqGrid('setGridParam',{
- postData:{'taskName': vm.q.taskName,'taskScore':vm.q.taskScore,'taskStatus': vm.q.taskStatus},
- page:page
- }).trigger("reloadGrid");
- },
- point() {
- var width = ($(window).width() * 0.6);
- var height = ($(window).height() - 50);
- layui.use(['layer', 'form'], function () {
- var $ = layui.jquery, layer = layui.layer;
- layer.open({
- type: 2,
- area: [width + 'px', height + 'px'],
- fix: false, //不固定
- maxmin: true,
- shadeClose: true,
- resize: false,
- full: true,
- shade: 0.4,
- title: '积分抵扣',
- anim: 3,
- content: '../qyh/point.html',
- end: function () {
- // vm.reload();
- // console.log(11)
- }
- });
- })
- },
- }
- });
- layui.use([ 'layer', 'form'],function() {
- var $ = layui.jquery, layer = layui.layer, form = layui.form;
- form.on('submit(go)', function(data){
- $.ajax({
- type: "POST",
- url: baseURL + 'qmjz/taskManage/update',
- contentType: "application/json",
- data: JSON.stringify(vm.work),
- success: function(r){
- if(r.code === 0){
- layer.msg("操作成功", {icon: 1});
- vm.reload();
- }else{
- layer.alert(r.msg);
- }
- }
- });
- return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
- });
- });
|