ThreeStandards.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. <template>
  2. <div>
  3. <div class="standards-all">
  4. <div class="standards-head">
  5. <div class="standards-head-li">
  6. <div>
  7. <label>国家:</label>
  8. <!-- <el-input style="width:200px" v-model="input" placeholder="请输入内容"></el-input> -->
  9. <el-select style="width: 220px;margin-left: 10px;" v-model="input" @change="countrychange($event)" filterable placeholder="请选择国家">
  10. <el-option
  11. v-for="item in countrylist"
  12. :key="item.countryName"
  13. :label="item.countryName"
  14. :value="item.countryName">
  15. </el-option>
  16. </el-select>
  17. </div>
  18. <div>
  19. <label>城市:</label>
  20. <el-select style="width: 220px;margin-left: 10px;" v-model="input2" @change="citychange" filterable placeholder="请选择公司">
  21. <el-option
  22. v-for="item in citylist"
  23. :key="item"
  24. :label="item"
  25. :value="item">
  26. </el-option>
  27. </el-select>
  28. <!-- <el-input style="width:200px" v-model="input2" placeholder="请输入内容"></el-input> -->
  29. </div>
  30. <div>
  31. <label>归属城市:</label>
  32. <el-select style="width: 220px;margin-left: 10px;" v-model="provinceId" @change="provinceIdchange" filterable placeholder="请选择归属城市">
  33. <el-option
  34. v-for="item in provinceIdarr"
  35. :key="item.id"
  36. :label="item.name"
  37. :value="item.id">
  38. </el-option>
  39. </el-select>
  40. </div>
  41. </div>
  42. <div class="standards-head-li">
  43. <!-- <el-button type="primary">查 询</el-button> -->
  44. <el-button @click="addclick('新增')" type="primary">新 增</el-button>
  45. </div>
  46. </div>
  47. <div class="standards-table">
  48. <el-table
  49. :data="tableData"
  50. border
  51. style="width: 100%">
  52. <el-table-column
  53. prop="rowNumber"
  54. label="序号"
  55. width="55">
  56. </el-table-column>
  57. <el-table-column
  58. prop="continent"
  59. label="洲"
  60. width="80">
  61. </el-table-column>
  62. <el-table-column
  63. prop="country"
  64. label="国家/地区"
  65. width="100">
  66. </el-table-column>
  67. <el-table-column
  68. prop="city"
  69. label="城市"
  70. width="180">
  71. </el-table-column>
  72. <el-table-column
  73. prop="currencyName"
  74. label="币种"
  75. width="80">
  76. </el-table-column>
  77. <el-table-column
  78. prop="roomCost"
  79. label="住宿费"
  80. width="120">
  81. </el-table-column>
  82. <el-table-column
  83. prop="foodCost"
  84. label="伙食费"
  85. width="120">
  86. </el-table-column>
  87. <el-table-column
  88. prop="publicCost"
  89. label="公杂费"
  90. width="120">
  91. </el-table-column>
  92. <el-table-column
  93. prop="trainCost"
  94. label="培训费"
  95. width="120">
  96. </el-table-column>
  97. <el-table-column
  98. prop="lastUpdateUserName"
  99. label="最后操作人"
  100. width="100">
  101. </el-table-column>
  102. <el-table-column
  103. prop="lastUpdateTime"
  104. label="最后操作时间"
  105. width="180">
  106. </el-table-column>
  107. <el-table-column
  108. prop="remark"
  109. label="备注"
  110. >
  111. </el-table-column>
  112. <el-table-column
  113. prop="address"
  114. label="操作"
  115. width="125">
  116. <template slot-scope="scope">
  117. <el-button
  118. @click.native.prevent="addclick('修改', scope.row)"
  119. size="mini">
  120. 修 改
  121. </el-button>
  122. <el-button
  123. style="margin-left: 0px;margin-top: 4px;"
  124. @click.native.prevent="deleteRow(scope.$index, tableData,scope.row)"
  125. type="danger"
  126. size="mini">
  127. 移 除
  128. </el-button>
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. <div class="block">
  133. <el-pagination
  134. @size-change="handleSizeChange"
  135. @current-change="handleCurrentChange"
  136. :current-page="currentPage4"
  137. :page-sizes="[14, 10, 18, 22]"
  138. :page-size="100"
  139. layout="total, sizes, prev, pager, next, jumper"
  140. :total="count">
  141. </el-pagination>
  142. </div>
  143. </div>
  144. <el-dialog :close-on-click-modal="false" width="720px" title="新增三公费用标准" :visible.sync="AdditionalFees">
  145. <el-form :model="addfees" ref="addfees" :rules="addfeesrules">
  146. <div class="standards-inif">
  147. <el-form-item label="洲" prop="continent" :label-width="formLabelWidth">
  148. <el-input size="medium" :controls="false" v-model="addfees.continent"></el-input>
  149. </el-form-item>
  150. <el-form-item label="国家" prop="country" :label-width="formLabelWidth">
  151. <el-input size="medium" :controls="false" v-model="addfees.country"></el-input>
  152. </el-form-item>
  153. <el-form-item label="城市" prop="city" :label-width="formLabelWidth">
  154. <el-input size="medium" :controls="false" v-model="addfees.city"></el-input>
  155. </el-form-item>
  156. <el-form-item label="归属城市" prop="provinceId" :label-width="formLabelWidth">
  157. <el-select size="medium" v-model="addfees.provinceId" filterable placeholder="请选择归属城市">
  158. <el-option
  159. v-for="item in provinceIdarr"
  160. :key="item.id"
  161. :label="item.name"
  162. :value="item.id">
  163. </el-option>
  164. </el-select>
  165. </el-form-item>
  166. <el-form-item label="币种" prop="currency" :label-width="formLabelWidth">
  167. <el-select size="medium" @change="currencychange" style="height:36px" v-model="addfees.currency" filterable placeholder="请选择">
  168. <el-option
  169. v-for="item in options"
  170. :key="item.id"
  171. :label="item.name"
  172. :value="item.id">
  173. </el-option>
  174. </el-select>
  175. </el-form-item>
  176. <el-form-item label="住宿费" prop="roomCost" :label-width="formLabelWidth">
  177. <el-input-number :precision="2" size="medium" :controls="false" v-model="addfees.roomCost"></el-input-number>
  178. </el-form-item>
  179. <el-form-item label="伙食费" prop="foodCost" :label-width="formLabelWidth">
  180. <el-input-number :precision="2" size="medium" :controls="false" v-model="addfees.foodCost"></el-input-number>
  181. </el-form-item>
  182. <el-form-item label="公杂费" prop="publicCost" :label-width="formLabelWidth">
  183. <el-input-number :precision="2" size="medium" :controls="false" v-model="addfees.publicCost"></el-input-number>
  184. </el-form-item>
  185. <el-form-item label="培训费" prop="trainCost" :label-width="formLabelWidth">
  186. <el-input-number :precision="2" size="medium" :controls="false" v-model="addfees.trainCost"></el-input-number>
  187. </el-form-item>
  188. </div>
  189. <div class="remark-box">
  190. <el-form-item label="备注" :label-width="formLabelWidth">
  191. <el-input :rows="8" type="textarea" v-model="addfees.remark"></el-input>
  192. </el-form-item>
  193. </div>
  194. </el-form>
  195. <div slot="footer" class="dialog-footer">
  196. <el-button type="primary" @click="addsbtn('addfees')">保 存</el-button>
  197. <el-button @click="AdditionalFees = false">取 消</el-button>
  198. </div>
  199. </el-dialog>
  200. </div>
  201. </div>
  202. </template>
  203. <script>
  204. export default {
  205. data() {
  206. return {
  207. loginuserid:'',
  208. input:'全部',
  209. input2:'全部',
  210. tableData: [],
  211. currentPage4: 1,
  212. count:0,
  213. pageSize:14,
  214. pageIndex:1,
  215. AdditionalFees:false,
  216. countrylist:[],
  217. citylist:[],
  218. provinceId:'',
  219. provinceIdarr:[],
  220. //新增
  221. addfees:{
  222. id:0,
  223. continent:'',//洲
  224. country:'', //国家
  225. city:'',//城市
  226. currency:807,//币种
  227. roomCost:0,//住宿费
  228. foodCost:0,//伙食费
  229. publicCost:0,//公杂费
  230. trainCost:0,//培训费
  231. provinceId:'',
  232. remark:'',//备注
  233. },
  234. options:[],
  235. formLabelWidth:'100px',
  236. addfeesrules:{
  237. continent: [
  238. { required: true, trigger: 'change',message:'请填写洲' }
  239. ],
  240. country: [
  241. {required: true, trigger: 'change',message:'请填写国家' }
  242. ],
  243. city: [
  244. { required: true, trigger: 'change',message:'请填写城市' }
  245. ],
  246. currency: [
  247. { required: true, trigger: 'blur',message:'请选择币种' }
  248. ],
  249. provinceId: [
  250. { required: true, trigger: 'change' ,message:'请选择归属城市'},
  251. ],
  252. roomCost: [
  253. { required: true, trigger: 'change' ,message:'请填写住宿费'},
  254. ],
  255. foodCost: [
  256. { required: true, trigger: 'change',message:'请填写伙食费' },
  257. ],
  258. publicCost: [
  259. { required: true, trigger: 'change',message:'请填写公杂费' },
  260. ],
  261. trainCost: [
  262. { required: true, trigger: 'change',message:'请填写培训费' },
  263. ],
  264. },
  265. }
  266. },
  267. methods:{
  268. //获取基础数据
  269. GetEnterExitCostDataSource(){
  270. var url = "/api/Groups/GetEnterExitCostDataSource"
  271. var that = this
  272. this.$axios({
  273. method: 'post',
  274. url: url,
  275. headers: {
  276. Authorization: 'Bearer ' + this.token
  277. },
  278. data:{
  279. portType: 1
  280. }
  281. }).then(function (res) {
  282. console.log(res)
  283. if(res.data.code==200){
  284. that.options=res.data.data.currencyData;
  285. }
  286. })
  287. },
  288. //获取省份归属基础数据
  289. GetEnterExitProvBelongCostDataSource(){
  290. var url = "/api/Groups/GetEnterExitProvBelongCostDataSource"
  291. var that = this
  292. this.$axios({
  293. method: 'get',
  294. url: url,
  295. }).then(function (res) {
  296. if(res.data.code==200){
  297. that.provinceIdarr=res.data.data;
  298. }
  299. })
  300. },
  301. provinceIdchange(){
  302. this.GatPostNationalTravel();
  303. },
  304. //获取标准列表
  305. GatPostNationalTravel(){
  306. var url = "/api/Groups/PostNationalTravelFeePage"
  307. var that = this
  308. var inputs=this.input
  309. var input2s=this.input2
  310. if(this.input=='全部'){
  311. inputs='';
  312. }
  313. if(this.input2=='全部'){
  314. input2s='';
  315. }
  316. this.$axios({
  317. method: 'post',
  318. url: url,
  319. headers: {
  320. Authorization: 'Bearer ' + this.token
  321. },
  322. data:{
  323. portType: 1,
  324. pageIndex:that.pageIndex,
  325. pageSize:that.pageSize,
  326. provinceId:that.provinceId==''?0:that.provinceId,
  327. country:inputs,
  328. city:input2s,
  329. }
  330. }).then(function (res) {
  331. console.log(res)
  332. if(res.data.code==200){
  333. that.tableData= res.data.data;
  334. that.count= res.data.count;
  335. }
  336. }).catch(()=>{})
  337. },
  338. //新增按钮
  339. addclick(text,val){
  340. if (this.$refs.salaryinif){
  341. this.$nextTick(() => {
  342. this.$refs['salaryinif'].clearValidate();
  343. })
  344. }
  345. this.addfees={
  346. id:0,
  347. continent:'',//洲
  348. country:'', //国家
  349. city:'',//城市
  350. currency:807,//币种
  351. roomCost:0,//住宿费
  352. foodCost:0,//伙食费
  353. publicCost:0,//公杂费
  354. trainCost:0,//培训费
  355. provinceId:'',
  356. remark:'',//备注
  357. },
  358. this.AdditionalFees=true;
  359. if(text=='修改'){
  360. console.log(val)
  361. this.addfees.id=val.id;
  362. this.addfees.continent=val.continent;
  363. this.addfees.country=val.country;
  364. this.addfees.city=val.city;
  365. this.addfees.currency=val.currency;
  366. this.addfees.roomCost=val.roomCost;
  367. this.addfees.provinceId=val.provinceId;
  368. this.addfees.foodCost=val.foodCost;
  369. this.addfees.publicCost=val.publicCost;
  370. this.addfees.trainCost=val.trainCost;
  371. this.addfees.remark=val.remark;
  372. this.pageIndex=1
  373. }else if(text=='新增'){
  374. this.addfees.id=0;
  375. }
  376. },
  377. handleSizeChange(val) {
  378. console.log(`每页 ${val} 条`);
  379. this.pageSize=val;
  380. this.GatPostNationalTravel();
  381. },
  382. handleCurrentChange(val) {
  383. console.log(`当前页: ${val}`);
  384. this.pageIndex=val;
  385. this.GatPostNationalTravel()
  386. },
  387. //currencyselect
  388. currencychange(val){
  389. console.log(val)
  390. this.addfees.currency=val
  391. },
  392. //新增,修改api
  393. PostNationalTravelFeeOperate(){
  394. var url = "/api/Groups/PostNationalTravelFeeOperate"
  395. var that = this
  396. this.$axios({
  397. method: 'post',
  398. url: url,
  399. headers: {
  400. Authorization: 'Bearer ' + this.token
  401. },
  402. data:{
  403. portType: 1,
  404. id:that.addfees.id,
  405. userId:that.loginuserid,
  406. provinceId:that.addfees.provinceId,
  407. continent:that.addfees.continent,
  408. country:that.addfees.country,
  409. city:that.addfees.city,
  410. currency:that.addfees.currency,
  411. roomCost:that.addfees.roomCost,
  412. foodCost:that.addfees.foodCost,
  413. publicCost:that.addfees.publicCost,
  414. trainCost:that.addfees.trainCost,
  415. remark:that.addfees.remark,
  416. }
  417. }).then(function (res) {
  418. console.log(res)
  419. if(res.data.code==200){
  420. that.$message({
  421. type: 'success',
  422. message: res.data.msg
  423. });
  424. that.AdditionalFees=false
  425. that.GatPostNationalTravel();
  426. }else{
  427. that.$message.error(res.data.msg);
  428. }
  429. }).catch(()=>{})
  430. },
  431. //新增-修改
  432. addsbtn(formName){
  433. this.$refs[formName].validate((valid) => {
  434. if (valid) {
  435. this.PostNationalTravelFeeOperate()
  436. } else {
  437. this.$message.error('请将红框内容补全!');
  438. return false;
  439. }
  440. });
  441. },
  442. //删除
  443. deleteRow(index, rows,inif){
  444. this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
  445. confirmButtonText: '确定',
  446. cancelButtonText: '取消',
  447. type: 'warning',
  448. center: true
  449. }).then(() => {
  450. console.log(inif)
  451. var url = "/api/Groups/PostNationalTravelFeeDel"
  452. var that = this
  453. this.$axios({
  454. method: 'post',
  455. url: url,
  456. headers: {
  457. Authorization: 'Bearer ' + this.token
  458. },
  459. data:{
  460. id: inif.id,
  461. deleteUserId:that.loginuserid,
  462. }
  463. }).then(function (res) {
  464. console.log(res)
  465. if(res.data.code==200){
  466. rows.splice(index, 1)
  467. that.$message({
  468. type: 'success',
  469. message: res.data.msg
  470. });
  471. that.GatPostNationalTravel();
  472. }
  473. }).catch(()=>{})
  474. }).catch(() => {
  475. this.$message({
  476. type: 'info',
  477. message: '已取消删除'
  478. });
  479. });
  480. },
  481. //搜索数据源
  482. GetNationalTravelFeePageDataSource(){
  483. var url = "/api/Groups/GetNationalTravelFeePageDataSource"
  484. var that = this
  485. this.$axios({
  486. method: 'post',
  487. url: url,
  488. headers: {
  489. Authorization: 'Bearer ' + this.token
  490. }
  491. }).then(function (res) {
  492. console.log(res)
  493. if(res.data.code==200){
  494. that.countrylist=res.data.data
  495. that.countrylist.unshift({cityData:[],countryName:'全部'})
  496. }
  497. }).catch(()=>{})
  498. },
  499. //国家change
  500. countrychange(item){
  501. this.input2="全部"
  502. this.citylist='';
  503. var obj={}
  504. obj= this.countrylist.find(function(i){
  505. return i.countryName ===item
  506. });
  507. //在change中获取到整条对象数据
  508. console.log(obj);
  509. this.citylist=obj.cityData
  510. this.citylist.unshift('全部')
  511. this.GatPostNationalTravel();
  512. },
  513. //城市change
  514. citychange(){
  515. this.GatPostNationalTravel();
  516. }
  517. },
  518. mounted(){
  519. this.loginuserid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  520. this.GatPostNationalTravel();
  521. this.GetEnterExitProvBelongCostDataSource();
  522. this.GetEnterExitCostDataSource();
  523. this.GetNationalTravelFeePageDataSource();
  524. }
  525. }
  526. </script>
  527. <style>
  528. .standards-all{
  529. background-color: #fff;
  530. padding: 10px;
  531. box-shadow: 0 0 5px #0005;
  532. border-radius: 10px;
  533. min-height: 830px;
  534. }
  535. .standards-head-li{
  536. display: flex;
  537. }
  538. .standards-head-li div{
  539. margin-right: 10px;
  540. }
  541. .standards-head-li label{
  542. color: #606266;
  543. font-size: 15px;
  544. font-weight: 600;
  545. }
  546. .standards-head{
  547. display: flex;
  548. justify-content: space-between;
  549. }
  550. .standards-table{
  551. margin-top: 20px;
  552. }
  553. .standards-table .block{
  554. margin-top: 10px;
  555. text-align: center;
  556. }
  557. .standards-inif{
  558. display: flex;
  559. flex-wrap:wrap ;
  560. }
  561. .standards-inif .el-input--medium {
  562. width: 218px;
  563. }
  564. .standards-inif .el-input-number--medium{
  565. width: 218px;
  566. }
  567. .remark-box .el-textarea__inner{
  568. width: 93%;
  569. }
  570. </style>