index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <div>
  3. <save-form
  4. :inline="true"
  5. :model="searchForm"
  6. ref="searchForm"
  7. @submit="search"
  8. @reset="onReSet"
  9. saveKey="/main/main/teamSchedule"
  10. >
  11. <el-form-item prop="organIds">
  12. <el-select
  13. class="multiple"
  14. v-model.trim="searchForm.organIds"
  15. filterable
  16. placeholder="请选择分部"
  17. >
  18. <el-option
  19. v-for="(item, index) in selects.branchs"
  20. :key="index"
  21. :label="item.name"
  22. :value="item.id"
  23. ></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item prop="userId">
  27. <remote-search :commit="'setEducations'" v-model="searchForm.userId" />
  28. </el-form-item>
  29. <el-form-item prop="month">
  30. <el-date-picker
  31. v-model="searchForm.month"
  32. value-format="yyyy-MM"
  33. type="monthrange"
  34. start-placeholder="开始周期"
  35. end-placeholder="结束周期"
  36. style="width: 220px;"
  37. >
  38. </el-date-picker>
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button native-type="submit" type="primary">搜索</el-button>
  42. <el-button native-type="reset" type="danger">重置</el-button>
  43. </el-form-item>
  44. </save-form>
  45. <el-table
  46. style="width: 100%"
  47. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  48. :data="tableList"
  49. >
  50. <el-table-column align="center" prop="organName" label="分部">
  51. <template slot-scope="scope">
  52. <div>
  53. <copy-text>{{ scope.row.organName }}</copy-text>
  54. </div>
  55. </template>
  56. </el-table-column>
  57. <el-table-column align="center" prop="month" label="工作周期">
  58. <template slot-scope="scope">
  59. <div>
  60. {{ scope.row.month | dayjsFormatWeek }}
  61. </div>
  62. </template>
  63. </el-table-column>
  64. <el-table-column align="center" prop="userName" label="乐团主管">
  65. <template slot-scope="scope">
  66. <div>
  67. <copy-text>{{ scope.row.userName }}</copy-text>
  68. </div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column align="center" prop="item" label="任务事项">
  72. <template slot-scope="scope">
  73. <div>
  74. {{ scope.row.item | inspectionItemFormat }}
  75. </div>
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. align="center"
  80. prop="times"
  81. label="任务次数"
  82. ></el-table-column>
  83. <el-table-column
  84. align="center"
  85. prop="plannedTimes"
  86. label="已安排日程次数"
  87. ></el-table-column>
  88. <el-table-column
  89. align="center"
  90. prop="submittedTimes"
  91. label="已提交任务数"
  92. >
  93. <template slot-scope="scope">
  94. <div
  95. :style="
  96. scope.row.times > scope.row.submittedTimes ? 'color:red' : ''
  97. "
  98. >
  99. {{ scope.row.submittedTimes }}
  100. </div>
  101. </template>
  102. </el-table-column>
  103. <el-table-column align="center" prop="memo" label="处理意见" width="220">
  104. <template slot-scope="scope">
  105. <overflow-text :text="scope.row.memo"></overflow-text>
  106. </template>
  107. </el-table-column>
  108. <el-table-column align="center" prop="studentId" label="操作">
  109. <template slot-scope="scope">
  110. <div>
  111. <auth v-if="scope.row.item == 'INSPECT'" auths="/teamSchedule/scheduleDetail">
  112. <el-button type="text" @click="gotoHander(scope.row)"
  113. >安排日程</el-button
  114. >
  115. </auth>
  116. <auth v-else auths="/returnVisitList">
  117. <el-button type="text" @click="gotoHander(scope.row)"
  118. >回访记录</el-button
  119. >
  120. </auth>
  121. <auth :auths="['inspectionItem/update']">
  122. <el-button
  123. type="text"
  124. :disabled="scope.row.times < scope.row.submittedTimes"
  125. @click="resetLine(scope.row)"
  126. >立即处理</el-button
  127. >
  128. </auth>
  129. </div>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. <pagination
  134. sync
  135. :total.sync="rules.total"
  136. save-key="teamSchedule"
  137. :page.sync="rules.page"
  138. :limit.sync="rules.limit"
  139. :page-sizes="rules.page_size"
  140. @pagination="getList"
  141. />
  142. <el-dialog title="处理方式" width="700px" :visible.sync="handleVisible">
  143. <el-input
  144. type="textarea"
  145. :rows="3"
  146. v-model="handleForm.memo"
  147. placeholder="请填写处理方式"
  148. ></el-input>
  149. <div slot="footer" class="dialog-footer">
  150. <el-button @click="handleVisible = false">取 消</el-button>
  151. <el-button type="primary" @click="submitHandle">确 定</el-button>
  152. </div>
  153. </el-dialog>
  154. </div>
  155. </template>
  156. <script>
  157. import { getInspectionItem, resetInspectionItem } from "../api";
  158. import { permission } from "@/utils/directivePage";
  159. import pagination from "@/components/Pagination/index";
  160. import dayjs from "dayjs";
  161. import { getTimes } from "@/utils";
  162. export default {
  163. components: { pagination },
  164. data() {
  165. return {
  166. searchForm: {
  167. userId: "",
  168. organIds: "",
  169. month: [],
  170. searchType: "",
  171. },
  172. handleForm: {
  173. memo: "",
  174. searchType: "",
  175. },
  176. tableList: [],
  177. handleVisible: false,
  178. rules: {
  179. // 分页规则
  180. limit: 10, // 限制显示条数
  181. page: 1, // 当前页
  182. total: 0, // 总条数
  183. page_size: [10, 20, 40, 50], // 选择限制显示条数
  184. },
  185. };
  186. },
  187. async mounted() {
  188. await this.$store.dispatch("setBranchs");
  189. this.$set(this.searchForm,'organId',this.selects.branchs[0].id)
  190. this.getList();
  191. },
  192. methods: {
  193. permission(str) {
  194. return permission(str);
  195. },
  196. onReSet() {
  197. this.$refs.searchForm.resetFields();
  198. this.search();
  199. },
  200. search() {
  201. this.rules.page = 1;
  202. this.getList();
  203. },
  204. async getList() {
  205. const { query } = this.$route;
  206. if (query.organId) {
  207. this.searchForm.organId = query.organId;
  208. }
  209. if (query.start && query.end) {
  210. this.searchForm.month = [query.start, query.end];
  211. }
  212. let { month, ...rest } = this.searchForm;
  213. let params = {
  214. ...rest,
  215. page: this.rules.page,
  216. rows: this.rules.limit,
  217. ...getTimes(month, ["startTime", "endTime"], "YYYY-MM"),
  218. searchType: this.$route.query.searchType,
  219. };
  220. try {
  221. const res = await getInspectionItem(params);
  222. this.tableList = res.data.rows;
  223. this.rules.total = res.data.total;
  224. } catch (e) {
  225. console.log(e);
  226. }
  227. },
  228. resetLine(row) {
  229. let { id, memo } = row;
  230. this.handleForm = { id, memo };
  231. this.handleVisible = true;
  232. },
  233. async submitHandle() {
  234. try {
  235. const res = await resetInspectionItem(this.handleForm);
  236. this.$message.success("提交成功");
  237. this.getList();
  238. this.handleVisible = false;
  239. } catch (e) {
  240. console.log(e);
  241. }
  242. },
  243. gotoHander(row) {
  244. let startTime = dayjs(row.month).startOf("month").format("YYYY-MM-DD");
  245. let endTime = dayjs(row.month).endOf("month").format("YYYY-MM-DD");
  246. if (row.item == "VISIT") {
  247. // 学员回访
  248. // 跳到回访页面 搜索条件 教务老师 时间范围
  249. this.$router.push({
  250. path: "/studentManager/returnVisitList",
  251. query: { teacher: row.userName, timer: [startTime, endTime] },
  252. });
  253. } else {
  254. // 下校巡查
  255. this.$router.push({
  256. path: "/main/scheduleDetail",
  257. query: {
  258. teacher: row.userId,
  259. startTime,
  260. endTime,
  261. name: row.userName,
  262. organId: row.organId,
  263. itemId: row.id,
  264. times: row.times,
  265. },
  266. });
  267. }
  268. },
  269. },
  270. };
  271. </script>
  272. <style lang="scss" scoped>
  273. </style>