technicalServiceList.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div id="technicalServiceList">
  3. <el-row>
  4. <el-col :span="24">
  5. <el-col :span="24" class="search">
  6. <!--<el-col :span="5">
  7. <span>筛选条件:</span>
  8. <el-select v-model="search.publish_state" placeholder="请选择发布状态">
  9. <el-option label="未发布" value="0"></el-option>
  10. <el-option label="已发布" value="1"></el-option>
  11. </el-select>
  12. </el-col>-->
  13. <el-col :span="4">
  14. <span>输入条件:</span>
  15. <el-input v-model="search.title" :placeholder="placeholder" class="input"></el-input>
  16. </el-col>
  17. <!--<el-col :span="7">
  18. <span>时间选择:</span>
  19. <el-date-picker v-model="search.date" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"> </el-date-picker>
  20. </el-col>-->
  21. <el-col :span="8">
  22. <el-button class="btnSearch" @click="toQuery">查询</el-button>
  23. <el-button class="btnSearch qing" @click="toClear">清空</el-button>
  24. </el-col>
  25. </el-col>
  26. <el-col :span="24">
  27. <el-table
  28. ref="tableData"
  29. :data="tableData"
  30. tooltip-effect="dark"
  31. :default-sort="{ prop: 'date', order: 'descending' }"
  32. style="width: 100%"
  33. @selection-change="handleSelectionChange"
  34. >
  35. <!--<el-table-column type="selection" align="center"> </el-table-column>-->
  36. <el-table-column type="index" label="序号" width="50" align="center"></el-table-column>
  37. <el-table-column property="title" label="名称" align="center"> </el-table-column>
  38. <!--<el-table-column property="service" label="服务" align="center"> </el-table-column>-->
  39. <el-table-column label="图片" align="center">
  40. <template slot-scope="scope">
  41. <span> <el-image v-if="scope.row.image" :src="scope.row.image" style="height:20px;width:20px "
  42. @click="showImage(scope.row.image)"></el-image></span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column property="contact" label="联系人" align="center"> </el-table-column>
  46. <el-table-column property="phone" label="联系电话" align="center"> </el-table-column>
  47. <el-table-column property="email" label="电子邮箱" align="center"> </el-table-column>
  48. <el-table-column label="操作" align="center" width="300px">
  49. <template slot-scope="scope">
  50. <el-button size="mini" type="text" class="edit" icon="el-icon-edit"
  51. @click="$router.push({ path: '/technicalService/detail', query: { id: scope.row.id } })"></el-button>
  52. <el-button size="mini" type="text" class="delete" icon="el-icon-delete"
  53. @click.prevent="deleteRow(scope.row.id)"></el-button>
  54. </template>
  55. </el-table-column>
  56. </el-table>
  57. <el-row>
  58. <el-pagination
  59. @size-change="handleSizeChange"
  60. @current-change="handleCurrentChange"
  61. :current-page.sync="currentPage"
  62. :page-sizes="[10, 20, 30, 40]"
  63. :page-size.sync="limit"
  64. background
  65. layout="total, sizes, prev, pager, next, jumper"
  66. :total="total"
  67. >
  68. </el-pagination>
  69. </el-row>
  70. </el-col>
  71. </el-col>
  72. </el-row>
  73. <el-dialog
  74. :visible.sync="dialogVisible"
  75. width="30%"
  76. >
  77. <el-image :src="elImage" style="height:100%;width:100% "></el-image>
  78. </el-dialog>
  79. </div>
  80. </template>
  81. <script>
  82. export default {
  83. name: 'technicalServiceList',
  84. props: {
  85. tableData: null,
  86. total: null,
  87. type: null,
  88. },
  89. components: {},
  90. data: () => ({
  91. placeholder: '请输入名称',
  92. search: {},
  93. currentPage: 1,
  94. limit: 10,
  95. dialogVisible: false,
  96. elImage: '',
  97. }),
  98. created() {
  99. },
  100. computed: {
  101. },
  102. methods: {
  103. handleSelectionChange(val) {
  104. this.multipleSelection = val;
  105. },
  106. deleteRow(id) {
  107. this.$set(this, `currentPage`, 1);
  108. this.$emit('deleteRow', {id: id, skip: 0, limit: this.limit,type:this.type, ...this.search});
  109. },
  110. handleSizeChange(val) {
  111. this.$set(this, `currentPage`, 1);
  112. this.$emit('select', {skip: 0, limit: val,type:this.type, ...this.search});
  113. },
  114. handleCurrentChange(val) {
  115. this.$emit('select', {skip: (val - 1) * this.limit, limit: this.limit,type:this.type, ...this.search});
  116. },
  117. toQuery() {
  118. this.$set(this, `currentPage`, 1);
  119. this.$emit('select', {skip: 0, limit: this.limit,type:this.type, ...this.search});
  120. },
  121. toClear() {
  122. let keys = Object.keys(this.search);
  123. for (const key of keys) {
  124. this.$set(this.search, `${key}`, '');
  125. }
  126. },
  127. showImage(image) {
  128. if(image){
  129. this.$set(this, `elImage`, image);
  130. this.$set(this, `dialogVisible`, true);
  131. }else{
  132. this.$set(this, `dialogVisible`, false);
  133. }
  134. },
  135. getDate(val) {
  136. if(val){
  137. return this.format(new Date(Number(val)),'yyyy年MM月dd');
  138. }
  139. return '';
  140. },
  141. format(date,formatStr){
  142. formatStr=formatStr.replace(/yyyy|YYYY/,date.getFullYear());
  143. formatStr=formatStr.replace(/MM/,(date.getMonth()+1)>9?(date.getMonth()+1).toString():'0' + (date.getMonth()+1));
  144. formatStr=formatStr.replace(/dd|DD/,date.getDate()>9?date.getDate().toString():'0' + date.getDate());
  145. return formatStr;
  146. },
  147. publish(row){
  148. if(row.publish_state === '1'){
  149. this.$message.error('已发布');
  150. return ;
  151. }
  152. this.$emit('publish', {row:row,skip: (this.currentPage - 1) * this.limit, limit: this.limit, ...this.search});
  153. },
  154. },
  155. };
  156. </script>
  157. <style lang="less" scoped>
  158. /deep/ .el-checkbox__input.is-checked .el-checkbox__inner {
  159. background-color: red;
  160. border-color: red;
  161. }
  162. /deep/ .el-checkbox__input.is-indeterminate .el-checkbox__inner {
  163. background-color: red;
  164. border-color: red;
  165. }
  166. /deep/ .el-table th {
  167. background-color: #f5f6fa;
  168. padding: 8px 0;
  169. }
  170. /deep/ .el-table td {
  171. padding: 11px 0;
  172. }
  173. .other {
  174. color: #f36302;
  175. }
  176. .view {
  177. color: #f36302;
  178. }
  179. .edit {
  180. color: #2ccc02;
  181. }
  182. .delete {
  183. color: #e9021d;
  184. }
  185. /deep/ .el-pagination {
  186. padding: 26px 20px;
  187. }
  188. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  189. background-color: red;
  190. }
  191. .input {
  192. width: 150px;
  193. }
  194. /deep/ .el-input__inner {
  195. height: 35px;
  196. line-height: 35px;
  197. }
  198. .btnSearch {
  199. width: 80px;
  200. height: 34px;
  201. background: rgba(233, 2, 29, 1);
  202. border-radius: 4px;
  203. padding: 0;
  204. color: #fff;
  205. }
  206. .qing {
  207. background: rgba(185, 185, 185, 1);
  208. }
  209. .top {
  210. height: 50px;
  211. margin: 0 0 10px 0;
  212. }
  213. .search {
  214. background: #ffffff;
  215. width: 97%;
  216. height: 35px;
  217. margin: 20px;
  218. margin-left: 0px;
  219. }
  220. .list {
  221. padding: 0 20px;
  222. }
  223. </style>