supplier.vue 22 KB

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