QueryPageDashboard.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <div class="flex-main">
  3. <table style="width: 100%; background-color: #f7f9f8; border: 1px solid #eeeeeb; margin-bottom: 0.5rem;">
  4. <thead>
  5. <tr height="40px">
  6. <th
  7. width="30px" class="text-center" :class="{ 'mulitiple-select': multipleSelect }"
  8. @click.self="changeSelectMode"
  9. >
  10. <input v-model="isSelectAll" autocomplete="off" type="checkbox" />
  11. </th>
  12. <th width="80px">
  13. <a-flex justify="flex-start" align="center">
  14. <a-button type="text" @click="sortInstance.changeFieldName('assetInstance.assetNo')">
  15. 综合排序
  16. <template v-if="sortInstance.sortSetting.fieldName == 'assetInstance.assetNo'" #icon>
  17. <ArrowUpOutlined v-if="sortInstance.sortSetting.direction == 'ASC'" />
  18. <ArrowDownOutlined v-if="sortInstance.sortSetting.direction == 'DESC'" />
  19. </template>
  20. </a-button>
  21. </a-flex>
  22. </th>
  23. <th width="80px">
  24. <a-flex justify="flex-start" align="center">
  25. <a-button type="text" @click="sortInstance.changeFieldName('assetInstance.buyDate')">
  26. 购置日期
  27. <template v-if="sortInstance.sortSetting.fieldName == 'assetInstance.buyDate'" #icon>
  28. <ArrowUpOutlined v-if="sortInstance.sortSetting.direction == 'ASC'" />
  29. <ArrowDownOutlined v-if="sortInstance.sortSetting.direction == 'DESC'" />
  30. </template>
  31. </a-button>
  32. </a-flex>
  33. </th>
  34. <th width="100px">
  35. <a-flex justify="flex-start" align="center">
  36. <a-button type="text" @click="sortInstance.changeFieldName('assetInstance.accountCreateDate')">
  37. 财务入账日期
  38. <template v-if="sortInstance.sortSetting.fieldName == 'assetInstance.accountCreateDate'" #icon>
  39. <ArrowUpOutlined v-if="sortInstance.sortSetting.direction == 'ASC'" />
  40. <ArrowDownOutlined v-if="sortInstance.sortSetting.direction == 'DESC'" />
  41. </template>
  42. </a-button>
  43. </a-flex>
  44. </th>
  45. <th width="60px">
  46. <a-flex justify="flex-start" align="center">
  47. <a-button type="text" @click="sortInstance.changeFieldName('assetInstance.quantity')">
  48. 数量
  49. <template v-if="sortInstance.sortSetting.fieldName == 'assetInstance.quantity'" #icon>
  50. <ArrowUpOutlined v-if="sortInstance.sortSetting.direction == 'ASC'" />
  51. <ArrowDownOutlined v-if="sortInstance.sortSetting.direction == 'DESC'" />
  52. </template>
  53. </a-button>
  54. </a-flex>
  55. </th>
  56. <th width="60px">
  57. <a-flex justify="flex-start" align="center">
  58. <a-button type="text" @click="sortInstance.changeFieldName('assetInstance.orginalValue')">
  59. 价格
  60. <template v-if="sortInstance.sortSetting.fieldName == 'assetInstance.orginalValue'" #icon>
  61. <ArrowUpOutlined v-if="sortInstance.sortSetting.direction == 'ASC'" />
  62. <ArrowDownOutlined v-if="sortInstance.sortSetting.direction == 'DESC'" />
  63. </template>
  64. </a-button>
  65. </a-flex>
  66. </th>
  67. <th />
  68. </tr>
  69. </thead>
  70. </table>
  71. <div>
  72. <a-flex wrap="wrap" gap="small">
  73. <div
  74. v-for="(item1, index) in infoWindowDataInstance.dataList" :key="'tr' + item1.id"
  75. :class="{ warning: item1.select }" @dblclick="selectNode(item1)"
  76. >
  77. <a-card hoverable :body-style="{ padding: '1rem' }" style="width: 200px;">
  78. <template #cover>
  79. <a-flex gap="0" vertical>
  80. <div>
  81. <div style="position: relative;">
  82. <div style="position: absolute; top:0px; left: 10px; z-index: 1;">
  83. <span>
  84. {{
  85. index +
  86. 1 +
  87. (pagination.current_page - 1) * pagination.per_page
  88. }}
  89. &nbsp;
  90. </span>
  91. </div>
  92. <div style="position: absolute; top:1px; left: 25px; z-index: 1;">
  93. <input
  94. autocomplete="off" type="checkbox" :checked="item1.select" style="padding-left: 10px;"
  95. @click.self="selectNodeForSearch(item1)"
  96. />
  97. </div>
  98. </div>
  99. </div>
  100. <div>
  101. <img
  102. style="width: 100%;" alt="example"
  103. src="https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png"
  104. @click="selectNodeForSearch(item1)"
  105. />
  106. </div>
  107. <div style="padding: 0 1rem;">
  108. {{ item1.data['assetInstance.assetNo'].displayValue[0] }}
  109. </div>
  110. <div style="padding: 0 1rem;">
  111. {{ item1.data['assetInstance.name'].displayValue[0] }}
  112. </div>
  113. <a-flex horizontal style="border: 1px solid #ebebe9;">
  114. <div style="width: 50%; text-align: center; border-right: 1px solid #ebebe9;">¥0</div>
  115. <div style="width: 50%; text-align: center;">数量:{{ item1.data['assetInstance.quantity'].displayValue[0] }}</div>
  116. </a-flex>
  117. </a-flex>
  118. </template>
  119. <a-flex gap="0" vertical>
  120. <a-flex horizontal gap="5">
  121. <div style="width: 40%">购置日期</div>
  122. <div style="width: 60%"> xxx </div>
  123. </a-flex>
  124. <a-flex horizontal gap="5">
  125. <div style="width: 40%">财务入账</div>
  126. <div style="width: 60%">xxx</div>
  127. </a-flex>
  128. <a-flex horizontal gap="5">
  129. <div style="width: 40%">使用人</div>
  130. <div style="width: 60%">xxx</div>
  131. </a-flex>
  132. <a-flex horizontal gap="5">
  133. <div style="width: 40%">使用状态</div>
  134. <div style="width: 60%">{{ item1.data['useStatus.name'].displayValue[0] }}</div>
  135. </a-flex>
  136. <a-flex horizontal justify="flex-end" style="margin-top: 5px;">
  137. <a-tag color="pink">账</a-tag>
  138. <a-tag color="red">固</a-tag>
  139. <a-tag color="orange">主</a-tag>
  140. <a-tag color="green">无</a-tag>
  141. </a-flex>
  142. </a-flex>
  143. </a-card>
  144. </div>
  145. </a-flex>
  146. </div>
  147. </div>
  148. </template>
  149. <script>
  150. import { ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue';
  151. export default {
  152. name: 'QueryPageDashboard',
  153. components: {
  154. ArrowUpOutlined, ArrowDownOutlined,
  155. },
  156. props: {
  157. infoWindowDataInstance: {
  158. type: Object,
  159. default() {
  160. return {};
  161. },
  162. },
  163. pagination: {
  164. type: Object,
  165. default() {
  166. return {};
  167. },
  168. },
  169. infoGridFieldsInstance: {
  170. type: Object,
  171. default() {
  172. return {};
  173. },
  174. },
  175. /**
  176. * 是否多选
  177. */
  178. multiple: {
  179. type: Boolean,
  180. default: false,
  181. },
  182. /**
  183. * 排序对象实例
  184. */
  185. sortInstance: {
  186. type: Object,
  187. default() {
  188. return {};
  189. },
  190. },
  191. },
  192. emits: ['dataSelected', 'deleteSelected'],
  193. data: function () {
  194. return {
  195. isSelectAll: false,
  196. multipleSelect: false,
  197. };
  198. },
  199. computed: {
  200. operateButtons: function () {
  201. let buttons = [];
  202. this.infoGridFieldsInstance.infoGridFields.forEach(item => {
  203. if (item.simpleDisplayType == 'OperateButton') {
  204. buttons.push(item);
  205. }
  206. });
  207. return buttons;
  208. },
  209. },
  210. watch: {
  211. /**
  212. * 是否选择了全部的数据
  213. */
  214. isSelectAll: function (val) {
  215. var _self = this;
  216. if (_self.multipleSelect) {
  217. if (_self.isSelectAll) {
  218. if (val) {
  219. _self.infoWindowDataInstance.setAllSelect();
  220. }
  221. } else {
  222. _self.infoWindowDataInstance.setAllUnSelect();
  223. }
  224. } else {
  225. _self.isSelectAll = false;
  226. }
  227. },
  228. multiple: {
  229. handler: function (newValue, oldValue) {
  230. this.multipleSelect = newValue;
  231. },
  232. immediate: true,
  233. },
  234. },
  235. methods: {
  236. /**
  237. * 切换全选/单选
  238. */
  239. changeSelectMode: function () {
  240. this.multipleSelect = !this.multipleSelect;
  241. },
  242. /**
  243. * 选择/取消选择表格行中的复选框事件
  244. */
  245. selectNodeForSearch: function (modelData) {
  246. var _self = this;
  247. var currentStatus = modelData.select;
  248. if (!_self.multipleSelect) {
  249. _self.infoWindowDataInstance.setAllUnSelect();
  250. }
  251. _self.infoWindowDataInstance.selectSelectState(modelData, !currentStatus);
  252. if (modelData.select === true) {
  253. _self.$emit('dataSelected', modelData);
  254. } else {
  255. _self.$emit('deleteSelected', modelData);
  256. }
  257. },
  258. /**
  259. * 双击表格行事件
  260. */
  261. selectNode: function (modelData) {
  262. this.$emit('dataSelected', modelData);
  263. },
  264. },
  265. };
  266. </script>
  267. <style scoped>
  268. .flex-main {
  269. overflow: scroll;
  270. flex: 1;
  271. margin-bottom: 0px;
  272. }
  273. </style>