index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <div class="page-container column-container">
  3. <!-- 搜索区 -->
  4. <el-form
  5. class="list-search-container"
  6. :model="queryParams"
  7. ref="queryRef"
  8. :inline="true"
  9. >
  10. <el-form-item label="单据号:" prop="formCode">
  11. <el-input
  12. v-model="queryParams.formCode"
  13. placeholder="请输入单据号"
  14. style="width: 144px"
  15. clearable
  16. @keyup.enter="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item label="表单日期:" prop="formDate">
  20. <el-date-picker
  21. v-model="queryParams.formDate"
  22. type="date"
  23. style="width: 144px"
  24. clearable
  25. value-format="YYYY-MM-DD"
  26. placeholder="请选择表单日期"
  27. >
  28. </el-date-picker>
  29. </el-form-item>
  30. <el-form-item label="外协商名称:" prop="supplierName">
  31. <el-input
  32. v-model="queryParams.supplierName"
  33. placeholder="请输入关键字"
  34. style="width: 144px"
  35. clearable
  36. @keyup.enter="handleQuery"
  37. />
  38. </el-form-item>
  39. <el-form-item label="送货方式:" prop="deliveryMethod">
  40. <el-select
  41. v-model="queryParams.deliveryMethod"
  42. style="width: 144px"
  43. clearable
  44. placeholder="请选择"
  45. >
  46. <el-option
  47. v-for="dict in delivery_method"
  48. :key="dict.value"
  49. :label="dict.label"
  50. :value="dict.value"
  51. />
  52. </el-select>
  53. </el-form-item>
  54. <el-form-item label="带箱方式:" prop="packagingMethod">
  55. <el-select
  56. v-model="queryParams.packagingMethod"
  57. style="width: 144px"
  58. clearable
  59. placeholder="请选择"
  60. >
  61. <el-option
  62. v-for="dict in packaging_method"
  63. :key="dict.value"
  64. :label="dict.label"
  65. :value="dict.value"
  66. />
  67. </el-select>
  68. </el-form-item>
  69. <el-form-item>
  70. <el-button type="primary" icon="Search" @click="handleQuery"
  71. >搜索</el-button
  72. >
  73. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  74. </el-form-item>
  75. </el-form>
  76. <!-- 功能按钮区 -->
  77. <div class="list-btns-container">
  78. <el-button
  79. type="primary"
  80. icon="Plus"
  81. @click="handleAdd"
  82. v-hasPermi="['business:outsource:add']"
  83. >
  84. 新增
  85. </el-button>
  86. <el-button
  87. type="danger"
  88. icon="Delete"
  89. :disabled="multiple"
  90. @click="handleDelete"
  91. v-hasPermi="['business:outsource:remove']"
  92. >
  93. 删除
  94. </el-button>
  95. <el-button
  96. type="warning"
  97. icon="Download"
  98. :disabled="ids.length != 1"
  99. @click="handleExport"
  100. v-hasPermi="['business:outsource:export']"
  101. >
  102. 导出
  103. </el-button>
  104. <el-button
  105. type="warning"
  106. icon="Download"
  107. :disabled="ids.length != 1"
  108. @click="handlePrint"
  109. v-hasPermi="['business:outsource:export']"
  110. >
  111. 打印
  112. </el-button>
  113. </div>
  114. <!-- 渲染数据区 -->
  115. <div class="el-table-container">
  116. <div class="el-table-inner-container">
  117. <el-table
  118. v-loading="loading"
  119. :data="orderList"
  120. size="small"
  121. border
  122. height="100%"
  123. @selection-change="handleSelectionChange"
  124. >
  125. <el-table-column type="selection" width="48" align="center" />
  126. <el-table-column
  127. label="外协单号"
  128. align="center"
  129. prop="formCode"
  130. width="120"
  131. />
  132. <el-table-column
  133. label="外协日期"
  134. align="center"
  135. prop="formDate"
  136. width="120"
  137. >
  138. <template #default="scope">
  139. {{ parseTime(scope.row.formDate, "{y}-{m}-{d}") }}
  140. </template>
  141. </el-table-column>
  142. <el-table-column
  143. label="外协商名称"
  144. align="center"
  145. prop="supplierName"
  146. width="320"
  147. />
  148. <el-table-column
  149. label="结算方式"
  150. align="center"
  151. prop="settlementType"
  152. width="120"
  153. >
  154. <template #default="scope">
  155. <dict-tag
  156. :options="settlement_type"
  157. :value="scope.row.settlementType"
  158. />
  159. </template>
  160. </el-table-column>
  161. <el-table-column
  162. label="送货方式"
  163. align="center"
  164. prop="deliveryMethod"
  165. width="120"
  166. >
  167. <template #default="scope">
  168. <dict-tag
  169. :options="delivery_method"
  170. :value="scope.row.deliveryMethod"
  171. />
  172. </template>
  173. </el-table-column>
  174. <el-table-column
  175. label="带箱方式"
  176. align="center"
  177. prop="packagingMethod"
  178. width="120"
  179. >
  180. <template #default="scope">
  181. <dict-tag
  182. :options="packaging_method"
  183. :value="scope.row.packagingMethod"
  184. />
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="备注" align="center" prop="remark" />
  188. <el-table-column
  189. label="操作"
  190. align="center"
  191. class-name="small-padding fixed-width"
  192. width="200"
  193. >
  194. <template #default="scope">
  195. <el-button
  196. v-if="scope.row.isSubmit == 1"
  197. link
  198. type="warning"
  199. icon="Edit"
  200. @click="handleUpdate(scope.row)"
  201. v-hasPermi="['business:outsource:edit']"
  202. >
  203. 编辑
  204. </el-button>
  205. <el-button
  206. link
  207. type="primary"
  208. icon="View"
  209. @click="handleView(scope.row)"
  210. v-hasPermi="['business:outsource:query']"
  211. >
  212. 查看
  213. </el-button>
  214. <el-button
  215. link
  216. type="danger"
  217. icon="Delete"
  218. @click="handleDelete(scope.row)"
  219. v-hasPermi="['business:outsource:remove']"
  220. >
  221. 删除
  222. </el-button>
  223. </template>
  224. </el-table-column>
  225. </el-table>
  226. </div>
  227. </div>
  228. <!-- 分页 -->
  229. <pagination
  230. v-show="total > 0"
  231. :total="total"
  232. v-model:page="queryParams.pageNum"
  233. v-model:limit="queryParams.pageSize"
  234. @pagination="getList"
  235. />
  236. <!-- 表单 -->
  237. <order-form
  238. ref="orderRef"
  239. :get-list="getList"
  240. :delivery-method="delivery_method"
  241. :settlement-type="settlement_type"
  242. :packaging-method="packaging_method"
  243. />
  244. </div>
  245. </template>
  246. <script setup name="Order">
  247. import {
  248. listOrder,
  249. delOrder,
  250. exportOutsource,
  251. printOutsource,
  252. } from "@/api/business/outsourcedOrder";
  253. import orderForm from "./form";
  254. const { proxy } = getCurrentInstance();
  255. /** 字典数组区 */
  256. const { delivery_method } = proxy.useDict("delivery_method");
  257. const { settlement_type } = proxy.useDict("settlement_type");
  258. const { packaging_method } = proxy.useDict("packaging_method");
  259. const orderList = ref([]);
  260. const loading = ref(true);
  261. const del = ref(true); //选中数据是否可以删除
  262. const ids = ref([]);
  263. const single = ref(true);
  264. const multiple = ref(true);
  265. const total = ref(0);
  266. /** 查询对象 */
  267. const queryParams = ref({
  268. pageNum: 1,
  269. pageSize: 10,
  270. formCode: null,
  271. formDate: null,
  272. startTime: null,
  273. endTime: null,
  274. supplierName: null,
  275. deliveryMethod: null,
  276. packagingMethod: null,
  277. freightPrice: null,
  278. freightAmount: null,
  279. });
  280. /*********************** 方法区 ****************************/
  281. /** 查询外协单主
  282. 带箱方式,是整单的。如果换新箱子,明细中,都需要更换箱子列表 */
  283. function getList() {
  284. loading.value = true;
  285. listOrder(queryParams.value).then((response) => {
  286. orderList.value = response.rows;
  287. total.value = response.total;
  288. loading.value = false;
  289. });
  290. }
  291. /** 搜索按钮操作 */
  292. function handleQuery() {
  293. queryParams.value.pageNum = 1;
  294. getList();
  295. }
  296. /** 重置按钮操作 */
  297. function resetQuery() {
  298. proxy.resetForm("queryRef");
  299. handleQuery();
  300. }
  301. // 多选框选中数据
  302. function handleSelectionChange(selection) {
  303. ids.value = selection.map((item) => item.id);
  304. del.value = !selection.some((item) => item.isSubmit == 1);
  305. single.value = selection.length != 1;
  306. multiple.value = !selection.length;
  307. }
  308. /** 新增按钮操作 */
  309. function handleAdd() {
  310. proxy.$refs.orderRef.open();
  311. }
  312. /** 修改按钮操作 */
  313. function handleUpdate(row) {
  314. const id = row.id || ids.value;
  315. row.flag = true
  316. proxy.$refs.orderRef.open(row);
  317. }
  318. function handleView(row) {
  319. const id = row.id || ids.value;
  320. row.flag =false
  321. proxy.$refs.orderRef.open(row);
  322. }
  323. /** 删除按钮操作 */
  324. function handleDelete(row) {
  325. const _ids = row.id || ids.value;
  326. if (del.value) {
  327. proxy.$modal
  328. .confirm("是否确认删除选中的数据项?")
  329. .then(function () {
  330. return delOrder(_ids);
  331. })
  332. .then(() => {
  333. getList();
  334. proxy.$modal.msgSuccess("删除成功!");
  335. })
  336. .catch(() => {});
  337. } else {
  338. proxy.$modal.msgError("已提交单据,不能删除!");
  339. }
  340. }
  341. /** 导出按钮操作 */
  342. function handleExport() {
  343. exportOutsource({ id: ids.value[0] });
  344. }
  345. /** 导出按钮操作 */
  346. function handlePrint() {
  347. printOutsource({ id: ids.value[0] });
  348. }
  349. getList();
  350. </script>