checkjobRecruitingList.vue 11 KB

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