Project.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. <template>
  2. <div class="create-container" v-loading="loading">
  3. <div class="title h1" v-if="!isModifyMode">项目</div>
  4. <div class="create-body">
  5. <div class="title h2" v-if="!isModifyMode">基本信息</div>
  6. <div v-if="!isModifyMode" class="el-form-item">
  7. <label class="el-form-item__label" style="width: 12%;">编号</label>
  8. <div class="el-form-item__content" style="margin-left: 12%;">
  9. <div>{{projectId}}</div>
  10. </div>
  11. </div>
  12. <el-form :model="project" :rules="rules" ref="project" label-width="12%" class="demo-project">
  13. <el-form-item label="项目名称" prop="name">
  14. <el-input size="small" v-if="isModifyMode" v-model="project.name"></el-input>
  15. <span v-if="!isModifyMode">{{project.name}}</span>
  16. </el-form-item>
  17. <el-form-item size="small" label="联系人" prop="contactName">
  18. <el-input v-if="isModifyMode" v-model="project.contactName" placeholder="请输入联系人姓名"></el-input>
  19. <span v-if="!isModifyMode">{{project.contactName}}</span>
  20. </el-form-item>
  21. <el-form-item size="small" label="联系人电话" prop="contactPhone">
  22. <el-input v-if="isModifyMode" v-model="project.contactPhone" placeholder="请输入联系人电话"></el-input>
  23. <span v-if="!isModifyMode">{{project.contactPhone}}</span>
  24. </el-form-item>
  25. <el-form-item size="small" label="预算" prop="budget">
  26. <el-input v-if="isModifyMode" type="number" v-model="project.budget">
  27. ¥
  28. <template slot="append"></template>
  29. </el-input>
  30. <span v-if="!isModifyMode">{{project.budget}}¥</span>
  31. </el-form-item>
  32. <el-form-item v-if="!isModifyMode" size="small" label="状态" prop="status">
  33. <span v-if="!isModifyMode">{{project.status==1?'等待接收':(project.status==2?'已被接收':(project.status==3?'项目已提交':'项目已结束'))}}</span>
  34. </el-form-item>
  35. <el-form-item label="需求描述">
  36. <el-input style="width: 400px" autosize v-if="isModifyMode" type="textarea" v-model="project.desc"></el-input>
  37. <span v-if="!isModifyMode">{{project.desc}}</span>
  38. </el-form-item>
  39. <!--<el-form-item label="价格" prop="price">-->
  40. <!--<el-input v-if="isModifyMode" type="number" v-model="project.price">-->
  41. <!--<template slot="append">¥</template>-->
  42. <!--</el-input>-->
  43. <!--<span v-if="!isModifyMode">{{project.price}}¥</span>-->
  44. <!--</el-form-item>-->
  45. <el-form-item label="平台" prop="platform">
  46. <el-checkbox-group v-if="isModifyMode" v-model="project.platform">
  47. <span v-for="(item,index) in platforms" :key="index">
  48. <el-checkbox :label="item">{{ item }}&nbsp;&nbsp;&nbsp;&nbsp;</el-checkbox>
  49. </span>
  50. </el-checkbox-group>
  51. <span
  52. v-if="!isModifyMode"
  53. class="badge"
  54. v-for="item in project.platform"
  55. >{{item}}</span>
  56. </el-form-item>
  57. <el-form-item label="服务类型" prop="type">
  58. <el-checkbox-group v-if="isModifyMode" v-model="project.type">
  59. <span v-for="(item,index) in serviceType" :key="index">
  60. <el-checkbox :label="item" name="type">{{ item }}&nbsp;&nbsp;</el-checkbox>
  61. </span>
  62. </el-checkbox-group>
  63. <span v-if="!isModifyMode" class="badge" v-for="item in project.type">{{item}}</span>
  64. </el-form-item>
  65. <!--<el-form-item label="用途" prop="usage">-->
  66. <!--<el-input v-if="isModifyMode" v-model="project.usage"></el-input>-->
  67. <!--<span v-if="!isModifyMode">{{project.usage}}</span>-->
  68. <!--</el-form-item>-->
  69. <el-form-item label="项目可见性" prop="resource">
  70. <div v-if="!isModifyMode">
  71. <div v-if="project.resource=='1'">{{updateLocation(project.location)}}</div>
  72. <div v-if="project.resource=='0'">{{project.institution==null?'暂未被接收':project.institution}}</div>
  73. <div v-if="project.resource=='2'">{{resourceType[project.resource]}}</div>
  74. </div>
  75. <el-tabs :tab-position="tabPosition" v-model="project.resource" style="max-height: 200px;"
  76. v-if="isModifyMode">
  77. <el-tab-pane :label="resourceType[0]" name="0">
  78. <el-radio-group v-model="project.institution">
  79. <el-radio :label="item" name="type" v-for="(item,index) in institutionArray" :key="index">
  80. {{item.name}}
  81. </el-radio>
  82. </el-radio-group>
  83. </el-tab-pane>
  84. <el-tab-pane :label="resourceType[1]" name="1">
  85. <provincecity
  86. ref="addFormProvince"
  87. @selectChange="locationChange"
  88. :provinceCode="project.location==null?'3200':project.location.provinceCode"
  89. :cityCode="project.location==null?'3201':project.location.cityCode"
  90. ></provincecity>
  91. </el-tab-pane>
  92. <el-tab-pane :label="resourceType[2]" name="2"></el-tab-pane>
  93. </el-tabs>
  94. </el-form-item>
  95. <el-form-item label="需求文档" prop="doc">
  96. <el-upload
  97. style="width: 400px"
  98. v-if="isModifyMode"
  99. drag
  100. class="upload-demo"
  101. action=""
  102. :on-remove="handleRemove"
  103. :before-remove="beforeRemove"
  104. :limit="1"
  105. :on-exceed="handleExceed"
  106. :before-upload="beforeFileUpload"
  107. :http-request="uploadRequireDoc"
  108. :file-list="project.doc"
  109. >
  110. <i class="el-icon-upload"></i>
  111. <div class="el-upload__text">
  112. 将文件拖到此处,或
  113. <em>点击上传</em>
  114. </div>
  115. </el-upload>
  116. <span v-if="!isModifyMode">
  117. <a :href="project.requireDocUrl" v-if="project.requireDocUrl!=null && project.requireDocUrl!=''"><el-link
  118. :underline="false" type="primary"><i
  119. class="el-icon-document"></i>下载文档</el-link></a>
  120. <i v-if="project.requireDocUrl==null || project.requireDocUrl==''" class="el-icon-document">暂无文档</i>
  121. </span>
  122. </el-form-item>
  123. <el-form-item label="安装包" prop="file">
  124. <el-upload
  125. style="width: 400px"
  126. v-if="isModifyMode"
  127. drag
  128. class="upload-demo"
  129. action=""
  130. :on-remove="handleRemove"
  131. :before-remove="beforeRemove"
  132. :limit="1"
  133. :on-exceed="handleExceed"
  134. :before-upload="beforeApkUpload"
  135. :http-request="uploadApkFile"
  136. :file-list="project.file"
  137. >
  138. <i class="el-icon-upload"></i>
  139. <div class="el-upload__text">
  140. 将文件拖到此处,或
  141. <em>点击上传</em>
  142. </div>
  143. </el-upload>
  144. <span v-if="!isModifyMode">
  145. <a v-if="project.fileUrl!=null && project.fileUrl!=''" :href="project.fileUrl"><el-link :underline="false"
  146. type="primary"><i
  147. class="el-icon-document"></i>下载文件</el-link></a>
  148. <i v-if="project.fileUrl==null || project.fileUrl==''" class="el-icon-document">暂无文件</i>
  149. </span>
  150. </el-form-item>
  151. <el-form-item label="项目截止时间" prop="datetime">
  152. <div class="block" v-if="isModifyMode">
  153. <el-date-picker
  154. size="small"
  155. v-model="project.datetime"
  156. type="datetime"
  157. placeholder="选择截止时间"
  158. align="right"
  159. :picker-options="pickerOptions"
  160. ></el-date-picker>
  161. </div>
  162. <span v-if="!isModifyMode">{{reformDate(new Date(project.datetime))}}</span>
  163. </el-form-item>
  164. <el-form-item v-if="isModifyMode">
  165. <div class="btn btn-small btn-info" @click="submitForm('project')">确认修改</div>
  166. <div class="btn btn-small" @click="resetForm('project')">重置</div>
  167. <div class="btn btn-small" @click="cancelMode('project')">取消</div>
  168. </el-form-item>
  169. <el-form-item v-if="!isModifyMode">
  170. <el-button v-if="projectOperationControl.confirmFinish" type="success" size="mini" @click="endProject()">
  171. 结束项目
  172. </el-button>
  173. <el-button v-if="projectOperationControl.finish" type="primary" size="mini" @click="submitProjectRequest()">
  174. 提交项目
  175. </el-button>
  176. <el-button v-if="projectOperationControl.receive" type="primary" size="mini" @click="receiveProject()">
  177. 接受项目
  178. </el-button>
  179. <el-button v-if="projectOperationControl.reject" type="danger" size="mini" @click="rejectProject()">
  180. 拒绝项目
  181. </el-button>
  182. <el-button v-if="projectOperationControl.update" type="primary" size="mini" @click="modifyForm()">
  183. 修改项目
  184. </el-button>
  185. <el-button v-if="projectOperationControl.createTask" type="primary" size="mini" @click="createNewTask()">
  186. 新建任务
  187. </el-button>
  188. <el-button v-if="projectOperationControl.uploadReport" type="primary" size="mini" @click="createReport()">
  189. 上传报告
  190. </el-button>
  191. </el-form-item>
  192. </el-form>
  193. </div>
  194. <div class="create-body" v-if="!isModifyMode">
  195. <div class="title h2">任务列表</div>
  196. <div class="task-list">
  197. <el-table :showHeader="true" :stripe="true" :data="task" style="width: 100%">
  198. <el-table-column prop="title" label="任务名称" title="任务名称">
  199. <template slot-scope="scope">
  200. <span>{{ scope.row.title }}</span>
  201. </template>
  202. </el-table-column>
  203. <el-table-column prop="datetime" sortable label="任务截止时间">
  204. <template slot-scope="scope">
  205. <span>{{reformDate(new Date(scope.row.datetime))}}</span>
  206. </template>
  207. </el-table-column>
  208. <el-table-column prop="resource" label="任务可见性">
  209. <template slot-scope="scope">
  210. <div v-if="scope.row.resource=='1'">{{scope.row.location.provinceCode}}/{{scope.row.location.cityCode}}
  211. </div>
  212. <div v-if="scope.row.resource=='0'">{{scope.row.institution}}</div>
  213. <div v-if="scope.row.resource=='2'">{{resourceType[scope.row.resource]}}</div>
  214. </template>
  215. </el-table-column>
  216. <el-table-column prop="type" label="业务类型">
  217. <template slot-scope="scope">
  218. <div class="badge">{{scope.row.serviceType}}</div>
  219. </template>
  220. </el-table-column>
  221. <el-table-column align="center" label="状态">
  222. <template slot-scope="scope">
  223. <el-tag :type="scope.row.statusVO.style">{{scope.row.statusVO.text}}</el-tag>
  224. </template>
  225. </el-table-column>
  226. <el-table-column align="right" label="操作">
  227. <template slot-scope="scope">
  228. <div
  229. class="btn btn-small btn-info"
  230. @click="goToTaskDetail(projectId, scope.row.id)"
  231. >查看详情
  232. </div>
  233. <div
  234. class="btn btn-small btn-danger"
  235. @click="handleDelete(scope.$index, scope.row.id)"
  236. >删除
  237. </div>
  238. </template>
  239. </el-table-column>
  240. </el-table>
  241. </div>
  242. </div>
  243. <div class="create-body" v-if="!isModifyMode">
  244. <div class="title h2">报告列表</div>
  245. <report-list v-bind:reports="reportList" v-bind:taskId=null v-bind:projectId="projectId"/>
  246. </div>
  247. </div>
  248. </template>
  249. <script>
  250. import ReportList from '@/components/report/ReportList'
  251. import Http from '@/js/http.js'
  252. import Apis from '@/js/api.js'
  253. import ResourceType from '@/constants/enum/resource-type'
  254. import provincecity from '@/components/commons/ProvinceCity'
  255. import {notify} from '@/constants/index'
  256. import {
  257. checkFileType,
  258. ensureEndProject,
  259. getAllInstitutions,
  260. getAllPlatformTypes,
  261. getAllServiceTypes,
  262. getFormalTimeFromDate,
  263. getProvinceCodeByProvinceName,
  264. getProvinceNameByProvinceCode,
  265. receiveProjectRequest,
  266. rejectProject,
  267. storageGet,
  268. submitProjectRequest
  269. } from '@/js/index'
  270. export default {
  271. name: 'Project',
  272. components: {
  273. provincecity,
  274. ReportList
  275. },
  276. data () {
  277. var validatePass = (rule, value, callback) => {
  278. var reg = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/
  279. if (this.project.contactPhone) {
  280. if (!reg.test(this.project.contactPhone)) {
  281. callback(new Error('请检查手机号码'))
  282. } else {
  283. callback()
  284. }
  285. }
  286. }
  287. return {
  288. projectId: 0,
  289. user: {},
  290. loading: false,
  291. tabPosition: 'top',
  292. institutionArray: [],
  293. isModifyMode: false,
  294. platforms: [],
  295. resourceType: ResourceType,
  296. serviceType: [],
  297. projectOperationControl: {
  298. confirmFinish: false,
  299. createTask: false,
  300. finish: false,
  301. receive: false,
  302. reject: false,
  303. update: false,
  304. uploadReport: false,
  305. },
  306. project: {
  307. userId: 0,
  308. name: '',
  309. type: '',
  310. platform: '',
  311. desc: '',
  312. resource: '',
  313. location: '',
  314. institution: {},
  315. contactName: '',
  316. contactPhone: '',
  317. doc: [],
  318. requireDocUrl: '',
  319. file: [],
  320. fileUrl: '',
  321. budget: '',
  322. price: '',
  323. datetime: '',
  324. usage: '',
  325. status: ''
  326. },
  327. task: [],
  328. reportList: [],
  329. pickerOptions: {
  330. shortcuts: [
  331. {
  332. text: '今天',
  333. onClick (picker) {
  334. picker.$emit('pick', new Date())
  335. }
  336. },
  337. {
  338. text: '昨天',
  339. onClick (picker) {
  340. const date = new Date()
  341. date.setTime(date.getTime() - 3600 * 1000 * 24)
  342. picker.$emit('pick', date)
  343. }
  344. },
  345. {
  346. text: '一周前',
  347. onClick (picker) {
  348. const date = new Date()
  349. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
  350. picker.$emit('pick', date)
  351. }
  352. }
  353. ]
  354. },
  355. rules: {
  356. name: [
  357. {required: true, message: '请输入项目名称', trigger: 'blur'},
  358. {min: 5, max: 50, message: '项目名称长度在 5 到 50 个字符', trigger: 'blur'}
  359. ],
  360. contactName: [
  361. {required: true, message: '请输入联系人姓名', trigger: 'blur'}
  362. // { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
  363. ],
  364. contactPhone: [
  365. {required: true, message: '请输入手机号', trigger: 'blur'},
  366. //{min: 11, max: 11, message: '请输入正确的手机号', trigger: 'blur'}
  367. ],
  368. type: [
  369. {
  370. type: 'array',
  371. required: true,
  372. message: '请至少选择一种服务类型',
  373. trigger: 'change'
  374. }
  375. ],
  376. platform: [
  377. {
  378. type: 'array',
  379. required: true,
  380. message: '请至少选择一个平台',
  381. trigger: 'change'
  382. }
  383. ],
  384. desc: [{required: false, message: '请填写描述', trigger: 'blur'}],
  385. //price: [{required: true, message: '请填写价格', trigger: 'blur'}],
  386. budget: [
  387. {required: true, message: '预算不可为空', trigger: 'blur'},
  388. {
  389. validator: (rule, value, callback) => {
  390. if (value < 0) {
  391. callback(new Error('请输入不小于0的数'))
  392. } else {
  393. callback()
  394. }
  395. }, trigger: 'blur'
  396. },
  397. ],
  398. resource: [
  399. {required: true},
  400. {
  401. validator: (rule, value, callback) => {
  402. if (value == 0 && this.project.institution == null) {
  403. callback(new Error('定向发布至少要选择一个区域管理员'))
  404. } else {
  405. callback()
  406. }
  407. }, trigger: 'change'
  408. },
  409. ],
  410. datetime: [{required: true, message: '截止时间不可为空', trigger: 'blur'}],
  411. }
  412. }
  413. },
  414. mounted () {
  415. this.$nextTick(() => {
  416. this.init()
  417. })
  418. },
  419. watch: {
  420. serviceType (val) {
  421. this.serviceType = val
  422. },
  423. institutionArray (val) {
  424. this.institutionArray = val
  425. },
  426. // 'project.institution' () {
  427. // if (this.project.institution) {
  428. // //this.$refs.addFormProvince.resetProviceCity()
  429. // this.project.location = {provinceCode: '', cityCode: ''}
  430. // }
  431. // },
  432. // 'project.location' () {
  433. // if (this.project.location.provinceCode || this.project.location.cityCode) {
  434. // this.project.institution = ''
  435. // }
  436. // },
  437. // 'project.resource' () {
  438. // if (this.project.resource == '2') {
  439. // //this.$refs.addFormProvince.resetProviceCity()
  440. // this.project.institution = ''
  441. // this.project.location = {provinceCode: '', cityCode: ''}
  442. // }
  443. // },
  444. deep: true
  445. },
  446. methods: {
  447. updateLocation (location) {
  448. //console.log(location)
  449. const loactionName = getProvinceNameByProvinceCode(location.provinceCode, location.cityCode)
  450. // var provinceName = ''
  451. // var cityName = ''
  452. // for (var item of provinceCityJSON.provinces) {
  453. // if (item.code === location.provinceCode) {
  454. // provinceName = item.name
  455. // for (var city of item.cities) {
  456. // if (city.code === location.cityCode) {
  457. // cityName = city.name
  458. // break
  459. // }
  460. // }
  461. // }
  462. // }
  463. return loactionName.provinceCode + ' / ' + loactionName.cityCode
  464. },
  465. init () {
  466. this.projectId = this.$route.params.projectId
  467. this.setServiceType()
  468. this.setPlatformType()
  469. this.setInstitutions()
  470. this.setUserInfo()
  471. this.loadData()
  472. //this.reformDate(123)
  473. // this.project.platform.map(item => {
  474. // this.platformType.push(PlatformType[item])
  475. // })
  476. },
  477. //提交修改
  478. submitForm (formName) {
  479. this.$refs['project'].validate(valid => {
  480. if (valid) {
  481. this.showLoading()
  482. const newProject = {
  483. userId: this.user.userVO.id,
  484. name: this.project.name,
  485. type: this.project.type,
  486. platform: this.project.platform,
  487. desc: this.project.desc,
  488. resource: this.project.resource,
  489. location: getProvinceNameByProvinceCode(this.project.location.provinceCode, this.project.location.cityCode),
  490. institution: this.project.institution == null ? null : this.project.institution.id,
  491. contactName: this.project.contactName,
  492. contactPhone: this.project.contactPhone,
  493. doc: this.project.requireDocUrl,
  494. file: this.project.fileUrl,
  495. budget: this.project.budget,
  496. price: this.project.price,
  497. datetime: this.project.datetime,
  498. usage: this.project.usage,
  499. }
  500. Http.put(Apis.PROJECT.UPDATE_PROJECT.replace('{projectId}', this.projectId), newProject).then((res) => {
  501. console.log('bb')
  502. console.log(res)
  503. this.projectId = res.projectDetails.id
  504. this.project.name = res.projectDetails.name
  505. this.project.contactName = res.projectDetails.contactName
  506. this.project.contactPhone = res.projectDetails.contactPhone
  507. this.project.type = res.projectDetails.type
  508. this.project.platform = res.projectDetails.platform
  509. this.project.desc = res.projectDetails.desc
  510. this.project.doc = []
  511. this.project.file = []
  512. this.project.resource = res.projectDetails.resource
  513. this.project.location = getProvinceCodeByProvinceName(res.projectDetails.location.provinceCode, res.projectDetails.location.cityCode)
  514. this.project.institution = res.projectDetails.institution
  515. this.project.datetime = new Date(res.projectDetails.datetime)
  516. this.project.price = res.projectDetails.price
  517. this.project.budget = res.projectDetails.budget
  518. this.project.usage = res.projectDetails.usage
  519. this.project.fileUrl = res.projectDetails.file
  520. this.project.requireDocUrl = res.projectDetails.doc
  521. this.task = res.taskList
  522. this.reportList = res.reportList
  523. this.isModifyMode = false
  524. this.hideLoading()
  525. notify('success', '项目修改成功')
  526. }).catch(error => {
  527. this.hideLoading()
  528. notify('error', error.data)
  529. console.log(error)
  530. })
  531. } else {
  532. notify('error', '表单填写错误!')
  533. return false
  534. }
  535. })
  536. },
  537. //重置表单
  538. resetForm (formName) {
  539. this.$refs[formName].resetFields()
  540. this.project.name = ''
  541. this.project.type = []
  542. this.project.platform = []
  543. this.project.desc = ''
  544. this.project.doc = ''
  545. this.project.file = ''
  546. this.project.contactName = ''
  547. this.project.contactPhone = ''
  548. this.project.resource = '2'
  549. this.project.institution = ''
  550. this.project.datetime = ''
  551. this.project.price = ''
  552. this.project.usage = ''
  553. this.project.budget = ''
  554. },
  555. //进入修改项目页面
  556. modifyForm () {
  557. this.isModifyMode = true
  558. console.log(this.project.doc)
  559. //this.setInstitutions()
  560. //获得update 信息
  561. //this.loadData()
  562. },
  563. //接收项目
  564. receiveProject () {
  565. this.$confirm('确认接收项目?', '提示', {
  566. confirmButtonText: '确认接收',
  567. cancelButtonText: '取消',
  568. type: 'success'
  569. }).then(() => {
  570. this.showLoading()
  571. console.log('接收项目')
  572. receiveProjectRequest(this.projectId, this.user.userVO.id, this.receiveProjectSuccess, this.receiveProjectFail)
  573. }).catch(() => {
  574. })
  575. },
  576. receiveProjectSuccess (res) {
  577. this.hideLoading()
  578. notify('success', '项目接收成功!')
  579. this.projectOperationControl = res.projectOperationControl
  580. this.project.status = res.projectDetails.status
  581. this.project.institution = res.projectDetails.institution
  582. },
  583. receiveProjectFail (error) {
  584. this.hideLoading()
  585. notify('error', '接收项目失败:' + error.data)
  586. },
  587. //拒绝项目
  588. rejectProject () {
  589. this.$confirm('确认拒绝项目?', '提示', {
  590. confirmButtonText: '确认拒绝',
  591. cancelButtonText: '取消',
  592. type: 'success'
  593. }).then(() => {
  594. this.showLoading()
  595. rejectProject(this.projectId, this.rejectProjectSuccess, this.rejectProjectFail)
  596. }).catch(() => {
  597. })
  598. },
  599. rejectProjectSuccess (res) {
  600. this.hideLoading()
  601. notify('success', '拒绝项目成功')
  602. },
  603. rejectProjectFail (error) {
  604. this.hideLoading()
  605. notify('error', '拒绝项目失败:' + error.data)
  606. },
  607. //提交项目
  608. submitProjectRequest () {
  609. this.$confirm('确认提交项目?', '提示', {
  610. confirmButtonText: '确认提交',
  611. cancelButtonText: '取消',
  612. type: 'success'
  613. }).then(() => {
  614. this.showLoading()
  615. submitProjectRequest(this.projectId, this.submitProjectRequestSuccess, this.submitProjectRequestFail)
  616. }).catch(() => {
  617. })
  618. },
  619. submitProjectRequestSuccess (res) {
  620. this.hideLoading()
  621. notify('success', '项目提交成功!')
  622. this.projectOperationControl = res.projectOperationControl
  623. this.project.status = res.projectDetails.status
  624. this.project.institution = res.projectDetails.institution
  625. },
  626. submitProjectRequestFail (error) {
  627. this.hideLoading()
  628. notify('error', '提交项目失败:' + error.data)
  629. },
  630. //结束项目
  631. endProject () {
  632. this.$confirm('确认结束项目?', '提示', {
  633. confirmButtonText: '确认结束',
  634. cancelButtonText: '取消',
  635. type: 'success'
  636. }).then(() => {
  637. this.showLoading()
  638. ensureEndProject(this.projectId, this.endProjectSuccess, this.endProjectFail)
  639. }).catch(() => {
  640. })
  641. },
  642. endProjectSuccess (res) {
  643. this.hideLoading()
  644. notify('success', '项目提交成功!')
  645. this.projectOperationControl = res.projectOperationControl
  646. this.project.status = res.projectDetails.status
  647. this.project.institution = res.projectDetails.institution
  648. },
  649. endProjectFail (error) {
  650. this.hideLoading()
  651. notify('error', '结束项目失败:' + error.data)
  652. },
  653. cancelMode (formName) {
  654. this.isModifyMode = false
  655. this.loadData()
  656. },
  657. goToTaskDetail (projectId, taskId) {
  658. this.$router.push({
  659. name: 'Task',
  660. params: {projectId: projectId, taskId: taskId}
  661. })
  662. },
  663. createNewTask () {
  664. const that = this
  665. this.$router.push({
  666. name: 'TaskCreate',
  667. params: {projectId: that.projectId}
  668. })
  669. },
  670. createReport () {
  671. this.$router.push({
  672. name: 'ProjectReportCreate',
  673. params: {
  674. scope: 0,
  675. dependencyCode: this.projectId,
  676. projectId: this.projectId,
  677. }
  678. })
  679. },
  680. handleDelete (index, id) {
  681. this.$confirm('确认删除该任务?')
  682. .then(_ => {
  683. //done()
  684. notify('success', '删除成功')
  685. })
  686. .catch(_ => {
  687. notify('error', '删除失败')
  688. })
  689. //this.task.splice(index, 1)
  690. },
  691. beforeApkUpload (file) {
  692. const isAPK = file.type === 'application/vnd.android.package-archive'
  693. const isDMG = file.type === 'application/octet-stream'
  694. if (!isAPK && !isDMG) {
  695. this.$message.error('上传安装包只能是 APK 或 DMG 格式!')
  696. }
  697. return isAPK || isDMG
  698. },
  699. beforeFileUpload (file) {
  700. console.log(file)
  701. const isPDF = file.type === 'application/pdf'
  702. const isDOC = file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
  703. const isEXCEL = file.type === 'application/vnd.ms-excel'
  704. const isXLS = file.type === 'application/x-xls'
  705. const isTXT = file.type === 'text/plain'
  706. const isXLSX = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
  707. //console.log(file)
  708. if (!(isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX)) {
  709. this.$message.error('上传文件只能是 PDF 、 DOC 、DOCX 、XLS、TXT、XLSX 格式!')
  710. }
  711. return isDOC || isEXCEL || isPDF || isTXT || isXLS || isXLSX
  712. },
  713. analyseDemand () {
  714. this.$router.push({name: 'AnalyseDemand'})
  715. },
  716. handleAccept (index, id) {
  717. console.log('接受')
  718. },
  719. handleReject (index, id) {
  720. console.log('拒绝')
  721. },
  722. loadData () {//PROJ--2019073114009
  723. this.showLoading()
  724. Http.get(Apis.PROJECT.GET_PROJECT.replace('{projectId}', this.projectId)).then((res) => {
  725. console.log(res)
  726. this.projectId = res.projectDetails.id
  727. this.project.name = res.projectDetails.name
  728. this.project.contactName = res.projectDetails.contactName
  729. this.project.contactPhone = res.projectDetails.contactPhone
  730. this.project.type = res.projectDetails.type
  731. this.project.platform = res.projectDetails.platform
  732. this.project.desc = res.projectDetails.desc
  733. this.project.doc = []
  734. this.project.file = []
  735. this.project.resource = res.projectDetails.resource
  736. this.project.location = getProvinceCodeByProvinceName(res.projectDetails.location.provinceCode, res.projectDetails.location.cityCode)
  737. this.project.institution = res.projectDetails.institution
  738. this.project.datetime = new Date(res.projectDetails.datetime)
  739. this.project.price = res.projectDetails.price
  740. this.project.budget = res.projectDetails.budget
  741. this.project.usage = res.projectDetails.usage
  742. this.project.fileUrl = res.projectDetails.file
  743. this.project.requireDocUrl = res.projectDetails.doc
  744. this.project.userId = res.projectDetails.userId
  745. this.project.status = res.projectDetails.status
  746. this.task = res.taskList
  747. this.reportList = res.reportList
  748. this.projectOperationControl = res.projectOperationControl
  749. this.hideLoading()
  750. }).catch((error) => {
  751. this.hideLoading()
  752. notify('error', error.data)
  753. })
  754. },
  755. locationChange (provinceId, cityId) {
  756. if (provinceId || cityId) {
  757. this.project.location = {provinceCode: provinceId, cityCode: cityId}
  758. }
  759. },
  760. handleRemove (file, fileList) {
  761. console.log(file, fileList)
  762. },
  763. handleExceed (files, fileList) {
  764. this.$message.warning(
  765. `当前限制选择 1 个文件,本次选择了 ${
  766. files.length
  767. } 个文件,共选择了 ${files.length + fileList.length} 个文件`
  768. )
  769. },
  770. beforeRemove (file, fileList) {
  771. //return this.$confirm(`确定移除 ${file.name}?`)
  772. },
  773. beforeUploadRequireDoc () {
  774. },
  775. beforeUploadApkFile () {
  776. },
  777. uploadRequireDoc (param) {
  778. this.showLoading()
  779. const formData = new FormData()
  780. let config = {
  781. //添加请求头
  782. headers: {'Content-Type': 'multipart/form-data'},
  783. }
  784. formData.append('file', param.file)
  785. Http.upload(Apis.FILE.REQUIREMENT_FILE.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
  786. this.project.requireDocUrl = res.data
  787. this.hideLoading()
  788. notify('success', '需求文档上传成功')
  789. }).catch((error) => {
  790. this.hideLoading()
  791. notify('error', '需求文档上传失败:' + error.data)
  792. })
  793. },
  794. uploadApkFile (param) {
  795. this.showLoading()
  796. const formData = new FormData()
  797. let config = {
  798. //添加请求头
  799. headers: {'Content-Type': 'multipart/form-data'},
  800. }
  801. formData.append('file', param.file)
  802. Http.upload(Apis.FILE.APK.replace('{userId}', this.user.userVO.id), formData, config).then((res) => {
  803. this.project.fileUrl = res.data
  804. this.hideLoading()
  805. notify('success', '文件上传成功')
  806. }).catch((error) => {
  807. this.hideLoading()
  808. notify('error', '文件上传失败')
  809. })
  810. },
  811. setServiceType () {
  812. getAllServiceTypes().then((res) => {
  813. this.serviceType = res
  814. }).catch((error) => {
  815. notify('error', '获取项目类型列表失败')
  816. })
  817. },
  818. setPlatformType () {
  819. this.platforms = getAllPlatformTypes()
  820. },
  821. setInstitutions () {
  822. getAllInstitutions().then((res) => {
  823. this.institutionArray = res
  824. }).catch((error) => {
  825. notify('error', '获取institution失败' + error.data)
  826. })
  827. },
  828. setUserInfo () {
  829. this.user = storageGet('user')
  830. },
  831. showLoading () {
  832. this.loading = true
  833. },
  834. hideLoading () {
  835. this.loading = false
  836. },
  837. reformDate (date) {
  838. return getFormalTimeFromDate(date)
  839. }
  840. }
  841. }
  842. </script>
  843. <style lang="less" scoped>
  844. .task-list {
  845. margin: 0 30px;
  846. }
  847. .el-col {
  848. padding: 0 !important;
  849. }
  850. .el-row {
  851. margin-bottom: 10px;
  852. }
  853. .el-input {
  854. width: 400px;
  855. }
  856. </style>
  857. <!--<div class="create-body" v-if="!isModifyMode">-->
  858. <!--<div class="title h2">分析需求</div>-->
  859. <!--<div class="task-list">-->
  860. <!--<el-table :data="analyseDemandList" style="width: 100%" max-height="400">-->
  861. <!--<el-table-column prop="institution" label="承接单位" title="承接单位"></el-table-column>-->
  862. <!--<el-table-column prop="feasibilityReport" sortable label="可行性分析报告">-->
  863. <!--<template slot-scope="scope">-->
  864. <!--<span v-if="!scope.row.feasibilityReport.url">暂无文件</span>-->
  865. <!--<a-->
  866. <!--:href="scope.row.feasibilityReport.url"-->
  867. <!--v-if="scope.row.feasibilityReport.url"-->
  868. <!--target="_blank"-->
  869. <!--&gt;-->
  870. <!--<i class="fa fa-file-text-o"></i>-->
  871. <!--{{scope.row.feasibilityReport.name}}-->
  872. <!--</a>-->
  873. <!--</template>-->
  874. <!--</el-table-column>-->
  875. <!--<el-table-column prop="priceAuditReport" sortable label="可行性分析报告">-->
  876. <!--<template slot-scope="scope">-->
  877. <!--<span v-if="!scope.row.priceAuditReport.url">暂无文件</span>-->
  878. <!--<a-->
  879. <!--:href="scope.row.priceAuditReport.url"-->
  880. <!--v-if="scope.row.priceAuditReport.url"-->
  881. <!--target="_blank"-->
  882. <!--&gt;-->
  883. <!--<i class="fa fa-file-text-o"></i>-->
  884. <!--{{scope.row.priceAuditReport.name}}-->
  885. <!--</a>-->
  886. <!--</template>-->
  887. <!--</el-table-column>-->
  888. <!--<el-table-column align="right" label="操作">-->
  889. <!--<template slot-scope="scope">-->
  890. <!--<div-->
  891. <!--class="btn btn-small btn-info"-->
  892. <!--@click="handleAccept(scope.$index, scope.row.id)"-->
  893. <!--&gt;接受-->
  894. <!--</div>-->
  895. <!--<div-->
  896. <!--class="btn btn-small btn-danger"-->
  897. <!--@click="handleReject(scope.$index, scope.row.id)"-->
  898. <!--&gt;拒绝-->
  899. <!--</div>-->
  900. <!--</template>-->
  901. <!--</el-table-column>-->
  902. <!--</el-table>-->
  903. <!--</div>-->
  904. <!--</div>-->