华西海圻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.

392 lines
15 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('page.business.study.study.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"><span class="status-circle cg"></span>{{$t('page.business.study.study.statusCg')}}</span>
  54. <span v-if="scope.row.status===3"><span class="status-circle syz"></span>{{$t('page.business.study.study.statusSyz')}}</span>
  55. <span v-if="scope.row.status===5"><span class="status-circle ysd"></span>{{$t('page.business.study.study.statusYsd')}}</span>
  56. <span v-if="scope.row.status===7"><span class="status-circle"></span>{{$t('page.business.study.study.statusDgd')}}</span>
  57. <span v-if="scope.row.status===9"><span class="status-circle"></span>{{$t('page.business.study.study.statusGd')}}</span>
  58. <span v-if="scope.row.status===10"><span class="status-circle"></span>{{$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.leader==userId || checkRole(['TFM'])) && (scope.row.status===1 || scope.row.status===3)">{{$t('page.business.study.study.edit')}}</el-button>
  76. <!-- 删除 -->
  77. <el-button type="text" style="color:#E22626" @click="del(scope.row)" v-hasPermi="['business:study:remove']" v-if="(scope.row.leader==userId || checkRole(['TFM'])) && 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.leader==userId || checkRole(['TFM'])) && scope.row.status===5">{{$t('page.business.study.study.gd')}}</el-button>
  84. <!-- 解锁 -->
  85. <el-button type="text" @click="js(scope.row)" v-hasPermi="['business:study:js']" v-if="(scope.row.leader==userId || checkRole(['TFM'])) && 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.leader==userId || checkRole(['TFM'])) && scope.row.status===9 && scope.row.borrowStatus===1">{{$t('page.business.study.study.jd')}}</el-button>
  88. <!-- 借阅 -->
  89. <el-button type="text" @click="jy(scope.row)" v-hasPermi="['business:study:jy']" v-if="(scope.row.leader==userId || checkRole(['TFM'])) && 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. <Detail ref="detail" v-show="showType==='detail'" @cancel="showType='list'" />
  135. <Sign ref="signRef" @callback="doSign" />
  136. </div>
  137. </template>
  138. <script>
  139. import { checkPermi, checkRole } from "@/utils/permission";
  140. import { study_list,study_delete,study_gd,study_js,study_jd,study_jy} from "@/api/business/study/study";
  141. import Edit from './comp/edit.vue'
  142. import Enter from './comp/enter.vue'
  143. import Detail from './comp/detail.vue'
  144. import Sign from './comp/sign.vue'
  145. export default {
  146. name: "Study",
  147. props:{
  148. },
  149. components:{
  150. Edit,
  151. Enter,
  152. Detail,
  153. Sign
  154. },
  155. computed: {
  156. },
  157. filters:{
  158. },
  159. data() {
  160. return {
  161. userId:this.$store.getters.id,
  162. daterange:[],
  163. searchForm: {
  164. pageNum: 1,
  165. pageSize: 10,
  166. sn:'',
  167. name:'',
  168. leaderName:'',
  169. status:'',
  170. startDate:'',
  171. endDate:'',
  172. },
  173. loading: true,
  174. total: 0,
  175. list: [],
  176. //线上类型list,edit。。。。
  177. showType:'list',
  178. operate:'',
  179. operateRow:{},
  180. };
  181. },
  182. created() {
  183. this.getList();
  184. },
  185. methods: {
  186. checkPermi,
  187. checkRole,
  188. getList() {
  189. this.loading = true;
  190. this.searchForm.startDate = this.daterange && this.daterange.length > 0 ? this.daterange[0] : ''
  191. this.searchForm.endDate = this.daterange && this.daterange.length > 1 ? this.daterange[1] : ''
  192. study_list(this.searchForm).then(response => {
  193. this.list = response.rows;
  194. this.total = response.total;
  195. }).finally(()=>{
  196. this.loading = false;
  197. })
  198. },
  199. search() {
  200. this.searchForm.pageNum = 1;
  201. this.getList();
  202. },
  203. reset(){
  204. this.searchForm = {
  205. pageNum: 1,
  206. pageSize: 10,
  207. sn:'',
  208. name:'',
  209. leaderName:'',
  210. status:'',
  211. startDate:'',
  212. endDate:'',
  213. }
  214. this.daterange = []
  215. this.search()
  216. },
  217. edit(row) {
  218. this.showType = 'edit'
  219. this.$refs.edit.edit(row)
  220. },
  221. save() {
  222. this.showType = 'list'
  223. this.getList()
  224. },
  225. enter(row){
  226. // const params = row
  227. // this.$tab.openPage("进入试验", '/study/enter/index/' + row.id, params)
  228. this.showType = 'enter'
  229. this.$refs.enter.show(row)
  230. },
  231. detail(row){
  232. this.showType = 'detail'
  233. this.$refs.detail.show(row)
  234. },
  235. del(row) {
  236. this.operate = 'del'
  237. this.operateRow = row
  238. this.$refs.signRef.show(this.$t('page.business.study.study.scsy'),'删除试验')
  239. },
  240. doDel(signInfo) {
  241. this.$modal.loading()
  242. let postData = {
  243. study:this.operateRow,
  244. sign:signInfo
  245. }
  246. study_delete(postData).then(() => {
  247. this.$refs.signRef.cancel()
  248. this.getList()
  249. })
  250. .finally(() => {
  251. this.$modal.closeLoading()
  252. })
  253. },
  254. gd(row) {
  255. this.operate = 'gd'
  256. this.operateRow = row
  257. this.$refs.signRef.show(this.$t('page.business.study.study.sqgd'),'申请归档')
  258. },
  259. doGd(signInfo) {
  260. this.$modal.loading()
  261. let postData = {
  262. study:this.operateRow,
  263. sign:signInfo
  264. }
  265. study_gd(postData).then(() => {
  266. this.$refs.signRef.cancel()
  267. this.getList()
  268. })
  269. .finally(() => {
  270. this.$modal.closeLoading()
  271. })
  272. },
  273. js(row) {
  274. this.operate = 'js'
  275. this.operateRow = row
  276. this.$refs.signRef.show(this.$t('page.business.study.study.jssy'),'解锁试验')
  277. },
  278. doJs(signInfo) {
  279. this.$modal.loading()
  280. let postData = {
  281. study:this.operateRow,
  282. sign:signInfo
  283. }
  284. study_js(postData).then(() => {
  285. this.$refs.signRef.cancel()
  286. this.getList()
  287. })
  288. .finally(() => {
  289. this.$modal.closeLoading()
  290. })
  291. },
  292. jd(row) {
  293. this.operate = 'jd'
  294. this.operateRow = row
  295. this.$refs.signRef.show(this.$t('page.business.study.study.sqjd'),'申请解档')
  296. },
  297. doJd(signInfo) {
  298. this.$modal.loading()
  299. let postData = {
  300. study:this.operateRow,
  301. sign:signInfo
  302. }
  303. study_jd(postData).then(() => {
  304. this.$refs.signRef.cancel()
  305. this.getList()
  306. })
  307. .finally(() => {
  308. this.$modal.closeLoading()
  309. })
  310. },
  311. jy(row) {
  312. this.operate = 'jy'
  313. this.operateRow = row
  314. this.$refs.signRef.show(this.$t('page.business.study.study.sqjy'),'申请借阅',true)
  315. },
  316. doJy(signInfo) {
  317. this.$modal.loading()
  318. let postData = {
  319. study:this.operateRow,
  320. sign:signInfo
  321. }
  322. study_jy(postData).then(() => {
  323. this.$refs.signRef.cancel()
  324. this.getList()
  325. })
  326. .finally(() => {
  327. this.$modal.closeLoading()
  328. })
  329. },
  330. doSign(val){
  331. if(this.operate==='del'){
  332. this.doDel(val)
  333. }
  334. if(this.operate==='gd'){
  335. this.doGd(val)
  336. }
  337. if(this.operate==='js'){
  338. this.doJs(val)
  339. }
  340. if(this.operate==='jd'){
  341. this.doJd(val)
  342. }
  343. if(this.operate==='jy'){
  344. this.doJy(val)
  345. }
  346. },
  347. }
  348. };
  349. </script>
  350. <style lang="scss" scoped>
  351. .study-page{
  352. background: #f5f5f5;
  353. padding: 0;
  354. .content-list{
  355. .search-box{
  356. background: #fff;
  357. padding: 20px 20px 2px 20px;
  358. margin-bottom: 10px;
  359. .right-btn{
  360. text-align:right
  361. }
  362. }
  363. .content-box{
  364. background: #fff;
  365. padding: 20px;
  366. .add-box{
  367. margin-bottom: 10px;
  368. }
  369. }
  370. }
  371. }
  372. </style>