You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.vue 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div>
  3. <crud-template ref="crudRef" class="as-weight" :submit-state="false" :home-data="field" :tableData="tableData"
  4. @btnSearch="btnSearch" @CurrentChange="handleCurrentChange" @importData="importData" @download="downloadHandle"
  5. @refreshLeft="refreshLeft" @add="Adds" @cancel="cancel" @submit="submitAdd" @handleEdit="itemEdit">
  6. <template #search>
  7. <el-input maxlength="60" v-trim clearable v-model="searchForm.startId" style="width: 200px"
  8. placeholder="请输入起始卡号" />
  9. <el-input maxlength="60" v-trim clearable v-model="searchForm.endId" style="width: 200px"
  10. placeholder="请输入结束卡号" />
  11. <el-select v-model="searchForm.status" placeholder="请选择设备状态" style="width: 240px">
  12. <el-option v-for="item in INV_DEVICE_STATUS" :key="item.value" :label="item.label" :value="item.value" />
  13. </el-select>
  14. <el-input maxlength="60" v-trim clearable v-model="searchForm.storeCode" style="width: 200px"
  15. placeholder="请输入仓库编号" />
  16. </template>
  17. <template #operation=scope>
  18. <el-popconfirm title="是否确认删除?" @confirm="handleAudit(scope.scope.$index, scope.scope.row, 1)">
  19. <template #reference>
  20. <el-button size="small" type="danger">
  21. 移除
  22. </el-button>
  23. </template>
  24. </el-popconfirm>
  25. <el-button type="success" size="small" @click="handleAudit(scope.$index, scope.scope.row, 2)">
  26. 一发信息查询
  27. </el-button>
  28. <el-button type="success" size="small" @click="lossReporting(scope)">
  29. 报损
  30. </el-button>
  31. </template>
  32. </crud-template>
  33. <el-dialog title="报损" v-model="dialogShow" width="400px">
  34. <el-input v-model="textarea" style="width: 100%" :rows="2" type="textarea" placeholder="请输入报损原因" />
  35. <template #footer>
  36. <div class="dialog-footer">
  37. <el-button @click="dialogShow = false">取消</el-button>
  38. <el-button type="primary" @click="handleAudit(0, 0, 3)">
  39. 确认
  40. </el-button>
  41. </div>
  42. </template>
  43. </el-dialog>
  44. <el-dialog title="一发信息查询" v-model="dialogShowTwo" width="80%">
  45. <view>
  46. <view>
  47. <crud-template :home-data="InvwQryCardBatchData" :tableData="InvwQryCardBatchList"></crud-template>
  48. </view>
  49. <view>
  50. <crud-template :home-data="InvwQryCardsData" :tableData="InvwQryCardsList"></crud-template>
  51. </view>
  52. </view>
  53. </el-dialog>
  54. </div>
  55. </template>
  56. <script setup lang="ts">
  57. import { ref, onMounted, computed } from 'vue'
  58. // @ts-ignore crudFrom模板
  59. import CrudTemplate from '@/crud/index.vue'
  60. import BaseService from '@/utils/baseService' //引入接口请求
  61. import {
  62. ElMessage,
  63. } from 'element-plus' //提示
  64. import { getZxqdFindConfig,InvwQryCardBatch,InvwQryCards } from "./data.js";
  65. import { useRoute } from 'vue-router'
  66. import { exportFn } from '@/views/settlement/exportFn'
  67. import $storeinitData from "@/store/initData";
  68. const INV_DEVICE_STATUS = computed(() => {
  69. return $storeinitData.state.dictData['INV_DEVICE_STATUS'] || []
  70. })
  71. //或取路由传入过来的对象数据
  72. const route = useRoute()
  73. const widthBase = '120px';
  74. const crudRef = ref()
  75. let tableData: any = ref([])
  76. const itemStartValue = ref("1")
  77. //查询参数
  78. const searchForm = ref({})
  79. const agencyIdList = ref([])
  80. const idx = ref('')
  81. const textarea = ref('')
  82. const dialogShow = ref(false)
  83. const dialogShowTwo = ref(false)
  84. const field = ref(getZxqdFindConfig(route, agencyIdList));
  85. const InvwQryCardBatchData = ref(InvwQryCardBatch(route, agencyIdList));
  86. const InvwQryCardsData = ref(InvwQryCards(route, agencyIdList));
  87. const InvwQryCardBatchList = ref([]);
  88. const InvwQryCardsList = ref([]);
  89. onMounted(() => {
  90. getList()
  91. })
  92. // 导出
  93. function downloadHandle() {
  94. exportFn('/invw/api/cardDetails/export', searchForm.value, '卡设备管理')
  95. }
  96. function lossReporting(scope) {
  97. idx.value = scope.scope.row.id;
  98. dialogShow.value = true;
  99. }
  100. //获取列表
  101. function getList() {
  102. crudRef.value.tableLoding = true
  103. let params: any = {
  104. pageNo: field.value.paging.currentPage,
  105. pageSize: field.value.paging.pageSize,
  106. }
  107. //赋值查询参数
  108. let searchFormList = { ...searchForm.value }
  109. for (let key in searchFormList) {
  110. if (searchFormList[key]) {
  111. params[key] = searchFormList[key]
  112. }
  113. }
  114. BaseService.postN('/invw/api/cardDetails/page', params).then((res: any) => {
  115. if (res && res.code === 0) {
  116. //数据转换
  117. let bizContent = res.data
  118. let data = bizContent.result || []
  119. //数据渲染
  120. tableData.value = data
  121. crudRef.value.tableLoding = false
  122. //分页总数
  123. field.value.paging.total = bizContent.totalCount
  124. } else {
  125. crudRef.value.tableLoding = false
  126. ElMessage.error(res.message)
  127. }
  128. })
  129. }
  130. function handleAudit(ids: any, row: any, type: any) {
  131. let url = ''
  132. let data = {}
  133. if (type == '1') { //移除
  134. url = '/invw/api/cardDetails/remove'
  135. data = { id: row.id }
  136. } else if (type == '2') { //一发信息查询
  137. url = '/invw/api/cardDetails/queryCard'
  138. data = { cardId: row.cardId }
  139. } else if (type == '3') { //报损
  140. data = { id: idx.value, reason: textarea.value }
  141. url = '/invw/api/cardDetails/breakage'
  142. }
  143. BaseService.post(url, data).then((res: any) => {
  144. if (res && res.statusCode === 0) {
  145. if (type == '1') {
  146. ElMessage.success('移除成功')
  147. } else if (type == '2') {
  148. dialogShowTwo.value = true
  149. InvwQryCardBatchList.value = res.data.InvwQryCardBatchList
  150. InvwQryCardsList.value = res.data.InvwQryCardBatchList
  151. ElMessage.success('查询成功')
  152. } else if (type == '3') {
  153. ElMessage.success('报损成功')
  154. dialogShow.value = false
  155. }
  156. getList()
  157. }
  158. })
  159. }
  160. const Adds = () => {
  161. itemStartValue.value = 1
  162. }
  163. //表单编辑按钮
  164. function itemEdit(idx: any, row: any) {
  165. itemStartValue.value = 2
  166. }
  167. // 添加
  168. const submitAdd = (data: any) => {
  169. request(data, itemStartValue.value)
  170. }
  171. const request = (data: any, type: any) => {
  172. data.optType = type //操作类型 1新增 2修改
  173. BaseService.postN(itemStartValue.value == 1 ? '/userw/wxCar/add' : '/userw/wxCar/update', data).then((res: any) => {
  174. if (res && res.code === 0) {
  175. getList()
  176. crudRef.value.reset();
  177. crudRef.value.dialogFormVisible = false;
  178. } else {
  179. ElMessage.error(res.message)
  180. }
  181. })
  182. }
  183. // 删除
  184. const deleteHandle = (index) => {
  185. addForm.value.locationModels.splice(index, 1)
  186. }
  187. // 搜索按钮
  188. function btnSearch() {
  189. field.value.paging.currentPage = 1
  190. getList()
  191. }
  192. //标签分页
  193. function handleClick(tab, event) {
  194. orderStep.value = tab.props.name
  195. getList()
  196. }
  197. //分页
  198. function handleCurrentChange(val: number) {
  199. field.value.paging.currentPage = val
  200. getList()
  201. }
  202. function handleAvatarSuccess(response: any, row) {
  203. }
  204. // 搜索重置
  205. function refreshLeft() {
  206. searchForm.value = {}
  207. getList()
  208. }
  209. //编辑
  210. function handleEdit() {
  211. }
  212. // 删除
  213. function handleDetele() {
  214. }
  215. // 取消
  216. function cancel() {
  217. }
  218. </script>
  219. <style lang="scss" scoped></style>