123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576 |
- <template>
- <div>
- <Toptitle title="查看">
- <Button
- @click="handleMatchedSelectAll()"
- type="primary"
- :ghost="!isMatchedSelectAll"
- style="margin-right: 10px"
- >{{ isMatchedSelectAll ? "取消选中" : "全部选中" }}</Button
- >
- <Button
- @click="handleGoProduction(1)"
- type="primary"
- style="margin-right: 10px"
- >下生产</Button
- >
- <Button @click="back" type="primary" ghost style="margin-right: 10px"
- >返回</Button
- >
- </Toptitle>
- <Row style="padding: 10px;font-size: 18px;">
- <Col span="6">
- <span>项目编号:</span><span>{{ project_number }}</span>
- </Col>
- <Col span="6">
- <span>项目名称:</span><span>{{ project_name }}</span>
- </Col>
- </Row>
- <div class="context-tabs">
- <Row type="flex" align="middle" style="padding:10px 0">
- <Col span="5">
- <span>图号:</span>
- <span>
- <Select
- filterable
- multiple
- filter-by-label
- clearable
- transfer
- v-model="matchedInfo.image_number"
- :max-tag-count="2"
- size="small"
- style="width: 150px"
- >
- <Option
- v-for="(item, index) in urlMatchedList"
- :key="index"
- :label="item"
- :value="item"
- ></Option>
- </Select>
- </span>
- </Col>
- <Col span="5">
- <span>产品名称:</span>
- <span>
- <Select
- filterable
- multiple
- filter-by-label
- clearable
- transfer
- v-model="matchedInfo.product_name"
- :max-tag-count="2"
- size="small"
- style="width: 150px"
- >
- <Option
- v-for="(item, index) in productMatchedList"
- :key="index"
- :label="item"
- :value="item"
- ></Option>
- </Select>
- </span>
- </Col>
- <Col span="2">
- <Button @click="initData" size="small" type="primary">
- 搜索
- </Button>
- </Col>
- </Row>
- <div
- v-for="matched_info in matchedList"
- :key="matched_info.number"
- class="matched-block"
- >
- <Row type="flex" justify="space-between" align="top">
- <Col style="display:flex;justify-content: space-around;">
- <div v-if="matched_info.matching_status == 2">
- <Checkbox
- v-show="matched_info.produce_status == 0"
- v-model="matched_info.isSelect"
- @on-change="(e) => handleMatchedSelect(matched_info, e)"
- >选择</Checkbox
- >
- </div>
- <span>图号:{{ matched_info.image_number }}</span>
- </Col>
- <Col span="6">
- <span>产品名称:{{ matched_info.product_name }}</span>
- </Col>
- <Col span="2">
- <span>{{
- matched_info.matching_status == 0
- ? "未匹配"
- : matched_info.matching_status == 1
- ? "匹配中"
- : "匹配完成"
- }}</span>
- </Col>
- <Col style="display:flex;justify-content: space-between;" span="6">
- <span v-if="matched_info.matching_status == 2">
- <Button
- @click="handleGoProduction(2, matched_info)"
- type="primary"
- size="small"
- :disabled="matched_info.produce_status != 0"
- >下生产</Button
- >
- </span>
- <div>
- 总计
- <span style="color:red">{{ matched_info.num }}</span>
- 条数据
- </div>
- <div>
- <Button
- @click="handleShowCurrencyMatched(matched_info)"
- size="small"
- type="text"
- >{{ matched_info.isCurrenct ? "收缩" : "展开" }}</Button
- >
- <Icon
- size="20"
- :type="
- matched_info.isCurrenct
- ? 'md-arrow-dropdown'
- : 'md-arrow-dropright'
- "
- style="vertical-align: middle;"
- />
- </div>
- </Col>
- </Row>
- <Row style="margin-top:20px" v-if="matched_info.isCurrenct">
- <Col span="4">
- <span>区域名称:</span>
- <span>
- <Select
- filterable
- multiple
- transfer
- clearable
- filter-by-label
- v-model="matchedInfo.region"
- :max-tag-count="2"
- size="small"
- style="width: 150px"
- >
- <Option
- v-for="(item, index) in regionMatchedList"
- :key="index"
- :label="item"
- :value="item"
- ></Option>
- </Select>
- </span>
- </Col>
- <Col span="4">
- <span>房号:</span>
- <span>
- <Select
- filterable
- multiple
- transfer
- clearable
- filter-by-label
- v-model="matchedInfo.number"
- :max-tag-count="2"
- size="small"
- style="width: 150px"
- >
- <Option
- v-for="(item, index) in numberMatchedList"
- :key="index"
- :label="item"
- :value="item"
- ></Option>
- </Select>
- </span>
- </Col>
- <Col span="4">
- <span>部件名称:</span>
- <span>
- <Select
- filterable
- multiple
- transfer
- clearable
- filter-by-label
- v-model="matchedInfo.part_name"
- :max-tag-count="2"
- size="small"
- style="width: 150px"
- >
- <Option
- v-for="(item, index) in partNameMatchedList"
- :key="index"
- :label="item"
- :value="item"
- ></Option>
- </Select>
- </span>
- </Col>
- <Col span="2">
- <Button
- @click="getMatchedDetailList(matched_info)"
- size="small"
- type="primary"
- >
- 搜索
- </Button>
- </Col>
- </Row>
- <div v-if="matched_info.isCurrenct">
- <div
- v-for="(matched_detail, index) in matchedDetailList"
- :key="index"
- >
- <Row type="flex" align="middle">
- <Col span="10" style="padding:10px 0">
- <span>匹配信息:</span>
- <span
- v-for="(matched_info, index) in matched_detail.special"
- :key="index"
- >
- {{ matched_info.key }}:{{ matched_info.value }}
- </span>
- <span>{{ matched_detail.num }}组</span>
- </Col>
- <Col span="2" offset="12" style="padding:10px 0">
- <Button
- @click="handleHiddenMatchedDetail(matched_detail)"
- size="small"
- type="text"
- >
- {{ matched_detail.isHidden ? "展开" : "收缩" }}
- </Button>
- </Col>
- </Row>
- <Table
- v-show="!matched_detail.isHidden"
- :columns="matchedSheetTableColumns"
- border
- :max-height="500"
- :data="matched_detail.detail"
- >
- </Table>
- </div>
- </div>
- </div>
- </div>
- <Modal v-model="processModal" title="下生产">
- <div>
- <div class="process_modal">
- <span>生产人员:</span>
- <Select
- v-model="process_man"
- filterable
- filter-by-label
- clearable
- style="width: 150px"
- >
- <Option
- v-for="item in processManList"
- :key="item.id"
- :label="item.nickname"
- :value="item.id"
- ></Option>
- </Select>
- </div>
- <div class="process_modal">
- <span>选择时间:</span>
- <DatePicker
- type="date"
- v-model="process_start_time"
- placeholder="年/月/日"
- style="width: 150px"
- ></DatePicker>
- 至
- <DatePicker
- type="date"
- v-model="process_end_time"
- placeholder="年/月/日"
- style="width: 150px"
- ></DatePicker>
- </div>
- </div>
- <div slot="footer">
- <Button
- @click="processModal = false"
- type="primary"
- ghost
- style="margin-right: 10px"
- >取消</Button
- >
- <Button
- @click="handleProcess"
- type="primary"
- style="margin-right: 10px"
- :disabled="process_control"
- >确定</Button
- >
- </div>
- </Modal>
- </div>
- </template>
- <script>
- // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
- // 例如:import 《组件名称》 from '《组件路径》';
- export default {
- name: "",
- components: {},
- props: {},
- // import引入的组件需要注入到对象中才能使用
- data() {
- // 这里存放数据
- return {
- project_number: this.$route.query.project_number,
- project_name: this.$route.query.project_name,
- isMatchedSelectAll: false,
- matchedInfo: {
- id: this.$route.query.id,
- image_number: "",
- product_name: "",
- region: [],
- number: [],
- part_name: [],
- },
- urlMatchedList: [],
- productMatchedList: [],
- regionMatchedList: [],
- numberMatchedList: [],
- partNameMatchedList: [],
- matchedDetailList: [],
- matchedList: [],
- matchedSheetTableColumns: [
- { title: "序号", align: "center", type: "index", minWidth: 60 },
- { title: "区域名称", align: "center", key: "region", minWidth: 100 },
- { title: "房号", align: "center", key: "house_number", minWidth: 60 },
- { title: "部件名称", align: "center", key: "part_name", minWidth: 80 },
- { title: "行号", align: "center", key: "line", minWidth: 70 },
- { title: "木皮1", align: "center", key: "skin1", minWidth: 60 },
- {
- title: "原材料",
- align: "center",
- minWidth: 80,
- render: (h, params) => {
- return h("span", {}, params.row.board1 +','+params.row.board2);
- },
- },
- { title: "木皮2", align: "center", key: "skin2", minWidth: 80 },
- { title: "毛料尺寸", align: "center", key: "wool_size", minWidth: 80 },
- {
- title: "原料数量",
- align: "center",
- key: "wool_number",
- minWidth: 80,
- },
- { title: "精裁尺寸", align: "center", key: "cut_size", minWidth: 80 },
- {
- title: "零部件数量",
- align: "center",
- key: "num",
- minWidth: 90,
- },
- { title: "贴皮面积", align: "center", key: "stick", minWidth: 80 },
- { title: "精裁面积", align: "center", key: "cut", minWidth: 80 },
- { title: "是否打印", align: "center", key: "chip_state", minWidth: 80 , render: (h, params) => {
- return h("span", {}, params.row.chip_state==0?'否':'是');
- }},
- { title: "工艺要求", align: "center", key: "remark", minWidth: 80 },
- ], //匹配表头
- processModal: false,
- process_man: "",
- processManList: [],
- process_start_time: "",
- process_end_time: "",
- process_control: false,
- cut_order_product_ids: [],
- matchedSelectedList: [],
- };
- },
- // 生命周期 - 创建完成(可以访问当前this实例)
- created() {
- this.axios("/api/user").then(
- (res) => (this.processManList = res.data.data)
- );
- },
- // 生命周期 - 挂载完成(可以访问DOM元素)
- mounted() {
- this.initData();
- },
- methods: {
- handleMatchedSelectAll(){
- this.isMatchedSelectAll = !this.isMatchedSelectAll;
- this.matchedSelectedList = [];
- this.matchedList.map((v) => {
- if (v.produce_status == 0) {
- v.isSelect = this.isMatchedSelectAll;
- if(v.isSelect){
- this.matchedSelectedList.push(v.id)
- }
- }
- });
- },
- handleMatchedSelect(row, e) {
- row.isSelect = e;
- console.log(row);
- let flag = true;
- this.matchedSelectedList = [];
- this.matchedList.map((v) => {
- if (v.produce_status == 0) {
- if (v.isSelect) {
- this.matchedSelectedList.push(v.id);
- } else {
- flag = false;
- }
- }
- });
- this.isMatchedSelectAll = flag;
- this.cut_order_product_ids = this.matchedSelectedList;
- console.log(this.cut_order_product_ids);
- },
- back() {
- this.$router.go(-1);
- },
- handleGoProduction(type, row) {
- if (this.matchedSelectedList.length == 0) {
- return this.$Message.warning("请选择");
- }
- if (type === 2) {
- this.cut_order_product_ids = [row.id];
- } else {
- this.cut_order_product_ids = this.matchedSelectedList;
- }
- this.processModal = true;
- },
- handleProcess() {
- this.process_control = true;
- console.log(this.cut_order_product_ids);
- this.axios({
- method: "post",
- url: "/api/bst_pull",
- data: {
- cut_order_product_ids: this.cut_order_product_ids,
- process_man: this.process_man,
- process_start_time: this.func.replaceDateNoHMS(
- this.process_start_time
- ),
- process_end_time: this.func.replaceDateNoHMS(this.process_end_time),
- },
- }).then((res) => {
- if (res.code == 200) {
- this.$Message.success(res.msg);
- this.processModal = false;
- this.matchedSelectedList = [];
- this.initData();
- }
- setTimeout(() => {
- this.process_control = false;
- }, 500);
- });
- },
- initData() {
- this.axios
- .get("/api/bst_matching_on_list", {
- params: {
- id: this.matchedInfo.id,
- image_number: this.matchedInfo.image_number,
- product_name: this.matchedInfo.product_name,
- },
- })
- .then((res) => {
- this.matchedList = [];
- res.data.list.map((v) => {
- v.isCurrenct = false;
- });
- this.urlMatchedList = res.data.image_number;
- this.productMatchedList = res.data.product_name;
- // this.matchedList = res.data.list;
- res.data.list.forEach((v, index) => {
- if (v.matching_status == 2) {
- this.matchedList.push(v);
- }
- });
- });
- },
- handleHiddenMatchedDetail(row) {
- if (row.isHidden) {
- row.isHidden = !row.isHidden;
- } else {
- row.isHidden = true;
- }
- this.$forceUpdate();
- },
- handleShowCurrencyMatched(row) {
- if (row.isCurrenct) {
- row.isCurrenct = !row.isCurrenct;
- } else {
- this.matchedList.map((v) => (v.isCurrenct = false));
- row.isCurrenct = true;
- }
- this.getMatchedDetailList(row);
- },
- getMatchedDetailList(row) {
- row.isCurrenct &&
- this.axios
- .post("/api/bst_matching_on_detail", {
- cut_order_product_id: row.id,
- id: this.matchedInfo.id,
- number: this.matchedInfo.number,
- part_name: this.matchedInfo.part_name,
- region: this.matchedInfo.region,
- })
- .then((res) => {
- this.regionMatchedList = res.data.region;
- this.numberMatchedList = res.data.number;
- this.partNameMatchedList = res.data.part_name;
- this.matchedDetailList = res.data.list;
- });
- },
- },
- // 监听属性 类似于data概念
- computed: {},
- // 监控data中的数据变化
- watch: {},
- beforeCreate() {}, // 生命周期 - 创建之前
- beforeMount() {}, // 生命周期 - 挂载之前
- beforeUpdate() {}, // 生命周期 - 更新之前
- updated() {}, // 生命周期 - 更新之后
- beforeDestroy() {}, // 生命周期 - 销毁之前
- destroyed() {}, // 生命周期 - 销毁完成
- activated() {}, // 如果页面有keep-alive缓存功能,这个函数会触发
- };
- </script>
- <style lang="scss" scoped>
- .context-tabs {
- position: relative;
- max-height: 650px;
- overflow: hidden;
- overflow-y: auto;
- padding: 15px;
- margin: 10px;
- margin-bottom: 30px;
- border-radius: 5px;
- box-shadow: 1px 1px 5px 1px #999;
- }
- .matched-block {
- padding: 15px;
- margin-bottom: 30px;
- background-color: #e9ecef;
- border-radius: 5px;
- }
- .process_modal {
- display: flex;
- justify-content: center;
- align-items: center;
- padding: 10px;
- }
- </style>
|