classFeesIsOk.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <!-- -->
  2. <template>
  3. <div class="m-container">
  4. <h2>
  5. <div class="squrt"></div>课酬确认
  6. </h2>
  7. <div class="m-core">
  8. <div
  9. @click="openSalary"
  10. v-if="isOpen == 0"
  11. v-permission="'courseScheduleTeacherSalary/openSalaryConfirm'"
  12. class="newBand"
  13. >开启课酬确认</div>
  14. <div
  15. v-if="isOpen == 1"
  16. @click="closeSalary"
  17. v-permission="'courseScheduleTeacherSalary/closeSalaryConfirm'"
  18. class="newBand"
  19. >关闭课酬确认</div>
  20. <el-form :inline="true" :model="searchForm">
  21. <el-form-item>
  22. <el-input
  23. v-model.trim="searchForm.search"
  24. @keyup.enter.native="search"
  25. placeholder="课程编号、课程组名称"
  26. ></el-input>
  27. </el-form-item>
  28. <el-form-item prop="organId">
  29. <el-select
  30. class="multiple"
  31. v-model.trim="searchForm.organIdList"
  32. filterable
  33. clearable
  34. placeholder="请选择分部"
  35. >
  36. <el-option
  37. v-for="(item,index) in organList"
  38. :key="index"
  39. :label="item.name"
  40. :value="item.id"
  41. ></el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item prop="organId">
  45. <el-select
  46. class="multiple"
  47. v-model.trim="searchForm.groupType"
  48. filterable
  49. clearable
  50. placeholder="请选择课程组类型"
  51. >
  52. <el-option
  53. v-for="(item,index) in groupTypeList"
  54. :key="index"
  55. :label="item.label"
  56. :value="item.value"
  57. ></el-option>
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item>
  61. <el-select placeholder="老师姓名" v-model="searchForm.teacherId" clearable filterable>
  62. <el-option
  63. v-for="(item,index) in teacherList"
  64. :label="item.realName"
  65. :value="item.id"
  66. :key="index"
  67. ></el-option>
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item>
  71. <el-select placeholder="正常签到" v-model="searchForm.signInStatus" clearable>
  72. <el-option label="是" value="1"></el-option>
  73. <el-option label="否" value="0"></el-option>
  74. </el-select>
  75. </el-form-item>
  76. <el-form-item>
  77. <el-select placeholder="正常签退" v-model="searchForm.signOutStatus" clearable>
  78. <el-option label="是" value="1"></el-option>
  79. <el-option label="否" value="0"></el-option>
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item>
  83. <el-select placeholder="状态" v-model="searchForm.confirmStatus" clearable>
  84. <el-option label="待确定" value="1"></el-option>
  85. <el-option label="已确定" value="2"></el-option>
  86. <el-option label="已完成" value="3"></el-option>
  87. </el-select>
  88. </el-form-item>
  89. <el-form-item>
  90. <el-date-picker
  91. :clearable="false"
  92. v-model="searchForm.month"
  93. type="month"
  94. value-format="yyyy-MM"
  95. placeholder="选择年月"
  96. ></el-date-picker>
  97. </el-form-item>
  98. <el-form-item>
  99. <el-button type="danger" @click="search">搜索</el-button>
  100. <el-button @click="onReSet" type="primary">重置</el-button>
  101. <!-- export/isSettlementCourseSalarys -->
  102. <el-button
  103. @click="onExport"
  104. type="primary"
  105. v-permission="'export/exercisesSituations'"
  106. style=" background: #14928a; border:1px solid #14928a;"
  107. >导出</el-button>
  108. </el-form-item>
  109. </el-form>
  110. <div class="tableWrap">
  111. <el-table
  112. style="width: 100%"
  113. :header-cell-style="{background:'#EDEEF0',color:'#444'}"
  114. :data="tableList"
  115. >
  116. <el-table-column align="center" prop="organName" label="分部"></el-table-column>
  117. <el-table-column align="center" prop="groupType" width="100" label="课程组类型">
  118. <template slot-scope="scope">{{scope.row.groupType | coursesType}}</template>
  119. </el-table-column>
  120. <el-table-column align="center" prop="courseScheduleId" label="课程编号"></el-table-column>
  121. <el-table-column align="center" prop="courseScheduleId" width="150" label="时间">
  122. <template slot-scope="scope">{{scope.row.startClassTime | dateForMinFormat}}</template>
  123. </el-table-column>
  124. <el-table-column align="center" prop="courseName" width="120" label="课程名称"></el-table-column>
  125. <el-table-column align="center" prop="teacherId" label="老师编号"></el-table-column>
  126. <el-table-column align="center" prop="teacherName" label="老师姓名"></el-table-column>
  127. <el-table-column align="center" prop="courseScheduleId" width="150" label="签到时间">
  128. <template slot-scope="scope">
  129. <p
  130. :class="scope.row.signInStatus == 1?'':'red'"
  131. >{{scope.row.signInTime | dateForMinFormat}}</p>
  132. <p
  133. :class="scope.row.signInStatus == 1?'':'red'"
  134. >{{scope.row.signInStatus | attendanceType }}</p>
  135. <p class="red" v-if="!scope.row.signInStatus&&scope.row.signInStatus!=0">未签到</p>
  136. </template>
  137. </el-table-column>
  138. <el-table-column align="center" prop="courseScheduleId" width="150" label="签退时间">
  139. <template slot-scope="scope">
  140. <p
  141. :class="scope.row.signOutStatus == 1?'':'red'"
  142. >{{scope.row.signOutTime | dateForMinFormat}}</p>
  143. <p
  144. :class="scope.row.signOutStatus == 1?'':'red'"
  145. >{{scope.row.signOutStatus | attendanceOutType}}</p>
  146. <p class="red" v-if="!scope.row.signOutStatus&&scope.row.signOutStatus!=0">未签到</p>
  147. </template>
  148. </el-table-column>
  149. <el-table-column align="center" prop="expectSalary" label="应发课酬">
  150. <template slot-scope="scope">{{scope.row.expectSalary + '元'}}</template>
  151. </el-table-column>
  152. <el-table-column align="center" prop="reduceSalary" label="课酬扣款">
  153. <template slot-scope="scope">{{scope.row.reduceSalary + '元'}}</template>
  154. </el-table-column>
  155. <el-table-column align="center" prop="actualSalary" label="结算课酬">
  156. <template slot-scope="scope">{{scope.row.actualSalary + '元'}}</template>
  157. </el-table-column>
  158. <el-table-column align="center" prop label="状态" fixed="right">
  159. <template slot-scope="scope">{{scope.row.confirmStatus | confirmFilter }}</template>
  160. </el-table-column>
  161. <el-table-column align="center" prop="memo" label="备注" width="150" fixed="right"></el-table-column>
  162. <el-table-column align="center" label="操作" fixed="right">
  163. <template slot-scope="scope">
  164. <el-button type="text">课酬调整</el-button>
  165. </template>
  166. </el-table-column>
  167. </el-table>
  168. <pagination
  169. :total="rules.total"
  170. :page.sync="rules.page"
  171. :limit.sync="rules.limit"
  172. :page-sizes="rules.page_size"
  173. @pagination="getList"
  174. />
  175. </div>
  176. </div>
  177. <el-dialog
  178. title="课酬调整"
  179. :visible.sync="dialogVisible"
  180. width="width"
  181. >
  182. <div></div>
  183. <div slot="footer">
  184. <el-button @click="dialogVisible = false">取 消</el-button>
  185. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  186. </div>
  187. </el-dialog>
  188. </div>
  189. </template>
  190. <script>
  191. import axios from "axios";
  192. import { getToken } from "@/utils/auth";
  193. import pagination from "@/components/Pagination/index";
  194. import load from "@/utils/loading";
  195. import { getTeacher, getEmployeeOrgan } from "@/api/buildTeam";
  196. import { findIsSettlementCourseSalarys,openSalaryConfirm,closeSalaryConfirm } from "@/api/journal";
  197. import { courseType } from "@/utils/searchArray";
  198. export default {
  199. components: { pagination },
  200. data() {
  201. return {
  202. searchForm: {
  203. search: null,
  204. organIdList: null,
  205. groupType: null,
  206. teacherId: null,
  207. signInStatus: null,
  208. signOutStatus: null,
  209. month: null,
  210. confirmStatus: null
  211. },
  212. dialogVisible:true,
  213. isOpen: null,
  214. teacherList: [],
  215. tableList: [],
  216. organList: [],
  217. groupTypeList: courseType,
  218. rules: {
  219. // 分页规则
  220. limit: 10, // 限制显示条数
  221. page: 1, // 当前页
  222. total: 0, // 总条数
  223. page_size: [10, 20, 40, 50] // 选择限制显示条数
  224. }
  225. };
  226. },
  227. //生命周期 - 创建完成(可以访问当前this实例)
  228. created() {},
  229. //生命周期 - 挂载完成(可以访问DOM元素)
  230. mounted() {
  231. getTeacher().then(res => {
  232. if (res.code == 200) {
  233. this.teacherList = res.data;
  234. }
  235. });
  236. getEmployeeOrgan().then(res => {
  237. if (res.code == 200) {
  238. this.organList = res.data;
  239. }
  240. });
  241. // 获取分部
  242. this.init();
  243. },
  244. activated() {
  245. this.init();
  246. },
  247. methods: {
  248. init() {
  249. if (!this.searchForm.month) {
  250. var now = new Date();
  251. this.searchForm.month = new Date(
  252. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  253. )
  254. .toISOString()
  255. .slice(0, 7);
  256. }
  257. this.getList();
  258. },
  259. getList() {
  260. let obj = this.getDate();
  261. findIsSettlementCourseSalarys(obj).then(res => {
  262. if (res.code == 200) {
  263. this.isOpen = res.data.isOpenConfirm;
  264. this.tableList = res.data.pageInfo.rows;
  265. this.rules.total = res.data.pageInfo.total;
  266. }
  267. });
  268. },
  269. search() {
  270. this.rules.page = 1;
  271. this.getList();
  272. },
  273. onReSet() {
  274. this.searchForm= {
  275. search: null,
  276. organIdList: null,
  277. groupType: null,
  278. teacherId: null,
  279. signInStatus: null,
  280. signOutStatus: null,
  281. month: null,
  282. confirmStatus: null
  283. }
  284. this.search()
  285. },
  286. getDate() {
  287. let obj = {
  288. search: this.searchForm.search,
  289. organIdList: this.searchForm.organIdList || null,
  290. groupType: this.searchForm.groupType || null,
  291. teacherId: this.searchForm.teacherId || null,
  292. signInStatus: this.searchForm.signInStatus || null,
  293. signOutStatus: this.searchForm.signOutStatus || null,
  294. month: this.searchForm.month || null,
  295. confirmStatus: this.searchForm.confirmStatus || null,
  296. page: this.rules.page,
  297. rows: this.rules.limit
  298. };
  299. return obj;
  300. },
  301. openSalary(){
  302. let now = new Date();
  303. let month = new Date(
  304. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  305. )
  306. .toISOString()
  307. .slice(0, 7);
  308. this.$confirm("您确定开启课酬确认?", "提示", {
  309. confirmButtonText: "确定",
  310. cancelButtonText: "取消",
  311. type: "warning"
  312. }).then(()=>{
  313. openSalaryConfirm({month}).then(res=>{
  314. if(res.code == 200){
  315. this.$message.success('开启成功')
  316. this.getList()
  317. }
  318. })
  319. })
  320. },
  321. closeSalary(){
  322. let now = new Date();
  323. let month = new Date(
  324. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  325. )
  326. .toISOString()
  327. .slice(0, 7);
  328. this.$confirm("您确定关闭课酬确认?", "提示", {
  329. confirmButtonText: "确定",
  330. cancelButtonText: "取消",
  331. type: "warning"
  332. }).then(()=>{
  333. closeSalaryConfirm({month}).then(res=>{
  334. if(res.code == 200){
  335. this.$message.success('关闭成功')
  336. this.getList()
  337. }
  338. })
  339. })
  340. },
  341. onExport() {
  342. let url = "/api-web/export/isSettlementCourseSalarys";
  343. let obj = this.getDate();
  344. const options = {
  345. method: "get",
  346. headers: {
  347. Authorization: getToken()
  348. },
  349. url,
  350. params: obj,
  351. responseType: "blob"
  352. };
  353. this.$confirm("您确定导出列表?", "提示", {
  354. confirmButtonText: "确定",
  355. cancelButtonText: "取消",
  356. type: "warning"
  357. })
  358. .then(() => {
  359. load.startLoading();
  360. axios(options)
  361. .then(res => {
  362. let blob = new Blob([res.data], {
  363. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8',
  364. type: "application/vnd.ms-excel;charset=utf-8"
  365. // word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  366. });
  367. let text = new Response(blob).text();
  368. text.then(res => {
  369. // 判断是否报错
  370. if (res.indexOf("code") != -1) {
  371. let json = JSON.parse(res);
  372. this.$message.error(json.msg);
  373. } else {
  374. let objectUrl = URL.createObjectURL(blob);
  375. let link = document.createElement("a");
  376. let nowTime = new Date();
  377. let ymd =
  378. nowTime.getFullYear() +
  379. "" +
  380. (nowTime.getMonth() + 1) +
  381. "" +
  382. nowTime.getDate() +
  383. "" +
  384. nowTime.getHours() +
  385. "" +
  386. nowTime.getMinutes();
  387. let fname = ymd + "课酬确认";
  388. link.href = objectUrl;
  389. link.setAttribute("download", fname);
  390. document.body.appendChild(link);
  391. link.click();
  392. }
  393. });
  394. load.endLoading();
  395. })
  396. .catch(error => {
  397. this.$message.error("导出数据失败,请连接管理员");
  398. load.endLoading();
  399. });
  400. })
  401. .catch(() => {});
  402. },
  403. },
  404. filters: {
  405. confirmFilter(val) {
  406. if (val) {
  407. let template = {
  408. 1: "待确认",
  409. 2: "已确认",
  410. 3: "已完成"
  411. };
  412. return template[val];
  413. }
  414. }
  415. }
  416. };
  417. </script>
  418. <style lang='scss' scoped>
  419. .red {
  420. color: red;
  421. }
  422. </style>