projectChange.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  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-picker placeholder="请选择主办单位" popup-title="请选择主办人" :localdata="range" v-model="value"
  26. @change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened" @popupclosed="onpopupclosed">
  27. </uni-data-picker>
  28. <!-- <view class="proMiao">主办单位</view>
  29. <uni-data-select class="proINname"
  30. v-model="value" placeholder="请选择主办单位"
  31. :localdata="range"
  32. @change="change"
  33. ></uni-data-select>
  34. <view class="proMiao">主办人</view>
  35. <uni-data-select class="proINname"
  36. v-model="peopleValue" placeholder="请选择主办人"
  37. :localdata="rangePeople"
  38. @change="change"
  39. ></uni-data-select> -->
  40. <view class="proMiao">协办单位/协办人</view>
  41. <uni-data-picker placeholder="请选择协办单位" popup-title="请选择协办人" :showSearch= "true" :localdata="range" v-model="value2"
  42. @change="onchange2" @nodeclick="onnodeclick2" @popupopened="onpopupopened2" @popupclosed="onpopupclosed2">
  43. </uni-data-picker>
  44. <view class="proINname" style="height: 100%;">
  45. <view v-if="userListSelectwei.length>0" class="tag-view" v-for="(value,key) in userListSelectwei" :key="key" @click="clearTagAdminwei(value)">
  46. <uni-tag :text="value.value+'/'+value.text[key]" type="primary" ></uni-tag>
  47. <uni-icons class="clearBtn" type="clear" size="15" color="#ccc" />
  48. </view>
  49. <view v-if="userListSelectwei.length==0" class="tag-view" v-for="(value,key) in userListSelect" :key="key" @click="clearTagAdmin(value)">
  50. <uni-tag :text="value.parent_value.organize+'/'+value.text" type="primary" ></uni-tag>
  51. <!-- {{value.parent_value.organize}}/{{value.text}} -->
  52. <uni-icons class="clearBtn" type="clear" size="15" color="#ccc" />
  53. </view>
  54. </view>
  55. <!-- <view class="proMiao">协办单位</view>
  56. <mySelectCheckbox class="proINname" placeholder="请选择协办单位" v-model="value2" multiple dataKey="label" dataValue="value" :localdata="data2"
  57. @change="changeXie"></mySelectCheckbox>
  58. <view class="proMiao">协办人</view>
  59. <mySelectCheckbox class="proINname" placeholder="请选择协办人" v-model="peopleValue2" multiple dataKey="label" dataValue="value" :localdata="dataPeople"
  60. @change="changeXiePeo"></mySelectCheckbox> -->
  61. <view class="proMiao">项目级别</view>
  62. <uni-data-select class="proINname"
  63. v-model="jibieValue" placeholder="请选择项目级别"
  64. :localdata="jibie"
  65. @change="change"
  66. ></uni-data-select>
  67. <view class="proMiao">项目来源</view>
  68. <uni-data-select class="proINname"
  69. v-model="fromValue" placeholder="请选择项目来源"
  70. :localdata="from"
  71. @change="change"
  72. ></uni-data-select>
  73. <view class="proMiao">项目评分人</view>
  74. <mySelectCheckbox class="proINname" placeholder="请选择项目评分人" v-model="peoplescore" multiple dataKey="label" dataValue="value" :localdata="scorePeople"
  75. @change="changeScore"></mySelectCheckbox>
  76. <view class="proMiao jindu">完成进度</view>
  77. <view class="weidu">维度权重{{weidu}}%</view>
  78. <view class="addRen" @click="addRen" v-if="crerenwu==1&& (select==5 || select==3)">新增任务</view>
  79. <!-- 任务列表 -->
  80. <view style="width: 100%;margin: 50rpx 0 0 20rpx;">
  81. <view class="renwu" v-for="(item,index) in renwu" :key="index" @click="clickRenwu(item)">
  82. <view>{{item.taskName}}</view>
  83. <view>{{item.createTime}}</view>
  84. <view v-if="item.finishTime!=null">{{item.finishRemark}}</view>
  85. <view v-if="gengrenwu==1">{{item.weight}}</view>
  86. <view v-if="item.state==1">已完成</view>
  87. <view style="color: rgba(0, 97, 255, 1);" @click.stop="updateJin(item)" v-if="gengrenwu==1&& (select==5 || select==3|| select==4)">更新进度</view>
  88. <view style="color: rgba(0, 97, 255, 1);" @click.stop="cuirenwu2(item)" v-if="cuirenwu==1">催办</view>
  89. <view style="display: flex;">
  90. <view class="renwu-bu bianji" v-if="item.finishTime==null&&uprenwu==1&& (select==5 || select==3)" @click.stop="bianjiRenwu(item)">编辑</view>
  91. <view class="renwu-bu delete" @click.stop="deleteRenwu(item)" v-if="delerenwu==1&& (select==5 || select==3)">删除</view>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- <view style="width: 100%;margin: 50rpx 0 0 20rpx;">
  96. <view class="renwu" v-for="(item,index) in renwu" :key="index">
  97. <view>{{item.taskName}}</view>
  98. <view>{{item.createTime}}</view>
  99. <view>{{item.weight}}</view>
  100. <view>{{item.scoreLimit}}</view>
  101. <view style="color: rgba(0, 97, 255, 1);" @click="updateJin(item)" v-if="gengrenwu==1">更新进度</view>
  102. <view style="color: rgba(0, 97, 255, 1);" @click="cuirenwu(item)" v-if="cuirenwu==1">催办</view>
  103. </view>
  104. </view> -->
  105. <view class="proMiao jindu" v-if="data.progress>0">进度详情</view>
  106. <!-- 进度 -->
  107. <view style="margin: 33rpx 0 0 19rpx;" v-if="data.progress>0">
  108. <view v-for="(item,index) in 5" :key="index" class="jindu-kuang">
  109. <view style="display: flex;">
  110. <view class="jindu-circle"></view>
  111. <view>
  112. <view style="width: 600rpx;display: flex;justify-content: space-between;margin-top: 20rpx;">
  113. <view style="display: flex;">
  114. <view style="margin-left: 28rpx;">{{item.createName}}</view>
  115. <view class="jindu-type lixiang">{{item.content}}</view>
  116. </view>
  117. <!-- <view class="jindu-type cuiban">已催办</view>
  118. <view class="jindu-type tijiao">已提交</view> -->
  119. <view>{{item.createTime}}</view>
  120. </view>
  121. <view style="margin:7rpx 0 0 28rpx;">项目名:{{item.projectName}}</view>
  122. </view>
  123. </view>
  124. <!-- <view class="jindu-line" v-if="index<4"></view> -->
  125. </view>
  126. </view>
  127. <view class="project">
  128. <view class="butt queren" @click="updatePro">保存</view>
  129. </view>
  130. <view style="width: 100%;height: 60rpx;"></view>
  131. </view>
  132. </view>
  133. </template>
  134. <script>
  135. import configdata from '@/common/config.js'
  136. import mySelectCheckbox from '../../components/my-selectCheckbox.vue'
  137. export default {
  138. components:{mySelectCheckbox},
  139. data() {
  140. return {
  141. data:{},
  142. //主办单位
  143. value: '1-2',
  144. range: [],
  145. //主办人
  146. peopleValue:'',
  147. rangePeople:[],
  148. userListSelect1:[],
  149. //协办
  150. value2:'',
  151. userListSelect:[],
  152. userListSelectwei:[
  153. {value:'',text:''},
  154. ],
  155. data2: [],
  156. xieban:[],//协办传入值数组
  157. xieValue:[],//协办传入id
  158. //协办人
  159. peopleValue2:[],
  160. dataPeople: [],
  161. xiebanPeople:[],//协办传入值数组
  162. xieValuePeople:[],//协办传入id
  163. //评分人
  164. peoplescore:[],
  165. scorePeople: [],
  166. scorePeople22:[],//协办传入值数组
  167. scoreValuePeople:[],//协办传入id
  168. // 项目级别
  169. jibieValue:0,
  170. jibie:[
  171. { value: 0, text: "正常" },
  172. { value: 1, text: "紧急" },
  173. ],
  174. // 项目来源
  175. fromValue:0,
  176. from:[
  177. { value: 0, text: "涉内" },
  178. { value: 1, text: "涉外" },
  179. ],
  180. fileList2: [],
  181. fileList22:'',
  182. // fileList: [
  183. // {name:'111'},
  184. // {name:'333'}
  185. // ],
  186. listStyles: {
  187. "borderStyle": {
  188. "width": "0", // 边框宽度
  189. },
  190. "border": false, // 是否显示边框
  191. "dividline": false
  192. },
  193. renwu:[],
  194. weidu:'',
  195. crerenwu:1,//添加任务
  196. uprenwu:1,//修改任务
  197. delerenwu:1,//是否删除任务
  198. cuirenwu:1,//催办任务
  199. gengrenwu:1,//是否更新任务
  200. select:0,//状态
  201. }
  202. },
  203. onShow() {
  204. this.getPeopleZhu()
  205. },
  206. onLoad(option) {
  207. this.crerenwu=uni.getStorageSync('crerenwu')
  208. this.uprenwu=uni.getStorageSync('uprenwu')
  209. this.delerenwu=uni.getStorageSync('delerenwu')
  210. this.cuirenwu=uni.getStorageSync('cuirenwu')
  211. this.gengrenwu=uni.getStorageSync('gengrenwu')
  212. this.select=option.select
  213. console.log(JSON.parse(decodeURIComponent(option.data)))
  214. var wei=JSON.parse(decodeURIComponent(option.weidu))
  215. this.data=JSON.parse(decodeURIComponent(option.data))
  216. this.weidu=(wei[2].configValue)
  217. // this.getDanwei()
  218. this.getPeople(this.data.organize)
  219. for(var i=0;i<this.jibie.length;i++){
  220. if(this.jibie[i].text==this.data.projectLevel){
  221. this.jibieValue=this.jibie[i].value
  222. }
  223. }
  224. for(var i=0;i<this.from.length;i++){
  225. if(this.from[i].text==this.data.projectFrom){
  226. this.fromValue=this.from[i].value
  227. }
  228. }
  229. var image=[]
  230. image=this.data.fileUrl.split(',')
  231. this.fileList2 =image.map(item =>{
  232. return {
  233. name: item
  234. }
  235. })
  236. this.fileList22=image.join(",")
  237. console.log(this.fileList2)
  238. this.getRenwu()
  239. console.log(this.data.coOrganize.split(','))
  240. // this.userListSelect=
  241. this.userListSelectwei=[]
  242. var xieban=[]
  243. var xiebanpeo=[]
  244. var tt=[]
  245. var xiebanV=[]
  246. xieban=this.data.coOrganize.split(',')
  247. xiebanpeo=this.data.coSposonerName.split(',')
  248. xiebanV=this.data.coSposoner.split(',')
  249. this.userListSelectwei=xieban.map(item =>{
  250. console.log(item)
  251. return {
  252. value: item,
  253. text:xiebanpeo,
  254. id:xiebanV
  255. }
  256. })
  257. // for(var i=0;i<xieban.length;i++){
  258. // // for(var j=0;j<xiebanpeo.length;j++){
  259. // // this.userListSelectwei.push({value:xieban[0]},{text:xiebanpeo[0]})
  260. // // }
  261. // }
  262. // this.userListSelectwei.push({value:xieban[0]},{text:xiebanpeo[0]})
  263. // xieban.map(item =>{
  264. // tt.push({value:item})
  265. // // return {
  266. // // value: item2,
  267. // // text: item,
  268. // // }
  269. // })
  270. // this.userListSelectwei=tt
  271. console.log(this.userListSelectwei,'t')
  272. // xiebanpeo.map(item =>{
  273. // this.userListSelectwei.push({text:item})
  274. // // return {
  275. // // value: item2,
  276. // // text: item,
  277. // // }
  278. // })
  279. // this.userListSelectwei=xiebanpeo.map(item =>{
  280. // return {
  281. // value: item,
  282. // }
  283. // })
  284. // this.userListSelectwei.push(xieban,xiebanpeo)
  285. console.log(this.userListSelectwei,'p')
  286. },
  287. methods: {
  288. change(e) {
  289. console.log("e:", e);
  290. },
  291. //主办人
  292. onnodeclick(data) {
  293. console.log(data);
  294. this.userListSelect1 = data
  295. // this.getPeople()
  296. },
  297. onpopupopened(e) {
  298. console.log('popupopened');
  299. },
  300. onpopupclosed(e) {
  301. console.log('popupclosed');
  302. },
  303. onchange(e) {
  304. console.log('---------onchange:', e);
  305. var acc=e.detail.value[0].text
  306. this.getPeople(acc)
  307. },
  308. //协办人
  309. clearTagAdmin(value){
  310. this.userListSelect = this.userListSelect.filter(item => item != value);
  311. },
  312. clearTagAdminwei(value){
  313. this.userListSelectwei = this.userListSelectwei.filter(item => item != value);
  314. },
  315. onnodeclick2(data) {
  316. console.log(data);
  317. if(data.parent_value){//存在父级
  318. let dataId = data.value;
  319. this.userListSelect.push(data);
  320. this.userListSelect = [...new Set(this.userListSelect)]//es6数组去重
  321. this.userListSelectwei=[]
  322. }
  323. console.log(this.userListSelectwei,'多选',this.userListSelect)
  324. },
  325. onpopupopened2(e) {
  326. console.log('popupopened');
  327. },
  328. onpopupclosed2(e) {
  329. console.log('popupclosed');
  330. },
  331. onchange2(e) {
  332. console.log('---------onchange:', e);
  333. },
  334. //评分人选择
  335. changeScore(e){
  336. console.log(this.peoplescore)
  337. this.scorePeople22=[]
  338. this.scoreValuePeople=[]
  339. console.log('e:', e);
  340. e.map(item =>{
  341. this.scorePeople22.push(item.label)
  342. this.scoreValuePeople.push(item.value)
  343. })
  344. },
  345. //新增任务
  346. addRen(){
  347. var shuzu=[
  348. {userName:'',department:'',id:''}
  349. ]
  350. var xieban=[]
  351. var xiebanpeo=[]
  352. var tt=[]
  353. var xiebanV=[]
  354. var a1=this.data.sposonerName+','+this.data.coSposonerName
  355. var a2=this.data.organize+','+this.data.coOrganize
  356. var a3=this.data.sposoner+','+this.data.coSposoner
  357. xieban=a1.split(',')
  358. xiebanpeo=a2.split(',')
  359. xiebanV=a3.split(',')
  360. shuzu=xieban.map(item =>{
  361. console.log(item)
  362. return {
  363. userName: item,
  364. }
  365. })
  366. shuzu.forEach((item,index) => {
  367. console.log(item);
  368. this.$set(item,"department",xiebanpeo[index])
  369. this.$set(item,"id",xiebanV[index])
  370. })
  371. let t2=JSON.stringify(shuzu)
  372. //这里———————————————————————————
  373. let query2 = encodeURIComponent(t2)
  374. uni.navigateTo({
  375. url:'/pages/project/addRenwu?proId='+this.data.id+'&people='+query2
  376. })
  377. },
  378. //编辑任务
  379. bianjiRenwu(item){
  380. var shuzu=[
  381. {userName:'',department:'',id:''}
  382. ]
  383. var xieban=[]
  384. var xiebanpeo=[]
  385. var tt=[]
  386. var xiebanV=[]
  387. var a1=this.data.sposonerName+','+this.data.coSposonerName
  388. var a2=this.data.organize+','+this.data.coOrganize
  389. var a3=this.data.sposoner+','+this.data.coSposoner
  390. xieban=a1.split(',')
  391. xiebanpeo=a2.split(',')
  392. xiebanV=a3.split(',')
  393. shuzu=xieban.map(item =>{
  394. console.log(item)
  395. return {
  396. userName: item,
  397. }
  398. })
  399. shuzu.forEach((item,index) => {
  400. console.log(item);
  401. this.$set(item,"department",xiebanpeo[index])
  402. this.$set(item,"id",xiebanV[index])
  403. })
  404. let t2=JSON.stringify(shuzu)
  405. //这里———————————————————————————
  406. let query2 = encodeURIComponent(t2)
  407. //传参对象,使用encodeURIComponent编码
  408. let str = JSON.stringify(item)
  409. //注意这里——————————————————————
  410. str = str.replace(/%/g, '%25')
  411. //这里———————————————————————————
  412. let query = encodeURIComponent(str)
  413. uni.navigateTo({
  414. url:'/pages/project/changeRenwu?data='+query+'&people='+query2
  415. })
  416. },
  417. //删除任务
  418. deleteRenwu(item){
  419. let that = this
  420. uni.showModal({
  421. title: '提示',
  422. content: '确定删除任务吗?',
  423. success: function(res) {
  424. if (res.confirm) {
  425. console.log('用户点击确定');
  426. uni.showLoading({
  427. title: '加载中',
  428. mask: true, // 是否显示透明蒙层,防止触摸穿透
  429. });
  430. let data={
  431. id:item.id,
  432. }
  433. that.$Request.postT('/api/sysTask/del',data).then(res => {
  434. if (res.code==200) {
  435. uni.showToast({
  436. title: '删除成功',
  437. icon: 'none',
  438. duration:800
  439. });
  440. uni.hideLoading()
  441. setTimeout(function() {
  442. that.getRenwu()
  443. }, 1000)
  444. } else {
  445. uni.hideLoading();
  446. uni.showToast({
  447. title: res.message,
  448. icon: 'none',
  449. duration:800
  450. });
  451. }
  452. });
  453. } else if (res.cancel) {
  454. console.log('用户点击取消');
  455. }
  456. }
  457. })
  458. },
  459. //任务详情
  460. clickRenwu(item){
  461. var shuzu=[
  462. {userName:'',department:'',id:''}
  463. ]
  464. var xieban=[]
  465. var xiebanpeo=[]
  466. var tt=[]
  467. var xiebanV=[]
  468. var a1=this.data.sposonerName+','+this.data.coSposonerName
  469. var a2=this.data.organize+','+this.data.coOrganize
  470. var a3=this.data.sposoner+','+this.data.coSposoner
  471. xieban=a1.split(',')
  472. xiebanpeo=a2.split(',')
  473. xiebanV=a3.split(',')
  474. shuzu=xieban.map(item =>{
  475. console.log(item)
  476. return {
  477. userName: item,
  478. }
  479. })
  480. shuzu.forEach((item,index) => {
  481. console.log(item);
  482. this.$set(item,"department",xiebanpeo[index])
  483. this.$set(item,"id",xiebanV[index])
  484. })
  485. let t2=JSON.stringify(shuzu)
  486. //这里———————————————————————————
  487. let query2 = encodeURIComponent(t2)
  488. //传参对象,使用encodeURIComponent编码
  489. let str = JSON.stringify(item)
  490. //注意这里——————————————————————
  491. str = str.replace(/%/g, '%25')
  492. //这里———————————————————————————
  493. let query = encodeURIComponent(str)
  494. uni.navigateTo({
  495. url:'/pages/project/renwuX?data='+query+'&people='+query2
  496. })
  497. },
  498. //更新进度
  499. updateJin(item){
  500. //传参对象,使用encodeURIComponent编码
  501. let str = JSON.stringify(item)
  502. //注意这里——————————————————————
  503. str = str.replace(/%/g, '%25')
  504. //这里———————————————————————————
  505. let query = encodeURIComponent(str)
  506. uni.navigateTo({
  507. url:'/pages/project/renwuUpdateJin?data='+query
  508. })
  509. },
  510. //催办任务
  511. cuirenwu2(item){
  512. let that = this
  513. uni.showModal({
  514. title: '提示',
  515. content: '确定催办任务吗?',
  516. success: function(res) {
  517. if (res.confirm) {
  518. console.log('用户点击确定');
  519. uni.showLoading({
  520. title: '加载中',
  521. mask: true, // 是否显示透明蒙层,防止触摸穿透
  522. });
  523. let data={
  524. taskId:item.id,
  525. }
  526. that.$Request.postT('/api/sysTask/urge',data).then(res => {
  527. if (res.code==200) {
  528. uni.showToast({
  529. title: '催办成功',
  530. icon: 'none',
  531. duration:800
  532. });
  533. uni.hideLoading()
  534. setTimeout(function() {
  535. that.getRenwu()
  536. }, 1000)
  537. } else {
  538. uni.hideLoading();
  539. uni.showToast({
  540. title: res.message,
  541. icon: 'none',
  542. duration:800
  543. });
  544. }
  545. });
  546. } else if (res.cancel) {
  547. console.log('用户点击取消');
  548. }
  549. }
  550. })
  551. },
  552. //获取单位
  553. getDanwei(){
  554. this.range=[]
  555. this.data2=[]
  556. uni.showLoading({
  557. title: '加载中',
  558. mask: true, // 是否显示透明蒙层,防止触摸穿透
  559. });
  560. this.$Request.postT('/api/Organize/query').then(res => {
  561. if (res.code==200&&res.data) {
  562. this.range =res.data.map(item =>{
  563. return {
  564. value: item.id,
  565. text: item.oname,
  566. id:item.oid
  567. }
  568. })
  569. this.data2 =res.data.map(item =>{
  570. return {
  571. value: item.id,
  572. label: item.oname,
  573. id:item.oid
  574. }
  575. })
  576. for(var i=0;i<this.range.length;i++){
  577. if(this.range[i].text==this.data.organize){
  578. this.value=this.range[i].value
  579. }
  580. }
  581. // for(var i=0;i<this.data2.length;i++){
  582. // if(this.data2[i].label==this.data.){
  583. // this.value2=this.data2[i].value
  584. // }
  585. // }
  586. }
  587. uni.hideLoading();
  588. });
  589. },
  590. //获取主办协办人
  591. getPeopleZhu(){
  592. this.range=[]
  593. this.rangePeople=[]
  594. uni.showLoading({
  595. title: '加载中',
  596. mask: true, // 是否显示透明蒙层,防止触摸穿透
  597. });
  598. this.$Request.postJson('/api/sysProject/queryCoUsers',{}).then(res => {
  599. if (res.code==200) {
  600. var lianji=[]
  601. for(var i=0;i<res.data.length;i++){
  602. if(res.data[i].userList.length>0){
  603. lianji.push(res.data[i])
  604. }
  605. }
  606. this.range =lianji.map(item =>{
  607. return {
  608. value: item,
  609. text: item.organize,
  610. children:item.userList.map(item =>{
  611. return{
  612. value: item.id,
  613. text: item.userName,
  614. }
  615. })
  616. }
  617. })
  618. console.log(this.range,'人')
  619. this.value=parseInt(this.data.sposoner)//25
  620. this.userListSelect1={
  621. parent_value:{
  622. organize:this.data.organize
  623. }
  624. }
  625. }else{
  626. var ii=JSON.stringify(res)
  627. console.log(res,res.data)
  628. console.log(JSON.parse(res))
  629. console.log(JSON.parse(ii))
  630. }
  631. uni.hideLoading();
  632. });
  633. },
  634. //根据单位获取人员(评分人)
  635. getPeople(acc){
  636. console.log(this.userListSelect1)
  637. this.scorePeople=[]
  638. uni.showLoading({
  639. title: '加载中',
  640. mask: true, // 是否显示透明蒙层,防止触摸穿透
  641. });
  642. this.$Request.postT('/api/sysUser/queryScorer',{
  643. organizes:acc
  644. }).then(res => {
  645. if (res.code==200) {
  646. console.log(res,'评分')
  647. this.scorePeople =res.data.map(item =>{
  648. return {
  649. value: item.id,
  650. label: item.userName,
  651. }
  652. })
  653. console.log(this.scorePeople,'人')
  654. var people=[]
  655. people=this.data.scorerName.split(',')
  656. for(var j=0;j<this.scorePeople.length;j++){
  657. for(var i=0;i<people.length;i++){
  658. console.log(this.scorePeople[j].label,'ll',people[i])
  659. if(this.scorePeople[j].label==people[i]){
  660. this.peoplescore.push(this.scorePeople[j].value)
  661. this.scoreValuePeople.push(this.scorePeople[j].value)
  662. }
  663. }
  664. }
  665. }else{
  666. var ii=JSON.stringify(res)
  667. console.log(res,res.data)
  668. console.log(JSON.parse(res))
  669. console.log(JSON.parse(ii))
  670. }
  671. uni.hideLoading();
  672. });
  673. },
  674. // 查找任务
  675. getRenwu(){
  676. let that = this
  677. that.renwu=[]
  678. uni.showLoading({
  679. title: '加载中',
  680. mask: true, // 是否显示透明蒙层,防止触摸穿透
  681. });
  682. var data={
  683. "projectId": that.data.id
  684. }
  685. that.$Request.postT('/api/sysTask/queryTaskByProject',data).then(res => {
  686. if (res.code==200) {
  687. that.renwu=res.data
  688. console.log(that.renwu,'任务')
  689. }
  690. uni.hideLoading();
  691. });
  692. },
  693. // 上传附件
  694. uploadSuccess(e) {
  695. console.log('上传成功', e)
  696. },
  697. uploadFail(e) {
  698. console.log('上传失败:', e)
  699. },
  700. //保存编辑项目
  701. updatePro(){
  702. console.log(this.userListSelectwei)
  703. var xieban=[]
  704. var xiebanValue=[]
  705. if(this.userListSelectwei.length>0){
  706. this.userListSelectwei.map(item =>{
  707. xieban.push(item.value)
  708. xiebanValue.push(item.id[0])
  709. })
  710. }else{
  711. this.userListSelect.map(item =>{
  712. xieban.push(item.parent_value.organize)
  713. xiebanValue.push(item.value)
  714. })
  715. }
  716. console.log(this.userListSelect1.parent_value.organize,this.value)
  717. let that = this
  718. if (!that.data.projectName) {
  719. that.$queue.showToast("请输入项目标题");
  720. }else if (!that.data.projectContent) {
  721. that.$queue.showToast("请输入项目描述");
  722. } else if (!that.value) {
  723. that.$queue.showToast("请选择主办单位");
  724. }else {
  725. uni.showLoading({
  726. title: '加载中',
  727. mask: true, // 是否显示透明蒙层,防止触摸穿透
  728. });
  729. that.$Request.postJson("/api/sysProject/update", {
  730. "id": that.data.id,
  731. "projectName": that.data.projectName, // 项目名称
  732. "projectFrom": that.from[that.fromValue].text, // 项目来源
  733. "projectLevel": that.jibie[that.jibieValue].text, // 项目等级
  734. "projectContent": that.data.projectContent, // 项目描述
  735. "fileUrl": that.fileList22, // 附件
  736. "organize": that.userListSelect1.parent_value.organize, // 主办单位-单选
  737. "sposoner": that.value, // 主办人ID-单选
  738. "coOrganize": xieban.join(","), // 协办单位-多选
  739. "coSposoner": xiebanValue.join(",") ,// 协办人ID-多选
  740. "scorer": that.scoreValuePeople.join(",") // 评分人ID-多选
  741. }).then(res => {
  742. if (res.code == 200) {
  743. uni.showToast({
  744. title: '修改成功',
  745. icon: 'none',
  746. duration:800
  747. });
  748. uni.hideLoading()
  749. setTimeout(function() {
  750. uni.switchTab({
  751. url:'/pages/project/index'
  752. })
  753. }, 1000)
  754. } else {
  755. uni.hideLoading();
  756. uni.showToast({
  757. title: res.message,
  758. icon: 'none',
  759. duration:800
  760. });
  761. }
  762. });
  763. }
  764. },
  765. //删除文件
  766. deleteHandle(index){
  767. console.log(index)
  768. this.fileList2.splice(index.index,1)
  769. console.log(this.fileList2)
  770. this.fileList22=this.fileList2.join(",")
  771. },
  772. async selectUpload(e) {
  773. console.log('上传:', e)
  774.  let data = new FormData();
  775.   data.set("file", e.tempFiles[0].file);
  776.   let res = await this.$axios({
  777.     method: "post",
  778.     url: this.config('APIHOST1') + "/api/sysFile/upload",
  779.     headers: {
  780. tokenW: localStorage.getItem("token"),
  781. "Content-Type": "multipart/form-data"
  782.     },
  783.     data: data,
  784.   });
  785. // return res
  786.   console.log(res, "图片上传成功");
  787.   if (res.data.code == 200) {
  788. console.log(this.fileList2)
  789.     this.fileList2.push(res.data.data);
  790. this.fileList22=this.fileList2.join(",")
  791. // console.log(this.fileList2.join(","))
  792.   } else if(res.message=="登录凭证已过去,请重新登录"){
  793. uni.removeStorageSync("tokenW")
  794. uni.removeStorageSync("roleId")
  795. uni.showModal({
  796. title: '提示',
  797. content: '用户信息失效,请重新登录!',
  798. showCancel: false, // 是否显示取消按钮,默认为 true // 是否显示取消按钮,默认为 true
  799. success: function(res) {
  800. if (res.confirm) {
  801. }
  802. }
  803. });
  804. }else {
  805.     uni.showToast({
  806. title: res.message,
  807. icon: 'none',
  808. duration:800
  809. });
  810.   }
  811. },
  812. config: function (name) {
  813. var info = null
  814. if (name) {
  815. var name2 = name.split('.') //字符分割
  816. if (name2.length > 1) {
  817. info = configdata[name2[0]][name2[1]] || null
  818. } else {
  819. info = configdata[name] || null
  820. }
  821. if (info == null) {
  822. let web_config = cache.get('web_config')
  823. if (web_config) {
  824. if (name2.length > 1) {
  825. info = web_config[name2[0]][name2[1]] || null
  826. } else {
  827. info = web_config[name] || null
  828. }
  829. }
  830. }
  831. }
  832. return info
  833. },
  834. }
  835. }
  836. </script>
  837. <style>
  838. .content {
  839. display: flex;
  840. flex-direction: column;
  841. align-items: center;
  842. justify-content: center;
  843. }
  844. .param{
  845. margin: 20rpx 0 0 0;
  846. width: 100%;
  847. background-color: rgba(255, 255, 255, 1);
  848. font-size: 28rpx;
  849. font-weight: 400;
  850. line-height: 41rpx;
  851. color: rgba(0, 0, 0, 1);
  852. }
  853. .all-text{
  854. margin: 22rpx 0 0 20rpx;
  855. font-size: 32rpx;
  856. font-weight: 500;
  857. color: rgba(0, 0, 0, 1);
  858. }
  859. .proName{
  860. margin: 23rpx 0 0 20rpx;
  861. }
  862. .proINname{
  863. margin: 25rpx 0 0 21rpx;
  864. width: 709rpx;
  865. height: 90rpx;
  866. border-radius: 13rpx;
  867. background: rgba(245, 248, 252, 1);
  868. border: 1rpx solid rgba(229, 229, 229, 1);
  869. font-size: 28rpx;
  870. line-height: 90rpx;
  871. /* 自动换行 */
  872. word-wrap: break-word;
  873. word-break: break-all;
  874. white-space: pre-line;
  875. /* color: rgba(179, 179, 179, 1); */
  876. }
  877. .proIMi{
  878. height: 315rpx;
  879. }
  880. .proMiao{
  881. margin: 31rpx 0 0 20rpx;
  882. }
  883. /* 上传附件 */
  884. .upload-img{
  885. /* width: 200rpx;
  886. height: 80rpx;
  887. opacity: 1;
  888. border-radius: 13rpx;
  889. background: rgba(0, 97, 255, 0.1);
  890. border: 1rpx solid rgba(0, 97, 255, 1); */
  891. }
  892. .jindu{
  893. font-size: 32rpx;
  894. font-weight: 500;
  895. line-height: 46rpx;
  896. }
  897. /* 进度 */
  898. .jindu-kuang{
  899. font-size: 24rpx;
  900. line-height: 35rpx;
  901. color: rgba(128, 128, 128, 1);
  902. }
  903. .jindu-circle{
  904. margin-top: 10rpx;
  905. width: 100rpx;
  906. height: 100rpx;
  907. border-radius: 50%;
  908. opacity: 1;
  909. background-color:rgba(204, 204, 204, 1);
  910. }
  911. .jindu-type{
  912. width: 103rpx;
  913. height: 40rpx;
  914. border-radius: 71rpx;
  915. font-size: 24rpx;
  916. line-height: 40rpx;
  917. color: rgba(255, 255, 255, 1);
  918. text-align: center;
  919. margin: 0 0 0 20rpx;
  920. }
  921. .lixiang{
  922. background: linear-gradient(90deg, rgba(54, 111, 255, 1) 0%, rgba(93, 160, 252, 1) 100%);
  923. }
  924. .cuiban{
  925. background: linear-gradient(90deg, rgba(57, 167, 139, 1) 0%, rgba(126, 224, 203, 1) 100%);
  926. }
  927. .tijiao{
  928. background: linear-gradient(90deg, rgba(255, 112, 69, 1) 0%, rgba(247, 161, 114, 1) 100%);
  929. }
  930. .jindu-line{
  931. width: 4rpx;
  932. height: 100rpx;
  933. background-color: rgba(166, 166, 166, 1);
  934. }
  935. .weidu{
  936. margin: 7rpx 0 0 20rpx;
  937. font-size: 24rpx;
  938. line-height: 35rpx;
  939. color: rgba(128, 128, 128, 1);
  940. }
  941. .addRen{
  942. margin: -80rpx 0 0 581rpx;
  943. width: 149rpx;
  944. height: 59rpx;
  945. border-radius: 92rpx;
  946. background: rgba(0, 97, 255, 1);
  947. font-size: 28rpx;
  948. line-height: 59rpx;
  949. color: rgba(255, 255, 255, 1);
  950. text-align: center;
  951. }
  952. /* 任务列表 */
  953. .renwu{
  954. display: flex;
  955. margin-top: 6rpx;
  956. width: 709rpx;
  957. height: 90rpx;
  958. border-radius: 13rpx;
  959. background: rgba(245, 248, 252, 1);
  960. border: 1rpx solid rgba(229, 229, 229, 1);
  961. font-size: 28rpx;
  962. justify-content: space-evenly;
  963. align-items: center;
  964. }
  965. .renwu-bu{
  966. width: 105rpx;
  967. height: 50rpx;
  968. border-radius: 110rpx;
  969. line-height:50rpx;
  970. text-align: center;
  971. }
  972. .bianji{
  973. border: 1rpx solid rgba(0, 97, 255, 1);
  974. color: rgba(0, 97, 255, 1);
  975. }
  976. .delete{
  977. margin-left: 20rpx;
  978. border: 1rpx solid rgba(212, 48, 48, 1);
  979. color: rgba(212, 48, 48, 1);
  980. }
  981. .project{
  982. display: flex;
  983. margin: 61rpx 0 0 0;
  984. justify-content: space-evenly;
  985. }
  986. .butt{
  987. width: 330rpx;
  988. height: 90rpx;
  989. border-radius: 117rpx;
  990. font-size: 32rpx;
  991. line-height: 90rpx;
  992. text-align: center;
  993. }
  994. .quxiao{
  995. border: 1rpx solid rgba(0, 97, 255, 1);
  996. color: rgba(0, 97, 255, 1);
  997. }
  998. .queren{
  999. background: rgba(0, 97, 255, 1);
  1000. color: rgba(255, 255, 255, 1);
  1001. }
  1002. </style>