addrate.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <view :style="'padding-bottom:' + bottom ">
  3. <view class='zhanline'></view>
  4. <uni-forms class='inform' ref="form" :rules="rules" :value="datainfo">
  5. <!-- <view class="info_tit">{{datainfo.year}}年{{datainfo.month}}月进度汇报</view> -->
  6. <uni-forms-item name="hbTime" style='margin-bottom: 0;'>
  7. <view class="flexc infolist">
  8. <view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>汇报时间</view>
  9. <picker mode="date" :value="datainfo.hbTime" class="infolist_a" @change='bindDateChangetimea'>
  10. <view :class="datainfo.hbTime?'':'f16 co80'">{{datainfo.hbTime||"请选择汇报时间"}}</view>
  11. </picker>
  12. </view>
  13. </uni-forms-item>
  14. <uni-forms-item name="isJd" style='margin-bottom: 0;'>
  15. <view class="infolist">
  16. <view class="f16 fw c34 flex0 pr pl12">是否完成节点</view>
  17. <picker range-key='dictLabel' :value="jdindex" :range="sflist" class="infolist_a" @change='bindDateChangea'>
  18. <view v-if="datainfo.isJd">{{datainfo.isJd=='Y'?'是':'否'}}</view>
  19. <view class="f16 co80" v-else>请选择是否完成节点</view>
  20. </picker>
  21. </view>
  22. </uni-forms-item>
  23. <uni-forms-item name="isJs" style='margin-bottom: 0;'>
  24. <view class="infolist">
  25. <view class="f16 fw c34 flex0 pr pl12">是否建设</view>
  26. <picker range-key='dictLabel' :value="jsindex" :range="sflist" class="infolist_a" @change='bindDateChangeb'>
  27. <view v-if="datainfo.isJs">{{datainfo.isJs=='Y'?'是':'否'}}</view>
  28. <view class="f16 co80" v-else>请选择是否建设</view>
  29. </picker>
  30. </view>
  31. </uni-forms-item>
  32. <uni-forms-item name="isNt" style='margin-bottom: 0;'>
  33. <view class="infolist">
  34. <view class="f16 fw c34 flex0 pr pl12">是否纳统</view>
  35. <picker range-key='dictLabel' :value="ntindex" :range="sflist" class="infolist_a" @change='bindDateChangec'>
  36. <view v-if="datainfo.isNt">{{datainfo.isNt=='Y'?'是':'否'}}</view>
  37. <view class="f16 co80" v-else>请选择是否纳统</view>
  38. </picker>
  39. </view>
  40. </uni-forms-item>
  41. <uni-forms-item name="isJg" style='margin-bottom: 0;'>
  42. <view class="infolist">
  43. <view class="f16 fw c34 flex0 pr pl12">是否竣工</view>
  44. <picker range-key='dictLabel' :value="jgindex" :range="sflist" class="infolist_a" @change='bindDateChanged'>
  45. <view v-if="datainfo.isJg">{{datainfo.isJg=='Y'?'是':'否'}}</view>
  46. <view class="f16 co80" v-else>请选择是否竣工</view>
  47. </picker>
  48. </view>
  49. </uni-forms-item>
  50. <uni-forms-item name="nttz" style='margin-bottom: 0;' v-show="datainfo.isNt=='Y'">
  51. <view class="flexc infolist">
  52. <view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>纳统金额(万元)</view>
  53. <input placeholder="请输入纳统金额(万元)" type="number" v-model="datainfo.nttz" class="f16 c34 flex1 txr"/>
  54. </view>
  55. </uni-forms-item>
  56. <uni-forms-item name="jzqk" style='margin-bottom: 0;'>
  57. <view class="flexc infolist" style="align-items: flex-start;">
  58. <view class="f16 fw c34 flex0 pr pl12"><text class="cir">*</text>进展情况</view>
  59. <uni-easyinput :inputBorder='false' type="textarea" v-model="datainfo.jzqk" placeholder="进展情况" placeholderStyle='text-align: right;font-size:32rpx;color:#808080'></uni-easyinput>
  60. <!-- <input placeholder="请输入进展情况" v-model="datainfo.jzqk" class="f16 c34 flex1 txr"/> -->
  61. </view>
  62. </uni-forms-item>
  63. <uni-forms-item name="sgll" style='margin-bottom: 0;'>
  64. <view class="flexc infolist" style="align-items: flex-start;">
  65. <view class="f16 fw c34 flex0 pr pl12">施工力量</view>
  66. <uni-easyinput :inputBorder='false' type="textarea" v-model="datainfo.sgll" placeholder="请输入施工力量(包含人、材、机…" placeholderStyle='text-align: right;font-size:32rpx;color:#808080'></uni-easyinput>
  67. <!-- <input placeholder="请输入施工力量(包含人、材、机…" v-model="datainfo.sgll" class="f16 c34 flex1 txr"/> -->
  68. </view>
  69. </uni-forms-item>
  70. <!-- <view class="border"></view> -->
  71. <uni-forms-item name="fjList" style='margin-bottom: 0;'>
  72. <view class="flexc infolist">
  73. <view class="f16 fw c34 flex0 pr pl12">附件</view>
  74. <view class="infolist_a co28">
  75. <lsj-upload ref="lsjUpload" childId="upload1" :width="width" :height="height" :option="option" :size="size" :formats="formats" :debug="debug" :instantly="instantly" @progress="" @uploadEnd="onuploadEnd" >
  76. <view class="btn" :style="{width: width,height: height}">上传文件</view>
  77. </lsj-upload>
  78. </view>
  79. </view>
  80. </uni-forms-item>
  81. <view class=" cldelistbf" v-for="(ite,idx) in filelist" :key="'fj_'+idx">
  82. <view class="flext f15 c6" @click.stop="getDown(ite.path)">
  83. <view class="imgl"><image :src="wimg" ></image></view>
  84. <view>{{ite.fjName}}</view>
  85. </view>
  86. <!-- 删除 -->
  87. <view class="delimg flex0" @click.stop="getDelFj(idx)">
  88. <image :src="delimg"></image>
  89. </view>
  90. </view>
  91. <view class="infolist_b"><text>*</text>请上传大小不超过<text>100MB</text>格式为<text>doc/xls/ppt/txt/pdf/zip/rar/word</text>的文件</view>
  92. <!-- <uni-forms-item name="remark" style='margin-bottom: 0;'>
  93. <view class="flexc infolist">
  94. <view class="f16 fw c34 flex0 pr pl12">备注</view>
  95. <input placeholder="请输入备注信息" v-model="datainfo.remark" class="f16 c34 flex1 txr"/>
  96. </view>
  97. </uni-forms-item> -->
  98. <!-- 新增 -->
  99. <view class="infobtn flexcc cf f16 f500" v-if="(checkPermi(['fgw:jzqk:add'])&&pagetype=='add')||(checkPermi(['fgw:jzqk:edit'])&&pagetype=='update')" @click="getSubmit">提交</view>
  100. </uni-forms>
  101. </view>
  102. </template>
  103. <script>
  104. import { getDictionaryFn} from '@/api/work/index.js'
  105. import {selectDictLabel} from "@/utils/common.js"
  106. import {getdetailzdjzqkFn,getaddzdjzqkFn,getputzdjzqkFn} from '@/api/zdwork/clue.js'
  107. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  108. import config from '@/config'
  109. const baseUrl = config.baseUrl
  110. import { getToken } from '@/utils/auth'
  111. export default {
  112. data() {
  113. return {
  114. //附件
  115. option: {
  116. // 上传服务器地址,需要替换为你的接口地址
  117. url: baseUrl+'/common/upload', // 该地址非真实路径,需替换为你项目自己的接口地址
  118. // 上传附件的key
  119. name: 'file',
  120. // 根据你接口需求自定义请求头,默认不要写content-type,让浏览器自适配
  121. header: {
  122. // 示例参数可删除
  123. 'Authorization': 'Bearer ' + getToken(),
  124. },
  125. // 根据你接口需求自定义body参数
  126. formData: {
  127. }
  128. },
  129. // 选择文件后是否立即自动上传,true=选择后立即上传
  130. instantly: true,
  131. // 必传宽高且宽高应与slot宽高保持一致
  132. width: '',
  133. height: '48rpx',
  134. // 限制允许上传的格式,空串=不限制,默认为空
  135. formats: 'doc,docx,xls,ppt,txt,pdf,zip,rar,word',
  136. // 文件上传大小限制
  137. size: 100,
  138. // 文件数量限制 默认10
  139. count: 5,
  140. // 文件回显列表
  141. files: new Map(),
  142. // 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道
  143. wxFiles: [],
  144. // 是否打印日志
  145. debug: false,
  146. filelist:[],
  147. selectDate: '',
  148. defaultPhoneHeight: '', //屏幕默认高度
  149. nowPhoneHeight: '', //屏幕现在的高度
  150. bottom:0,
  151. datainfo:{
  152. "xmId":"",//项目ID
  153. "xmmc":"",//项目名称
  154. "deptId":"",//审核人id
  155. "deptName":"",//部门名称
  156. "jzqk":"",//进展情况
  157. "sgll":"",//施工力量
  158. "hbTime":"",//汇报时间
  159. "isJd":"N",//
  160. "isJs":"N",//是否建设
  161. "isNt":"N",//是否纳统
  162. "isJg":"N",//
  163. "nttz":"",//纳统投资
  164. fjList:[],//附件地址
  165. },
  166. tanfalg:false,
  167. addimg:require("@/static/images/mine/add.png"),
  168. delimg:require("@/static/images/mine/del.png"),
  169. checknimg:require("@/static/images/mine/jnicon.png"),
  170. gcheckimg:require("@/static/images/mine/jicon.png"),
  171. closeimg:require('@/static/images/close.png'),
  172. wimg:require('@/static/images/index/wicon.png'),
  173. downimg:require('@/static/images/index/down.png'),
  174. rules: {
  175. hbTime: {rules: [{required: true,errorMessage: '请选择汇报时间'}]},
  176. jzqk: {rules: [{required: true,errorMessage: '请输入进展情况',}]},
  177. // sgll: {rules: [{required: true,errorMessage: '请输入施工力量' } ]},
  178. // fjList: {rules: [{required: true,errorMessage: '请上传附件'} ]},
  179. },
  180. jdindex:-1,//完成
  181. jsindex:-1,//开工
  182. ntindex:-1,//纳统
  183. jgindex:-1,//竣工
  184. sflist:[{dictLabel:'是',dictValue:'Y'},{dictLabel:'否',dictValue:'N'}],//是否
  185. currentdate:'',//当天日期
  186. pagetype:'add',
  187. jzfrom:'',//从哪来
  188. }
  189. },
  190. onLoad(e) {
  191. this.datainfo.hbTime = this.getNowFormatDate();
  192. var newObj={};
  193. if(e.data){
  194. newObj=JSON.parse(decodeURIComponent(e.data))
  195. this.jzfrom=newObj.jzfrom||'';
  196. this.pagetype=newObj.pagetype||'add';
  197. this.datainfo.xmId=newObj.id;
  198. this.datainfo.xmmc=newObj.xmmc;
  199. this.datainfo.year=newObj.year||"";
  200. this.datainfo.month=newObj.month||'';
  201. this.datainfo.jdId=newObj.jdId||"";
  202. }
  203. console.log(newObj)
  204. if(this.pagetype=='update'){
  205. this.id=newObj.xmhbid;
  206. // 获取详情 修改
  207. this.getDataFn()
  208. }else{
  209. }
  210. // #ifdef APP
  211. uni.onKeyboardHeightChange(res=> { //监听键盘高度变化
  212. const res_keyboard = uni.getSystemInfoSync();
  213. let key_height = res.height - (res_keyboard.screenHeight - res_keyboard.windowHeight)
  214. // let key_height = res.height - (res_keyboard.screenHeight - res_keyboard.windowHeight + res_keyboard.safeAreaInsets.bottom)
  215. this.bottom = `${ key_height>0 ? key_height : 0}px`;
  216. console.log( this.bottom,1)
  217. })
  218. // #endif
  219. },
  220. onHide() {
  221. // #ifdef APP-PLUS
  222. uni.offKeyboardHeightChange(); // 取消监听键盘高度变化事件,避免内存消耗
  223. // #endif
  224. },
  225. onReady() {
  226. // this.$refs.form.setRules(this.rules)
  227. },
  228. methods: {
  229. checkPermi, checkRole,
  230. // 项目详情
  231. // that.diff_amount = parseFloat(that.order.amount - that.money).toFixed(2);
  232. getDataFn(){
  233. var that=this;
  234. getdetailzdjzqkFn(this.id).then(res=>{
  235. if(res.code==200){
  236. this.datainfo=res.data;
  237. if(res.data.fjList&&res.data.fjList.length){
  238. this.filelist=JSON.parse(JSON.stringify(res.data.fjList))
  239. }
  240. }else{
  241. this.$toast(res.msg)
  242. }
  243. })
  244. },
  245. // 字典值
  246. getinvestmentarea(){
  247. // 所属行业
  248. getDictionaryFn('industry').then(res=>{
  249. if(res.code==200){
  250. this.industry=res.data
  251. }
  252. })
  253. },
  254. getNowFormatDate(){
  255. let date = new Date();
  256. let y = date.getFullYear();
  257. let m = date.getMonth() + 1;
  258. m = m < 10 ? "0" + m : m;
  259. let d = date.getDate();
  260. d = d < 10 ? "0" + d : d;
  261. const timeday = y + "-" + m + "-" + d;
  262. return timeday;
  263. },
  264. bindDateChangetimea(e){//计划开工时间
  265. this.datainfo.jhkgsj=e.detail.value
  266. },
  267. bindDateChangea(e) {// 完成
  268. var val=e.detail.value;
  269. this.datainfo.isJd=this.sflist[val].dictValue;
  270. },
  271. bindDateChangeb(e) {// 开工
  272. var val=e.detail.value;
  273. this.datainfo.isJs=this.sflist[val].dictValue;
  274. },
  275. bindDateChangec(e) {// 纳统
  276. var val=e.detail.value;
  277. this.datainfo.isNt=this.sflist[val].dictValue;
  278. },
  279. bindDateChanged(e) {// 竣工
  280. var val=e.detail.value;
  281. this.datainfo.isJg=this.sflist[val].dictValue;
  282. },
  283. getSubmit() {
  284. var that=this;
  285. this.$refs.form.validate().then(res => {
  286. var params=this.datainfo;
  287. if(params.isNt=='Y'){
  288. if(!params.nttz){
  289. that.$toast('请输入纳统资金')
  290. return
  291. }
  292. }
  293. if(this.pagetype=='add'){
  294. getaddzdjzqkFn(params).then(res=>{
  295. if(res.code==200){
  296. this.$toast('新增汇报进度成功')
  297. setTimeout(function() {
  298. uni.$emit('refreshdatazd');
  299. if(that.jzfrom=='ratelist'){
  300. uni.navigateBack({delta: 2});
  301. }else{
  302. uni.navigateBack({delta: 1});
  303. }
  304. },1500);
  305. }else{
  306. this.$toast(res.msg)
  307. }
  308. })
  309. }else{
  310. getputzdjzqkFn(params).then(res=>{
  311. if(res.code==200){
  312. this.$toast('修改汇报进度成功')
  313. setTimeout(function() {
  314. uni.$emit('refreshdatazd');
  315. uni.navigateBack({delta: 1});
  316. },1500);
  317. }else{
  318. this.$toast(res.msg)
  319. }
  320. })
  321. }
  322. })
  323. },
  324. onuploadEnd(item) {
  325. var newobj={}
  326. var responseText=JSON.parse(item.responseText)
  327. newobj.fjName=responseText.originalFilename;
  328. newobj.path=responseText.fileName;
  329. newobj.xmId=this.datainfo.xmId;
  330. newobj.xmmc=this.datainfo.xmmc;
  331. newobj.type= '18';
  332. this.filelist.push(newobj)
  333. this.datainfo.fjList=JSON.parse(JSON.stringify(this.filelist))
  334. },
  335. getDelFj(idx){
  336. var that=this;
  337. if(!this.disabled){
  338. uni.showModal({
  339. title: '确认删除',
  340. content: "是否确认删除",
  341. cancelText: '取消',
  342. confirmText: '确认',
  343. success: function(res) {
  344. if (res.confirm) {
  345. that.filelist.splice(idx,1)
  346. that.datainfo.fjList=JSON.parse(JSON.stringify(that.filelist))
  347. } else if (res.cancel) {
  348. }
  349. }
  350. });
  351. }
  352. },
  353. getDown(e){
  354. uni.showLoading({
  355. title: '加载中'
  356. });
  357. var url=baseUrl+e;
  358. uni.downloadFile({
  359. url: url,//文件的下载路径
  360. success(result) {
  361. uni.hideLoading()
  362. var filePath = result.tempFilePath;
  363. uni.openDocument({
  364. filePath: filePath,
  365. showMenu: true,
  366. success: function (res) {
  367. // console.log('打开文档成功');
  368. }
  369. });
  370. },
  371. fail(res) {uni.hideLoading()}
  372. })
  373. },
  374. }
  375. }
  376. </script>
  377. <style lang="scss" scoped>
  378. .inform{padding-top: 30rpx; padding-bottom: 160rpx;}
  379. .infolist{padding: 30rpx 32rpx 30rpx 24rpx;position: relative;display: flex;align-items: center;
  380. .cir{position: absolute;font-size: 36rpx;font-weight: bold;color: #FE5706;left: 0rpx;}
  381. }
  382. .delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center;
  383. image{width: 30rpx;height: 30rpx;}
  384. }
  385. .infobtn{width: 100%;height: 88rpx;background: #FA5F03;line-height: 88rpx;position: fixed;left: 0;right: 0;bottom: 0;z-index: 3;}
  386. .input_ye image{width: 34rpx;height: 18rpx;}
  387. .info_tit{font-size: 32rpx;color: #FE5706;padding: 30rpx 26rpx;font-weight: bold;}
  388. .infolist_a{height: 44rpx;flex: 1;text-align: right;font-size: 32rpx;color: #343434;}
  389. .inform /deep/ .uni-forms-item__error{margin-top: -30rpx;margin-left: 24rpx;}
  390. .inform .pl12{margin-right: 10rpx;}
  391. .fixedbox .pl12{margin-right: 10rpx;}
  392. // 计算合计
  393. .infohjbtn{font-size: 30rpx;margin-left: 20rpx;color: #3C9BCD;}
  394. </style>