payMode-index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <div class="mis-pageBox">
  3. <!-- 主页 -->
  4. <el-container>
  5. <el-header height="40px">
  6. <el-row>
  7. <el-col :span="18">
  8. <el-input v-model="queryParams.searchText" size="small" style="width: 300px" placeholder="输入关键字" clearable
  9. @keyup.enter.native="clickQuery()" />
  10. <el-button type="primary" size="small" icon="el-icon-search" @click="clickQuery()">查询</el-button>
  11. </el-col>
  12. <el-col :span="6" class="list-opCol">
  13. <!-- <el-button type="primary" size="small" icon="el-icon-plus" @click="clickAdd()">添加</el-button> -->
  14. <el-button type="primary" size="small" icon="el-icon-edit" @click="clickModify()"
  15. :disabled="disabledModify">修改</el-button>
  16. <el-button type="danger" size="small" icon="el-icon-delete" @click="clickDelete()"
  17. :disabled="disabledDelete">删除</el-button>
  18. </el-col>
  19. </el-row>
  20. </el-header>
  21. <el-main>
  22. <tfTable :table-data="dataList" :column="columns" :for-id="false" :pagination="false"
  23. :currentpage="pageInfo.current" :pagesize="pageInfo.size" :total="pageInfo.tableTotal" :border="true"
  24. :multiple="true" :fixed="true" :isdelete="false" :is-select="false" :stripe="true"
  25. @handleCurrentChange="handleCurrentChange" @handleSizeChange="handleSizeChange"
  26. @handleSelectionChange="handleSelectionChange" @rowDblclick="showDetail" @detail="showDetail" />
  27. </el-main>
  28. </el-container>
  29. <!-- 详情页 -->
  30. <el-dialog v-if="dialogVisible" v-dialogDrag top="20vh" :title="dialogTitle" :visible.sync="dialogVisible"
  31. width="800px" class="dialog">
  32. <tfDetail :detailData="detailData" :editState="editState" ref="dForm" />
  33. <template slot="footer">
  34. <el-button type="warning" icon="el-icon-check" @click="clickSave()" v-if="!editState">确 定</el-button>
  35. <el-button type="warning" icon="el-icon-close" @click="clickCancel()">关 闭</el-button>
  36. </template>
  37. </el-dialog>
  38. </div>
  39. </template>
  40. <script>
  41. import "@/views/mis/common/assets/styles/misStyle.scss";
  42. import { DateHelper } from "@/views/mis/common/assets/scripts/utils.js";
  43. import { PayMode } from "@/views/mis/common/api/codingManagement.js";
  44. import tfTable from "@/views/mis/common/misTable/index.vue";
  45. import tfDetail from "./payMode-form.vue";
  46. export default {
  47. name: "payMode",
  48. components: { tfTable, tfDetail },
  49. props: ["data"],
  50. data() {
  51. return {
  52. /* ----- 主页 ----- */
  53. queryParams: {
  54. searchText: "",
  55. },
  56. disabledModify: true,
  57. disabledDelete: true,
  58. editType: true, //编辑类型,true:新增;false:修改
  59. loading: false, // 控制表格查询时
  60. pageInfo: {
  61. current: 1,
  62. size: 100,
  63. tableTotal: 1,
  64. "orders[0].asc": "true",
  65. "orders[0].column": "code",
  66. }, // 分页数据
  67. columns: [
  68. {
  69. label: "编码",
  70. prop: "code",
  71. align: "center",
  72. sortable: true,
  73. },
  74. {
  75. label: "名称",
  76. prop: "name",
  77. align: "center",
  78. },
  79. {
  80. label: "是否启用",
  81. prop: "isdisabled",
  82. align: "center",
  83. formatter: function (row, column, cellValue, index) {
  84. return cellValue == 1 ? "是" : "否";
  85. },
  86. },
  87. {
  88. label: "档案是否启用",
  89. prop: "yhIsdisabled",
  90. align: "center",
  91. formatter: function (row, column, cellValue, index) {
  92. return cellValue == 1 ? "是" : "否";
  93. },
  94. },
  95. {
  96. label: "余额滚动标志",
  97. prop: "yegdbz",
  98. align: "center",
  99. formatter: function (row, column, cellValue, index) {
  100. return cellValue == 1 ? "参与滚动" : "不参与滚动";
  101. },
  102. },
  103. {
  104. label: "操作人员",
  105. prop: "oname",
  106. align: "center",
  107. },
  108. ],
  109. dataList: [], // 表格数据
  110. selectionsData: [], // 表格选中数据
  111. selectedRow: {}, //表格选中行
  112. /* ----- 详情页 ----- */
  113. dialogTitle: "新增",
  114. editState: false, //编辑状态,true:禁用;false:启用
  115. dialogVisible: false,
  116. detailData: {
  117. code: undefined,
  118. name: undefined,
  119. isdisabled: undefined,
  120. yhIsdisabled: undefined,
  121. yegdbz: undefined,
  122. oname: undefined,
  123. },
  124. };
  125. },
  126. watch: {
  127. selectionsData(value) {
  128. this.disabledModify = this.selectionsData.length !== 1;
  129. this.disabledDelete = this.selectionsData.length == 0;
  130. },
  131. dialogVisible(newVal, oldVal) {
  132. if (!newVal) {
  133. this.resetDetailData();
  134. }
  135. },
  136. },
  137. created() { },
  138. mounted() {
  139. this.bindList();
  140. },
  141. methods: {
  142. /* ----- 方法 ----- */
  143. /**
  144. * @description 绑定列表
  145. */
  146. bindList() {
  147. // 追加分页参数
  148. let params = Object.assign({}, this.pageInfo, this.queryParams);
  149. this.dataList = [];
  150. this.loading = true;
  151. PayMode.query(params)
  152. .then((res) => {
  153. if (res.code !== 1) {
  154. this.$message.error("查询失败!");
  155. return;
  156. }
  157. // 数据总数
  158. this.pageInfo.tableTotal = res.result.total;
  159. this.dataList = res.result.records;
  160. })
  161. .catch((ex) => {
  162. this.$message.error("查询失败!");
  163. })
  164. .finally(() => {
  165. this.loading = false;
  166. });
  167. },
  168. resetDetailData() {
  169. // 表单数据
  170. for (var key in this.detailData) {
  171. //console.log("key值:" + key)
  172. this.detailData[key] = undefined;
  173. }
  174. },
  175. add() {
  176. let params = Object.assign({}, this.detailData);
  177. params.ocode = this.$store.state.user.userId;
  178. params.oname = this.$store.state.user.realName;
  179. PayMode.add(params).then((res) => {
  180. if (res.code == 1) {
  181. this.bindList();
  182. this.$message.success("添加成功!");
  183. this.dialogVisible = false;
  184. }
  185. });
  186. },
  187. modify() {
  188. let params = Object.assign({}, this.detailData);
  189. params.ocode = this.$store.state.user.userId;
  190. params.oname = this.$store.state.user.realName;
  191. // params.cdate = DateHelper.getNowFormatDate(true);
  192. PayMode.modify(params).then((res) => {
  193. if (res.code == 1) {
  194. this.bindList();
  195. this.$message.success("修改成功!");
  196. this.dialogVisible = false;
  197. }
  198. });
  199. },
  200. delete() {
  201. const ids = this.selectionsData.map((item) => {
  202. return item.code;
  203. });
  204. PayMode.delete({ ids: ids.join(",") }).then((res) => {
  205. if (res.code == 1) {
  206. this.bindList();
  207. this.$message.success("删除成功!");
  208. }
  209. });
  210. },
  211. /**
  212. * @description 显示详情
  213. */
  214. showDetail(data) {
  215. this.selectedRow = data;
  216. this.detailData = Object.assign({}, this.selectedRow);
  217. this.dialogTitle = "查看";
  218. this.editState = true;
  219. this.dialogVisible = true; // 显示弹窗
  220. },
  221. /* ----- dom事件 ----- */
  222. /**
  223. * @description 查询
  224. */
  225. clickQuery() {
  226. this.pageInfo.current = 1;
  227. this.bindList();
  228. },
  229. /**
  230. * @description 添加
  231. */
  232. clickAdd() {
  233. this.detailData.oname = this.$store.state.user.realName;
  234. this.detailData.cdate = DateHelper.getNowFormatDate(true);
  235. this.editType = true;
  236. this.dialogTitle = "添加";
  237. this.editState = false;
  238. this.dialogVisible = true; // 显示弹窗
  239. },
  240. /**
  241. * @description 修改
  242. */
  243. clickModify() {
  244. this.selectedRow = this.selectionsData[0];
  245. this.detailData = Object.assign({}, this.selectedRow);
  246. this.editType = false;
  247. this.dialogTitle = "修改";
  248. this.editState = false;
  249. this.dialogVisible = true; // 显示弹窗
  250. },
  251. /**
  252. * @description 删除
  253. */
  254. clickDelete() {
  255. this.$confirm("确定删除?", "提示", {
  256. confirmButtonText: "确定",
  257. cancelButtonText: "取消",
  258. type: "warning",
  259. }).then(() => {
  260. this.delete();
  261. });
  262. },
  263. clickCancel() {
  264. this.dialogVisible = false; // 关闭弹窗
  265. },
  266. clickSave() {
  267. let flag = this.$refs.dForm.validate();
  268. if (flag) {
  269. if (this.editType) this.add(); // 新增
  270. else this.modify(); // 修改
  271. }
  272. },
  273. /* ----- 组件事件 ----- */
  274. /**
  275. * @description 改变当前页
  276. */
  277. handleCurrentChange(current) {
  278. this.pageInfo.current = current;
  279. this.bindList();
  280. },
  281. /**
  282. * @description 分页每页条数
  283. */
  284. handleSizeChange(size) {
  285. this.pageInfo.size = size;
  286. this.bindList();
  287. },
  288. /**
  289. * @description 选择改变
  290. */
  291. handleSelectionChange(rows) {
  292. this.selectionsData = rows;
  293. },
  294. },
  295. };
  296. </script>
  297. <style lang="scss" scoped></style>