detailsPage.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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 class="el-button--small-yh add-customer-btn" type="primary"
  9. >保存
  10. </el-button>
  11. </div>
  12. </div>
  13. <div style="margin-top: 60px">
  14. <containerTitle title="基础信息"></containerTitle>
  15. <basic-container>
  16. <el-form :model="form" ref="form" label-width="130px">
  17. <el-row>
  18. <el-col v-for="(item, index) in basicData.column" :span="item.span?item.span:6" :key="index">
  19. <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
  20. <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
  21. <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"/>
  22. <el-select v-else-if="item.type === 'select'" style="width: 100%" size="small" placeholder="请选择" clearable filterable></el-select>
  23. <selectComponent v-else-if="item.prop === 'corpId'" v-model="form[item.prop]" :configuration="configuration"/>
  24. <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" placeholder="请输入"></el-input>
  25. </el-form-item>
  26. </el-col>
  27. </el-row>
  28. </el-form>
  29. </basic-container>
  30. <containerTitle title="明细列表"></containerTitle>
  31. <basic-container>
  32. <avue-crud
  33. ref="crud"
  34. :data="data"
  35. :option="optionTable"
  36. :page.sync="page"
  37. :table-loading="loading"
  38. v-model="optionFrom"
  39. @row-del="rowDel"
  40. @row-save="rowSave"
  41. @size-change="sizeChange"
  42. @current-change="currentChange"
  43. @selection-change="selectionChange"
  44. @search-change="searchChange"
  45. @refresh-change="refreshChange"
  46. @on-load="getList"
  47. @saveColumn="saveColumn"
  48. >
  49. <template slot="menuLeft">
  50. <el-button type="success"
  51. size="small"
  52. icon="el-icon-plus"
  53. plain
  54. @click="serviceDialog = true">新增明细
  55. </el-button>
  56. <el-button type="success"
  57. size="small"
  58. icon="el-icon-plus"
  59. plain
  60. @click="">新 单
  61. </el-button>
  62. <el-button type="info"
  63. size="small"
  64. plain
  65. @click="">请 核
  66. </el-button>
  67. </template>
  68. <template slot="menuRight">
  69. <el-button type="primary"
  70. size="small"
  71. icon="el-icon-arrow-right"
  72. plain
  73. @click="">导 出
  74. </el-button>
  75. <el-button type="primary"
  76. size="small"
  77. plain
  78. @click="">打 印
  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 style="float: left;padding-top: 2px">{{ row.userId }}</span>
  90. <el-button type="text" size="mini" style="float: right" @click="selectUser(row)">选择</el-button>
  91. </template>
  92. </avue-crud>
  93. </basic-container>
  94. <containerTitle title="附件上传"></containerTitle>
  95. <basic-container style="margin-bottom: 40px">
  96. <avue-crud
  97. :option="upLoadOption"
  98. v-model="upLoadForm"
  99. :data="upLoadData"
  100. @row-save="upLoadSave"
  101. @row-update="upLoadUpdate"
  102. @row-del="upLoadDel"
  103. ></avue-crud>
  104. </basic-container>
  105. </div>
  106. <el-dialog
  107. title="导入服务项目"
  108. append-to-body
  109. class="el-dialogDeep"
  110. :visible.sync="serviceDialog"
  111. width="70%"
  112. :close-on-click-modal="false"
  113. :destroy-on-close="true"
  114. :close-on-press-escape="false">
  115. <el-row style="height: 0;">
  116. <el-col :span="5" >
  117. <div>
  118. <el-scrollbar>
  119. <basic-container>
  120. <avue-tree :option="serviceTreeOption" @node-click="serviceNodeClick"/>
  121. </basic-container>
  122. </el-scrollbar>
  123. </div>
  124. </el-col>
  125. <el-col :span="19">
  126. <basic-container>
  127. <avue-crud ref="serviceCrud"
  128. :page.sync="servicePage"
  129. :search.sync="serviceSearch"
  130. :option="serviceOption"
  131. :table-loading="serviceLoading"
  132. :data="serviceData"
  133. @refresh-change="serviceRefreshChange"
  134. @selection-change="serviceSelectionChange"
  135. @search-change="serviceSearchChange"
  136. @on-load="serviceOnLoad">
  137. </avue-crud>
  138. </basic-container>
  139. </el-col>
  140. </el-row>
  141. <span slot="footer" class="dialog-footer">
  142. <el-button type="primary" @click="serviceConfirm()" :disabled="this.serviceSelectList.length == 0">导 入</el-button>
  143. <el-button @click="serviceDialog = false">取 消</el-button>
  144. </span>
  145. </el-dialog>
  146. <el-dialog
  147. title="导入用户"
  148. :visible.sync="userDialog"
  149. class="el-dialogDeep"
  150. append-to-body
  151. width="80%">
  152. <el-row style="margin-top: -5px;height: 0">
  153. <el-col :span="5">
  154. <div class="box">
  155. <el-scrollbar>
  156. <basic-container>
  157. <avue-tree :option="userTreeOption" :data="userTreeData" @node-click="userNodeClick"/>
  158. </basic-container>
  159. </el-scrollbar>
  160. </div>
  161. </el-col>
  162. <el-col :span="19">
  163. <basic-container>
  164. <avue-crud ref="userCrud"
  165. :option="userOption"
  166. :data="userDataList"
  167. :table-loading="userLoading"
  168. :page.sync="userPage"
  169. v-model="userForm"
  170. @search-change="userSearchChange"
  171. @search-reset="userSearchReset"
  172. @refresh-change="userRefreshChange"
  173. @selection-change="userSelectionChange"
  174. @on-load="userOnLoad"
  175. >
  176. </avue-crud>
  177. </basic-container>
  178. </el-col>
  179. </el-row>
  180. <span slot="footer" class="dialog-footer">
  181. <el-button @click="userDialog = false">取 消</el-button>
  182. <el-button type="primary" :disabled="this.userSelection.length == 1 ? false:true" @click="userConfirm" >确 定</el-button>
  183. </span>
  184. </el-dialog>
  185. </div>
  186. </template>
  187. <script>
  188. import option from "./configuration/detailsPage.json";
  189. //上传文件json
  190. import upLoadOption from "../../exportTrade/purchaseContract/config/uploadList.json"
  191. //服务列表接口
  192. import {getServiceProjectList,getServiceTypeTree,} from "@/api/workManagement/serviceProject";
  193. import serviceOption from "./configuration/serviceDialogList.json";
  194. //任务部门树接口
  195. import {getLazyList} from "@/api/system/dept";
  196. //用户组件
  197. import userOption from "./configuration/userList.json";
  198. import { getList } from "@/api/system/user";
  199. import { getDeptLazyTree} from "@/api/system/dept";
  200. export default {
  201. data() {
  202. return {
  203. loading: false,
  204. form:{},
  205. optionFrom:{},
  206. data: [
  207. {
  208. deptId:'',
  209. userId:''
  210. }
  211. ],
  212. deptDicData:[],//任务部门数据
  213. serviceDialog:false,//服务导入窗口
  214. userDialog:false,//用户导入窗口
  215. //客户组件配置控制
  216. configuration:{
  217. multipleChoices:false,
  218. multiple:true,
  219. searchShow:true,
  220. collapseTags:true,
  221. placeholder:'请点击右边按钮选择',
  222. dicData:[]
  223. },
  224. page: {
  225. currentPage: 1,
  226. total: 0,
  227. pageSize: 10
  228. },
  229. detailsSelect: {},
  230. //顶部from数据
  231. basicData: {
  232. column: [
  233. {
  234. label: '系统编号',
  235. prop: 'sysNo',
  236. rules: [
  237. {
  238. required: true,
  239. message: '请输入系统编号',
  240. trigger: 'blur'
  241. }
  242. ]
  243. }, {
  244. label: '项目编码',
  245. prop: 'code',
  246. rules: [
  247. {
  248. required: true,
  249. message: '请输入项目编码',
  250. trigger: 'blur'
  251. }
  252. ]
  253. }, {
  254. label: '项目名称',
  255. prop: 'cname',
  256. rules: [
  257. {
  258. required: true,
  259. message: '请输入项目名称',
  260. trigger: 'blur'
  261. }
  262. ]
  263. }, {
  264. label: '客户名称',
  265. prop: 'corpId'
  266. },{
  267. label: '合同金额',
  268. prop: 'debitAmount',
  269. rules: [
  270. {
  271. pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
  272. message: '请输入数字或小数,且小数位不超过两位',
  273. trigger: 'blur'
  274. }
  275. ]
  276. },
  277. {
  278. label: '首付金额',
  279. prop: 'advanceAmount',
  280. rules: [
  281. {
  282. pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
  283. message: '请输入数字或小数,且小数位不超过两位',
  284. trigger: 'blur'
  285. }
  286. ]
  287. },
  288. {
  289. label: '未收金额',
  290. prop: 'balanceAmount',
  291. rules: [
  292. {
  293. pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
  294. message: '请输入数字或小数,且小数位不超过两位',
  295. trigger: 'blur'
  296. }
  297. ]
  298. },
  299. {
  300. label: '已收金额',
  301. prop: 'settlmentAmount',
  302. disabled:true,
  303. rules: [
  304. {
  305. pattern: /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
  306. message: '请输入数字或小数,且小数位不超过两位',
  307. trigger: 'blur'
  308. }
  309. ]
  310. },
  311. {
  312. label: '责任人',
  313. prop: 'corpAttn',
  314. }, {
  315. label: '承揽人',
  316. prop: 'salesName',
  317. },
  318. {
  319. label: '制单人',
  320. prop: 'createUser',
  321. }, {
  322. label: '制单日期',
  323. prop: 'createTime',
  324. type: 'datetime'
  325. },
  326. {
  327. label: '电话',
  328. prop: 'corpTel',
  329. },
  330. {
  331. label: '收款方式',
  332. prop: 'paymentType',
  333. type:'select',
  334. dataType: "number",
  335. width: 120,
  336. dicUrl: "/api/blade-system/dict-biz/dictionary?code=payment_term",
  337. props: {
  338. label: "dictValue",
  339. value: "dictKey"
  340. },
  341. },
  342. {
  343. label: '开始日期',
  344. prop: 'beginTime',
  345. type:'datetime',
  346. },
  347. {
  348. label: '结束日期',
  349. prop: 'endTime',
  350. type:'datetime',
  351. },
  352. {
  353. label: '备注',
  354. span: 24,
  355. prop: 'remark'
  356. }
  357. ],
  358. },
  359. optionTable: option,
  360. //上传文件
  361. upLoadOption: upLoadOption,
  362. upLoadData:[],
  363. upLoadForm:{},
  364. //服务窗口定义
  365. serviceTreeOption: {
  366. nodeKey: 'id',
  367. lazy: true,
  368. treeLoad: function(node, resolve) {
  369. const parentId = node.level === 0 ? 0 : node.data.id;
  370. getServiceTypeTree(parentId).then(res => {
  371. resolve(
  372. res.data.data.map(item => {
  373. return {
  374. ...item,
  375. leaf: !item.hasChildren
  376. };
  377. })
  378. );
  379. });
  380. },
  381. addBtn: false,
  382. menu: false,
  383. size: 'small',
  384. props: {
  385. labelText: '标题',
  386. label: 'title',
  387. value: 'value',
  388. children: 'children'
  389. }
  390. },
  391. serviceOption:serviceOption,
  392. serviceLoading:false,
  393. serviceData:[],
  394. servicePage:{
  395. currentPage: 1,
  396. total: 0,
  397. pageSize: 10
  398. },
  399. serviceSearch:{},
  400. serviceTreeDeptId:"",
  401. serviceSelectList:[],
  402. //用户窗口定义
  403. userTreeOption: {
  404. nodeKey: 'id',
  405. lazy: true,
  406. treeLoad: function (node, resolve) {
  407. const parentId = (node.level === 0) ? 0 : node.data.id;
  408. getDeptLazyTree(parentId).then(res => {
  409. resolve(res.data.data.map(item => {
  410. return {
  411. ...item,
  412. leaf: !item.hasChildren
  413. }
  414. }))
  415. });
  416. },
  417. addBtn: false,
  418. menu: false,
  419. size: 'small',
  420. props: {
  421. labelText: '标题',
  422. label: 'title',
  423. value: 'value',
  424. children: 'children'
  425. }
  426. },
  427. userTreeData:[],
  428. userOption:userOption,
  429. userLoading:false,
  430. userDataList:[],
  431. userSelection:"",
  432. userTreeDeptId:"",
  433. userForm:{},
  434. userPage:{
  435. currentPage: 1,
  436. total: 0,
  437. pageSize: 10
  438. },
  439. };
  440. },
  441. mounted() {
  442. },
  443. methods: {
  444. //删除列表后面的删除按钮触发触发(row, index, done)
  445. rowDel(row, index, done) {
  446. this.$confirm("确定将选择数据删除?", {
  447. confirmButtonText: "确定",
  448. cancelButtonText: "取消",
  449. type: "warning"
  450. }).then(() => {
  451. this.$message({
  452. type: "success",
  453. message: "操作成功!"
  454. });
  455. // 数据回调进行刷新
  456. done(row);
  457. });
  458. },
  459. //点击修改或保存时触发
  460. rowCellTwo(row,index){
  461. if(row.$cellEdit){
  462. setTimeout(() => {
  463. this.$message.success("保存成功");
  464. }, 1000);
  465. }else{
  466. this.$refs.crud.rowCell(row, index);
  467. }
  468. },
  469. //新增修改时保存触发
  470. rowSave(row, done, loading) {
  471. },
  472. getList() {
  473. this.loading = true;
  474. setTimeout(() => {
  475. this.loading = false;
  476. this.page.total = 1;
  477. }, 1000);
  478. },
  479. searchChange(params, done) {
  480. this.getList(this.page, params);
  481. done();
  482. },
  483. sizeChange(val) {
  484. this.page.pageSize = val;
  485. this.getList();
  486. },
  487. currentChange(val) {
  488. this.page.currentPage = val;
  489. this.getList();
  490. },
  491. refreshChange() {
  492. this.page.currentPage = 1;
  493. this.getList();
  494. },
  495. saveColumn(row, column) {
  496. console.log(row, column);
  497. },
  498. //返回主营项目列表
  499. backToList(){
  500. this.$router.$avueRouter.closeTag();
  501. this.$router.push({
  502. path: '/workManagement/main-items/list',
  503. query: {}
  504. });
  505. },
  506. //上传文件保存
  507. upLoadSave(row, done, loading){
  508. this.upLoadData.push(row)
  509. done()
  510. },
  511. //修改附件上传触发
  512. upLoadUpdate(row, done){
  513. done(row);
  514. },
  515. //删除附件上传触发
  516. upLoadDel(row, index,){
  517. this.$confirm("确定将选择数据删除?", {
  518. confirmButtonText: "确定",
  519. cancelButtonText: "取消",
  520. type: "warning"
  521. }).then(() => {
  522. if (row.id){
  523. corpsbank(row.id).then(res=>{
  524. this.$message({
  525. type: "success",
  526. message: "操作成功!"
  527. });
  528. this.bankOfDepositData.splice(index, 1);
  529. })
  530. }else {
  531. this.$message({
  532. type: "success",
  533. message: "操作成功!"
  534. });
  535. this.bankOfDepositData.splice(index, 1);
  536. }
  537. })
  538. },
  539. //服务窗口事件
  540. serviceNodeClick(data) {
  541. this.serviceTreeDeptId = data.id;
  542. this.serviceOnLoad(this.servicePage);
  543. },
  544. serviceRefreshChange(){
  545. this.serviceOnLoad(this.servicePage, this.serviceSearch)
  546. },
  547. serviceSearchChange(params, done){
  548. this.serviceOnLoad(this.servicePage, params)
  549. done();
  550. },
  551. serviceSelectionChange(row){
  552. this.serviceSelectList = row;
  553. },
  554. serviceOnLoad(page, params = {}) {
  555. this.serviceLoading = true;
  556. getServiceProjectList(page.currentPage, page.pageSize, params, this.serviceTreeDeptId).then(res => {
  557. this.serviceData = res.data.data.records
  558. this.servicePage.total = res.data.data.total
  559. this.serviceLoading = false
  560. })
  561. },
  562. serviceConfirm(){
  563. if(this.serviceSelectList.length != 0){
  564. this.serviceSelectList.forEach((item)=>{
  565. item.prop1 = item.code;
  566. item.prop2 = item.name;
  567. item.prop4 = item.unit;
  568. item.prop3 = item.remarks;
  569. this.$refs.crud.rowCellAdd(item);
  570. this.$refs.crud.rowCell(item, this.optionFrom.length-1)
  571. })
  572. }
  573. this.serviceSelectList = []
  574. this.serviceDialog = false
  575. },
  576. //用户窗口事件
  577. selectUser(row){
  578. this.userDialog = true
  579. this.detailsSelect = row.$index;
  580. },
  581. userSearchChange(params, done){
  582. this.userOnLoad(this.userPage, params);
  583. done()
  584. },
  585. userSearchReset(){
  586. },
  587. userRefreshChange(){
  588. this.userOnLoad(this.userPage)
  589. },
  590. userSelectionChange(row){
  591. this.userSelection = row;
  592. },
  593. userOnLoad(page,params={}){
  594. this.userLoading = true;
  595. getList(page.currentPage, page.pageSize, params, this.userTreeDeptId).then(res => {
  596. this.userDataList = res.data.data.records
  597. this.userPage.total = res.data.data.total
  598. this.userLoading = false;
  599. });
  600. },
  601. userNodeClick(data){
  602. this.userTreeDeptId = data.id;
  603. this.userOnLoad(this.userPage);
  604. },
  605. //确定
  606. userConfirm(){
  607. if(this.userSelection){
  608. this.optionFrom[this.detailsSelect].userId = this.userSelection[0].userId;
  609. }
  610. }
  611. },
  612. };
  613. </script>
  614. <style scoped lang="scss">
  615. .main-head {
  616. position: fixed;
  617. top: 105px;
  618. width: 100%;
  619. margin-left: -10px;
  620. height: 62px;
  621. background: #ffffff;
  622. box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
  623. z-index: 999;
  624. }
  625. .main-back {
  626. cursor: pointer;
  627. line-height: 62px;
  628. font-size: 16px;
  629. color: #323233;
  630. font-weight: 400;
  631. }
  632. .avue-tree {
  633. overflow: hidden;
  634. max-height: 660px;
  635. }
  636. .add-customer-btn {
  637. position: fixed;
  638. right: 36px;
  639. top: 115px;
  640. }
  641. </style>