setPlan.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <div class="project-setPlan" v-loading="loading">
  3. <div class="project-setPlan-main">
  4. <div class="project-setPlan-title">商品要求</div>
  5. <div class="project-setPlan-ask-table">
  6. <template v-if="ladder">
  7. <el-table
  8. :data="ladder"
  9. :size="'mini'"
  10. border
  11. stripe
  12. style="width: 100%"
  13. >
  14. <el-table-column prop="good_type" label="商品类型" width="80px">
  15. <template slot-scope="scope">
  16. <el-tag
  17. :size="'mini'"
  18. v-text="
  19. (
  20. statusOptions.find(
  21. (item) => item.value == scope.row.good_type
  22. ) || {}
  23. ).label || '--'
  24. "
  25. ></el-tag
  26. ></template>
  27. </el-table-column>
  28. <el-table-column prop="budget_price" label="预算单价" width="110" />
  29. <el-table-column prop="num" label="购买数量" width="110" />
  30. <el-table-column prop="cat_name" label="商品分类" />
  31. <el-table-column prop="good_img" label="图片" width="50">
  32. <template slot-scope="scope">
  33. <div
  34. v-if="scope.row.good_img"
  35. style="width: 20px; height: 20px"
  36. class="hover"
  37. v-viewer
  38. >
  39. <img
  40. :src="scope.row.good_img"
  41. style="display: inline-block; width: 100%; height: 100%"
  42. alt=""
  43. />
  44. </div>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop="good_name" label="商品名称" />
  48. </el-table>
  49. </template>
  50. </div>
  51. <div class="project-setPlan-title">客户反馈商品情况</div>
  52. <div class="project-setPlan-backGood-table">
  53. <template v-if="tableData">
  54. <ex-table
  55. v-loading="loading"
  56. :table="table"
  57. :data="tableData"
  58. :columns="columns"
  59. :page="pageInfo"
  60. :size="'mini'"
  61. @page-curr-change="handlePageChange($event)"
  62. @page-size-change="handleSizeChange($event)"
  63. @screen-reset="
  64. pageInfo.curr = 1;
  65. page = 1;
  66. searchList();
  67. "
  68. @screen-submit="
  69. pageInfo.curr = 1;
  70. page = 1;
  71. searchList();
  72. "
  73. >
  74. <template #operation="{ scope }">
  75. <el-tooltip
  76. effect="dark"
  77. content="删除"
  78. placement="top"
  79. v-if="scope.row.data_source === '1'"
  80. >
  81. <i
  82. class="el-icon-delete tb-icon"
  83. @click="deleteId(scope.row.id)"
  84. ></i>
  85. </el-tooltip>
  86. </template>
  87. </ex-table>
  88. </template>
  89. </div>
  90. </div>
  91. </div>
  92. </template>
  93. <script>
  94. import asyncRequest from "@/apis/service/sellOut/project";
  95. import resToken from "@/mixins/resToken";
  96. import columnsForm from "./columnsForm";
  97. export default {
  98. name: "setPlan",
  99. props: ["showModel", "sitem", "id", "type"],
  100. mixins: [resToken],
  101. watch: {
  102. // showModel: function (val) {
  103. // this.showModelThis = val;
  104. // if (val) {
  105. // this.initForm();
  106. // }
  107. // },
  108. // showModelThis(val) {
  109. // if (!val) {
  110. // this.$emit("cancel");
  111. // }
  112. // },
  113. },
  114. data() {
  115. return {
  116. showModel: false,
  117. searchItem: {},
  118. loading: false,
  119. ladder: [],
  120. // allList: [],
  121. projectNo: "",
  122. statusOptions: [
  123. { value: "1", label: "竞品" },
  124. { value: "2", label: "竞聘" },
  125. ],
  126. table: {
  127. stripe: true,
  128. border: true,
  129. // _defaultHeader_: ["setcol"],
  130. },
  131. // 表格 - 列参数
  132. columns: columnsForm,
  133. };
  134. },
  135. mounted() {
  136. this.initForm();
  137. },
  138. methods: {
  139. //初始化整个组件
  140. async initForm() {
  141. this.loading = true;
  142. await this.initListData();
  143. this.loading = false;
  144. },
  145. async resetFormData() {
  146. this.pageInfo = {
  147. size: 15,
  148. curr: 1,
  149. total: 0,
  150. };
  151. this.loading = true;
  152. this.tableData = [];
  153. await this.searchList();
  154. },
  155. //初始化整个组件
  156. async initListData() {
  157. console.log(this.sitem);
  158. const { projectNo, ladder } = this.sitem;
  159. this.projectNo = projectNo;
  160. this.ladder = JSON.parse(JSON.stringify(ladder));
  161. this.pageInfo = {
  162. size: 15,
  163. curr: 1,
  164. total: 0,
  165. };
  166. this.tableData = [];
  167. await this.searchList()
  168. },
  169. //页数选择
  170. async handlePageChange(e) {
  171. this.pageInfo.curr = e;
  172. await this.searchList();
  173. },
  174. //页面条数选择
  175. async handleSizeChange(e) {
  176. this.pageInfo.curr = 1;
  177. this.pageInfo.size = e;
  178. await this.searchList();
  179. },
  180. async searchList() {
  181. const { size, curr } = this.pageInfo;
  182. this.loading = true;
  183. let model = {
  184. page: curr,
  185. size: size,
  186. zxNo: "",
  187. infoNo: "",
  188. bidNo: "",
  189. status: "1",
  190. pgNo: "",
  191. projectNo: this.projectNo,
  192. };
  193. const { code, data } = await asyncRequest.back_good_list(model);
  194. if (code === 0) {
  195. const { list, count } = data;
  196. this.tableData = list;
  197. this.tableData.map((v) => {
  198. v.class_cat = "";
  199. if (v.can && v.can.length > 0) {
  200. v.can.forEach((x, i) => {
  201. v.class_cat += i === 0 ? x.name : "/" + x.name;
  202. });
  203. }
  204. return v;
  205. });
  206. this.pageInfo.total = Number(count);
  207. } else if (code >= 100 && code <= 104) {
  208. await this.logout();
  209. } else {
  210. this.tableData = [];
  211. this.pageInfo.total = 0;
  212. }
  213. this.loading = false;
  214. },
  215. },
  216. };
  217. </script>
  218. <style lang="scss" scoped>
  219. .project-setPlan {
  220. box-sizing: border-box;
  221. width: 100%;
  222. .project-setPlan-main {
  223. padding: 2px 16px 16px 16px;
  224. // background: #fefefe;
  225. border-radius: 5px;
  226. overflow: hidden;
  227. border: 1px solid #f0f0f0;
  228. margin: 0 0 16px 0;
  229. .project-setPlan-title {
  230. height: 48px;
  231. line-height: 48px;
  232. color: #676767;
  233. }
  234. }
  235. }
  236. </style>