capacity.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. //资源管理运力
  2. <template>
  3. <div class="steel_inbound">
  4. <div class="sache">
  5. <el-input
  6. placeholder="请输入内容"
  7. v-model="textInput"
  8. clearable>
  9. </el-input>
  10. <el-button type="primary" class="btn" @click="onclick" :loading="selectLoading">
  11. <i class="el-icon-search"></i>查询
  12. </el-button>
  13. <el-button type="primary" class="btn" @click="toInsert">
  14. <i class="el-icon-plus"></i>新增
  15. </el-button>
  16. </div>
  17. <div class="table">
  18. <dilTable
  19. v-bind.sync="options"
  20. :loading="tableloading"
  21. @func="func"
  22. :isKuang="isKuang"
  23. >
  24. <el-table-column fixed="right" label="操作" width="100">
  25. <template slot-scope="scope">
  26. <el-button
  27. type="text"
  28. size="small"
  29. @click="updateCapacity(scope.row.capacityId)"
  30. >
  31. 修改
  32. </el-button>
  33. <el-button
  34. type="text"
  35. size="small"
  36. @click="deleteCapacity(scope.row.capacityId)"
  37. v-if="show==true">
  38. 删除
  39. </el-button>
  40. </template>
  41. </el-table-column>
  42. </dilTable>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import { getCookie } from "@/utils/util.js";
  48. export default {
  49. data(){
  50. return{
  51. selectLoading:false,
  52. isKuang:false,
  53. tableloading:false,
  54. show:false,
  55. name:"homeworkPath",
  56. textInput:"",
  57. restaurants: [],
  58. ssoId:null,
  59. options:{
  60. // first请求数据的地址
  61. requestUrl: "",
  62. },
  63. }
  64. },
  65. created(){
  66. if(getCookie("orgCode") == "wuliuchuyunzhongxin" || getCookie("orgCode") == "dagangadmin" || getCookie("orgCode") == "zidonghuabu"){
  67. this.show = true
  68. }
  69. if(getCookie("orgCode") == "chengyunshang"){
  70. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ getCookie("userId");
  71. }else if(getCookie("orgCode") == "baohua"){
  72. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId=" + getCookie("userId");
  73. }else{
  74. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId=" + null;
  75. }
  76. },
  77. methods:{
  78. func(res){
  79. if(this.tableloading){
  80. this.tableloading = false;
  81. }
  82. if(this.isKuang){
  83. this.isKuang = false;
  84. }
  85. if(this.selectLoading){
  86. this.selectLoading = false;
  87. }
  88. },
  89. onclick(){
  90. this.isKuang = true;
  91. this.tableloading = true;
  92. this.selectLoading = true;
  93. if(this.textInput){
  94. if(getCookie("orgCode") == "chengyunshang"){
  95. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ getCookie("userId") +"&con=" +this.textInput + "&i=" + new Date();
  96. }else if(getCookie("orgCode") == "baohua"){
  97. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId=" + getCookie("userId") + this.textInput + "&i=" + new Date();
  98. }else{
  99. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ null +"&con=" +this.textInput + "&i=" + new Date();
  100. }
  101. }else{
  102. if(getCookie("orgCode") == "chengyunshang"){
  103. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ getCookie("userId") + "&i=" + new Date();
  104. }else if(getCookie("orgCode") == "baohua"){
  105. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId=" + getCookie("userId") + "&i=" + new Date();
  106. }else{
  107. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ null + "&i=" + new Date();
  108. }
  109. }
  110. },
  111. toInsert() {
  112. this.$router.push("/addCapacity");
  113. },
  114. updateCapacity(capacityId){
  115. this.$router.push("/editCapacity/" + capacityId)
  116. },
  117. deleteUser(userId){
  118. this.axios.delete("pass/v1/sysusers/" + userId) .then((res) => {
  119. });
  120. },
  121. deleteCapacity(capacityId) {
  122. if(getCookie("orgCode") == "wuliuchuyunzhongxin" || getCookie("orgCode") == "dagangadmin" || getCookie("orgCode") == "zidonghuabu"){
  123. this.$confirm('是否删除?', '提示', {
  124. confirmButtonText: '确定',
  125. cancelButtonText: '取消',
  126. type: 'warning',
  127. }).then(() => {
  128. this.axios
  129. .post("/api/v1/rms/deleteCapacity/" + capacityId)
  130. .then((res) => {
  131. if (res.data.code == "200") {
  132. console.log(res.data.data)
  133. this.deleteUser(res.data.data)
  134. this.$message({
  135. type: "success",
  136. message: "删除成功!",
  137. });
  138. this.tableloading = true;
  139. this.options.requestUrl = "/api/v1/rms/getCapacityList?apiId=397&carrierSSOId="+ null + "&i=" + new Date();
  140. } else {
  141. this.$message({
  142. message: "删除失败",
  143. type: "warning",
  144. });
  145. }
  146. });
  147. }).catch(() => {
  148. this.$message({
  149. type: 'info',
  150. message: '已取消删除'
  151. });
  152. });
  153. }else{
  154. this.$message.error("!权限不足,请联系管理员")
  155. }
  156. },
  157. },
  158. }
  159. </script>
  160. <style lang="scss" scode>
  161. .steel_inbound{
  162. .sache{
  163. padding: 1.25rem 0.375rem;
  164. .el-input {
  165. width: 20%;
  166. margin-right: 1.25rem;
  167. }
  168. }
  169. }
  170. </style>