pointsPlusOrMinus.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div class="app-container calendar-list-container">
  3. <!-- 查询和其他操作 -->
  4. <div class="filter-container">
  5. <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入姓名"
  6. v-model="listQuery.userName"></el-input>
  7. <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
  8. <el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-edit">添加</el-button>
  9. </div>
  10. <!-- 查询结果 -->
  11. <el-table size="small" :data="list" v-loading="listLoading" element-loading-text="正在查询中。。。" border fit
  12. highlight-current-row>
  13. <el-table-column type="index" label="序号" header-align="center" align="center">
  14. </el-table-column>
  15. <el-table-column align="center" min-width="80px" label="姓名" prop="userName">
  16. </el-table-column>
  17. <el-table-column align="center" min-width="150px" label="部门" prop="deptName">
  18. </el-table-column>
  19. <el-table-column align="center" min-width="80px" label="积分">
  20. <template slot-scope="scope">
  21. <span style="color: #67C23A;font-weight: 600;font-size: 14px;" v-if="scope.row.pm == 0">
  22. + {{ scope.row.integral }}
  23. </span>
  24. <span style="color: #F56C6C;font-weight: 600;font-size: 14px;" v-else>
  25. - {{ scope.row.integral }}
  26. </span>
  27. </template>
  28. </el-table-column>
  29. <el-table-column align="center" min-width="200px" label="备注" prop="comment">
  30. </el-table-column>
  31. <el-table-column align="center" min-width="80px" label="创建时间" prop="createTime">
  32. </el-table-column>
  33. </el-table>
  34. <!-- 分页 -->
  35. <div class="pagination-container">
  36. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
  37. :current-page="listQuery.page" :page-sizes="[10, 20, 30, 50]" :page-size="listQuery.limit"
  38. layout="total, sizes, prev, pager, next, jumper" :total="total">
  39. </el-pagination>
  40. </div>
  41. <!-- 添加或修改对话框 -->
  42. <el-dialog :close-on-click-modal="false" :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="45%">
  43. <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="100px"
  44. style='width:700px; margin-left:50px;'>
  45. <el-form-item label="员工" prop="loginId">
  46. <el-select v-model="dataForm.loginId" filterable placeholder="请选择" style="width: 350px">
  47. <el-option :key="item.loginId" v-for="item in loginIdList" :label="item.userName" :value="item.loginId">
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item label="积分" prop="integral">
  52. <el-input-number
  53. style="width: 350px"
  54. :precision="0"
  55. :step="1"
  56. v-model="dataForm.integral"
  57. ></el-input-number>
  58. </el-form-item>
  59. <el-form-item label="备注">
  60. <el-input type="textarea" :rows="2" style="width: 350px" v-model="dataForm.msg"></el-input>
  61. </el-form-item>
  62. </el-form>
  63. <div slot="footer" class="dialog-footer">
  64. <el-button @click="dialogFormVisible = false">取消</el-button>
  65. <el-button type="primary" @click="createData">确定</el-button>
  66. </div>
  67. </el-dialog>
  68. </div>
  69. </template>
  70. <style>
  71. .demo-table-expand {
  72. font-size: 0;
  73. }
  74. .demo-table-expand label {
  75. width: 200px;
  76. color: #99a9bf;
  77. }
  78. .demo-table-expand .el-form-item {
  79. margin-right: 0;
  80. margin-bottom: 0;
  81. }
  82. </style>
  83. <script>
  84. import { getPointDetailList, addSub } from "@/api/pointManage";
  85. import { allUserList } from "@/api/public";
  86. import waves from "@/directive/waves"; // 水波纹指令
  87. import Tinymce from '@/components/Tinymce'
  88. export default {
  89. components: { Tinymce },
  90. directives: { waves },
  91. data() {
  92. return {
  93. loginIdList:[],
  94. list: [],
  95. total: 0,
  96. listLoading: false,
  97. listQuery: {
  98. page: 1,
  99. limit: 10,
  100. integralType:100,
  101. userName: '',
  102. },
  103. dataForm: {
  104. integral: undefined,
  105. loginId: '',
  106. msg:'',
  107. },
  108. dialogFormVisible: false,
  109. dialogStatus: '',
  110. textMap: {
  111. update: "编辑",
  112. create: "创建",
  113. },
  114. rules: {
  115. integral: [{ required: true, message: "积分不能为空", trigger: "blur" }],
  116. loginId: [{ required: true, message: "请选积分加减人员", trigger: "blur" }],
  117. },
  118. }
  119. },
  120. created() {
  121. this.getAllUserList();
  122. this.getList();
  123. },
  124. methods: {
  125. getAllUserList() {
  126. allUserList().then(response => {
  127. this.loginIdList = response.data.data;
  128. }).catch(() => {});
  129. },
  130. resetForm() {
  131. this.dataForm = {
  132. integral: undefined,
  133. loginId: '',
  134. msg:'',
  135. };
  136. },
  137. handleCreate() {
  138. this.resetForm();
  139. this.dialogFormVisible = true;
  140. this.dialogStatus = "create";
  141. this.$nextTick(() => {
  142. this.$refs["dataForm"].clearValidate();
  143. });
  144. },
  145. createData() {
  146. this.$refs["dataForm"].validate((valid) => {
  147. if (valid) {
  148. console.log(this.dataForm);
  149. addSub(this.dataForm)
  150. .then((response) => {
  151. this.dialogFormVisible = false;
  152. this.$notify({
  153. title: "成功",
  154. message: "创建成功",
  155. type: "success",
  156. duration: 2000,
  157. });
  158. this.getList();
  159. })
  160. .catch(() => { });
  161. }
  162. });
  163. },
  164. getList() {
  165. this.listLoading = true
  166. getPointDetailList(this.listQuery).then(response => {
  167. this.list = response.data.data.items
  168. this.total = response.data.data.total
  169. this.listLoading = false
  170. }).catch(() => {
  171. })
  172. },
  173. handleFilter() {
  174. this.listQuery.page = 1
  175. this.getList()
  176. },
  177. handleSizeChange(val) {
  178. this.listQuery.limit = val
  179. this.getList()
  180. },
  181. handleCurrentChange(val) {
  182. this.listQuery.page = val
  183. this.getList()
  184. },
  185. }
  186. }
  187. </script>
  188. <style>
  189. .ad-avatar-uploader .el-upload {
  190. border: 1px dashed #d9d9d9;
  191. border-radius: 6px;
  192. cursor: pointer;
  193. position: relative;
  194. overflow: hidden;
  195. }
  196. .ad-avatar-uploader .el-upload:hover {
  197. border-color: #409EFF;
  198. }
  199. .ad-avatar-uploader-icon {
  200. font-size: 28px;
  201. color: #8c939d;
  202. width: 178px;
  203. height: 178px;
  204. line-height: 178px;
  205. text-align: center;
  206. }
  207. .ad-avatar {
  208. display: block;
  209. }
  210. </style>