contractCap.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. <template>
  2. <fullscreen :fullscreen.sync="fullscreen" class="container">
  3. <div class="container-box">
  4. <toolList @iconCli="iconCli" :tooltit="tooltit"></toolList>
  5. <div class="search">
  6. <mySearch
  7. :searchList="searchList"
  8. @searchInfo="searchInfo"
  9. ></mySearch>
  10. <el-button
  11. class="btn-check"
  12. size="medium"
  13. type="primary"
  14. @click="dialogCheck(3)"
  15. v-if="userInfo.countyName == null && userInfo.cityName != null"
  16. >添加
  17. </el-button>
  18. </div>
  19. <div class="tabbox">
  20. <el-table
  21. height="calc(100% - 40px)"
  22. class="com-table"
  23. ref="multipleTable"
  24. :data="tableData"
  25. tooltip-effect="dark"
  26. size="small"
  27. border
  28. style="width: 100%"
  29. v-loading="loading"
  30. >
  31. <el-table-column prop="regionName" label="地市名称">
  32. </el-table-column>
  33. <!-- <el-table-column prop="regionCode" label="地市编码">
  34. </el-table-column> -->
  35. <!-- <el-table-column prop="preAccount" label="一采预算">
  36. </el-table-column> -->
  37. <el-table-column
  38. prop="secbuyPreAccount"
  39. label="二采预算总额"
  40. >
  41. </el-table-column>
  42. <!-- <el-table-column prop="costAccount" label="一采累计使用">
  43. </el-table-column> -->
  44. <!-- <el-table-column prop="secbuyCostAccount" label="二采累计使用">
  45. </el-table-column> -->
  46. <el-table-column
  47. prop="secbuyLastAccount"
  48. label="二采剩余预算"
  49. >
  50. </el-table-column>
  51. <el-table-column prop="secbuySchedule" label="使用进度">
  52. </el-table-column>
  53. <!-- <el-table-column
  54. :label="item.supplierName"
  55. v-for="(item, index) in supplierArr"
  56. :key="index"
  57. >
  58. <template slot-scope="scope">
  59. <div
  60. v-if="
  61. scope.row.cMkSupplierCumulativeAmounts.filter(
  62. n => {
  63. return (
  64. n.supplierName ==
  65. item.supplierName
  66. );
  67. }
  68. ).length > 0
  69. "
  70. >
  71. {{ item.sumBudget }}
  72. </div>
  73. </template>
  74. </el-table-column> -->
  75. <!-- <el-table-column prop="advYearn" :label="advYearnLabel">
  76. </el-table-column> -->
  77. <el-table-column label="操作" width="160px" align="center" v-if="userInfo.countyName == null && userInfo.cityName != null">
  78. <template slot-scope="scope">
  79. <!-- <el-button
  80. size="mini"
  81. type="primary"
  82. @click="dialogCheck(1, scope.row)"
  83. >查看</el-button
  84. > -->
  85. <el-button
  86. size="mini"
  87. type="primary"
  88. @click="dialogCheck(2, scope.row)"
  89. v-if="userInfo.countyName == null && userInfo.cityName != null"
  90. >编辑</el-button>
  91. <!-- <el-button
  92. size="mini"
  93. type="danger"
  94. @click="delLine(scope.row)"
  95. >删除</el-button
  96. > -->
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <!-- <el-pagination
  101. class="pageBox"
  102. @current-change="currchange"
  103. layout="prev, pager, next"
  104. background
  105. :total="total"
  106. >
  107. </el-pagination> -->
  108. </div>
  109. </div>
  110. <el-dialog
  111. :title="titname"
  112. :visible.sync="dialogStatus"
  113. width="40%"
  114. :destroy-on-close="true"
  115. :modal-append-to-body="false"
  116. :close-on-click-modal="false"
  117. :before-close="closedia"
  118. >
  119. <div v-loading="loadinged">
  120. <el-form :model="infolist" ref="infolist" :rules="rules">
  121. <div class="info-line" style="width: 50%; margin: 0 auto;">
  122. <!-- <el-form-item prop="regionCode">
  123. <span>地市名称</span>
  124. <el-select
  125. :popper-append-to-body="false"
  126. v-model="infolist.regionCode"
  127. placeholder="地市名称"
  128. @change="verifcheck"
  129. :disabled="secbuyLastDisableStatus"
  130. >
  131. <el-option
  132. v-for="item in regionOpt"
  133. :key="item.compId"
  134. :label="item.compName"
  135. :value="item.compId"
  136. >
  137. </el-option>
  138. </el-select>
  139. </el-form-item> -->
  140. <el-form-item prop="secbuyPreAccount" style="width: 100%;">
  141. <span>二采预算总额</span>
  142. <el-input
  143. v-model="infolist.secbuyPreAccount"
  144. placeholder="二采预算总额"
  145. ></el-input>
  146. </el-form-item>
  147. <el-form-item prop="secbuyLastAccount" style="width: 100%;">
  148. <span>二采剩余预算</span>
  149. <el-input
  150. v-model="infolist.secbuyLastAccount"
  151. placeholder="二采剩余预算"
  152. ></el-input>
  153. </el-form-item>
  154. <!-- <el-form-item prop="secbuySchedule">
  155. <span>使用进度</span>
  156. <el-input
  157. v-model="infolist.secbuySchedule"
  158. placeholder="使用进度"
  159. disabled
  160. ></el-input>
  161. </el-form-item> -->
  162. <!-- <el-form-item prop="secbuyCostAccount">
  163. <span>二采使用</span>
  164. <el-input v-model="infolist.secbuyCostAccount" placeholder="二采累计使用" disabled></el-input>
  165. </el-form-item>
  166. <el-form-item>
  167. <span>统计周期</span>
  168. <el-input v-model="infolist.advYearn" placeholder="统计周期" :disabled="disableStatus"></el-input>
  169. </el-form-item> -->
  170. </div>
  171. </el-form>
  172. <div slot="footer" class="dialog-footer myfooter">
  173. <el-button
  174. type="primary"
  175. @click="dialogCli(2)"
  176. v-if="titname !== '查看'"
  177. >确 定</el-button
  178. >
  179. <el-button @click="dialogCli(1)" v-if="titname === '查看'"
  180. >确 定</el-button
  181. >
  182. <el-button @click="dialogCli(1)">取 消</el-button>
  183. </div>
  184. </div>
  185. </el-dialog>
  186. <myMessage
  187. :messTit="messTit"
  188. @closeMessage="closeMessage"
  189. :centerDialogVisible="centerDialogVisible"
  190. v-if="centerDialogVisible"
  191. ></myMessage>
  192. </fullscreen>
  193. </template>
  194. <script>
  195. import mySearch from "../../../components/search.vue";
  196. import myMessage from "../../../components/myMessage.vue";
  197. import toolList from "../../../components/toolList";
  198. import { MessageBox } from "element-ui";
  199. export default {
  200. components: {
  201. mySearch,
  202. myMessage,
  203. toolList,
  204. MessageBox
  205. },
  206. data() {
  207. const regionCode = (rule, value, callback) => {
  208. if (!this.infolist.regionCode) {
  209. callback(new Error("不能为空"));
  210. } else {
  211. callback();
  212. }
  213. };
  214. const secbuyPreAccount = (rule, value, callback) => {
  215. if (!this.infolist.secbuyPreAccount) {
  216. callback(new Error("不能为空"));
  217. } else {
  218. callback();
  219. }
  220. };
  221. const secbuyLastAccount = (rule, value, callback) => {
  222. if (!this.infolist.secbuyLastAccount) {
  223. callback(new Error("不能为空"));
  224. } else {
  225. callback();
  226. }
  227. };
  228. return {
  229. rules: {
  230. regionCode: [
  231. {
  232. required: true,
  233. trigger: "change",
  234. validator: regionCode
  235. }
  236. ],
  237. secbuyPreAccount: [
  238. {
  239. required: true,
  240. trigger: "change",
  241. validator: secbuyPreAccount
  242. }
  243. ],
  244. secbuyLastAccount: [
  245. {
  246. required: true,
  247. trigger: "change",
  248. validator: secbuyLastAccount
  249. }
  250. ]
  251. },
  252. searchList: [
  253. {
  254. type: "input",
  255. tit: "地市名称",
  256. value: "",
  257. width: "98%"
  258. }
  259. ],
  260. tooltit: "预算及合同上限",
  261. fullscreen: false,
  262. total: 0,
  263. pageSize: 1,
  264. tableData: [],
  265. dialogStatus: false,
  266. disableStatus: false,
  267. secbuyLastDisableStatus: false,
  268. titname: "",
  269. infolist: {},
  270. userInfo: {},
  271. params: {},
  272. centerDialogVisible: false,
  273. messTit: "",
  274. delid: "",
  275. loading: false,
  276. loadinged: false,
  277. regionOpt: [],
  278. proviceopt: [
  279. {
  280. id: "0",
  281. name: "省公司"
  282. },
  283. {
  284. id: "1",
  285. name: "地市公司"
  286. }
  287. ],
  288. countyOpt: [],
  289. areaCode: "",
  290. areaName: "",
  291. supplierArr: [],
  292. currentRole: []
  293. };
  294. },
  295. computed: {
  296. // secbuySchedule: function() {
  297. // this.infolist.secbuySchedule = (this.infolist.secbuyPreAccount - this.infolist.secbuyLastAccount) / this.infolist.secbuyPreAccount;
  298. // this.infolist.secbuySchedule = ((parseFloat(this.infolist.secbuySchedule)*100).toFixed(2));
  299. // if(isNaN(this.infolist.secbuySchedule)){
  300. // this.infolist.secbuySchedule = ''
  301. // }
  302. // return this.infolist.secbuySchedule;
  303. // }
  304. },
  305. methods: {
  306. closedia() {
  307. this.infolist = {};
  308. this.dialogStatus = false;
  309. },
  310. //搜索数据
  311. searchInfo(v) {
  312. this.params = {};
  313. v[0] ? (this.params.regionName = v[0]) : "";
  314. this.getList(this.params, this.pageSize);
  315. },
  316. //获取列表
  317. getList(v, n) {
  318. this.pageSize = n;
  319. let _this = this;
  320. this.loading = true;
  321. this.tableData = [];
  322. this.$http({
  323. url: "/market/cadvContract/queryPage",
  324. method: "post",
  325. headers: {
  326. "Content-Type": "application/json",
  327. page: '{"pageNo":"' + n + '","pageSize":"10"}'
  328. },
  329. data: v
  330. }).then(res => {
  331. if (
  332. this.userInfo.countyName == null &&
  333. this.userInfo.cityName == null
  334. ) {
  335. this.tableData = res.data.data;
  336. } else if (this.userInfo.countyName == null && this.userInfo.cityName != null) {
  337. this.tableData = res.data.data.filter(item => {
  338. return item.regionName == this.userInfo.cityName;
  339. });
  340. }
  341. this.total = res.data.totalRecord;
  342. this.loading = false;
  343. var arr = new Set();
  344. this.tableData.forEach(item => {
  345. // this.advYearnLabel = item.advYearn + '供应商'
  346. this.supplierArr = item.cMkSupplierCumulativeAmounts;
  347. this.supplierArr.forEach(n => {
  348. arr.add(n);
  349. });
  350. });
  351. this.supplierArr = Array.from(arr);
  352. });
  353. },
  354. // 分页
  355. currchange(v) {
  356. this.pageSize = v;
  357. this.getList(this.params, this.pageSize);
  358. },
  359. //申请
  360. dialogCheck(v, n) {
  361. this.dialogStatus = true;
  362. this.infolist = Object.assign({}, n);
  363. this.areaCode = this.infolist.areaCode;
  364. this.areaName = this.infolist.areaName;
  365. if (v === 1) {
  366. this.titname = "查看";
  367. this.disableStatus = true;
  368. // this.getComp(v.regionCode);
  369. return;
  370. } else if (v === 2) {
  371. this.titname = "编辑";
  372. this.disableStatus = false;
  373. this.secbuyLastDisableStatus = true;
  374. // this.getComp(v.regionCode);
  375. } else if (v === 3) {
  376. this.titname = "添加";
  377. this.secbuyLastDisableStatus = false;
  378. this.disableStatus = false;
  379. }
  380. this.infolist.opNo = this.userInfo.loginNo;
  381. this.infolist.opName = this.userInfo.loginName;
  382. },
  383. //添加
  384. dialogCli(v) {
  385. if (v === 1) {
  386. this.infolist = {};
  387. this.dialogStatus = false;
  388. return;
  389. } else {
  390. this.infolist.opTime = this.$formatDate(
  391. new Date(),
  392. "YYYY-MM-DD"
  393. );
  394. this.infolist.areaCode = this.areaCode;
  395. this.infolist.areaName = this.areaName;
  396. if(this.currentRole.length == 1){
  397. this.infolist.regionName = this.currentRole[0].compName;
  398. this.infolist.regionCode = this.currentRole[0].compId;
  399. }
  400. if (this.titname === "添加") {
  401. this.submitInfo("/market/cadvContract/add");
  402. } else if (this.titname === "编辑") {
  403. this.submitInfo("/market/cadvContract/update", v);
  404. }
  405. }
  406. },
  407. submitInfo(u) {
  408. // callback(new Error('不能为空'))
  409. // if (
  410. // this.infolist.secbuyPreAccount <=
  411. // this.infolist.secbuyLastAccount
  412. // ) {
  413. // new Error("二采预算总额应大于二采剩余预算");
  414. // }
  415. let _this = this;
  416. this.$refs.infolist.validate(valid => {
  417. if (valid) {
  418. this.loadinged = true;
  419. this.$http({
  420. url: u,
  421. method: "post",
  422. headers: {
  423. "Content-Type": "application/json"
  424. },
  425. data: this.infolist
  426. }).then(res => {
  427. this.loadinged = false;
  428. if (res.data.result === 0) {
  429. _this.$message({
  430. message: "成功",
  431. type: "success"
  432. });
  433. _this.infolist = {};
  434. _this.dialogStatus = false;
  435. _this.getList({}, _this.pageSize);
  436. } else {
  437. _this.$message({
  438. message: res.data.desc,
  439. type: "error"
  440. });
  441. }
  442. });
  443. }
  444. });
  445. },
  446. closeMessage(v) {
  447. this.centerDialogVisible = false;
  448. let _this = this;
  449. if (v === 1) {
  450. _this
  451. .$http({
  452. url: "/market/cadvContract/del",
  453. method: "post",
  454. headers: {
  455. "Content-Type": "application/json"
  456. },
  457. data: {
  458. id: this.delid
  459. }
  460. })
  461. .then(res => {
  462. if (res.data.result === 1) {
  463. _this.$message({
  464. message: res.data.desc,
  465. type: "error"
  466. });
  467. } else {
  468. _this.$message({
  469. message: "删除成功",
  470. type: "success"
  471. });
  472. _this.getList(this.params, this.pageSize);
  473. }
  474. });
  475. }
  476. },
  477. //删除
  478. delLine(v) {
  479. this.centerDialogVisible = true;
  480. this.messTit = "即将删除此条数据, 是否删除?";
  481. this.delid = v.id;
  482. },
  483. //文件返回值
  484. uploadBack(v) {
  485. },
  486. //功能栏
  487. iconCli(v) {
  488. if (v === 1) {
  489. this.getList(this.params, this.pageSize);
  490. }
  491. if (v === 2) {
  492. this.fullscreen = !this.fullscreen;
  493. }
  494. },
  495. // verifcheck(v) {
  496. // if (v == 2) {
  497. // for (let i = 0; i < this.countyOpt.length; i++) {
  498. // if (this.countyOpt[i].compId === this.areaCode) {
  499. // this.areaName = this.countyOpt[i].compName;
  500. // }
  501. // }
  502. // } else {
  503. // for (let i = 0; i < this.regionOpt.length; i++) {
  504. // if (this.regionOpt[i].compId === this.infolist.regionCode) {
  505. // this.infolist.regionName = this.regionOpt[i].compName;
  506. // this.areaCode = "";
  507. // this.areaName = "";
  508. // this.getComp(this.regionOpt[i].compId);
  509. // }
  510. // }
  511. // }
  512. // },
  513. // getComp(v) {
  514. // this.$http({
  515. // url: "/sysmgr/regionComp/queryList",
  516. // method: "post",
  517. // headers: {
  518. // "Content-Type": "application/json"
  519. // },
  520. // data: {
  521. // parentCompId: v
  522. // }
  523. // }).then(res => {
  524. // this.countyOpt = res.data;
  525. // });
  526. // },
  527. getUser() {
  528. this.userInfo = JSON.parse(window.sessionStorage.userInfo);
  529. this.$http({
  530. url: "/sysmgr/regionComp/queryList",
  531. method: "post",
  532. headers: {
  533. "Content-Type": "application/json"
  534. },
  535. data: {
  536. parentCompId: "0"
  537. }
  538. }).then(res => {
  539. this.currentRole = res.data.filter(item=>{
  540. return item.compName == this.userInfo.cityName
  541. })
  542. // if (
  543. // this.userInfo.countyName == null && this.userInfo.cityName == null
  544. // ) {
  545. // this.regionOpt = res.data;
  546. // } else if (this.userInfo.countyName == null && this.userInfo.cityName != null) {
  547. // this.regionOpt = res.data.filter(item => {
  548. // return item.compName == this.userInfo.cityName;
  549. // });
  550. // }
  551. });
  552. }
  553. },
  554. mounted() {
  555. this.getList({}, 1);
  556. this.getUser();
  557. },
  558. created() {}
  559. };
  560. </script>
  561. <style scoped lang="scss">
  562. .onetab {
  563. margin-bottom: 20px;
  564. padding: 0 20px;
  565. }
  566. .titbox {
  567. div {
  568. float: right;
  569. i {
  570. font-size: 22px;
  571. margin-left: 20px;
  572. cursor: pointer;
  573. }
  574. }
  575. }
  576. .tabbox {
  577. margin-top: 15px;
  578. }
  579. .pageBox {
  580. text-align: right;
  581. margin-top: 10px;
  582. }
  583. .info-line {
  584. width: 100%;
  585. display: block;
  586. padding-left: 20px;
  587. div {
  588. width: 50%;
  589. display: inline-block;
  590. }
  591. span {
  592. width: 100px;
  593. display: inline-block;
  594. text-align: left;
  595. i {
  596. color: red;
  597. display: inline-block;
  598. padding-right: 5px;
  599. }
  600. }
  601. .el-select,
  602. .el-input {
  603. width: calc(100% - 120px);
  604. }
  605. }
  606. .online {
  607. width: 100%;
  608. .el-select {
  609. width: calc(100% - 120px);
  610. }
  611. span {
  612. vertical-align: top;
  613. }
  614. .el-textarea {
  615. width: calc(100% - 100px);
  616. }
  617. }
  618. </style>