华西海圻ELN前端工程
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

266 lines
12 KiB

  1. <template>
  2. <div class="app-container study-page">
  3. <div class="content-list" v-show="showType==='list'">
  4. <el-form :model="searchForm" ref="searchForm" :inline="true" class="search-box">
  5. <el-form-item :label="$t('page.business.study.study.name')" prop="name">
  6. <el-input v-model="searchForm.name" :placeholder="$t('form.placeholderInput')" clearable style="width: 150px" @keyup.enter.native="search" />
  7. </el-form-item>
  8. <el-form-item :label="$t('page.business.study.study.sn')" prop="sn">
  9. <el-input v-model="searchForm.sn" :placeholder="$t('form.placeholderInput')" clearable style="width: 150px" @keyup.enter.native="search" />
  10. </el-form-item>
  11. <el-form-item :label="$t('page.business.study.study.dateRange')">
  12. <el-date-picker v-model="daterange" clearable type="daterange" range-separator="-" :start-placeholder="$t('page.business.study.study.startDate')"
  13. :end-placeholder="$t('page.business.study.study.endDate')" value-format="yyyy-MM-dd" @change="search" style="width: 220px" />
  14. </el-form-item>
  15. <el-form-item prop="status" :label="$t('page.business.study.study.status')">
  16. <el-select
  17. v-model="searchForm.status"
  18. :placeholder="$t('form.placeholderSelect')"
  19. clearable
  20. style="width: 100px"
  21. @change="search"
  22. >
  23. <el-option :label="$t('page.business.study.study.statusCg')" :value="1" />
  24. <el-option :label="$t('page.business.study.study.statusSyz')" :value="3" />
  25. <el-option :label="$t('page.business.study.study.statusYsd')" :value="5" />
  26. <el-option :label="$t('page.business.study.study.statusDgd')" :value="7" />
  27. <el-option :label="$t('page.business.study.study.statusGd')" :value="9" />
  28. <el-option :label="$t('page.business.study.study.statusDjd')" :value="10" />
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item prop="leaderName" :label="$t('page.business.study.study.leader')">
  32. <el-input v-model="searchForm.leaderName" :placeholder="$t('form.placeholderInput')" clearable style="width: 150px" @keyup.enter.native="search" />
  33. </el-form-item>
  34. <div class="right-btn">
  35. <el-form-item>
  36. <el-button type="primary" icon="el-icon-search" @click="search">{{ $t('form.search') }}</el-button>
  37. <el-button icon="el-icon-refresh" @click="reset">{{ $t('form.reset') }}</el-button>
  38. </el-form-item>
  39. </div>
  40. </el-form>
  41. <div class="content-box">
  42. <el-row class="add-box">
  43. <el-col>
  44. <el-button type="primary" icon="el-icon-plus" @click="edit(null)" v-hasPermi="['business:study:add']">{{ $t('page.business.study.study.add') }}</el-button>
  45. </el-col>
  46. </el-row>
  47. <el-table v-loading="loading" :data="list">
  48. <el-table-column :label="$t('page.business.study.study.sort')" type="index" width="50" />
  49. <el-table-column :label="$t('page.business.study.study.name')" prop="name" />
  50. <el-table-column :label="$t('page.business.study.study.sn')" prop="sn" />
  51. <el-table-column :label="$t('page.business.study.study.status')" prop="status" width="100">
  52. <template slot-scope="scope">
  53. <span v-if="scope.row.status===1">{{$t('page.business.study.study.statusCg')}}</span>
  54. <span v-if="scope.row.status===3">{{$t('page.business.study.study.statusSyz')}}</span>
  55. <span v-if="scope.row.status===5">{{$t('page.business.study.study.statusYsd')}}</span>
  56. <span v-if="scope.row.status===7">{{$t('page.business.study.study.statusDgd')}}</span>
  57. <span v-if="scope.row.status===9">{{$t('page.business.study.study.statusGd')}}</span>
  58. <span v-if="scope.row.status===10">{{$t('page.business.study.study.statusDjd')}}</span>
  59. </template>
  60. </el-table-column>
  61. <el-table-column :label="$t('page.business.study.study.borrowStatus')" prop="borrowStatus" width="100">
  62. <template slot-scope="scope">
  63. <span v-if="scope.row.borrowStatus===1">{{$t('page.business.study.study.borrowStatusWjy')}}</span>
  64. <span v-if="scope.row.borrowStatus===5">{{$t('page.business.study.study.borrowStatusJyz')}}</span>
  65. <span v-if="scope.row.borrowStatus===10">{{$t('page.business.study.study.borrowStatusDjy')}}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column :label="$t('page.business.study.study.formCount')" align="center" prop="formCount" width="100" />
  69. <el-table-column :label="$t('page.business.study.study.formFinishCount')" align="center" prop="formFinishCount" width="120" />
  70. <el-table-column :label="$t('page.business.study.study.leader')" align="center" prop="leaderName" width="100" />
  71. <el-table-column :label="$t('page.business.study.study.createDate')" align="center" prop="createTime" width="140" />
  72. <el-table-column :label="$t('form.operate')" fixed="right" align="center" width="200">
  73. <template slot-scope="scope">
  74. <!-- 编辑 -->
  75. <el-button type="text" @click="edit(scope.row)" v-hasPermi="['business:study:edit']" v-if="scope.row.status===1 || scope.row.status===3">{{$t('page.business.study.study.edit')}}</el-button>
  76. <!-- 删除 -->
  77. <el-button type="text" @click="del(scope.row)" v-hasPermi="['business:study:remove']" v-if="scope.row.status===1">{{$t('page.business.study.study.delete')}}</el-button>
  78. <!-- 详情 -->
  79. <el-button type="text" @click="detail(scope.row)" v-hasPermi="['business:study:detail']" v-if="scope.row.status===1 || scope.row.status===3 || scope.row.status===5 || (scope.row.status===9 && scope.row.borrowStatus===10)">{{$t('page.business.study.study.detail')}}</el-button>
  80. <!-- 进入试验 -->
  81. <el-button type="text" @click="enter(scope.row)" v-hasPermi="['business:study:enter']" v-if="scope.row.status===3 || scope.row.status===5 || (scope.row.status===9 && scope.row.borrowStatus===10)">{{$t('page.business.study.study.enter')}}</el-button>
  82. <!-- 归档 -->
  83. <el-button type="text" @click="gd(scope.row)" v-hasPermi="['business:study:gd']" v-if="scope.row.status===5">{{$t('page.business.study.study.gd')}}</el-button>
  84. <!-- 解锁 -->
  85. <el-button type="text" @click="jd(scope.row)" v-hasPermi="['business:study:js']" v-if="scope.row.status===5">{{$t('page.business.study.study.js')}}</el-button>
  86. <!-- 解档 -->
  87. <el-button type="text" @click="jd(scope.row)" v-hasPermi="['business:study:jd']" v-if="scope.row.status===9 && scope.row.borrowStatus===1">{{$t('page.business.study.study.jd')}}</el-button>
  88. <!-- 借阅 -->
  89. <el-button type="text" @click="jd(scope.row)" v-hasPermi="['business:study:jy']" v-if="scope.row.status===9 && scope.row.borrowStatus===1">{{$t('page.business.study.study.jy')}}</el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <pagination
  94. v-show="total>0"
  95. :total="total"
  96. :page.sync="searchForm.pageNum"
  97. :limit.sync="searchForm.pageSize"
  98. @pagination="getList"
  99. />
  100. </div>
  101. <!-- <el-dialog :close-on-click-modal="false" :title="infoDialog.title" :visible.sync="infoDialog.visible" width="600px" append-to-body>
  102. <el-form ref="infoDialogForm" :model="infoDialog.formData" :rules="infoDialog.rules" label-width="100px">
  103. <el-row>
  104. <el-col :span="24">
  105. <el-form-item :label="$t('page.business.study.study.name')+':'" prop="name">
  106. <el-input v-model="infoDialog.formData.name" :placeholder="$t('form.placeholderInput')" />
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="24">
  110. <el-form-item :label="$t('page.business.study.study.sn')+':'" prop="sn">
  111. <el-input v-model="infoDialog.formData.sn" :placeholder="$t('form.placeholderInput')" />
  112. </el-form-item>
  113. </el-col>
  114. <el-col :span="24">
  115. <el-form-item :label="$t('page.business.study.study.leader')+':'" prop="leader">
  116. <el-input v-model="infoDialog.formData.leader" :placeholder="$t('form.placeholderInput')" />
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="24">
  120. <el-form-item :label="$t('page.business.study.study.remark')+':'" prop="remark">
  121. <el-input type="textarea" :rows="5" :placeholder="$t('form.placeholderInput')" v-model="infoDialog.formData.remark"> </el-input>
  122. </el-form-item>
  123. </el-col>
  124. </el-row>
  125. </el-form>
  126. <div slot="footer" class="dialog-footer">
  127. <el-button type="primary" @click="save"> </el-button>
  128. <el-button @click="infoDialog.visible = false"> </el-button>
  129. </div>
  130. </el-dialog> -->
  131. </div>
  132. <Edit ref="edit" v-show="showType==='edit'" @cancel="showType='list'" @save="save" />
  133. <Enter ref="enter" v-show="showType==='enter'" @cancel="showType='list'" />
  134. </div>
  135. </template>
  136. <script>
  137. import { study_list,study_info,study_save,study_delete} from "@/api/business/study/study";
  138. import Edit from './comp/edit.vue'
  139. import Enter from './comp/enter.vue'
  140. export default {
  141. name: "Study",
  142. props:{
  143. },
  144. components:{
  145. Edit,
  146. Enter
  147. },
  148. computed: {
  149. },
  150. filters:{
  151. },
  152. data() {
  153. return {
  154. daterange:[],
  155. searchForm: {
  156. pageNum: 1,
  157. pageSize: 10,
  158. sn:'',
  159. name:'',
  160. leaderName:'',
  161. status:'',
  162. startDate:'',
  163. endDate:'',
  164. },
  165. loading: true,
  166. total: 0,
  167. list: [],
  168. //线上类型list,edit。。。。
  169. showType:'list'
  170. };
  171. },
  172. created() {
  173. this.getList();
  174. },
  175. methods: {
  176. getList() {
  177. this.loading = true;
  178. this.searchForm.startDate = this.daterange && this.daterange.length > 0 ? this.daterange[0] : ''
  179. this.searchForm.endDate = this.daterange && this.daterange.length > 1 ? this.daterange[1] : ''
  180. study_list(this.searchForm).then(response => {
  181. this.list = response.rows;
  182. this.total = response.total;
  183. }).finally(()=>{
  184. this.loading = false;
  185. })
  186. },
  187. search() {
  188. this.searchForm.pageNum = 1;
  189. this.getList();
  190. },
  191. reset(){
  192. this.searchForm = {
  193. pageNum: 1,
  194. pageSize: 10,
  195. sn:'',
  196. name:'',
  197. leaderName:'',
  198. status:'',
  199. startDate:'',
  200. endDate:'',
  201. }
  202. this.daterange = []
  203. this.search()
  204. },
  205. edit(row) {
  206. this.showType = 'edit'
  207. this.$refs.edit.edit(row)
  208. },
  209. save() {
  210. this.showType = 'list'
  211. this.getList()
  212. },
  213. del(row) {
  214. this.$modal.confirm(this.$t('form.confirmDelete')).then(function() {
  215. this.$modal.loading()
  216. study_delete({ id: row.id}).then(() => {
  217. this.getList()
  218. })
  219. .finally(() => {
  220. this.$modal.closeLoading()
  221. })
  222. }).catch(() => {})
  223. },
  224. enter(row){
  225. this.showType = 'enter'
  226. this.$refs.enter.show(row)
  227. },
  228. }
  229. };
  230. </script>
  231. <style lang="scss" scoped>
  232. .study-page{
  233. background: #f5f5f5;
  234. padding: 0;
  235. .content-list{
  236. .search-box{
  237. background: #fff;
  238. padding: 20px 20px 2px 20px;
  239. margin-bottom: 10px;
  240. .right-btn{
  241. text-align:right
  242. }
  243. }
  244. .content-box{
  245. background: #fff;
  246. padding: 20px;
  247. .add-box{
  248. margin-bottom: 10px;
  249. }
  250. }
  251. }
  252. }
  253. </style>