index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="任务" prop="taskCode">
  5. <el-input
  6. v-model="queryParams.taskCode"
  7. placeholder="请输入任务编码"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  14. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  15. </el-form-item>
  16. </el-form>
  17. <BehaviorList :key="timer" :source = "'Behavior'" :bo="queryParams" />
  18. </div>
  19. </template>
  20. <script>
  21. import { listBehavior, getBehavior, delBehavior, addBehavior, updateBehavior } from "@/api/business/spd/bo/behavior";
  22. import BehaviorList from '../behavior/behaviorList.vue'
  23. export default {
  24. name: "Behavior",
  25. components: {BehaviorList},
  26. data() {
  27. return {
  28. // 遮罩层
  29. loading: true,
  30. // 选中数组
  31. ids: [],
  32. // 非单个禁用
  33. single: true,
  34. // 非多个禁用
  35. multiple: true,
  36. // 显示搜索条件
  37. showSearch: true,
  38. // 总条数
  39. total: 0,
  40. // 行动表格数据
  41. behaviorList: [],
  42. // 弹出层标题
  43. title: "",
  44. // 是否显示弹出层
  45. open: false,
  46. // 查询参数
  47. queryParams: {
  48. pageNum: 1,
  49. pageSize: 10,
  50. taskId: null,
  51. type: null,
  52. time: null,
  53. customer: null,
  54. customerName: null,
  55. linkman: null,
  56. linkmanName: null,
  57. purpose: null,
  58. result: null,
  59. assist: null,
  60. assistContent: null,
  61. salesOrg: null,
  62. salesOrgName: null,
  63. dept: null,
  64. deptName: null,
  65. staff: null,
  66. staffName: null,
  67. content: null,
  68. tenantId: null,
  69. revision: null,
  70. },
  71. // 表单参数
  72. form: {},
  73. // 表单校验
  74. rules: {
  75. },
  76. //重新加载子组件参数
  77. timer: '',
  78. };
  79. },
  80. created() {
  81. this.getList();
  82. },
  83. methods: {
  84. /** 查询行动列表 */
  85. getList() {
  86. this.loading = true;
  87. listBehavior(this.queryParams).then(response => {
  88. this.behaviorList = response.rows;
  89. this.total = response.total;
  90. this.loading = false;
  91. });
  92. },
  93. // 取消按钮
  94. cancel() {
  95. this.open = false;
  96. this.reset();
  97. },
  98. // 表单重置
  99. reset() {
  100. this.form = {
  101. id: null,
  102. taskCode: null,
  103. type: null,
  104. time: null,
  105. customer: null,
  106. customerName: null,
  107. linkman: null,
  108. linkmanName: null,
  109. purpose: null,
  110. result: null,
  111. assist: null,
  112. assistContent: null,
  113. salesOrg: null,
  114. salesOrgName: null,
  115. dept: null,
  116. deptName: null,
  117. staff: null,
  118. staffName: null,
  119. content: null,
  120. tenantId: null,
  121. revision: null,
  122. createBy: null,
  123. createTime: null,
  124. updateBy: null,
  125. updateTime: null,
  126. delFlag: null
  127. };
  128. this.resetForm("form");
  129. },
  130. /** 搜索按钮操作 */
  131. handleQuery() {
  132. this.queryParams.pageNum = 1;
  133. this.timer = new Date().getTime();
  134. // this.getList();
  135. },
  136. /** 重置按钮操作 */
  137. resetQuery() {
  138. this.resetForm("queryForm");
  139. this.handleQuery();
  140. },
  141. // 多选框选中数据
  142. handleSelectionChange(selection) {
  143. this.ids = selection.map(item => item.id)
  144. this.single = selection.length!==1
  145. this.multiple = !selection.length
  146. },
  147. /** 新增按钮操作 */
  148. handleAdd() {
  149. this.reset();
  150. this.open = true;
  151. this.title = "添加行动";
  152. },
  153. /** 修改按钮操作 */
  154. handleUpdate(row) {
  155. this.reset();
  156. const id = row.id || this.ids
  157. getBehavior(id).then(response => {
  158. this.form = response.data;
  159. this.open = true;
  160. this.title = "修改行动";
  161. });
  162. },
  163. /** 提交按钮 */
  164. submitForm() {
  165. this.$refs["form"].validate(valid => {
  166. if (valid) {
  167. if (this.form.id != null) {
  168. updateBehavior(this.form).then(response => {
  169. this.$modal.msgSuccess("修改成功");
  170. this.open = false;
  171. this.getList();
  172. });
  173. } else {
  174. addBehavior(this.form).then(response => {
  175. this.$modal.msgSuccess("新增成功");
  176. this.open = false;
  177. this.getList();
  178. });
  179. }
  180. }
  181. });
  182. },
  183. /** 删除按钮操作 */
  184. handleDelete(row) {
  185. const ids = row.id || this.ids;
  186. this.$modal.confirm('是否确认删除行动编号为"' + ids + '"的数据项?').then(function() {
  187. return delBehavior(ids);
  188. }).then(() => {
  189. this.getList();
  190. this.$modal.msgSuccess("删除成功");
  191. }).catch(() => {});
  192. },
  193. /** 导出按钮操作 */
  194. handleExport() {
  195. this.download('system/behavior/export', {
  196. ...this.queryParams
  197. }, `behavior_${new Date().getTime()}.xlsx`)
  198. }
  199. }
  200. };
  201. </script>