projectChange.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. <template>
  2. <view class="content">
  3. <view class="param">
  4. <view class="all-text">创建项目需求</view>
  5. <view class="proName">项目标题</view>
  6. <input class="proINname" v-model="data.projectName" placeholder="请输入项目标题"/>
  7. <view class="proMiao">项目描述</view>
  8. <textarea class="proINname proIMi" v-model="data.projectContent" placeholder="请输入项目描述"/>
  9. <view class="proMiao">附件</view>
  10. <view class="upload-img">
  11. <uni-file-picker limit="3"
  12. @select='selectUpload'
  13. @delete="deleteHandle"
  14. :auto-upload='false'
  15. file-extname='pdf,docx,jpg,png,jpeg'
  16. file-mediatype="all"
  17. @success='uploadSuccess'
  18. @fail='uploadFail'
  19. :list-styles='listStyles'
  20. v-model='fileList2'
  21. ></uni-file-picker>
  22. </view>
  23. <span style="margin: 20rpx 0 0 20rpx;">支持pdf/word/xlsx格式,单个文件大小不超过5MB</span>
  24. <view class="proMiao">主办单位</view>
  25. <uni-data-select class="proINname"
  26. v-model="value" placeholder="请选择主办单位"
  27. :localdata="range"
  28. @change="change"
  29. ></uni-data-select>
  30. <view class="proMiao">主办人</view>
  31. <uni-data-select class="proINname"
  32. v-model="peopleValue" placeholder="请选择主办人"
  33. :localdata="rangePeople"
  34. @change="change"
  35. ></uni-data-select>
  36. <view class="proMiao">协办单位</view>
  37. <mySelectCheckbox class="proINname" placeholder="请选择协办单位" v-model="value2" multiple dataKey="label" dataValue="value" :localdata="data2"
  38. @change="changeXie"></mySelectCheckbox>
  39. <view class="proMiao">协办人</view>
  40. <mySelectCheckbox class="proINname" placeholder="请选择协办人" v-model="peopleValue2" multiple dataKey="label" dataValue="value" :localdata="dataPeople"
  41. @change="changeXiePeo"></mySelectCheckbox>
  42. <view class="proMiao">项目级别</view>
  43. <uni-data-select class="proINname"
  44. v-model="jibieValue" placeholder="请选择项目级别"
  45. :localdata="jibie"
  46. @change="change"
  47. ></uni-data-select>
  48. <view class="proMiao">项目来源</view>
  49. <uni-data-select class="proINname"
  50. v-model="fromValue" placeholder="请选择项目来源"
  51. :localdata="from"
  52. @change="change"
  53. ></uni-data-select>
  54. <view class="proMiao">项目评分人</view>
  55. <mySelectCheckbox class="proINname" placeholder="请选择项目评分人" v-model="value2" multiple dataKey="label" dataValue="value" :localdata="data"
  56. @change="changeXie"></mySelectCheckbox>
  57. <view class="proMiao jindu">完成进度</view>
  58. <view class="weidu">维度权重40%</view>
  59. <view class="addRen" @click="addRen">新增任务</view>
  60. <!-- 任务列表 -->
  61. <view style="width: 100%;margin: 50rpx 0 0 20rpx;">
  62. <view class="renwu" v-for="(item,index) in renwu" :key="index" @click="clickRenwu(item)">
  63. <view>{{item.taskName}}</view>
  64. <view>{{item.createTime}}</view>
  65. <view style="display: flex;">
  66. <view class="renwu-bu bianji" @click.stop="bianjiRenwu(item)">编辑</view>
  67. <view class="renwu-bu delete" @click.stop="deleteRenwu(item)">删除</view>
  68. </view>
  69. </view>
  70. </view>
  71. <view style="width: 100%;margin: 50rpx 0 0 20rpx;">
  72. <view class="renwu" v-for="(item,index) in renwu" :key="index">
  73. <view>{{item.taskName}}</view>
  74. <view>{{item.createTime}}</view>
  75. <view>30%</view>
  76. <view>{{item.scoreLimit}}</view>
  77. <view style="color: rgba(0, 97, 255, 1);" @click="updateJin(item)">更新进度</view>
  78. <view style="color: rgba(0, 97, 255, 1);" @click="cuirenwu(item)">催办</view>
  79. </view>
  80. </view>
  81. <view class="proMiao jindu" v-if="data.progress>0">进度详情</view>
  82. <!-- 进度 -->
  83. <view style="margin: 33rpx 0 0 19rpx;" v-if="data.progress>0">
  84. <view v-for="(item,index) in 5" :key="index" class="jindu-kuang">
  85. <view style="display: flex;">
  86. <view class="jindu-circle"></view>
  87. <view>
  88. <view style="width: 600rpx;display: flex;justify-content: space-between;margin-top: 20rpx;">
  89. <view style="display: flex;">
  90. <view style="margin-left: 28rpx;">周提</view>
  91. <view class="jindu-type lixiang">已立项</view>
  92. </view>
  93. <!-- <view class="jindu-type cuiban">已催办</view>
  94. <view class="jindu-type tijiao">已提交</view> -->
  95. <view>2024-06-10 12:00:00</view>
  96. </view>
  97. <view style="margin:7rpx 0 0 28rpx;">任务指派:xxx,xxx,xxx</view>
  98. <view style="margin:7rpx 0 0 28rpx;">任务指派:xxx,xxx,xxx</view>
  99. <view style="margin:7rpx 0 0 28rpx;">任务指派:xxx,xxx,xxx</view>
  100. <view style="margin:7rpx 0 0 28rpx;">任务指派:xxx,xxx,xxx</view>
  101. </view>
  102. </view>
  103. <view class="jindu-line" v-if="index<4"></view>
  104. </view>
  105. </view>
  106. <view class="project">
  107. <view class="butt queren" @click="updatePro">保存</view>
  108. </view>
  109. <view style="width: 100%;height: 60rpx;"></view>
  110. </view>
  111. </view>
  112. </template>
  113. <script>
  114. import configdata from '@/common/config.js'
  115. import mySelectCheckbox from '../../components/my-selectCheckbox.vue'
  116. export default {
  117. data() {
  118. return {
  119. data:{},
  120. //主办单位
  121. value: '',
  122. range: [],
  123. //主办人
  124. peopleValue:'',
  125. rangePeople:[],
  126. //协办
  127. value2:[],
  128. data2: [],
  129. xieban:[],//协办传入值数组
  130. xieValue:[],//协办传入id
  131. //协办人
  132. peopleValue2:[],
  133. dataPeople: [],
  134. xiebanPeople:[],//协办传入值数组
  135. xieValuePeople:[],//协办传入id
  136. // 项目级别
  137. jibieValue:0,
  138. jibie:[
  139. { value: 0, text: "正常" },
  140. { value: 1, text: "紧急" },
  141. ],
  142. // 项目来源
  143. fromValue:0,
  144. from:[
  145. { value: 0, text: "涉内" },
  146. { value: 1, text: "涉外" },
  147. ],
  148. fileList2: [],
  149. fileList22:'',
  150. // fileList: [
  151. // {name:'111'},
  152. // {name:'333'}
  153. // ],
  154. listStyles: {
  155. "borderStyle": {
  156. "width": "0", // 边框宽度
  157. },
  158. "border": false, // 是否显示边框
  159. "dividline": false
  160. },
  161. renwu:[],
  162. }
  163. },
  164. onLoad(option) {
  165. console.log(JSON.parse(decodeURIComponent(option.data)))
  166. this.data=JSON.parse(decodeURIComponent(option.data))
  167. this.getDanwei()
  168. for(var i=0;i<this.jibie.length;i++){
  169. if(this.jibie[i].text==this.data.projectLevel){
  170. this.jibieValue=this.jibie[i].value
  171. }
  172. }
  173. for(var i=0;i<this.from.length;i++){
  174. if(this.from[i].text==this.data.projectFrom){
  175. this.fromValue=this.from[i].value
  176. }
  177. }
  178. var image=[]
  179. image=this.data.fileUrl.split(',')
  180. this.fileList2 =image.map(item =>{
  181. return {
  182. name: item
  183. }
  184. })
  185. this.fileList22=image.join(",")
  186. console.log(this.fileList2)
  187. this.getRenwu()
  188. },
  189. methods: {
  190. change(e) {
  191. console.log("e:", e);
  192. },
  193. //新增任务
  194. addRen(){
  195. uni.navigateTo({
  196. url:'/pages/project/addRenwu?proId='+this.data.id
  197. })
  198. },
  199. //编辑任务
  200. bianjiRenwu(item){
  201. //传参对象,使用encodeURIComponent编码
  202. let str = JSON.stringify(item)
  203. //注意这里——————————————————————
  204. str = str.replace(/%/g, '%25')
  205. //这里———————————————————————————
  206. let query = encodeURIComponent(str)
  207. uni.navigateTo({
  208. url:'/pages/project/changeRenwu?data='+query
  209. })
  210. },
  211. //删除任务
  212. deleteRenwu(item){
  213. let that = this
  214. uni.showModal({
  215. title: '提示',
  216. content: '确定删除任务吗?',
  217. success: function(res) {
  218. if (res.confirm) {
  219. console.log('用户点击确定');
  220. uni.showLoading({
  221. title: '加载中',
  222. mask: true, // 是否显示透明蒙层,防止触摸穿透
  223. });
  224. let data={
  225. id:item.id,
  226. }
  227. that.$Request.postT('/api/sysTask/del',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. that.getRenwu()
  237. }, 1000)
  238. } else {
  239. uni.hideLoading();
  240. uni.showToast({
  241. title: res.message,
  242. icon: 'none',
  243. duration:800
  244. });
  245. }
  246. });
  247. } else if (res.cancel) {
  248. console.log('用户点击取消');
  249. }
  250. }
  251. })
  252. },
  253. //任务详情
  254. clickRenwu(item){
  255. //传参对象,使用encodeURIComponent编码
  256. let str = JSON.stringify(item)
  257. //注意这里——————————————————————
  258. str = str.replace(/%/g, '%25')
  259. //这里———————————————————————————
  260. let query = encodeURIComponent(str)
  261. uni.navigateTo({
  262. url:'/pages/project/renwuX?data='+query
  263. })
  264. },
  265. //更新进度
  266. updateJin(item){
  267. //传参对象,使用encodeURIComponent编码
  268. let str = JSON.stringify(item)
  269. //注意这里——————————————————————
  270. str = str.replace(/%/g, '%25')
  271. //这里———————————————————————————
  272. let query = encodeURIComponent(str)
  273. uni.navigateTo({
  274. url:'/pages/project/renwuUpdateJin?data='+query
  275. })
  276. },
  277. //催办任务
  278. cuirenwu(item){
  279. let that = this
  280. uni.showModal({
  281. title: '提示',
  282. content: '确定催办任务吗?',
  283. success: function(res) {
  284. if (res.confirm) {
  285. console.log('用户点击确定');
  286. uni.showLoading({
  287. title: '加载中',
  288. mask: true, // 是否显示透明蒙层,防止触摸穿透
  289. });
  290. let data={
  291. taskId:item.id,
  292. }
  293. that.$Request.postT('/api/sysTask/urge',data).then(res => {
  294. if (res.code==200) {
  295. uni.showToast({
  296. title: '催办成功',
  297. icon: 'none',
  298. duration:800
  299. });
  300. uni.hideLoading()
  301. setTimeout(function() {
  302. that.getRenwu()
  303. }, 1000)
  304. } else {
  305. uni.hideLoading();
  306. uni.showToast({
  307. title: res.message,
  308. icon: 'none',
  309. duration:800
  310. });
  311. }
  312. });
  313. } else if (res.cancel) {
  314. console.log('用户点击取消');
  315. }
  316. }
  317. })
  318. },
  319. //获取单位
  320. getDanwei(){
  321. this.range=[]
  322. this.data2=[]
  323. uni.showLoading({
  324. title: '加载中',
  325. mask: true, // 是否显示透明蒙层,防止触摸穿透
  326. });
  327. this.$Request.postT('/api/Organize/query').then(res => {
  328. if (res.code==200&&res.data) {
  329. this.range =res.data.map(item =>{
  330. return {
  331. value: item.id,
  332. text: item.oname,
  333. id:item.oid
  334. }
  335. })
  336. this.data2 =res.data.map(item =>{
  337. return {
  338. value: item.id,
  339. label: item.oname,
  340. id:item.oid
  341. }
  342. })
  343. for(var i=0;i<this.range.length;i++){
  344. if(this.range[i].text==this.data.organize){
  345. this.value=this.range[i].value
  346. }
  347. }
  348. // for(var i=0;i<this.data2.length;i++){
  349. // if(this.data2[i].label==this.data.){
  350. // this.value2=this.data2[i].value
  351. // }
  352. // }
  353. }
  354. uni.hideLoading();
  355. });
  356. },
  357. // 查找任务
  358. getRenwu(){
  359. let that = this
  360. that.renwu=[]
  361. uni.showLoading({
  362. title: '加载中',
  363. mask: true, // 是否显示透明蒙层,防止触摸穿透
  364. });
  365. var data={
  366. "projectId": that.data.id
  367. }
  368. that.$Request.postT('/api/sysTask/queryTaskByProject',data).then(res => {
  369. if (res.code==200) {
  370. that.renwu=res.data
  371. console.log(that.renwu,'任务')
  372. }
  373. uni.hideLoading();
  374. });
  375. },
  376. // 上传附件
  377. uploadSuccess(e) {
  378. console.log('上传成功', e)
  379. },
  380. uploadFail(e) {
  381. console.log('上传失败:', e)
  382. },
  383. //保存编辑项目
  384. updatePro(){
  385. let that = this
  386. if (!that.data.projectName) {
  387. that.$queue.showToast("请输入项目标题");
  388. }else if (!that.data.projectContent) {
  389. that.$queue.showToast("请输入项目描述");
  390. } else if (!that.value) {
  391. that.$queue.showToast("请选择主办单位");
  392. } else if (!that.value2) {
  393. that.$queue.showToast("请选择协办单位");
  394. }else {
  395. uni.showLoading({
  396. title: '加载中',
  397. mask: true, // 是否显示透明蒙层,防止触摸穿透
  398. });
  399. that.$Request.postJson("/api/sysProject/update", {
  400. "id": that.data.id,
  401. "projectName": that.data.projectName, // 项目名称
  402. "projectFrom": that.from[that.fromValue].text, // 项目来源
  403. "projectLevel": that.jibie[that.jibieValue].text, // 项目等级
  404. "projectContent": that.data.projectContent, // 项目描述
  405. "fileUrl": that.fileList22, // 附件
  406. "organize": that.range[that.value].text, // 主办单位-单选
  407. "sposoner": "25", // 主办人ID-单选
  408. "coOrganize": "产教融合处,信息与控制技术研究所", // 协办单位-多选
  409. "coSposoner": "20,23" // 协办人ID-多选
  410. }).then(res => {
  411. if (res.code == 200) {
  412. uni.showToast({
  413. title: '修改成功',
  414. icon: 'none',
  415. duration:800
  416. });
  417. uni.hideLoading()
  418. setTimeout(function() {
  419. uni.switchTab({
  420. url:'/pages/project/index'
  421. })
  422. }, 1000)
  423. } else {
  424. uni.hideLoading();
  425. uni.showToast({
  426. title: res.message,
  427. icon: 'none',
  428. duration:800
  429. });
  430. }
  431. });
  432. }
  433. },
  434. //删除文件
  435. deleteHandle(index){
  436. console.log(index)
  437. this.fileList2.splice(index.index,1)
  438. console.log(this.fileList2)
  439. this.fileList22=this.fileList2.join(",")
  440. },
  441. async selectUpload(e) {
  442. console.log('上传:', e)
  443.  let data = new FormData();
  444.   data.set("file", e.tempFiles[0].file);
  445.   let res = await this.$axios({
  446.     method: "post",
  447.     url: this.config('APIHOST1') + "/api/sysFile/upload",
  448.     headers: {
  449. tokenW: localStorage.getItem("token"),
  450. "Content-Type": "multipart/form-data"
  451.     },
  452.     data: data,
  453.   });
  454. // return res
  455.   console.log(res, "图片上传成功");
  456.   if (res.data.code == 200) {
  457. console.log(this.fileList2)
  458.     this.fileList2.push(res.data.data);
  459. this.fileList22=this.fileList2.join(",")
  460. // console.log(this.fileList2.join(","))
  461.   } else if(res.message=="登录凭证已过去,请重新登录"){
  462. uni.removeStorageSync("tokenW")
  463. uni.removeStorageSync("roleId")
  464. uni.showModal({
  465. title: '提示',
  466. content: '用户信息失效,请重新登录!',
  467. showCancel: false, // 是否显示取消按钮,默认为 true // 是否显示取消按钮,默认为 true
  468. success: function(res) {
  469. if (res.confirm) {
  470. }
  471. }
  472. });
  473. }else {
  474.     uni.showToast({
  475. title: res.message,
  476. icon: 'none',
  477. duration:800
  478. });
  479.   }
  480. },
  481. config: function (name) {
  482. var info = null
  483. if (name) {
  484. var name2 = name.split('.') //字符分割
  485. if (name2.length > 1) {
  486. info = configdata[name2[0]][name2[1]] || null
  487. } else {
  488. info = configdata[name] || null
  489. }
  490. if (info == null) {
  491. let web_config = cache.get('web_config')
  492. if (web_config) {
  493. if (name2.length > 1) {
  494. info = web_config[name2[0]][name2[1]] || null
  495. } else {
  496. info = web_config[name] || null
  497. }
  498. }
  499. }
  500. }
  501. return info
  502. },
  503. }
  504. }
  505. </script>
  506. <style>
  507. .content {
  508. display: flex;
  509. flex-direction: column;
  510. align-items: center;
  511. justify-content: center;
  512. }
  513. .param{
  514. margin: 20rpx 0 0 0;
  515. width: 100%;
  516. background-color: rgba(255, 255, 255, 1);
  517. font-size: 28rpx;
  518. font-weight: 400;
  519. line-height: 41rpx;
  520. color: rgba(0, 0, 0, 1);
  521. }
  522. .all-text{
  523. margin: 22rpx 0 0 20rpx;
  524. font-size: 32rpx;
  525. font-weight: 500;
  526. color: rgba(0, 0, 0, 1);
  527. }
  528. .proName{
  529. margin: 23rpx 0 0 20rpx;
  530. }
  531. .proINname{
  532. margin: 25rpx 0 0 21rpx;
  533. width: 709rpx;
  534. height: 90rpx;
  535. border-radius: 13rpx;
  536. background: rgba(245, 248, 252, 1);
  537. border: 1rpx solid rgba(229, 229, 229, 1);
  538. font-size: 28rpx;
  539. line-height: 90rpx;
  540. color: rgba(179, 179, 179, 1);
  541. }
  542. .proIMi{
  543. height: 315rpx;
  544. }
  545. .proMiao{
  546. margin: 31rpx 0 0 20rpx;
  547. }
  548. /* 上传附件 */
  549. .upload-img{
  550. /* width: 200rpx;
  551. height: 80rpx;
  552. opacity: 1;
  553. border-radius: 13rpx;
  554. background: rgba(0, 97, 255, 0.1);
  555. border: 1rpx solid rgba(0, 97, 255, 1); */
  556. }
  557. .jindu{
  558. font-size: 32rpx;
  559. font-weight: 500;
  560. line-height: 46rpx;
  561. }
  562. /* 进度 */
  563. .jindu-kuang{
  564. font-size: 24rpx;
  565. line-height: 35rpx;
  566. color: rgba(128, 128, 128, 1);
  567. }
  568. .jindu-circle{
  569. margin-top: 10rpx;
  570. width: 100rpx;
  571. height: 100rpx;
  572. border-radius: 50%;
  573. opacity: 1;
  574. background-color:rgba(204, 204, 204, 1);
  575. }
  576. .jindu-type{
  577. width: 103rpx;
  578. height: 40rpx;
  579. border-radius: 71rpx;
  580. font-size: 24rpx;
  581. line-height: 40rpx;
  582. color: rgba(255, 255, 255, 1);
  583. text-align: center;
  584. margin: 0 0 0 20rpx;
  585. }
  586. .lixiang{
  587. background: linear-gradient(90deg, rgba(54, 111, 255, 1) 0%, rgba(93, 160, 252, 1) 100%);
  588. }
  589. .cuiban{
  590. background: linear-gradient(90deg, rgba(57, 167, 139, 1) 0%, rgba(126, 224, 203, 1) 100%);
  591. }
  592. .tijiao{
  593. background: linear-gradient(90deg, rgba(255, 112, 69, 1) 0%, rgba(247, 161, 114, 1) 100%);
  594. }
  595. .jindu-line{
  596. width: 4rpx;
  597. height: 100rpx;
  598. background-color: rgba(166, 166, 166, 1);
  599. }
  600. .weidu{
  601. margin: 7rpx 0 0 20rpx;
  602. font-size: 24rpx;
  603. line-height: 35rpx;
  604. color: rgba(128, 128, 128, 1);
  605. }
  606. .addRen{
  607. margin: -80rpx 0 0 581rpx;
  608. width: 149rpx;
  609. height: 59rpx;
  610. border-radius: 92rpx;
  611. background: rgba(0, 97, 255, 1);
  612. font-size: 28rpx;
  613. line-height: 59rpx;
  614. color: rgba(255, 255, 255, 1);
  615. text-align: center;
  616. }
  617. /* 任务列表 */
  618. .renwu{
  619. display: flex;
  620. margin-top: 6rpx;
  621. width: 709rpx;
  622. height: 90rpx;
  623. border-radius: 13rpx;
  624. background: rgba(245, 248, 252, 1);
  625. border: 1rpx solid rgba(229, 229, 229, 1);
  626. font-size: 28rpx;
  627. justify-content: space-evenly;
  628. align-items: center;
  629. }
  630. .renwu-bu{
  631. width: 105rpx;
  632. height: 50rpx;
  633. border-radius: 110rpx;
  634. line-height:50rpx;
  635. text-align: center;
  636. }
  637. .bianji{
  638. border: 1rpx solid rgba(0, 97, 255, 1);
  639. color: rgba(0, 97, 255, 1);
  640. }
  641. .delete{
  642. margin-left: 20rpx;
  643. border: 1rpx solid rgba(212, 48, 48, 1);
  644. color: rgba(212, 48, 48, 1);
  645. }
  646. .project{
  647. display: flex;
  648. margin: 61rpx 0 0 0;
  649. justify-content: space-evenly;
  650. }
  651. .butt{
  652. width: 330rpx;
  653. height: 90rpx;
  654. border-radius: 117rpx;
  655. font-size: 32rpx;
  656. line-height: 90rpx;
  657. text-align: center;
  658. }
  659. .quxiao{
  660. border: 1rpx solid rgba(0, 97, 255, 1);
  661. color: rgba(0, 97, 255, 1);
  662. }
  663. .queren{
  664. background: rgba(0, 97, 255, 1);
  665. color: rgba(255, 255, 255, 1);
  666. }
  667. </style>