project-product.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <!-- 工种管理 -->
  2. <template>
  3. <div class="work-type">
  4. <template v-if="!addOrUpdateVisible && !detailVisible && !assignVisible && !selectionVisible && !noticeChangeVisible">
  5. <el-form :inline="true" :model="dataForm" @keyup.enter.native="queryData()">
  6. <el-form-item label="项目名称">
  7. <el-input v-model="dataForm.projectName" placeholder="" clearable/>
  8. </el-form-item>
  9. <el-form-item label="任务号">
  10. <el-input v-model="dataForm.orderCode" placeholder="" clearable/>
  11. </el-form-item>
  12. <el-form-item label="责任人">
  13. <el-input v-model="dataForm.responsibilityPerson" placeholder="" clearable/>
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button @click="queryData()">查询</el-button>
  17. <el-button @click="noticeSettingHandle(null, false)">通知设置</el-button>
  18. </el-form-item>
  19. </el-form>
  20. <el-table
  21. :data="dataList"
  22. border
  23. v-loading="dataListLoading"
  24. style="width: 100%;">
  25. <el-table-column
  26. label="序号"
  27. type="index"
  28. width="100"
  29. align="center">
  30. </el-table-column>
  31. <el-table-column
  32. prop="projectName"
  33. header-align="center"
  34. align="center"
  35. min-width="140"
  36. :show-tooltip-when-overflow="true"
  37. label="项目名称">
  38. </el-table-column>
  39. <el-table-column
  40. prop="orderCode"
  41. header-align="center"
  42. align="center"
  43. min-width="160"
  44. :show-tooltip-when-overflow="true"
  45. label="任务号">
  46. </el-table-column>
  47. <el-table-column
  48. prop="productName"
  49. header-align="center"
  50. align="center"
  51. min-width="160"
  52. :show-tooltip-when-overflow="true"
  53. label="物料名称">
  54. </el-table-column>
  55. <el-table-column
  56. prop="state"
  57. header-align="center"
  58. align="center"
  59. min-width="160"
  60. :show-tooltip-when-overflow="true"
  61. :formatter="formatState"
  62. label="状态">
  63. </el-table-column>
  64. <el-table-column
  65. prop="deliveryDate"
  66. header-align="center"
  67. align="center"
  68. min-width="160"
  69. :show-tooltip-when-overflow="true"
  70. label="合同交期">
  71. </el-table-column>
  72. <el-table-column
  73. fixed="right"
  74. header-align="center"
  75. align="center"
  76. width="220"
  77. label="操作">
  78. <template slot-scope="scope">
  79. <el-button type="text" size="small" @click="detailHandle(scope.row)">查看</el-button>
  80. <el-button type="text" size="small" @click="assignHandle(scope.row)">分派</el-button>
  81. <el-button type="text" size="small" @click="selectionHandle(scope.row, false)">选择清单</el-button>
  82. <el-button type="text" size="small" @click="importHandle(scope.row)">导入</el-button>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. <el-pagination
  87. @size-change="sizeChangeHandle"
  88. @current-change="currentChangeHandle"
  89. :current-page="pageIndex"
  90. :page-sizes="[10, 20, 50, 100]"
  91. :page-size="pageSize"
  92. :total="totalPage"
  93. layout="total, sizes, prev, pager, next, jumper">
  94. </el-pagination>
  95. </template>
  96. <!-- 弹窗, 新增 / 修改 -->
  97. <detail v-if="detailVisible" ref="detail" @onChose="onChose"/>
  98. <assign v-if="assignVisible" ref="assign" @onChose="onChose"/>
  99. <selection v-if="selectionVisible" ref="selection" @onChose="onChose"/>
  100. <notice-change v-if="noticeChangeVisible" ref="noticeChange" @onChose="onChose"/>
  101. <el-dialog title="导入" :visible.sync="importVisible">
  102. <el-upload
  103. class="upload-demo"
  104. ref="upload"
  105. :on-remove="handleRemove"
  106. action="#"
  107. :limit="1"
  108. :file-list="fileList"
  109. :auto-upload="false"
  110. :http-request="handleUpload"
  111. v-loading="importLoading"
  112. >
  113. <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
  114. <el-button size="small" type="success" @click="submitUpload" >开始上传</el-button>
  115. </el-upload>
  116. </el-dialog>
  117. </div>
  118. </template>
  119. <script>
  120. import Detail from './project-product-detail'
  121. import Assign from './project-product-assign'
  122. import Selection from './project-product-selection'
  123. import NoticeChange from './project-product-notice-change-setting'
  124. export default {
  125. name: 'file-manage',
  126. components: {
  127. Detail, Assign, Selection, NoticeChange
  128. },
  129. data () {
  130. return {
  131. addOrUpdateVisible: false,
  132. detailVisible: false,
  133. assignVisible: false,
  134. selectionVisible: false,
  135. importVisible: false,
  136. noticeChangeVisible: false,
  137. dataForm: {},
  138. dataList: [],
  139. pageIndex: 1,
  140. pageSize: 10,
  141. totalPage: 0,
  142. dataListLoading: false,
  143. dataListSelections: [],
  144. optionsLevel: [],
  145. importLoading: false,
  146. importData: {},
  147. fileList: [],
  148. stateOption: [
  149. {label: '待处理', value: '1'},
  150. {label: '已处理', value: '2'}
  151. ]
  152. }
  153. },
  154. created () {
  155. this.getDataList()
  156. },
  157. methods: {
  158. onChose () {
  159. this.addOrUpdateVisible = false
  160. this.detailVisible = false
  161. this.assignVisible = false
  162. this.selectionVisible = false
  163. this.noticeChangeVisible = false
  164. },
  165. // 查询
  166. queryData () {
  167. this.pageIndex = 1
  168. this.getDataList()
  169. },
  170. // 获取数据列表
  171. getDataList () {
  172. this.dataListLoading = true
  173. this.addOrUpdateVisible = false
  174. this.$http({
  175. url: this.$http.adornUrl(`/biz-service/projProduct/list`),
  176. method: 'get',
  177. params: this.$http.adornParams({
  178. 'current': this.pageIndex,
  179. 'size': this.pageSize,
  180. 'orderCode': this.dataForm.orderCode,
  181. 'projectName': this.dataForm.projectName,
  182. 'responsibilityPerson': this.dataForm.responsibilityPerson
  183. })
  184. }).then(({data}) => {
  185. this.dataListLoading = false
  186. if (data && data.code === '200') {
  187. this.dataList = data.data.records
  188. this.totalPage = Number(data.data.total)
  189. } else {
  190. this.dataList = []
  191. this.totalPage = 0
  192. }
  193. })
  194. },
  195. // 每页数
  196. sizeChangeHandle (val) {
  197. this.pageSize = val
  198. this.pageIndex = 1
  199. this.getDataList()
  200. },
  201. // 当前页
  202. currentChangeHandle (val) {
  203. this.pageIndex = val
  204. this.getDataList()
  205. },
  206. // 多选
  207. selectionChangeHandle (val) {
  208. this.dataListSelections = val
  209. },
  210. // 新增 / 修改
  211. addOrUpdateHandle (item, disable) {
  212. this.addOrUpdateVisible = true
  213. this.$nextTick(() => {
  214. this.$refs.addOrUpdate.init(item, disable)
  215. })
  216. },
  217. // 详情
  218. detailHandle (item) {
  219. this.detailVisible = true
  220. item.stateStr = this.getStateStr(item.state)
  221. this.$nextTick(() => {
  222. this.$refs.detail.init(item)
  223. })
  224. },
  225. assignHandle (item) {
  226. this.assignVisible = true
  227. this.$nextTick(() => {
  228. this.$refs.assign.init(item)
  229. })
  230. },
  231. selectionHandle (item) {
  232. this.selectionVisible = true
  233. this.$nextTick(() => {
  234. this.$refs.selection.init(item)
  235. })
  236. },
  237. importHandle (item) {
  238. this.importVisible = true
  239. this.importData = item
  240. },
  241. // 上传
  242. submitUpload () {
  243. this.$refs.upload.submit()
  244. },
  245. // 移除
  246. handleRemove (file, fileList) {
  247. this.$emit('input', fileList)
  248. },
  249. handleUpload (file) {
  250. if (file == null) {
  251. this.$message.error('请上传文件')
  252. return
  253. }
  254. this.importLoading = true
  255. const formData = new FormData()
  256. formData.append('importFile', file.file)
  257. formData.append('productTechnologyId', this.importData.productTechnologyId)
  258. this.$http({
  259. url: this.$http.adornUrl(`/biz-service/projProduct/importExcel`),
  260. method: 'POST',
  261. data: formData,
  262. timeout: 0
  263. }).then(({data}) => {
  264. this.importLoading = false
  265. if (data && data.code === '200') {
  266. this.$message({
  267. message: '导入成功',
  268. type: 'success',
  269. duration: 1500,
  270. onClose: () => {
  271. this.importVisible = false
  272. }
  273. })
  274. } else {
  275. this.$message.error(data.msg)
  276. }
  277. })
  278. },
  279. formatState (row) {
  280. if (!row.state) return ''
  281. return this.getStateStr(row.state)
  282. },
  283. getStateStr(state){
  284. let option = this.stateOption.find(t => t.value === state)
  285. if (option != null) {
  286. return option.label
  287. }
  288. return ''
  289. },
  290. noticeSettingHandle(){
  291. this.noticeChangeVisible = true
  292. this.$nextTick(() => {
  293. this.$refs.noticeChange.init()
  294. })
  295. }
  296. }
  297. }
  298. </script>
  299. <style scoped>
  300. </style>