detail.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253
  1. <template>
  2. <basic-container>
  3. <div>
  4. <el-tabs
  5. v-model="activeType"
  6. :before-leave="beforeLeave"
  7. >
  8. <!-- 合同段信息 -->
  9. <el-tab-pane
  10. label="合同段信息"
  11. name="1"
  12. >
  13. <div>
  14. <el-form
  15. :model="contractForm"
  16. :rules="contractRules"
  17. ref="contractForm"
  18. label-width="120px"
  19. >
  20. <el-form-item label="项目名称">
  21. <el-input
  22. v-model="projectInfo.projectName"
  23. disabled
  24. ></el-input>
  25. </el-form-item>
  26. <el-row>
  27. <el-col :span="12">
  28. <el-form-item
  29. label="合同段类型"
  30. prop="contractType"
  31. >
  32. <el-select
  33. v-model="contractForm.contractType"
  34. placeholder="请选择"
  35. class="w-100p"
  36. >
  37. <el-option
  38. v-for="item in contractTypeList"
  39. :key="item.id"
  40. :label="item.dictValue"
  41. :value="item.dictKey"
  42. ></el-option>
  43. </el-select>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="12">
  47. <el-form-item
  48. label="合同段编号"
  49. prop="contractNumber"
  50. >
  51. <el-input v-model="contractForm.contractNumber"></el-input>
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. <el-row>
  56. <el-col :span="12">
  57. <el-form-item
  58. label="合同段名称"
  59. prop="contractName"
  60. >
  61. <el-input v-model="contractForm.contractName"></el-input>
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span="12">
  65. <el-form-item
  66. label="参与方进场日期"
  67. prop="contractorJoinTime"
  68. >
  69. <el-date-picker
  70. v-model="contractForm.contractorJoinTime"
  71. type="date"
  72. format="yyyy 年 MM 月 dd 日"
  73. value-format="yyyy-MM-dd HH:mm:ss"
  74. placeholder="选择日期"
  75. ></el-date-picker>
  76. </el-form-item>
  77. </el-col>
  78. </el-row>
  79. <el-row>
  80. <el-col :span="12">
  81. <el-form-item
  82. label="计划开工日期"
  83. prop="planStartTime"
  84. >
  85. <el-date-picker
  86. v-model="contractForm.planStartTime"
  87. type="date"
  88. format="yyyy 年 MM 月 dd 日"
  89. value-format="yyyy-MM-dd HH:mm:ss"
  90. placeholder="选择日期"
  91. ></el-date-picker>
  92. </el-form-item>
  93. </el-col>
  94. <el-col :span="12">
  95. <el-form-item
  96. label="计划完工日期"
  97. prop="planEndTime"
  98. >
  99. <el-date-picker
  100. v-model="contractForm.planEndTime"
  101. type="date"
  102. format="yyyy 年 MM 月 dd 日"
  103. value-format="yyyy-MM-dd HH:mm:ss"
  104. placeholder="选择日期"
  105. ></el-date-picker>
  106. </el-form-item>
  107. </el-col>
  108. </el-row>
  109. <el-row>
  110. <el-col :span="12">
  111. <el-form-item
  112. label="实际开工日期"
  113. prop="actualStartTime"
  114. >
  115. <el-date-picker
  116. v-model="contractForm.actualStartTime"
  117. type="date"
  118. format="yyyy 年 MM 月 dd 日"
  119. value-format="yyyy-MM-dd HH:mm:ss"
  120. placeholder="选择日期"
  121. ></el-date-picker>
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="12">
  125. <el-form-item
  126. label="实际完工日期"
  127. prop="actualEndTime"
  128. >
  129. <el-date-picker
  130. v-model="contractForm.actualEndTime"
  131. type="date"
  132. format="yyyy 年 MM 月 dd 日"
  133. value-format="yyyy-MM-dd HH:mm:ss"
  134. placeholder="选择日期"
  135. ></el-date-picker>
  136. </el-form-item>
  137. </el-col>
  138. </el-row>
  139. <el-row>
  140. <el-col :span="12">
  141. <el-form-item
  142. label="业主单位名称"
  143. prop="contractorUnitName"
  144. >
  145. <el-input v-model="contractForm.contractorUnitName"></el-input>
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="12">
  149. <el-form-item
  150. label="合同金额"
  151. prop="contractAmount"
  152. >
  153. <el-input v-model="contractForm.contractAmount">
  154. <template slot="append">万元</template>
  155. </el-input>
  156. </el-form-item>
  157. </el-col>
  158. </el-row>
  159. <el-row>
  160. <el-col :span="12">
  161. <el-form-item
  162. label="施工单位名称"
  163. prop="constructionUnitName"
  164. >
  165. <el-input v-model="contractForm.constructionUnitName"></el-input>
  166. </el-form-item>
  167. </el-col>
  168. <el-col :span="12">
  169. <el-form-item
  170. label="上传开工令"
  171. prop="startFileUrl"
  172. >
  173. <template v-if="isBackShow">
  174. <el-link
  175. type="primary"
  176. @click="downloadFile"
  177. >开工令</el-link>
  178. <el-button
  179. @click="delFile"
  180. class="mg-l-10"
  181. style="color:red"
  182. type="text"
  183. icon="el-icon-circle-close"
  184. ></el-button>
  185. </template>
  186. <template v-else>
  187. <el-upload
  188. action="/api/blade-resource/oss/endpoint/put-file-attach"
  189. :on-remove="handleRemove"
  190. :limit="1"
  191. :headers=headers
  192. :on-exceed="handleExceed"
  193. :on-success="handleSuccess"
  194. :file-list="fileList"
  195. >
  196. <el-button
  197. size="small"
  198. type="primary"
  199. >点击上传</el-button>
  200. </el-upload>
  201. </template>
  202. </el-form-item>
  203. </el-col>
  204. </el-row>
  205. <el-row>
  206. <el-col :span="12">
  207. <el-form-item
  208. label="监理单位名称"
  209. prop="supervisionUnitName"
  210. >
  211. <el-input v-model="contractForm.supervisionUnitName"></el-input>
  212. </el-form-item>
  213. </el-col>
  214. <el-col :span="12">
  215. <el-form-item
  216. label="试验室名称"
  217. prop="laboratoryName"
  218. >
  219. <el-input v-model="contractForm.laboratoryName"></el-input>
  220. </el-form-item>
  221. </el-col>
  222. </el-row>
  223. <el-divider></el-divider>
  224. <el-row :gutter="20">
  225. <el-col
  226. :span="12"
  227. v-show="contractForm.contractType!=1"
  228. >
  229. <div class="head-font">施工方合同段权限配置</div>
  230. <el-checkbox-group
  231. v-model="idList"
  232. class="martop15"
  233. >
  234. <el-checkbox
  235. :label="item.contractId"
  236. :key="key"
  237. v-for="(item,key) in checkList"
  238. >{{item.deptName}}</el-checkbox>
  239. </el-checkbox-group>
  240. </el-col>
  241. <el-col :span="12">
  242. <div class="head-font">组卷归档默认信息</div>
  243. <el-row class="martop15">
  244. <el-col :span="12">
  245. <el-form-item
  246. label="立卷人"
  247. prop="filer"
  248. >
  249. <el-input v-model="contractForm.filer"></el-input>
  250. </el-form-item>
  251. </el-col>
  252. <el-col :span="12">
  253. <el-form-item
  254. label="保管期限"
  255. prop="storagePeriod"
  256. >
  257. <el-select
  258. v-model="contractForm.storagePeriod"
  259. placeholder="请选择"
  260. class="w-100p"
  261. >
  262. <el-option
  263. v-for="item in storagePeriodList"
  264. :key="item.id"
  265. :label="item.dictValue"
  266. :value="item.dictKey"
  267. ></el-option>
  268. </el-select>
  269. </el-form-item>
  270. </el-col>
  271. </el-row>
  272. <el-row>
  273. <el-col :span="12">
  274. <el-form-item
  275. label="审核人"
  276. prop="reviewer"
  277. >
  278. <el-input v-model="contractForm.reviewer"></el-input>
  279. </el-form-item>
  280. </el-col>
  281. <el-col :span="12">
  282. <el-form-item
  283. label="保管密级"
  284. prop="securityLevel"
  285. >
  286. <el-select
  287. v-model="contractForm.securityLevel"
  288. placeholder="请选择"
  289. class="w-100p"
  290. >
  291. <el-option
  292. v-for="item in securityLevelList"
  293. :key="item.id"
  294. :label="item.dictValue"
  295. :value="item.dictKey"
  296. ></el-option>
  297. </el-select>
  298. </el-form-item>
  299. </el-col>
  300. </el-row>
  301. <el-row>
  302. <el-col :span="12">
  303. <el-form-item
  304. label="档案前缀"
  305. prop="prefix"
  306. >
  307. <el-input v-model="contractForm.prefix"></el-input>
  308. </el-form-item>
  309. </el-col>
  310. <el-col :span="12">
  311. </el-col>
  312. </el-row>
  313. </el-col>
  314. <el-col
  315. :span="12"
  316. v-if="contractForm.contractType==1"
  317. >
  318. <div class="head-font">附加信息</div>
  319. <el-form-item
  320. label="项目地址"
  321. prop="projectPlace"
  322. >
  323. <!-- <el-input v-model="contractForm.projectPlace" placeholder="点击后面地图选取地址">
  324. <el-button slot="append" icon="el-icon-map-location" @click="mapDialogVisible = true"></el-button>
  325. </el-input> -->
  326. <avue-input-map
  327. :params="params"
  328. placeholder="请选择地图"
  329. v-model="flageData"
  330. @change="mapChange"
  331. ></avue-input-map>
  332. </el-form-item>
  333. <el-form-item
  334. label="起始桩号"
  335. prop="startStation"
  336. >
  337. <el-input v-model="contractForm.startStation"></el-input>
  338. </el-form-item>
  339. <el-form-item
  340. label="结束桩号"
  341. prop="endStation"
  342. >
  343. <el-input v-model="contractForm.endStation"></el-input>
  344. </el-form-item>
  345. </el-col>
  346. </el-row>
  347. </el-form>
  348. </div>
  349. </el-tab-pane>
  350. <el-tab-pane
  351. v-if="$route.query.contractType==1||$route.query.contractType===undefined"
  352. label="分配WBS"
  353. name="2"
  354. >
  355. <div>
  356. <div
  357. v-if="!wbsId"
  358. class="text-align-c"
  359. >项目暂未分配wbs树</div>
  360. <tree-tree
  361. :left-tree-data="leftTreeData"
  362. ref="treetotree"
  363. @onAddTree="treeChang"
  364. @onDelTree="treeChang"
  365. ></tree-tree>
  366. </div>
  367. </el-tab-pane>
  368. <el-tab-pane
  369. label="分配项目人员"
  370. name="3"
  371. >
  372. <div>
  373. <div class="flex jc-al-c">
  374. <span class="mg-r-10">项目名称</span>
  375. <el-input
  376. v-model="projectInfo.projectName"
  377. disabled
  378. style="width:300px;margin-right:30px;"
  379. ></el-input>
  380. <span class="mg-r-10">合同段名称</span>
  381. <el-input
  382. v-model="contractForm.contractName"
  383. disabled
  384. style="width:300px;"
  385. ></el-input>
  386. </div>
  387. <el-divider></el-divider>
  388. <div class="flex jc-al-c mg-b-10">
  389. <div>
  390. <span class="mg-r-10">角色方</span>
  391. <el-radio-group v-model="rId">
  392. <el-radio-button
  393. v-for="(item,key) in roleList"
  394. :label="item.id"
  395. :key="key"
  396. >{{item.roleName}}</el-radio-button>
  397. </el-radio-group>
  398. </div>
  399. <div>
  400. <span class="mg-r-10 mg-l-20">请选择岗位</span>
  401. <el-select
  402. v-model="postId"
  403. filterable
  404. placeholder="请输入搜索"
  405. >
  406. <el-option
  407. v-for="item in postList"
  408. :key="item.id"
  409. :label="item.roleName"
  410. :value="item.id"
  411. ></el-option>
  412. </el-select>
  413. </div>
  414. </div>
  415. <!-- table表 -->
  416. <div>
  417. <el-table
  418. :data="contractUserList"
  419. border
  420. height="420"
  421. style="width: 100%"
  422. >
  423. <el-table-column
  424. prop="name"
  425. label="姓名"
  426. align="center"
  427. ></el-table-column>
  428. <el-table-column
  429. prop="account"
  430. label="登录账号"
  431. align="center"
  432. ></el-table-column>
  433. <el-table-column
  434. prop="password"
  435. label="密码"
  436. align="center"
  437. ></el-table-column>
  438. <el-table-column
  439. label="操作"
  440. align="center"
  441. >
  442. <template slot-scope="scope">
  443. <el-link
  444. class="mg-r-20"
  445. type="primary"
  446. @click="copyAccPas(scope.row)"
  447. >复制</el-link>
  448. <el-link
  449. class="mg-r-20"
  450. type="primary"
  451. @click="resetPassword(scope.row)"
  452. >重置密码</el-link>
  453. <el-link
  454. type="danger"
  455. @click="handleDelete(scope.$index, scope.row)"
  456. >删除</el-link>
  457. </template>
  458. </el-table-column>
  459. </el-table>
  460. <el-input
  461. v-model="copyText"
  462. ref="copyInput"
  463. type="textarea"
  464. style='opacity: 0;position: absolute;height:1px;overflow:hidden;'
  465. ></el-input>
  466. </div>
  467. <div class="martop10 flexEnd">
  468. <el-pagination
  469. background
  470. @size-change="handleSizeChange"
  471. @current-change="handleCurrentChange"
  472. :current-page.sync="pageindx"
  473. :page-size="pagesize"
  474. layout="total, prev, pager, next"
  475. :total="total"
  476. >
  477. </el-pagination>
  478. </div>
  479. <div class="flex jc-al-c mg-t-20">
  480. <span>添加项目人员</span>
  481. <el-select
  482. class="marleft10"
  483. v-model="userId"
  484. filterable
  485. placeholder="请输入搜索"
  486. >
  487. <el-option
  488. v-for="item in userList"
  489. :key="item.id"
  490. :label="item.name"
  491. :value="item.id"
  492. ></el-option>
  493. </el-select>
  494. <el-button
  495. class="marleft10"
  496. type="success"
  497. @click="addUserToProject"
  498. >添加</el-button>
  499. <el-button
  500. type="primary"
  501. @click="rputerPush()"
  502. >创建新用户</el-button>
  503. <!--<el-button
  504. type="danger"
  505. @click="handleDeletes"
  506. >全部删除</el-button>-->
  507. </div>
  508. <el-divider></el-divider>
  509. </div>
  510. </el-tab-pane>
  511. </el-tabs>
  512. <div class="flexEnd marbottom20">
  513. <el-button
  514. type="success"
  515. size="medium"
  516. :loading="btnLoad"
  517. @click="saveQuit"
  518. >保存并退出</el-button>
  519. <el-button
  520. type="info"
  521. size="medium"
  522. :loading="btnLoad"
  523. v-if="activeType != 1"
  524. @click="saveNext('p')"
  525. >保存并返回上一步</el-button>
  526. <el-button
  527. type="info"
  528. size="medium"
  529. :loading="btnLoad"
  530. v-if="activeType != 3"
  531. @click="saveNext('n')"
  532. >保存并进入下一步</el-button>
  533. </div>
  534. </div>
  535. </basic-container>
  536. </template>
  537. <script>
  538. import { getProjectDeatil, findProjectTree, treeAllConstruction } from "@/api/manager/projectinfo";
  539. import {
  540. submitContractInfo, getContractInfo, getContractInfo2, delFileFromUrl, searchRole, findAllUserByCondition, findUserByName,
  541. saveUserInfoByProjectTow, removeUsersByIds, resetPasswordByUserId,
  542. submitWbsTreeInContract, getContractInfoTree
  543. } from "@/api/manager/contractinfo";
  544. import { getDictionary } from "@/api/system/dict";
  545. import { getDictionary as getDictbiz } from "@/api/system/dictbiz";
  546. import { remove as removeFile } from "@/api/resource/attach";
  547. import website from '@/config/website';
  548. import { Base64 } from 'js-base64';
  549. import { getToken } from '@/util/auth';
  550. import { mapGetters } from "vuex";
  551. import treeTree from "@/components/tree-tree/main"
  552. export default {
  553. components: {
  554. treeTree
  555. },
  556. data () {
  557. var checkPlace = (rule, value, callback) => {
  558. if (this.flageData && this.flageData.length > 2 && this.flageData[2]) {
  559. callback();
  560. } else {
  561. callback(new Error('请选取项目地址'));
  562. }
  563. }
  564. var checkDate = (rule, value, callback) => {
  565. if (value && this.contractForm.planStartTime) {
  566. if (Date.parse(value) < Date.parse(this.contractForm.planStartTime)) {
  567. callback(new Error('计划完工日期不能小于开工日期'));
  568. }
  569. }
  570. callback();
  571. };
  572. var checkDate2 = (rule, value, callback) => {
  573. if (value && this.contractForm.actualStartTime) {
  574. if (Date.parse(value) < Date.parse(this.contractForm.actualStartTime)) {
  575. callback(new Error('实际完工日期不能小于开工日期'));
  576. }
  577. }
  578. callback();
  579. };
  580. var checkIsNumber = (rule, value, callback) => {
  581. if (value != Number(value)) {
  582. callback(new Error('金额必须是数字'));
  583. }
  584. callback();
  585. };
  586. return {
  587. idList: [],
  588. checkList: [],
  589. postIdss: '',
  590. //#region
  591. pageindx: 1,
  592. pagesize: 10,
  593. total: 0,
  594. //#endregion
  595. activeType: '1',
  596. typeChang: {
  597. 1: false,
  598. 2: false,
  599. 3: false,
  600. },
  601. btnLoad: false,
  602. pid: '',
  603. cid: '',
  604. projectInfo: {},
  605. contractTypeList: [],
  606. storagePeriodList: [],//保管期限
  607. securityLevelList: [],//保管密级
  608. fileList: [],
  609. headers: {},
  610. isBackShow: false,
  611. contractForm: {
  612. contractType: 1,
  613. contractAmount: 0
  614. },
  615. contractRules: {
  616. contractName: [
  617. { required: true, message: '请输入合同段名称', trigger: 'blur' },
  618. ],
  619. contractType: [
  620. { required: true, message: '请选择合同段类型', trigger: 'change' }
  621. ],
  622. contractNumber: [
  623. { required: true, message: '请输入合同段编号', trigger: 'blur' },
  624. ],
  625. contractorUnitName: [
  626. { required: true, message: '请输入业主单位名称', trigger: 'blur' },
  627. ],
  628. constructionUnitName: [
  629. { required: true, message: '请输入施工单位名称', trigger: 'blur' },
  630. ],
  631. supervisionUnitName: [
  632. { required: true, message: '请输入监理单位名称', trigger: 'blur' },
  633. ],
  634. startStation: [
  635. { required: true, message: '请输入起始桩号', trigger: 'blur' },
  636. ],
  637. endStation: [
  638. { required: true, message: '请输入结束桩号', trigger: 'blur' },
  639. ],
  640. projectPlace: [
  641. { required: true, validator: checkPlace, trigger: 'blur' },
  642. ],
  643. planEndTime: [
  644. { validator: checkDate, trigger: 'blur' },
  645. ],
  646. actualEndTime: [
  647. { validator: checkDate2, trigger: 'blur' },
  648. ],
  649. contractAmount: [
  650. { validator: checkIsNumber, trigger: 'blur' }
  651. ]
  652. },
  653. mapDialogVisible: false,
  654. params: {
  655. zoom: 10,
  656. // zoomEnable: false,
  657. // dragEnable: false,
  658. },
  659. flageData: [],
  660. rId: '',
  661. roleList: [],
  662. postId: '',
  663. postList: [],
  664. contractUserList: [],
  665. userId: '',
  666. userList: [],
  667. copyText: '',
  668. wbsId: '',
  669. leftTreeData: [],
  670. }
  671. },
  672. computed: {
  673. ...mapGetters(["userInfo"]),
  674. },
  675. watch: {
  676. contractForm: {
  677. handler: function () { // 此处注意,handler函数不能为箭头函数,this会取上下文,而不是组件里的this,此外,深度监听,必须为handler函数名,否则会无效果
  678. this.typeChang['1'] = true;
  679. },
  680. deep: true
  681. },
  682. activeType: async function (newValue) {
  683. if (newValue == '3') {
  684. this.getUserByName();
  685. this.searchRole()
  686. } else if (newValue == '2') {
  687. await this.getLeftTree();
  688. this.getRightTree();
  689. }
  690. },
  691. rId: function () {
  692. this.postIdss = ''
  693. this.postId = ''
  694. this.roleList.forEach(val => {
  695. if (val.id === this.rId) {
  696. if (val.children) {
  697. this.postList = val.children
  698. } else {
  699. this.postList = []
  700. }
  701. if (val.roleName === '超级管理员') {
  702. this.postIdss = this.rId
  703. this.findAllUserByCondition(this.rId)
  704. }
  705. }
  706. })
  707. },
  708. postId: function (newValue) {
  709. if (newValue) {
  710. this.findAllUserByCondition();
  711. } else {
  712. this.contractUserList = [];
  713. }
  714. },
  715. 'contractForm.contractType' (newValue) {
  716. if (newValue != 1) {
  717. this.treeAllConstruction()
  718. }
  719. }
  720. },
  721. created () {
  722. this.init();
  723. //console.log(this.userInfo)
  724. },
  725. mounted () {
  726. this.$nextTick(() => {
  727. this.typeChang = {
  728. 1: false,
  729. 2: false,
  730. 3: false,
  731. }
  732. })
  733. },
  734. methods: {
  735. //#region //后加分页
  736. handleSizeChange (val) {
  737. this.pagesize = val
  738. this.findAllUserByCondition()
  739. },
  740. handleCurrentChange (val) {
  741. this.pageindx = val
  742. this.findAllUserByCondition()
  743. },
  744. rputerPush () {
  745. this.$router.push({
  746. path: '/system/user',
  747. query: { tankai: true }
  748. })
  749. },
  750. //#endregion
  751. //#region 甘云杰
  752. async searchRole () {
  753. const { data: res } = await searchRole()
  754. console.log(res);
  755. if (res.code === 200) {
  756. this.roleList = res.data
  757. }
  758. },
  759. async init () {
  760. this.pid = this.$route.query.pid;
  761. this.cid = this.$route.query.cid;
  762. if (!this.cid) {
  763. this.contractForm.pid = this.pid;
  764. } else {
  765. if (this.$route.query.contractType == 1) {
  766. await this.getContractInfo();//获取合同段基本信息
  767. } else if (this.$route.query.contractType == 2 || this.$route.query.contractType == 3) {
  768. await this.getContractInfo2()
  769. }
  770. }
  771. await this.getProjectDeatil();//获取项目详情
  772. if (this.$route.query.type) {
  773. console.log(this.$route.query.type);
  774. this.activeType = this.$route.query.type;
  775. }
  776. this.getContractTypeList();//获取合同类型
  777. this.getStoragePeriodList();//获取业务字典
  778. this.getSecurityLevelList();//获取安全等级
  779. this.setHeaders();
  780. },
  781. beforeLeave (activeName, oldActiveName) {
  782. return new Promise((resolve, reject) => {
  783. if (oldActiveName == '1' && !this.contractForm.id) {
  784. this.$message({
  785. type: "warning",
  786. message: "请先保存合同段后,再进行合同段的分配"
  787. });
  788. reject();
  789. }
  790. if (this.typeChang[oldActiveName]) {
  791. this.$confirm('检测到新编辑内容, 是否保存?', '提示', {
  792. confirmButtonText: '确定',
  793. cancelButtonText: '不用',
  794. type: 'warning'
  795. }).then(() => {
  796. switch (oldActiveName) {
  797. case '1':
  798. this.savecontract().then((res) => {
  799. this.contractForm.id = res.data.data.id;
  800. resolve();
  801. this.$message({
  802. type: "success",
  803. message: "保存成功!"
  804. });
  805. });
  806. break;
  807. case '2':
  808. this.saveWbsTree().then(() => {
  809. resolve();
  810. this.$message({
  811. type: "success",
  812. message: "保存成功!"
  813. });
  814. })
  815. break;
  816. }
  817. }).catch(() => {
  818. this.typeChang[oldActiveName] = false;
  819. resolve();
  820. })
  821. } else {
  822. resolve();
  823. }
  824. })
  825. },
  826. getProjectDeatil () {
  827. return new Promise((resolve) => {
  828. getProjectDeatil(this.pid).then((res) => {
  829. this.projectInfo = res.data.data;
  830. this.wbsId = this.projectInfo.referenceWbsTemplateId;
  831. resolve();
  832. }).finally(() => {
  833. resolve();
  834. })
  835. })
  836. },
  837. getContractInfo () {
  838. return new Promise((resolve) => {
  839. getContractInfo(this.cid).then((res) => {
  840. this.contractForm = res.data.data;
  841. if (this.contractForm.startFileUrl) {
  842. this.isBackShow = true;
  843. }
  844. if (this.contractForm.projectPlace) {
  845. this.flageData = ['', '', this.contractForm.projectPlace]
  846. }
  847. if (Number(this.contractForm.contractAmount) < 0) {
  848. this.contractForm.contractAmount = 0;
  849. }
  850. this.$nextTick(() => {
  851. this.typeChang['1'] = false;
  852. })
  853. }).finally(() => {
  854. resolve();
  855. })
  856. })
  857. },
  858. getContractInfo2 () {
  859. return new Promise((resolve) => {
  860. getContractInfo2({ id: this.cid, contractType: this.contractType }).then((res) => {
  861. this.contractForm = res.data.data.contractInfo
  862. if (res.data.data.wbsTreeContractList.length > 0) {
  863. this.idList = []
  864. res.data.data.wbsTreeContractList.forEach(val => {
  865. if (val.contractIdRelation) {
  866. this.idList.push(val.contractIdRelation)
  867. }
  868. })
  869. }
  870. if (this.contractForm.startFileUrl) {
  871. this.isBackShow = true;
  872. }
  873. if (this.contractForm.projectPlace) {
  874. this.flageData = ['', '', this.contractForm.projectPlace]
  875. }
  876. if (Number(this.contractForm.contractAmount) < 0) {
  877. this.contractForm.contractAmount = 0;
  878. }
  879. this.$nextTick(() => {
  880. this.typeChang['1'] = false;
  881. })
  882. }).finally(() => {
  883. resolve();
  884. })
  885. })
  886. },
  887. async saveQuit () {
  888. this.btnLoad = true;
  889. try {
  890. if (this.activeType == '1') {
  891. await this.savecontract();
  892. } else if (this.activeType == '2') {
  893. await this.saveWbsTree();
  894. }
  895. } catch (error) {
  896. this.btnLoad = false;
  897. return;
  898. }
  899. this.$message({
  900. type: "success",
  901. message: "保存成功!"
  902. });
  903. this.btnLoad = false;
  904. this.$router.go(-1);
  905. },
  906. async saveNext (type) {
  907. this.btnLoad = true;
  908. try {
  909. if (this.activeType == '1') {
  910. let res = await this.savecontract();
  911. this.contractForm.id = res.data.data.id;
  912. } else if (this.activeType == '2') {
  913. await this.saveWbsTree();
  914. }
  915. } catch (error) {
  916. this.btnLoad = false;
  917. return;
  918. }
  919. this.$message({
  920. type: "success",
  921. message: "保存成功!"
  922. });
  923. this.typeChang[this.activeType] = false;
  924. let num = Number(this.activeType);
  925. if (type == 'n') {
  926. num++;
  927. } else if (type == 'p') {
  928. num--;
  929. }
  930. this.activeType = num.toString();
  931. this.btnLoad = false;
  932. },
  933. savecontract () {
  934. return new Promise((resolve, reject) => {
  935. this.$refs['contractForm'].validate((valid) => {
  936. if (valid) {
  937. if (this.flageData.length == 3) {
  938. this.contractForm.projectPlace = this.flageData[2];
  939. }
  940. let das = this.contractForm
  941. if (this.contractForm.contractType != 1) {
  942. if (this.idList.length > 0) {
  943. delete das.startStation
  944. delete das.endStation
  945. delete das.projectPlace
  946. das.idList = []
  947. this.idList.forEach(val => {
  948. das.idList.push({ contractId: val })
  949. })
  950. resolve(submitContractInfo(das))
  951. } else {
  952. this.$message({
  953. type: "error",
  954. message: "请先选择施工方合同段权限配置"
  955. })
  956. }
  957. } else {
  958. resolve(submitContractInfo(das))
  959. }
  960. } else {
  961. reject('验证失败')
  962. }
  963. })
  964. })
  965. },
  966. handleRemove (file) {
  967. //console.log(file, fileList);
  968. removeFile(file.response.data.attachId).then(() => {
  969. this.contractForm.startFileUrl = '';
  970. })
  971. },
  972. handleExceed () {
  973. this.$message.warning(`当前限制选择 1 个文件,请先移除后,再次上传`);
  974. },
  975. handleSuccess (res) {
  976. this.contractForm.startFileUrl = res.data.link;
  977. },
  978. setHeaders () {
  979. this.headers['Authorization'] = `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`;
  980. this.headers[website.tokenHeader] = 'bearer ' + getToken()
  981. },
  982. downloadFile () {
  983. window.open(this.contractForm.startFileUrl);
  984. },
  985. delFile () {
  986. this.$confirm('是否删除该文件?', '删除开工令', {
  987. distinguishCancelAndClose: true,
  988. confirmButtonText: '删除',
  989. cancelButtonText: '取消'
  990. }).then(() => {
  991. delFileFromUrl(this.contractForm.startFileUrl).then(() => {
  992. this.isBackShow = false;
  993. this.contractForm.startFileUrl = '';
  994. })
  995. })
  996. },
  997. addUserToProject () {
  998. if (!this.userId) {
  999. this.$message({
  1000. type: "warning",
  1001. message: "请先选择用户再进行添加"
  1002. });
  1003. return;
  1004. }
  1005. let roleId = ''
  1006. if (!this.postIdss) {
  1007. if (!this.postId) {
  1008. this.$message({
  1009. type: "warning",
  1010. message: "请先选择岗位再进行添加"
  1011. });
  1012. return;
  1013. } else {
  1014. roleId = this.postId
  1015. }
  1016. } else {
  1017. roleId = this.postIdss
  1018. }
  1019. let list = [{
  1020. projectId: this.pid,
  1021. contractId: this.contractForm.id,
  1022. userId: this.userId,
  1023. roleId: roleId,
  1024. }];
  1025. saveUserInfoByProjectTow(list).then(() => {
  1026. this.findAllUserByCondition(this.rId);
  1027. })
  1028. },
  1029. findAllUserByCondition (val) {
  1030. let rId
  1031. if (this.postId) {
  1032. rId = this.postId
  1033. } else {
  1034. rId = val
  1035. }
  1036. findAllUserByCondition({
  1037. cId: this.contractForm.id,
  1038. pId: this.pid,
  1039. // "postId": this.postId,
  1040. rId: rId,
  1041. },
  1042. this.pagesize,
  1043. this.pageindx,
  1044. ).then((res) => {
  1045. this.contractUserList = res.data.data.records;
  1046. this.total = res.data.data.total
  1047. })
  1048. },
  1049. handleDelete (index, row) {
  1050. this.$confirm('是否将该用户移除出合同段', '提示', {
  1051. confirmButtonText: '确定',
  1052. cancelButtonText: '取消',
  1053. type: 'warning'
  1054. }).then(() => {
  1055. removeUsersByIds(row.id).then(() => {
  1056. this.contractUserList.splice(index, 1);
  1057. this.$message({
  1058. type: "success",
  1059. message: "删除成功!"
  1060. });
  1061. })
  1062. })
  1063. },
  1064. handleDeletes () {
  1065. this.$confirm('是否将所有用户移除出合同段', '提示', {
  1066. confirmButtonText: '确定',
  1067. cancelButtonText: '取消',
  1068. type: 'warning'
  1069. }).then(() => {
  1070. let ids = [];
  1071. this.contractUserList.forEach((element) => {
  1072. ids.push(element.id);
  1073. })
  1074. removeUsersByIds(ids.join(',')).then(() => {
  1075. this.contractUserList = [];
  1076. this.$message({
  1077. type: "success",
  1078. message: "删除成功!"
  1079. });
  1080. })
  1081. })
  1082. },
  1083. copyAccPas (row) {
  1084. this.copyText = `姓名:${row.name}
  1085. 账号:${row.account}
  1086. 密码:${row.password}`;
  1087. this.$nextTick(() => {
  1088. this.$refs.copyInput.select()
  1089. document.execCommand('copy')
  1090. this.$message({
  1091. type: "success",
  1092. message: "成功复制在剪贴板!"
  1093. });
  1094. })
  1095. },
  1096. resetPassword (row) {
  1097. this.$confirm('是否将用户【' + row.name + '】密码重置为123456', '提示', {
  1098. confirmButtonText: '确定',
  1099. cancelButtonText: '取消',
  1100. type: 'warning'
  1101. }).then(() => {
  1102. resetPasswordByUserId(row.uid).then(() => {
  1103. row.password = '123456';
  1104. this.$message({
  1105. type: "success",
  1106. message: "重置成功!"
  1107. });
  1108. })
  1109. })
  1110. },
  1111. getContractTypeList () {
  1112. if (this.contractTypeList.length > 1) {
  1113. return;
  1114. }
  1115. getDictionary({
  1116. code: 'contract_type'
  1117. }).then((res) => {
  1118. res.data.data.forEach(element => {
  1119. element.dictKey = Number(element.dictKey)
  1120. });
  1121. this.contractTypeList = res.data.data;
  1122. })
  1123. },
  1124. getUserByName () {
  1125. findUserByName('').then((res) => {
  1126. this.userList = res.data.data;
  1127. })
  1128. },
  1129. getLeftTree () {
  1130. return new Promise((resolve) => {
  1131. if (!this.leftTreeData.length) {
  1132. findProjectTree(this.projectInfo.id, this.wbsId).then((res) => {
  1133. if (Array.isArray(res.data.data)) {
  1134. this.leftTreeData = res.data.data;
  1135. } else {
  1136. this.leftTreeData = [];
  1137. }
  1138. resolve();
  1139. }).finally(() => {
  1140. resolve();
  1141. })
  1142. }
  1143. resolve();
  1144. })
  1145. },
  1146. getRightTree () {
  1147. console.log(this.wbsId, this.projectInfo.id, this.contractForm.id);
  1148. getContractInfoTree(this.wbsId, this.projectInfo.id, this.contractForm.id).then((res) => {
  1149. if (Array.isArray(res.data.data)) {
  1150. this.$refs.treetotree.setRightTree(res.data.data);
  1151. }
  1152. })
  1153. },
  1154. saveWbsTree () {
  1155. let obj = {};
  1156. let ids = this.$refs.treetotree.getTreeAllId('rightTree');
  1157. obj = {
  1158. wbsId: this.wbsId,
  1159. projectId: this.projectInfo.id,
  1160. contractId: this.contractForm.id,
  1161. wbsTreeIds: ids
  1162. }
  1163. return submitWbsTreeInContract(obj);
  1164. },
  1165. treeChang () {
  1166. this.typeChang[2] = true;
  1167. },
  1168. mapChange () {
  1169. this.$refs['contractForm'].validateField('projectPlace');
  1170. },
  1171. getStoragePeriodList () {
  1172. if (this.storagePeriodList.length > 1) {
  1173. return;
  1174. }
  1175. getDictbiz({
  1176. code: 'storage_period'
  1177. }).then((res) => {
  1178. res.data.data.forEach(element => {
  1179. element.dictKey = Number(element.dictKey)
  1180. });
  1181. this.storagePeriodList = res.data.data;
  1182. })
  1183. },
  1184. getSecurityLevelList () {
  1185. if (this.securityLevelList.length > 1) {
  1186. return;
  1187. }
  1188. getDictbiz({
  1189. code: 'security_level'
  1190. }).then((res) => {
  1191. res.data.data.forEach(element => {
  1192. element.dictKey = Number(element.dictKey)
  1193. });
  1194. this.securityLevelList = res.data.data;
  1195. })
  1196. },
  1197. //#endregion
  1198. //#region 合同段信息
  1199. async treeAllConstruction () {
  1200. const { data: res } = await treeAllConstruction({ projectId: this.$route.query.pid })
  1201. console.log(res);
  1202. if (res.code == 200) {
  1203. this.checkList = res.data
  1204. }
  1205. },
  1206. //#endregion
  1207. }
  1208. };
  1209. </script>
  1210. <style scoped lang="scss">
  1211. .bm-view {
  1212. width: 100%;
  1213. height: 300px;
  1214. }
  1215. .head-font {
  1216. font-size: 20px;
  1217. font-weight: bold;
  1218. }
  1219. </style>