changeRenwu.vue 13 KB

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