detailsPage.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  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. this.configuration.dicData = res.data.data.corpName; //给客户名称赋值
  639. if(res.data.data.filesList){
  640. this.upLoadData = res.data.data.filesList
  641. this.oldUpLoadData = this.deepClone(res.data.data.filesList)
  642. }
  643. if(res.data.data.itemList){
  644. this.operationDetailList(res.data.data.itemList);
  645. }else{
  646. this.data = [];
  647. }
  648. })
  649. }else{
  650. getSysNo().then(res =>{
  651. this.$set(this.form,"sysNo", res.data.data)
  652. let date = new Date();
  653. let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
  654. this.$set(this.form,"createTime",strDate)
  655. });
  656. getUserInfo().then(res =>{
  657. this.$set(this.form,"createUserName", res.data.data.name)
  658. })
  659. }
  660. },
  661. operationDetailList(itemList){
  662. this.data = itemList;
  663. this.oldData = this.deepClone(itemList)
  664. let status = [];
  665. this.data.forEach(item =>{
  666. item.status == 0 ? status.push(true) : status.push(false)
  667. })
  668. //如果 明细列表存在 请核之后的状态 禁止编辑一些输入框
  669. if(status.findIndex(item => item == false) == 0){
  670. this.basicData.column.forEach(item =>{
  671. if(item.prop == "code" || item.prop == "cname" || item.prop == "corpId" || item.prop == "debitAmount"){
  672. item.disabled = true
  673. this.configuration.disabled = true
  674. }
  675. })
  676. }
  677. },
  678. //删除列表后面的删除按钮触发触发(row, index, done)
  679. rowDel(row, index, done) {
  680. this.$confirm("确定将此明细删除?", {
  681. confirmButtonText: "确定",
  682. cancelButtonText: "取消",
  683. type: "warning"
  684. }).then(() => {
  685. this.data.splice(index,0)
  686. // 数据回调进行刷新
  687. done(row);
  688. });
  689. },
  690. // 合同金额
  691. debitChange(val){
  692. if(val){
  693. if(!this.form.settlmentAmount){
  694. this.$set(this.form,"balanceAmount",val)
  695. }
  696. }
  697. // if(this.form.debitAmount){
  698. // if(this.form.serviceCharge && parseFloat(this.form.serviceCharge) > parseFloat(this.form.debitAmount)){
  699. // this.$message.warning('服务费不得大于合同金额!')
  700. // this.$set(this.form,"serviceCharge","");
  701. // return
  702. // }
  703. // if(this.form.matMoney && parseFloat(this.form.matMoney) > parseFloat(this.form.debitAmount)){
  704. // this.$message.warning('代垫费费不得大于合同金额!')
  705. // this.$set(this.form,"matMoney","");
  706. // return
  707. // }
  708. // if(this.form.serviceCharge && this.form.matMoney){
  709. // if(_.add(parseFloat(this.form.serviceCharge),parseFloat(this.form.matMoney))> parseFloat(this.form.debitAmount)){
  710. // this.$message.warning('服务费代垫费总和不得大于合同金额!')
  711. // this.$set(this.form,"serviceCharge","");
  712. // this.$set(this.form,"matMoney","");
  713. // }
  714. // }
  715. // }
  716. },
  717. //新单
  718. addMainProject(){
  719. this.$confirm("需先将此单据保存", {
  720. confirmButtonText: "确定",
  721. cancelButtonText: "取消",
  722. type: "warning"
  723. }).then(()=>{
  724. this.editMainProject(10010);
  725. })
  726. },
  727. openPleaseCheckDialog(){
  728. this.processDialog = true;
  729. this.itemId = this.crudSelection[0].id //记得不能写死
  730. },
  731. //请核之前
  732. beforePleaseCheck(){
  733. if(this.crudSelection){
  734. let id = [];
  735. let result = [];
  736. this.crudSelection.forEach(item=>{
  737. // 新录入状态下 才可提交审核
  738. item.id ? id.push(true) : id.push(false) //如果没有id并且为新录入 提示保存
  739. item.strStatus === "录入" ? result.push(true) : result.push(false) //判断所有的是否为录入状态
  740. })
  741. if(id.findIndex(item => item != true) == -1){
  742. if(result.findIndex(item => item != true) == -1){
  743. if(contrastObj(this.form,this.oldForm) || contrastList(this.data,this.oldData)){ //判断是否改动过此页面
  744. this.$confirm("您已改动此页面,请先保存之后在请核?", "提示", {
  745. confirmButtonText: "保存",
  746. cancelButtonText: "取消",
  747. type: "warning",
  748. }).then(() => {
  749. this.editMainProject();
  750. }).catch(()=>{
  751. return
  752. })
  753. }else{
  754. this.pleaseCheck()
  755. // this.openPleaseCheckDialog();
  756. }
  757. }else{
  758. this.$message({
  759. type: "error",
  760. message: "请核数据中存在已请核数据!"
  761. });
  762. return
  763. }
  764. }else{
  765. this.$confirm("列表内存在新录入数据,是否先保存此数据?", {
  766. confirmButtonText: "确定",
  767. cancelButtonText: "取消",
  768. type: "warning"
  769. }).then(() => {
  770. this.editMainProject();
  771. })
  772. }
  773. }
  774. },
  775. //新增 修改
  776. editMainProject(pleaseCheck){
  777. this.$refs["form"].validate((valid) => {
  778. //校验明细列表
  779. let valids = true;
  780. if(this.data.length !=0){
  781. this.data.forEach((item) =>{
  782. if((item.userid =="" || !item.deptid || !item.amount) && valids){
  783. this.$message({
  784. type: "warning",
  785. message: "请检查明细列表第 "+(item.$index +1 )+" 行必填项"
  786. });
  787. valids = false;
  788. }
  789. })
  790. }
  791. if(valid && valids){
  792. const params = {
  793. ...this.form,
  794. itemList:this.data,
  795. filesList:this.upLoadData
  796. }
  797. editMianProject(params).then(res =>{
  798. this.id = res.data.data
  799. if(pleaseCheck === 10010){ //复制新单新单
  800. this.$router.push({
  801. path: "/mainItems_detailsPage",
  802. query: {id: ''},
  803. });
  804. //清空关键信息
  805. this.form = {}
  806. this.data = []
  807. this.upLoadData = []
  808. this.id = ''
  809. }else if(pleaseCheck === 10001){ //返回列表保存数据
  810. this.$message({
  811. type: "success",
  812. message: "操作成功!"
  813. });
  814. this.$router.$avueRouter.closeTag();
  815. this.$router.push({
  816. path: '/workManagement/main-items/list',
  817. query: {}
  818. });
  819. }else{
  820. this.$message({
  821. type: "success",
  822. message: "操作成功!"
  823. });
  824. this.getProjectDetail()
  825. }
  826. })
  827. }
  828. })
  829. },
  830. //请核
  831. pleaseCheck(){
  832. this.crudSelection.forEach(item =>{
  833. updateItemStatus(this.data[item.$index].id,1).then(res =>{
  834. if(res.data.success){
  835. }
  836. })
  837. this.$message({
  838. type: "success",
  839. message: "请核成功!"
  840. });
  841. //刷新列表
  842. this.getProjectDetail();
  843. })
  844. },
  845. //返回主营项目列表
  846. backToList(){
  847. if(contrastObj(this.form,this.oldForm) || contrastList(this.data,this.oldData)
  848. || contrastList(this.upLoadData,this.oldUpLoadData)
  849. ){
  850. this.$confirm("是否保存当前页面?", "提示", {
  851. confirmButtonText: "保存",
  852. cancelButtonText: "取消",
  853. type: "warning",
  854. }).then(() => {
  855. this.editMainProject(10001)
  856. }).catch(()=>{
  857. this.$router.$avueRouter.closeTag();
  858. this.$router.push({
  859. path: '/workManagement/main-items/list',
  860. query: {}
  861. });
  862. })
  863. }else{
  864. this.$router.$avueRouter.closeTag();
  865. this.$router.push({
  866. path: '/workManagement/main-items/list',
  867. query: {}
  868. });
  869. }
  870. },
  871. //点击修改或保存时触发
  872. rowCellTwo(row,index){
  873. this.$refs.crud.rowCell(row, index);
  874. },
  875. //选择时
  876. selectionChange(row){
  877. this.crudSelection = row;
  878. },
  879. //新增修改时保存触发
  880. rowSave(row, done, loading) {
  881. done()
  882. },
  883. rowUpdate(row, index, done, loading) {
  884. done(row)
  885. },
  886. searchChange(params, done) {
  887. this.getList(this.page, params);
  888. done();
  889. },
  890. sizeChange(val) {
  891. this.page.pageSize = val;
  892. this.getList();
  893. },
  894. currentChange(val) {
  895. this.page.currentPage = val;
  896. this.getList();
  897. },
  898. saveColumn(row, column) {
  899. console.log(row, column);
  900. },
  901. //上传文件保存
  902. upLoadSave(row, done, loading){
  903. this.upLoadData.push(row)
  904. done()
  905. },
  906. //修改附件上传触发
  907. upLoadUpdate(row, done){
  908. done(row);
  909. },
  910. //删除附件上传触发
  911. upLoadDel(row, index,){
  912. this.$confirm("确定将选择数据删除?", {
  913. confirmButtonText: "确定",
  914. cancelButtonText: "取消",
  915. type: "warning"
  916. }).then(() => {
  917. if (row.id){
  918. corpsbank(row.id).then(res=>{
  919. if(res.data.success){
  920. this.$message({
  921. type: "success",
  922. message: "操作成功!"
  923. });
  924. this.bankOfDepositData.splice(index, 1);
  925. }
  926. })
  927. }else {
  928. this.$message({
  929. type: "success",
  930. message: "操作成功!"
  931. });
  932. this.bankOfDepositData.splice(index, 1);
  933. }
  934. })
  935. },
  936. //服务窗口事件
  937. serviceNodeClick(data) {
  938. this.serviceTreeDeptId = data.id;
  939. this.serviceOnLoad(this.servicePage);
  940. },
  941. serviceRefreshChange(){
  942. this.serviceOnLoad(this.servicePage, this.serviceSearch)
  943. },
  944. serviceSearchChange(params, done){
  945. this.serviceOnLoad(this.servicePage, params)
  946. done();
  947. },
  948. serviceSelectionChange(row){
  949. this.serviceSelectList = row;
  950. },
  951. serviceOnLoad(page, params = {}) {
  952. this.serviceLoading = true;
  953. getServiceProjectList(page.currentPage, page.pageSize, params, this.serviceTreeDeptId).then(res => {
  954. this.serviceData = res.data.data.records
  955. this.servicePage.total = res.data.data.total
  956. this.serviceLoading = false
  957. })
  958. },
  959. serviceConfirm(){
  960. if(this.serviceSelectList.length != 0){
  961. this.serviceSelectList.forEach((item)=>{
  962. const params = {
  963. strStatus:"录入",
  964. pname:item.cname,
  965. remarks:item.remarks,
  966. price:item.price,
  967. unit:item.unit,
  968. frequency:item.rate,
  969. }
  970. this.$refs.crud.rowCellAdd(params);
  971. this.$refs.crud.rowCell(item, this.optionFrom.length-1)
  972. })
  973. }
  974. this.serviceSelectList = []
  975. this.serviceDialog = false
  976. this.$message({
  977. type: "success",
  978. message: "导入成功!"
  979. });
  980. },
  981. //用户窗口事件
  982. selectUser(row){
  983. this.userDialog = true
  984. this.detailsSelect = row.$index;
  985. },
  986. userSearchChange(params, done){
  987. this.userOnLoad(this.userPage, params);
  988. done()
  989. },
  990. userSearchReset(){
  991. },
  992. userRefreshChange(){
  993. this.userOnLoad(this.userPage)
  994. },
  995. userSelectionChange(row){
  996. this.userSelection = row;
  997. },
  998. userOnLoad(page,params={}){
  999. this.userLoading = true;
  1000. getList(page.currentPage, page.pageSize, params, this.userTreeDeptId).then(res => {
  1001. this.userDataList = res.data.data.records
  1002. this.userPage.total = res.data.data.total
  1003. this.userLoading = false;
  1004. });
  1005. },
  1006. userNodeClick(data){
  1007. this.userTreeDeptId = data.id;
  1008. this.userOnLoad(this.userPage);
  1009. },
  1010. //确定
  1011. userConfirm(){
  1012. if(this.userSelection){
  1013. this.data[this.detailsSelect].userid = this.userSelection[0].id;
  1014. this.$set(this.data[this.detailsSelect],'userName',this.userSelection[0].realName)
  1015. this.userDialog = !this.userDialog
  1016. }
  1017. },
  1018. dialogProcessClose(){
  1019. this.processDialog = false
  1020. this.getProjectDetail()
  1021. },
  1022. },
  1023. };
  1024. </script>
  1025. <style scoped lang="scss">
  1026. .main-head {
  1027. position: fixed;
  1028. top: 105px;
  1029. width: 100%;
  1030. margin-left: -10px;
  1031. height: 62px;
  1032. background: #ffffff;
  1033. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  1034. z-index: 999;
  1035. }
  1036. .main-back {
  1037. cursor: pointer;
  1038. line-height: 62px;
  1039. font-size: 16px;
  1040. color: #323233;
  1041. font-weight: 400;
  1042. }
  1043. .avue-tree {
  1044. overflow: hidden;
  1045. max-height: 660px;
  1046. }
  1047. .add-customer-btn-two {
  1048. position: fixed;
  1049. right: 150px;
  1050. top: 115px;
  1051. }
  1052. .add-customer-btn {
  1053. position: fixed;
  1054. right: 36px;
  1055. top: 115px;
  1056. }
  1057. ::v-deep .el-form-item {
  1058. margin-bottom: 0;
  1059. }
  1060. </style>