crafts-management.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <!-- 工艺管理 -->
  2. <template>
  3. <div class="order">
  4. <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
  5. <el-form-item label="工艺名称">
  6. <el-input v-model="dataForm.techName" clearable/>
  7. </el-form-item>
  8. <el-form-item label="产品名称">
  9. <el-input v-model="dataForm.productName" clearable/>
  10. </el-form-item>
  11. <el-form-item label="状态">
  12. <el-select
  13. v-model="dataForm.state"
  14. placeholder="请选择">
  15. <el-option
  16. v-for="item in optionsState"
  17. :key="item.code"
  18. :label="item.value"
  19. :value="item.code">
  20. </el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="创建日期">
  24. <el-date-picker
  25. v-model="dataForm.createTime"
  26. value-format="yyyy-MM-dd"
  27. type="date">
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button @click="queryData()">查询</el-button>
  32. <el-button v-if="isAuth('pro:technology:save')" type="primary" @click="addOrUpdateHandle(0, false)">新建工艺</el-button>
  33. </el-form-item>
  34. </el-form>
  35. <el-table
  36. :data="dataList"
  37. border
  38. v-loading="dataListLoading"
  39. @selection-change="selectionChangeHandle"
  40. style="width: 100%;">
  41. <el-table-column
  42. label="序号"
  43. type="index"
  44. width="50"
  45. align="center">
  46. </el-table-column>
  47. <el-table-column
  48. prop="techCode"
  49. header-align="center"
  50. align="center"
  51. min-width="180"
  52. :show-tooltip-when-overflow="true"
  53. label="工艺编码">
  54. </el-table-column>
  55. <el-table-column
  56. prop="techName"
  57. header-align="center"
  58. align="center"
  59. min-width="180"
  60. :show-overflow-tooltip="true"
  61. label="工艺名称">
  62. </el-table-column>
  63. <el-table-column
  64. prop="techVersion"
  65. header-align="center"
  66. align="center"
  67. min-width="120"
  68. :show-tooltip-when-overflow="true"
  69. label="工艺版本">
  70. </el-table-column>
  71. <el-table-column
  72. prop="productName"
  73. header-align="center"
  74. align="center"
  75. min-width="140"
  76. :show-tooltip-when-overflow="true"
  77. label="产品名称">
  78. </el-table-column>
  79. <el-table-column
  80. prop="createTime"
  81. header-align="center"
  82. align="center"
  83. min-width="160"
  84. label="创建时间">
  85. </el-table-column>
  86. <el-table-column
  87. prop="updateTime"
  88. header-align="center"
  89. align="center"
  90. min-width="160"
  91. label="上次修改时间">
  92. </el-table-column>
  93. <el-table-column
  94. prop="creatorName"
  95. header-align="center"
  96. align="center"
  97. min-width="160"
  98. label="创建人">
  99. </el-table-column>
  100. <el-table-column
  101. prop="notes"
  102. header-align="center"
  103. align="center"
  104. min-width="160"
  105. label="备注">
  106. </el-table-column>
  107. <el-table-column
  108. prop="state"
  109. header-align="center"
  110. align="center"
  111. min-width="100"
  112. label="当前状态">
  113. <template slot-scope="scope">
  114. <span>{{ scope.row.techState === -1 ? '停用' : '启用' }}</span>
  115. </template>
  116. </el-table-column>
  117. <el-table-column
  118. header-align="center"
  119. fixed="right"
  120. align="center"
  121. width="100"
  122. label="操作">
  123. <template slot-scope="scope">
  124. <el-button v-if="isAuth('pro:technology:update') && scope.row.techState === -1" type="text" size="small" @click="addOrUpdateHandle1(scope.row.techId, 0)">启用</el-button>
  125. <el-button v-if="isAuth('pro:technology:update') && scope.row.techState === 0" type="text" size="small" @click="addOrUpdateHandle1(scope.row.techId, -1)">停用</el-button>
  126. <el-button v-if="isAuth('pro:technology:info')" type="text" size="small" @click="detailHandle(scope.row.techId)">查看</el-button>
  127. </template>
  128. </el-table-column>
  129. </el-table>
  130. <el-pagination
  131. @size-change="sizeChangeHandle"
  132. @current-change="currentChangeHandle"
  133. :current-page="pageIndex"
  134. :page-sizes="[10, 20, 50, 100]"
  135. :page-size="pageSize"
  136. :total="totalPage"
  137. layout="total, sizes, prev, pager, next, jumper">
  138. </el-pagination>
  139. <!-- 弹窗, 新增 / 修改 -->
  140. <ctafts-add-or-detail v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getTechnology" />
  141. <detail v-if="detailVisible" ref="detail"/>
  142. </div>
  143. </template>
  144. <script>
  145. import { getTechnology, update } from '@/api/crafts'
  146. import ctaftsAddOrDetail from './ctafts-add-or-detail'
  147. import Detail from './crafts-detail'
  148. export default {
  149. name: 'order',
  150. components: {
  151. ctaftsAddOrDetail, Detail
  152. },
  153. created () {
  154. this.queryData()
  155. },
  156. data () {
  157. return {
  158. addOrUpdateVisible: false,
  159. addOrUpdateVisible1: false,
  160. detailVisible: false,
  161. dataForm: {},
  162. dataList: [],
  163. pageIndex: 1,
  164. pageSize: 10,
  165. totalPage: 0,
  166. dataListLoading: false,
  167. dataListSelections: [],
  168. optionsState: [
  169. {
  170. code: null, value: '全部'
  171. },
  172. {
  173. code: '0', value: '正常'
  174. },
  175. {
  176. code: '-1', value: '停用'
  177. }
  178. ],
  179. optionsCustomer: []
  180. }
  181. },
  182. methods: {
  183. // 查询
  184. queryData () {
  185. this.pageIndex = 1
  186. this.getTechnology()
  187. },
  188. // 获取数据列表
  189. getTechnology () {
  190. this.dataListLoading = true
  191. let params = {
  192. 'current': this.pageIndex,
  193. 'size': this.pageSize,
  194. 'createTimeS': this.dataForm.createTime ? this.dataForm.createTime : null,
  195. 'techState': this.dataForm.state ? this.dataForm.state : null,
  196. 'techName': this.dataForm.techName ? this.dataForm.techName : null,
  197. 'productName': this.dataForm.productName ? this.dataForm.productName : null
  198. }
  199. getTechnology(params).then(({data}) => {
  200. if (data && data.code === '200') {
  201. this.dataList = data.data.records
  202. this.totalPage = Number(data.data.total)
  203. } else {
  204. this.dataList = []
  205. this.totalPage = 0
  206. }
  207. this.dataListLoading = false
  208. })
  209. },
  210. // 每页数
  211. sizeChangeHandle (val) {
  212. this.pageSize = val
  213. this.pageIndex = 1
  214. this.getTechnology()
  215. },
  216. // 当前页
  217. currentChangeHandle (val) {
  218. this.pageIndex = val
  219. this.getTechnology()
  220. },
  221. // 多选
  222. selectionChangeHandle (val) {
  223. this.dataListSelections = val
  224. },
  225. // 新增 / 修改
  226. addOrUpdateHandle (id, display) {
  227. this.addOrUpdateVisible = true
  228. this.$nextTick(() => {
  229. this.$refs.addOrUpdate.init(id, display)
  230. })
  231. },
  232. addOrUpdateHandle1 (id, type) {
  233. update({ techId: id, techState: type }).then(({data}) => {
  234. if (data && data.code === '200') {
  235. this.getTechnology()
  236. }
  237. })
  238. },
  239. // 详情
  240. detailHandle (id) {
  241. this.detailVisible = true
  242. this.$nextTick(() => {
  243. this.$refs.detail.init(id)
  244. })
  245. }
  246. }
  247. }
  248. </script>
  249. <style scoped>
  250. </style>