123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524 |
- <template>
- <view>
- <uni-forms ref="form" labelPosition="left" labelAlign="left" @submit="submitForm">
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">工作项名称</text></view>
- <view class="uni-input-wrapper">
- {{progressName+'->'+progressNodeName}}
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">进度计划名称</text></view>
- <view class="uni-input-wrapper">
- {{progressName}}
- </view>
- </view>
-
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">报告日期</text></view>
- <view class="uni-input-wrapper" style="justify-content: left;">
- <picker mode="date" @change="bindDateChange" v-model="reportDate" style="width: 100%;">
- <view class="uni-input">{{reportDate}}</view>
- </picker>
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">填报进度</text></view>
- <view class="uni-input-wrapper">
- <view style="width: 200px;">
- <input class="uni-input" focus value="0" v-model="completePercent" type="number" /></view>
- <view>%</view>
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">实际开始时间</text></view>
- <view class="uni-input-wrapper" style="justify-content: left;">
- <picker mode="date" @change="bindDealDateChange" v-model="actualStartDate" style="width: 100%;">
- <view class="uni-input">{{actualStartDate}}</view>
- </picker>
- </view>
- </view>
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">实际结束时间</text></view>
- <view class="uni-input-wrapper" style="justify-content: left;">
- <picker mode="date" @change="bindFinishDateChange" v-model="actualFinishDate" style="width: 100%;">
- <view class="uni-input">{{actualFinishDate}}</view>
- </picker>
- </view>
- </view>
-
-
- <view class="uni-form-item uni-column">
- <view class="title"><text class="uni-form-item__title">执行情况</text></view>
- <view class="uni-textarea">
- <textarea focus placeholder="请填写执行情况" v-model="remark" auto-height="true" />
- </view>
- </view>
-
-
- <view class="uni-form-item uni-column">
- <view class="title" style="background-color: #efefef;"><text class="uni-form-item__title">附件</text></view>
- <view class="content">
- <g-upfile ref='gUpfile' :mode="imgList" @chooseFile='chooseFile' @imgDelete='imgDelete' :control='control'
- :columnNum="columnNum" :maxCount="maxCount" @limitFileSizeList='limitFileSizeList' @limitFileTypeList='limitFileTypeList' :maxFileSize="20000"></g-upfile>
- </view>
- </view>
- <view style="margin-bottom: 60px;">
-
- </view>
-
- <view class="uni-btn-v uni-column">
- <button type="primary" form-type="submit" style="border-radius: 15px;" >确定</button>
- </view>
-
- </uni-forms>
-
-
-
- </view>
- </template>
- <script>
-
- import {InsertProgressReport} from "@/common/api/ProgressApi.js";
-
- import {Decimal} from 'decimal.js'; //decimal计算
-
-
- export default {
- data() {
- return {
- progressId:this.$util.getQuery("progressId"),
- progressName:this.$util.getQuery("progressName"), //进度计划名
- progressNodeId:this.$util.getQuery("progressNodeId"),
- progressNodeName:this.$util.getQuery("progressNodeName"), //工作项名称
- reportDate:this.$util.getDate({
- format: true
- }),
- completePercent:0,
- remark:'',
- actualStartDate:'',
- actualFinishDate:'',
-
-
- imageList: [],
- countIndex: 5,
- count: [1, 2, 3, 4, 5],
- title1: 'picker',
- array: [],
- index: 0,
-
-
- control: true,
- columnNum: 3,
- imgList: [],
- urlList:[],
- maxCount:5
-
- }
- },
- onLoad(){
- //console.info(page.path);
- console.info(uni.getStorageSync('storage_state'));
- //console.info(this);
- this.$util.persistLogin(this);
- //console.info(this.$store.state.user);
-
- },
- onUnload() {
- this.imageList = [];
-
- },
- created: function() {
-
-
- },
- updated:function(){
-
- },
- methods: {
-
- /**
- * 手动提交
- * @param {Object} form
- */
- submitForm(e) {
- console.info('submitForm');
- let _this=this;
- if(this.progressNodeId=='')
- {
- uni.showToast({
- icon:"none",
- title:"请填写工作项名称",
- duration:3000
- });
- return;
- }
- if(this.progressId=='')
- {
- uni.showToast({
- icon:"none",
- title:"请填写进度计划名称",
- duration:3000
- });
- return;
- }
- if(this.reportDate==='')
- {
- uni.showToast({
- icon:"none",
- title:"请选择报告日期",
- duration:3000
- });
- return;
- }
- if(this.completePersent<=0)
- {
- uni.showToast({
- icon:"none",
- title:"请填报进度",
- duration:3000
- });
- return;
- }
- if(this.completePersent>100)
- {
- uni.showToast({
- icon:"none",
- title:"填报进度不能大于100",
- duration:3000
- });
- return;
- }
- if(this.actualStartDate===""){
- uni.showToast({
- icon:"none",
- title:"请选择实际开始日期",
- duration:3000
- });
- return;
- }
- if(this.completePersent==100&&this.actualFinishDate===""){
- uni.showToast({
- icon:"none",
- title:"请选结束日期",
- duration:3000
- });
- return;
- }
-
-
-
- if(this.remark!==""){
- if(this.remark.length>500){
- uni.showToast({
- icon:"none",
- title:"备注不能超过500字",
- duration:3000
- });
- return;
- }
- }
- let actualFinishDate=null;
- var data={projectCode:_this.$util.getState(_this,'projectCode'),progressId:_this.progressId-0,progressNodeId:_this.progressNodeId-0,reportDate:_this.reportDate,completePercent:_this.completePercent-0,actualStartDate:_this.actualStartDate,actualFinishDate:_this.actualFinishDate==''?actualFinishDate:_this.actualFinishDate,remark:_this.remark,inputPerson:_this.$util.getState(_this,'userCode')};
- console.info('data:',data);
- //return;
- InsertProgressReport(data).then((res)=>{
- console.info("提交应答");
- console.info(res);
- if(res=="-1")
- {
- uni.showToast({
- title:'进度不能小于等于0',
- icon:'none',
- duration:3000
- });
- return;
- }
- if(res=="-2")
- {
- uni.showToast({
- title:'进度不能大于等于100',
- icon:'none',
- duration:3000
- });
- return;
- }
- if(res){
- //上传图片
- _this.uploadFileToServe(res) ;
-
- uni.navigateTo({
- url:'/pages/template/GetpmProgressReportDTOs/GetpmProgressReportDTOs?progressNodeId='+_this.progressNodeId
- })
- }
- else{
- uni.showToast({
- title:'添加失败,重新操作',
- icon:'none',
- duration:3000
- })
- }
-
- });
- },
- /*
- 获取申请单
- */
- getRequisition() {
- let _this = this;
- _this.saveTemp(_this);
- //创建名字为fire的监听器,监听子页面传值事件
- uni.$on('requisition', function(data) {
- console.info("监听getRequisition子页面的传值", data);
- //console.info('监听',_this);
- _this.getTemp(_this);
- _this.requisitionCode=data[0].requisitionCode;
- _this.requisitionName=data[0].requisitionName;
- /* _this.$nextTick(function(){
- //更新dom
- }); */
-
- //接收一次监听,一旦监听到回传值,则清除监听事件,若不清除,会占用资源
- uni.$off("requisition");
- });
- uni.navigateTo({
- url: '/pages/template/SelectRelationRequision/SelectRelationRequision'
- });
- },
-
-
- delRow: function(index) {
- console.info("删除");
- console.info(this.costList[index]);
- this.costList.splice(index, 1);
- },
-
- bindPickerChange: function(e) {
- //console.log('picker发送选择改变,携带值为:' + e.detail.value);
- //console.info(e.detail);
- this.index = e.detail.value;
- this.viseType=this.array[this.index];
- console.info(this.viseType);
- },
- bindDateChange: function(e) {
- let date = e.detail.value;
- this.reportDate=date;
- console.info('bindDateChange',this.reportDate);
- },
- bindDealDateChange: function(e) {
- let date = e.detail.value;
- this.actualStartDate=date;
- console.info('bindDealDateChange',this.actualStartDate);
- },
- bindFinishDateChange:function(e){
- let date = e.detail.value;
- this.actualFinishDate=date;
- console.info('bindFinishDateChange',this.actualFinishDate);
- },
-
- /*
- 上传后返回的值:
- list:上传后图片数组
- v:返回当前上传图片的临时路径
- */
- chooseFile(list, v) {
- console.log("上传图片_list:", list)
- console.log("上传图片_v:", v);
- this.urlList=list;
- console.info("urlList",this.urlList);
-
- },
-
-
- /*
- 删除图片:
- list:删除返回删除后剩余的图片数组
- eq:返回删除的数组
- */
- imgDelete(list, eq) {
- console.log("删除图片_list:", list);
- console.log("删除图片_eq:", eq);
- this.urlList=list;
- console.info("urlList",this.urlList);
- },
- /*限制文件大小列表*/
- limitFileSizeList(list){
- console.info('limitFileSizeList:',list);
- if(list){
- if(list.length>0){
- uni.showModal({
- title:'警告',
- content: list.join()+' 文件大小超过2000KB',
- showCancel:false
- });
- }
- }
- },
- /*限制文件类型列表*/
- limitFileTypeList(list,allowFileType){
- console.info('limitFileTypeList:',list);
- console.info('limitFileTypeList:',allowFileType);
- if(list){
- if(list.length>0){
- uni.showModal({
- title:'警告',
- content: list.join()+' 文件类型必须是'+allowFileType.join(),
- showCancel:false
- });
- }
- }
- },
- /*
- 执行上传服务:
- urlList:要上传的图片:数组类型
- */
- uploadFileToServe(masterCode) {
- let _this=this;
- var urlList=_this.urlList;
- if (!urlList || urlList.length <= 0) {
- return;
- };
- //console.info(urlList);
-
-
- //return;
- for (let i = 0; i < urlList.length; i++) {
-
- uni.uploadFile({
- url: '/api/Common/UploadImage',
- filePath: urlList[i],
- name: 'file',
- formData: {
- createPerson:_this.$store.state.user.userCode,
- masterCode:masterCode,
- attachMentType:'---ProgressReportAttachment'
- },
- headers: {
- 'Content-Type': 'multipart/form-data; boundary = ' + new Date().getTime()
- //这里要把content-type设置为multipard/form-data,同时还要设置boundary
- },
- success: (uploadFileRes) => {
- console.log("图片上传:",uploadFileRes.data);
- }
- });
- }
- },
-
-
- }
- }
- </script>
- <style scoped>
- /* 头条小程序组件内不能引入字体 */
- /* #ifdef MP-TOUTIAO */
- @font-face {
- font-family: uniicons;
- font-weight: normal;
- font-style: normal;
- src: url("~@/static/uni.ttf") format("truetype");
- }
- /* #endif */
-
- page {
- display: flex;
- flex-direction: column;
- box-sizing: border-box;
- background-color: #efeff4;
- min-height: 100%;
- height: auto;
- }
- view {
- font-size: 14px;
- line-height: inherit;
- }
- .uni-form-item__title {
- font-size: 16px;
- line-height: 24px;
- }
-
- .uni-input-wrapper {
- /* #ifndef APP-NVUE */
- display: flex;
- /* #endif */
- padding: 8px 13px;
- flex-direction: row;
- flex-wrap: nowrap;
- background-color: #FFFFFF;
- -webkit-justify-content: left;
- }
- .title{
- background-color: #efefef;
- }
-
-
- .uni-icon {
- font-family: uniicons;
- font-size: 24px;
- font-weight: normal;
- font-style: normal;
- width: 24px;
- height: 24px;
- line-height: 24px;
- margin-left:15px;
- color: #999999;
- }
-
- .uni-eye-active {
- color: #007AFF;
- }
- .uni-btn-v{
- position: fixed;
- bottom: 0;
- width:100%;
-
- }
- .header-slot-box {
- font-size:15px;
- margin: 5px 5px;
- width:20%;
- justify-content: center;
- }
- .body-slot-box {
- font-size:15px;
- margin: 5px 5px;
- width:40%;
- justify-content: center;
- }
- .footer-slot-box {
- font-size:15px;
- margin: 5px 5px;
- width:40%;
- justify-content: center;
- }
- .uni-textarea textarea{
- font-size:15px;
- }
- .content {
- padding: 40rpx;
- background-color: #fff;
- }
-
- /* 上传控件 */
- .uploadControl {
- border: 1rpx solid #eee;
- border-radius: 10rpx;
- width: 130rpx;
- display: block;
- height: 130rpx;
- text-align: center;
- line-height: 130rpx;
- font-size: 30rpx;
- color: #888;
- background-color: #eeeeee;
- }
-
- .topicon >>> .icon{
- border: #4CD964 2upx solid;
- }
- </style>
|