detailsPage.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. <template>
  2. <div class="borderless">
  3. <div class="main-head">
  4. <div class="main-back">
  5. <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
  6. @click="backToList">返回列表
  7. </el-button>
  8. <el-button type="success"
  9. class="el-button--small-yh add-customer-btn-two"
  10. :disabled="true"
  11. @click.stop="addMainProject">复制新单
  12. </el-button>
  13. <el-button class="el-button--small-yh add-customer-btn" type="primary"
  14. @click.stop="editMainProject"
  15. >{{this.id?"确认修改" :"确认新增"}}
  16. </el-button>
  17. </div>
  18. </div>
  19. <div style="margin-top: 60px">
  20. <containerTitle title="基础信息"></containerTitle>
  21. <basic-container>
  22. <el-form :model="form" ref="form" label-width="100px" class="demo-ruleForm">
  23. <el-row>
  24. <el-col v-for="(item, index) in basicData.column" :span="item.span?item.span:6" :key="index">
  25. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  26. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="datetime" :disabled="item.disabled?true:false" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
  27. <el-date-picker v-else-if="item.type === 'date'" style="width: 100%;" v-model="form[item.prop]" size="small" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"/>
  28. <el-select v-else-if="item.prop === 'paymentType'" style="width: 100%" v-model="form[item.prop]" size="small" placeholder="请选择" clearable filterable>
  29. <el-option v-for="(item,index) in paymentTerm" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
  30. </el-select>
  31. <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :configuration="configuration"/>
  32. <el-input type="textarea" v-else-if="(item.prop === 'remark')" v-model="form[item.prop]" size="small" autocomplete="off" placeholder="请输入"></el-input>
  33. <el-input type="age" v-else-if="item.type === 'unit'" v-model="form[item.prop]" @change="debitChange" :disabled="item.disabled?true:false" size="small" autocomplete="off" placeholder="请输入">
  34. <template slot="append">元</template>
  35. </el-input>
  36. <el-input type="age" v-else v-model="form[item.prop]" :disabled="item.disabled?true:false" size="small" value="0" autocomplete="off" placeholder="请输入">
  37. <template v-if="item.prop === 'advanceAmount'||item.prop === 'settlmentAmount'||item.prop === 'balanceAmount'" slot="append">元</template>
  38. </el-input>
  39. </el-form-item>
  40. </el-col>
  41. </el-row>
  42. </el-form>
  43. </basic-container>
  44. <containerTitle title="明细列表"></containerTitle>
  45. <basic-container>
  46. <avue-crud
  47. ref="crud"
  48. :data="data"
  49. :option="optionTable"
  50. :page.sync="page"
  51. :table-loading="loading"
  52. v-model="optionFrom"
  53. @row-del="rowDel"
  54. @row-save="rowSave"
  55. @row-update="rowUpdate"
  56. @size-change="sizeChange"
  57. @current-change="currentChange"
  58. @selection-change="selectionChange"
  59. @search-change="searchChange"
  60. @saveColumn="saveColumn"
  61. >
  62. <template slot-scope="scope" slot="menuLeft">
  63. <el-button type="primary"
  64. size="small"
  65. icon="el-icon-plus"
  66. @click="serviceDialog = true">录入明细
  67. </el-button>
  68. <el-button type="info"
  69. size="small"
  70. :disabled="crudSelection == 0"
  71. @click.stop="beforePleaseCheck()">请 核
  72. </el-button>
  73. </template>
  74. <template slot="menuRight">
  75. <el-button
  76. size="small"
  77. type="info"
  78. @click.stop="openReport()"
  79. >导出报表
  80. </el-button>
  81. </template>
  82. <template slot-scope="{row,index}" slot="menu">
  83. <el-button
  84. type="text"
  85. size="small"
  86. @click="rowCellTwo(row,index)"
  87. :disabled="row.strStatus !== '录入'"
  88. >{{row.$cellEdit?'修改完成':'修改'}}</el-button>
  89. </template>
  90. <template slot="userid" slot-scope="{row,index}">
  91. <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
  92. <span style="margin-left: 12px;padding-top: 2px">{{ row.userName }}</span>
  93. <el-button v-if="row.$cellEdit" type="text" size="mini" style="float: right" @click="selectUser(row)">选择</el-button>
  94. </template>
  95. <template slot="amount" slot-scope="{ row }">
  96. <el-input
  97. v-if="row.$cellEdit"
  98. v-model="row.amount"
  99. placeholder="请输入"
  100. size="small"
  101. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  102. @change="totalChange(row,'金额')"
  103. ></el-input>
  104. <span v-else>{{ row.amount }}</span>
  105. </template>
  106. <template slot="serviceCharge" slot-scope="{ row }">
  107. <el-input
  108. v-if="row.$cellEdit"
  109. v-model="row.serviceCharge"
  110. placeholder="请输入"
  111. size="small"
  112. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  113. @change="totalChange(row,'服务')"
  114. ></el-input>
  115. <span v-else>{{ row.serviceCharge }}</span>
  116. </template>
  117. <template slot="matMoney" slot-scope="{ row }">
  118. <el-input
  119. v-if="row.$cellEdit"
  120. v-model="row.matMoney"
  121. placeholder="请输入"
  122. size="small"
  123. oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
  124. @change="totalChange(row,'代垫')"
  125. ></el-input>
  126. <span v-else>{{ row.matMoney }}</span>
  127. </template>
  128. </avue-crud>
  129. </basic-container>
  130. <containerTitle title="附件上传"></containerTitle>
  131. <basic-container style="margin-bottom: 40px">
  132. <avue-crud
  133. :option="upLoadOption"
  134. v-model="upLoadForm"
  135. :data="upLoadData"
  136. @row-save="upLoadSave"
  137. @row-update="upLoadUpdate"
  138. @row-del="upLoadDel"
  139. ></avue-crud>
  140. </basic-container>
  141. </div>
  142. <el-dialog
  143. title="导入服务项目"
  144. append-to-body
  145. class="el-dialogDeep"
  146. :visible.sync="serviceDialog"
  147. width="70%"
  148. :close-on-click-modal="false"
  149. :destroy-on-close="true"
  150. :close-on-press-escape="false">
  151. <el-row style="height: 0;">
  152. <el-col :span="5" >
  153. <div>
  154. <el-scrollbar>
  155. <basic-container>
  156. <avue-tree :option="serviceTreeOption" @node-click="serviceNodeClick"/>
  157. </basic-container>
  158. </el-scrollbar>
  159. </div>
  160. </el-col>
  161. <el-col :span="19">
  162. <basic-container>
  163. <avue-crud ref="serviceCrud"
  164. :page.sync="servicePage"
  165. :search.sync="serviceSearch"
  166. :option="serviceOption"
  167. :table-loading="serviceLoading"
  168. :data="serviceData"
  169. @refresh-change="serviceRefreshChange"
  170. @selection-change="serviceSelectionChange"
  171. @search-change="serviceSearchChange"
  172. @on-load="serviceOnLoad">
  173. </avue-crud>
  174. </basic-container>
  175. </el-col>
  176. </el-row>
  177. <span slot="footer" class="dialog-footer">
  178. <el-button type="primary" @click="serviceConfirm()" :disabled="this.serviceSelectList.length == 0">导 入</el-button>
  179. <el-button @click="serviceDialog = false">取 消</el-button>
  180. </span>
  181. </el-dialog>
  182. <el-dialog
  183. title="导入用户"
  184. :visible.sync="userDialog"
  185. class="el-dialogDeep"
  186. append-to-body
  187. width="80%">
  188. <el-row style="margin-top: -5px;height: 0">
  189. <el-col :span="5">
  190. <div class="box">
  191. <el-scrollbar>
  192. <basic-container>
  193. <avue-tree :option="userTreeOption" :data="userTreeData" @node-click="userNodeClick"/>
  194. </basic-container>
  195. </el-scrollbar>
  196. </div>
  197. </el-col>
  198. <el-col :span="19">
  199. <basic-container>
  200. <avue-crud ref="userCrud"
  201. :option="userOption"
  202. :data="userDataList"
  203. :table-loading="userLoading"
  204. :page.sync="userPage"
  205. v-model="userForm"
  206. @search-change="userSearchChange"
  207. @search-reset="userSearchReset"
  208. @refresh-change="userRefreshChange"
  209. @selection-change="userSelectionChange"
  210. @on-load="userOnLoad"
  211. >
  212. </avue-crud>
  213. </basic-container>
  214. </el-col>
  215. </el-row>
  216. <span slot="footer" class="dialog-footer">
  217. <el-button @click="userDialog = false">取 消</el-button>
  218. <el-button type="primary" :disabled="this.userSelection.length == 1 ? false:true" @click="userConfirm" >确 定</el-button>
  219. </span>
  220. </el-dialog>
  221. <el-dialog
  222. title="流程"
  223. append-to-body
  224. class="el-dialogDeep"
  225. :visible.sync="processDialog"
  226. width="60%"
  227. :close-on-click-modal="false"
  228. :destroy-on-close="true"
  229. :modal-append-to-body='false'
  230. :close-on-press-escape="false"
  231. v-dialog-drag
  232. >
  233. <examine-approve
  234. :itemId ="itemId"
  235. :closeFun="dialogProcessClose"
  236. >
  237. </examine-approve>
  238. </el-dialog>
  239. </div>
  240. </template>
  241. <script>
  242. import option from "./configuration/detailsPage.json";
  243. import startOption from "./configuration/startDialog.json";
  244. import { projectDetail,editMianProject,updateItemStatus,getSysNo } from "@/api/workManagement/mainProject";
  245. //上传文件json
  246. import upLoadOption from "../../exportTrade/purchaseContract/config/uploadList.json"
  247. //服务列表接口
  248. import {getServiceProjectList,getServiceTypeTree,} from "@/api/workManagement/serviceProject";
  249. import serviceOption from "./configuration/serviceDialogList.json";
  250. //业务字典
  251. import { getDictionary } from "@/api/system/dictbiz";
  252. // 当前登录人
  253. import { getUserInfo } from "@/api/system/user";
  254. //用户组件
  255. import userOption from "./configuration/userList.json";
  256. import { getList } from "@/api/system/user";
  257. import { getDeptLazyTree} from "@/api/system/dept";
  258. //上传附件删除
  259. import { corpsbank } from "@/api/basicData/configuration"
  260. //事务
  261. import examineApprove from "@/components/examineApprove/index";
  262. //对象数组比较
  263. import { contrastObj,contrastList } from "@/util/contrastData";
  264. import _ from "lodash";
  265. export default {
  266. data() {
  267. return {
  268. id:'',
  269. loading: false,
  270. form:{},
  271. optionFrom:{},
  272. data: [],
  273. crudSelection:[],
  274. deptDicData:[],//任务部门数据
  275. serviceDialog:false,//服务导入窗口
  276. userDialog:false,//用户导入窗口
  277. //客户组件配置控制
  278. configuration:{
  279. multipleChoices:false,
  280. multiple:false,
  281. disabled:false,
  282. searchShow:true,
  283. collapseTags:false,
  284. placeholder:'请点击右边按钮选择',
  285. dicData:[]
  286. },
  287. page: {
  288. currentPage: 1,
  289. total: 0,
  290. pageSize: 10
  291. },
  292. detailsSelect: {},
  293. paymentTerm:[],
  294. //顶部from数据
  295. basicData: {
  296. column: [
  297. {
  298. label: '系统编号',
  299. prop: 'sysNo',
  300. disabled: true,
  301. rules: [
  302. {
  303. required: true,
  304. message: ' ',
  305. trigger: 'blur'
  306. }
  307. ]
  308. }, {
  309. label: '项目编码',
  310. prop: 'code',
  311. rules: [
  312. {
  313. required: true,
  314. message: ' ',
  315. trigger: 'blur'
  316. }
  317. ]
  318. }, {
  319. label: '项目名称',
  320. prop: 'cname',
  321. rules: [
  322. {
  323. required: true,
  324. message: ' ',
  325. trigger: 'blur'
  326. }
  327. ]
  328. }, {
  329. label: '客户名称',
  330. prop: 'corpId',
  331. },{
  332. label: '合同金额',
  333. prop: 'debitAmount',
  334. type:'unit',
  335. rules: [
  336. {
  337. required: true,
  338. message: ' ',
  339. trigger: 'blur'
  340. },
  341. {
  342. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  343. message: ' ',
  344. trigger: 'blur'
  345. },
  346. ]
  347. },
  348. {
  349. label: '首付金额',
  350. prop: 'advanceAmount',
  351. type:'unit',
  352. rules: [
  353. {
  354. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  355. message: ' ',
  356. trigger: 'blur'
  357. }
  358. ]
  359. },
  360. {
  361. label: '已收金额',
  362. prop: 'settlmentAmount',
  363. disabled: true,
  364. type:'unit',
  365. rules: [
  366. {
  367. pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  368. message: ' ',
  369. trigger: 'blur'
  370. }
  371. ]
  372. },
  373. {
  374. label: '未收金额',
  375. type:'unit',
  376. prop: 'balanceAmount',
  377. disabled: true,
  378. rules: [
  379. {
  380. pattern:/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  381. message: ' ',
  382. trigger: 'blur'
  383. }
  384. ]
  385. },
  386. {
  387. label: '总服务费',
  388. prop: 'serviceCharge',
  389. type:'unit',
  390. disabled: true,
  391. rules: [
  392. {
  393. pattern:/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  394. message: ' ',
  395. trigger: 'blur'
  396. }
  397. ]
  398. },
  399. {
  400. label: '总代垫费',
  401. prop: 'matMoney',
  402. type:'unit',
  403. disabled: true,
  404. rules: [
  405. {
  406. pattern:/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  407. message: ' ',
  408. trigger: 'blur'
  409. }
  410. ]
  411. },
  412. {
  413. label: '责任人',
  414. prop: 'corpAttn',
  415. }, {
  416. label: '承揽人',
  417. prop: 'salesName',
  418. },
  419. {
  420. label: '制单人',
  421. prop: 'createUserName',
  422. disabled: true
  423. }, {
  424. label: '制单日期',
  425. prop: 'createTime',
  426. type: 'datetime',
  427. valueFormat:"yyyy-MM-dd HH:mm:ss",
  428. format:"yyyy-MM-dd",
  429. disabled: true
  430. },
  431. {
  432. label: '电话',
  433. prop: 'corpTel',
  434. },
  435. {
  436. label: '收款方式',
  437. prop: 'paymentType',
  438. type:'select',
  439. dataType: "number",
  440. width: 120,
  441. dicUrl: "/api/blade-system/dict-biz/dictionary?code=affair_payment_term",
  442. props: {
  443. label: "dictValue",
  444. value: "dictKey"
  445. },
  446. },
  447. {
  448. label: '开始日期',
  449. prop: 'beginTime',
  450. valueFormat:"yyyy-MM-dd HH:mm:ss",
  451. format:"yyyy-MM-dd",
  452. type:'datetime',
  453. },
  454. {
  455. label: '结束日期',
  456. prop: 'endTime',
  457. valueFormat:"yyyy-MM-dd HH:mm:ss",
  458. format:"yyyy-MM-dd",
  459. type:'datetime',
  460. },
  461. {
  462. label: '备注',
  463. span: 24,
  464. prop: 'remark'
  465. }
  466. ],
  467. },
  468. optionTable: option,
  469. //上传文件
  470. upLoadOption: upLoadOption,
  471. upLoadData:[],
  472. upLoadForm:{},
  473. //服务窗口定义
  474. serviceTreeOption: {
  475. nodeKey: 'id',
  476. lazy: true,
  477. treeLoad: function(node, resolve) {
  478. const parentId = node.level === 0 ? 0 : node.data.id;
  479. getServiceTypeTree(parentId).then(res => {
  480. resolve(
  481. res.data.data.map(item => {
  482. return {
  483. ...item,
  484. leaf: !item.hasChildren
  485. };
  486. })
  487. );
  488. });
  489. },
  490. addBtn: false,
  491. menu: false,
  492. size: 'small',
  493. props: {
  494. labelText: '标题',
  495. label: 'title',
  496. value: 'value',
  497. children: 'children'
  498. }
  499. },
  500. serviceOption:serviceOption,
  501. serviceLoading:false,
  502. serviceData:[],
  503. servicePage:{
  504. currentPage: 1,
  505. total: 0,
  506. pageSize: 10
  507. },
  508. serviceSearch:{},
  509. serviceTreeDeptId:"",
  510. serviceSelectList:[],
  511. //用户窗口定义
  512. userTreeOption: {
  513. nodeKey: 'id',
  514. lazy: true,
  515. treeLoad: function (node, resolve) {
  516. const parentId = (node.level === 0) ? 0 : node.data.id;
  517. getDeptLazyTree(parentId).then(res => {
  518. resolve(res.data.data.map(item => {
  519. return {
  520. ...item,
  521. leaf: !item.hasChildren
  522. }
  523. }))
  524. });
  525. },
  526. addBtn: false,
  527. menu: false,
  528. size: 'small',
  529. props: {
  530. labelText: '标题',
  531. label: 'title',
  532. value: 'value',
  533. children: 'children'
  534. }
  535. },
  536. userTreeData:[],
  537. userOption:userOption,
  538. userLoading:false,
  539. userDataList:[],
  540. userSelection:[],
  541. userTreeDeptId:"",
  542. userForm:{},
  543. userPage:{
  544. currentPage: 1,
  545. total: 0,
  546. pageSize: 10
  547. },
  548. itemId:'',
  549. //请核窗口定义
  550. processDialog:false,
  551. pleaseCheckContact:startOption,
  552. pleaseCheckLoading:false,
  553. pleaseCheckData:[],
  554. pleaseCheckPage:{
  555. pageSize: 10,
  556. currentPage: 1,
  557. total: 0
  558. },
  559. //新旧数据比较
  560. oldData:[],
  561. oldUpLoadData:[],
  562. oldForm:{}
  563. };
  564. },
  565. created() {
  566. // 表格行编辑 输入框change事件
  567. //单价
  568. this.optionTable.column[5].change = function (val) {
  569. val.row.amount = val.row.quantity*val.value;
  570. }
  571. //数量
  572. this.optionTable.column[7].change = function (val) {
  573. val.row.amount = val.row.price*val.value;
  574. }
  575. this.$set(this.form,"debitAmount",0)
  576. this.$set(this.form,"advanceAmount",0)
  577. this.$set(this.form,"settlmentAmount",0)
  578. this.$set(this.form,"balanceAmount",0)
  579. this.id = BigInt(this.$route.query.id);//字符串转数字 超长用BigInt
  580. this.getProjectDetail();
  581. const params = {
  582. code : "affair_payment_term"
  583. }
  584. getDictionary(params).then(res =>{
  585. this.paymentTerm = res.data.data;
  586. })
  587. },
  588. components:{
  589. examineApprove
  590. },
  591. mounted() {
  592. },
  593. methods: {
  594. //合计
  595. totalChange(row,type){
  596. let amountList = this.data.map(item => {
  597. if(item.amount){
  598. return parseFloat(item.amount);
  599. }else return 0
  600. });
  601. let serviceChargeList = this.data.map(item => {
  602. if(item.serviceCharge){
  603. return parseFloat(item.serviceCharge);
  604. }else return 0
  605. });
  606. let matMoneyList = this.data.map(item => {
  607. if(item.matMoney){
  608. return parseFloat(item.matMoney);
  609. }else return 0
  610. });
  611. if(type==='金额'){
  612. if(this.form.debitAmount){
  613. if(this.form.debitAmount < amountList.reduce((n,m) => n + m)){
  614. this.$message.error("明细列表合同金额不能大于总金额!")
  615. }
  616. }
  617. }
  618. if(type==='服务'){
  619. this.form.serviceCharge = serviceChargeList.reduce((n,m) => n + m)
  620. }
  621. if(type==='代垫'){
  622. this.form.matMoney = matMoneyList.reduce((n,m) => n + m)
  623. }
  624. if(row.serviceCharge && row.matMoney){
  625. if(row.amount < _.add(parseFloat(row.serviceCharge),parseFloat(row.matMoney))){
  626. this.$message.error("服务费代垫费不能超过合同金额!")
  627. row.serviceCharge = 0;
  628. row.matMoney = 0;
  629. }
  630. }
  631. },
  632. //查询明细
  633. getProjectDetail(pleaseCheck){
  634. if(this.id){
  635. projectDetail(this.id,"0,1,2,3,4,5").then(res =>{
  636. this.form = res.data.data;
  637. this.oldForm = Object.assign({},res.data.data);
  638. if(res.data.data.corpName){
  639. this.configuration.dicData = res.data.data.corpName; //给客户名称赋值
  640. }
  641. if(res.data.data.filesList){
  642. this.upLoadData = res.data.data.filesList
  643. this.oldUpLoadData = this.deepClone(res.data.data.filesList)
  644. }
  645. if(res.data.data.itemList){
  646. this.operationDetailList(res.data.data.itemList);
  647. }else{
  648. this.data = [];
  649. }
  650. })
  651. }else{
  652. getSysNo().then(res =>{
  653. this.$set(this.form,"sysNo", res.data.data)
  654. let date = new Date();
  655. let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  656. this.$set(this.form,"createTime",strDate)
  657. });
  658. getUserInfo().then(res =>{
  659. this.$set(this.form,"createUserName", res.data.data.name)
  660. })
  661. }
  662. },
  663. operationDetailList(itemList){
  664. this.data = itemList;
  665. this.oldData = this.deepClone(itemList)
  666. let status = [];
  667. this.data.forEach(item =>{
  668. item.status == 0 ? status.push(true) : status.push(false)
  669. })
  670. //如果 明细列表存在 请核之后的状态 禁止编辑一些输入框
  671. if(status.findIndex(item => item == false) == 0){
  672. this.basicData.column.forEach(item =>{
  673. if(item.prop == "code" || item.prop == "cname" || item.prop == "corpId" || item.prop == "debitAmount"){
  674. item.disabled = true
  675. this.configuration.disabled = true
  676. }
  677. })
  678. }
  679. },
  680. //删除列表后面的删除按钮触发触发(row, index, done)
  681. rowDel(row, index, done) {
  682. this.$confirm("确定将此明细删除?", {
  683. confirmButtonText: "确定",
  684. cancelButtonText: "取消",
  685. type: "warning"
  686. }).then(() => {
  687. this.data.splice(index,0)
  688. // 数据回调进行刷新
  689. done(row);
  690. });
  691. },
  692. // 合同金额
  693. debitChange(val){
  694. if(val){
  695. if(!this.form.settlmentAmount){
  696. this.$set(this.form,"balanceAmount",val)
  697. }
  698. }
  699. // if(this.form.debitAmount){
  700. // if(this.form.serviceCharge && parseFloat(this.form.serviceCharge) > parseFloat(this.form.debitAmount)){
  701. // this.$message.warning('服务费不得大于合同金额!')
  702. // this.$set(this.form,"serviceCharge","");
  703. // return
  704. // }
  705. // if(this.form.matMoney && parseFloat(this.form.matMoney) > parseFloat(this.form.debitAmount)){
  706. // this.$message.warning('代垫费费不得大于合同金额!')
  707. // this.$set(this.form,"matMoney","");
  708. // return
  709. // }
  710. // if(this.form.serviceCharge && this.form.matMoney){
  711. // if(_.add(parseFloat(this.form.serviceCharge),parseFloat(this.form.matMoney))> parseFloat(this.form.debitAmount)){
  712. // this.$message.warning('服务费代垫费总和不得大于合同金额!')
  713. // this.$set(this.form,"serviceCharge","");
  714. // this.$set(this.form,"matMoney","");
  715. // }
  716. // }
  717. // }
  718. },
  719. //新单
  720. addMainProject(){
  721. this.$confirm("需先将此单据保存", {
  722. confirmButtonText: "确定",
  723. cancelButtonText: "取消",
  724. type: "warning"
  725. }).then(()=>{
  726. this.editMainProject(10010);
  727. })
  728. },
  729. openPleaseCheckDialog(){
  730. this.processDialog = true;
  731. this.itemId = this.crudSelection[0].id //记得不能写死
  732. },
  733. //请核之前
  734. beforePleaseCheck(){
  735. if(this.crudSelection){
  736. let id = [];
  737. let result = [];
  738. this.crudSelection.forEach(item=>{
  739. // 新录入状态下 才可提交审核
  740. item.id ? id.push(true) : id.push(false) //如果没有id并且为新录入 提示保存
  741. item.strStatus === "录入" ? result.push(true) : result.push(false) //判断所有的是否为录入状态
  742. })
  743. if(id.findIndex(item => item != true) == -1){
  744. if(result.findIndex(item => item != true) == -1){
  745. if(contrastObj(this.form,this.oldForm) || contrastList(this.data,this.oldData)){ //判断是否改动过此页面
  746. this.$confirm("您已改动此页面,请先保存之后在请核?", "提示", {
  747. confirmButtonText: "保存",
  748. cancelButtonText: "取消",
  749. type: "warning",
  750. }).then(() => {
  751. this.editMainProject();
  752. }).catch(()=>{
  753. return
  754. })
  755. }else{
  756. this.pleaseCheck()
  757. // this.openPleaseCheckDialog();
  758. }
  759. }else{
  760. this.$message({
  761. type: "error",
  762. message: "请核数据中存在已请核数据!"
  763. });
  764. return
  765. }
  766. }else{
  767. this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
  768. confirmButtonText: "确定",
  769. cancelButtonText: "取消",
  770. type: "warning"
  771. }).then(() => {
  772. this.editMainProject();
  773. })
  774. }
  775. }
  776. },
  777. //新增 修改
  778. editMainProject(pleaseCheck){
  779. this.$refs["form"].validate((valid) => {
  780. //校验明细列表
  781. let valids = true;
  782. if(this.data.length !=0){
  783. this.data.forEach((item) =>{
  784. if((item.userid =="" || !item.deptid || !item.amount) && valids){
  785. this.$message({
  786. type: "warning",
  787. message: "请检查明细列表第 "+(item.$index +1 )+" 行必填项"
  788. });
  789. valids = false;
  790. }
  791. })
  792. }
  793. if(valid && valids){
  794. const params = {
  795. ...this.form,
  796. itemList:this.data,
  797. filesList:this.upLoadData
  798. }
  799. editMianProject(params).then(res =>{
  800. this.id = res.data.data
  801. if(pleaseCheck === 10010){ //复制新单新单
  802. this.$router.push({
  803. path: "/mainItems_detailsPage",
  804. query: {id: ''},
  805. });
  806. //清空关键信息
  807. this.form = {}
  808. this.data = []
  809. this.upLoadData = []
  810. this.id = ''
  811. }else if(pleaseCheck === 10001){ //返回列表保存数据
  812. this.$message({
  813. type: "success",
  814. message: "操作成功!"
  815. });
  816. this.$router.$avueRouter.closeTag();
  817. this.$router.push({
  818. path: '/workManagement/main-items/list',
  819. query: {}
  820. });
  821. }else{
  822. this.$message({
  823. type: "success",
  824. message: "操作成功!"
  825. });
  826. this.getProjectDetail()
  827. }
  828. })
  829. }
  830. })
  831. },
  832. //请核
  833. pleaseCheck(){
  834. this.crudSelection.forEach(item =>{
  835. updateItemStatus(this.data[item.$index].id,1).then(res =>{
  836. if(res.data.success){
  837. }
  838. })
  839. this.$message({
  840. type: "success",
  841. message: "请核成功!"
  842. });
  843. //刷新列表
  844. this.getProjectDetail();
  845. })
  846. },
  847. //返回主营项目列表
  848. backToList(){
  849. if(contrastObj(this.form,this.oldForm) || contrastList(this.data,this.oldData)
  850. || contrastList(this.upLoadData,this.oldUpLoadData)
  851. ){
  852. this.$confirm("是否保存当前页面?", "提示", {
  853. confirmButtonText: "保存",
  854. cancelButtonText: "取消",
  855. type: "warning",
  856. }).then(() => {
  857. this.editMainProject(10001)
  858. }).catch(()=>{
  859. this.$router.$avueRouter.closeTag();
  860. this.$router.push({
  861. path: '/workManagement/main-items/list',
  862. query: {}
  863. });
  864. })
  865. }else{
  866. this.$router.$avueRouter.closeTag();
  867. this.$router.push({
  868. path: '/workManagement/main-items/list',
  869. query: {}
  870. });
  871. }
  872. },
  873. //点击修改或保存时触发
  874. rowCellTwo(row,index){
  875. this.$refs.crud.rowCell(row, index);
  876. },
  877. //选择时
  878. selectionChange(row){
  879. this.crudSelection = row;
  880. },
  881. //新增修改时保存触发
  882. rowSave(row, done, loading) {
  883. done()
  884. },
  885. rowUpdate(row, index, done, loading) {
  886. done(row)
  887. },
  888. searchChange(params, done) {
  889. this.getList(this.page, params);
  890. done();
  891. },
  892. sizeChange(val) {
  893. this.page.pageSize = val;
  894. this.getList();
  895. },
  896. currentChange(val) {
  897. this.page.currentPage = val;
  898. this.getList();
  899. },
  900. saveColumn(row, column) {
  901. console.log(row, column);
  902. },
  903. //上传文件保存
  904. upLoadSave(row, done, loading){
  905. this.upLoadData.push(row)
  906. done()
  907. },
  908. //修改附件上传触发
  909. upLoadUpdate(row, done){
  910. done(row);
  911. },
  912. //删除附件上传触发
  913. upLoadDel(row, index,){
  914. this.$confirm("确定将选择数据删除?", {
  915. confirmButtonText: "确定",
  916. cancelButtonText: "取消",
  917. type: "warning"
  918. }).then(() => {
  919. if (row.id){
  920. corpsbank(row.id).then(res=>{
  921. if(res.data.success){
  922. this.$message({
  923. type: "success",
  924. message: "操作成功!"
  925. });
  926. this.bankOfDepositData.splice(index, 1);
  927. }
  928. })
  929. }else {
  930. this.$message({
  931. type: "success",
  932. message: "操作成功!"
  933. });
  934. this.bankOfDepositData.splice(index, 1);
  935. }
  936. })
  937. },
  938. //服务窗口事件
  939. serviceNodeClick(data) {
  940. this.serviceTreeDeptId = data.id;
  941. this.serviceOnLoad(this.servicePage);
  942. },
  943. serviceRefreshChange(){
  944. this.serviceOnLoad(this.servicePage, this.serviceSearch)
  945. },
  946. serviceSearchChange(params, done){
  947. this.serviceOnLoad(this.servicePage, params)
  948. done();
  949. },
  950. serviceSelectionChange(row){
  951. this.serviceSelectList = row;
  952. },
  953. serviceOnLoad(page, params = {}) {
  954. this.serviceLoading = true;
  955. getServiceProjectList(page.currentPage, page.pageSize, params, this.serviceTreeDeptId).then(res => {
  956. this.serviceData = res.data.data.records
  957. this.servicePage.total = res.data.data.total
  958. this.serviceLoading = false
  959. })
  960. },
  961. serviceConfirm(){
  962. if(this.serviceSelectList.length != 0){
  963. this.serviceSelectList.forEach((item)=>{
  964. const params = {
  965. strStatus:"录入",
  966. pname:item.cname,
  967. remarks:item.remarks,
  968. price:item.price,
  969. unit:item.unit,
  970. frequency:item.rate,
  971. }
  972. this.$refs.crud.rowCellAdd(params);
  973. this.$refs.crud.rowCell(item, this.optionFrom.length-1)
  974. })
  975. }
  976. this.serviceSelectList = []
  977. this.serviceDialog = false
  978. this.$message({
  979. type: "success",
  980. message: "导入成功!"
  981. });
  982. },
  983. //用户窗口事件
  984. selectUser(row){
  985. this.userDialog = true
  986. this.detailsSelect = row.$index;
  987. },
  988. userSearchChange(params, done){
  989. this.userOnLoad(this.userPage, params);
  990. done()
  991. },
  992. userSearchReset(){
  993. },
  994. userRefreshChange(){
  995. this.userOnLoad(this.userPage)
  996. },
  997. userSelectionChange(row){
  998. this.userSelection = row;
  999. },
  1000. userOnLoad(page,params={}){
  1001. this.userLoading = true;
  1002. getList(page.currentPage, page.pageSize, params, this.userTreeDeptId).then(res => {
  1003. this.userDataList = res.data.data.records
  1004. this.userPage.total = res.data.data.total
  1005. this.userLoading = false;
  1006. });
  1007. },
  1008. userNodeClick(data){
  1009. this.userTreeDeptId = data.id;
  1010. this.userOnLoad(this.userPage);
  1011. },
  1012. //确定
  1013. userConfirm(){
  1014. if(this.userSelection){
  1015. this.data[this.detailsSelect].userid = this.userSelection[0].id;
  1016. this.$set(this.data[this.detailsSelect],'userName',this.userSelection[0].realName)
  1017. this.userDialog = !this.userDialog
  1018. }
  1019. },
  1020. dialogProcessClose(){
  1021. this.processDialog = false
  1022. this.getProjectDetail()
  1023. },
  1024. },
  1025. };
  1026. </script>
  1027. <style scoped lang="scss">
  1028. .main-head {
  1029. position: fixed;
  1030. top: 105px;
  1031. width: 100%;
  1032. margin-left: -10px;
  1033. height: 62px;
  1034. background: #ffffff;
  1035. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1036. z-index: 999;
  1037. }
  1038. .main-back {
  1039. cursor: pointer;
  1040. line-height: 62px;
  1041. font-size: 16px;
  1042. color: #323233;
  1043. font-weight: 400;
  1044. }
  1045. .avue-tree {
  1046. overflow: hidden;
  1047. max-height: 660px;
  1048. }
  1049. .add-customer-btn-two {
  1050. position: fixed;
  1051. right: 150px;
  1052. top: 115px;
  1053. }
  1054. .add-customer-btn {
  1055. position: fixed;
  1056. right: 36px;
  1057. top: 115px;
  1058. }
  1059. ::v-deep .el-form-item {
  1060. margin-bottom: 0;
  1061. }
  1062. </style>