addProject.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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="pName" placeholder="请输入项目标题"/>
  7. <view class="proMiao">项目描述</view>
  8. <textarea class="proINname proIMi" v-model="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='fileList'
  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="change1"
  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="data"
  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="value" placeholder="请选择关联流程"
  51. :localdata="range"
  52. @change="change"
  53. ></uni-data-select> -->
  54. <view class="proMiao">项目来源</view>
  55. <uni-data-select class="proINname"
  56. v-model="fromValue" placeholder="请选择项目来源"
  57. :localdata="from"
  58. @change="change"
  59. ></uni-data-select>
  60. <!-- <view class="proMiao jindu">完成进度</view>
  61. <view class="weidu">维度权重40%</view>
  62. <view class="addRen" @click="addRen">新增任务</view> -->
  63. <!-- 任务列表 -->
  64. <!-- <view style="width: 100%;margin: 50rpx 0 0 20rpx;">
  65. <view class="renwu" v-for="(item,index) in renwu" :key="index" @click="clickRenwu">
  66. <view>{{item.name}}</view>
  67. <view>{{item.time}}</view>
  68. <view style="display: flex;">
  69. <view class="renwu-bu bianji">编辑</view>
  70. <view class="renwu-bu delete">删除</view>
  71. </view>
  72. </view>
  73. </view> -->
  74. <view class="proMiao">项目评分人</view>
  75. <mySelectCheckbox class="proINname" placeholder="请选择项目评分人" v-model="value2" multiple dataKey="label" dataValue="value" :localdata="data"
  76. @change="changeXie"></mySelectCheckbox>
  77. <view class="project">
  78. <view class="butt quxiao" @click="quxiao">取消</view>
  79. <view class="butt queren" @click="addProject">确认创建</view>
  80. </view>
  81. <view style="width: 100%;height: 60rpx;"></view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import configdata from '@/common/config.js'
  87. import mySelectCheckbox from '../../components/my-selectCheckbox.vue'
  88. export default {
  89. components:{mySelectCheckbox},
  90. data() {
  91. return {
  92. pName:'',//项目标题
  93. projectContent:'',//项目描述
  94. //主办单位
  95. value: '',
  96. range: [],
  97. //主办人
  98. peopleValue:'',
  99. rangePeople:[],
  100. //协办
  101. value2:[],
  102. data: [],
  103. xieban:[],//协办传入值数组
  104. xieValue:[],//协办传入id
  105. //协办人
  106. peopleValue2:[],
  107. dataPeople: [],
  108. xiebanPeople:[],//协办传入值数组
  109. xieValuePeople:[],//协办传入id
  110. // 项目级别
  111. jibieValue:0,
  112. jibie:[
  113. { value: 0, text: "正常" },
  114. { value: 1, text: "紧急" },
  115. ],
  116. // 项目来源
  117. fromValue:0,
  118. from:[
  119. { value: 0, text: "涉内" },
  120. { value: 1, text: "涉外" },
  121. ],
  122. fileList: [],
  123. fileList2: [],
  124. fileList22:'',
  125. listStyles: {
  126. "borderStyle": {
  127. "width": "0", // 边框宽度
  128. },
  129. "border": false, // 是否显示边框
  130. "dividline": false
  131. },
  132. renwu:[
  133. {name:'xxx任务',time:'2024-04-11'},
  134. {name:'xxx任务',time:'2024-04-11'},
  135. {name:'xxx任务',time:'2024-04-11'},
  136. ],
  137. }
  138. },
  139. onLoad() {
  140. this.getDanwei()
  141. },
  142. methods: {
  143. // 主办单位
  144. change1(e) {
  145. console.log("e:", e);
  146. this.getPeople()
  147. },
  148. //协办单位选择
  149. changeXie(e){
  150. this.xieban=[]
  151. this.xieValue=[]
  152. console.log('e:', e);
  153. e.map(item =>{
  154. this.xieban.push(item.label)
  155. this.xieValue.push(item.value)
  156. })
  157. },
  158. //协办人选择
  159. changeXiePeo(e){
  160. this.xieban=[]
  161. this.xieValue=[]
  162. console.log('e:', e);
  163. e.map(item =>{
  164. this.xieban.push(item.label)
  165. this.xieValue.push(item.value)
  166. })
  167. },
  168. //获取单位
  169. getDanwei(){
  170. this.range=[]
  171. this.data=[]
  172. uni.showLoading({
  173. title: '加载中',
  174. mask: true, // 是否显示透明蒙层,防止触摸穿透
  175. });
  176. this.$Request.postT('/api/Organize/query').then(res => {
  177. if (res.code==200&&res.data) {
  178. this.range =res.data.map(item =>{
  179. return {
  180. value: item.id,
  181. text: item.oname,
  182. }
  183. })
  184. this.data =res.data.map(item =>{
  185. return {
  186. value: item.id,
  187. label: item.oname,
  188. }
  189. })
  190. console.log(this.range)
  191. }
  192. uni.hideLoading();
  193. });
  194. },
  195. //根据单位获取人员
  196. getPeople(){
  197. this.rangePeople=[]
  198. uni.showLoading({
  199. title: '加载中',
  200. mask: true, // 是否显示透明蒙层,防止触摸穿透
  201. });
  202. this.$Request.postJson('/api/sysUser/queryPage?page=1&rows=10',{
  203. "userName": null, // 姓名
  204. "roleName": null, // 角色名称
  205. "department": this.range[this.value].text, // 部门
  206. "createBy": "", // 创建时间-开始日期
  207. "updateBy": "" // 创建时间-结束日期
  208. }).then(res => {
  209. if (res.code==200&&res.data.total>0) {
  210. var total=res.data.total
  211. this.$Request.postJson('/api/sysUser/queryPage?page=1&rows='+total,{
  212. "userName": null, // 姓名
  213. "roleName": null, // 角色名称
  214. "department": this.range[this.value].text, // 部门
  215. "createBy": "", // 创建时间-开始日期
  216. "updateBy": "" // 创建时间-结束日期
  217. }).then(res => {
  218. if (res.code==200&&res.data) {
  219. this.rangePeople =res.data.rows.map(item =>{
  220. return {
  221. value: item.id,
  222. text: item.userName,
  223. }
  224. })
  225. console.log(this.rangePeople,'人')
  226. }
  227. });
  228. }
  229. uni.hideLoading();
  230. });
  231. },
  232. //取消
  233. quxiao(){
  234. uni.switchTab({
  235. url:'/pages/project/index'
  236. })
  237. },
  238. //新增项目
  239. addProject(){
  240. console.log(this.jibie[this.jibieValue].text)
  241. let that = this
  242. if (!that.pName) {
  243. that.$queue.showToast("请输入项目标题");
  244. }else if (!that.projectContent) {
  245. that.$queue.showToast("请输入项目描述");
  246. } else if (!that.value) {
  247. that.$queue.showToast("请选择主办单位");
  248. } else if (!that.value2) {
  249. that.$queue.showToast("请选择协办单位");
  250. }else {
  251. uni.showLoading({
  252. title: '加载中',
  253. mask: true, // 是否显示透明蒙层,防止触摸穿透
  254. });
  255. var data={
  256. "projectName": that.pName, // 项目名称
  257. "projectFrom": that.from[that.fromValue].text, // 项目来源
  258. "projectLevel": that.jibie[that.jibieValue].text, // 项目等级
  259. "projectContent": that.projectContent, // 项目描述
  260. "fileUrl": that.fileList22, // 附件
  261. "organize": that.range[that.value].text, // 主办单位-单选
  262. "sposoner": '26',//that.peopleValue, // 主办人ID-单选
  263. "coOrganize": that.xieban.join(","), // 协办单位-多选
  264. "coSposoner": '22,20'//that.xieValue.join(",") // 协办人ID-多选
  265. }
  266. that.$Request.postJson('/api/sysProject/add',data).then(res => {
  267. if (res.code==200) {
  268. uni.showToast({
  269. title: '添加成功',
  270. icon: 'none',
  271. duration:800
  272. });
  273. uni.hideLoading()
  274. setTimeout(function() {
  275. uni.switchTab({
  276. url:'/pages/project/index'
  277. })
  278. }, 1000)
  279. } else {
  280. uni.hideLoading();
  281. uni.showToast({
  282. title: res.message,
  283. icon: 'none',
  284. duration:800
  285. });
  286. }
  287. });
  288. }
  289. },
  290. //新增任务
  291. addRen(){
  292. uni.navigateTo({
  293. url:'/pages/project/addRenwu'
  294. })
  295. },
  296. //任务详情
  297. clickRenwu(){
  298. uni.navigateTo({
  299. url:'/pages/project/renwuX'
  300. })
  301. },
  302. // 上传附件
  303. uploadSuccess(e) {
  304. console.log('上传成功', e)
  305. },
  306. uploadFail(e) {
  307. console.log('上传失败:', e)
  308. },
  309. //删除文件
  310. deleteHandle(index){
  311. console.log(index)
  312. this.fileList2.splice(index.index,1)
  313. // console.log(this.fileList2)
  314. this.fileList22=this.fileList2.join(",")
  315. },
  316. async selectUpload(e) {
  317. console.log('上传:', e)
  318.  let data = new FormData();
  319.   data.set("file", e.tempFiles[0].file);
  320.   let res = await this.$axios({
  321.     method: "post",
  322.     url: this.config('APIHOST1') + "/api/sysFile/upload",
  323.     headers: {
  324. tokenW: localStorage.getItem("token"),
  325. "Content-Type": "multipart/form-data"
  326.     },
  327.     data: data,
  328.   });
  329. // return res
  330.   console.log(res, "图片上传成功");
  331.   if (res.data.code == 200) {
  332. console.log(this.fileList)
  333.     this.fileList2.push(res.data.data);
  334. this.fileList22=this.fileList2.join(",")
  335. // console.log(this.fileList2.join(","))
  336.   } else if(res.message=="登录凭证已过去,请重新登录"){
  337. uni.removeStorageSync("tokenW")
  338. uni.removeStorageSync("roleId")
  339. uni.showModal({
  340. title: '提示',
  341. content: '用户信息失效,请重新登录!',
  342. showCancel: false, // 是否显示取消按钮,默认为 true // 是否显示取消按钮,默认为 true
  343. success: function(res) {
  344. if (res.confirm) {
  345. }
  346. }
  347. });
  348. }else {
  349.     uni.showToast({
  350. title: res.message,
  351. icon: 'none',
  352. duration:800
  353. });
  354.   }
  355. },
  356. config: function (name) {
  357. var info = null
  358. if (name) {
  359. var name2 = name.split('.') //字符分割
  360. if (name2.length > 1) {
  361. info = configdata[name2[0]][name2[1]] || null
  362. } else {
  363. info = configdata[name] || null
  364. }
  365. if (info == null) {
  366. let web_config = cache.get('web_config')
  367. if (web_config) {
  368. if (name2.length > 1) {
  369. info = web_config[name2[0]][name2[1]] || null
  370. } else {
  371. info = web_config[name] || null
  372. }
  373. }
  374. }
  375. }
  376. return info
  377. },
  378. }
  379. }
  380. </script>
  381. <style>
  382. .content {
  383. display: flex;
  384. flex-direction: column;
  385. align-items: center;
  386. justify-content: center;
  387. }
  388. .param{
  389. margin: 20rpx 0 0 0;
  390. width: 100%;
  391. background-color: rgba(255, 255, 255, 1);
  392. font-size: 28rpx;
  393. font-weight: 400;
  394. line-height: 41rpx;
  395. color: rgba(0, 0, 0, 1);
  396. }
  397. .all-text{
  398. margin: 22rpx 0 0 20rpx;
  399. font-size: 32rpx;
  400. font-weight: 500;
  401. color: rgba(0, 0, 0, 1);
  402. }
  403. .proName{
  404. margin: 23rpx 0 0 20rpx;
  405. }
  406. .proINname{
  407. margin: 25rpx 0 0 21rpx;
  408. width: 709rpx;
  409. height: 90rpx;
  410. border-radius: 13rpx;
  411. background: rgba(245, 248, 252, 1);
  412. border: 1rpx solid rgba(229, 229, 229, 1);
  413. font-size: 28rpx;
  414. line-height: 90rpx;
  415. color: rgba(179, 179, 179, 1);
  416. }
  417. .proIMi{
  418. height: 315rpx;
  419. }
  420. .proMiao{
  421. margin: 31rpx 0 0 20rpx;
  422. }
  423. /* 上传附件 */
  424. .upload-img{
  425. /* margin: 25rpx 0 0 21rpx;
  426. width: 200rpx;
  427. opacity: 1;
  428. border-radius: 13rpx;
  429. background: rgba(0, 97, 255, 0.1);
  430. border: 1rpx solid rgba(0, 97, 255, 1); */
  431. }
  432. .jindu{
  433. font-size: 32rpx;
  434. font-weight: 500;
  435. line-height: 46rpx;
  436. }
  437. .weidu{
  438. margin: 7rpx 0 0 20rpx;
  439. font-size: 24rpx;
  440. line-height: 35rpx;
  441. color: rgba(128, 128, 128, 1);
  442. }
  443. .addRen{
  444. margin: -80rpx 0 0 581rpx;
  445. width: 149rpx;
  446. height: 59rpx;
  447. border-radius: 92rpx;
  448. background: rgba(0, 97, 255, 1);
  449. font-size: 28rpx;
  450. line-height: 59rpx;
  451. color: rgba(255, 255, 255, 1);
  452. text-align: center;
  453. }
  454. /* 任务列表 */
  455. .renwu{
  456. display: flex;
  457. margin-top: 6rpx;
  458. width: 709rpx;
  459. height: 90rpx;
  460. border-radius: 13rpx;
  461. background: rgba(245, 248, 252, 1);
  462. border: 1rpx solid rgba(229, 229, 229, 1);
  463. font-size: 28rpx;
  464. justify-content: space-evenly;
  465. align-items: center;
  466. }
  467. .renwu-bu{
  468. width: 105rpx;
  469. height: 50rpx;
  470. border-radius: 110rpx;
  471. line-height:50rpx;
  472. text-align: center;
  473. }
  474. .bianji{
  475. border: 1rpx solid rgba(0, 97, 255, 1);
  476. color: rgba(0, 97, 255, 1);
  477. }
  478. .delete{
  479. margin-left: 20rpx;
  480. border: 1rpx solid rgba(212, 48, 48, 1);
  481. color: rgba(212, 48, 48, 1);
  482. }
  483. .project{
  484. display: flex;
  485. margin: 61rpx 0 0 0;
  486. justify-content: space-evenly;
  487. }
  488. .butt{
  489. width: 330rpx;
  490. height: 90rpx;
  491. border-radius: 117rpx;
  492. font-size: 32rpx;
  493. line-height: 90rpx;
  494. text-align: center;
  495. }
  496. .quxiao{
  497. border: 1rpx solid rgba(0, 97, 255, 1);
  498. color: rgba(0, 97, 255, 1);
  499. }
  500. .queren{
  501. background: rgba(0, 97, 255, 1);
  502. color: rgba(255, 255, 255, 1);
  503. }
  504. </style>