detailsPage.vue 30 KB

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