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

391 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="$i18n.locale === 'zh_CN'?'leaderName':'leaderNameEn'" 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. this.$tab.openPage("进入试验", '/study/enter/' + row.id)
  227. // this.showType = 'enter'
  228. // this.$refs.enter.show(row)
  229. },
  230. detail(row){
  231. this.showType = 'detail'
  232. this.$refs.detail.show(row)
  233. },
  234. del(row) {
  235. this.operate = 'del'
  236. this.operateRow = row
  237. this.$refs.signRef.show(this.$t('page.business.study.study.scsy'),this.$t('page.business.study.study.scsy'))
  238. },
  239. doDel(signInfo) {
  240. this.$modal.loading()
  241. let postData = {
  242. study:this.operateRow,
  243. sign:signInfo
  244. }
  245. study_delete(postData).then(() => {
  246. this.$refs.signRef.cancel()
  247. this.getList()
  248. })
  249. .finally(() => {
  250. this.$modal.closeLoading()
  251. })
  252. },
  253. gd(row) {
  254. this.operate = 'gd'
  255. this.operateRow = row
  256. this.$refs.signRef.show(this.$t('page.business.study.study.sqgd'),this.$t('page.business.study.study.sqgd'))
  257. },
  258. doGd(signInfo) {
  259. this.$modal.loading()
  260. let postData = {
  261. study:this.operateRow,
  262. sign:signInfo
  263. }
  264. study_gd(postData).then(() => {
  265. this.$refs.signRef.cancel()
  266. this.getList()
  267. })
  268. .finally(() => {
  269. this.$modal.closeLoading()
  270. })
  271. },
  272. js(row) {
  273. this.operate = 'js'
  274. this.operateRow = row
  275. this.$refs.signRef.show(this.$t('page.business.study.study.jssy'),this.$t('page.business.study.study.jssy'))
  276. },
  277. doJs(signInfo) {
  278. this.$modal.loading()
  279. let postData = {
  280. study:this.operateRow,
  281. sign:signInfo
  282. }
  283. study_js(postData).then(() => {
  284. this.$refs.signRef.cancel()
  285. this.getList()
  286. })
  287. .finally(() => {
  288. this.$modal.closeLoading()
  289. })
  290. },
  291. jd(row) {
  292. this.operate = 'jd'
  293. this.operateRow = row
  294. this.$refs.signRef.show(this.$t('page.business.study.study.sqjd'),this.$t('page.business.study.study.sqjd'))
  295. },
  296. doJd(signInfo) {
  297. this.$modal.loading()
  298. let postData = {
  299. study:this.operateRow,
  300. sign:signInfo
  301. }
  302. study_jd(postData).then(() => {
  303. this.$refs.signRef.cancel()
  304. this.getList()
  305. })
  306. .finally(() => {
  307. this.$modal.closeLoading()
  308. })
  309. },
  310. jy(row) {
  311. this.operate = 'jy'
  312. this.operateRow = row
  313. this.$refs.signRef.show(this.$t('page.business.study.study.sqjy'),this.$t('page.business.study.study.sqjy'),true)
  314. },
  315. doJy(signInfo) {
  316. this.$modal.loading()
  317. let postData = {
  318. study:this.operateRow,
  319. sign:signInfo
  320. }
  321. study_jy(postData).then(() => {
  322. this.$refs.signRef.cancel()
  323. this.getList()
  324. })
  325. .finally(() => {
  326. this.$modal.closeLoading()
  327. })
  328. },
  329. doSign(val){
  330. if(this.operate==='del'){
  331. this.doDel(val)
  332. }
  333. if(this.operate==='gd'){
  334. this.doGd(val)
  335. }
  336. if(this.operate==='js'){
  337. this.doJs(val)
  338. }
  339. if(this.operate==='jd'){
  340. this.doJd(val)
  341. }
  342. if(this.operate==='jy'){
  343. this.doJy(val)
  344. }
  345. },
  346. }
  347. };
  348. </script>
  349. <style lang="scss" scoped>
  350. .study-page{
  351. background: #f5f5f5;
  352. padding: 0;
  353. .content-list{
  354. .search-box{
  355. background: #fff;
  356. padding: 20px 20px 2px 20px;
  357. margin-bottom: 10px;
  358. .right-btn{
  359. text-align:right
  360. }
  361. }
  362. .content-box{
  363. background: #fff;
  364. padding: 20px;
  365. .add-box{
  366. margin-bottom: 10px;
  367. }
  368. }
  369. }
  370. }
  371. </style>