index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <!-- 资费管理 -->
  2. <template>
  3. <div class="container">
  4. <!-- 搜索条件区 -->
  5. <div class="search-section">
  6. <Search :SearchForm="trafficSearchFrom" @query="intData" @reset="reset" />
  7. </div>
  8. <div class="audit-btn">
  9. <a-button type="text" @click="dictShowModel(1, false)" v-if="role.getRole == 1">
  10. <template #icon>
  11. <icon-plus-circle />
  12. </template>
  13. <template #default>{{ $t('form.Add') }}</template>
  14. </a-button>
  15. </div>
  16. <a-table row-key="id" :data="dataSource" :columns="columns" :pagination="pagination" :scroll="{ x: 'auto' }"
  17. @page-change="evChangePage">
  18. <template #id="{ record }">
  19. <!-- 修改 -->
  20. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="dictShowModel(2, record)"
  21. v-if="role.getRole == 1">编辑</a>
  22. <a class="a-link" href="javascript:;" style="margin-right: 1rem" @click="meal(record)" v-if="role.getRole == 1">{{
  23. $t('tariffManagement.SetMeal') }}</a>
  24. <!-- 删除 -->
  25. <a-popconfirm :content="$t('form.Delete')" :ok-text="$t('form.Confirm')" :cancel-text="$t('form.Cancel')"
  26. @ok="handleDel(record.id)">
  27. <a class="a-link" href="javascript:;" style="margin-right: 1rem" v-if="role.getRole == 1">{{
  28. $t('form.Delete')
  29. }}</a>
  30. </a-popconfirm>
  31. </template>
  32. </a-table>
  33. <a-modal width="70%" :visible="planVisible" :title="$t('tariffManagement.SelectiveTrafficPacket')"
  34. @ok="handleSubmitPlan" @cancel="handleCancelTarriName">
  35. <!-- 搜索条件区 -->
  36. <div class="search-section">
  37. <a-form :model="formData" layout="inline">
  38. <a-form-item field="label" :label="$t('tariffManagement.label')">
  39. <a-input v-model="formData.label" :placeholder="$t('lotCard.please') + $t('tariffManagement.label')"
  40. allow-clear />
  41. </a-form-item>
  42. <a-form-item>
  43. <a-space>
  44. <a-button type="primary" @click="handleSearchPlan">{{ $t('form.Search') }}</a-button>
  45. <a-button @click="resetSearchPlan">{{ $t('form.Reset') }}</a-button>
  46. </a-space>
  47. </a-form-item>
  48. </a-form>
  49. </div>
  50. <a-table row-key="id" :data="planList" :columns="planColumns" :scroll="{ x: 'auto' }"
  51. :row-selection="rowSelectionPlan" v-model:selectedKeys="selectedKeysPlan">
  52. </a-table>
  53. </a-modal>
  54. <Meal v-model:model-value="modealShow" :traffIds="ids" @submit="intData()" />
  55. <Add v-model:model-value="visible" :type-index="typeCurrent" ref="addDetaile" @submit="intData()"></Add>
  56. </div>
  57. </template>
  58. <script setup>
  59. import { onMounted, ref, toRefs, getCurrentInstance } from "vue";
  60. import { useRoute } from "vue-router";
  61. import { columns, planColumns, trafficSearchFrom } from "./config";
  62. import { deleteTariff, tariffList ,UpdateTariffName} from "@/api/path/tariffManagement.api"
  63. import { Getdictionary } from '@/mixins/index.js'
  64. import { useSystemStore } from '@/store/modules/systemStore'
  65. import Meal from './Management/meal.vue'
  66. import Add from './Management/add.vue'
  67. import Search from '@/components/Search/index.vue'
  68. import { useI18n } from 'vue-i18n'
  69. import { Message } from '@arco-design/web-vue'
  70. const { t } = useI18n();
  71. const role = useSystemStore()
  72. const { proxy } = getCurrentInstance()
  73. const route = useRoute();
  74. const state = ref({
  75. searchForm: {},
  76. currency: [],
  77. dataSource: [],
  78. pagination: {
  79. total: 0,
  80. pageSize: 10,
  81. current: 1,
  82. },
  83. planList: [],
  84. visible: false,
  85. typeCurrent: null,
  86. sourceList: [],
  87. cycleist: [],
  88. modealShow: false,
  89. planVisible: false,
  90. formData: {},
  91. selectedKeysPlan: [],
  92. rowSelectionPlan: {
  93. type: 'radio',
  94. showCheckedAll: true,
  95. onlyCurrent: false,
  96. },
  97. ids: null,
  98. methodList: [],
  99. Form: {
  100. id: "",
  101. name: "",
  102. }
  103. })
  104. const {
  105. searchForm,
  106. currency,
  107. dataSource,
  108. pagination,
  109. planList,
  110. visible,
  111. typeCurrent,
  112. sourceList,
  113. cycleist,
  114. modealShow,
  115. planVisible,
  116. formData,
  117. selectedKeysPlan,
  118. rowSelectionPlan,
  119. ids,
  120. methodList,
  121. Form
  122. } = toRefs(state.value);
  123. const addDetaile = ref(null)
  124. const intData = async (item) => {
  125. if (item) {
  126. searchForm.value = item
  127. }
  128. const param = {
  129. current: pagination.value.current,
  130. size: pagination.value.pageSize,
  131. ...searchForm.value,
  132. }
  133. const { data } = await tariffList(param)
  134. dataSource.value = (data.records || []).map((item, index) => {
  135. const sourceName = sourceList.value.find(val => val.value == item.source)?.label
  136. const billingCycleName = cycleist.value.find(val => val.value == item.billingCycle)?.label
  137. const Activated = item.trafficBilling + item.trafficBillingType
  138. const bagSize = item.pricing + '/' + item.mrcAmount + '/' + item.networkAccessFee
  139. const billingMethodName = methodList.value.find(val => val.value == item.billingMethod)?.label
  140. delete item.children
  141. let pricingName;
  142. if (item.billingMethod == 1) {
  143. pricingName = item.trafficBillingAmount + '/' + item.currency
  144. } else if (item.billingMethod == 2) {
  145. pricingName = item.pricing + '/' + item.currency
  146. }
  147. return {
  148. ...item,
  149. sourceName,
  150. pricingName,
  151. billingCycleName,
  152. Activated: Activated,
  153. status: "正常",
  154. bagSize,
  155. billingMethodName,
  156. Number: index + 1
  157. }
  158. })
  159. pagination.value.total = data.total
  160. }
  161. const reset = (item) => {
  162. searchForm.value = item
  163. pagination.value.current = 1
  164. intData()
  165. }
  166. const handleCancelTarriName = ()=>{
  167. putLabel.value = false
  168. Form.value.id = ''
  169. Form.value.name = ''
  170. }
  171. // 删除
  172. const handleDel = async (id) => {
  173. const { code } = await deleteTariff({ id })
  174. if (code == 200) {
  175. Message.success({
  176. content: t('setting.deleteSuccess'),
  177. duration: 2000,
  178. })
  179. intData()
  180. }
  181. };
  182. const evChangePage = (page) => {
  183. pagination.value.current = page
  184. intData()
  185. }
  186. // 弹框
  187. const dictShowModel = (type, data) => {
  188. addDetaile.value.detaile(data)
  189. typeCurrent.value = type;
  190. visible.value = true;
  191. }
  192. const resetSearchPlan = () => {
  193. }
  194. const handleSearchPlan = () => {
  195. }
  196. const handleSubmitPlan = () => {
  197. if (selectedKeysPlan.value.length > 0) {
  198. formState.value.simDataPlanId = String(selectedKeysPlan.value[0])
  199. planVisible.value = false
  200. }
  201. }
  202. const handleDictValue = async () => {
  203. sourceList.value = await Getdictionary('source')
  204. cycleist.value = await Getdictionary('Billingcycle')
  205. currency.value = await Getdictionary('currencyType')
  206. methodList.value = await Getdictionary('billingMethod')
  207. }
  208. const meal = (data) => {
  209. ids.value = data.id
  210. modealShow.value = true
  211. }
  212. onMounted(async () => {
  213. await handleDictValue()
  214. await intData()
  215. })
  216. </script>
  217. <style scoped lang="less">
  218. .head-title-right {
  219. .m-r-10 {
  220. margin-right: 10px;
  221. }
  222. }
  223. .search-section {
  224. margin-top: 20px;
  225. margin-bottom: 20px;
  226. }
  227. .container {
  228. .head-title {
  229. display: flex;
  230. justify-content: space-between;
  231. }
  232. .form-row {
  233. display: flex;
  234. .form-row-col {
  235. width: 25%;
  236. display: flex;
  237. align-items: center;
  238. .form-row-label {
  239. width: 120px;
  240. text-align: right;
  241. }
  242. }
  243. }
  244. }
  245. .audit-btn {
  246. margin-bottom: 10px;
  247. }
  248. .formTitle {
  249. font-size: 18px;
  250. margin-bottom: 20px;
  251. display: flex;
  252. align-items: center
  253. }
  254. .formTitle::before {
  255. content: "";
  256. display: inline-block;
  257. width: 4px;
  258. height: 20px;
  259. background-color: green;
  260. margin-right: 10px;
  261. }
  262. </style>