checkjobRecruitingList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <div class="mainBox">
  3. <!--搜索功能 start------------------------------------------------------------>
  4. <div class="layerBox_search">
  5. <div class="layerBoxLine">
  6. <el-row>
  7. <el-col :span="8">
  8. <div class="searchBox">
  9. <div class="searchTitle">职位名称:</div>
  10. <el-input placeholder="请输入职位名称" autocomplete="off" v-model="getApiData.keyword" />
  11. </div>
  12. </el-col>
  13. </el-row>
  14. </div>
  15. </div>
  16. <div class="layerBoxNoBg">
  17. <div>
  18. <!--el-button type="primary" @click="goCreat">发布职位</el-button-->
  19. </div>
  20. <div>
  21. <el-button @click="clearSearchList">重置</el-button>
  22. <el-button type="primary" @click="getData('search')">搜索</el-button>
  23. </div>
  24. </div>
  25. <!--搜索功能 end------------------------------------------------------------>
  26. <!--表格内容 start------------------------------------------------------------>
  27. <div class="layerBox">
  28. <tableTitle :name="tableDivTitle" />
  29. <el-row>
  30. <template>
  31. <el-table :data="tableData" style="width: 100%">
  32. <el-table-column fixed prop="id" label="编号" width="100"></el-table-column>
  33. <el-table-column prop="title" label="职位名称" width=""></el-table-column>
  34. <el-table-column prop="website_name" label="网站名称" width=""></el-table-column>
  35. <el-table-column prop="user_name" label="发布人" width=""></el-table-column>
  36. <el-table-column prop="created_at" label="创建时间" width=""></el-table-column>
  37. <el-table-column prop="updated_at" label="修改时间" width=""></el-table-column>
  38. <el-table-column prop="status" label="审核状态" width="100">
  39. <template slot-scope="scope">
  40. <span v-if="scope.row.status == 0">待审核</span>
  41. <span v-if="scope.row.status == 1">已审核</span>
  42. <span v-if="scope.row.status == 2">已拒绝</span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column fixed="right" label="操作" width="300" header-align="center">
  46. <template slot-scope="scope">
  47. <div class="listBtnBox">
  48. <div class="listMainBtn" @click="getUpRow(scope.row.id, tableData)"
  49. v-if="creatNews_user_type == '10000'"><i class="el-icon-check"></i>审核</div>
  50. <div class="listDeleteBtn" @click="deleteRow(scope.row.id, tableData)"><i
  51. class="el-icon-delete"></i>删除</div>
  52. <div class="listEditBtn" @click="goEdit(scope.row.id, tableData)"><i
  53. class="el-icon-edit-outline"></i>编辑</div>
  54. </div>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. </template>
  59. </el-row>
  60. </div>
  61. <!--分页 start------------------------------------------------------------>
  62. <div class="alignBox">
  63. <el-row>
  64. <el-col :span="24">
  65. <el-pagination @size-change="handleSizeChange" :current-page="getApiData.page"
  66. @current-change="handleCurrentChange" :page-size="10" layout="total, prev, pager, next, jumper"
  67. :total="allCount"></el-pagination>
  68. </el-col>
  69. </el-row>
  70. </div>
  71. <!--分页 end------------------------------------------------------------>
  72. <!--表格内容 end------------------------------------------------------------>
  73. <!--弹出框1:外部表单弹出框 start------------------------------------------------------------>
  74. <el-dialog title="请输入驳回理由" :visible.sync="examineWindow" :close-on-click-modal="false">
  75. <el-form :model="form" ref="form" :rules="formRules" label-position="left">
  76. <div class="formDiv">
  77. <el-form-item label="驳回原因:" :label-width="formLabelWidth" prop="refuse_reason" class="custom-align-right">
  78. <el-input type="textarea" v-model="form.refuse_reason" class="custom-textarea" placeholder="请输入驳回原因"
  79. :rows="3"></el-input>
  80. </el-form-item>
  81. </div>
  82. </el-form>
  83. <div slot="footer" class="dialog-footer">
  84. <div>
  85. <el-button type="info" @click="examineWindow = false">取消</el-button>
  86. <el-button type="primary" @click="examineToServe">确定</el-button>
  87. </div>
  88. </div>
  89. </el-dialog>
  90. <!--弹出框1:外部表单弹出框 end------------------------------------------------------------>
  91. </div>
  92. </template>
  93. <script>
  94. //表格标题
  95. import tableTitle from './components/tableTitle';
  96. //引入公用样式
  97. import '@/styles/global.less';
  98. import { getUseType } from '@/utils/auth';
  99. export default {
  100. components: {
  101. tableTitle,//表格标题
  102. },
  103. data() {
  104. const validateEmpty = (rule, value, callback) => {
  105. if (value == '') {
  106. callback(new Error('该项不能为空!'))
  107. } else {
  108. callback()
  109. }
  110. }
  111. return {
  112. //1.列表和分页相关 start ------------------------------------------------------------>
  113. tableDivTitle: "职位列表",
  114. tableData: [],//内容
  115. editId: 0,//要修改的网站id
  116. examineWindow: false,//审核窗口
  117. formLabelWidth: "120px",//表单label宽度
  118. getApiData: {
  119. title: "",//职位名称
  120. website_name: "",//网站名称
  121. user_name: "",//发布人
  122. created_at: "",//创建时间
  123. updated_at: "",//修改时间
  124. page: 1,//当前是第几页
  125. page_size: 10,//一共多少条
  126. checkout: 0,//是否审核 0 未审核
  127. },
  128. //提交驳回
  129. form: {
  130. refuse_reason: ""
  131. },
  132. formRules: {
  133. //导航池名称不能为空
  134. refuse_reason: [{ required: true, trigger: 'blur', validator: validateEmpty }],
  135. },
  136. creatNews_user_type: '0',//用户类型
  137. keyword: "",//搜索关键字
  138. allCount: 0,//总条数
  139. //分页相关 end ------------------------------------------------------------>
  140. }
  141. },
  142. methods: {
  143. //1.列表和分页相关 start ------------------------------------------------------------>
  144. //1.1 开始请求列表信息方法
  145. getData(type) {
  146. if (type == "search") {
  147. this.getApiData.page = 1;
  148. }
  149. this.getApiData.checkout = 0;
  150. // this.getApiData.keyword = this.keyword;
  151. this.$store.dispatch('news/getJobRecruitingList', this.getApiData).then(res => {
  152. let data = [];
  153. console.log(res.data.rows)
  154. this.tableData = res.data.rows; //给与内容
  155. this.allCount = res.data.count; //给与总条数
  156. }).catch(() => {
  157. this.$message({
  158. type: 'warning',
  159. message: '网络错误,请重试!'
  160. });
  161. })
  162. },
  163. //1.2 删除内容
  164. deleteRow(id) {
  165. this.$confirm('此操作将永久删除该条数据, 是否继续?', '提示', {
  166. confirmButtonText: '确定',
  167. cancelButtonText: '取消',
  168. type: 'warning'
  169. }).then(() => {
  170. console.log("当前删除:" + id)
  171. this.$store.dispatch('news/delJobRecruiting', { id: id }).then(res => {
  172. this.getData();
  173. this.$message({
  174. type: 'success',
  175. message: '删除成功!'
  176. });
  177. }).catch(() => {
  178. this.$message({
  179. type: 'warning',
  180. message: '网络错误,请重试!'
  181. });
  182. })
  183. }).catch(() => {
  184. this.$message({
  185. type: 'warning',
  186. message: '已取消删除'
  187. });
  188. });
  189. },
  190. //1.4 审核温江
  191. getUpRow(id) {
  192. //设置待审核的id
  193. this.editId = id;
  194. console.log(id)
  195. this.$confirm('将此职位通过审核吗?', '提示', {
  196. confirmButtonText: '通过',
  197. cancelButtonText: '拒绝',
  198. type: 'warning'
  199. }).then(() => {
  200. this.upRow(id, 1)
  201. }).catch(() => {
  202. //输入驳回理由
  203. console.log("驳回")
  204. if (the_reback == "cancel") {
  205. //输入驳回理由
  206. // console.log("驳回" )
  207. this.examineWindow = true;
  208. }
  209. })
  210. },
  211. //1.5 修改文章状态
  212. upRow(id, status) {
  213. let data = {
  214. id: id,
  215. status: status
  216. }
  217. this.$store.dispatch('news/checkJobRecruiting', data).then(res => {
  218. if (res.code == 200) {
  219. this.$message({
  220. type: 'success',
  221. message: '操作成功!'
  222. });
  223. this.getData();
  224. }
  225. })
  226. },
  227. //提交驳回内容
  228. examineToServe(id) {
  229. this.$refs.form.validate(valid => {
  230. if (valid) {
  231. let data = {
  232. id: this.editId,
  233. status: 2,//驳回status
  234. refuse_reason: this.form.refuse_reason
  235. }
  236. this.$store.dispatch('news/checkJobRecruiting', data).then(res => {
  237. if (res.code == 200) {
  238. this.$message({
  239. type: 'success',
  240. message: '操作成功!'
  241. });
  242. this.getData();
  243. this.form.refuse_reason = "";//清空上一次的输入
  244. this.examineWindow = false;
  245. }
  246. })
  247. } else {
  248. this.$message.error("驳回理由不能为空!")
  249. }
  250. })
  251. },
  252. //1.4 列表内容分页
  253. //直接跳转
  254. handleSizeChange(val) {
  255. this.getApiData.page = val;
  256. this.getData();
  257. },
  258. //1.5 点击分页
  259. handleCurrentChange(val) {
  260. this.getApiData.page = val;
  261. this.getData();
  262. },
  263. //1.6 重置按钮
  264. clearSearchList() {
  265. this.getApiData.keyword = "";
  266. this.getApiData.page = 1;
  267. this.getApiData.page_size = 10;
  268. this.getData();
  269. },
  270. //列表和分页相关 end ------------------------------------------------------------>
  271. //2.添加新闻 start ------------------------------------------------------------>
  272. //跳转到职位发布页面
  273. goCreat() {
  274. this.$router.push({
  275. path: '/creatJob',
  276. });
  277. },
  278. goEdit(id) {
  279. let data = {
  280. id: id,
  281. to: "checkjob"
  282. }
  283. this.$router.push({
  284. path: '/creatJob',
  285. query: data
  286. });
  287. }
  288. //添加新闻 end ------------------------------------------------------------>
  289. },
  290. mounted() {
  291. this.creatNews_user_type = getUseType()
  292. //1.获得初始数据
  293. this.getData();
  294. }
  295. }
  296. </script>
  297. <style scoped lang="less"></style>