index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  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="144"
  193. >
  194. <template #default="scope">
  195. <el-button
  196. v-if="scope.row.isSubmit == 0"
  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. v-if="scope.row.isSubmit == 1"
  207. link
  208. type="primary"
  209. icon="View"
  210. @click="handleUpdate(scope.row)"
  211. v-hasPermi="['business:outsource:query']"
  212. >
  213. 查看
  214. </el-button>
  215. <el-button
  216. v-if="scope.row.isSubmit == 0"
  217. link
  218. type="danger"
  219. icon="Delete"
  220. @click="handleDelete(scope.row)"
  221. v-hasPermi="['business:outsource:remove']"
  222. >
  223. 删除
  224. </el-button>
  225. </template>
  226. </el-table-column>
  227. </el-table>
  228. </div>
  229. </div>
  230. <!-- 分页 -->
  231. <pagination
  232. v-show="total > 0"
  233. :total="total"
  234. v-model:page="queryParams.pageNum"
  235. v-model:limit="queryParams.pageSize"
  236. @pagination="getList"
  237. />
  238. <!-- 表单 -->
  239. <order-form
  240. ref="orderRef"
  241. :get-list="getList"
  242. :delivery-method="delivery_method"
  243. :settlement-type="settlement_type"
  244. :packaging-method="packaging_method"
  245. />
  246. </div>
  247. </template>
  248. <script setup name="Order">
  249. import {
  250. listOrder,
  251. delOrder,
  252. exportOutsource,
  253. printOutsource,
  254. } from "@/api/business/outsourcedOrder";
  255. import orderForm from "./form";
  256. const { proxy } = getCurrentInstance();
  257. /** 字典数组区 */
  258. const { delivery_method } = proxy.useDict("delivery_method");
  259. const { settlement_type } = proxy.useDict("settlement_type");
  260. const { packaging_method } = proxy.useDict("packaging_method");
  261. const orderList = ref([]);
  262. const loading = ref(true);
  263. const del = ref(true); //选中数据是否可以删除
  264. const ids = ref([]);
  265. const single = ref(true);
  266. const multiple = ref(true);
  267. const total = ref(0);
  268. /** 查询对象 */
  269. const queryParams = ref({
  270. pageNum: 1,
  271. pageSize: 10,
  272. formCode: null,
  273. formDate: null,
  274. startTime: null,
  275. endTime: null,
  276. supplierName: null,
  277. deliveryMethod: null,
  278. packagingMethod: null,
  279. freightPrice: null,
  280. freightAmount: null,
  281. });
  282. /*********************** 方法区 ****************************/
  283. /** 查询外协单主
  284. 带箱方式,是整单的。如果换新箱子,明细中,都需要更换箱子列表 */
  285. function getList() {
  286. loading.value = true;
  287. listOrder(queryParams.value).then((response) => {
  288. orderList.value = response.rows;
  289. total.value = response.total;
  290. loading.value = false;
  291. });
  292. }
  293. /** 搜索按钮操作 */
  294. function handleQuery() {
  295. queryParams.value.pageNum = 1;
  296. getList();
  297. }
  298. /** 重置按钮操作 */
  299. function resetQuery() {
  300. proxy.resetForm("queryRef");
  301. handleQuery();
  302. }
  303. // 多选框选中数据
  304. function handleSelectionChange(selection) {
  305. ids.value = selection.map((item) => item.id);
  306. del.value = !selection.some((item) => item.isSubmit == 1);
  307. single.value = selection.length != 1;
  308. multiple.value = !selection.length;
  309. }
  310. /** 新增按钮操作 */
  311. function handleAdd() {
  312. proxy.$refs.orderRef.open();
  313. }
  314. /** 修改按钮操作 */
  315. function handleUpdate(row) {
  316. const id = row.id || ids.value;
  317. proxy.$refs.orderRef.open(id);
  318. }
  319. /** 删除按钮操作 */
  320. function handleDelete(row) {
  321. const _ids = row.id || ids.value;
  322. if (del.value) {
  323. proxy.$modal
  324. .confirm("是否确认删除选中的数据项?")
  325. .then(function () {
  326. return delOrder(_ids);
  327. })
  328. .then(() => {
  329. getList();
  330. proxy.$modal.msgSuccess("删除成功!");
  331. })
  332. .catch(() => {});
  333. } else {
  334. proxy.$modal.msgError("已提交单据,不能删除!");
  335. }
  336. }
  337. /** 导出按钮操作 */
  338. function handleExport() {
  339. exportOutsource({ id: ids.value[0] });
  340. }
  341. /** 导出按钮操作 */
  342. function handlePrint() {
  343. printOutsource({ id: ids.value[0] });
  344. }
  345. getList();
  346. </script>