index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <a-card title="物资数量曲线" style="margin-bottom: 10px">
  3. <template #extra>
  4. <a-select style="width: 100px" v-model:value="type">
  5. <a-select-option v-for="item in typeList" :value="item.id" :key="item.id">{{item.label}}</a-select-option>
  6. </a-select>
  7. </template>
  8. <div class="chart_content">
  9. <chart-good v-if="lineChart.length > 0" :id="0" :list="lineChart"></chart-good>
  10. <a-empty v-else style="padding-top: 100px" />
  11. </div>
  12. </a-card>
  13. <a-card style="margin-bottom: 10px">
  14. <a-form>
  15. <a-row :gutter="16">
  16. <a-col :span="6">
  17. <a-form-item label="申请时间">
  18. <a-range-picker v-model:value="dateTime" value-format="YYYY-MM-DD" format="YYYY-MM-DD" />
  19. </a-form-item>
  20. </a-col>
  21. <a-col :span="4">
  22. <a-space>
  23. <a-button type="primary" @click="search">查询</a-button>
  24. <a-button @click="reset">重置</a-button>
  25. <!-- <a-button type="primary" @click="derive">导出</a-button>-->
  26. </a-space>
  27. </a-col>
  28. </a-row>
  29. </a-form>
  30. </a-card>
  31. <a-card>
  32. <!--:alert="options.alert.show"-->
  33. <s-table
  34. ref="table"
  35. :columns="columns"
  36. :data="loadData"
  37. :expand-row-by-click="true"
  38. bordered
  39. :row-key="(record) => record.id"
  40. :row-selection="options.rowSelection"
  41. @resizeColumn="(w, col) => {
  42. col.width = w
  43. }"
  44. >
  45. <!-- <template #operator class="table-operator">-->
  46. <!-- <a-space>-->
  47. <!-- <xn-batch-delete :selectedRowKeys="selectedRowKeys" @batchDelete="deleteAll" />-->
  48. <!-- </a-space>-->
  49. <!-- </template>-->
  50. <template #bodyCell="{ column, record }">
  51. <template v-if="column.dataIndex === 'goodsNums'">
  52. <span>{{record.goodsNums}}{{record.goodsUnit}}</span>
  53. </template>
  54. <template v-if="column.dataIndex === 'action'">
  55. <a-popconfirm title="删除此消息吗?" @confirm="del(record)">
  56. <a-button type="link" danger size="small">删除</a-button>
  57. </a-popconfirm>
  58. </template>
  59. </template>
  60. </s-table>
  61. </a-card>
  62. </template>
  63. <script setup name="good">
  64. import chartGood from '../chart/chartGood.vue'
  65. import washEntranceApi from "@/api/wash/washEntranceApi";
  66. const type = ref(2)
  67. const typeList = ref([
  68. {
  69. id: 1,
  70. label: '今日'
  71. },
  72. {
  73. id: 2,
  74. label: '本周'
  75. },
  76. {
  77. id: 3,
  78. label: '本月'
  79. }
  80. ])
  81. const lineChart = ref([])
  82. watch(type, () => {
  83. initLineChart()
  84. })
  85. const initLineChart = () => {
  86. let params = {
  87. type: type.value,
  88. dataType: 2
  89. }
  90. washEntranceApi.getLuggageLineChart(params).then(res => {
  91. lineChart.value = res
  92. })
  93. }
  94. const dateTime = ref([])
  95. const reset = () => {
  96. dateTime.value = []
  97. }
  98. const table = ref()
  99. const toolConfig = { refresh: true, height: true, columnSetting: true, striped: false }
  100. const show = ref(true)
  101. const columns = [
  102. {
  103. title: '申请单',
  104. dataIndex: 'billAdmission',
  105. width: 150,
  106. fixed: true
  107. },
  108. {
  109. title: '申请时间',
  110. dataIndex: 'createDate',
  111. width: 150,
  112. resizable: true,
  113. ellipsis: true
  114. },
  115. {
  116. title: '当前位置',
  117. dataIndex: 'currentLocation',
  118. width: 150,
  119. resizable: true,
  120. ellipsis: true
  121. },
  122. {
  123. title: '物资类型',
  124. dataIndex: 'goodsTypeName',
  125. width: 150,
  126. resizable: true,
  127. ellipsis: true
  128. },
  129. {
  130. title: '物资名称',
  131. dataIndex: 'goodsName',
  132. width: 150,
  133. resizable: true,
  134. ellipsis: true
  135. },
  136. {
  137. title: '物资数量',
  138. dataIndex: 'goodsNums',
  139. width: 150,
  140. resizable: true,
  141. ellipsis: true,
  142. sorter: true
  143. }
  144. // {
  145. // title: '操作',
  146. // dataIndex: 'action',
  147. // width: 200,
  148. // fixed: 'right'
  149. // }
  150. ]
  151. const selectedRowKeys = ref([])
  152. // 列表选择配置
  153. const options = {
  154. // columns数字类型字段加入 needTotal: true 可以勾选自动算账
  155. alert: {
  156. show: true,
  157. clear: () => {
  158. selectedRowKeys.value = ref([])
  159. }
  160. },
  161. rowSelection: {
  162. onChange: (selectedRowKey, selectedRows) => {
  163. selectedRowKeys.value = selectedRowKey
  164. }
  165. }
  166. }
  167. const loadData = (parameter) => {
  168. let params = {
  169. startTime: dateTime.value.length ? dateTime.value[0] : '',
  170. endTime: dateTime.value.length ? dateTime.value[1] : '',
  171. dataType: 3
  172. }
  173. return washEntranceApi.getWashingTableList(Object.assign(parameter, params)).then((data) => {
  174. return data
  175. })
  176. }
  177. const deleteAll = (params) => {
  178. let l = []
  179. params.forEach(item => {
  180. l.push(item.id)
  181. })
  182. let str = l.join(',')
  183. let data = {
  184. ids: str
  185. }
  186. washEntranceApi.delWashingTableList(data).then(() => {
  187. table.value.clearRefreshSelected()
  188. })
  189. }
  190. const del = (row) => {
  191. let params = {
  192. ids: row.id
  193. }
  194. washEntranceApi.delWashingTableList(params).then(() => {
  195. table.value.refresh(true)
  196. })
  197. }
  198. onMounted(() => {
  199. initLineChart()
  200. })
  201. </script>
  202. <style scoped>
  203. .chart_content {
  204. width: 100%;
  205. height: 400px;
  206. }
  207. </style>