changeRenwu.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. <template>
  2. <view class="content">
  3. <view class="param">
  4. <view class="proMiao">任务名称</view>
  5. <input class="proINname" v-model="data.taskName" placeholder="请输入任务名称"/>
  6. <view class="proMiao">评分标准</view>
  7. <textarea class="proINname proIMi" v-model="data.scoreStandard" placeholder="请输入评分标准"/>
  8. <view class="proMiao">附件</view>
  9. <view class="upload-img">
  10. <uni-file-picker limit="3"
  11. @select='selectUpload'
  12. @delete="deleteHandle"
  13. :auto-upload='false'
  14. file-extname='pdf,docx,jpg,png,jpeg'
  15. file-mediatype="all"
  16. @success='uploadSuccess'
  17. @fail='uploadFail'
  18. :list-styles='listStyles'
  19. v-model='fileList2'
  20. ></uni-file-picker>
  21. </view>
  22. <span style="margin: 20rpx 0 0 20rpx;">支持pdf/word/xlsx格式,单个文件大小不超过5MB</span>
  23. <view class="proMiao">评分上限</view>
  24. <input class="proINname" placeholder="请输入评分上限" type="number" v-model="data.scoreLimit"/>
  25. <view class="proMiao">权重</view>
  26. <input class="proINname" placeholder="请输入权重" type="digit" v-model="data.weight"/>
  27. <view class="proMiao">任务负责人</view>
  28. <view @click="toggle()">
  29. <input class="proINname" v-model="peopleValue" placeholder="请选择任务负责人"/>
  30. <!-- <uni-data-select class="proINname" :disabled="true"
  31. v-model="peopleValue" placeholder="请选择主办人"
  32. :localdata="rangePeople"
  33. ></uni-data-select> -->
  34. </view>
  35. <view class="proMiao">提醒时间</view>
  36. <uni-datetime-picker class="proINname" type="datetime" v-model="data.remindTime" @change="changeLog" />
  37. <view class="proMiao">预警时间</view>
  38. <uni-datetime-picker class="proINname" type="datetime" v-model="data.warnTime" @change="changeLog" />
  39. <view class="proMiao">任务周期</view>
  40. <uni-datetime-picker class="proINname" v-model="datetimerange" type="datetimerange" rangeSeparator="至" />
  41. <!-- 操作键 -->
  42. <view class="project">
  43. <view class="butt queren" @click="updateRen">保存</view>
  44. </view>
  45. <view style="width: 100%;height: 60rpx;"></view>
  46. <!-- 任务负责人弹出框-->
  47. <uni-popup ref="popup" background-color="#fff">
  48. <view class="popup-content">
  49. <view class="popup-title">
  50. <view @click="quPopup">取消</view>
  51. <view>选择任务负责人</view>
  52. <view style="color: rgba(0, 97, 255, 1);" @click="selectPeo">确定</view>
  53. </view>
  54. <view class="popup-list">
  55. <radio-group @change="radioChange" v-for="(item,index) in people" :key="index">
  56. <view class="l-line"></view>
  57. <view class="l-kuang">
  58. <view class="l-circle"></view>
  59. <view style="margin-left: 20rpx;width: 320px;">
  60. <view style="font-size: 28rpx;">{{item.userName}}</view>
  61. <view style="font-size: 24rpx;">{{item.department}}</view>
  62. </view>
  63. <label class="l-label">
  64. <view>
  65. <radio :id="item.userName" :value="item.userName" :checked="index==peopleCruuent"></radio>
  66. </view>
  67. </label>
  68. </view>
  69. </radio-group>
  70. </view>
  71. </view>
  72. </uni-popup>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import configdata from '@/common/config.js'
  78. export default {
  79. data() {
  80. return {
  81. data:{},
  82. renwuName:'',//任务名称
  83. projectId:'',//项目id
  84. scoreStandard:'',//评价标准
  85. scoreLimit:'',//评分上限
  86. weight:'',//权重
  87. remindTime: '',//提醒时间
  88. warnTime:'',//预警时间
  89. datetimerange: [],
  90. people:[],
  91. peopleCruuent:'',
  92. peopleValue:'',
  93. peopleId:'',
  94. // 附件
  95. fileList: [],
  96. fileList2: [],
  97. fileList22:'',
  98. listStyles: {
  99. "borderStyle": {
  100. "width": "0", // 边框宽度
  101. },
  102. "border": false, // 是否显示边框
  103. "dividline": false
  104. },
  105. }
  106. },
  107. onLoad(option) {
  108. console.log(JSON.parse(decodeURIComponent(option.data)))
  109. this.data=JSON.parse(decodeURIComponent(option.data))
  110. this.getPeople()
  111. this.peopleValue=this.data.headerName
  112. this.datetimerange[0]=this.data.startTime
  113. this.datetimerange[1]=this.data.endTime
  114. var image=[]
  115. image=this.data.fileUrl.split(',')
  116. this.fileList2 =image.map(item =>{
  117. return {
  118. name: item
  119. }
  120. })
  121. this.fileList22=image.join(",")
  122. console.log(this.fileList2)
  123. },
  124. methods: {
  125. // 任务负责人弹框
  126. toggle() {
  127. console.log('dd')
  128. // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
  129. this.$refs.popup.open('bottom')
  130. this.getPeople()
  131. },
  132. //取消弹框
  133. quPopup(){
  134. this.$refs.popup.close()
  135. },
  136. //确定负责人
  137. selectPeo(){
  138. this.$refs.popup.close()
  139. this.peopleValue=this.people[this.peopleCruuent].userName
  140. this.peopleId=this.people[this.peopleCruuent].id
  141. },
  142. // 选择负责人
  143. radioChange: function(evt) {
  144. console.log(evt)
  145. for (let i = 0; i < this.people.length; i++) {
  146. if (this.people[i].userName === evt.detail.value) {
  147. this.peopleCruuent = i;
  148. break;
  149. }
  150. }
  151. },
  152. //选择负责人
  153. getPeople(){
  154. this.people=[]
  155. uni.showLoading({
  156. title: '加载中',
  157. mask: true, // 是否显示透明蒙层,防止触摸穿透
  158. });
  159. this.$Request.postJson('/api/sysUser/queryPage?page=1&rows=10',{
  160. "userName": null, // 姓名
  161. "roleName": null, // 角色名称
  162. "department": null, // 部门
  163. "createBy": "", // 创建时间-开始日期
  164. "updateBy": "" // 创建时间-结束日期
  165. }).then(res => {
  166. if (res.code==200&&res.data.total>0) {
  167. var total=res.data.total
  168. this.$Request.postJson('/api/sysUser/queryPage?page=1&rows='+total,{
  169. "userName": null, // 姓名
  170. "roleName": null, // 角色名称
  171. "department": null, // 部门
  172. "createBy": "", // 创建时间-开始日期
  173. "updateBy": "" // 创建时间-结束日期
  174. }).then(res => {
  175. if (res.code==200&&res.data) {
  176. this.people =res.data.rows
  177. console.log(this.people,'人')
  178. for(var i=0;i<this.people.length;i++){
  179. if(this.people[i].userName==this.data.headerName){
  180. this.peopleId=this.people[i].id
  181. }
  182. }
  183. }
  184. });
  185. }
  186. uni.hideLoading();
  187. });
  188. },
  189. //修改任务
  190. updateRen(){
  191. let that = this
  192. if (!that.data.taskName) {
  193. that.$queue.showToast("请输入任务名称");
  194. }else if (!that.data.scoreStandard) {
  195. that.$queue.showToast("请输入评分标准");
  196. }else if (!that.data.scoreLimit) {
  197. that.$queue.showToast("请输入评分上限");
  198. }else if (!that.data.weight) {
  199. that.$queue.showToast("请输入权重");
  200. }else if (!that.data.remindTime) {
  201. that.$queue.showToast("请选择提醒时间");
  202. }else if (!that.data.warnTime) {
  203. that.$queue.showToast("请选择预警时间");
  204. }else if (!that.datetimerange) {
  205. that.$queue.showToast("请选择周期");
  206. } else if (!that.peopleId) {
  207. that.$queue.showToast("请选择任务负责人");
  208. }else {
  209. uni.showLoading({
  210. title: '加载中',
  211. mask: true, // 是否显示透明蒙层,防止触摸穿透
  212. });
  213. var data={
  214. "id": that.data.id,
  215. "taskName": that.data.taskName, // 任务名称
  216. "projectId": that.data.projectId, // 项目ID
  217. "scoreStandard": that.data.scoreStandard, // 评价标准
  218. "fileUrl": that.fileList22, // 附件
  219. "scoreLimit": that.data.scoreLimit, // 评分上限
  220. "weight": that.data.weight, // 权重
  221. "remindTime": that.data.remindTime, // 提醒时间
  222. "warnTime": that.data.warnTime, // 预警时间
  223. "header": that.peopleId, // 负责人
  224. "startTime": that.datetimerange[0], // 周期-起始时间
  225. "endTime": that.datetimerange[1] // 周期-结束时间
  226. }
  227. that.$Request.postJson('/api/sysTask/update',data).then(res => {
  228. if (res.code==200) {
  229. uni.showToast({
  230. title: '修改成功',
  231. icon: 'none',
  232. duration:800
  233. });
  234. uni.hideLoading()
  235. setTimeout(function() {
  236. uni.switchTab({
  237. url:'/pages/project/index'
  238. })
  239. }, 1000)
  240. } else {
  241. uni.hideLoading();
  242. uni.showToast({
  243. title: res.message,
  244. icon: 'none',
  245. duration:800
  246. });
  247. }
  248. });
  249. }
  250. },
  251. // 上传附件
  252. uploadSuccess(e) {
  253. console.log('上传成功', e)
  254. },
  255. uploadFail(e) {
  256. console.log('上传失败:', e)
  257. },
  258. //删除文件
  259. deleteHandle(index){
  260. console.log(index)
  261. this.fileList2.splice(index.index,1)
  262. // console.log(this.fileList2)
  263. this.fileList22=this.fileList2.join(",")
  264. },
  265. async selectUpload(e) {
  266. console.log('上传:', e)
  267.  let data = new FormData();
  268.   data.set("file", e.tempFiles[0].file);
  269.   let res = await this.$axios({
  270.     method: "post",
  271.     url: this.config('APIHOST1') + "/api/sysFile/upload",
  272.     headers: {
  273. tokenW: localStorage.getItem("token"),
  274. "Content-Type": "multipart/form-data"
  275.     },
  276.     data: data,
  277.   });
  278. // return res
  279.   console.log(res, "图片上传成功");
  280.   if (res.data.code == 200) {
  281. console.log(this.fileList)
  282.     this.fileList2.push(res.data.data);
  283. this.fileList22=this.fileList2.join(",")
  284. // console.log(this.fileList2.join(","))
  285.   } else if(res.message=="登录凭证已过去,请重新登录"){
  286. uni.removeStorageSync("tokenW")
  287. uni.removeStorageSync("roleId")
  288. uni.showModal({
  289. title: '提示',
  290. content: '用户信息失效,请重新登录!',
  291. showCancel: false, // 是否显示取消按钮,默认为 true // 是否显示取消按钮,默认为 true
  292. success: function(res) {
  293. if (res.confirm) {
  294. }
  295. }
  296. });
  297. }else {
  298.     uni.showToast({
  299. title: res.message,
  300. icon: 'none',
  301. duration:800
  302. });
  303.   }
  304. },
  305. config: function (name) {
  306. var info = null
  307. if (name) {
  308. var name2 = name.split('.') //字符分割
  309. if (name2.length > 1) {
  310. info = configdata[name2[0]][name2[1]] || null
  311. } else {
  312. info = configdata[name] || null
  313. }
  314. if (info == null) {
  315. let web_config = cache.get('web_config')
  316. if (web_config) {
  317. if (name2.length > 1) {
  318. info = web_config[name2[0]][name2[1]] || null
  319. } else {
  320. info = web_config[name] || null
  321. }
  322. }
  323. }
  324. }
  325. return info
  326. },
  327. }
  328. }
  329. </script>
  330. <style>
  331. .content {
  332. display: flex;
  333. flex-direction: column;
  334. align-items: center;
  335. justify-content: center;
  336. }
  337. .param{
  338. margin: 20rpx 0 0 0;
  339. width: 100%;
  340. background-color: rgba(255, 255, 255, 1);
  341. font-size: 28rpx;
  342. font-weight: 400;
  343. line-height: 41rpx;
  344. color: rgba(0, 0, 0, 1);
  345. }
  346. .proMiao{
  347. margin: 31rpx 0 0 20rpx;
  348. }
  349. /* 上传附件 */
  350. .upload-img{
  351. /* margin: 25rpx 0 0 21rpx;
  352. width: 200rpx;
  353. height: 80rpx;
  354. opacity: 1;
  355. border-radius: 13rpx;
  356. background: rgba(0, 97, 255, 0.1);
  357. border: 1rpx solid rgba(0, 97, 255, 1); */
  358. }
  359. .proINname{
  360. margin: 25rpx 0 0 21rpx;
  361. width: 709rpx;
  362. height: 90rpx;
  363. border-radius: 13rpx;
  364. background: rgba(245, 248, 252, 1);
  365. border: 1rpx solid rgba(229, 229, 229, 1);
  366. font-size: 28rpx;
  367. line-height: 90rpx;
  368. color: rgba(179, 179, 179, 1);
  369. }
  370. .proIMi{
  371. height: 315rpx;
  372. }
  373. /* 操作键 */
  374. .project{
  375. display: flex;
  376. margin: 61rpx 0 0 0;
  377. justify-content: space-evenly;
  378. }
  379. .butt{
  380. width: 330rpx;
  381. height: 90rpx;
  382. border-radius: 117rpx;
  383. font-size: 32rpx;
  384. line-height: 90rpx;
  385. text-align: center;
  386. }
  387. .quxiao{
  388. border: 1rpx solid rgba(0, 97, 255, 1);
  389. color: rgba(0, 97, 255, 1);
  390. }
  391. .queren{
  392. background: rgba(0, 97, 255, 1);
  393. color: rgba(255, 255, 255, 1);
  394. }
  395. /* 任务负责人弹出框 */
  396. .popup-title{
  397. display: flex;
  398. width: 100%;
  399. height: 104rpx;
  400. font-size: 32rpx;
  401. line-height: 104rpx;
  402. justify-content: space-around;
  403. color: rgba(0, 0, 0, 1);
  404. }
  405. .l-line{
  406. width: 100%;
  407. border: 1rpx solid rgba(230, 230, 230, 1);
  408. }
  409. .l-kuang{
  410. margin: 40rpx 0 0 20rpx;
  411. display: flex;
  412. }
  413. .l-circle{
  414. width: 80rpx;
  415. height: 80rpx;
  416. border-radius: 50%;
  417. background-color:rgba(204, 204, 204, 1);
  418. }
  419. .l-label1{
  420. width: 50rpx;
  421. height: 50rpx;
  422. opacity: 1;
  423. border-radius: 50%;
  424. background-color: rgba(0, 97, 255, 1);
  425. }
  426. .l-label{
  427. /* margin-left: 404rpx; */
  428. /* width: 50rpx;
  429. height: 50rpx;
  430. opacity: 1;
  431. border-radius: 50%;
  432. border: 1rpx solid rgba(166, 166, 166, 1); */
  433. }
  434. </style>