index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <div class="app-container">
  3. <div class="head-container" style="margin: 10px 0 10px 0;">
  4. <!-- 搜索 -->
  5. <el-input
  6. v-model="query.title"
  7. clearable
  8. placeholder="请输入标题"
  9. style="width: 200px;"
  10. size="small"
  11. class="filter-item"
  12. />
  13. <el-button class="filter-item" size="small" type="primary" icon="el-icon-search" plain @click="handleFind">搜索</el-button>
  14. </div>
  15. <!--表格渲染-->
  16. <el-table v-loading="loading" :data="data" style="width: 100%;">
  17. <el-table-column label="序号" fixed="left" width="60" align="center">
  18. <template slot-scope="scope">
  19. <span>{{ scope.$index + 1 }}</span>
  20. </template>
  21. </el-table-column>
  22. <el-table-column prop="title" label="标题" align="center" :show-overflow-tooltip="true" />
  23. <el-table-column label="状态" width="100" align="center">
  24. <template slot-scope="scope">
  25. <el-tag v-if="scope.row.tenderStatus ==1">进行中</el-tag>
  26. <el-tag v-if="scope.row.tenderStatus ==2" type="info">已结束</el-tag>
  27. <el-tag v-if="scope.row.tenderStatus ==3" type="danger">已作废</el-tag>
  28. </template>
  29. </el-table-column>
  30. <el-table-column label="结果" width="100" align="center">
  31. <template slot-scope="scope">
  32. <!-- {{scope.row.bidding.status}} -->
  33. <el-tag v-if="scope.row.status == null" type="info">未参与</el-tag>
  34. <el-tag v-if="scope.row.status == 0" type="warning">已提交</el-tag>
  35. <el-tag v-if="scope.row.status == 1" type="success">已中标</el-tag>
  36. <el-tag v-if="scope.row.status == 2" type="danger">未中标</el-tag>
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop="description" width="100" :show-overflow-tooltip="true" label="报价方式" align="center">
  40. <template slot-scope="scope">
  41. <el-tag v-if="scope.row.priceQuotes == 1" color="#5783E6" style="border-color:#5783E6" effect="dark">总价</el-tag>
  42. <el-tag v-if="scope.row.priceQuotes == 2" effect="dark" color="#82C497" style="border-color:#82C497">单价</el-tag>
  43. </template>
  44. </el-table-column>
  45. <el-table-column prop="remarks" label="备注" align="center" :show-overflow-tooltip="true" />
  46. <el-table-column prop="appendix" width="100" label="附件" align="center">
  47. <template slot-scope="scope">
  48. <!-- <el-link type="primary" :href="scope.row.appendix">查看</el-link> -->
  49. <el-button type="text" @click="onLoad(scope.row.appendix)">下载</el-button>
  50. </template>
  51. </el-table-column>
  52. <el-table-column prop="endTime" width="160" label="截止时间" align="center" />
  53. <el-table-column label="操作" width="250" align="center">
  54. <template slot-scope="scope">
  55. <el-button v-if="scope.row.tenderStatus == 1 && scope.row.status == null" slot="reference" type="text" icon="el-icon-edit" @click="handleAdd(scope.row)">投标</el-button>
  56. <el-button v-if="scope.row.tenderStatus == 1 && scope.row.status == 0" slot="reference" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">改标</el-button>
  57. <el-button v-if="scope.row.tenderStatus == 2 || scope.row.tenderStatus == 3" slot="reference" icon="el-icon-view" type="text" @click="handleView(scope.row)">投标详情</el-button>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <!--分页-->
  62. <div class="pagination">
  63. <el-pagination
  64. :current-page.sync="currentPage"
  65. :page-size="pageSize"
  66. layout="total, sizes, prev, pager, next, jumper"
  67. :total="total"
  68. background
  69. @size-change="handleSizeChange"
  70. @current-change="handleCurrentChange"
  71. />
  72. </div>
  73. <!--新增-->
  74. <el-dialog :append-to-body="true" :visible.sync="dialog" :title="isAdd ? '投标' : '修标'" width="50%">
  75. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  76. <el-form-item label="报价方式">
  77. <!-- <el-radio v-model="form.priceQuotes" disabled :label="1">总价</el-radio>
  78. <el-radio v-model="form.priceQuotes" disabled :label="2">单价</el-radio> -->
  79. <el-tag v-if="form.priceQuotes == 1">总价</el-tag>
  80. <el-tag v-if="form.priceQuotes == 2">单价</el-tag>
  81. </el-form-item>
  82. <el-form-item label="报价" prop="price">
  83. <el-input v-model.number="form.price" style="width: 250px;" placeholder="请输入金额"><template slot="append">元</template></el-input>
  84. </el-form-item>
  85. <el-form-item label="备注" prop="remarks">
  86. <el-input
  87. v-model="form.remarks"
  88. type="textarea"
  89. style="width: 370px;"
  90. :autosize="{ minRows: 2, maxRows: 10}"
  91. maxlength="500"
  92. show-word-limit
  93. placeholder="请输入内容"
  94. />
  95. </el-form-item>
  96. <el-form-item label="附件" :required="true" prop="appendix">
  97. <el-upload
  98. class="upload-demo"
  99. drag
  100. :limit="1"
  101. :on-preview="handlePreview"
  102. :on-change="handleChange"
  103. :on-remove="handleRemove"
  104. :before-remove="beforeRemove"
  105. :on-exceed="handleExceed"
  106. :action="BASE_API+'/bidding/upload'"
  107. list-type="text"
  108. :file-list="fileList"
  109. multiple
  110. >
  111. <i class="el-icon-upload" />
  112. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  113. <!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div> -->
  114. </el-upload>
  115. </el-form-item>
  116. </el-form>
  117. <div slot="footer" class="dialog-footer">
  118. <el-button @click="dialog = false">取消</el-button>
  119. <el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
  120. </div>
  121. </el-dialog>
  122. <!-- 详情 -->
  123. <el-dialog :append-to-body="true" :visible.sync="viewDialog" title="投标详情" width="90%" center>
  124. <el-table center :data="Paramdata" style="width: 100%;">
  125. <el-table-column prop="customerName" label="客户名称" align="center" />
  126. <el-table-column label="报价方式" align="center">
  127. <template slot-scope="scope">
  128. <el-tag v-if="scope.row.priceQuotes == 1" color="#5783E6" style="border-color:#5783E6" effect="dark">总价</el-tag>
  129. <el-tag v-if="scope.row.priceQuotes == 2" effect="dark" color="#82C497" style="border-color:#82C497">单价</el-tag>
  130. </template>
  131. </el-table-column>
  132. <el-table-column prop="price" :show-overflow-tooltip="true" label="报价金额" align="center" />
  133. <el-table-column prop="remarks" label="备注" :show-overflow-tooltip="true" align="center" />
  134. <el-table-column prop="appendix" label="附件" align="center" width="100">
  135. <template slot-scope="scope">
  136. <!-- <el-link type="primary" :href="scope.row.appendix">查看</el-link> -->
  137. <el-button type="text" @click="onLoad(scope.row.appendix)">下载</el-button>
  138. </template>
  139. </el-table-column>
  140. <el-table-column prop="createTime" label="投极时间" align="center" />
  141. <el-table-column prop="userName" label=" 投标帐号" align="center" />
  142. <el-table-column prop="status" label=" 投标结果" align="center">
  143. <template slot-scope="scope">
  144. <el-tag v-if="scope.row.status == null" type="info">未参与</el-tag>
  145. <el-tag v-if="scope.row.status == 0" type="warning">已提交</el-tag>
  146. <el-tag v-if="scope.row.status == 1" type="success">已中标</el-tag>
  147. <el-tag v-if="scope.row.status == 2" type="danger">未中标</el-tag>
  148. <!-- <span v-if="scope.row.status == 0">已提交</span>
  149. <span v-if="scope.row.status == 1">中标</span>
  150. <span v-if="scope.row.status == 2">未中标</span> -->
  151. </template>
  152. </el-table-column>
  153. </el-table>
  154. <div class="pagination">
  155. <el-pagination
  156. :current-page.sync="param.page"
  157. :page-size="param.size"
  158. layout="total, sizes, prev, pager, next, jumper"
  159. :total="total1"
  160. :page-sizes="[10, 20, 30, 50]"
  161. background
  162. @size-change="handleSizeChangeParam"
  163. @current-change="handleCurrentChangeParam"
  164. />
  165. </div>
  166. <div slot="footer" class="dialog-footer">
  167. <el-button @click="viewDialog = false">取消</el-button>
  168. <el-button :loading="loading" type="primary" @click="viewDialog = false">确认</el-button>
  169. </div>
  170. </el-dialog>
  171. </div>
  172. </template>
  173. <script>
  174. import { getTableList, getQueryAdd, getQueryEdit, getQueryId } from '@/api/tender'
  175. import { Notification, MessageBox } from 'element-ui'
  176. export default {
  177. data() {
  178. const checkTel = (rule, value, callback) => {
  179. console.log(rule)
  180. console.log(value)
  181. console.log(callback)
  182. if (value == null) {
  183. callback(new Error('请选择附件'))
  184. } else {
  185. callback()
  186. }
  187. }
  188. return {
  189. form: {
  190. },
  191. data: [],
  192. BASE_API: process.env.BASE_API,
  193. dialog: false,
  194. loading: false,
  195. delLoading: false,
  196. viewDialog: false,
  197. isAdd: false,
  198. currentPage: 1,
  199. pageSize: 10,
  200. total: 0, // 总数量
  201. rules: {
  202. price: [
  203. { required: true, message: '报价金额不为空', trigger: 'blur' },
  204. { type: 'number', message: '报价金额必须为数字值' }
  205. ],
  206. appendix: [
  207. // { type:"array",required: true, message: '附件不为空', trigger: 'blur' },
  208. { validator: checkTel, trigger: 'blur' }
  209. ]
  210. },
  211. query: {
  212. type: '',
  213. value: ''
  214. },
  215. fileList: [],
  216. param: {
  217. page: 1,
  218. size: 10
  219. },
  220. total1: 0,
  221. Paramdata: []
  222. }
  223. },
  224. created() {
  225. this.getDictData()
  226. },
  227. methods: {
  228. // 发布时间
  229. oncustom() {
  230. },
  231. // 获取详情
  232. getDictData: function() {
  233. this.loading = true
  234. const params = {
  235. page: this.currentPage,
  236. size: this.pageSize,
  237. title: this.query.title
  238. }
  239. getTableList(params).then(res => {
  240. console.log(res)
  241. this.data = res.data.data.records
  242. this.total = res.data.data.total
  243. this.loading = false
  244. })
  245. },
  246. // 搜索
  247. handleFind: function() {
  248. this.currentPage = 1
  249. this.getDictData()
  250. },
  251. // 文件移除的时候
  252. handleRemove(file, fileList) {
  253. this.form.appendix = ''
  254. console.log(file, fileList, this.fileList, '移出')
  255. },
  256. // 文件状态改变时的钩子,添加文件、上传成功和上传失败时都会被调用
  257. handleChange(file, fileList) {
  258. console.log(file, fileList, '上传')
  259. if (file.response) {
  260. console.log(file.response, 'file')
  261. if (file.response.code == '200') {
  262. this.form.appendix = file.response.data
  263. } else {
  264. Notification.error({
  265. title: file.response.msg,
  266. duration: 1000
  267. })
  268. this.fileList = []
  269. }
  270. }
  271. },
  272. // 点击文件列表中已上传的文件时的钩子
  273. handlePreview(file) {
  274. console.log(file, 'file1')
  275. // window.location.href = file.url
  276. },
  277. handleExceed(files, fileList) {
  278. this.$message.warning(`当前限制选择 1 个附件,本次选择了 ${files.length} 个文件`)
  279. },
  280. beforeRemove(file, fileList) {
  281. return this.$confirm(`确定移除 ${file.name}?`)
  282. },
  283. // 下载
  284. onLoad(row) {
  285. // const params = new URLSearchParams()
  286. // params.append('path', row)
  287. const a = document.createElement('a')
  288. // a.href= /bidding/load
  289. const url = window.location.origin + process.env.BASE_API + '/bidding/load?path=' + encodeURIComponent(row)
  290. a.href = url
  291. a.click()
  292. },
  293. // 字典名称提交动作
  294. doSubmit() {
  295. this.$refs['form'].validate((valid) => {
  296. if (valid) {
  297. if (this.isAdd) {
  298. // 新增字典
  299. this.loading = true
  300. getQueryAdd(this.form).then((res) => {
  301. if (res.data.code === 200) {
  302. this.$message({ message: '操作成功', type: 'success' })
  303. } else {
  304. this.$message({ message: res.data.msg, type: 'error' })
  305. }
  306. this.dialog = false
  307. this.loading = false
  308. this.getDictData()
  309. this.$refs['form'].resetFields()
  310. }).catch(err => {
  311. this.loading = false
  312. })
  313. } else {
  314. // 更新字典
  315. getQueryEdit(this.form).then((res) => {
  316. if (res.data.code === 200) {
  317. this.$message({ message: '操作成功', type: 'success' })
  318. } else {
  319. this.$message({ message: res.data.msg, type: 'error' })
  320. }
  321. this.dialog = false
  322. this.getDictData()
  323. })
  324. }
  325. }
  326. })
  327. },
  328. // 添加字典
  329. handleAdd: function(row) {
  330. this.dialog = true
  331. this.isAdd = true
  332. this.form = {}
  333. this.fileList = []
  334. this.form.tenderId = row.id
  335. this.form.priceQuotes = row.priceQuotes
  336. if (this.$refs['form']) {
  337. this.$refs['form'].resetFields()
  338. }
  339. },
  340. // 编辑字典
  341. handleEdit: function(row) {
  342. if (this.$refs['form']) {
  343. this.$refs['form'].resetFields()
  344. }
  345. this.dialog = true
  346. this.isAdd = false
  347. this.form = row.bidding
  348. this.form.priceQuotes = row.priceQuotes
  349. if (this.form.appendix) {
  350. let name = this.form.appendix.split('bidding/')
  351. name = name.pop()
  352. // let name = data.appendix.replace(/(.*\/)*([^.]+).*/ig, "$2");
  353. this.fileList = [{ name: name, url: this.form.appendix }]
  354. }
  355. },
  356. handleView(row) {
  357. this.param.tenderId = row.id
  358. this.param.page = 1
  359. this.getParam()
  360. this.viewDialog = true
  361. },
  362. getParam() {
  363. const data = this.param
  364. getQueryId(data).then((res) => {
  365. console.log(res.data.data.records, '')
  366. this.Paramdata = res.data.data.records
  367. this.total1 = res.data.data.total
  368. })
  369. },
  370. // 换页
  371. handleCurrentChange: function(val) {
  372. this.currentPage = val
  373. this.getDictData()
  374. },
  375. handleSizeChange(val) {
  376. this.pageSize = val
  377. this.getDictData()
  378. },
  379. handleCurrentChangeParam(val) {
  380. this.param.page = val
  381. this.getParam()
  382. },
  383. handleSizeChangeParam(val) {
  384. this.param.size = val
  385. this.getParam()
  386. }
  387. }
  388. }
  389. </script>
  390. <style scoped>
  391. /* 去掉上传附件时候的过度效果 */
  392. ::v-deep .el-upload-list__item{transition: none !important;}
  393. ::v-deep .el-textarea__inner{
  394. padding-bottom: 36px;
  395. }
  396. </style>