123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658 |
- var addVue = new Vue({
- el: '#app',
- data() {
- return {
- baseAjaxUrl: apiurljs.login, //基础请求路径
- get_AccessToken: localStorage.getItem("GlWorkPlatform-AccessToken"), //请求时的验证参数
- userId: $.cookie("GlWorkPlatform-userid"),
- userName: $.cookie("GlWorkPlatform-chineseName"),
- nowTab: "1",
- editID: 0,
- formData: {
- PROCODE: "", //项目编号
- PRONAME: "", //项目名称
- LOCATION: "", //项目位置
- JSUNIT: "", //建设单位
- ZTZ: 0, //总投资
- NDTZ: 0, //年度投资
- REMARK: "", //内容描述
- STARTDATE: "", //日期
- ENDDATE: "", //竣工日期
- SJXKHXMCODE: "", //市绩效考核项目
- KHDATECODE: "", //考核时段
- ZRLEADER: "", //责任领导
- ZRMAN: "", //责任人
- }, //主表表单数据
- ruleValidate: {
- PROCODE: [
- {required: true, message: '项目编号不能为空', trigger: 'blur'}
- ],
- PRONAME: [
- {required: true, message: '项目名称不能为空', trigger: 'blur'}
- ],
- STARTDATE: [
- {required: true, message: '开始时间不能为空', trigger: 'change', pattern: /.+/},
- {required: true, message: '开始时间不能为空', trigger: 'blur', pattern: /.+/}
- ],
- ENDDATE: [
- {required: true, message: '结束时间不能为空', trigger: 'change', pattern: /.+/},
- {required: true, message: '结束时间不能为空', trigger: 'blur', pattern: /.+/}
- ]
- }, //主表表单校验规则
- SJXKHXMList: [], //市绩效考核项目列表
- KHDATEList: [], //考核时段列表
- yearColumns: [
- {
- title: '序号',
- type: 'index',
- width: 60,
- align: 'center'
- },
- {
- title: '投资年份',
- key: 'TZNF',
- align: 'center'
- },
- {
- title: '投资金额(万元)',
- key: 'NDTZ',
- align: 'center'
- },
- {
- title: '操作',
- key: 'action',
- align: 'center',
- width: 150,
- render: (h, params) => {
- return h('div', [
- h('Button', {
- props: {
- type: 'primary',
- size: 'small'
- },
- style: {
- marginRight: '10px'
- },
- on: {
- click: () => {
- this.openEditYearModal(params.row);
- }
- }
- }, '编辑'),
- h('Button', {
- props: {
- type: 'error',
- size: 'small'
- },
- on: {
- click: () => {
- this.delYearModal(params.row);
- }
- }
- }, '删除')
- ]);
- }
- }
- ],
- yearTableData: [],
- modalYear: false,
- modalYearObj: {
- ID:0,
- NDTZ: 0,
- TZNF: ""
- },
- ruleValidateModalYear: {
- NDTZ: [
- {required: true, message: '投资金额不能为空', trigger: 'blur'}
- ],
- TZNF: [
- {required: true, message: '投资年份不能为空', trigger: 'change', pattern: /.+/},
- {required: true, message: '投资年份不能为空', trigger: 'blur', pattern: /.+/}
- ]
- },
- loadingModalYear: true,
- taskColumns: [
- {
- title: '序号',
- type: 'index',
- width: 60,
- align: 'center'
- },
- {
- title: '任务名称',
- key: 'TASKNAME',
- align: 'center'
- },
- {
- title: '工作内容',
- key: 'TASKCONNECT',
- align: 'center'
- },
- {
- title: '责任单位',
- key: 'ZRUNIT',
- align: 'center'
- },
- {
- title: '操作',
- key: 'action',
- align: 'center',
- width: 150,
- render: (h, params) => {
- return h('div', [
- h('Button', {
- props: {
- type: 'primary',
- size: 'small'
- },
- style: {
- marginRight: '10px'
- },
- on: {
- click: () => {
- this.openEditTaskModal(params.row);
- }
- }
- }, '编辑'),
- h('Button', {
- props: {
- type: 'error',
- size: 'small'
- },
- on: {
- click: () => {
- this.delTaskModal(params.row);
- }
- }
- }, '删除')
- ]);
- }
- }
- ],
- taskTableData:[],
- modalTask: false,
- loadingModalTask: true,
- modalTaskObj: {
- ID:0,
- TASKNAME:"",
- TASKCONNECT:"",
- ZRUNIT:"",
- ZRUINPUTNAME:"",
- USERID:""
- },
- ruleValidateModalTask: {
- TASKNAME: [
- {required: true, message: '任务名称不能为空', trigger: 'blur'}
- ],
- TASKCONNECT: [
- {required: true, message: '工作内容不能为空', trigger: 'blur'}
- ],
- ZRUNIT: [
- {required: true, message: '责任单位不能为空', trigger: 'blur'},
- {required: true, message: '任务名称不能为空', trigger: 'change'}
- ]
- },
- ZRUNITList:[]
- }
- },
- computed: {},
- methods: {
- //保存表单函数
- saveFormData: (name) => {
- _this.$refs[name].validate((valid) => {
- if (valid) {
- var postData = {
- ID: _this.editID,
- TABLENAME: "KEYPROJECT",
- PROCODE: _this.formData.PROCODE, //项目编号
- PRONAME: _this.formData.PRONAME, //项目名称
- LOCATION: _this.formData.LOCATION, //项目位置
- JSUNIT: _this.formData.JSUNIT, //建设单位
- ZTZ: _this.formData.ZTZ, //总投资
- NDTZ: _this.formData.NDTZ, //年度投资
- REMARK: _this.formData.REMARK, //内容描述
- STARTDATE: _this.formData.STARTDATE, //日期
- ENDDATE: _this.formData.ENDDATE, //竣工日期
- SJXKHXMCODE: _this.formData.SJXKHXMCODE, //市绩效考核项目
- KHDATECODE: _this.formData.KHDATECODE, //考核时段
- SJXKHXM: "",
- KHDATE: "",
- ZRLEADER: _this.formData.ZRLEADER, //责任领导
- ZRMAN: _this.formData.ZRMAN, //责任人
- ZRUNIT: "",
- PRODATE: sp.dateFtt("yyyy-MM-dd", new Date()),
- PROUSER: _this.userName,
- PROUSERID: _this.userId,
- SORTID: 0
- }
- _this.KHDATEList.forEach(function (item) {
- if (item.CODE == _this.formData.KHDATECODE) {
- console.log(item.CNAME);
- postData.KHDATE = item.CNAME;
- }
- })
- _this.SJXKHXMList.forEach(function (item) {
- if (item.CODE == _this.formData.SJXKHXMCODE) {
- console.log(item.CNAME);
- postData.SJXKHXM = item.CNAME;
- }
- })
- $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/insertOrUpData',
- data: postData
- }).then(res => {
- console.log(res);
- if (res.data.success) {
- _this.editID = res.data.data.id;
- _this.$Message.success('操作成功!');
- } else {
- _this.$Message.error('操作失败请联系管理员!');
- }
- })
- } else {
- _this.$Message.error('表单验证失败!');
- }
- })
- },
- //获取市绩效考核项目
- getSJXKHXMList: () => {
- return $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/queryCode',
- data: {
- tablename: "CODE_SJXKHXM"
- }
- })
- },
- //获取考核时段
- getKHDATEList: () => {
- return $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/queryCode',
- data: {
- tablename: "CODE_KHSD"
- }
- })
- },
- //初始化函数
- initBaseData: () => {
- _this.SJXKHXMList = [];
- _this.KHDATEList = [];
- _this.ZRUNITList = [];
- $http.all([_this.getSJXKHXMList(), _this.getKHDATEList(),_this.getZRUNITList()]).then($http.spread((first, second,third) => {
- _this.SJXKHXMList = first.data.data;
- _this.KHDATEList = second.data.data;
- _this.ZRUNITList=third.data.data;
- console.log(_this.ZRUNITList)
- _this.formData.SJXKHXMCODE = _this.SJXKHXMList[0].CODE;
- _this.formData.KHDATECODE = _this.KHDATEList[0].CODE;
- if (_this.editID != 0) {
- //获取项目信息
- _this.getDatail();
- //获取年度投资信息
- _this.getYearData();
- //获取项目分解信息
- _this.getTaskData();
- } else {
- }
- }))
- },
- //返回列表页面
- goBack: () => {
- var returnPage = (sp.getUrlName("lastReturnPageno") != "" && sp.getUrlName("lastReturnPageno") != null && sp.getUrlName("lastReturnPageno") != undefined) ? sp.getUrlName("lastReturnPageno") : 1;
- location.href = "index.html?lastReturnPageno=" + returnPage;
- },
- //加载当前需要编辑的数据
- getDatail: () => {
- var postData = {
- id: _this.editID
- }
- $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/getData',
- data: postData
- }).then(res => {
- _this.formData.PROCODE = res.data.data.PROCODE; //项目编号
- _this.formData.PRONAME = res.data.data.PRONAME; //项目名称
- _this.formData.LOCATION = res.data.data.LOCATION; //项目位置
- _this.formData.JSUNIT = res.data.data.JSUNIT; //建设单位
- _this.formData.ZTZ = res.data.data.ZTZ; //总投资
- _this.formData.NDTZ = res.data.data.NDTZ; //年度投资
- _this.formData.REMARK = res.data.data.REMARK; //内容描述
- _this.formData.STARTDATE = sp.dateFtt("yyyy-MM-dd", new Date(res.data.data.STARTDATE)); //日期
- _this.formData.ENDDATE = sp.dateFtt("yyyy-MM-dd", new Date(res.data.data.ENDDATE)); //竣工日期
- _this.formData.SJXKHXMCODE = res.data.data.SJXKHXMCODE; //市绩效考核项目
- _this.formData.KHDATECODE = res.data.data.KHDATECODE; //考核时段
- _this.formData.ZRLEADER = res.data.data.ZRLEADER; //责任领导
- _this.formData.ZRMAN = res.data.data.ZRMAN; //责任人
- })
- },
- //打开新增年度投资模态窗口
- openAddYearModal: (name) => {
- _this.modalYearObj.ID = 0;
- _this.modalYearObj.NDTZ = "";
- _this.modalYearObj.TZNF = "";
- _this.loadingModalYear = true;
- _this.modalYear = true;
- _this.$refs[name].resetFields();
- },
- //年度投资模态窗口确定函数
- okYearModal: (name) => {
- _this.$refs[name].validate((valid) => {
- if (valid) {
- _this.modalYear = false;
- _this.saveModalYearData();
- } else {
- _this.loadingModalYear = false
- _this.$nextTick(() => {
- _this.loadingModalYear = true
- })
- }
- })
- },
- //年度投资模态窗口取消函数
- cancelYearModal: (name) => {
- _this.modalYearObj.ID = 0;
- _this.modalYearObj.NDTZ = "";
- _this.modalYearObj.TZNF = "";
- _this.loadingModalYear = true;
- _this.$refs[name].resetFields();
- },
- //保存年度投资
- saveModalYearData: () => {
- var postData = {
- ID: _this.modalYearObj.ID,
- TABLENAME: "KEYPROJECT_06",
- PID: _this.editID,
- NDTZ: parseFloat(_this.modalYearObj.NDTZ),
- TZNF: _this.modalYearObj.TZNF
- }
- $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/insertOrUpNDTZData',
- data: postData
- }).then(res => {
- if(res.data.success){
- _this.$Message.success('操作成功!');
- _this.getDatail();
- _this.getYearData();
- }else{
- _this.$Message.error('操作失败请联系管理员!');
- }
- })
- },
- //获取年度投资记录
- getYearData: () => {
- _this.yearTableData = [];
- var postData = {
- tablename: "KEYPROJECT_06",
- id: _this.editID,
- userid: ""
- }
- $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/queryNTZData',
- data: postData
- }).then(res => {
- _this.yearTableData = res.data.data;
- })
- },
- //编辑年度投资按钮
- openEditYearModal:(editData)=>{
- console.log(editData);
- _this.modalYearObj.ID=editData.ID;
- _this.modalYearObj.NDTZ = editData.NDTZ + "";
- _this.modalYearObj.TZNF = editData.TZNF;
- _this.modalYear = true;
- },
- //删除年度投资按钮
- delYearModal:(editData)=>{
- var postData = {
- id:_this.editID,
- id_child:editData.ID,
- tablename_child:"KEYPROJECT_06",
- tablename:"KEYPROJECT",
- ndtz:parseFloat(editData.NDTZ),
- totndtz:parseFloat(_this.formData.NDTZ)
- }
- $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/delNDTZData',
- data: postData
- }).then(res => {
- if(res.data.success){
- _this.$Message.success('操作成功!');
- _this.getYearData();
- _this.getDatail();
- }else{
- _this.$Message.error('操作失败请联系管理员!');
- }
- })
- },
- //打开任务分解弹出层
- openAddTaskModal:(name)=>{
- _this.modalTaskObj.ID = 0;
- _this.modalTaskObj.TASKNAME = "";
- _this.modalTaskObj.TASKCONNECT = "";
- _this.modalTaskObj.ZRUNIT = "";
- _this.modalTaskObj.ZRUINPUTNAME = "";
- _this.modalTaskObj.USERID = "";
- _this.loadingModalTask = true;
- _this.modalTask=true;
- _this.$refs[name].resetFields();
- },
- //任务分解模态窗口确定按钮
- okTaskModal:(name)=>{
- _this.$refs[name].validate((valid) => {
- if (valid) {
- _this.modalTask = false;
- _this.saveModalTaskData();
- } else {
- _this.loadingModalTask = false
- _this.$nextTick(() => {
- _this.loadingModalTask = true
- })
- }
- })
- },
- //任务分解模态窗口取消按钮
- cancelTaskModal:(name)=>{
- _this.modalTaskObj.ID = 0;
- _this.modalTaskObj.TASKNAME = "";
- _this.modalTaskObj.TASKCONNECT = "";
- _this.modalTaskObj.ZRUNIT = "";
- _this.modalTaskObj.ZRUINPUTNAME = "";
- _this.modalTaskObj.USERID = "";
- _this.loadingModalTask = true;
- _this.$refs[name].resetFields();
- },
- //获取责任单位列表
- getZRUNITList: () => {
- return $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/queryZRUnit',
- data: {
- "ushowname":"",
- "zid":"AA06"
- }
- })
- },
- //选择责任单位
- changeZRUNIT:(value)=>{
- _this.ZRUNITList.forEach(function (item) {
- if(item.USHOWNAME==value){
- _this.modalTaskObj.USERID=item.USERID;
- _this.modalTaskObj.ZRUINPUTNAME=item.UINPUTNAME;
- }
- })
- },
- //保存任务分解
- saveModalTaskData: () => {
- var postData = {
- ID: _this.modalTaskObj.ID,
- PID: _this.editID,
- TABLENAME: "KEYPROJECT_04",
- TASKNAME:_this.modalTaskObj.TASKNAME,
- TASKCONNECT:_this.modalTaskObj.TASKCONNECT,
- ZRUNIT:_this.modalTaskObj.ZRUNIT,
- ZRUINPUTNAME:_this.modalTaskObj.ZRUINPUTNAME,
- USERID:_this.modalTaskObj.USERID
- }
- $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/insertOrUpData',
- data: postData
- }).then(res => {
- if(res.data.success){
- _this.$Message.success('操作成功!');
- _this.getTaskData();
- }else{
- _this.$Message.error('操作失败请联系管理员!');
- }
- })
- },
- //获取任务分解记录
- getTaskData: () => {
- _this.taskTableData = [];
- var postData = {
- id: _this.editID
- }
- $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/queryRWData',
- data: postData
- }).then(res => {
- _this.taskTableData = res.data.data;
- })
- },
- //编辑任务分解按钮
- openEditTaskModal:(editData)=>{
- console.log(editData);
- _this.modalTaskObj.ID = editData.ID;
- _this.modalTaskObj.TASKNAME = editData.TASKNAME;
- _this.modalTaskObj.TASKCONNECT = editData.TASKCONNECT;
- _this.modalTaskObj.ZRUNIT = editData.ZRUNIT;
- _this.modalTaskObj.ZRUINPUTNAME = editData.ZRUINPUTNAME;
- _this.loadingModalTask = true;
- _this.modalTask=true;
- },
- //删除任务分解按钮
- delTaskModal:(editData)=>{
- var postData = {
- tablename: "KEYPROJECT_04",
- id: editData.ID
- }
- $http({
- method: 'post',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + _this.get_AccessToken
- },
- baseURL: _this.baseAjaxUrl,
- url: 'g2app/duchaduban/del',
- data: postData
- }).then(res => {
- if(res.data.success){
- _this.$Message.success('操作成功!');
- _this.getTaskData();
- }else{
- _this.$Message.error('操作失败请联系管理员!');
- }
- })
- }
- },
- created: function () {
- _this = this;
- _this.baseAjaxUrl = apiurljs.login;
- _this.editID = (sp.getUrlName("ID") != undefined && sp.getUrlName("ID") != "" && sp.getUrlName("ID") != null) ? sp.getUrlName("ID") : 0;
- _this.initBaseData();
- },
- updated: function () {
- },
- mounted: function () {
- window.onresize = function () {
- var pageHeight = $(".boxContent").height();
- $(".contentBox").height($(".boxContent").height() - 50);
- };
- this.$nextTick(function () {
- var pageHeight = $(".boxContent").height();
- $(".contentBox").height($(".boxContent").height() - 50);
- });
- //项目阶段
- }
- });
|