posType.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :span="3">
  8. <a-form-item label="">
  9. <j-input
  10. placeholder="pos名称"
  11. v-model="queryParam.name"
  12. ></j-input>
  13. </a-form-item>
  14. </a-col>
  15. <a-col :md="6" :sm="8">
  16. <span
  17. style="float: left; overflow: hidden"
  18. class="table-page-search-submitButtons"
  19. >
  20. <a-button type="primary" @click="searchQuery" icon="search"
  21. >查询</a-button
  22. >
  23. <a-button
  24. type="primary"
  25. @click="searchReset"
  26. icon="reload"
  27. style="margin-left: 8px"
  28. >重置</a-button
  29. >
  30. </span>
  31. </a-col>
  32. </a-row>
  33. </a-form>
  34. </div>
  35. <!-- 查询区域-END -->
  36. <!-- 操作按钮区域 -->
  37. <div class="table-operator">
  38. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  39. </div>
  40. <!-- table区域-begin -->
  41. <div>
  42. <!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
  43. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
  44. <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
  45. >项
  46. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  47. </div> -->
  48. <a-table
  49. ref="table"
  50. size="middle"
  51. :scroll="{ x: true }"
  52. bordered
  53. rowKey="id"
  54. :columns="columns"
  55. :dataSource="dataSource"
  56. :pagination="ipagination"
  57. :loading="loading"
  58. :rowSelection="{
  59. selectedRowKeys: selectedRowKeys,
  60. onChange: onSelectChange,
  61. }"
  62. class="j-table-force-nowrap"
  63. @change="handleTableChange"
  64. >
  65. <template slot="payFlagslot" slot-scope="text, record, index">
  66. {{ record.payFlag == 1 ? "是" : "否" }}
  67. </template>
  68. <template slot="iconslot" slot-scope="text, record, index">
  69. <a-icon :type="record.icon" theme="filled" />
  70. </template>
  71. <template slot="htmlSlot" slot-scope="text">
  72. <div v-html="text"></div>
  73. </template>
  74. <template slot="imgSlot" slot-scope="text, record">
  75. <span v-if="!text" style="font-size: 12px; font-style: italic"
  76. >无图片</span
  77. >
  78. <img
  79. v-else
  80. :src="getImgView(text)"
  81. :preview="record.id"
  82. height="25px"
  83. alt=""
  84. style="max-width: 80px; font-size: 12px; font-style: italic"
  85. />
  86. </template>
  87. <template slot="fileSlot" slot-scope="text">
  88. <span v-if="!text" style="font-size: 12px; font-style: italic"
  89. >无文件</span
  90. >
  91. <a-button
  92. v-else
  93. :ghost="true"
  94. type="primary"
  95. icon="download"
  96. size="small"
  97. @click="downloadFile(text)"
  98. >
  99. 下载
  100. </a-button>
  101. </template>
  102. <span slot="action" slot-scope="text, record">
  103. <a @click="handleEdit(record)">编辑</a>
  104. <a-divider type="vertical" />
  105. <a-popconfirm
  106. title="确定删除吗?"
  107. @confirm="() => handleDelete(record.id)"
  108. >
  109. <a>删除</a>
  110. </a-popconfirm>
  111. </span>
  112. </a-table>
  113. </div>
  114. <pos-type-modal ref="modalForm" @ok="modalFormOk"></pos-type-modal>
  115. </a-card>
  116. </template>
  117. <script>
  118. import { JeecgListMixin } from "@/mixins/JeecgListMixin";
  119. import PosTypeModal from "./modules/PosTypeModal";
  120. import { filterObj } from "@/utils/util";
  121. import { getAction } from "@/api/manage";
  122. export default {
  123. name: "memberList",
  124. mixins: [JeecgListMixin],
  125. components: {
  126. PosTypeModal,
  127. },
  128. data() {
  129. return {
  130. queryParam: {},
  131. // 分页参数
  132. ipagination: {
  133. current: 1,
  134. pageSize: 10,
  135. pageSizeOptions: ["10", "20", "30"],
  136. showTotal: (total, range) => {
  137. return range[0] + "-" + range[1] + " 共" + total + "条";
  138. },
  139. showQuickJumper: true,
  140. showSizeChanger: true,
  141. total: 0,
  142. },
  143. // 表头
  144. columns: [
  145. {
  146. title: "名字",
  147. align: "center",
  148. dataIndex: "name",
  149. },
  150. {
  151. title: "状态",
  152. align: "center",
  153. dataIndex: "state",
  154. customRender(text) {
  155. return text === 1 ? "启用" : "停用";
  156. },
  157. },
  158. {
  159. title: "操作",
  160. dataIndex: "action",
  161. align: "center",
  162. fixed: "right",
  163. width: 147,
  164. scopedSlots: { customRender: "action" },
  165. },
  166. ],
  167. url: {
  168. list: "/pos/posType/list",
  169. delete: "/pos/posType/delete",
  170. deleteBatch: "/pos/posType/deleteBatch",
  171. exportXlsUrl: "/pos/posType/exportXls",
  172. importExcelUrl: "pos/posType/importExcel",
  173. },
  174. dictOptions: {},
  175. superFieldList: [],
  176. selectedRowKeys: [],
  177. isorter: {
  178. column: "createTime",
  179. order: "desc",
  180. },
  181. };
  182. },
  183. created() {
  184. // this.loadData()
  185. },
  186. methods: {
  187. // searchQuery() {
  188. // this.loadData(1);
  189. // },
  190. // loadData(arg) {
  191. // //加载数据 若传入参数1则加载第一页的内容
  192. // if (arg === 1) {
  193. // this.ipagination.current = 1;
  194. // }
  195. // var params = this.getQueryParams(); //查询条件
  196. // getAction(this.url.list, params).then((res) => {
  197. // if (res.success) {
  198. // this.dataSource1 = res.result.records;
  199. // this.ipagination.total = res.result.total;
  200. // }
  201. // });
  202. // },
  203. // getQueryParams() {
  204. // var param = Object.assign({}, this.queryParam, this.isorter);
  205. // param.pageNo = this.ipagination.current;
  206. // param.pageSize = this.ipagination.pageSize;
  207. // return filterObj(param);
  208. // },
  209. getAvatarView: function (avatar) {
  210. return getFileAccessHttpUrl(avatar);
  211. },
  212. batchFrozen: function (status) {
  213. if (this.selectedRowKeys.length <= 0) {
  214. this.$message.warning("请选择一条记录!");
  215. return false;
  216. } else {
  217. let ids = "";
  218. let that = this;
  219. let isAdmin = false;
  220. that.selectionRows.forEach(function (row) {
  221. if (row.username == "admin") {
  222. isAdmin = true;
  223. }
  224. });
  225. if (isAdmin) {
  226. that.$message.warning("管理员账号不允许此操作,请重新选择!");
  227. return;
  228. }
  229. that.selectedRowKeys.forEach(function (val) {
  230. ids += val + ",";
  231. });
  232. that.$confirm({
  233. title: "确认操作",
  234. content: "是否" + (status == 1 ? "解冻" : "冻结") + "选中账号?",
  235. onOk: function () {
  236. frozenBatch({ ids: ids, status: status }).then((res) => {
  237. if (res.success) {
  238. that.$message.success(res.message);
  239. that.loadData();
  240. that.onClearSelected();
  241. } else {
  242. that.$message.warning(res.message);
  243. }
  244. });
  245. },
  246. });
  247. }
  248. },
  249. handleMenuClick(e) {
  250. if (e.key == 1) {
  251. this.batchDel();
  252. } else if (e.key == 2) {
  253. this.batchFrozen(2);
  254. } else if (e.key == 3) {
  255. this.batchFrozen(1);
  256. }
  257. },
  258. handleFrozen: function (id, status, username) {
  259. let that = this;
  260. //TODO 后台校验管理员角色
  261. if ("admin" == username) {
  262. that.$message.warning("管理员账号不允许此操作!");
  263. return;
  264. }
  265. frozenBatch({ ids: id, status: status }).then((res) => {
  266. if (res.success) {
  267. that.$message.success(res.message);
  268. that.loadData();
  269. } else {
  270. that.$message.warning(res.message);
  271. }
  272. });
  273. },
  274. handleChangePassword(username) {
  275. this.$refs.passwordmodal.show(username);
  276. },
  277. passwordModalOk() {
  278. //TODO 密码修改完成 不需要刷新页面,可以把datasource中的数据更新一下
  279. },
  280. onSyncFinally({ isToLocal }) {
  281. // 同步到本地时刷新下数据
  282. if (isToLocal) {
  283. this.loadData();
  284. }
  285. },
  286. },
  287. };
  288. </script>
  289. <style scoped>
  290. @import "~@assets/less/common.less";
  291. </style>